From 3d9e7056219bdddb2206a2bc3773c62c01c19927 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Wed, 3 Mar 2021 18:28:54 +1100 Subject: [PATCH] videoaggregator: allow selecting an alpha output from non-alpha inputs e.g. if we have: video-x/raw,format=I420 ! compositor ! video/x-raw,format=BGRA This will currently produce a warning as the alpha-ness of the chosen 'best' format (I420) will be different from the value restricted by the downstream caps filter. Part-of: --- gst-libs/gst/video/gstvideoaggregator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/video/gstvideoaggregator.c b/gst-libs/gst/video/gstvideoaggregator.c index c38bf484a..b1d557753 100644 --- a/gst-libs/gst/video/gstvideoaggregator.c +++ b/gst-libs/gst/video/gstvideoaggregator.c @@ -951,7 +951,9 @@ gst_video_aggregator_find_best_format (GstVideoAggregator * vagg, for (i = 0; i < vagg->priv->supported_formats->len; i++) { GstVideoFormatInfo *format_info = vagg->priv->supported_formats->pdata[i]; - if ((! !GST_VIDEO_FORMAT_INFO_HAS_ALPHA (format_info)) == (! !need_alpha)) { + /* either we don't care about alpha, or the output format needs to have + * alpha */ + if (!need_alpha || GST_VIDEO_FORMAT_INFO_HAS_ALPHA (format_info)) { gst_video_info_set_format (best_info, format_info->format, best_info->width, best_info->height); possible_caps =