diff options
author | Matthew Waters <matthew@centricular.com> | 2014-09-30 14:46:14 +1000 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2014-09-30 19:48:14 +1000 |
commit | 45ec04a9f99d3aabf3afd64993994c87b6d83b18 (patch) | |
tree | 710299803147afefa5737509b2bbcd6c68928f07 | |
parent | f825be4e07808f7a2da396501bd56bbe5a233248 (diff) | |
download | gstreamer-plugins-bad-45ec04a9f99d3aabf3afd64993994c87b6d83b18.tar.gz |
glcolorconvert: convert xRGB into ARGB properly
The alpha channel might not be the last component so check which one
it is in and clobber that one instead.
-rw-r--r-- | gst-libs/gst/gl/gstglcolorconvert.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c index 87e04aa63..aaba1d8f1 100644 --- a/gst-libs/gst/gl/gstglcolorconvert.c +++ b/gst-libs/gst/gl/gstglcolorconvert.c @@ -673,8 +673,17 @@ _RGB_to_RGB (GstGLColorConvert * convert) info->in_n_textures = 1; info->out_n_textures = 1; - if (_is_RGBx (in_format)) - alpha = g_strdup_printf ("t.%c = 1.0;", pixel_order[3]); + if (_is_RGBx (in_format)) { + int i; + char input_alpha_channel = 'a'; + for (i = 0; i < GST_VIDEO_MAX_PLANES; i++) { + if (in_format_str[i] == 'X' || in_format_str[i] == 'x') { + input_alpha_channel = _index_to_shader_swizzle (i); + break; + } + } + alpha = g_strdup_printf ("t.%c = 1.0;", input_alpha_channel); + } info->frag_prog = g_strdup_printf (frag_REORDER, alpha ? alpha : "", pixel_order[0], pixel_order[1], pixel_order[2], pixel_order[3]); info->shader_tex_names[0] = "tex"; |