我有一個解碼器代碼。我正試圖將它整合到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 –