diff mbox series

[FFmpeg-devel,02/17] avdevice: deprecate av_*_device_next()

Message ID 20200528201559.22618-2-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,01/17] Remove unnecessary use of avcodec_close(). | expand

Checks

Context Check Description
andriy/default pending
andriy/make_warn warning New warnings during build
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Anton Khirnov May 28, 2020, 8:15 p.m. UTC
These functions rely on deprecated libavformat APIs and apparently have
zero users outside of cmdutils. Since the functionality they provide is
apparently not useful to anyone, deprecate them without replacement.
---
 doc/APIchanges         | 4 ++++
 fftools/cmdutils.c     | 2 +-
 fftools/cmdutils.h     | 4 ++--
 libavdevice/avdevice.c | 4 ++++
 libavdevice/avdevice.h | 6 ++++++
 5 files changed, 17 insertions(+), 3 deletions(-)

Comments

Josh Dekker May 28, 2020, 11:23 p.m. UTC | #1
On 28/05/2020 21:15, Anton Khirnov wrote:
> These functions rely on deprecated libavformat APIs and apparently have
> zero users outside of cmdutils. Since the functionality they provide is
> apparently not useful to anyone, deprecate them without replacement.
> ---
>   doc/APIchanges         | 4 ++++
>   fftools/cmdutils.c     | 2 +-
>   fftools/cmdutils.h     | 4 ++--
>   libavdevice/avdevice.c | 4 ++++
>   libavdevice/avdevice.h | 6 ++++++
>   5 files changed, 17 insertions(+), 3 deletions(-)
> 
> [...]

This is the last part of the iterate() API update. I was recently 
looking at this again, and I think this is the best way to solve it.
Nicolas George May 29, 2020, 11:09 a.m. UTC | #2
Anton Khirnov (12020-05-28):
> These functions rely on deprecated libavformat APIs and apparently have
> zero users outside of cmdutils. Since the functionality they provide is
> apparently not useful to anyone, deprecate them without replacement.

Unacceptable and fallacious.

Libavdevice is a library, and as such its point is to provide a public
API. cmdutils is the part of FFmpeg where we factored the common used of
the public APIs: it is absolutely normal for an API to be used only
there.

Furthermore, since it is a library and a public API, it can be used by
other projects, including unpublished projects, closed-source projects,
etc.

I can work with you to update the implementation so that it does not use
deprecated lavf APIs if you point me where the issue was discussed. But
just removing these libavdevices API is not acceptable.

Regards,
diff mbox series

Patch

diff --git a/doc/APIchanges b/doc/APIchanges
index fb5534b5f5..f5b2a7b964 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@  libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2020-xx-xx - avdevice.h
+  Deprecate av_input_video_device_next, av_output_video_device_next,
+  av_input_audio_device_next, av_output_audio_device_next
+
 2020-xx-xx - xxxxxxxxxx - lavc 58.88.100 - avcodec.h codec.h
   Move AVCodec-related public API to new header codec.h.
 
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index dec18850d8..a948d478d5 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -2216,7 +2216,7 @@  double get_rotation(AVStream *st)
     return theta;
 }
 
-#if CONFIG_AVDEVICE
+#if CONFIG_AVDEVICE && FF_API_NEXT
 static int print_device_sources(AVInputFormat *fmt, AVDictionary *opts)
 {
     int ret, i;
diff --git a/fftools/cmdutils.h b/fftools/cmdutils.h
index 1917510589..ae5208f1aa 100644
--- a/fftools/cmdutils.h
+++ b/fftools/cmdutils.h
@@ -201,7 +201,7 @@  typedef struct OptionDef {
 void show_help_options(const OptionDef *options, const char *msg, int req_flags,
                        int rej_flags, int alt_flags);
 
-#if CONFIG_AVDEVICE
+#if CONFIG_AVDEVICE && FF_API_NEXT
 #define CMDUTILS_COMMON_OPTIONS_AVDEVICE                                                                                \
     { "sources"    , OPT_EXIT | HAS_ARG, { .func_arg = show_sources },                                                  \
       "list sources of the input device", "device" },                                                                   \
@@ -498,7 +498,7 @@  int show_demuxers(void *optctx, const char *opt, const char *arg);
  */
 int show_devices(void *optctx, const char *opt, const char *arg);
 
-#if CONFIG_AVDEVICE
+#if CONFIG_AVDEVICE && FF_API_NEXT
 /**
  * Print a listing containing autodetected sinks of the output device.
  * Device name with options may be passed as an argument to limit results.
diff --git a/libavdevice/avdevice.c b/libavdevice/avdevice.c
index 3d03d89f04..e45cc06153 100644
--- a/libavdevice/avdevice.c
+++ b/libavdevice/avdevice.c
@@ -78,6 +78,8 @@  const char * avdevice_license(void)
     return &LICENSE_PREFIX FFMPEG_LICENSE[sizeof(LICENSE_PREFIX) - 1];
 }
 
+#if FF_API_NEXT
+FF_DISABLE_DEPRECATION_WARNINGS
 static void *device_next(void *prev, int output,
                          AVClassCategory c1, AVClassCategory c2)
 {
@@ -99,6 +101,7 @@  static void *device_next(void *prev, int output,
     } while (category != c1 && category != c2);
     return prev;
 }
+FF_ENABLE_DEPRECATION_WARNINGS
 
 AVInputFormat *av_input_audio_device_next(AVInputFormat  *d)
 {
@@ -123,6 +126,7 @@  AVOutputFormat *av_output_video_device_next(AVOutputFormat *d)
     return device_next(d, 1, AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT,
                        AV_CLASS_CATEGORY_DEVICE_OUTPUT);
 }
+#endif
 
 int avdevice_app_to_dev_control_message(struct AVFormatContext *s, enum AVAppToDevMessageType type,
                                         void *data, size_t data_size)
diff --git a/libavdevice/avdevice.h b/libavdevice/avdevice.h
index ee9462480e..c63f661fc7 100644
--- a/libavdevice/avdevice.h
+++ b/libavdevice/avdevice.h
@@ -70,6 +70,7 @@  const char *avdevice_license(void);
  */
 void avdevice_register_all(void);
 
+#if FF_API_NEXT
 /**
  * Audio input devices iterator.
  *
@@ -77,6 +78,7 @@  void avdevice_register_all(void);
  * if d is non-NULL, returns the next registered input audio/video device after d
  * or NULL if d is the last one.
  */
+attribute_deprecated
 AVInputFormat *av_input_audio_device_next(AVInputFormat  *d);
 
 /**
@@ -86,6 +88,7 @@  AVInputFormat *av_input_audio_device_next(AVInputFormat  *d);
  * if d is non-NULL, returns the next registered input audio/video device after d
  * or NULL if d is the last one.
  */
+attribute_deprecated
 AVInputFormat *av_input_video_device_next(AVInputFormat  *d);
 
 /**
@@ -95,6 +98,7 @@  AVInputFormat *av_input_video_device_next(AVInputFormat  *d);
  * if d is non-NULL, returns the next registered output audio/video device after d
  * or NULL if d is the last one.
  */
+attribute_deprecated
 AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d);
 
 /**
@@ -104,7 +108,9 @@  AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d);
  * if d is non-NULL, returns the next registered output audio/video device after d
  * or NULL if d is the last one.
  */
+attribute_deprecated
 AVOutputFormat *av_output_video_device_next(AVOutputFormat *d);
+#endif
 
 typedef struct AVDeviceRect {
     int x;      /**< x coordinate of top left corner */