nx_server_plugin_sdk 1.0 Server Plugin SDK

media_encoder.h
1 // Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
2
3 #pragma once
4
5 #include <memory>
6
7 #include <camera/camera_plugin.h>
8 #include <plugins/plugin_tools.h>
9
10 #include "stream_reader.h"
11
12 class CameraManager;
13
17 class MediaEncoder
18 :
19 public nxcip::CameraMediaEncoder2
20 {
21 public:
22 MediaEncoder(
23 CameraManager* const cameraManager,
24 int encoderNumber,
25 unsigned int frameDurationUsec );
26 virtual ~MediaEncoder();
27
29 virtual void* queryInterface( const nxpl::NX_GUID& interfaceID ) override;
31 virtual int addRef() const override;
33 virtual int releaseRef() const override;
34
36 virtual int getMediaUrl( char* urlBuf ) const override;
38 virtual int getResolutionList( nxcip::ResolutionInfo* infoList, int* infoListCount ) const override;
40 virtual int getMaxBitrate( int* maxBitrate ) const override;
42 virtual int setResolution( const nxcip::Resolution& resolution ) override;
44 virtual int setFps( const float& fps, float* selectedFps ) override;
46 virtual int setBitrate( int bitrateKbps, int* selectedBitrateKbps ) override;
47
49 virtual nxcip::StreamReader* getLiveStreamReader() override;
50 virtual int getAudioFormat( nxcip::AudioFormat* format ) const override;
51
52 private:
53 nxpt::CommonRefManager m_refManager;
54 CameraManager* m_cameraManager;
55 std::unique_ptr<StreamReader> m_streamReader;
56 unsigned int m_frameDurationUsec;
57 int m_encoderNumber;
58 };
MediaEncoder::setFps
virtual int setFps(const float &fps, float *selectedFps) override
Implementation of nxcip::CameraMediaEncoder::setFps.
Definition: media_encoder.cpp:77
MediaEncoder::getResolutionList
virtual int getResolutionList(nxcip::ResolutionInfo *infoList, int *infoListCount) const override
Implementation of nxcip::CameraMediaEncoder::getResolutionList.
Definition: media_encoder.cpp:60
nxcip::ResolutionInfo
Contains resolution and maximum fps, supported by camera for this resolution.
Definition: camera_plugin.h:282
nxcip::AudioFormat
Definition: camera_plugin.h:362
MediaEncoder::getLiveStreamReader
virtual nxcip::StreamReader * getLiveStreamReader() override
Implementation of nxcip::CameraMediaEncoder::setBitrate.
Definition: media_encoder.cpp:87
nxcip::StreamReader
Used for reading media stream from camera.
Definition: camera_plugin.h:1168
MediaEncoder::setResolution
virtual int setResolution(const nxcip::Resolution &resolution) override
Implementation of nxcip::CameraMediaEncoder::setResolution.
Definition: media_encoder.cpp:72
CameraManager
Definition: camera_manager.h:14
nxpl::NX_GUID
GUID of plugin interface.
Definition: plugin_api.h:26
MediaEncoder::getAudioFormat
virtual int getAudioFormat(nxcip::AudioFormat *format) const override
Returns audio format, if audio is supported.
Definition: media_encoder.cpp:101
nxcip::Resolution
Resolution of video stream picture.
Definition: camera_plugin.h:266
MediaEncoder::queryInterface
virtual void * queryInterface(const nxpl::NX_GUID &interfaceID) override
Implementation of nxpl::PluginInterface::queryInterface.
Definition: media_encoder.cpp:24
MediaEncoder::getMaxBitrate
virtual int getMaxBitrate(int *maxBitrate) const override
Implementation of nxcip::CameraMediaEncoder::getMaxBitrate.
Definition: media_encoder.cpp:66
nxcip::CameraMediaEncoder2
Extends CameraMediaEncoder by adding functionality for plugin to directly provide live media stream...
Definition: camera_plugin.h:417
MediaEncoder::addRef
virtual int addRef() const override
Implementation of nxpl::PluginInterface::addRef.
Definition: media_encoder.cpp:44
nxpt::CommonRefManager
Definition: plugin_tools.h:67
MediaEncoder::releaseRef
virtual int releaseRef() const override
Implementation of nxpl::PluginInterface::releaseRef.
Definition: media_encoder.cpp:49
MediaEncoder::getMediaUrl
virtual int getMediaUrl(char *urlBuf) const override
Implementation of nxcip::CameraMediaEncoder::getMediaUrl.
Definition: media_encoder.cpp:54
plugin_tools.h
MediaEncoder::setBitrate
virtual int setBitrate(int bitrateKbps, int *selectedBitrateKbps) override
Implementation of nxcip::CameraMediaEncoder::setBitrate.
Definition: media_encoder.cpp:82
MediaEncoder
Definition: media_encoder.h:17