From dc4b4832d4ab09adb642cf3a64e6833b2c48277a Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 30 Sep 2014 14:46:14 +1000 Subject: [PATCH] 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. --- gst-libs/gst/gl/gstglcolorconvert.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c index 552e1c1d17..abe92fa76b 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";