nx_server_plugin_sdk 1.0 Server Plugin SDK

video_packet.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #ifndef RPI_VIDEO_PACKET_H
4 #define RPI_VIDEO_PACKET_H
5
6 #include <memory>
7
8 #include <camera/camera_plugin.h>
9 #include <plugins/plugin_tools.h>
10
11 #include "ref_counter.h"
12
13 namespace rpi_cam
14 {
16 class VideoPacket : public DefaultRefCounter<nxcip::VideoDataPacket>
17 {
18 public:
19 VideoPacket()
20 : m_data( nullptr ),
21 m_size( 0 )
22 {}
23
24 VideoPacket(const uint8_t * data, size_t size, uint64_t ts, unsigned flags);
25 virtual ~VideoPacket();
26
27 // nxpl::PluginInterface
28
29 virtual void * queryInterface( const nxpl::NX_GUID& interfaceID ) override;
30
31 // nxpl::MediaDataPacket
32
33 virtual nxcip::UsecUTCTimestamp timestamp() const override;
34 virtual nxcip::DataPacketType type() const override;
35 virtual const void* data() const override;
36 virtual unsigned int dataSize() const override;
37 virtual unsigned int channelNumber() const override;
38 virtual nxcip::CompressionType codecType() const override;
39 virtual unsigned int flags() const override;
40 virtual unsigned int cSeq() const override;
41 virtual nxcip::Picture* getMotionData() const override;
42
43 //
44
45 void swap(VideoPacket& vp)
46 {
47 using std::swap;
48
49 m_data.swap(vp.m_data);
50 swap(m_size, vp.m_size);
51 swap(m_time, vp.m_time);
52 swap(m_flags, vp.m_flags);
53 }
54
55 private:
56 std::shared_ptr<uint8_t> m_data;
57 size_t m_size;
58 nxcip::UsecUTCTimestamp m_time;
59 unsigned m_flags;
60 };
61 }
62
63 #endif
nxcip::DataPacketType
DataPacketType
Type of packets provided by StreamReader.
Definition: camera_plugin.h:1010
rpi_cam::VideoPacket
Definition: video_packet.h:16
rpi_cam
Raspberry Pi camera unit and configuration.
Definition: camera_manager.cpp:21
rpi_cam::VideoPacket::data
virtual const void * data() const override
Coded media stream data.
Definition: video_packet.cpp:63
rpi_cam::VideoPacket::cSeq
virtual unsigned int cSeq() const override
Returns sequence number of command this packet belongs to.
Definition: video_packet.cpp:88
rpi_cam::VideoPacket::codecType
virtual nxcip::CompressionType codecType() const override
Definition: video_packet.cpp:78
rpi_cam::VideoPacket::channelNumber
virtual unsigned int channelNumber() const override
Definition: video_packet.cpp:73
rpi_cam::VideoPacket::timestamp
virtual nxcip::UsecUTCTimestamp timestamp() const override
Packet&#39;s timestamp (usec (microseconds) since 1970-01-01, UTC)
Definition: video_packet.cpp:53
nxpl::NX_GUID
GUID of plugin interface.
Definition: plugin_api.h:26
rpi_cam::VideoPacket::flags
virtual unsigned int flags() const override
Returns combination of values from MediaDataPacket::Flags enumeration.
Definition: video_packet.cpp:83
rpi_cam::VideoPacket::type
virtual nxcip::DataPacketType type() const override
Packet type.
Definition: video_packet.cpp:58
nxcip::Picture
Picture.
Definition: camera_plugin.h:654
rpi_cam::VideoPacket::queryInterface
virtual void * queryInterface(const nxpl::NX_GUID &interfaceID) override
Cast to type, specified by interfaceID.
Definition: video_packet.cpp:37
rpi_cam::VideoPacket::getMotionData
virtual nxcip::Picture * getMotionData() const override
Returns motion data. Can be NULL, if no motion.
Definition: video_packet.cpp:93
plugin_tools.h
rpi_cam::DefaultRefCounter
Definition: ref_counter.h:11
rpi_cam::VideoPacket::dataSize
virtual unsigned int dataSize() const override
Returns size (in bytes) of packet&#39;s data.
Definition: video_packet.cpp:68