[FFmpeg-devel] [PATCH 02/17] avdevice: deprecate av_*_device_next()
Anton Khirnov
anton at khirnov.net
Thu May 28 23:15:44 EEST 2020
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(-)
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 */
--
2.26.2
More information about the ffmpeg-devel
mailing list