nx_server_plugin_sdk 1.0 Server Plugin SDK

Public Types | Public Member Functions | List of all members
nxcip::MediaDataPacket Class Referenceabstract

Portion of media data. More...

`#include <camera_plugin.h>`

Inheritance diagram for nxcip::MediaDataPacket:

## Public Types
enum | Flags { fKeyPacket = 0x01, fReverseStream = 0x02, fReverseBlockStart = 0x04, DEPRECATED_fLowQuality = 0x08, fStreamReset = 0x10 }

## Public Member Functions
virtual UsecUTCTimestamp | timestamp () const =0
| Packet's timestamp (usec (microseconds) since 1970-01-01, UTC)
virtual DataPacketType | type () const =0
| Packet type.
virtual const void * | data () const =0
| Coded media stream data. More...
virtual unsigned int | dataSize () const =0
| Returns size (in bytes) of packet's data. More...
virtual unsigned int | channelNumber () const =0
virtual CompressionType | codecType () const =0
virtual unsigned int | flags () const =0
| Returns combination of values from MediaDataPacket::Flags enumeration.
virtual unsigned int | cSeq () const =0
| Returns sequence number of command this packet belongs to. More...
Public Member Functions inherited from nxpl::PluginInterface
virtual void * | queryInterface (const nxpl::NX_GUID &interfaceID)=0
| Cast to type, specified by interfaceID. More...
virtual int | addRef () const =0
| Increment reference counter. More...
virtual int | releaseRef () const =0
| Decrement reference counter. More...

## Detailed Description

Portion of media data.

Warning
  Buffer returned by MediaDataPacket::data() MUST be MEDIA_PACKET_BUFFER_PADDING_SIZE larger than MediaDataPacket::dataSize() returns and this padding MUST be filled with zeros. This is required by decoder, since this buffer may (and will!) be used as decoder input

## Member Enumeration Documentation

## ◆ Flags

enum nxcip::MediaDataPacket::Flags

Enumerator
fKeyPacket | e.g., h.264 IDR frame
fReverseStream | packet has been generated during playback of reverse stream. Packets of type dptEmpty MUST have this flag set if end-of-stream has been reached with reverse mode
fReverseBlockStart | set in first packet of gop block of reverse stream (see nxcip::DtsArchiveReader::setReverseMode)
fStreamReset | MUST be set after each nxcip::DtsArchiveReader::seek, nxcip::DtsArchiveReader::reverseModeCapability, nxcip::DtsArchiveReader::setQuality to signal discontinuity in timestamp

## Member Function Documentation

## ◆ channelNumber()

virtual unsigned int nxcip::MediaDataPacket::channelNumber | ( |  | ) | const
| pure virtual

For video packet data contains number of camera sensor starting with 0 (e.g., panoramic camera has multiple sensors).
For audio, this is audio track number (in case of multiple microphones on camera device)

Implemented in rpi_cam::VideoPacket, ILPEmptyPacket, and ILPVideoPacket.

## ◆ codecType()

virtual CompressionType nxcip::MediaDataPacket::codecType | ( |  | ) | const
| pure virtual

Returns
  Any valid video or audio codec. The values AV_CODEC_ID_NONE, AV_CODEC_ID_TEXT and AV_CODEC_ID_BIN_DATA are currently not supported. Uncompressed video formats are currently not supported.

Implemented in ILPEmptyPacket, ILPVideoPacket, and rpi_cam::VideoPacket.

## ◆ cSeq()

virtual unsigned int nxcip::MediaDataPacket::cSeq | ( |  | ) | const
| pure virtual

Returns sequence number of command this packet belongs to.

Command - it is a call to DtsArchiveReader::seek, DtsArchiveReader::setReverseMode, DtsArchiveReader::playRange. In case of live stream cSeq is ignored

Implemented in ILPEmptyPacket, ILPVideoPacket, and rpi_cam::VideoPacket.

## ◆ data()

virtual const void* nxcip::MediaDataPacket::data | ( |  | ) | const
| pure virtual

Coded media stream data.

Data format for different codecs:

- h.264 (nxcip::AV_CODEC_ID_H264): [iso-14496-10, AnnexB] byte stream. SPS and PPS MUST be available in the stream. It is recommended that SPS and PPS are repeated before each group of pictures
- motion jpeg (nxcip::AV_CODEC_ID_MJPEG): Each packet is a complete jpeg picture
- aac (nxcip::AV_CODEC_ID_AAC): ADTS stream
  Returns
    Media data. Returned buffer MUST be aligned on MEDIA_DATA_BUFFER_ALIGNMENT - byte boundary (this restriction helps for some optimization). nx::kit::utils::mallocAligned and nx::kit::utils::freeAligned routines can be used for that purpose
  Warning
    Actual buffer size MUST be MEDIA_PACKET_BUFFER_PADDING_SIZE larger than MediaDataPacket::dataSize() returns and this padding MUST be filled with zeros. This is required by decoder, since this buffer may (and will!) be used as decoder input

Implemented in rpi_cam::VideoPacket, ILPEmptyPacket, and ILPVideoPacket.

## ◆ dataSize()

virtual unsigned int nxcip::MediaDataPacket::dataSize | ( |  | ) | const
| pure virtual

Returns size (in bytes) of packet's data.

Warning
  Actual buffer size MUST be MEDIA_PACKET_BUFFER_PADDING_SIZE larger than this method returns and this padding MUST be filled with zeros. This is required by decoder, since this buffer may (and will!) be used as decoder input

Implemented in rpi_cam::VideoPacket, ILPEmptyPacket, and ILPVideoPacket.

The documentation for this class was generated from the following file:

- src/camera/camera_plugin.h