GNOME Bugzilla – Bug 769962
videocompositor: Remove output format alpha check
Last modified: 2018-05-07 15:51:43 UTC
Why need below code to check output format alpha? Our hardware support transform such as RGBA to YUYV. But video compositor will report error. if (at_least_one_alpha && !(finfo->flags & GST_VIDEO_FORMAT_FLAG_ALPHA)) { GST_ELEMENT_ERROR (vagg, CORE, NEGOTIATION, ("At least one of the input pads contains alpha, but configured caps don't support alpha."), ("Either convert your inputs to not contain alpha or add a videoconvert after the aggregator")); ret = FALSE; goto done; }
What is exactly the problem you observe? This code is there because otherwise compositor will already operate on a non-alpha format when doing the blending. It always does the blending on the output format. Blending on non-alpha formats means however that you completely ignore the alpha channel of the input, and that's a (quite severe) loss of information.
We write one plugin based on videoaggregator for our hardware. The hardware has the capability to do video blending. The input has alpha channel and the output hasn't alpha channel. And we need the plugin output video format without alpha. But above code will report error. And plugin can't overwrite the function which report error. Can changed to just print warning for loss of information?
(In reply to kevin from comment #2) > We write one plugin based on videoaggregator for our hardware. The hardware > has the capability to do video blending. The input has alpha channel and the > output hasn't alpha channel. And we need the plugin output video format > without alpha. But above code will report error. And plugin can't overwrite > the function which report error. Then some API has to be added to videoaggregator to allow subclasses to override this behaviour. glvideomixer would be able to make use of that too. > Can changed to just print warning for loss of information? No, as that will cause silent loss of information when using compositor.
So, how about to move output alpha check into gst_video_aggregator_src_setcaps(). And change gst_video_aggregator_src_setcaps() to one virtual function?
I wonder if the base class shouldn't have a special case if there is an input that is "fullscreen", at the bottom, and doesn't have alpha.. Or a solid background color? Then the input can have alpha, but not the output.
Let's close this for now until someone wants to work on this and can provide a coherent design how it should work. This can be added in a backwards compatible way to videoaggregator when needed.