13.07.2015 Views

System Integration Guide ONVIF Network Video Transmitter Suite ...

System Integration Guide ONVIF Network Video Transmitter Suite ...

System Integration Guide ONVIF Network Video Transmitter Suite ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

www.synesis.ru | +7 (495) 660-77-47 | +1 (646) 536 7123 | +375 (17) 281-77-91Russia, 119019, Moscow Gogolevskiy bulvard, dom 2/18/1, stroenie 1<strong>System</strong> <strong>Integration</strong> <strong>Guide</strong><strong>ONVIF</strong> <strong>Network</strong> <strong>Video</strong> <strong>Transmitter</strong> <strong>Suite</strong> with Edge AnalyticsIntroductionSynesis’ <strong>ONVIF</strong> <strong>Network</strong> <strong>Video</strong> <strong>Transmitter</strong> (NVT) <strong>Suite</strong>with Edge Analytics enables security solution providersto release intelligent video surveillance devices such asIP-cameras and video encoders compliant with theglobal standard <strong>ONVIF</strong>. The customer quickly creates itsdifferentiating IP while reducing the time to marketand avoiding th e costs of <strong>ONVIF</strong> protocol stackmaintenance. The suite provides an abstraction layerfor platform dependent services and libraries.Rich feature set based on industry standardThe following feature blocks are available in Synesis’reference designs based on the <strong>ONVIF</strong> NVT suite: <strong>Network</strong> device discovery Live video streaming <strong>Video</strong> capture configuration <strong>Video</strong> compression configuration <strong>Video</strong> analytics configuration Event and metadata configuration Rule management for alerts Secure firmware update(with optional software copy protection) Local storage / network storage recording PTZ camera controlThe present implementation matches <strong>ONVIF</strong> version1.02 while certain advanced features are designed inconsideration of the <strong>ONVIF</strong> 2.0 draft. The standardconformance is validated by the community test tools,third-party VMS integration and internal QA.<strong>ONVIF</strong> NVT software frameworkThe modular and flexible architecture of themiddleware suite provides cost-effective softwarecustomization, third-party integration andmaintenance. The suite consists of the followingcomponents as shown in the Figure: Onvifd serves <strong>ONVIF</strong> requests from network videoclients (NVC). Streamer transmits multimedia by RTSP/RTPprotocol.Router routes messages between components.User application provides access to a source ofvideo and/or audio data. It also can containimplementation of data processing such asfiltering, video analytics, event raising, etc.Communication between components is done bysending messages to the Router and further routingthem to the appropriate one or more receivers.The IP device can be integrated with legacy videomanagement systems (without <strong>ONVIF</strong> support) bymapping <strong>ONVIF</strong> calls onto a custom protocol handler.In this way, alternative protocols such as PSIA can besupported.For multiple channel configurations, the middleware isintegrated with H.264 AVC Main Profile codec fromIttiam. Third-party codecs are supported via the TI’sCodec Engine (xDAIS) interface. <strong>Video</strong> analytics andmetadata streaming is available on all channels.Intelligent video pipelineThe suite is integrated with a camera calibrator,professional video analytics, tampering detectors,various digital filters and a range of codes. Theseextensions are customisable.Metadata InMetadata OutCMDcgi-scriptcgi-servercgi-servercgi-serversocketonvifdonvif lib/etc/onvif.cfgOnvifdRouterUserAppcgiWeb-serverNetWSdiscovery/etc/ws4d/conf.d/hosting.xml<strong>ONVIF</strong> NVT software frameworkOnvifd component


