[FFmpeg-devel] [PATCH 75/87] avformat/avformat, utils: Make av_find_best_stream const-correct

James Almer jamrial at gmail.com
Mon Apr 19 17:10:12 EEST 2021


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

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
 doc/APIchanges         | 4 ++++
 libavformat/avformat.h | 2 +-
 libavformat/utils.c    | 4 ++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index a823a4419c..d19b817660 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -17,6 +17,10 @@ API changes, most recent first:
 2021-04-17 - xxxxxxxxxx - lavu 56.73.100 - frame.h detection_bbox.h
   Add AV_FRAME_DATA_DETECTION_BBOXES
 
+2021-04-14 - xxxxxxxxxx - lavf yyyyyyyyy - avformat.h
+  av_find_best_stream now uses a const AVCodec ** parameter
+  for the returned decoder.
+
 2021-04-14 - xxxxxxxxxx - lavc yyyyyyyyy - codec.h
   avcodec_find_encoder_by_name(), avcodec_find_encoder(),
   avcodec_find_decoder_by_name() and avcodec_find_decoder()
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 23bdaa207b..28069d45dc 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2070,7 +2070,7 @@ int av_find_best_stream(AVFormatContext *ic,
                         enum AVMediaType type,
                         int wanted_stream_nb,
                         int related_stream,
-                        AVCodec **decoder_ret,
+                        const AVCodec **decoder_ret,
                         int flags);
 
 /**
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 7078891dc0..2f66f539a6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4200,7 +4200,7 @@ AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int
 
 int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type,
                         int wanted_stream_nb, int related_stream,
-                        AVCodec **decoder_ret, int flags)
+                        const AVCodec **decoder_ret, int flags)
 {
     int i, nb_streams = ic->nb_streams;
     int ret = AVERROR_STREAM_NOT_FOUND;
@@ -4260,7 +4260,7 @@ int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type,
         }
     }
     if (decoder_ret)
-        *decoder_ret = (AVCodec*)best_decoder;
+        *decoder_ret = best_decoder;
     return ret;
 }
 
-- 
2.31.1



More information about the ffmpeg-devel mailing list