Callback Format
Description
A callback function is used to receive data (such as the image data and frame ID) decoded by VideoDecoder and implement user-defined processing function in the callback.
To implement user-defined processing function, you are advised to perform operations, such as saving data and writing lists (append), to reduce the processing time and prevent the decoding thread from being blocked, which slows down the video decoding speed.
Prototype
def callback_func(decodedImage: Image, channelId: int, frameId: int) -> None
Parameter Description
callback_func indicates the function name, which is user-defined but must be the same as the function name registered by registerVdecCallBack.
Parameter |
Type |
Description |
|---|---|---|
decodedImage |
Image class |
Output image class after decoding |
channelId |
int |
Video stream index, which is set during VideoDecoder initialization. |
frameId |
int |
Video frame index, which is set by the decode function of the VideoDecoder class. |
Exception Throwing Interface
If the function parameters and outputs are not defined in the specified format, the "pybind11::error_already_set" exception occurs.