<strong>Integration</strong> guide for new systems1. LinkageThe customer application must be linked with libutils and librouter libraries. You can link them eitherstatically (libutils.a and librouter.a) or as shared library (-lutils and -lrouter);2. CompilingPaths /libutils/include and /router/include should be added as -I compiler option duringcompilation stage;3. Processing messagesFor interaction with other components of the middleware custom application must use the messaging protocolbased on message exchange. Every message is a string compatible with command line arguments format, i. e. it isan ASCII string containing tokens separated by space.Messages shall be of the following format: --cmd [-- ]- – name of the component that sent the message. Example: onvif, streamer, app;- – name of the command. Example: SET_SENSOR_BRIGHTNESS;- – name of the argument. Every command has predefined set of arguments;- – argument value. Valid range of arguments depends on a specific argument.Example of a message:onvif --cmd SET_SENSOR_BACKLIGHT_COMPENSATION --enable 0For message exchange two entities are introduced in the middleware – Messenger and Communicator.3.1 MessengerMessenger is a class implementing basic operations with the middleware messaging protocol. The executionmodel is similar to email client, i.e. outgoing messages are kept in outgoing message queue, incoming messagesare kept in incoming message queue.The following methods available in the Messenger:// put a message into outgoing message queueint send(char* message, int size);// get message from incoming message queueint recv(char* message, int size);// perform actual sending and receiving messages through the socketint poll(int timeout);Every message is a string residing in a buffer referenced by message argument. Size of the buffer is specified insize argument. This buffer shall be used by process implementation to store response message.Parameters:- message [in, out] – buffer containing incoming and outgoing message;- size [in] – size of buffer referenced by message;- timeout [in] – timeout for waiting messages from socket.Return value:- Upon successful completion, send and recv shall return the number of bytes sent or received. Otherwise, -1shall be returned- Upon successful completion, poll shall return a non-negative value. A value of 0 indicates that the call timedout and no file messages have been sent or received. Upon failure, poll shall return -1.If custom application uses Messenger class it shall include the following initialization code for properlyinitialization:


Messager processor;processor.set_fd(fd); // sets open socket descriptor3.2 CommunicatorCommunicator is a class derived from Messenger. In addition to functionality provided in Messenger, theCommunicator can act as an active object, periodically performing sending and receiving messages in a separatethread.If custom application uses Communicator class it shall declare a derived class as shown:#include “communicator.h”class MyMessageProcessor : public Communicator{public:// Processes the incoming messagesvirtual int process(char* message, int size, int* status);…};Custom application must provide implementation of the pure virtual method:// Processes the incoming messagesvirtual int process(char* message, int size, int* status);This method is invoked on every incoming message. Every message is a string residing in a buffer referenced bymessage argument. Size of the buffer is specified in size argument. This buffer shall be used by processimplementation to store response message.Parameters:- message [in, out] – buffer containing incoming and outgoing message;- size [in] – size of buffer referenced by message;- status [in, out] – reserved for future, should be ignored.Return value:- the process method should return 0. Other values are reserved for future.If custom application uses Communicator class it shall include the following initialization code for properlyinitialization:MyMessageProcessor processor("onvif --cmd <strong>ONVIF</strong>", “/path/to/local_socket”);processor.start();4.Command name Sender Receiver(s) Parameters1 RESTART Onvifd Onvifd, App, Streamer --timeout %d2 EVENT App Onvifd --type %s--name %s3 GET_STREAMURI Onvifd App, Streamer --channel %d--transport %d--videoencoder %d--audioencoder %d--metaformat %d4 STREAMURI Streamer Onvifd, App --uri %s--channel %d--timeout %d--untilconnect %d--untilreboot %d--return %d'5 GET_SNAPSHOTURI Onvifd App --channel %d6 SNAPSHOTURI App Onvifd --uri %s--timeout %d--untilconnect %d--untilreboot %d


