FFMPEG:解释任何编解码器函数指针的参数

时间:2013-12-03 04:30:57

标签: video ffmpeg codec decoder

我正在阅读文章How to integrate a codec in FFMPEG multimedia framework。 根据它,每个编解码器都需要定义3个基本函数,并将这些函数分配给结构AVCodec的函数指针。

上述文章中指定的3个函数指针是:

.init -> takes care of allocations and other initializations

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

.decode -> frame by frame decoding.

对于函数指针.decode,分配的函数是:

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

这些参数的详细信息在上面的文章中指定。但是,在最新的代码中,当以相同的函数为例时,其声明如下所示:

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

我需要对内存执行一些映射操作。所以,我请求是否有人可以在函数声明中解释上述参数。另外,哪个参数具有用于解码帧的输入缓冲区?在解码帧之后,解码帧映射到哪个参数?

1 个答案:

答案 0 :(得分:2)

this source开始,通常的想法是从avpkt解码音频/视频帧并将输出放在data中。基本上,您链接中API的最大变化就是bufbuf_size汇总为AVPacket。并且got_frame_ptr表示成功。