Callback Format
Function Usage
A callback function is used to receive data (such as 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. Otherwise, the video decoding speed will slow down.
Prototype
1 | def callback_func(decodedImage: Image, channelId: int, frameId: int) -> None |
Input Parameters
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. |
If the callback function throws an exception, it triggers an exception on the C++ side, leading to a core dump. Capture and manage exceptions within the callback function.