After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 726833 - ximagesrc: Add alpha channel support
ximagesrc: Add alpha channel support
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal enhancement
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Reported: 2014-03-21 17:12 UTC by Nicolas Dufresne (ndufresne)
Modified: 2014-03-27 20:36 UTC
See Also:
GNOME target: ---
GNOME version: ---

Add ARGB/BGRA support (1.45 KB, patch)
2014-03-21 17:14 UTC, Nicolas Dufresne (ndufresne)
reviewed Details | Review
ximagesrc: only extrapolate alpha mask for 32-bit depth (1.14 KB, patch)
2014-03-27 19:54 UTC, Tim-Philipp Müller
committed Details | Review

Description Nicolas Dufresne (ndufresne) 2014-03-21 17:12:49 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.
Comment 1 Nicolas Dufresne (ndufresne) 2014-03-21 17:14:23 UTC
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.
Comment 2 Nicolas Dufresne (ndufresne) 2014-03-21 21:20:27 UTC
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.
Comment 3 Nicolas Dufresne (ndufresne) 2014-03-27 19:12:38 UTC
I've just removed the no-op line, though i forgot the cross reference. Sorry Tim.

commit 09186626240fe21b0115f0236d2841969d8c15c0
Author: Nicolas Dufresne <>
Date:   Fri Mar 21 13:03:17 2014 -0400

    ximagesrc: Add ARGB/BGRA support
Comment 4 Tim-Philipp Müller 2014-03-27 19:18:27 UTC
Doesn't this patch "extrapolate" an alpha mask even if there is no alpha?
Comment 5 Tim-Philipp Müller 2014-03-27 19:54:29 UTC
Created attachment 273109 [details] [review]
ximagesrc: only extrapolate alpha mask for 32-bit depth
Comment 6 Tim-Philipp Müller 2014-03-27 20:09:45 UTC
It works without this patch as well, but that seems to rely on implementation details of the format_from_masks function.
Comment 7 Nicolas Dufresne (ndufresne) 2014-03-27 20:30:53 UTC
Right, let me do that for imagesink too then ;-P
Comment 8 Nicolas Dufresne (ndufresne) 2014-03-27 20:36:02 UTC
Review of attachment 273109 [details] [review]:

Tested and works on X11 with BGRA visual.

commit 39fc394254c94461de26be770fc9ac7370f903b0
Author: Tim-Philipp Müller <>
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.