From: Niklas Haas <g...@haasn.dev>

Each input is entirely independent and can have varying pixel formats,
color spaces, etc. To accomplish this, we need to make a full copy of the
format list for each subsequent input, rather than sharing the same ref.

Signed-off-by: Niklas Haas <g...@haasn.dev>
Sponsored-by: nxtedition
---
 libavfilter/vf_libplacebo.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_libplacebo.c b/libavfilter/vf_libplacebo.c
index ce2065cc35..6eeda7f252 100644
--- a/libavfilter/vf_libplacebo.c
+++ b/libavfilter/vf_libplacebo.c
@@ -1146,8 +1146,16 @@ static int libplacebo_query_format(const AVFilterContext 
*ctx,
         goto fail;
     }
 
-    for (int i = 0; i < s->nb_inputs; i++)
+    for (int i = 0; i < s->nb_inputs; i++) {
+        if (i > 0) {
+            /* Duplicate the format list for each subsequent input */
+            infmts = NULL;
+            for (int n = 0; n < cfg_in[0]->formats->nb_formats; n++)
+                RET(ff_add_format(&infmts, cfg_in[0]->formats->formats[n]));
+        }
         RET(ff_formats_ref(infmts, &cfg_in[i]->formats));
+    }
+
     RET(ff_formats_ref(outfmts, &cfg_out[0]->formats));
 
     /* Set colorspace properties */
-- 
2.47.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to