--return %d7 SET_STATE App Onvifd --return %d8 VALIDATE_VIDEO_ENCODER Onvifd App --channel %d--width %d--height %d--videoencoder %d9 VIDEO_ENCODER_VALIDATED App Onvifd --return %d10 SET_ANALYTICS_SETTINGS Onvifd App --channel %d--module %s11 SET_ANALYTICS_STATE Onvifd App --channel %d--module %s--enable %d12 SET_JPEG_SETTINGS Onvifd App, Streamer --channel %d--quality %d--bitrate %d--framerate %d--encinterval %d13 SET_H264_SETTINGS Onvifd App, Streamer --channel %d--profile %d--govlen %d--bitrate %d--framerate %d--encinterval %d14 SET_MPG4_SETTINGS Onvifd App, Streamer --channel %d--profile %d--govlen %d--bitrate %d--framerate %d--encinterval %d15 SET_AAC_SETTINGS Onvifd App, Streamer Sound not supported now16 SET_G711_SETTINGS Onvifd App, Streamer Sound not supported now17 SET_G726_SETTINGS Onvifd App, Streamer Sound not supported now18 SET_SYNCPOINT Onvifd App --channel %d--videoencoding %d--audioencoding %d--metaformat %d19 SET_VIDEO_CAPTURE Onvifd App --channel %d--width %d--height %d--offsetx %d--offsety %d20 SET_SENSOR_BRIGHTNESS Onvifd App --value %.2f21 SET_SENSOR_SATURATION Onvifd App --value %.2f22 SET_SENSOR_CONTRAST Onvifd App --value %.2f23 SET_SENSOR_SHARPNESS Onvifd App --value %.2f24 SET_SENSOR_FOCUS Onvifd App --auto %d25 SET_SENSOR_EXPOSURE Onvifd App --auto %d26 SET_SENSOR_WHITE_BALANCE Onvifd App --auto %d27 SET_SENSOR_WIDE_DYNAMIC_RANGE Onvifd App --enable %d


28 SET_SENSOR_BACKLITE_COMPENSATION Onvifd App --enable %dCommands that MUST be processed in custom application:"onvif --cmd SET_VIDEO_CAPTURE --channel %d --width %d --height %d --offsetx %d --offsety %d"Application shall set mode of video capture."onvif --cmd SET_JPEG_SETTINGS --channel %d --quality %d --bitrate %d --framerate %d --encinterval %d"Application shall set parameters for JPEG encoder"onvif --cmd SET_MPG4_SETTINGS --channel %d --profile %d --govlen %d --bitrate %d --framerate%d --encinterval %d"Application shall set parameters for MPG4 encoder, if supported"onvif --cmd SET_H264_SETTINGS --channel %d --profile %d --govlen %d --bitrate %d --framerate%d --encinterval %d"Application shall set parameters for H264 encoder, if supported"onvif --cmd SET_SYNCPOINT --channel %d --videoencoding %d --audioencoding %d --metaformat%d"Application shall set synchronization point (next frame shall be as key one)"onvif --cmd GET_STREAMURI --channel %d --transport %d --videoencoder %d --audioencoder %d --metaformat %d"Application shall activate video and audio encoders specified in --videoencoder and --audioencoderparameters, create a media session with streams from specified encoders and return URI referencing to RTSPserver with the given media session."onvif --cmd GET_SNAPSHOTURI --channel %d"Application shall return URI to JPEG snapshot.Commands that SHOULD be processed in custom application.Sensor management commands, if supported:"onvif --cmd SET_SENSOR_BACKLIGHT_COMPENSATION --enable %d < --level %.2f >""onvif --cmd SET_SENSOR_BRIGHTNESS --value %.2f""onvif --cmd SET_SENSOR_SATURATION --value %.2f""onvif --cmd SET_SENSOR_CONTRAST --value %.2f""onvif --cmd SET_SENSOR_SHARPNESS --value %.2f""onvif --cmd SET_SENSOR_IRCUT_FILTER --mode %d""onvif --cmd SET_SENSOR_WIDE_DYNAMIC_RANGE --enable %d < --level %.2f >""onvif --cmd SET_SENSOR_WHITE_BALANCE --auto %d < --rgain %.2f --bgain %.2f >""onvif --cmd SET_SENSOR_FOCUS --auto %d < --speed %.2f --near %.2f --far %.2f >""onvif --cmd SET_SENSOR_EXPOSURE --auto %d "Application shall set the corresponding sensor properties to the given values.<strong>Video</strong> analytics commands, if video analytics is present:"onvif --cmd SET_ANALYTICS_STATE --channel %d --module %s --enable %d"Application shall switch analytics module on or off."onvif --cmd SET_ANALYTICS_SETTINGS --channel %d --module %s "Application shall set parameters for analytical module. The actual list of parameters and their values are definedby developer of the analytical module.


