[FFmpeg-devel] [PATCH 02/87] avformat: Remove next API for AV(In|Out)putFormat

James Almer jamrial at gmail.com
Mon Apr 19 17:08:59 EEST 2021


From: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 libavformat/allformats.c | 98 ----------------------------------------
 libavformat/avformat.h   | 43 ------------------
 libavformat/version.h    |  3 --
 3 files changed, 144 deletions(-)

diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index fa093c7ac2..f450c1709b 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -22,10 +22,6 @@
 #include "libavutil/thread.h"
 #include "libavformat/internal.h"
 #include "avformat.h"
-#include "rtp.h"
-#include "rdt.h"
-#include "url.h"
-#include "version.h"
 
 /* (de)muxers */
 extern AVOutputFormat ff_a64_muxer;
@@ -573,104 +569,10 @@ const AVInputFormat *av_demuxer_iterate(void **opaque)
 
 static AVMutex avpriv_register_devices_mutex = AV_MUTEX_INITIALIZER;
 
-#if FF_API_NEXT
-FF_DISABLE_DEPRECATION_WARNINGS
-static AVOnce av_format_next_init = AV_ONCE_INIT;
-
-static void av_format_init_next(void)
-{
-    AVOutputFormat *prevout = NULL, *out;
-    AVInputFormat *previn = NULL, *in;
-
-    ff_mutex_lock(&avpriv_register_devices_mutex);
-
-    for (int i = 0; (out = (AVOutputFormat*)muxer_list[i]); i++) {
-        if (prevout)
-            prevout->next = out;
-        prevout = out;
-    }
-
-    if (outdev_list) {
-        for (int i = 0; (out = (AVOutputFormat*)outdev_list[i]); i++) {
-            if (prevout)
-                prevout->next = out;
-            prevout = out;
-        }
-    }
-
-    for (int i = 0; (in = (AVInputFormat*)demuxer_list[i]); i++) {
-        if (previn)
-            previn->next = in;
-        previn = in;
-    }
-
-    if (indev_list) {
-        for (int i = 0; (in = (AVInputFormat*)indev_list[i]); i++) {
-            if (previn)
-                previn->next = in;
-            previn = in;
-        }
-    }
-
-    ff_mutex_unlock(&avpriv_register_devices_mutex);
-}
-
-AVInputFormat *av_iformat_next(const AVInputFormat *f)
-{
-    ff_thread_once(&av_format_next_init, av_format_init_next);
-
-    if (f)
-#if FF_API_AVIOFORMAT
-        return f->next;
-#else
-        return (AVInputFormat *) f->next;
-#endif
-    else {
-        void *opaque = NULL;
-        return (AVInputFormat *)av_demuxer_iterate(&opaque);
-    }
-}
-
-AVOutputFormat *av_oformat_next(const AVOutputFormat *f)
-{
-    ff_thread_once(&av_format_next_init, av_format_init_next);
-
-    if (f)
-#if FF_API_AVIOFORMAT
-        return f->next;
-#else
-        return (AVOutputFormat *) f->next;
-#endif
-    else {
-        void *opaque = NULL;
-        return (AVOutputFormat *)av_muxer_iterate(&opaque);
-    }
-}
-
-void av_register_all(void)
-{
-    ff_thread_once(&av_format_next_init, av_format_init_next);
-}
-
-void av_register_input_format(AVInputFormat *format)
-{
-    ff_thread_once(&av_format_next_init, av_format_init_next);
-}
-
-void av_register_output_format(AVOutputFormat *format)
-{
-    ff_thread_once(&av_format_next_init, av_format_init_next);
-}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
-
 void avpriv_register_devices(const AVOutputFormat * const o[], const AVInputFormat * const i[])
 {
     ff_mutex_lock(&avpriv_register_devices_mutex);
     outdev_list = o;
     indev_list = i;
     ff_mutex_unlock(&avpriv_register_devices_mutex);
-#if FF_API_NEXT
-    av_format_init_next();
-#endif
 }
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 8600ee1bf7..6c97aff423 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -533,9 +533,6 @@ typedef struct AVOutputFormat {
 #define ff_const59
 #else
 #define ff_const59 const
-#endif
-#if FF_API_NEXT
-    ff_const59 struct AVOutputFormat *next;
 #endif
     /**
      * size of private data so that it can be allocated in the wrapper
@@ -683,10 +680,6 @@ typedef struct AVInputFormat {
      * New public fields should be added right above.
      *****************************************************************
      */
-#if FF_API_NEXT
-    ff_const59 struct AVInputFormat *next;
-#endif
-
     /**
      * Raw demuxers store their codec ID here.
      */
@@ -1941,24 +1934,6 @@ const char *avformat_configuration(void);
  */
 const char *avformat_license(void);
 
-#if FF_API_NEXT
-/**
- * Initialize libavformat and register all the muxers, demuxers and
- * protocols. If you do not call this function, then you can select
- * exactly which formats you want to support.
- *
- * @see av_register_input_format()
- * @see av_register_output_format()
- */
-attribute_deprecated
-void av_register_all(void);
-
-attribute_deprecated
-void av_register_input_format(AVInputFormat *format);
-attribute_deprecated
-void av_register_output_format(AVOutputFormat *format);
-#endif
-
 /**
  * Do global initialization of network libraries. This is optional,
  * and not recommended anymore.
@@ -1981,24 +1956,6 @@ int avformat_network_init(void);
  */
 int avformat_network_deinit(void);
 
-#if FF_API_NEXT
-/**
- * If f is NULL, returns the first registered input format,
- * if f is non-NULL, returns the next registered input format after f
- * or NULL if f is the last one.
- */
-attribute_deprecated
-AVInputFormat  *av_iformat_next(const AVInputFormat  *f);
-
-/**
- * If f is NULL, returns the first registered output format,
- * if f is non-NULL, returns the next registered output format after f
- * or NULL if f is the last one.
- */
-attribute_deprecated
-AVOutputFormat *av_oformat_next(const AVOutputFormat *f);
-#endif
-
 /**
  * Iterate over all registered muxers.
  *
diff --git a/libavformat/version.h b/libavformat/version.h
index 66068d4d56..d82adba668 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -91,9 +91,6 @@
 #ifndef FF_API_OLD_RTSP_OPTIONS
 #define FF_API_OLD_RTSP_OPTIONS         (LIBAVFORMAT_VERSION_MAJOR < 59)
 #endif
-#ifndef FF_API_NEXT
-#define FF_API_NEXT                     (LIBAVFORMAT_VERSION_MAJOR < 59)
-#endif
 #ifndef FF_API_DASH_MIN_SEG_DURATION
 #define FF_API_DASH_MIN_SEG_DURATION    (LIBAVFORMAT_VERSION_MAJOR < 59)
 #endif
-- 
2.31.1



More information about the ffmpeg-devel mailing list