我有一个解码器代码。我正试图将它整合到ffmpeg framework
。FFMPEG:是为编解码器强制定义上下文吗?
我指的是该怎么这里给出:http://wiki.multimedia.cx/index.php?title=FFmpeg_codec_howto
据该文章中,我需要在我decoder_name.c
文件中定义的结构。
示例结构如下所示:
AVCodec sample_decoder =
{
.name = "sample",
.type = AVCODEC_TYPE_VIDEO,
.id = AVCODEC_ID_SAMPLE,
// .priv_data_size = sizeof(COOKContext),
.init = sample_decode_init,
.close = sample_decode_close,
.decode = sample_decode_frame,
};
凡
.name -> specifies the short name of my decoder.
.type -> is used to specify that it is a video decoder.
.id -> is an unique id that i'm assigning to my video decoder.
.init -> is a function pointer to the function in my decoder code that performs decoder related initializations
.decode -> is a function pointer to the function in my decoder code that decodes a single frame, given the input data (elementary stream).
.close -> is a function pointer to the function in my decoder that frees all allocated memory i.e. the memory allocated in init.
然而,我的疑问是根据上述文章,还有一个字段称为.priv_data_size
持有的大小一些背景。
是否必须拥有此字段.priv_data_size
,因为根据上面的文章,我不需要定义结构AVCodec
的所有参数。此外,我没有任何这样的上下文为我的解码器。但是,当我通过ffmpeg的libavcodec
中的其他可用解码器的代码时,我发现每个解码器都定义了这个。如果我没有指定这个,我的解码器能工作吗?因为这个,我无法继续。请提供一些相同的指导。
- 提前感谢。
很高兴听到您是维护该帖子的人。它真的帮助像我这样的人开始使用编解码器集成。首先感谢这篇文章和你的回答。其次,如果您确实有任何此类相关帖子,请在本节中提供您的宝贵帖子链接。这对每个人都有帮助。谢谢:) – sam
这里是我写的另一篇文章,以回应一系列与多媒体有关的问题,可能会感兴趣:http://stackoverflow.com/a/9958424/475067 –