SendData

Function Usage

Sends data to the input element (appsrc) on the specified stream. The blocking mode is used. Multi-thread concurrency is not supported.

Prototype and Parameter Description

APP_ERROR SendData(const std::string& streamName,  
    int inPluginId, 
    MxstDataInput& dataBuffer);

Parameter

Input/Output

Description

streamName

Input

Stream name

inPluginId

Input

ID of the object input plugin, that is, the ID of the appsrc element. (The appsrc number indicates the sequence number of the appsrc element.)

dataBuffer

Input

Data to be sent.

The value of dataBuffer.dataSize must be equal to the size of the memory to be sent and within the range of [1, 1073741824]. dataBuffer.dataPtr needs to be deleted.

APP_ERROR SendData(const std::string& streamName, 
    const std::string& elementName,
    MxstDataInput& dataBuffer);

Parameter

Input/Output

Description

streamName

Input

Stream name

elementName

Input

Name of the input plugin. Only appsrc can be used as the input plugin.

dataBuffer

Input

Data to be sent. The value of dataBuffer.dataSize must be equal to the size of the memory to be sent and within the range of [1, 1073741824]. dataBuffer.dataPtr needs to be deleted.

APP_ERROR SendData(const std::string& streamName, 
    const std::string& elementName, std::vector<MxstMetadataInput>& metadataVec, 
    MxstBufferInput& bufferInput);

Parameter

Input/Output

Description

streamName

Input

Stream name

elementName

Input

Name of the input plugin. Only appsrc can be used as the input plugin.

metadataVec

Input

For details about the list of sent protobuf data, see MxstMetadataInput.

bufferInput

Input

Data to be sent. The data type is MxstBufferInput.

The value of bufferInput.dataSize must be equal to the size of the memory to be sent and within the range of [1, 1073741824]. bufferInput.dataPtr needs to be deleted.

Return Parameter Description

Data Structure

Description

APP_ERROR

Error code returned during program execution. For details, see the MxBase/ErrorCode/ErrorCode.h file.