Decode
Function Usage
Video decoding API of the VideoDecoder class.
When an instantiated decoder calls the Decode API for the first time, the system checks whether the scenario is a pre-allocation scenario. In this case, call the Decode API to pre-allocate output memory to prevent API calling failure.
Prototype
1 | APP_ERROR VideoDecoder::Decode(const std::shared_ptr<uint8_t> data, const uint32_t dataSize, const uint32_t frameId, void* userData); |
1 | APP_ERROR VideoDecoder::Decode(const std::shared_ptr<uint8_t> data, const uint32_t dataSize, const uint32_t frameId, Image& preMallocData, void* userData); |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
data |
Input |
Memory address of the data before decoding. |
dataSize |
Input |
Memory size of the data before decoding. |
frameId |
Input |
Frame ID of the video frame before decoding. The output frame sequence may be different from the frame transmitting sequence. |
userData |
Input/Output |
User-defined data, which is transferred to the user-defined callback function and is used to obtain the decoding result. |
preMallocData |
Input |
To use the pre-allocated memory, users need to construct the Image class based on the allocated memory address, memory size, image width and height, device ID, and image format. |
The frameId outputs frames in the display sequence instead of the decoding sequence, so the output frame sequence may be different from the frame transmitting sequence, but it is the same as the actual image display sequence.
Response Parameters
Data Structure |
Description |
|---|---|
APP_ERROR |
For details about the returned error codes, see APP_ERROR Description. |