FFMPEG:解释任何编解码器函数指针的参数 [英] FFMPEG: Explain parameters of any codecs function pointers

查看:246
本文介绍了FFMPEG:解释任何编解码器函数指针的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读文章,如何在FFMPEG多媒体框架中集成编解码器
根据它,每个编解码器都需要定义3个基本函数,并将这些函数分配给结构 AVCodec 的函数指针。

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.

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

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.

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

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?

推荐答案

这个来源,它的一般想法是从 avpkt 中解码音频/视频帧,并将输出放在数据。基本上,API链接中最大的变化就是将 buf buf_size 卷入 AVPacket 。还有 got_frame_ptr 表示成功。

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.

这篇关于FFMPEG:解释任何编解码器函数指针的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