]> git.sesse.net Git - ffmpeg/blobdiff - libavfilter/vf_mergeplanes.c
Merge commit 'fb472e1a11a4e0caed2c3c91da01ea8e35d9e3f8'
[ffmpeg] / libavfilter / vf_mergeplanes.c
index ea796be10f7b09cb9b137e5251e801d3e57bd283..2d9db843f44b5d411e5487d5ca1bf705975ffcbe 100644 (file)
@@ -116,22 +116,25 @@ static int query_formats(AVFilterContext *ctx)
 {
     MergePlanesContext *s = ctx->priv;
     AVFilterFormats *formats = NULL;
-    int i;
+    int i, ret;
 
     s->outdesc = av_pix_fmt_desc_get(s->out_fmt);
     for (i = 0; av_pix_fmt_desc_get(i); i++) {
         const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(i);
         if (desc->comp[0].depth == s->outdesc->comp[0].depth &&
-            av_pix_fmt_count_planes(i) == desc->nb_components)
-            ff_add_format(&formats, i);
+            av_pix_fmt_count_planes(i) == desc->nb_components &&
+            (ret = ff_add_format(&formats, i)) < 0)
+                return ret;
     }
 
     for (i = 0; i < s->nb_inputs; i++)
-        ff_formats_ref(formats, &ctx->inputs[i]->out_formats);
+        if ((ret = ff_formats_ref(formats, &ctx->inputs[i]->out_formats)) < 0)
+            return ret;
 
     formats = NULL;
-    ff_add_format(&formats, s->out_fmt);
-    ff_formats_ref(formats, &ctx->outputs[0]->in_formats);
+    if ((ret = ff_add_format(&formats, s->out_fmt)) < 0 ||
+        (ret = ff_formats_ref(formats, &ctx->outputs[0]->in_formats)) < 0)
+        return ret;
 
     return 0;
 }