FFMPEG: Explain parameters of any codecs function pointers

假如想象 提交于 2019-12-13 02:48:54

问题


I'm going through the article, How to integrate a codec in FFMPEG multimedia framework. According to it, every codec needs to have 3 basic functions to be defined and these functions are assigned to function pointers of the structure AVCodec.

The 3 function pointers specified in the above article are:

.init -> takes care of allocations and other initializations

.close -> freeing the allocated memory and de-initializations

.decode -> frame by frame decoding.

For the function pointer .decode, the function assigned is:

static int cook_decode_frame(AVCodecContext *avctx,
            void *data, int *data_size,
            uint8_t *buf, int buf_size) {
...

The details of these parameters are specified in the above article. However, in the latest code, when the same function is taken as an example, its declaration is as shown below:

static int cook_decode_frame(AVCodecContext *avctx, void *data,
                             int *got_frame_ptr, AVPacket *avpkt)

I need to perform some mapping operations on the memory. So, i request if anyone could kindly explain the above parameters in the function declarations. Also, which parameter has the input buffer for decoding the frame? And after decoding a frame, to which parameter is the decoded frame mapped?


回答1:


From this source, it looks like the general idea is to decode audio/video frames from avpkt and put the output in data. Basically, the biggest change in API from your link is simply that buf and buf_size are rolled up into an AVPacket. And there's the got_frame_ptr as an indication of success.



来源:https://stackoverflow.com/questions/20342921/ffmpeg-explain-parameters-of-any-codecs-function-pointers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!