From 39630dc8b6c2241df9e0e6066e1bd858b864f7de Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 1 May 2021 21:53:56 +0200 Subject: build: address AVCodec, AVInputFormat, AVOutputFormat const warnings FFmpeg recently changed these to be const on their side. --- common/av_common.c | 4 ++-- common/encode_lavc.c | 6 +++--- common/encode_lavc.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'common') diff --git a/common/av_common.c b/common/av_common.c index 01428ff2f4..2eae8c4e3e 100644 --- a/common/av_common.c +++ b/common/av_common.c @@ -270,7 +270,7 @@ int mp_codec_to_av_codec_id(const char *codec) if (desc) id = desc->id; if (id == AV_CODEC_ID_NONE) { - AVCodec *avcodec = avcodec_find_decoder_by_name(codec); + const AVCodec *avcodec = avcodec_find_decoder_by_name(codec); if (avcodec) id = avcodec->id; } @@ -285,7 +285,7 @@ const char *mp_codec_from_av_codec_id(int codec_id) if (desc) name = desc->name; if (!name) { - AVCodec *avcodec = avcodec_find_decoder(codec_id); + const AVCodec *avcodec = avcodec_find_decoder(codec_id); if (avcodec) name = avcodec->name; } diff --git a/common/encode_lavc.c b/common/encode_lavc.c index 2af93d239f..cf033e07d5 100644 --- a/common/encode_lavc.c +++ b/common/encode_lavc.c @@ -735,7 +735,7 @@ static void encoder_destroy(void *ptr) free_stream(p->twopass_bytebuffer); } -static AVCodec *find_codec_for(struct encode_lavc_context *ctx, +static const AVCodec *find_codec_for(struct encode_lavc_context *ctx, enum stream_type type, bool *used_auto) { char *codec_name = type == STREAM_VIDEO @@ -746,7 +746,7 @@ static AVCodec *find_codec_for(struct encode_lavc_context *ctx, *used_auto = !(codec_name && codec_name[0]); - AVCodec *codec; + const AVCodec *codec; if (*used_auto) { codec = avcodec_find_encoder(av_guess_codec(ctx->oformat, NULL, ctx->options->file, NULL, @@ -797,7 +797,7 @@ struct encoder_context *encoder_context_alloc(struct encode_lavc_context *ctx, }; bool auto_codec; - AVCodec *codec = find_codec_for(ctx, type, &auto_codec); + const AVCodec *codec = find_codec_for(ctx, type, &auto_codec); const char *tname = stream_type_name(type); if (!codec) { diff --git a/common/encode_lavc.h b/common/encode_lavc.h index 06e7254e86..cc4030a292 100644 --- a/common/encode_lavc.h +++ b/common/encode_lavc.h @@ -41,7 +41,7 @@ struct encode_lavc_context { struct encode_opts *options; struct mp_log *log; struct encode_priv *priv; - AVOutputFormat *oformat; + const AVOutputFormat *oformat; const char *filename; // All entry points must be guarded with the lock. Functions called by @@ -71,7 +71,7 @@ struct encoder_context { struct mpv_global *global; struct encode_opts *options; struct mp_log *log; - AVOutputFormat *oformat; + const AVOutputFormat *oformat; // (avoid using this) struct encode_lavc_context *encode_lavc_ctx; -- cgit v1.2.3