### Basic Video Input/Output with LinkSDK (C++) Source: https://www.yuque.com/linkpi/linksdk/zga7g6vtn9ngcd75 This C++ code snippet demonstrates initializing the LinkSDK, creating a video input module (e.g., from HDMI), creating a video output module (e.g., to HDMI), and linking the video stream from input to output. It requires the LinkSDK library to be installed. ```cpp //SDK初始化 Link::init(); //创建一个视频输入模块 LinkObject *vi=Link::create("InputVi"); QVariantMap dataVi; dataVi["interface"]="HDMI"; vi->start(dataVi); //创建一个视频输出模块 LinkObject *vo=Link::create("OutputVo"); QVariantMap dataVo; dataVo["type"]="hdmi"; vo->start(dataVo); //连接视频流(采集->显示) vi->linkV(vo); ``` -------------------------------- ### GBMux Module Methods Source: https://www.yuque.com/linkpi/linksdk/he5h17b35fyrmc7g_language=en-us This section describes the methods available for interacting with the GBMux module, including pausing, resuming, getting speed, and segmenting files. ```APIDOC ## GBMux Module Methods ### Description Provides methods to control the GBMux module's operation, such as pausing, resuming, retrieving transfer speed, and initiating file segmentation. ### Methods #### `pause()` - **Description**: Pauses the GBMux module. - **Return Type**: `QVariant` (expected to contain a boolean indicating success or failure). #### `resume()` - **Description**: Resumes the GBMux module after it has been paused. - **Return Type**: `QVariant` (expected to contain a boolean indicating success or failure). #### `getSpeed()` - **Description**: Retrieves the data transfer speed since the last call to this method. - **Return Type**: `QVariantMap` containing: - `speed` (numeric): Total transfer speed. - `speedA` (numeric): Audio stream transfer speed. - `speedV` (numeric): Video stream transfer speed. #### `segment(QVariant path)` - **Description**: Initiates a new file segmentation. Specify the desired file path for the segment. - **Parameters**: - **path** (QVariant) - Required - The file path for the new segment. ``` -------------------------------- ### board.json Example for Audio-Video Interfaces Source: https://www.yuque.com/linkpi/linksdk/fz3y4gvft56blw8b_language=en-us This JSON object illustrates the structure of a board.json file, defining configurations for video ('interfaceV') and audio ('interfaceA') interfaces, as well as video buffer settings ('videoBuffer'). It specifies parameters like chip, name, protocols, samplerate, and buffer sizes. ```json { "interfaceV":{ "HDMI":{"chip":"IT6801","name":"hdmi1","protocols":["HDMI"],"did": 0,"cid": 0,"mode": "bt1120s","dstFramerate":60,"reverse":true} }, "interfaceA":{ "HDMI":{"chip":"IT6801","samplerate":48000,"did": 1,"cid": 0,"channels": 2, "chnCnt": 2,"delay":-80,"delay2": 4}, "HDMI-OUT":{"samplerate":48000,"type":"hdmi","did": 1,"cid": 0,"channels":2, "chnCnt": 2,"mode":"i2sm"}, "Line-In":{"chip":"ES8388","samplerate":48000,"did": 0,"cid": 0,"channels":2, "chnCnt": 2,"mode":"i2sm"}, "Line-Out":{"samplerate":48000,"did": 0,"cid": 0,"channels":2, "chnCnt": 2,"mode":"i2sm"} }, "videoBuffer":{ "sys":[ {"size":12441600,"cnt":8}, {"size":3133440,"cnt":100}, {"size":345600,"cnt":50} ] } } ``` -------------------------------- ### Configure Audio Input Interface (Line-In) using board.json Source: https://www.yuque.com/linkpi/linksdk/fz3y4gvft56blw8b_language=en-us This code snippet shows how to initialize and start an audio input object ('InputAi') by referencing the 'Line-In' interface defined in the board.json configuration. The LinkSDK simplifies audio interface management. ```c++ LinkObject *ai=Link::create("InputAi"); QVariantMap dataAi; dataAi["interface"]="Line-In"; ai->start(dataAi); ``` -------------------------------- ### NDISend Module Overview Source: https://www.yuque.com/linkpi/linksdk/yf249rnvzqw77hpu Provides an overview of the NDISend module, its purpose, licensing, and basic setup. ```APIDOC ## NDISend Module ### Description This module supports NewTek's NDI protocol for HX transmission. A license from NewTek or LinkPi is required for operation beyond a 30-minute trial. ### Setup During development, include `LinkNDI.pri` in your QT project file. ### Data Interfaces | Interface | Valid | Type | Multi-connection | |-------------|-------|--------------|------------------| | Audio In | ✔ | AAC | ✖ | | Video In | ✔ | H264/H265 | ✖ | | Audio Out | ✖ | - | ✖ | | Video Out | ✖ | - | ✖ | ### Module Parameters | Parameter Name | Type | Default Value | Description | Hot Update | |----------------|--------|----------------------|--------------------|------------| | name | string | "NDI Test" | NDI channel name | ✔ | | group | string | "" | NDI group name | ✔ | | config | string | "/link/config/ndi.json" | NDI config file path | ✔ | ### Module Methods #### `getTally()` * **Description**: Retrieves the current Tally status. * **Returns**: A Map of type `{program: bool, preview: bool}`. ``` -------------------------------- ### MixV Layout Configuration Example (JSON) Source: https://www.yuque.com/linkpi/linksdk/kfo8sgkda9zegla4_language=zh-cn This snippet demonstrates the JSON structure for configuring the layout of input sources in the MixV module. It specifies dimensions, source names, and the position, size, transparency, and stacking order for each layout element. Ensure that JSON comments are removed before parsing. ```json { "width":1920, "height":1080, "src": [ "InputVi_1", "InputVi_2" ], "layout": [ { "x": 0, "y": 0, "w": 0.5, "h": 0.5, "a": 1, "index": 0 }, { "x": 0.5, "y": 0.5, "w": 0.5, "h": 0.5, "a": 1, "index": 1 } ] } ``` -------------------------------- ### Overlay2 Module Configuration: Lays Data Structure Example (JSON) Source: https://www.yuque.com/linkpi/linksdk/tsgtus2clfeui59c_language=en-us This snippet demonstrates the JSON structure for configuring overlay layers (lays) in the Overlay2 module. It includes examples for text, time, picture, mask, border, and rectangle overlays, specifying properties like type, content, position, size, and appearance. The 'Json::decode' method can be used to parse this data. ```json [ { "type": "text", "enable": true, "font": "/link/res/font.ttf", "content": "哈哈呵呵哈哈~~~~呵呵哈哈呵呵~~~~哈哈呵呵", "x": 0.1, "y": 0.136, "scale": 2.2, "color": "#669900", "bgColor": "", "alpha": 1, "move": -1, "w": 0.515 }, { "type": "time", "enable": true, "font": "/link/res/font.ttf", "content": "yyyy年MM月dd日 hh:mm:ss", "x": 0.1, "y": 0.136, "scale": 2.2, "color": "#669900", "bgColor": "", "alpha": 1 }, { "type": "pic", "enable": true, "content": "/link/res/logo.png", "x": 0.1, "y": 0.1, "scale": 1, "alpha": 1 }, { "type": "mask", "enable": true, "content": "16", "x": 0.4, "y": 0.4, "w": 0.2, "h": 0.2 }, { "type": "border", "x": "0.483", "y": "0.508", "h": "0.197", "w": "0.304", "enable": true, "color": "#000000", "alpha": 1, "border": 7 }, { "type": "rect", "x": "0.097", "y": "0.104", "h": "0.261", "w": "0.208", "enable": true, "color": "#000000", "alpha": 1 } ] ``` -------------------------------- ### Configure Video Input Interface (HDMI) using board.json Source: https://www.yuque.com/linkpi/linksdk/fz3y4gvft56blw8b_language=en-us This code snippet demonstrates how to create and start a video input object ('InputVi') by specifying the 'HDMI' interface from the board.json configuration. It utilizes the LinkSDK to abstract the underlying hardware details. ```c++ LinkObject *vi=Link::create("InputVi"); QVariantMap dataVi; dataVi["interface"]="HDMI"; vi->start(dataVi); ``` -------------------------------- ### Get Core Temperature (Device Module) Source: https://www.yuque.com/linkpi/linksdk/tkl3pvwhagllvoqw_language=zh-cn Retrieves the core temperature of the microcontroller in Celsius. This method should be called after the module has been started. It returns an integer value representing the temperature. ```cpp QVariant getTemperature() // Method Function: Returns the core temperature. // Return Value: Int type, in Celsius. ``` -------------------------------- ### Send Playback Request - C++ (Qt) Source: https://www.yuque.com/linkpi/linksdk/xx9gpzm2fes0meu0 Sends an invite request for playback. Requires a list argument containing the channel ID and SDP. Returns a boolean indicating success. ```cpp QVariant sendPlayback(QVariant args); // args: list type, [string:channel id,string:sdp]. ``` -------------------------------- ### Start New File Segmentation Source: https://www.yuque.com/linkpi/linksdk/he5h17b35fyrmc7g Initiates a new file segmentation process within the GBMux module. This method requires a file path as input and returns a boolean indicating whether the segmentation was successfully started. ```C++ QVariant segment(QVariant path) { // Method functionality: Start a new file segment. // path: File path. // Return value: Bool type. return QVariant(); // Placeholder for actual implementation } ``` -------------------------------- ### Link Class - Initialization and Configuration Source: https://www.yuque.com/linkpi/linksdk/ldd42xeynyhawwp2_language=zh-cn Static methods for initializing the LinkSDK, setting configuration, and retrieving configuration. ```APIDOC ## Link Class Static Methods ### Description Provides static methods for initializing the LinkSDK library, managing configuration, and creating Link objects. ### Methods #### `static bool init(bool sys = true)` - **Description**: Initializes the LinkLib. - **Parameters**: - **sys** (bool) - Optional - Whether to initialize the Hisilicon MPP system. Defaults to true. - **Return Value**: true on success, false on failure. - **Notes**: Must be called at the very beginning of the program. If two processes use LinkLib concurrently, the later one should set `sys` to false to avoid MPP system resets. #### `static LinkObject* create(QString className, QString name = "")` - **Description**: Creates a LinkLib module instance. - **Parameters**: - **className** (QString) - Required - The name of the module (e.g., "EncodeV"). The "Link" prefix can be omitted. - **name** (QString) - Optional - The instance name. If empty, it's auto-generated. If a name conflict occurs, it's appended with a sequence number. - **Return Value**: A pointer to the module instance, or NULL if the module does not exist. #### `static LinkObject* find(QString name)` - **Description**: Finds a LinkObject instance by its name. - **Parameters**: - **name** (QString) - Required - The name of the instance to find. - **Return Value**: A pointer to the instance, or NULL if not found. #### `static bool setConfig(QString path)` - **Description**: Sets the board configuration from a file. - **Parameters**: - **path** (QString) - Required - The path to the configuration file. - **Return Value**: true on success, false on failure. - **Notes**: Usually not needed, as `init()` loads default configurations. #### `static QVariantMap getConfig()` - **Description**: Retrieves the current board configuration. - **Return Value**: A QVariantMap containing the board configuration. ``` -------------------------------- ### Get the current playback progress Source: https://www.yuque.com/linkpi/linksdk/rvqwrtbg45t9wg53_language=zh-cn This method returns the current playback progress of the file in milliseconds. ```cpp QVariant getPosition(); // ●Return value: Int type, unit ms. ``` -------------------------------- ### Link Class Method Details (C++) Source: https://www.yuque.com/linkpi/linksdk/ldd42xeynyhawwp2_language=zh-cn Details the functionalities of the static methods within the Link class. `init` handles SDK initialization, `create` instantiates modules, `find` retrieves existing modules, `setConfig` applies board configurations, and `getConfig` retrieves current configurations. ```c++ bool init(bool sys=true) { // LinkLib initialization logic // sys: whether to initialize Hi35xx mpp system // return: true on success, false on failure } LinkObject* create(QString className, QString name="") { // Create a LinkLib module instance // className: module name (e.g., "EncodeV" for LinkEncodeV) // name: instance name (auto-generated if empty or if name conflicts) // return: module instance pointer, or NULL if module doesn't exist } LinkObject* find(QString name) { // Find a module instance by its name // name: instance name // return: instance pointer or NULL } bool setConfig(QString path) { // Set board configuration from a file // path: path to the configuration file // return: true on success, false on failure } QVariantMap getConfig() { // Get the current board configuration // return: board configuration map } ``` -------------------------------- ### Initialize LinkLib and Create Modules (C++) Source: https://www.yuque.com/linkpi/linksdk/ldd42xeynyhawwp2 Provides functions to initialize the LinkLib system and create module instances. The `init` function sets up the library, with an option to initialize the HiSilicon MPP system. The `create` function instantiates modules by their class name, optionally assigning a specific name. It handles automatic naming conflicts and allows omitting the 'Link' prefix for module names. ```cpp static bool init(bool sys=true); static LinkObject* create(QString className, QString name=""); ``` -------------------------------- ### Get the current playback progress Source: https://www.yuque.com/linkpi/linksdk/rvqwrtbg45t9wg53 This function returns the current playback progress of the media file in milliseconds. It does not require any input parameters. ```C++ QVariant getPosition(); /** * @brief Method function: Get the current playback progress. * @return Value: Int type, unit ms. */ ``` -------------------------------- ### ColorKey Module Methods Source: https://www.yuque.com/linkpi/linksdk/da2dvc7yaus5c9ha_language=zh-cn Lists the available methods for the ColorKey module. ```APIDOC ## ColorKey Module Methods ### Description This section details the methods available for interacting with the ColorKey module. **No methods are exposed by this module.** ``` -------------------------------- ### LinkInputVi Module Configuration and Functionality Source: https://www.yuque.com/linkpi/linksdk/qf44fg This section details the parameters and methods available for configuring and interacting with the LinkInputVi module. ```APIDOC ## LinkInputVi Module Documentation ### Description The LinkInputVi module integrates image acquisition, frame rate control, and driver communication functionalities. It leverages the MPP system's VI interface on HiSilicon platforms, serving as the source for video data streams. ### Data Interfaces | Interface | Available | Type | Multi-connection | |--------------|-----------|------|------------------| | Video Out | Yes | VPSS | Yes | ### Module Parameters | Parameter Name | Type | Default Value | Description | |----------------|---------|----------------------------|---------------------------------------------------------------------| | interface | string | - | Video input port name. | | pic | string | "/link/config/nosignal.yuv" | Placeholder image for no signal (1920x1080, YUV420sp format). | | crop | map | - | Cropping parameters, supporting "L,T,R,B" or "x,y,width,height". | | mirror | bool | false | Horizontal mirror. | | flip | bool | false | Vertical flip. | | rotate | int | 0 | Rotation angle (0, 90, 180, 270 degrees). | | avalible | bool | false | Input source availability. | | width | int | 1920 | Resolution width. | | height | int | 1080 | Resolution height. | | dstFramerate | int | 30 | Maximum output frame rate. | | srcFramerate | int | 30 | Input source frame rate. | | interlace | bool | false | Interlacing mode. | | mode | string | bt1120s | Input mode. | | did | int | 0 | Device ID. | | cid | int | 0 | Channel ID. | | mux | int | 1 | Muxing mode (1, 2, 4). | | double | bool | false | Double edge sampling. | *Note: When `interface` is used, parameters like `avalible`, `width`, `height`, `dstFramerate`, `srcFramerate`, `interlace`, `mode`, `did`, `cid`, `mux`, and `double` are automatically updated or determined by `board.json`.* ### Module Methods #### `QVariant getReport()` * **Description**: Returns the driver status. * **Return Value**: A `Map` containing `avalible` (bool), `width` (int), `height` (int), `framerate` (int), and `interlace` (bool). * **Notes**: Valid only when the `interface` parameter is defined. ### Module Events #### `signal` * **Trigger Condition**: Input signal change. * **Carried Message**: A `Map` with the same structure as the return value of `getReport()`. ``` -------------------------------- ### Mux Module Methods Source: https://www.yuque.com/linkpi/linksdk/zq1gf0aku6nbhxf9_language=zh-cn This section describes the methods available to control the Mux module's behavior, including pausing, resuming, getting transmission speed, and segmenting files. ```APIDOC ## Mux Module Methods ### Description Methods for controlling the Mux module's operation and retrieving stream statistics. ### Methods - **pause()** - **Functionality**: Pauses the media stream processing. - **Returns**: `Bool` - Indicates success or failure of the pause operation. - **resume()** - **Functionality**: Resumes the media stream processing after a pause. - **Returns**: `Bool` - Indicates success or failure of the resume operation. - **getSpeed()** - **Functionality**: Retrieves the data transmission rate over a specific interval. - **Returns**: `QVariantMap` - A map containing: - `speed` (float): Total transmission speed. - `speedA` (float): Audio stream transmission speed. - `speedV` (float): Video stream transmission speed. - **segment(QVariant path)** - **Functionality**: Initiates a new file segment. Useful for creating time-based or size-based segments. - **Parameters**: - **path** (string) - Required - The path for the new segment file. ``` -------------------------------- ### GPIO State Management API Source: https://www.yuque.com/linkpi/linksdk/mcobgntqe4vsk2l4_language=zh-cn APIs for setting and getting the state of GPIO ports. These include setting a port to high or low and retrieving its current state. ```APIDOC ## POST /gpio/setGPIO ### Description Sets the state of a GPIO port. ### Method POST ### Endpoint /gpio/setGPIO ### Parameters #### Request Body - **info** (List) - Required - A list containing the GPIO name (String) and the desired state (Boolean: true for high, false for low). ### Request Example ```json { "info": ["GPIO_1", true] } ``` ### Response #### Success Response (200) - **return_value** (Boolean) - True if the state was set successfully, false otherwise. #### Response Example ```json { "return_value": true } ``` ## GET /gpio/getGPIO ### Description Retrieves the current state of a GPIO port. ### Method GET ### Endpoint /gpio/getGPIO ### Parameters #### Query Parameters - **info** (String) - Required - The name of the GPIO. ### Request Example ``` /gpio/getGPIO?info=GPIO_1 ``` ### Response #### Success Response (200) - **return_value** (Boolean) - True if the GPIO is high, false if it is low. #### Response Example ```json { "return_value": true } ``` ``` -------------------------------- ### Get the total duration of a file Source: https://www.yuque.com/linkpi/linksdk/rvqwrtbg45t9wg53_language=zh-cn This method retrieves the total duration of a given file. The 'path' parameter is a string representing the file path, and the duration is returned in milliseconds. ```cpp QVariant getDuration(QVariant path); // ●path value: String type, file path. // ●Return value: Int type, unit ms. ``` -------------------------------- ### Link Class - Initialization and Module Creation Source: https://www.yuque.com/linkpi/linksdk/ldd42xeynyhawwp2_language=en-us Provides methods for initializing the LinkLib and creating new Link modules. ```APIDOC ## Link Class Static Methods ### Description Static methods for initializing the LinkSDK and creating/managing modules. ### Methods #### `bool init(bool sys = true)` - **Description**: Initializes the LinkLib. The `sys` parameter determines if the HiSilicon MPP system should be initialized. - **Parameters**: - `sys` (bool) - Optional - Whether to initialize the HiSilicon MPP system. Defaults to `true`. - **Return Value**: `true` on success, `false` on failure. - **Notes**: Must be called at the very beginning of the program. If two processes use LinkLib simultaneously, the later one must set `sys` to `false` to avoid MPP system resets. #### `LinkObject* create(QString className, QString name = "")` - **Description**: Creates a LinkLib module instance. - **Parameters**: - `className` (QString) - Required - The name of the module (e.g., "EncodeV" for LinkEncodeV). - `name` (QString) - Optional - The instance name. If empty, a name like "moduleName_sequence" is automatically assigned. - **Return Value**: A pointer to the module instance, or `NULL` if the module does not exist. - **Notes**: The "Link" prefix for module names can be omitted during creation. #### `LinkObject* find(QString name)` - **Description**: Finds a module instance by its name. - **Parameters**: - `name` (QString) - Required - The instance name to search for. - **Return Value**: A pointer to the instance, or `NULL` if not found. #### `bool setConfig(QString path)` - **Description**: Sets the board configuration using a specified file. - **Parameters**: - `path` (QString) - Required - The path to the configuration file. - **Return Value**: `true` on success, `false` on failure. - **Notes**: Usually not required, as `init` loads default configurations. #### `QVariantMap getConfig()` - **Description**: Retrieves the current board configuration. - **Return Value**: A `QVariantMap` containing the board configuration. ``` -------------------------------- ### Get the total duration of a file Source: https://www.yuque.com/linkpi/linksdk/rvqwrtbg45t9wg53 This function retrieves the total duration of a media file. It requires the file path as a string input and returns the duration in milliseconds as an integer. ```C++ QVariant getDuration(QVariant path); /** * @brief Method function: Get the total duration of the file. * @param path Value: String type, file path. * @return Value: Int type, unit ms. */ ``` -------------------------------- ### Enable IR Receiver (Device Module) Source: https://www.yuque.com/linkpi/linksdk/tkl3pvwhagllvoqw_language=zh-cn Enables the Infrared (IR) receiving functionality of the device. This method should be called after the module has been started. It returns a boolean value indicating success or failure. ```cpp QVariant enableIR() // Method Function: Enables the IR receiving function. // Return Value: Bool type. ``` -------------------------------- ### OutputVo Module Configuration Source: https://www.yuque.com/linkpi/linksdk/wxq0u5uu2pua5dzn_language=en-us Configure the OutputVo module with various parameters to control video output, UI settings, and advanced features. ```APIDOC ## OutputVo Module Configuration ### Description Configure the OutputVo module with various parameters to control video output, UI settings, and advanced features. ### Parameters #### Module Parameters - **type** (string) - Required - Interface type, optional values: hdmi, dvi, vga, cvbs, bt1120, multiple can be separated by '|'. - **output** (string) - Required - Output resolution, corresponds to the content after VO_OUTPUT_ in the enum type VO_INTF_SYNC_E, case-sensitive. - **ui** (bool) - Optional - Enable LinuxFb. Defaults to true. - **vid** (int) - Optional - Force specify the output device number, usually not needed. - **flip** (bool) - Optional - Vertical flip. Defaults to false. - **rotate** (int) - Optional - Rotation angle, supports 0, 90, 180, 270 degrees. Defaults to 0. - **wbc** (bool) - Optional - Enable echo function, which allows outputting video (including UI layer) to downstream modules. Defaults to false. - **scaleUp** (bool) - Optional - For IPC series solutions, due to asymmetric VPSS scaling capabilities, specify whether scaling up is required using the scaleUp parameter. Defaults to true. ### Notes - Each instance's interface cannot be repeated. An InputVi instance for the same video port can only be created once. - This module supports multiple connection outputs. If the image data is needed in multiple places, call the linkV method of this instance multiple times. - The NoSignal image specified by 'pic' must be a YUV420sp raw image, 1920x1080. ``` -------------------------------- ### LinkObject Advanced Method Invocation (C++) Source: https://www.yuque.com/linkpi/linksdk/ldd42xeynyhawwp2_language=zh-cn Allows direct invocation of internal methods within a LinkObject module. This provides a flexible way to control module-specific functionalities not exposed by the standard interface. Requires the module to be started. ```c++ QVariant invoke(QString func, QVariant value=QVariant()) { // Call an internal module function // func: name of the function to invoke // value: argument for the function (optional) // return: the return value of the invoked function } ``` -------------------------------- ### Webcam Capture Module Configuration Source: https://www.yuque.com/linkpi/linksdk/ghl41dpa9uxgkypm This section details the parameters available for configuring the webcam capture module. These parameters allow for setting the device path, capture format, resolution, and frame rate. ```APIDOC ## Webcam Capture Module Parameters ### Description Configuration options for the webcam capture module. ### Module Parameters #### path * **Type**: string * **Default**: "/dev/video0" * **Description**: Device address of the webcam. * **Updatable**: No #### format * **Type**: string * **Default**: "mjpeg" * **Description**: Capture format. Currently supports mjpeg, yuv, and h264. * **Updatable**: No #### width * **Type**: int * **Default**: 1920 * **Description**: Maximum decoding width. * **Updatable**: Yes #### height * **Type**: int * **Default**: 1080 * **Description**: Maximum decoding height. * **Updatable**: Yes #### framerate * **Type**: int * **Default**: 30 * **Description**: Output image frame rate. * **Updatable**: Yes ``` -------------------------------- ### Mux Module Methods Source: https://www.yuque.com/linkpi/linksdk/zq1gf0aku6nbhxf9 This section details the methods available for interacting with the Mux module, including pausing, resuming, getting transmission speed, and initiating file segmentation. The methods return QVariant or QVariantMap objects. ```cpp QVariant pause() ●方法功能:暂停。 ●返回值:Bool类型。 QVariant resume() ●方法功能:恢复。 ●返回值:Bool类型。 QVariantMap getSpeed() ●方法功能:获取距离上一次调用该接口这段时间内的传输速率。 ●返回值:{speed:总速率,speedA:音频流速率,speedV:视频流速率} QVariant segment(QVariant path) ●方法功能:开始一个新的文件分段。 ●path:文件路径。 ●返回值:Bool类型。 ``` -------------------------------- ### Get Transmission Speed Source: https://www.yuque.com/linkpi/linksdk/he5h17b35fyrmc7g Retrieves the transmission speed of the GBMux module since the last call. This method provides details on the overall, audio, and video stream rates. It returns a QVariantMap containing speed information. ```C++ QVariantMap getSpeed() { // Method functionality: Get the transfer rate during the time interval since the last call to this interface. // Return value: {speed: total rate, speedA: audio stream rate, speedV: video stream rate} return QVariantMap(); // Placeholder for actual implementation } ``` -------------------------------- ### Link Class Static Methods (C++) Source: https://www.yuque.com/linkpi/linksdk/ldd42xeynyhawwp2_language=zh-cn Provides static methods for initializing the LinkSDK, creating and finding module instances, and managing configuration settings. Ensures proper initialization order and handles module naming conventions. The `init` method requires specific handling when multiple processes use the SDK. ```c++ static bool init(bool sys=true); static LinkObject* create(QString className, QString name=""); static LinkObject* find(QString name); static bool setConfig(QString path); static QVariantMap getConfig(); ``` -------------------------------- ### Get Network NDI Device List (C++) Source: https://www.yuque.com/linkpi/linksdk/iz2vkupptlgumgcw_language=en-us This C++ function retrieves a list of all NDI devices discovered on the network. It returns a QVariant list containing strings, where each string represents an available NDI device. ```cpp QVariant getList() { // return value: List type, string. } ``` -------------------------------- ### Query Device Catalog - C++ (Qt) Source: https://www.yuque.com/linkpi/linksdk/xx9gpzm2fes0meu0 Requests the catalog (list of channels) for a specific device. Requires the device ID as a string argument. Returns a boolean indicating success. ```cpp QVariant queryCatalog(QVariant devId); // args: string type, device id. ``` -------------------------------- ### WebRTCPush Module Configuration Source: https://www.yuque.com/linkpi/linksdk/ky1kux7oqi977vdu_language=zh-cn Configure the WebRTCPush module with the necessary parameters for streaming. ```APIDOC ## WebRTCPush Module Configuration ### Description Configure the WebRTCPush module with parameters such as the push stream URL and bearer token. ### Method N/A (Configuration) ### Endpoint N/A (Configuration) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **path** (string) - Required - The push stream URL, e.g., http://192.168.1.56:1985/rtc/v1/whip/?app=live&stream=livestream - **bearer** (string) - Optional - Bearer authentication information ### Request Example ```json { "path": "http://192.168.1.56:1985/rtc/v1/whip/?app=live&stream=livestream", "bearer": "your_bearer_token" } ``` ### Response #### Success Response (200) N/A (Configuration is typically applied directly or via a separate control plane) #### Response Example N/A ``` -------------------------------- ### Invoking Module Methods via LinkObject::invoke Source: https://www.yuque.com/linkpi/linksdk/pe2dtqu9bcxos0nz_language=zh-cn Demonstrates how to call specific module functions beyond basic operations (setData, start, stop) using the LinkObject::invoke interface. This allows access to extended module capabilities. ```cpp // Example of invoking a module method // Replace 'module_name', 'method_name', and 'parameters' with actual values LinkObject* module = LinkObject::find("module_name"); if (module) { QVariant result = module->invoke("method_name", parameters); // Process the result if necessary } ``` -------------------------------- ### Get Volume Statistics (QVariantMap) Source: https://www.yuque.com/linkpi/linksdk/uxgg3vw1bcqpz69w Retrieves the volume statistics from the module. The returned map contains average and maximum volume for both left and right channels. This method is part of the module's interface for accessing calculated data. ```cpp QVariantMap getVolume() { // Method implementation to retrieve volume statistics // Returns a map with keys: avg, max, avg2, max2 } ``` -------------------------------- ### Send Playback Request - C++ Source: https://www.yuque.com/linkpi/linksdk/xx9gpzm2fes0meu0_language=zh-cn Initiates a playback request, similar to an "invite" but for recorded media. It takes a list containing the channel ID and SDP data. Returns a boolean indicating the success of sending the playback request. ```cpp QVariant sendPlayback(QVariant args); // args: list type, [string: channel ID, string: sdp] ``` -------------------------------- ### MixV Module Configuration Source: https://www.yuque.com/linkpi/linksdk/kfo8sgkda9zegla4 This section details the parameters used to configure the MixV module, including image dimensions, framerate, background color, input sources, and layout definitions. ```APIDOC ## MixV Module Parameters ### Description Configuration parameters for the MixV module. ### Parameters #### Module Parameters - **width** (int) - Default: 1920 - Image width. Hot-updatable. - **height** (int) - Default: 1080 - Image height. Hot-updatable. - **framerate** (int) - Default: 30 - Frame rate. Hot-updatable. - **color** (uint) - Default: 0 - Background color in RGB24 format. Hot-updatable. - **src** (list) - Default: - List of LinkObject instance names for input source ordering. Hot-updatable. - **layout** (list) - Default: - Layout definition data. See example below. Not hot-updatable. ### Layout Structure Example ```json { "width": 1920, // Image width "height": 1080, // Image height "src": [ "InputVi_1", // Input source instance name "InputVi_2" ], "layout": [ { "x": 0, // Horizontal coordinate [0,1] "y": 0, // Vertical coordinate [0,1] "w": 0.5, // Image width [0,1] "h": 0.5, // Image height [0,1] "a": 1, // Transparency (0 or 1). Default is 1. "index": 0 // Stacking order, higher values are on top. }, { "x": 0.5, "y": 0.5, "w": 0.5, "h": 0.5, "a": 1, "index": 1 } ] } ``` ### Module Method #### `swap(QVariant list)` - **Description**: Swaps the positions of two instances in the layout. - **Parameters**: - **list** (List) - Contains the names of the two instances to swap. - **Returns**: Bool type. ``` -------------------------------- ### Get GPIO Port State with LinkGPIO Source: https://www.yuque.com/linkpi/linksdk/mcobgntqe4vsk2l4_language=zh-cn Retrieves the current state of a specified GPIO port. The function takes the GPIO name as a string input and returns a boolean value, where true indicates the port is high and false indicates it is low. ```qml QVariant getGPIO(QVariant info); /** * @brief Method function: Get GPIO port state. * @param info Value: String type, GPIO name. * @return Return value: Bool type, true: pull high, false: pull low. */ ``` -------------------------------- ### Queue Module Interfaces and Parameters Source: https://www.yuque.com/linkpi/linksdk/dzfyt05y82whq3gi_language=zh-cn This section details the data interfaces, module parameters, and their configurations for the Queue module. ```APIDOC ## Queue Module Documentation ### Description The Queue module buffers audio and video stream data and outputs it stably according to timestamps. Adjusting the kernel clock to 1000Hz will result in smoother output. ### Data Interfaces | Interface | Valid | Type | Multiple Connections | |---|---|---|---| | Audio In | ✔ | Any | ✖ | | Video In | ✔ | Any | ✖ | | Audio Out | ✔ | Any | ✔ | | Video Out | ✔ | Any | ✔ | ### Module Parameters | Parameter Name | Type | Default Value | Description | Hot Update | |---|---|---|---|---| | delay | int | 1000 | Buffer time, in ms. | ✔ | ### Module Methods None ### Module Events None ``` -------------------------------- ### Get GPIO Port State with LinkGPIO Source: https://www.yuque.com/linkpi/linksdk/mcobgntqe4vsk2l4_language=en-us Retrieves the current state of a GPIO port using the LinkGPIO module. This function takes the GPIO name as a string input and returns a boolean value representing the state (true for high, false for low). ```cpp QVariant getGPIO(QVariant info); /** * @brief Method functionality: Gets GPIO port state. * @param info Value: String type, GPIO name. * @return Bool type, true: pull high, false: pull low. */ ``` -------------------------------- ### Demonstrate Multi-Connection Video Output Source: https://www.yuque.com/linkpi/linksdk/pe2dtqu9bcxos0nz_language=en-us This C++ code snippet demonstrates how a module with multi-connection video output can link to multiple encode modules simultaneously. It shows the creation of an InputVi object and two EncodeV objects, then links the InputVi object's video output to both encode objects. ```cpp LinkObject *vi=Link::create("InputVi"); LinkObject *enc1=Link::create("EncodeV"); LinkObject *enc2=Link::create("EncodeV"); vi->linkV(enc1); vi->linkV(enc2); ```