]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/avf_ahistogram.c
avfilter: Constify all AVFilters
[ffmpeg] / libavfilter / avf_ahistogram.c
index a0931bfa58a2530efebc35d3e8887c168a3aa6be..864c061c2f1c27ab0db42d4e712d27a0a292d35e 100644 (file)
@@ -99,17 +99,17 @@ static int query_formats(AVFilterContext *ctx)
     int ret = AVERROR(EINVAL);
 
     formats = ff_make_format_list(sample_fmts);
-    if ((ret = ff_formats_ref         (formats, &inlink->out_formats        )) < 0 ||
+    if ((ret = ff_formats_ref         (formats, &inlink->outcfg.formats        )) < 0 ||
         (layouts = ff_all_channel_counts()) == NULL ||
-        (ret = ff_channel_layouts_ref (layouts, &inlink->out_channel_layouts)) < 0)
+        (ret = ff_channel_layouts_ref (layouts, &inlink->outcfg.channel_layouts)) < 0)
         return ret;
 
     formats = ff_all_samplerates();
-    if ((ret = ff_formats_ref(formats, &inlink->out_samplerates)) < 0)
+    if ((ret = ff_formats_ref(formats, &inlink->outcfg.samplerates)) < 0)
         return ret;
 
     formats = ff_make_format_list(pix_fmts);
-    if ((ret = ff_formats_ref(formats, &outlink->in_formats)) < 0)
+    if ((ret = ff_formats_ref(formats, &outlink->incfg.formats)) < 0)
         return ret;
 
     return 0;
@@ -163,6 +163,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     const int w = s->w;
     int c, y, n, p, bin;
     uint64_t acmax = 1;
+    AVFrame *clone;
 
     if (!s->out || s->out->width  != outlink->w ||
                    s->out->height != outlink->h) {
@@ -363,7 +364,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
             s->ypos = H;
     }
 
-    return ff_filter_frame(outlink, av_frame_clone(s->out));
+    clone = av_frame_clone(s->out);
+    if (!clone)
+        return AVERROR(ENOMEM);
+
+    return ff_filter_frame(outlink, clone);
 }
 
 static int activate(AVFilterContext *ctx)
@@ -419,7 +424,7 @@ static const AVFilterPad ahistogram_outputs[] = {
     { NULL }
 };
 
-AVFilter ff_avf_ahistogram = {
+const AVFilter ff_avf_ahistogram = {
     .name          = "ahistogram",
     .description   = NULL_IF_CONFIG_SMALL("Convert input audio to histogram video output."),
     .uninit        = uninit,