我有一个解码器代码。我正在尝试将其集成到ffmpeg framework
.
我指的是这里给出的 HOW TO: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
。此外,我的解码器没有任何此类上下文。
但是,当我浏览libavcodec
ffmpeg 中其他可用解码器的代码时,我发现每个解码器都定义了这一点。如果我不指定,我的解码器会工作吗?因此,我无法继续。请提供一些相同的指导。
- 提前致谢。