]> git.sesse.net Git - ffmpeg/commitdiff
lavfi/formats: more logical testing of inputs and outputs.
authorNicolas George <george@nsup.org>
Sun, 23 Aug 2020 09:52:16 +0000 (11:52 +0200)
committerNicolas George <george@nsup.org>
Tue, 8 Sep 2020 12:22:24 +0000 (14:22 +0200)
ff_set_common_formats() is currently only called after
graph_check_validity(), guaranteeing that inputs and outputs
are connected.
If we want to support configuring partially-connected graphs,
we will have a lot of redesign to do anyway.

Fix CID 1466262 / 1466263.

libavfilter/formats.c

index 95361170c5fa0dcef1326e75390b71b904876aeb..c54aff688f306e9891ec5503d0e1264408effc39 100644 (file)
@@ -594,8 +594,8 @@ int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
 int ff_default_query_formats(AVFilterContext *ctx)
 {
     int ret;
-    enum AVMediaType type = ctx->inputs  && ctx->inputs [0] ? ctx->inputs [0]->type :
-                            ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type :
+    enum AVMediaType type = ctx->nb_inputs  ? ctx->inputs [0]->type :
+                            ctx->nb_outputs ? ctx->outputs[0]->type :
                             AVMEDIA_TYPE_VIDEO;
 
     ret = ff_set_common_formats(ctx, ff_all_formats(type));