nx_server_plugin_sdk 1.0 Server Plugin SDK

Public Member Functions | List of all members
rpi_cam::VideoPacket Class Reference
Inheritance diagram for rpi_cam::VideoPacket:

## Public Member Functions
| VideoPacket (const uint8_t *data, size_t size, uint64_t ts, unsigned flags)
virtual void * | queryInterface (const nxpl::NX_GUID &interfaceID) override
| Cast to type, specified by interfaceID. More...
virtual nxcip::UsecUTCTimestamp | timestamp () const override
| Packet's timestamp (usec (microseconds) since 1970-01-01, UTC)
virtual nxcip::DataPacketType | type () const override
| Packet type.
virtual const void * | data () const override
| Coded media stream data. More...
virtual unsigned int | dataSize () const override
| Returns size (in bytes) of packet's data. More...
virtual unsigned int | channelNumber () const override
virtual nxcip::CompressionType | codecType () const override
virtual unsigned int | flags () const override
| Returns combination of values from MediaDataPacket::Flags enumeration.
virtual unsigned int | cSeq () const override
| Returns sequence number of command this packet belongs to. More...
virtual nxcip::Picture * | getMotionData () const override
| Returns motion data. Can be NULL, if no motion. More...
void | swap (VideoPacket &vp)
Public Member Functions inherited from rpi_cam::DefaultRefCounter< nxcip::VideoDataPacket >
virtual int | addRef () const override
virtual int | releaseRef () const override

## Additional Inherited Members
Public Types inherited from nxcip::MediaDataPacket
enum | Flags { fKeyPacket = 0x01, fReverseStream = 0x02, fReverseBlockStart = 0x04, DEPRECATED_fLowQuality = 0x08, fStreamReset = 0x10 }
Protected Member Functions inherited from rpi_cam::DefaultRefCounter< nxcip::VideoDataPacket >
| DefaultRefCounter (nxpt::CommonRefManager *refManager)
Protected Attributes inherited from rpi_cam::DefaultRefCounter< nxcip::VideoDataPacket >
nxpt::CommonRefManager | m_refManager

## Member Function Documentation

## ◆ channelNumber()

unsigned int rpi_cam::VideoPacket::channelNumber | ( |  | ) | const
| overridevirtual

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)

Implements nxcip::MediaDataPacket.

## ◆ codecType()

nxcip::CompressionType rpi_cam::VideoPacket::codecType | ( |  | ) | const
| overridevirtual

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.

Implements nxcip::MediaDataPacket.

## ◆ cSeq()

unsigned int rpi_cam::VideoPacket::cSeq | ( |  | ) | const
| overridevirtual

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

Implements nxcip::MediaDataPacket.

## ◆ data()

const void * rpi_cam::VideoPacket::data | ( |  | ) | const
| overridevirtual

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

Implements nxcip::MediaDataPacket.

## ◆ dataSize()

unsigned int rpi_cam::VideoPacket::dataSize | ( |  | ) | const
| overridevirtual

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

Implements nxcip::MediaDataPacket.

## ◆ getMotionData()

nxcip::Picture * rpi_cam::VideoPacket::getMotionData | ( |  | ) | const
| overridevirtual

Returns motion data. Can be NULL, if no motion.

Motion data is a monochrome (format nxcip::AV_PIX_FMT_MONOBLACK) picture of size (nxcip::DEFAULT_MOTION_DATA_PICTURE_WIDTH, nxcip::DEFAULT_MOTION_DATA_PICTURE_HEIGHT) pixels, '1' bit designates motion presence in that pixel. It is not required that motion data dimensions same as those of video picture. Motion data just designates regions of video picture where motion has been detected.

Warning
  motion data MUST be rotated by 90 degrees clock-wise! That means, picture returned here is nxcip::DEFAULT_MOTION_DATA_PICTURE_HEIGHT pixels wide and nxcip::DEFAULT_MOTION_DATA_PICTURE_WIDTH pixels height

Returns
  motion data

Note
  size (DEFAULT_MOTION_DATA_PICTURE_WIDTH, DEFAULT_MOTION_DATA_PICTURE_HEIGHT) pixels is required! If picture has greater size, only required region will be used. If picture has less size, considering that missing region contains no motion

Implements nxcip::VideoDataPacket.

## ◆ queryInterface()

void * rpi_cam::VideoPacket::queryInterface | ( | const nxpl::NX_GUID & | interfaceID | ) |
| overridevirtual

Cast to type, specified by interfaceID.

If pointer cannot be cast, NULL MUST be returned

Returns
  If not NULL, returned pointer can be safely cast to type, defined by interfaceID

Note
  This method increments reference counter

Implements nxpl::PluginInterface.

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

- samples/device/rpi_camera_plugin/src/video_packet.h
- samples/device/rpi_camera_plugin/src/video_packet.cpp