aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-10 22:11:57 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-09-11 14:42:36 +0200
commit0086432fc72f6671d23ca67ede7e8bc18af7124e (patch)
treef2d236a7820442417cf76aa29318e7a16ece1ffd
parentb091df721050df77d537cee8156fe1a4406b1afb (diff)
downloadffmpeg-0086432fc72f6671d23ca67ede7e8bc18af7124e.tar.gz
fftools, libavcodec, libavfilter: Add const to some AVCodec *
The user has no business modifying the underlying AVCodec. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--fftools/ffmpeg.h5
-rw-r--r--fftools/ffmpeg_filter.c5
-rw-r--r--libavcodec/avrndec.c2
-rw-r--r--libavcodec/utils.c4
-rw-r--r--libavfilter/lavfutils.c2
-rw-r--r--libavfilter/src_movie.c2
-rw-r--r--libavfilter/vf_mcdeint.c2
-rw-r--r--libavfilter/vf_subtitles.c2
-rw-r--r--libavfilter/vf_uspp.c2
9 files changed, 14 insertions, 12 deletions
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 908bc73fca..8665218dcf 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -638,8 +638,9 @@ void assert_avoptions(AVDictionary *m);
int guess_input_channel_layout(InputStream *ist);
-enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *avctx, AVCodec *codec, enum AVPixelFormat target);
-void choose_sample_fmt(AVStream *st, AVCodec *codec);
+enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *avctx,
+ const AVCodec *codec, enum AVPixelFormat target);
+void choose_sample_fmt(AVStream *st, const AVCodec *codec);
int configure_filtergraph(FilterGraph *fg);
int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out);
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 3c507f8c1d..e9e31e043e 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -60,7 +60,8 @@ static const enum AVPixelFormat *get_compliance_unofficial_pix_fmts(enum AVCodec
}
}
-enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx, AVCodec *codec, enum AVPixelFormat target)
+enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx,
+ const AVCodec *codec, enum AVPixelFormat target)
{
if (codec && codec->pix_fmts) {
const enum AVPixelFormat *p = codec->pix_fmts;
@@ -90,7 +91,7 @@ enum AVPixelFormat choose_pixel_fmt(AVStream *st, AVCodecContext *enc_ctx, AVCod
return target;
}
-void choose_sample_fmt(AVStream *st, AVCodec *codec)
+void choose_sample_fmt(AVStream *st, const AVCodec *codec)
{
if (codec && codec->sample_fmts) {
const enum AVSampleFormat *p = codec->sample_fmts;
diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c
index a7bdab280d..f4ec490de5 100644
--- a/libavcodec/avrndec.c
+++ b/libavcodec/avrndec.c
@@ -46,7 +46,7 @@ static av_cold int init(AVCodecContext *avctx)
}
if(a->is_mjpeg) {
- AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_MJPEG);
+ const AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_MJPEG);
AVDictionary *thread_opt = NULL;
if (!codec) {
av_log(avctx, AV_LOG_ERROR, "MJPEG codec not found\n");
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 2e5185f364..d93a0953fa 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -695,7 +695,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) &&
avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
const char *codec_string = av_codec_is_encoder(codec) ? "encoder" : "decoder";
- AVCodec *codec2;
+ const AVCodec *codec2;
av_log(avctx, AV_LOG_ERROR,
"The %s '%s' is experimental but experimental codecs are not enabled, "
"add '-strict %d' if you want to use it.\n",
@@ -1193,7 +1193,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
const char *avcodec_get_name(enum AVCodecID id)
{
const AVCodecDescriptor *cd;
- AVCodec *codec;
+ const AVCodec *codec;
if (id == AV_CODEC_ID_NONE)
return "none";
diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c
index 57af5ebfdc..a2085ed5ef 100644
--- a/libavfilter/lavfutils.c
+++ b/libavfilter/lavfutils.c
@@ -27,7 +27,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
{
AVInputFormat *iformat = NULL;
AVFormatContext *format_ctx = NULL;
- AVCodec *codec;
+ const AVCodec *codec;
AVCodecContext *codec_ctx = NULL;
AVCodecParameters *par;
AVFrame *frame = NULL;
diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c
index d83cb6d1e4..ab12c34f4a 100644
--- a/libavfilter/src_movie.c
+++ b/libavfilter/src_movie.c
@@ -155,7 +155,7 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec)
static int open_stream(AVFilterContext *ctx, MovieStream *st)
{
- AVCodec *codec;
+ const AVCodec *codec;
int ret;
codec = avcodec_find_decoder(st->st->codecpar->codec_id);
diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c
index 9cdec6308d..bc7b3230d3 100644
--- a/libavfilter/vf_mcdeint.c
+++ b/libavfilter/vf_mcdeint.c
@@ -102,7 +102,7 @@ static int config_props(AVFilterLink *inlink)
{
AVFilterContext *ctx = inlink->dst;
MCDeintContext *mcdeint = ctx->priv;
- AVCodec *enc;
+ const AVCodec *enc;
AVCodecContext *enc_ctx;
AVDictionary *opts = NULL;
int ret;
diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index 08b4d4efca..de74afa2b7 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -302,7 +302,7 @@ static av_cold int init_subtitles(AVFilterContext *ctx)
AVDictionary *codec_opts = NULL;
AVFormatContext *fmt = NULL;
AVCodecContext *dec_ctx = NULL;
- AVCodec *dec = NULL;
+ const AVCodec *dec;
const AVCodecDescriptor *dec_desc;
AVStream *st;
AVPacket pkt;
diff --git a/libavfilter/vf_uspp.c b/libavfilter/vf_uspp.c
index 72a0f562af..6a814350e8 100644
--- a/libavfilter/vf_uspp.c
+++ b/libavfilter/vf_uspp.c
@@ -316,7 +316,7 @@ static int config_input(AVFilterLink *inlink)
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
int i;
- AVCodec *enc = avcodec_find_encoder(AV_CODEC_ID_SNOW);
+ const AVCodec *enc = avcodec_find_encoder(AV_CODEC_ID_SNOW);
if (!enc) {
av_log(ctx, AV_LOG_ERROR, "SNOW encoder not found.\n");
return AVERROR(EINVAL);