]> git.sesse.net Git - ffmpeg/commitdiff
avdevice/avdevice: Constify av_*_device_next API
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 25 Feb 2021 01:58:13 +0000 (02:58 +0100)
committerJames Almer <jamrial@gmail.com>
Tue, 27 Apr 2021 13:43:14 +0000 (10:43 -0300)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
doc/APIchanges
fftools/cmdutils.c
libavdevice/alldevices.c
libavdevice/avdevice.h

index c4a112bd9ffa9a00563fbd064b7dfebd84189084..9a29421446e3a8a75012f95ffba0b43c8a15a2bd 100644 (file)
@@ -14,6 +14,10 @@ libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2021-04-27 - xxxxxxxxxx - lavd yyyyyyyyy - avdevice.h
+  The av_*_device_next API functions now accept and return
+  pointers to const AVInputFormat resp. AVOutputFormat.
+
 2021-04-27 - xxxxxxxxxx - lavd yyyyyyyyy - avdevice.h
   avdevice_list_input_sources and avdevice_list_output_sinks now accept
   pointers to const AVInputFormat resp. const AVOutputFormat.
index 822fa8df456b013900ee1692b4ea40112b61206f..4148285971eb049a6e4526801c8b5f076183aeb9 100644 (file)
@@ -2289,7 +2289,7 @@ static int show_sinks_sources_parse_arg(const char *arg, char **dev, AVDictionar
 
 int show_sources(void *optctx, const char *opt, const char *arg)
 {
-    AVInputFormat *fmt = NULL;
+    const AVInputFormat *fmt = NULL;
     char *dev = NULL;
     AVDictionary *opts = NULL;
     int ret = 0;
@@ -2327,7 +2327,7 @@ int show_sources(void *optctx, const char *opt, const char *arg)
 
 int show_sinks(void *optctx, const char *opt, const char *arg)
 {
-    AVOutputFormat *fmt = NULL;
+    const AVOutputFormat *fmt = NULL;
     char *dev = NULL;
     AVDictionary *opts = NULL;
     int ret = 0;
index 92b27a1d1457623ff220fb14c006e0c442f812ea..f65317018a7ffe49cc8806e0ae01d7bb4b1eb6a2 100644 (file)
@@ -68,7 +68,7 @@ void avdevice_register_all(void)
     avpriv_register_devices(outdev_list, indev_list);
 }
 
-static void *next_input(const AVInputFormat *prev, AVClassCategory c2)
+static const void *next_input(const AVInputFormat *prev, AVClassCategory c2)
 {
     const AVClass *pc;
     const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_INPUT;
@@ -91,10 +91,10 @@ static void *next_input(const AVInputFormat *prev, AVClassCategory c2)
             continue;
         category = pc->category;
     } while (category != c1 && category != c2);
-    return (AVInputFormat *)fmt;
+    return fmt;
 }
 
-static void *next_output(const AVOutputFormat *prev, AVClassCategory c2)
+static const void *next_output(const AVOutputFormat *prev, AVClassCategory c2)
 {
     const AVClass *pc;
     const AVClassCategory c1 = AV_CLASS_CATEGORY_DEVICE_OUTPUT;
@@ -117,25 +117,25 @@ static void *next_output(const AVOutputFormat *prev, AVClassCategory c2)
             continue;
         category = pc->category;
     } while (category != c1 && category != c2);
-    return (AVOutputFormat *)fmt;
+    return fmt;
 }
 
-AVInputFormat *av_input_audio_device_next(AVInputFormat  *d)
+const AVInputFormat *av_input_audio_device_next(const AVInputFormat  *d)
 {
     return next_input(d, AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT);
 }
 
-AVInputFormat *av_input_video_device_next(AVInputFormat  *d)
+const AVInputFormat *av_input_video_device_next(const AVInputFormat  *d)
 {
     return next_input(d, AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT);
 }
 
-AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d)
+const AVOutputFormat *av_output_audio_device_next(const AVOutputFormat *d)
 {
     return next_output(d, AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT);
 }
 
-AVOutputFormat *av_output_video_device_next(AVOutputFormat *d)
+const AVOutputFormat *av_output_video_device_next(const AVOutputFormat *d)
 {
     return next_output(d, AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT);
 }
index d0b0f23f5dd34804f1accb1ede18f04fb42af6bc..8370bbc7f2b0ba7f61c9a61257f8ac96019cb5ce 100644 (file)
@@ -77,7 +77,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.
  */
-AVInputFormat *av_input_audio_device_next(AVInputFormat  *d);
+const AVInputFormat *av_input_audio_device_next(const AVInputFormat  *d);
 
 /**
  * Video input devices iterator.
@@ -86,7 +86,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.
  */
-AVInputFormat *av_input_video_device_next(AVInputFormat  *d);
+const AVInputFormat *av_input_video_device_next(const AVInputFormat  *d);
 
 /**
  * Audio output devices iterator.
@@ -95,7 +95,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.
  */
-AVOutputFormat *av_output_audio_device_next(AVOutputFormat *d);
+const AVOutputFormat *av_output_audio_device_next(const AVOutputFormat *d);
 
 /**
  * Video output devices iterator.
@@ -104,7 +104,7 @@ 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.
  */
-AVOutputFormat *av_output_video_device_next(AVOutputFormat *d);
+const AVOutputFormat *av_output_video_device_next(const AVOutputFormat *d);
 
 typedef struct AVDeviceRect {
     int x;      /**< x coordinate of top left corner */