Ffmpeg源代碼簡單分析之解碼2

static void   register_all(void)

allformats.c (libavformat)

#include “libavformat/avformat.h”

 

void  avcodec_register_all(void)

allcodecs.c (libavcodec)

#include “libavformat/ avcodec.h”


函數調用關係圖如下圖所示。av_register_all()調用了avcodec_register_all()avcodec_register_all()註冊了和編解碼器有關的組件:硬件加速器,解碼器,編碼器,ParserBitstream Filterav_register_all()除了調用avcodec_register_all()之外,還註冊了複用器,解複用器,協議處理器。

該函數在所有基於ffmpeg的應用程序中幾乎都是第一個被調用的。只有調用了該函數,才能使用複用器,編碼器等

Ps: 此函數的目的就是將實實在在的組件(編解碼器AVCodec 硬件加速器AVHWAccel 分析器 AVCodecParser 複用器AvInputFormat 解複用器AvOutputFormat 等 )註冊到系統鏈表中 以備後續使用

 

下面列舉幾個實實在在的組件:

 AVInputFormat ff_live_flv_demuxer = {    .name           = "live_flv",    .long_name      = NULL_IF_CONFIG_SMALL("live RTMP FLV (Flash Video)"),    .priv_data_size = sizeof(FLVContext),    .read_probe     = live_flv_probe,    .read_header    = flv_read_header,    .read_packet    = flv_read_packet,    .read_seek      = flv_read_seek,    .read_close     = flv_read_close,    .extensions     = "flv",    .priv_class     = &live_flv_class,    .flags          = AVFMT_TS_DISCONT};

AVCodec ff_flv_encoder = {

   .name           = "flv",

   .long_name      = NULL_IF_CONFIG_SMALL("FLV / SorensonSpark / Sorenson H.263 (Flash Video)"),

   .type           =AVMEDIA_TYPE_VIDEO,

   .id             =AV_CODEC_ID_FLV1,

   .priv_data_size = sizeof(MpegEncContext),

   .init           =ff_mpv_encode_init,

   .encode2        =ff_mpv_encode_picture,

   .close          =ff_mpv_encode_end,

   .pix_fmts       = (const enumAVPixelFormat[]) { AV_PIX_FMT_YUV420P,

                                                    AV_PIX_FMT_NONE},

   .priv_class     = &flv_class,

};


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章