Signed-off-by: Michael Niedermayer <michae...@gmx.at> --- libavformat/allformats.c | 44 +++++++++++++++++++++++++++++++------------- libavformat/avformat.h | 5 +++++ 2 files changed, 36 insertions(+), 13 deletions(-)
diff --git a/libavformat/allformats.c b/libavformat/allformats.c index d54ed9b..b613bed 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -26,37 +26,42 @@ #include "version.h" #define REGISTER_MUXER(X, x) \ - { \ + if (!name || !strcmp(name, AV_STRINGIFY(x##_muxer))) { \ extern AVOutputFormat ff_##x##_muxer; \ - if (CONFIG_##X##_MUXER) \ + if (CONFIG_##X##_MUXER) { \ av_register_output_format(&ff_##x##_muxer); \ + found++; \ + } \ } #define REGISTER_DEMUXER(X, x) \ - { \ + if (!name || !strcmp(name, AV_STRINGIFY(x##_demuxer))) { \ extern AVInputFormat ff_##x##_demuxer; \ - if (CONFIG_##X##_DEMUXER) \ + if (CONFIG_##X##_DEMUXER) { \ av_register_input_format(&ff_##x##_demuxer); \ + found++; \ + } \ } #define REGISTER_MUXDEMUX(X, x) REGISTER_MUXER(X, x); REGISTER_DEMUXER(X, x) #define REGISTER_PROTOCOL(X, x) \ - { \ + if (!name || !strcmp(name, AV_STRINGIFY(x##_protocol))) { \ extern URLProtocol ff_##x##_protocol; \ - if (CONFIG_##X##_PROTOCOL) \ + if (CONFIG_##X##_PROTOCOL) { \ ffurl_register_protocol(&ff_##x##_protocol); \ + found++; \ + } \ } -void av_register_all(void) +int av_register_one(const char *name) { - static int initialized; - - if (initialized) - return; - initialized = 1; + int found = 0; - avcodec_register_all(); + if (name) { + found = avcodec_register_one(name); + } else + avcodec_register_all(); /* (de)muxers */ REGISTER_MUXER (A64, a64); @@ -383,4 +388,17 @@ void av_register_all(void) REGISTER_PROTOCOL(LIBRTMPTE, librtmpte); REGISTER_PROTOCOL(LIBSSH, libssh); REGISTER_PROTOCOL(LIBSMBCLIENT, libsmbclient); + + return found; } + +void av_register_all(void) +{ + static int initialized; + + if (initialized) + return; + initialized = 1; + + av_register_one(NULL); +} \ No newline at end of file diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 78054de..902a329 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1782,6 +1782,11 @@ const char *avformat_license(void); */ void av_register_all(void); +/** + * @returns the number of newly registered entities + */ +int av_register_one(const char *name); + void av_register_input_format(AVInputFormat *format); void av_register_output_format(AVOutputFormat *format); -- 1.7.9.5 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel