[vlc-devel] [PATCH] avcodec: remove deprecation warning for av*_register_all

Alexandre Janniaux ajanni at videolabs.io
Wed Apr 8 15:07:15 CEST 2020


>From doc/APIchanges:

    2018-02-06 - 0694d87024 - lavf 58.9.100 - avformat.h
      Deprecate use of av_register_input_format(), av_register_output_format(),
      av_register_all(), av_iformat_next(), av_oformat_next().
      Add av_demuxer_iterate(), and av_muxer_iterate().

    2018-02-06 - 36c85d6e77 - lavc 58.10.100 - avcodec.h
      Deprecate use of avcodec_register(), avcodec_register_all(),
      av_codec_next(), av_register_codec_parser(), and av_parser_next().
      Add av_codec_iterate() and av_parser_iterate().

They are no-op since those updates. If compiling with a recent release,
just don't call av*_register_all to prevent warnings.
---
 modules/codec/avcodec/avcommon.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/codec/avcodec/avcommon.h b/modules/codec/avcodec/avcommon.h
index 671cde5c81..fa06616433 100644
--- a/modules/codec/avcodec/avcommon.h
+++ b/modules/codec/avcodec/avcommon.h
@@ -109,6 +109,7 @@ static inline void vlc_init_avutil(vlc_object_t *obj)
 
 #ifdef HAVE_LIBAVFORMAT_AVFORMAT_H
 # include <libavformat/avformat.h>
+# include <libavformat/version.h>
 static inline void vlc_init_avformat(vlc_object_t *obj)
 {
     vlc_avcodec_lock();
@@ -117,7 +118,9 @@ static inline void vlc_init_avformat(vlc_object_t *obj)
 
     avformat_network_init();
 
+#if (LIBAVFORMAT_VERSION_MICRO >= 100) && (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 9, 100))
     av_register_all();
+#endif
 
     vlc_avcodec_unlock();
 }
@@ -125,13 +128,16 @@ static inline void vlc_init_avformat(vlc_object_t *obj)
 
 #ifdef HAVE_LIBAVCODEC_AVCODEC_H
 # include <libavcodec/avcodec.h>
+# include <libavcodec/version.h>
 static inline void vlc_init_avcodec(vlc_object_t *obj)
 {
     vlc_avcodec_lock();
 
     vlc_init_avutil(obj);
 
+#if (LIBAVFORMAT_VERSION_MICRO >= 100) && (LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 10, 100))
     avcodec_register_all();
+#endif
 
     vlc_avcodec_unlock();
 }
-- 
2.26.0



More information about the vlc-devel mailing list