I'm having a a decoder code. I'm trying to integrate it into ffmpeg framework
.
I'm referring to the HOW TO given here: http://wiki.multimedia.cx/index.php?title=FFmpeg_codec_howto
According to that article i need to define a structure in my decoder_name.c
file.
The example structure is shown below:
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,
};
Where,
.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.
However, my doubt is according to the above mentioned article, there is another field called .priv_data_size
which hold the size of some context.
Is it compulsory to have this field .priv_data_size
because according to the above article, i need not define all the parameters of the structure AVCodec
. Further i do not possess any such context for my decoder.
However, when i go through the code of other available decoders in libavcodec
of ffmpeg, i find that every decoder has defined this. Will my decoder work if i do not specify this? I'm unable to proceed because of this. please provide some guidance regrading the same.
--Thanks in advance.