nx_camera_sdk
1.0
Camera SDK
|
// Copyright 2018-present Network Optix, Inc. Licensed under MPL 2.0: www.mozilla.org/MPL/2.0/
The whole contents of this package, including all C/C++ source code, is licensed as Open Source under the terms of Mozilla Public License 2.0: www.mozilla.org/MPL/2.0/, with the possible exception of certain files which may be licensed under the terms of other open-source licenses explicitly referenced in those files.
See the license texts in license_*.md
files in the root directory of this package.
This package provides an SDK to create so-called Camera Plugins for the Video Management System (VMS).
From the business logic point of view, a Camera Plugin creates its own type of a Device (such as a Camera or an I/O Module), capable of e.g. supplying video frames to the VMS Server.
Such a Plugin can, for example, be one of the following:
axis_camera_plugin
.rpi_camera_plugin
.image_library_plugin
.From the developers' point of view, an Camera Plugin is a dynamic library (.dll
on Windows, .so
on Linux) which exports a single extern "C"
entry point function. Such function is a factory for objects inherited from a dedicated SDK abstract class (in other words, implementing a dedicated interface) class nxpl::PluginInterface
(src/plugins/plugin_api.h
). This base interface also defines the name and the prototype of the entry point function.
To make it possible to develop plugins using a different C++ compiler (e.g. with an incompatible ABI) rather than the one used to compile the VMS itself, or potentially in languages other than C++, a COM-like approach is offered: all objects created in a plugin or passed to a plugin inherit abstract classes declared in header files of this SDK, which have only pure virtual functions with C-style arguments (not using C++ standard library classes). To manage lifetime of such objects, they incorporate a reference counter.
The SDK C++ files have extensive documentation comments in Doxygen format, from which HTML files are generated and included into the SDK: see docs/html/index.html
.
This package includes a number of sample Camera Plugins written in C++, located at samples/
.
These samples can be compiled and linked using CMake.
Prerequisites:
To compile the samples, execute the commands collected into the provided scripts (use their source code as a reference):
ATTENTION: If cmake cannot find Qt, add the following arg to a build_samples* script (will be passed to cmake):
On Windows, after CMake generation phase, Visual Studio GUI can be used to compile a sample: open ..\camera_sdk-build\<sample_name>\<sample_name>.sln
and build the ALL_BUILD
project. Make sure that the platform combo-box is set to "x64".
After successful build, locate the built artifacts:
To install a plugin, just copy its library file to the dedicated folder in the VMS Server installation directory:
ATTENTION: After copying a plugin library, the Server has to be restarted.
Plugin libraries compiled using nx_sdk 1.7.1 (which has been included with VMS 3.2) are compatible with VMS 4.0, because the binary interface (ABI) did not change. The same way, plugins compiled with this newer nx_sdk should work with VMS 3.2 as well.
The current camera_sdk version (coming with VMS 4.0) has no new features or extensions to the API available for the plugins in nx_sdk 1.7.1 (coming with VMS 3.2).
Re-compiling the source code of plugins written with nx_sdk 1.7.1 using this newer camera_sdk requires some simple adjustments due the following breaking changes in SDK source code:
class PluginInterface
methods (does not affect binary compatibility) addRef()
and releaseRef()
:int
instead of unsigned int
.const
.nxpl::Plugin3
which only added setLocale()
to nxpl::Plugin2
.include/plugins/camera_*.h
-> src/camera/
.include/plugins/plugin_*.h -> src/plugins/
.plugin_tools.h
:ScopedRef<>
replaced with Ptr<>
(src/nx/sdk/ptr.h
).alignUp()
, mallocAligned()
, freeAligned()
moved to nx/kit/utils.h
.