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

Alexandre Janniaux git at videolan.org
Sat Apr 11 11:04:47 CEST 2020


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Wed Apr  8 15:07:15 2020 +0200| [d2887bd8d6623b4b8db88d87c1e3d390ba483aa1] | committer: Alexandre Janniaux

avcodec: remove deprecation warning for av*_register_all

>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.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d2887bd8d6623b4b8db88d87c1e3d390ba483aa1
---

 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();
 }



More information about the vlc-commits mailing list