close
/* register all codecs, demux and protocols */
avcodec_register_all();
av_register_all();
=>/ffmpeg/libavcodec/allcodecs.c
#define REGISTER_DECODER(X,x) \
{ \
extern AVCodec x##_decoder; \
if (CONFIG_##X##_DECODER) \
avcodec_register(&x##_decoder); \
}
avcodec_register_all()
{
/* 自己加入想要的名稱 */
REGISTER_DECODER(XXX_MPEGVIDEO, xxx_mpegvideo);
REGISTER_DECODER(XXX_MPEG1VIDEO, xxx_mpeg1video);
REGISTER_DECODER(XXX_MPEG2VIDEO, xxx_mpeg2video);
REGISTER_DECODER(XXX_MSMPEG4V3, xxx_msmpeg4v3);
REGISTER_DECODER(XXX_MPEG4, xxx_mpeg4);
}
=>/ffmpeg/libavcodec/utils.c
void avcodec_register(AVCodec *codec)
{
AVCodec **p;
avcodec_init();
p = &first_avcodec;
while (*p != NULL) p = &(*p)->next;
*p = codec;
codec->next = NULL;
}
=>/ffmpeg/libavformat/allformats.c
void av_register_all(void)
{
/* (de)muxers */
REGISTER_MUXER(MP2, mp2);
REGISTER_MUXER(MP4, mp4);
REGISTER_MUXER(MPEG1VIDEO, mpeg1video);
REGISTER_MUXER(MPEG2VIDEO, mpeg2video);
REGISTER_MUXER(MPEG2VOB, mpeg2vob);
REGISTER_DEMUXER(MPEGPS, mpegps);
REGISTER_DEMUXER(AAC, aac);
REGISTER_MUXDEMUX(AC3, ac3);
REGISTER_MUXDEMUX(AVI, avi);
REGISTER_MUXDEMUX(MOV, mov);
REGISTER_MUXDEMUX(MP3, mp3);
REGISTER_MUXDEMUX(MPEGTS, mpegts);
}
#define REGISTER_MUXER(X,x) \
{ \
extern AVOutputFormat x##_muxer; \
if (CONFIG_##X##_MUXER) \
av_register_output_format(&x##_muxer); \
}
#define REGISTER_DEMUXER(X,x) \
{ \
extern AVInputFormat x##_demuxer; \
if (CONFIG_##X##_DEMUXER) \
av_register_input_format(&x##_demuxer); \
}
#define REGISTER_MUXDEMUX(X,x) REGISTER_MUXER(X,x); REGISTER_DEMUXER(X,x)
=>/ffmpeg/libavformat/utils.c
void av_register_input_format(AVInputFormat *format)
{
AVInputFormat **p;
p = &first_iformat;
while (*p != NULL) p = &(*p)->next;
*p = format;
format->next = NULL;
}
void av_register_output_format(AVOutputFormat *format)
{
AVOutputFormat **p;
p = &first_oformat;
while (*p != NULL) p = &(*p)->next;
*p = format;
format->next = NULL;
}
全站熱搜
留言列表