nx_server_plugin_sdk 1.0 Server Plugin SDK

stream_reader.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #ifndef RPI_STREAM_READER_H
4 #define RPI_STREAM_READER_H
5
6 #include <atomic>
7 #include <memory>
8 #include <vector>
9
10 #include <camera/camera_plugin.h>
11 #include <plugins/plugin_tools.h>
12
13 #include "ref_counter.h"
14 #include "timer.h"
15
16 namespace rpi_cam
17 {
18 class RPiCamera;
19
21 class StreamReader : public DefaultRefCounter<nxcip::StreamReader>
22 {
23 public:
24 StreamReader(std::shared_ptr<RPiCamera> camera, unsigned encoderNumber);
25 virtual ~StreamReader();
26
27 // nxpl::PluginInterface
28
29 virtual void * queryInterface( const nxpl::NX_GUID& interfaceID ) override;
30
31 // nxcip::StreamReader
32
33 virtual int getNextData(nxcip::MediaDataPacket** packet) override;
34 virtual void interrupt() override;
35
36 //
37
38 private:
39 std::weak_ptr<RPiCamera> m_camera;
40 unsigned m_encoderNumber;
41 std::vector<uint8_t> m_data;
42 static TimeCorrection m_timeCorrect;
43 uint64_t m_pts;
44
45 std::atomic_bool m_interrupt;
46 };
47 }
48
49 #endif
rpi_cam::StreamReader::interrupt
virtual void interrupt() override
Interrupt StreamReader::getNextData blocked in other thread.
Definition: stream_reader.cpp:38
rpi_cam
Raspberry Pi camera unit and configuration.
Definition: camera_manager.cpp:21
rpi_cam::StreamReader
Definition: stream_reader.h:21
rpi_cam::StreamReader::getNextData
virtual int getNextData(nxcip::MediaDataPacket **packet) override
Returns media packet or NULL in case of error.
Definition: stream_reader.cpp:43
nxpl::NX_GUID
GUID of plugin interface.
Definition: plugin_api.h:26
rpi_cam::TimeCorrection
PTS to timestamps converter.
Definition: timer.h:12
plugin_tools.h
rpi_cam::DefaultRefCounter
Definition: ref_counter.h:11
nxcip::MediaDataPacket
Portion of media data.
Definition: camera_plugin.h:1037
rpi_cam::StreamReader::queryInterface
virtual void * queryInterface(const nxpl::NX_GUID &interfaceID) override
Cast to type, specified by interfaceID.
Definition: stream_reader.cpp:27