The eSDK Pro API provides classes, methods, and data structures for building custom multi-camera applications. The API is organized into four main areas:
Provides the foundation for building applications. Includes classes for managing systems, servers, and pipelines.
Represents the state of the current eSDK session. A system instance owns all servers created in the application.
Usage notes
Destroy()
when finished to release resources.Represents a local or remote server that manages cameras.
Example
auto cameras = server.DiscoverCameras();
for (auto& camInfo : cameras) {
Camera cam = server.AddCamera(camInfo);
auto username = cam.GetParameter<StringCameraParam>("DeviceUserName").GetValue();
std::cout << "Camera: " << username << std::endl;
}
Defines the data flow graph of tasks connected to cameras and plugins.
Example
for (auto& cam : server.GetCameras()) {
CameraTask camTask = pipeline.CreateCameraTask(cam);
RawSavingTask rawSavingTask =
pipeline.CreateRawSavingTask(server, "/data/captures/OutputPath");
pipeline.ConnectTasks(camTask.GetOutput(), rawSavingTask.GetInput());
}
pipeline.Start();
std::this_thread::sleep_for(std::chrono::seconds(5));
pipeline.Stop();
Example (Linux only)
/**
* Connects a source port to a destination port via FlexTrans using GPU to GPU.
* Tasks must have different GPUs set when FlexTrans will be used for data transfer.
* @param src The source output port.
* @param dst The destination input port.
*/
void ConnectTasksFlexTrans(const Output& src, const Input& dst);
/**
* Connects a source port to a destination port via FlexTrans using rivermax mellanox network cards.
* Tasks must have different servers set when FlexTrans will be used for data transfer.
* @param src The source output port.
* @param srcNicIp The ip of the source mellanox card.
* @param dst The destination input port.
* @param dstNicIp The ip of the destination mellanox card.
*/
void ConnectTasksFlexTrans(const Output& src, const std::string& srcNicIp,
const Input& dst, const std::string& dstNicIp);
Covers lifecycle control and parameter access for individual cameras.
Represents a single camera managed by a server.
Example
auto exposure = cam.GetParameter<UInt32CameraParam>("Exposure");
exposure.SetValue(5000); // microseconds
cam.StartStreaming();
// ...
cam.StopStreaming();
For camera-specific features (such as exposure controls or pixel formats), see the Camera Features reference.
Defines how camera data flows through tasks, task workers, and frames in a pipeline.
Represents a processing node in the pipeline. Tasks are created by the pipeline (not directly).
ConnectTasks
method to connect tasks.Example
CameraTask camTask = pipeline.CreateCameraTask(cam);
UInt32CameraParam widthParam = cam.GetParameter<UInt32CameraParam>("Width");
UInt32CameraParam heightParam = cam.GetParameter<UInt32CameraParam>("Height");
UInt32CameraParam framerateParam = cam.GetParameter<UInt32CameraParam>("FrameRate");
EnumCameraParam pixelFormatParam = cam.GetParameter<EnumCameraParam>("PixelFormat");
PIXEL_FORMAT pixelFormat = StringToPixelFormat(pixelFormatParam.GetValue());
NvencTask nvencTask = pipeline.CreateNvencTask(
server, c_gpuId, recordPath,
widthParam.GetValue(), heightParam.GetValue(),
pixelFormat, framerateParam.GetValue(),
params.m_codec, params.m_bitrateKbps);
RawSavingTask rawSavingTask =
pipeline.CreateRawSavingTask(server, "/data/captures/OutputPath");
pipeline.ConnectTasks(camTask.GetOutput(), nvencTask.GetInput());
pipeline.ConnectTasks(camTask.GetOutput(), rawSavingTask.GetInput());
Base class for implementing custom plugin tasks.
Example
class CustomTask : public Plugin::TaskWorker {
public:
const static inline std::string c_name{"CustomTask"};
const static inline std::string c_inputName{"InputFrame"};
CustomTask() {
SetName(c_name);
m_input = CreateFrameInput(c_inputName, HWPlatform::Host);
}
virtual bool Process() override {
auto frame = m_input.GetFrame();
std::cout << "Processing frame " << frame.GetFrameId() << std::endl;
return true;
}
private:
Plugin::FrameInput m_input{};
};
Represents a single image frame.
Provides supporting functionality such as error handling and versioning.
The eSDK throws ESdkProException
. Error codes are limited to:
Success
General
NotFound
Invalid
Example
try {
System system = System::Create();
Server server = system.ConnectServer("127.0.0.1");
auto cams = server.DiscoverCameras();
if (cams.empty()) {
throw ESdkProException("NotFound", "No cameras discovered");
}
}
catch (const ESdkProException& ex) {
std::cerr << "eSDK Pro error: " << ex.what() << std::endl;
}
The eSDK version is available in eSdkPro/version.h
:
const char c_eSdkProVersionStr[] = "1.2.0";
const int c_eSdkProVersionMajor = 1;
const int c_eSdkProVersionMinor = 2;
const int c_eSdkProVersionPatch = 0;