]> git.sesse.net Git - ffmpeg/commitdiff
avformat/avformat, utils: Make av_find_best_stream const-correct
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 25 Feb 2021 00:53:40 +0000 (01:53 +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
doc/examples/extract_mvs.c
doc/examples/filtering_audio.c
doc/examples/filtering_video.c
doc/examples/hw_decode.c
doc/examples/vaapi_transcode.c
libavformat/avformat.h
libavformat/utils.c

index 9b7a2d4b99107b2cf82c7dc35e3b1ce59e4ff2c9..9a5cfa7dc03cb1c7feb7f5a4b1027765500c7b73 100644 (file)
@@ -14,6 +14,10 @@ libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2021-04-27 - xxxxxxxxxx - lavf yyyyyyyyy - avformat.h
+  av_find_best_stream now uses a const AVCodec ** parameter
+  for the returned decoder.
+
 2021-04-27 - xxxxxxxxxx - lavc yyyyyyyyy - codec.h
   avcodec_find_encoder_by_name(), avcodec_find_encoder(),
   avcodec_find_decoder_by_name() and avcodec_find_decoder()
index de31ccd2b9877c8b33ac602c6a392e0fd8cd5f4c..42e1844150e5505b624e1efa93e4abd2aeea0e59 100644 (file)
@@ -78,7 +78,7 @@ static int open_codec_context(AVFormatContext *fmt_ctx, enum AVMediaType type)
     int ret;
     AVStream *st;
     AVCodecContext *dec_ctx = NULL;
-    AVCodec *dec = NULL;
+    const AVCodec *dec = NULL;
     AVDictionary *opts = NULL;
 
     ret = av_find_best_stream(fmt_ctx, type, -1, -1, &dec, 0);
index 834b137cd93fb89b3e83fc8a15f18a5c5193c1b9..508c19c60bfce641c9aeefc4fc625a6bf2432408 100644 (file)
@@ -48,8 +48,8 @@ static int audio_stream_index = -1;
 
 static int open_input_file(const char *filename)
 {
+    const AVCodec *dec;
     int ret;
-    AVCodec *dec;
 
     if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0) {
         av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
index 105a200d93401f6ea27cd0b8cb71fca8b3ff4b98..88394530abbd9b8bc509f4a51d9c40deffcc8f5f 100644 (file)
@@ -53,8 +53,8 @@ static int64_t last_pts = AV_NOPTS_VALUE;
 
 static int open_input_file(const char *filename)
 {
+    const AVCodec *dec;
     int ret;
-    AVCodec *dec;
 
     if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0) {
         av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
index 71be6e670914c49a81afb7554b32d3c8ec664ca1..096a229c0d2a9934b17ed4641cbbdd91ef5e042d 100644 (file)
@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
     int video_stream, ret;
     AVStream *video = NULL;
     AVCodecContext *decoder_ctx = NULL;
-    AVCodec *decoder = NULL;
+    const AVCodec *decoder = NULL;
     AVPacket packet;
     enum AVHWDeviceType type;
     int i;
index e9b33eede06bdd6091303ac022125729991dd079..a174bb643a7f01aee9b2759dd727e8ad2550a742 100644 (file)
@@ -62,7 +62,7 @@ static enum AVPixelFormat get_vaapi_format(AVCodecContext *ctx,
 static int open_input_file(const char *filename)
 {
     int ret;
-    AVCodec *decoder = NULL;
+    const AVCodec *decoder = NULL;
     AVStream *video = NULL;
 
     if ((ret = avformat_open_input(&ifmt_ctx, filename, NULL, NULL)) < 0) {
index 23bdaa207bc168eb74b1671c3fd72051175236a7..28069d45dc28dd2323cb3dc4958279f8e06cce51 100644 (file)
@@ -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);
 
 /**
index 7078891dc0d103e9c38e6d3aabe740c342b0b82f..2f66f539a693ddbfa92aa6893b49afd97f79131b 100644 (file)
@@ -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;
 }