]> git.sesse.net Git - ffmpeg/commitdiff
fftools, libavcodec, libavfilter: Add const to some AVCodec *
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 10 Sep 2020 20:11:57 +0000 (22:11 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 11 Sep 2020 12:42:36 +0000 (14:42 +0200)
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>
fftools/ffmpeg.h
fftools/ffmpeg_filter.c
libavcodec/avrndec.c
libavcodec/utils.c
libavfilter/lavfutils.c
libavfilter/src_movie.c
libavfilter/vf_mcdeint.c
libavfilter/vf_subtitles.c
libavfilter/vf_uspp.c

index 908bc73fca477a6aaf8c157a8d1725a462b20db9..8665218dcf59628d8d67baf71e013334ee6abc90 100644 (file)
@@ -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);
index 3c507f8c1d54f946ff4cce4d95f6c091e96b5439..e9e31e043ebaccbd1f78924aa3de80b8db7b5b4b 100644 (file)
@@ -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;
index a7bdab280d7463b4d7113560cb7fdb1da8ec037b..f4ec490de5e3107ec0c5224fca9f4af09ee39fae 100644 (file)
@@ -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");
index 2e5185f364536e965abfa4e6618f810da0c80958..d93a0953fa741b0572c0ea72762cdb6ab09885ce 100644 (file)
@@ -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";
index 57af5ebfdcd2828d311cbf46ccead953b00f75c9..a2085ed5efe85ca96cec2b35ace8cf9a2d84abec 100644 (file)
@@ -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;
index d83cb6d1e48986e9c7f60c6916bd9dca5deea5a0..ab12c34f4abda280531879df1f15df11f2c0000f 100644 (file)
@@ -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);
index 9cdec6308d80f473cb2b9cb9f847743a842c583f..bc7b3230d3c88257145d451d16e4b5fcc52123fd 100644 (file)
@@ -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;
index 08b4d4efcae95a0582e29eb8af3872a082622e47..de74afa2b72004d489cd92ac7fc3b4bb0f83d754 100644 (file)
@@ -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;
index 72a0f562af62f76d79848aa286b20dc1a9a644db..6a814350e868d321906ea21381a162f569aba117 100644 (file)
@@ -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);