<strong>Integration</strong> guide for legacy systemsTop level <strong>ONVIF</strong> lib APIApp Onvif lib /etc/onvif.cfgBottom level <strong>ONVIF</strong> lib APILegacy systems must use the libonvif library, header file for this library is onvif_api.h.The libonvif library represents <strong>ONVIF</strong> implementation from NVT side and implements generic interaction withthe NVCs. The <strong>ONVIF</strong> Framework API consists of three parts:- Top level <strong>ONVIF</strong> lib API - calls available for application;- Bottom level <strong>ONVIF</strong> lib API - the callbacks for implementation by application for performing system specificactions such as changing network settings;- the default configuration file /etc/onvif.cfg.The libonvif is designed as single-threaded library. That means that all API calls must be invoked from the samethread.An execution model based on message loop is implemented in libonvif. A message is a small piece of data,indicating that something happened in the system, for example, a signal is received or socket became available forreading or writing. Messages are organized in a message queue. On every turn, one message is taken from the queueand dispatched for processing to one of message handlers. There is always a default message handler, installed bythe Framework. Custom application can install its own message handlers. Single threading with message basedexecution model mean that processing of every event must not take a lot of time and must not use blocking systemcalls.The following messages can be delivered to a message handler of custom application:- OM_QUIT – indicates that the message loop is going to exit;- OM_SIGNAL – indicates that a Unix signal is delivered into the process;- OM_TICK – this message is delivered every 10 milliseconds. This allows performing some actions on aperiodical base, for example, polling a socket.Here is a pseudo code describing typical usage of the libonvif library.void MyProcessMessage(const Message& message);MiddlewareApi api;int main (){FillMiddlewareApiStruct(api);InitializeOnvif();RegisterMessageHandler(MyProcessMessage);ExecuteMessageLoop();UnregisterMessageHandler(MyProcessMessage);FinalizeOnvif();}void MyProcessMessage(const Message& message){switch (message.Type){case OM_TICK:


}}if (newRequestAvailable)ProcessOnvifRequest(httpSocketFd);break;For cases when some platform specific action is needed for processing <strong>ONVIF</strong> request, the API has a set of callbackcalls that are to be implemented by custom application. These calls are defined in the MiddlewareApi structure.An instance of MiddlewareApi must be initialized by custom application and passed to the Framework duringinitialization step.Typical usage of callbacks: let’s consider what happens when Set<strong>Network</strong>Interfaces request is received byNVT. This request is detected in MyProcessMessage routine and delivered to libonvif byProcessOnvifRequest. libonvif, in turn, after verification of incoming arguments is ready to apply newsettings. However, setting network interface settings is platform dependent action which may differ on differenttargets. That’s why, libonvif cannot do it itself. Instead of this, it translates the call to custom application byinvoking the Set<strong>Network</strong>Interface callback.Third-party dependenciesMontaVista productslinux 2.6.18_pro500 GPL 2Texas Instruments productsubl 1.3.4bios 5.33.06 TI licensecodec_engine 2.24.01dsplib 2.10 TI licensedsplink_linux 1.63 GPL 2framework_components 2.24.01imglib 2.0.1 TI licensexdais 6.24xdctools 3.15.00.50Over productsalsa-lib 1.0.21a LGPL 2.1alsa-utils 1.0.22 GPL 2busybox 1.16.2 GPL 2gnupg 1.4.9 GPL 3gsoap 2.7.13 GPL 2libc 2.5.90 LGPL 2.1libconfig 1.4.3 LGPL 2.1libpng 1.2.29 AS ISlibxml2 2.6.32 AS ISlinuxutils 2.24.02 GPL 2live555 2010.03.16 LGPL 2.1lzo2 2.03 GPL 2mini_httpd 1.19AS ISsmtd-utils 20080508 GPL 2ntp 4.2.6 NTP Licenseopenssh 5.1p1 BSDopenssl 0.9.8i OpenSSL and SSLeaythttpd 2.25b BSDu-boot 1.3.4 GPL 2udev 070 GPL 2ws4d-gsoap 0.7 GPL 2zlib 1.2.3 AS IS

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!