aclvdecSendFrame
Description
Feeds a stream (the input buffer, as well as the output buffer) to the decoder for decoding. This API is asynchronous.
Restrictions
- This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, call the synchronization API (for example, aclrtSynchronizeStream) to ensure that the task is complete.
- Ensure that a channel has been created. Otherwise, an error code is returned.
- A stream must be fed in frame mode, which means that a complete frame must be fed in every call to this API.
- It is not allowed to send an empty stream packet with eos = 0 (stream length is 0 or stream address is empty).
- After all streams are sent, a frame with eos = 1 can be sent, indicating the end of the current stream file. After the EOS frame is fed to the decoder, this API call returns the decoding result only after all received frames are decoded and the user-defined callback function handling is complete.
- Due to stream exception or decoding timeout, the aclvdecSendFrame API may fail to send frames or the EOS frame. You are advised to obtain the return code of this API when writing code. If this API fails to be called, handle the exception.
- aclrtLaunchCallback is encapsulated in aclvdecSendFrame to insert a callback function that needs to be executed to the stream. When you implement the VDEC function, aclrtLaunchCallback does not need to be called separately.
Prototype
aclError aclvdecSendFrame(aclvdecChannelDesc *channelDesc,
acldvppStreamDesc *input,
acldvppPicDesc *output,
aclvdecFrameConfig *config,
void *userData)
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
channelDesc |
Input |
Pointer to the channel description. Must be the same as the channelDesc argument passed to the aclvdecCreateChannel call. Call aclvdecSetChannelDesc series to set the decoding channel description, including the channel ID, thread, callback function, and video coding protocol.
NOTE:
For the |
|
input |
Input |
Pointer to the input stream description. The user needs to allocate input buffer in advance.
|
|
output |
Input/Output |
Pointer to the output image description. The user needs to allocate output buffer in advance. When output is used as an input, the user needs to:
When output is used as an output, the user must obtain the decoding output by calling the acldvppGetPicDesc series in the callback function. For an interlaced stream, two fields are transmitted every frame. It is normal that one of two transmitted fields has no decoding output and the error code ERR_DECODE_NOPIC = 0x20000 is returned. The decoding output of the interlaced stream is stored in the output buffer corresponding to the odd field. |
|
config |
Input |
Pointer to the decoding configuration. This parameter is reserved and can be set to NULL currently. |
|
userData |
Input |
Pointer to the user-defined data. If you want to obtain the sequence number of the decoded frame, define the userData parameter. Then, the sequence number can be passed to the VDEC callback function to determine the frame to be processed. |
Returns
The value 0 indicates success, and other values indicate failure. For details, see aclError.