stub_analytics_plugin  1.6
Network Optix Video Analytics SDK
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
nx::sdk::analytics::VideoFrameProcessingDeviceAgent Class Referenceabstract

#include <video_frame_processing_device_agent.h>

Inheritance diagram for nx::sdk::analytics::VideoFrameProcessingDeviceAgent:
nx::sdk::RefCountable< IConsumingDeviceAgent > nx::vms_server_plugins::analytics::stub::DeviceAgent

Public Member Functions

template<typename DerivedEngine >
DerivedEngine * engineCasted () const
 
virtual IEngineengine () const override
 
virtual Error setHandler (IDeviceAgent::IHandler *handler) override
 
virtual Error pushDataPacket (IDataPacket *dataPacket) override
 
virtual const IStringmanifest (Error *error) const override
 
virtual void setSettings (const IStringMap *settings) override
 
virtual IStringMappluginSideSettings () const override
 
- Public Member Functions inherited from nx::sdk::RefCountable< IConsumingDeviceAgent >
 RefCountable (const RefCountable &)=delete
 
 RefCountable (RefCountable &&)=delete
 
RefCountableoperator= (const RefCountable &)=delete
 
RefCountableoperator= (RefCountable &&)=delete
 
virtual int addRef () const override
 
virtual int releaseRef () const override
 
int refCount () const
 
virtual IRefCountablequeryInterface (InterfaceId id)
 
const IRefCountablequeryInterface (InterfaceId id) const
 
InterfacequeryInterface ()
 
const InterfacequeryInterface () const
 

Protected Member Functions

 VideoFrameProcessingDeviceAgent (IEngine *engine, const IDeviceInfo *deviceInfo, bool enableOutput, const std::string &printPrefix="")
 
virtual std::string manifest () const =0
 
virtual bool pushCompressedVideoFrame (const ICompressedVideoPacket *)
 
virtual bool pushUncompressedVideoFrame (const IUncompressedVideoFrame *)
 
virtual bool pullMetadataPackets (std::vector< IMetadataPacket *> *)
 
void pushMetadataPacket (IMetadataPacket *metadataPacket)
 
void pushPluginEvent (IPluginEvent::Level level, std::string caption, std::string description)
 
virtual void settingsReceived ()
 
std::string getParamValue (const char *paramName)
 
virtual Error setNeededMetadataTypes (const IMetadataTypes *metadataTypes) override=0
 

Protected Attributes

const LogUtils logUtils
 

Detailed Description

Base class for a typical implementation of DeviceAgent which receives video frames and sends back constructed metadata packets. Hides many technical details of Analytics SDK, but may limit DeviceAgent capabilities - use only when suitable.

To use NX_PRINT/NX_OUTPUT in a derived class with the prefix defined by this class, add the following to the derived class .cpp:


    #define NX_PRINT_PREFIX (this->logUtils.printPrefix)
    #include <nx/kit/debug.h>

Constructor & Destructor Documentation

◆ VideoFrameProcessingDeviceAgent()

nx::sdk::analytics::VideoFrameProcessingDeviceAgent::VideoFrameProcessingDeviceAgent ( IEngine engine,
const IDeviceInfo deviceInfo,
bool  enableOutput,
const std::string &  printPrefix = "" 
)
protected
Parameters
enableOutputEnables NX_OUTPUT. Typically, use NX_DEBUG_ENABLE_OUTPUT as a value.
printPrefixPrefix for NX_PRINT and NX_OUTPUT. If empty, will be made from Engine's libName().

Member Function Documentation

◆ engineCasted()

template<typename DerivedEngine >
DerivedEngine* nx::sdk::analytics::VideoFrameProcessingDeviceAgent::engineCasted ( ) const
inline

Intended to be called from a method of a derived class overriding engine().

Returns
Parent Engine, casted to the specified type.

◆ getParamValue()

std::string nx::sdk::analytics::VideoFrameProcessingDeviceAgent::getParamValue ( const char *  paramName)
protected

Provides access to the Manager settings stored by the server for a particular Resource. ATTENTION: If settingsReceived() has not been called yet, it means that the DeviceAgent has not received its settings from the server yet, and thus this method will yield empty values.

Returns
Param value, or an empty string if such param does not exist, having logged the error.

◆ pullMetadataPackets()

virtual bool nx::sdk::analytics::VideoFrameProcessingDeviceAgent::pullMetadataPackets ( std::vector< IMetadataPacket *> *  )
inlineprotectedvirtual

Override to send the newly constructed metadata packets to Server - add the packets to the provided list. Called after pushVideoFrame() to retrieve any metadata packets available to the moment (not necessarily referring to that frame). As an alternative, send metadata to Server by calling pushMetadataPacket() instead of implementing this method.

◆ pushCompressedVideoFrame()

virtual bool nx::sdk::analytics::VideoFrameProcessingDeviceAgent::pushCompressedVideoFrame ( const ICompressedVideoPacket )
inlineprotectedvirtual

Override to accept next compressed video frame for processing. Should not block the caller thread for long.

Parameters
videoFrameContains a pointer to the compressed video frame raw bytes. The lifetime (validity) of this pointer is the same as of videoFrame. Thus, it can be extended by addRef() or queryInterface() inside this method.

Reimplemented in nx::vms_server_plugins::analytics::stub::DeviceAgent.

◆ pushMetadataPacket()

void nx::sdk::analytics::VideoFrameProcessingDeviceAgent::pushMetadataPacket ( IMetadataPacket metadataPacket)
protected

Send a newly constructed metadata packet to Server. Can be called at any time, from any thread. As an alternative, send metadata to Server by implementing pullMetadataPackets().

◆ pushPluginEvent()

void nx::sdk::analytics::VideoFrameProcessingDeviceAgent::pushPluginEvent ( IPluginEvent::Level  level,
std::string  caption,
std::string  description 
)
protected

Sends a PluginEvent to the Server. Can be called from any thread, but if called before settingsReceived() was called, will be ignored in case setHandler() was not called yet.

◆ pushUncompressedVideoFrame()

virtual bool nx::sdk::analytics::VideoFrameProcessingDeviceAgent::pushUncompressedVideoFrame ( const IUncompressedVideoFrame )
inlineprotectedvirtual

Override to accept next uncompressed video frame for processing.

Parameters
videoFrameContains a pointer to the compressed video frame raw bytes. The lifetime (validity) of this pointer is the same as of videoFrame. Thus, it can be extended by addRef() or queryInterface() inside this method.

Reimplemented in nx::vms_server_plugins::analytics::stub::DeviceAgent.

◆ settingsReceived()

virtual void nx::sdk::analytics::VideoFrameProcessingDeviceAgent::settingsReceived ( )
inlineprotectedvirtual

Called when the settings are received from the server (even if the values are not changed). Should perform any required (re)initialization. Called even if the settings model is empty.

Reimplemented in nx::vms_server_plugins::analytics::stub::DeviceAgent.


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