1. Introduction
The LT API is built around the REST architecture (Representational State Transfer). REST defines a structured approach for exposing system functionalities via a consistent interface.
A REST API is typically accessed using predefined URLs, which represent various resources returned as JSON objects. These resources support standard methods such as GET, POST, and DELETE.
The LT API requests are processed by a host service called cv40agent, which utilizes standard OS mechanisms such as IPC, SG-DMA, and shared memory. This ensures minimal latency when handling API requests. To optimize performance, video and audio data are shared among consumers using memory segments, allowing large data buffers and concurrent access.
With LT boards designed to be seen as hardware-as-a-service approach, the LT API abstracts hardware-specific implementations behind a unified API. This allows users to focus on core functionalities such as capturing, playing, recording, and streaming audio/video data.
The LT API is accessible through various clients, including the ecurl command line interface (CLI) and the ecam graphical user interface (GUI). The API can also be accessed directly through C++, Python, DirectShow, V4L2, NamedPipe, and UART.
Clients REST LT API LT Agent LT Driver ============= ========== <-- | | | | | ecurl (CLI) <-- | | | | | ecap (GUI) <-- | | Controls | | | <-- | | Status | | | <-- | | Logs | | | GO <-- | | | | | <--> LT board #0 C++ <-- | | | | | Python <-- | | | | PCIe | <-- | --> |-----------| <--> | Driver | <-- | | | | (DMA) | Directshow <-- | | | | | V4L2 <-- | | Data | | | <--> LT board #1 <-- | | Server | | | <-- | | | | | NamedPipe <-- | | | | | UART <-- | |-----------| | | <-- | | Firmwares | | | ============= ==========
2. Installation
2.1. Windows
Download and run the latest cv40install_x.x.x.exe to install the cv40 family drivers, tools and services. If necessary the previous version will be uninstalled.
Once installed, the cv40agent service will be started automatically and will be (re)started automatically with each system (re)boot.
The cv40agent can be controlled using the Windows Services Manager or the command line. For more details, see [control_service].
The LT boards plugged into the host should appear in the Windows Device Manager under the Sound, video and game controllers.
| Note | To uninstall the cv40 family drivers, tools and services, run the installer and choose "Remove" or use "Apps & features" menu. |
2.2. Linux
Download and extract the latest cv40install_x.x.x.tar.gz, then run the cv40install.sh script to install the cv40 family drivers, tools and services. If necessary, the previous version will be uninstalled.
Upon successful installation, the cv40agent daemon will start automatically and will also (re)started with each system (re)boot. If the installation fails, contact us and check the cv40install.log file for details.
The cv40agent can be controlled using the command line. For more details, see [control_service].
| Note | To uninstall the cv40 family drivers, tools and services, run cv40_uninstall.sh from the installation directory. |
2.3. SDK
Download the latest cv40sdk_x.x.x.zip or cv40sdk_x.x.x.tar.gz archive and extract it anywhere you want. The SDK contains the API documentation, the API libraries and examples for the following languages Go, C++ and Python.
Please navigate through the examples to learn how to program the API.
You can also create scripts using the ecurl command-line tool. For more details, see [ecurl].
2.4. Tools
Two tools are installed along with the cv40agent service:
By default, the service and tools are added to the PATH environment variable, allowing you to use them from any command line.
2.5. cv40agent Controls
To access the LT API, ensure that the cv40agent is installed and running on your host system.
You can use the following commands, which require administrative privileges, to control the cv40agent.
$ cv40agent start
$ cv40agent stop
$ cv40agent version
$ cv40agent status
2.6. Board Firmware
If the boards installed in the host require a firmware update, the cv40agent service will automatically update them when the service starts. This process may take up to 2 minutes, depending on the board type. The service will be unavailable until the update is completed.
Please use the command below if you want to check the firmware version of the boards.
$ cv40agent version
It is also possible to manually update the board firmware.
$ cv40agent update
| Note | To update the board firmware, the cv40agent must be stopped. |
3. ecurl (CLI)
The ecurl program is a developer tool to help you make requests on the LT API directly from your terminal. The tool is deployed along with the cv40agent at the installation stage. The tool has been developed with our SDK and is available for both Linux and Windows platforms.
You can use the ecurl CLI to:
-
Create, retrieve, update or delete LT API objects.
-
Play and record any video or audio resources.
-
Use the multi-channel feature of the LT boards.
-
Control and test the installed LT boards.
| Note | The cv40agent must be running otherwise ecurl will not work. |
3.1. GET command
$ ecurl get <url>
Send a GET request to retrieve a specific API object identified by the <url>.
Examples
$ ecurl get cv40:/
$ ecurl get cv40:/0
$ ecurl get cv40:/0/{in}/0/file -d type=image/jpeg
3.2. POST command
$ ecurl post <url> [-d @file.json] [-d field=value] [-d data=@file.bin]
Create or modify the resource designated by the <url>.
Arguments may be added to the request with the -d optional flags. It is possible to use a file content as input by preceding the filename with the @ character. By preceding the filename with the $ charater, relative path will be translated to the absolute full path.
Examples
$ ecurl post cv40:/canvas/0/init -d source=$video.mp4
$ ecurl post cv40:/0/hdmi-in/0/edid -d data=@custom.edid
3.3. DELETE Command
$ ecurl delete <url>
Delete or reset the resource pointed by the <url>.
Examples
$ ecurl delete cv40:/canvas/0
3.4. PLAY Command
$ ecurl play <url> [-d]
Play video or audio source until Ctrl+c is pressed.
Arguments may be added to the request with the -d optional flags.
Examples
$ ecurl play cv40:/0/camera/0
3.5. REC Command
$ ecurl rec <url> [-d]
Record video or audio source until Ctrl+c is pressed.
Arguments may be added to the request with the -d optional flags.
Examples
$ ecurl rec cv40:/0/camera/0/file -d media=video/mp4
$ ecurl rec cv40:/0/camera/0 -d media=video/mp4 -d extra.hw=nvenc -d extra.codec=hevc
4. ecam (GUI)
The ecam program is a simple graphical user interface developed with our SDK and is available for Linux and Windows platforms.
You can use the ecam application to:
|
|
|
|
| Note | The cv40agent has to be running otherwise ecam will not work. |
5. API description
An API endpoint is a URL where the API processes requests for a specific resource. Endpoints are accessed via URLs using the syntax
scheme:/path
. It consists of:
-
A non-empty scheme component followed by a colon
cv40:. -
A path component made up of path segments separated by slashes
/.
For clarity, the URLs endpoints are presented in tables where:
-
The scheme
cv40:is omitted. -
Tables vertical separators replace slashes
/. -
Each method listed in a cell represents an available operation for that path.
-
An empty cell means that no method exists for that path.
5.1. Agent
The agent endpoint allows to retrieve the cv40agent software version.
5.1.1. Agent Configuration File
The agent can be configured using a optional configuration file. You can place the
cv40agent.config
file in the same directory as the application executable. Configuration options:
| Option | Description |
|---|---|
| Working directory for the agent (default: current working directory) |
| Number of canvas objects to create (default 4) |
| Settings for when no video signal is detected (default: gray background with "NO SIGNAL" text) |
| Enable/disable DirectShow filters (default: true) |
| Enable/disable V4l2 filters (default: false) |
| Enable/disable development mode (default: false) |
This file is included in the agent folder. The configuration file is optional and can be omitted if not needed.
5.1.2. Agent Object
|
5.1.3. View cv40agent Information
Retrieves the cv40agent software version.
Examples
ecurl
$ ecurl get cv40:/
GO
var response lt.Agent // struct to store the response
err := lt.Get("cv40:/", &response)
C++
lt::Agent response; // struct to store the response
lt::error err = lt::Get("cv40:/", response);
Python
response, err = Get("cv40:/")
5.2. Board
The board endpoint allows to retrieve information on boards installed into the host. These information are described in the board object section.
| ||||
|
5.2.1. Board Object
|
5.2.2. View Board Information
To retrieve the board information at a given position, send a GET request to the /:board endpoint.
Examples
ecurl
$ ecurl get cv40:/0
GO
var response lt.Board // struct to store the response
err := lt.Get("cv40:/0", &response)
C++
lt::Board response; // object to store the response
lt::error err = lt::Get("cv40:/0", response);
Python
response, err = Get("cv40:/0")
5.2.3. Button Object
The button object allows to capture the button pin state.
|
5.2.4. View Button State
To retrieve the button status, send a GET request to the button/:pin endpoint.
Examples
ecurl
$ ecurl get cv40:/0/buttons/0
golang
var response lt.Button // struct to store the response
err := lt.Get("cv40:/0/buttons/0", &response)
C++
lt::Button response; // struct to store the response
lt::error err = lt::Get("cv40:/0/buttons/0", response);
Python
response, err = Get("cv40:/0/buttons/0")
5.2.5. Buttons Object
The buttons object is a collection of button objects. It allows to capture the state of multiple buttons at once.
5.2.6. View Buttons State
To retrieve the status of all buttons at once, send a GET request to the buttons endpoint.
Examples
ecurl
$ ecurl get cv40:/0/buttons
golang
var response lt.Buttons // struct to store the response
err := lt.Get("cv40:/0/buttons", &response)
C++
lt::Buttons response; // struct to store the response
lt::error err = lt::Get("cv40:/0/buttons", response);
Python
response, err = Get("cv40:/0/buttons/0")
5.3. Audio/Video structure
This is not an endpoint, but data structure used by other endpoints.
5.3.1. Audio object
|
5.3.2. Video object
|
5.4. Camera
This endpoint describes how to use camera inputs.
Native data can be accessed via the format path enumerator
yuyv
(video).
Some of the proposed format might require to use the host CPU and/or GPU before being delivered.
The
pci
endpoint allows to limit the maximum framerate coming through the PCIe bus to save bandwidth and ensure best quality of service for multi-channel scenarios.
Some camera has GPIOs buttons that can be used to trigger a capture, a recording or zoom control.
| ||||
| ||||
|
5.4.1. Camera Object
|
5.4.2. View Camera Status
To retrieve the camera signal status, send a GET request to the camera/:id endpoint
Examples
ecurl
$ ecurl get cv40:/0/camera/0
GO
var response lt.Camera // struct to store the response
err := lt.Get("cv40:/0/camera/0", &response)
C++
lt::Camera response; // struct to store the response
lt::error err = lt::Get("cv40:/0/camera/0", response);
Python
response, err = Get("cv40:/0/camera/0")
5.4.3. White Object
The white object is used to control the white balance and color temperature of the camera.
|
5.4.4. View White Settings
To retrieve the camera white parameters, send a GET request to the white endpoint.
Examples
ecurl
$ ecurl get cv40:/0/camera/0/white
GO
var response lt.CameraWhite // struct to store the response
err := lt.Get("cv40:/0/camera/0/white", &response)
C++
lt::CameraWhite response;
lt::error err = lt::Get("cv40:/0/camera/0/white", response);
Python
response, err = Get("cv40:/0/camera/0/white")
5.4.5. Update White Settings
To update the white settings, send a POST request with the parameters you want to update to the white endpoint.
If you want to perform a white balance operation, send an empty body. In that case, the camera will automatically adjust the white balance gains and temperature.
Examples
ecurl
$ ecurl post cv40:/0/camera/0/white -d temperature=3800
GO
body := lt.JSON{
temperature: 3800,
}
var response lt.CameraWhite // struct to store the response
err := lt.Post("cv40:/0/camera/0/white", body, &response)
C++
lt::json body = {
{"temperature", 3800}
};
lt::CameraWhite response;
lt::error err = lt::Post("cv40:/0/camera/0/white", body, response);
Python
body = {
"temperature": 3800
}
response, err = Post("cv40:/0/camera/0/white", body)
5.4.6. Colors Object
The colors object is used to customize the color saturation, hue, brightness, contrast and gamma correction.
|
5.4.7. View Colors Settings
To retrieve the camera colors parameters, send a GET request to the colors endpoint.
Examples
ecurl
$ ecurl get cv40:/0/camera/0/colors
GO
var response lt.CameraColors // struct to store the response
err := lt.Get("cv40:/0/camera/0/colors", &response)
C++
lt::CameraColors response;
lt::error err = lt::Get("cv40:/0/camera/0/colors", response);
Python
response, err = Get("cv40:/0/camera/0/colors")
5.4.8. Update Colors Settings
To update the colors settings, send a POST request with the parameters you want to update to the colors endpoint.
Examples
ecurl
$ ecurl post cv40:/0/camera/0/colors -d saturation=80 -d brightness=60
GO
body := lt.JSON{
Saturation: 80,
Brightness: 60,
}
var response lt.CameraColors // struct to store the response
err := lt.Post("cv40:/0/camera/0/colors", body, &response)
C++
lt::json body = {
{"saturation", 80},
{"brightness", 60}
};
lt::CameraColors response;
lt::error err = lt::Post("cv40:/0/camera/0/colors", body, response);
Python
body = {
"saturation": 80,
"brightness": 60
}
response, err = Post("cv40:/0/camera/0/colors", body)
5.4.9. Exposure Object
The exposure object is used to control the manual and auto exposure settings of the camera.
| |
|
5.4.10. View Exposure Settings
To retrieve the camera exposure parameters, send a GET request to the exposure endpoint.
Examples
ecurl
$ ecurl get cv40:/0/camera/0/exposure
GO
var response lt.CameraExposure // struct to store the response
err := lt.Get("cv40:/0/camera/0/exposure", &response)
C++
lt::CameraExposure response;
lt::error err = lt::Get("cv40:/0/camera/0/exposure", response);
Python
response, err = Get("cv40:/0/camera/0/exposure")
5.4.11. Update Exposure Settings
Change the exposure parameters as required by your application by sending a POST request to the exposure endpoint.
Examples
ecurl
$ ecurl post cv40:/0/camera/0/exposure -d gainLimits=2.5,15.0
GO
body := lt.JSON{
GainLimits: [2.5, 15.0],
}
var response lt.CameraExposure // struct to store the response
err := lt.Post("cv40:/0/camera/0/exposure", body, &response)
C++
lt::json body = {
{"gainLimits", {2.5, 15.0}}
};
lt::CameraExposure response;
lt::error err = lt::Post("cv40:/0/camera/0/exposure", body, response);
Python
body = {
"gainLimits": [2.5, 15.0]
}
response, err = Post("cv40:/0/camera/0/exposure", body)
5.4.12. Visuals Object
The visuals object regroups parameters to enhance the camera picture. It includes sharpness, anisotropic and bilateral denoising filters, shadow lighting effect, flip and zoom settings.
|
5.4.13. View Visuals Settings
To retrieve the camera visuals parameters, send a GET request to the visuals endpoint.
Examples
ecurl
$ ecurl get cv40:/0/camera/0/visuals
GO
var response lt.CameraVisuals // struct to store the response
err := lt.Get("cv40:/0/camera/0/visuals", &response)
C++
lt::CameraVisuals response;
lt::error err = lt::Get("cv40:/0/camera/0/visuals", response);
Python
response, err = Get("cv40:/0/camera/0/visuals")
5.4.14. Update Visuals Settings
Change the camera visuals as required by your application by sending a POST request to the visuals endpoint.
Examples
ecurl
$ ecurl post cv40:/0/camera/0/visuals -d sharpness=2.5
GO
body := lt.JSON{
Sharpness: 2.5,
}
var response lt.CameraVisuals // struct to store the response
err := lt.Post("cv40:/0/camera/0/visuals", body, &response)
C++
lt::json body = {
{"sharpness", 2.5}
};
lt::CameraVisuals response;
lt::error err = lt::Post("cv40:/0/camera/0/visuals", body, response);
Python
body = {
"sharpness": 2.5
}
response, err = Post("cv40:/0/camera/0/visuals", body)
5.4.15. Button Object
The button object allows to capture the button pin state.
|
5.4.16. View Button State
To retrieve the button status, send a GET request to the button/:pin endpoint.
Examples
ecurl
$ ecurl get cv40:/0/camera/0/buttons/0
golang
var response lt.Button // struct to store the response
err := lt.Get("cv40:/0/camera/0/buttons/0", &response)
C++
lt::Button response; // struct to store the response
lt::error err = lt::Get("cv40:/0/camera/0/buttons/0", response);
Python
response, err = Get("cv40:/0/camera/0/buttons/0")
5.4.17. Buttons Object
The buttons object is a collection of button objects. It allows to capture the state of multiple buttons at once.
5.4.18. View Buttons State
To retrieve the status of all buttons at once, send a GET request to the buttons endpoint.
Examples
ecurl
$ ecurl get cv40:/0/camera/0/buttons
golang
var response lt.Buttons // struct to store the response
err := lt.Get("cv40:/0/camera/0/buttons", &response)
C++
lt::Buttons response; // struct to store the response
lt::error err = lt::Get("cv40:/0/camera/0/buttons", response);
Python
response, err = Get("cv40:/0/camera/0/buttons/0")
5.5. HDMI Output
Allows to configure the physical hdmi outputs on a LT board.
| ||||
|
5.5.1. HDMI Output Object
|
5.5.2. View HDMI Output Status
To retrieve the hdmi-out configuration, send a GET request to the hdmi-out/:id endpoint.
Examples
ecurl
$ ecurl get cv40:/0/hdmi-out/0
GO
var response lt.Output // struct to store the response
err := lt.Get("cv40:/0/hdmi-out/0", &response)
C++
lt::HdmiOutput response; // struct to store the response
lt::error err = lt::Get("cv40:/0/hdmi-out/0", response);
Python
response, err = Get("cv40:/0/hdmi-out/0")
5.5.3. Configure HDMI Output
In order to update the hdmi-out configuration, send a POST request to the hdmi-out/:id endpoint with the desired settings.
Examples
ecurl
$ ecurl post cv40:/0/hdmi-out/0 -d overlay=canvas/0
GO
body := lt.JSON{
"overlay": "canvas/0",
}
var response lt.Output // struct to store the response
err := lt.Post("cv40:/0/hdmi-out/0", body, &response)
C++
lt::json body = {
{"overlay", "canvas/0"}
};
lt::HdmiOutput response; // struct to store the response
lt::error err = lt::Post("cv40:/0/hdmi-out/0", body, response);
Python
body = {
"overlay": "canvas/0"
}
response, err = Post("cv40:/0/hdmi-out/0", body)
5.6. SDI Output
Allows to configure the physical sdi outputs on a LT board.
| ||||
|
5.6.1. SDI Output Object
|
|
5.6.2. View SDI Output Status
To retrieve the sdi-out configuration, send a GET request to the sdi-out/:id endpoint.
Examples
ecurl
$ ecurl get cv40:/0/sdi-out/0
GO
var response lt.Output // struct to store the response
err := lt.Get("cv40:/0/sdi-out/0", &response)
C++
lt::SdiOutput response; // struct to store the response
lt::error err = lt::Get("cv40:/0/sdi-out/0", response);
Python
response, err = Get("cv40:/0/sdi-out/0")
5.6.3. Configure SDI Output
In order to update the sdi-out configuration, send a POST request to the sdi-out/:id endpoint with the desired settings.
Examples
ecurl
$ ecurl post cv40:/0/sdi-out/0 -d overlay=canvas/0
GO
body := lt.JSON{
"overlay": "canvas/0",
}
var response lt.Output // struct to store the response
err := lt.Post("cv40:/0/sdi-out/0", body, &response)
C++
lt::json body = {
{"overlay", "canvas/0"}
};
lt::SdiOutput response; // struct to store the response
lt::error err = lt::Post("/0/sdi-out/0", body, response);
Python
body = {
"overlay": "canvas/0"
}
response, err = Post("cv40:/0/sdi-out/0", body)
5.7. Canvas
The canvas endpoint is both a virtual audio/video source and a dynamic synthetic image generator which supports draw operations. It could be used to emulate the LT boards video inputs and to send overlay images onto the hdmi and/or sdi outputs.
| ||||
|
| ||||
|
5.7.1. Canvas Object
5.7.2. View Canvas Status
To retrieve the canvas signal status, send a GET request to the canvas/:id endpoint
Examples
ecurl
$ ecurl get cv40:/canvas/0
GO
var response lt.Input // struct to store the response
err := lt.Get("cv40:/canvas/0", &response)
C++
lt::Input response; // struct to store the response
lt::error err = lt::Get("cv40:/canvas/0", response);
Python
response, err = Get("cv40:/canvas/0")
5.7.3. Delete Operation
Clear the canvas to a "NO SIGNAL" equivalent. Helps to simulate a video input loss.
Parameters None. Response Returns an error if the request failed. |
Examples
ecurl
$ ecurl delete cv40:/canvas/0
GO
err := lt.Delete("cv40:/canvas/0", nil, nil)
C++
lt::error err = lt::Delete("cv40:/canvas/0", nullptr, nullptr);
Python
err = Delete("cv40:/canvas/0")
5.7.4. Init Operation
Clear the canvas and fill the background with the specified file, pattern or color.
Parameters
Response Returns the init operation parameters if the request succeeded. |
Examples
ecurl
$ ecurl post cv40:/canvas/0/init -d source=video.mp4
GO
body := lt.JSON{
"source": "video.mp4",
}
err := lt.Post("cv40:/canvas/0/init", body, nil)
C++
lt::json body = {
{"source", "video.mp4"}
};
lt::error err = lt::Post("cv40:/canvas/0/init", body, nullptr);
Python
body = {
"source": "video.mp4"
}
resp, err = Post("cv40:/canvas/0/init", body)
5.7.5. Text Operation
Draw text onto the canvas.
Parameters
| |
Response Returns the text operation parameters if the request succeeded. |
Examples
ecurl
$ ecurl post cv40:/canvas/0/text -d text="hello world!"
GO
body := lt.JSON{
"text": "hello world!",
}
err := lt.Post("cv40:/canvas/0/text", body, nil)
C++
lt::json body = {
{"text", "hello world!"}
};
lt::error err = lt::Post("cv40:/canvas/0/text", body, nullptr);
Python
body = {
"text": "hello world!"
}
resp, err = Post("cv40:/canvas/0/text", body)
5.7.6. Line Operation
Draw a line whose top left anchor is
(x,y)
coordinates.
Parameters
Response Returns the line operation parameters if the request succeeded. |
Examples
ecurl
$ ecurl post cv40:/canvas/0/line \
-d position=0,0 \
-d size=3840,2160 \
-d color=255,0,0,255
GO
body := lt.JSON{
"position": [0,0],
"size": [3840,2160],
"color": [255,0,0,255]
}
err := lt.Post("cv40:/canvas/0/line", body, nil)
C++
lt::json body = {
{"position", {0,0}},
{"size", {3840,2160}},
{"color", {255,0,0,255}}
};
lt::error err = lt::Post("cv40:/canvas/0/line", body, nullptr);
Python
body = {
"position": [0, 0],
"size": [3840, 2160],
"color": [255, 0, 0, 255]
}
resp, err = Post("cv40:/canvas/0/line", body)
5.7.7. Ellipse Operation
Draw an ellipse whose top left anchor is
(x,y)
coordinates.
Parameters
Response Returns the ellipse operation parameters if the request succeeded. |
Examples
ecurl
$ ecurl post cv40:/canvas/0/ellipse \
-d position=0,0 \
-d size=3840,2160 \
-d color=255,0,0,255 \
-d fill=0,255,0,255
GO
body := lt.JSON{
"position": [0,0],
"size": [3840,2160],
"color": [255,0,0,255],
"fill": [0,255,0,255]
}
err := lt.Post("cv40:/canvas/0/ellipse", body, nil)
C++
lt::json body = {
{"position", {0,0}},
{"size", {3840,2160}},
{"color", {255,0,0,255}},
{"fill", {0,255,0,255}}
};
lt::error err = lt::Post("cv40:/canvas/0/ellipse", body, nullptr);
Python
body = {
"position": [0,0],
"size": [3840,2160],
"color": [255,0,0,255],
"fill": [0,255,0,255]
}
resp, err = Post("cv40:/canvas/0/ellipse", body)
5.7.8. Rectangle Operation
Draw a rectangle whose top left anchor is
(x,y)
coordinates.
Parameters
Response Returns the rectangle operation parameters if the request succeeded. |
Examples
ecurl
$ ecurl post cv40:/canvas/0/rectangle \
-d position=100,100 \
-d size=400,400 \
-d fill=0,0,255,255
GO
body := lt.JSON{
"position": [100,100],
"size": [400,400],
"fill": [0,0,255,255]
}
err := lt.Post("cv40:/canvas/0/rectangle", body, nil)
C++
lt::json body = {
{"position", {100,100}},
{"size", {400,400}},
{"fill", {0,0,255,255}}
};
lt::error err = lt::Post("cv40:/canvas/0/rectangle", body, nullptr);
Python
body = {
"position": [100,100],
"size": [400,400],
"fill": [0,0,255,255]
}
resp, err = Post("cv40:/canvas/0/rectangle", body)
5.7.9. Image Operation
There are two ways to draw an image on the canvas:
-
Using a file path with the
sourceparameter. Theformat,data,widthandheightparameters are ignored. -
Using a data buffer with the
dataparameter. Theformatparameter is mandatory and if a raw format is used (i.e.rgbaorrgb), thewidthandheightparameters are required too.
Parameters
Response Returns the image operation parameters if the request succeeded. |
Examples
ecurl
$ ecurl post cv40:/canvas/0/image \
-d source=C:\\image.png \
-d position=0,0 \
-d size=640,480
GO
body := lt.JSON{
"source": "C:\\image.png",
"position": [0,0],
"size": [640,480]
}
err := lt.Post("cv40:/canvas/0/image", body, nil)
C++
lt::json body = {
{"source", "C:\\image.png"},
{"position", {0,0}},
{"size", {640,480}}
};
lt::error err = lt::Post("cv40:/canvas/0/image", body, nullptr);
Python
body = {
"source": "C:\\image.png",
"position": [0,0],
"size": [640,480]
}
resp, err = Post("cv40:/canvas/0/image", body)
5.7.10. Video Operation
Place a video on the canvas.
Parameters
Response Returns the video operation parameters if the request succeeded. |
Examples
ecurl
$ ecurl post cv40:/canvas/0/video \
-d source=0/camera/0 \
-d position=0,0 \
-d size=1920,1080
GO
body := lt.JSON{
"source": "0/camera/0",
"position": [0,0],
"size": [1920,1080]
}
err := lt.Post("cv40:/canvas/0/video", body, nil)
C++
lt::json body = {
{"source", "0/camera/0"},
{"position", {0,0}},
{"size", {1920,1080}}
};
lt::error err = lt::Post("cv40:/canvas/0/video", body, nullptr);
Python
body = {
"source": "0/sdi-in/0",
"position": [0,0],
"size": [1920,1080]
}
resp, err = Post("cv40:/canvas/0/video", body)
5.7.11. Clear Operation
Clear the canvas and fill the background with the specified color or remove video sources from the canvas.
Parameters
Response Returns the clear operation parameters if the request succeeded. |
Examples
ecurl - Clear entire canvas
$ ecurl post cv40:/canvas/0/op -d op=clear -d color=0,0,0,255
ecurl - Remove specific video source
$ ecurl post cv40:/canvas/0/op -d op=clear -d source=0/hdmi-in/0
ecurl - Remove all video sources
$ ecurl post cv40:/canvas/0/op -d op=clear -d source=all
GO
body := lt.JSON{
"op": "clear",
"source": "0/sdi-in/0",
}
err := lt.Post("cv40:/canvas/0/op", body, nil)
C++
lt::json body = {
{"op", "clear"},
{"source", "0/sdi-in/0"}
};
lt::error err = lt::Post("cv40:/canvas/0/op", body, nullptr);
5.7.12. Batch Operations
Draw operations in batch.
Parameters
Response Returns the operations if succeeded. |
5.8. Client
The client endpoint retains the connection context, the living memory references and the running workers. Once a client is done with a resource, it has to delete it. If the client dies or ceases to communicate, the cv40agent will automatically collect the resources and clean them.
|
|
| ||
| ||||
| ||||
|
| |||
|
5.8.1. Fetch Worker Updates
The long running task(s) (eg: recording a mp4) are child processe(s) of the client(s) which have initiated the request(s). These task(s) are processed by worker(s) that are attached into the client(s) context(s) with an unique ID. Retrieving the updates periodically ensures that the tasks are properly processed and allow to fetch the data out of the cv40agent. |
5.8.2. Release Referenced Memory
Clients and cv40agent communicate by exchanging references on shared memory blocks. Once processed, it is recommended to expressly release the references, otherwise the cv40agent memory pool can run out of shared memory blocks. Depending to your development language (Garbage Collected or not), the SDK wrapper might automatically release the memory for you. |
5.9. Workers
All the API processing is based on Worker objects created by the server (on behalf of the clients requests) to serve data or metadata packets. The workers creation endpoints are easily recognizable by their URLs patterns:
|
| ||
| |||
|
The workers can serve streams under 3 types:
-
datathe de facto interface to process data into a third party application. These kind of workers use the host shared memory mechanisms with pooled buffers to distribute large chunk of data to multiple concurrent consumers. -
filethis helps you record files onto the host hard drive. These workers supports splitting and containerized formats like mp4, asf, or avi. Each time that a file is finished or split, the completed field of the Worker object is set to true. The next request will point toward a new file via a redirected URL.
Finally, the Workers transfer packets from the LT agent to the LT clients. Packets may contains data, metadata, video, audio, …
5.9.1. Worker Creation
A type has to be submitted to the data or file endpoint to create a worker. The type is a string that describes the data class
audio
,
image
and
video
and the data format. The type is a mandatory field and must be set to a valid value.
Audio:
audio/pcm
,
audio/wav
,
audio/aac
.
Image:
image/yuyv
,
image/yuv422
,
image/nv12
,
image/rgba
,
image/rgb
,
image/jpeg
,
image/png
,
image/bmp
.
Video:
video/yuyv
,
video/yuv422
,
video/nv12
,
video/rgba
,
video/rgb
,
video/jpeg
,
video/png
,
video/bmp
,
video/h264
,
video/mp4
.
5.9.1.1. Audio Data Worker
Create a worker object that serves audio data packets.
Parameters
Response Returns the location of the worker object onto the form of a redirect error. |
Examples
GO
err := lt.Post("cv40:/:url/data", lt.AudioDataWorker{Media: "audio/pcm"}, nil)
if !errors.Is(err, lt.ErrRedirect) {
log.Fatal("worker creation failed:", err)
}
workerURL := lt.RedirectLocation(err)
C++
lt::error err = lt::Post("cv40:/:url/data", lt::AudioDataWorker{ "audio/pcm" }, nullptr);
if (!lt::ErrorIs(err, lt::ErrRedirect)) {
logFatal("worker creation failed:" + err);
}
string workerURL = lt::RedirectLocation(err);
Python
resp, err = Post("cv40:/:url/data", {'media': "audio/pcm"})
if not lt.ErrorIs(err, lt.ErrRedirect):
exit(err)
workerURL = lt.RedirectLocation(err)
5.9.1.2. Image Data Worker
Create a worker object that serves one image data packet.
Parameters
Response Returns the location of the worker object onto the form of a redirect error. |
Examples
GO
err := lt.Post("cv40:/:url/data", lt.ImageDataWorker{Media: "image/jpeg"}, nil)
if !errors.Is(err, lt.ErrRedirect) {
log.Fatal("worker creation failed:", err)
}
workerURL := lt.RedirectLocation(err)
C++
lt::error err = lt::Post("cv40:/:url/data", lt::ImageDataWorker{ "image/jpeg" }, nullptr);
if (!lt::ErrorIs(err, lt::ErrRedirect)) {
logFatal("worker creation failed:" + err);
}
string workerURL = lt::RedirectLocation(err);
Python
resp, err = Post("cv40:/:url/data", {'media': "image/jpeg"})
if not lt.ErrorIs(err, lt.ErrRedirect):
exit(err)
workerURL = lt.RedirectLocation(err)
5.9.1.3. Video Data Worker
Create a worker object that continuously serves video data packets.
Parameters
Response Returns the location of the worker object onto the form of a redirect error. |
Examples
GO
err := lt.Post("cv40:/:url/data", lt.VideoDataWorker{Media: "video/nv12"}, nil)
if !errors.Is(err, lt.ErrRedirect) {
log.Fatal("worker creation failed:", err)
}
workerURL := lt.RedirectLocation(err)
C++
lt::error err = lt::Post("cv40:/:url/data", lt::VideoDataWorker{ "video/nv12" }, nullptr);
if (!lt::ErrorIs(err, lt::ErrRedirect)) {
logFatal("worker creation failed:" + err);
}
string workerURL = lt::RedirectLocation(err);
Python
resp, err = Post("cv40:/:url/data", {'media': "video/nv12"})
if not lt.ErrorIs(err, lt.ErrRedirect):
exit(err)
workerURL = lt.RedirectLocation(err)
5.9.1.4. Audio File Worker
Create a worker object that records an audio file. The file is split when the file length or the file duration is reached.
Parameters
Response Returns the location of the worker object onto the form of a redirect error. |
Examples
GO
err := lt.Post("cv40:/:url/file", lt.AudioFileWorker{Media: "audio/wav"}, nil)
if !errors.Is(err, lt.ErrRedirect) {
log.Fatal("worker creation failed:", err)
}
workerURL := lt.RedirectLocation(err)
C++
lt::error err = lt::Post("cv40:/:url/file", lt::AudioFileWorker{ "audio/wav" }, nullptr);
if (!lt::ErrorIs(err, lt::ErrRedirect)) {
logFatal("worker creation failed:" + err);
}
string workerURL = lt::RedirectLocation(err);
Python
resp, err = Post("cv40:/:url/file", {'media': "audio/wav"})
if not lt.ErrorIs(err, lt.ErrRedirect):
exit(err)
workerURL = lt.RedirectLocation(err)
5.9.1.5. Image File Worker
Create a worker object that records one image file.
Parameters
Response Returns the location of the worker object onto the form of a redirect error. |
Examples
GO
err := lt.Post("cv40:/:url/file", lt.ImageFileWorker{Media: "image/jpeg"}, nil)
if !errors.Is(err, lt.ErrRedirect) {
log.Fatal("worker creation failed:", err)
}
workerURL := lt.RedirectLocation(err)
C++
lt::error err = lt::Post("cv40:/:url/file", lt::ImageFileWorker{ "image/jpeg" }, nullptr);
if (!lt::ErrorIs(err, lt::ErrRedirect)) {
logFatal("worker creation failed:" + err);
}
string workerURL = lt::RedirectLocation(err);
Python
resp, err = Post("cv40:/:url/file", {'media': "image/jpeg"})
if not lt.ErrorIs(err, lt.ErrRedirect):
exit(err)
workerURL = lt.RedirectLocation(err)
5.9.1.6. Video File Worker
Create a worker object that records a video file. The file is split when the file length or the file duration is reached.
Parameters
|
Response Returns the location of the worker object onto the form of a redirect error. | ||
Examples
GO
err := lt.Post("cv40:/:url/file", lt.VideoFileWorker{Media: "video/mp4"}, nil)
if !errors.Is(err, lt.ErrRedirect) {
log.Fatal("worker creation failed:", err)
}
workerURL := lt.RedirectLocation(err)
C++
lt::error err = lt::Post("cv40:/:url/file", lt::VideoFileWorker{ "video/mp4" }, nullptr);
if (!lt::ErrorIs(err, lt::ErrRedirect)) {
logFatal("worker creation failed:" + err);
}
string workerURL = lt::RedirectLocation(err);
Python
resp, err = Post("cv40:/:url/file", {'media': "video/mp4"})
if not lt.ErrorIs(err, lt.ErrRedirect):
exit(err)
workerURL = lt.RedirectLocation(err)
5.9.2. Worker Object
The Worker object is the result of a GET request onto a worker endpoint. It contains the worker status, data packets and metadata. A Worker might process one or multiples tracks and the SDK provides helpers functions to automatically parse the worker into a comprehensive structure with the contained audio and video packets.
|
5.9.3. Packet Object
The packet object wraps the data and the metadata of an audio, video, … track.
The SDK provides a helper function to automatically parse the packets into a comprehensive structure.
|
5.9.3.1. SharedPacket Object
This has the same description as the Packet object, use only for reference. To lower the cpu consumption and the latency, big data blocks are transmitted to the user using the OS standard shared memory mechanisms. No memory copy is involved in the packet transmission.
The SDK provides a helper function to automatically parse the shared packets into a comprehensive structure.
|
5.9.3.2. Audio Metadata
Packets with
audio/*
type.
|
5.9.3.3. Image Metadata
Packets with
image/*
type.
|
5.9.3.4. Video Metadata
Packets with
video/*
type.
|
5.9.4. Data Worker Workflow
Create a worker object that serves data packets. Data packets could be of type audio, image or video.
Create Worker
|
|
5.9.5. File Worker Workflow
Create a worker object that records a file. The file is split when the file length or the file duration is reached. Files could be of type audio, image or video.
Create file worker
|
Process file worker
|
6. Cheatsheet
| ||||
| ||||
| ||||
| ||||
| ||||
| ||||
| ||||
|
|
| ||
| ||||
| ||||
|
| |||
7. Changelog
# 1.3.3 (17/09/2025):
- Fix get camera button with CV40Q
- Add get camera temperature
# 1.3.2 (11/09/2025):
- Remove serial/uart client from sdk
- Fix zoom problem (now boards can work properly without PCIe)
- Minor fixes
# 1.3.1 (31/07/2025):
- Fix serial/uart client
- Fix downscaling
# 1.3.0 (21/07/2025):
- Add agent configuration file
- Add NV12 native support
- Add independent RGB gain
- Add video encoder parameters (hardware accelerators, codecs, ...)
- Add dead pixels correction
- Improve overlay performance
- Improve agent reliability
- Improve programmation reliability
- Improve Linux support
- Update sdk
- Remove Windows 7 & 8 support
- Minor fixes
# 1.2.1 (11/02/2025):
- Improve player colorimetry
- Minor fixes
# 1.2.0 (22/01/2025):
- Add low light boost
- Add shadow lighting
- Add OSD feature into server
- Add overlay scaling option
- Improve DirectShow filters
- Update sdk
- Minor fixes
# 1.1.0 (22/08/2024):
- Add OSD feature (only works with UART interface)
# 1.0.0 (19/07/2024):
- First official release