summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-05-01 21:53:56 +0200
committersfan5 <sfan5@live.de>2021-05-01 22:07:31 +0200
commit39630dc8b6c2241df9e0e6066e1bd858b864f7de (patch)
tree47e41a747f0597b9b3c0d061bef9c3051597684d
parent02fbdf8aaffac527ce33c81ace001b48aee9e953 (diff)
downloadmpv-39630dc8b6c2241df9e0e6066e1bd858b864f7de.tar.bz2
mpv-39630dc8b6c2241df9e0e6066e1bd858b864f7de.tar.xz
build: address AVCodec, AVInputFormat, AVOutputFormat const warnings
FFmpeg recently changed these to be const on their side.
-rw-r--r--audio/decode/ad_lavc.c2
-rw-r--r--audio/decode/ad_spdif.c2
-rw-r--r--audio/filter/af_lavcac3enc.c2
-rw-r--r--common/av_common.c4
-rw-r--r--common/encode_lavc.c6
-rw-r--r--common/encode_lavc.h4
-rw-r--r--demux/demux_lavf.c4
-rw-r--r--sub/lavc_conv.c2
-rw-r--r--sub/sd_lavc.c2
-rw-r--r--video/image_writer.c6
10 files changed, 17 insertions, 17 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c
index eaaf0729e9..228054e8d6 100644
--- a/audio/decode/ad_lavc.c
+++ b/audio/decode/ad_lavc.c
@@ -85,7 +85,7 @@ static bool init(struct mp_filter *da, struct mp_codec_params *codec,
struct ad_lavc_params *opts =
mp_get_config_group(ctx, da->global, &ad_lavc_conf);
AVCodecContext *lavc_context;
- AVCodec *lavc_codec;
+ const AVCodec *lavc_codec;
ctx->codec_timebase = mp_get_codec_timebase(codec);
diff --git a/audio/decode/ad_spdif.c b/audio/decode/ad_spdif.c
index 0b1977769a..520803c4b0 100644
--- a/audio/decode/ad_spdif.c
+++ b/audio/decode/ad_spdif.c
@@ -116,7 +116,7 @@ static void determine_codec_params(struct mp_filter *da, AVPacket *pkt,
if (profile != FF_PROFILE_UNKNOWN || spdif_ctx->codec_id != AV_CODEC_ID_DTS)
return;
- AVCodec *codec = avcodec_find_decoder(spdif_ctx->codec_id);
+ const AVCodec *codec = avcodec_find_decoder(spdif_ctx->codec_id);
if (!codec)
goto done;
diff --git a/audio/filter/af_lavcac3enc.c b/audio/filter/af_lavcac3enc.c
index 38f93a1c08..45e0aa64a2 100644
--- a/audio/filter/af_lavcac3enc.c
+++ b/audio/filter/af_lavcac3enc.c
@@ -68,7 +68,7 @@ struct priv {
struct mp_aframe *in_frame;
struct mp_aframe_pool *out_pool;
- struct AVCodec *lavc_acodec;
+ const struct AVCodec *lavc_acodec;
struct AVCodecContext *lavc_actx;
int bit_rate;
int out_samples; // upper bound on encoded output per AC3 frame
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;
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 2c69de447c..71fb9fc289 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -227,7 +227,7 @@ typedef struct lavf_priv {
bool own_stream;
char *filename;
struct format_hack format_hack;
- AVInputFormat *avif;
+ const AVInputFormat *avif;
int avif_flags;
AVFormatContext *avfc;
AVIOContext *pb;
@@ -443,7 +443,7 @@ static int lavf_check_file(demuxer_t *demuxer, enum demux_check check)
if (!lavfdopts->allow_mimetype || !mime_type)
mime_type = "";
- AVInputFormat *forced_format = NULL;
+ const AVInputFormat *forced_format = NULL;
const char *format = lavfdopts->format;
if (!format)
format = s->lavf_type;
diff --git a/sub/lavc_conv.c b/sub/lavc_conv.c
index d47b0c4c07..8e1d1aad7f 100644
--- a/sub/lavc_conv.c
+++ b/sub/lavc_conv.c
@@ -75,7 +75,7 @@ struct lavc_conv *lavc_conv_create(struct mp_log *log, const char *codec_name,
AVCodecContext *avctx = NULL;
AVDictionary *opts = NULL;
const char *fmt = get_lavc_format(priv->codec);
- AVCodec *codec = avcodec_find_decoder(mp_codec_to_av_codec_id(fmt));
+ const AVCodec *codec = avcodec_find_decoder(mp_codec_to_av_codec_id(fmt));
if (!codec)
goto error;
avctx = avcodec_alloc_context3(codec);
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index 77877fdbd1..e8da942a76 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -91,7 +91,7 @@ static int init(struct sd *sd)
struct sd_lavc_priv *priv = talloc_zero(NULL, struct sd_lavc_priv);
AVCodecContext *ctx = NULL;
- AVCodec *sub_codec = avcodec_find_decoder(cid);
+ const AVCodec *sub_codec = avcodec_find_decoder(cid);
if (!sub_codec)
goto error;
ctx = avcodec_alloc_context3(sub_codec);
diff --git a/video/image_writer.c b/video/image_writer.c
index fb297f9c0f..cff8609ded 100644
--- a/video/image_writer.c
+++ b/video/image_writer.c
@@ -103,7 +103,7 @@ static bool write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp
av_init_packet(&pkt);
- struct AVCodec *codec;
+ const AVCodec *codec;
if (ctx->opts->format == AV_CODEC_ID_WEBP) {
codec = avcodec_find_encoder_by_name("libwebp"); // non-animated encoder
} else {
@@ -251,7 +251,7 @@ static bool write_jpeg(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp
#endif
-static int get_encoder_format(struct AVCodec *codec, int srcfmt, bool highdepth)
+static int get_encoder_format(const AVCodec *codec, int srcfmt, bool highdepth)
{
const enum AVPixelFormat *pix_fmts = codec->pix_fmts;
int current = 0;
@@ -277,7 +277,7 @@ static int get_encoder_format(struct AVCodec *codec, int srcfmt, bool highdepth)
static int get_target_format(struct image_writer_ctx *ctx)
{
- struct AVCodec *codec = avcodec_find_encoder(ctx->opts->format);
+ const AVCodec *codec = avcodec_find_encoder(ctx->opts->format);
if (!codec)
goto unknown;