GNOME Bugzilla – Bug 726833
ximagesrc: Add alpha channel support
Last modified: 2014-03-27 20:36:02 UTC
Some new DDX expose visual with a depth of 32 bit, which imply you need to pass a alpha mask when calling gst_video_format_from_masks() otherwise you'll endup with "UNKNOWN" as a format. The following patch enables alpha support in ximagesrc by extrapolating the alpha_mask. This code has been taken from ximagesink, which is not in the same repository for reason I don't know.
Created attachment 272580 [details] [review] Add ARGB/BGRA support This is no intrusive, and fixes a bug where the ximagesrc would push caps with format=NULL. I propose to also include it in stable.
Review of attachment 272580 [details] [review]: ::: sys/ximage/gstximagesrc.c @@ +1076,3 @@ + alpha_mask = ~(xcontext->r_mask_output + | xcontext->g_mask_output | xcontext->b_mask_output); + alpha_mask &= 0xffffffff; This line looks like a no-op to me, if so we should fix in ximagesink too.
I've just removed the no-op line, though i forgot the cross reference. Sorry Tim. commit 09186626240fe21b0115f0236d2841969d8c15c0 Author: Nicolas Dufresne <nicolas.dufresne@collabora.com> Date: Fri Mar 21 13:03:17 2014 -0400 ximagesrc: Add ARGB/BGRA support
Doesn't this patch "extrapolate" an alpha mask even if there is no alpha?
Created attachment 273109 [details] [review] ximagesrc: only extrapolate alpha mask for 32-bit depth
It works without this patch as well, but that seems to rely on implementation details of the format_from_masks function.
Right, let me do that for imagesink too then ;-P
Review of attachment 273109 [details] [review]: Tested and works on X11 with BGRA visual. commit 39fc394254c94461de26be770fc9ac7370f903b0 Author: Tim-Philipp Müller <tim@centricular.com> Date: Thu Mar 27 19:51:50 2014 +0000 ximagesrc: only extrapolate alpha mask for 32-bit depth Instead of passing bogus alpha mask values when there's no alpha. https://bugzilla.gnome.org/show_bug.cgi?id=726833