Rate This Document
Findability
Accuracy
Completeness
Readability

SetCopyFrameFunc

Function Usage

Sets the hook function to reduce memory copies when frame data is output. This API is provided for the decoder.

Restrictions

N/A

Prototype

DecoderRetCode SetCopyFrameFunc(std::function<uint32_t(uint8_t*, uint8_t*, const PicInfoParams &, uint32_t)> copyFrame)

Parameter Description

Field Name

Input/Output

Field Type

Description

copyFrame

Input

std::function<uint32_t(uint8_t*, uint8_t*, const PicInfoParams &, uint32_t)

Sets the hook function for copying decoded data of one frame to the output buffer. This function is used to shield format differences of the output API.

In the callback, the first uint8_t* indicates the address of decoded data, the second uint8_t* indicates the destination of the copied data, which needs to be the same as the buffer address entered in RetrieveFrameData. const PicInfoParams & indicates the image width and height (see SetDecodeParams). uint32_t indicates the maximum length of the output buffer, which needs to be the same as the maximum buffer size entered in RetrieveFrameData. The return value of this callback is the actual size of processed data.

Return Value Description

Data type: DecoderRetCode

The value can be any of the following:

  • VIDEO_DECODER_SUCCESS: The callback is successfully set.
  • VIDEO_DECODER_SET_FUNC_FAIL: Failed to set the callback.