glcolorconvert: fix negotiation for a non list video format in caps
authorMatthew Waters <matthew@centricular.com>
Sun, 6 May 2018 08:51:10 +0000 (18:51 +1000)
committerMatthew Waters <matthew@centricular.com>
Sun, 6 May 2018 08:54:20 +0000 (18:54 +1000)
For a single format in the caps, we were returning some weird answers,
like only RGB formats for a RGB input when we can also support YUV from
RGB.

Fixup of 3cfff727b19d450898dbe7931c53ea05bc2a9ac3 where I thought my
previous (~6month) self had got this right.  Don't trust your previous
self people!

gst-libs/gst/gl/gstglcolorconvert.c

index 489a1b2..d8c24f7 100644 (file)
@@ -995,7 +995,6 @@ gst_gl_color_convert_caps_transform_format_info (GstGLContext * context,
       if (have_rgb_formats) {
         gst_structure_set_value (st, "format", &supported_formats);
       } else {
-        GValue supported_rgb_formats = G_VALUE_INIT;
         /* add passthrough structure, then the rgb conversion structure */
         gst_structure_set_value (st, "format", &passthrough_formats);
         gst_caps_append_structure_full (res, gst_structure_copy (st),
@@ -1013,9 +1012,9 @@ gst_gl_color_convert_caps_transform_format_info (GstGLContext * context,
         gst_structure_set_value (st, "format", format);
         gst_caps_append_structure_full (res, gst_structure_copy (st),
             gst_caps_features_copy (f));
-        gst_structure_set_value (st, "format", &rgb_formats);
-      } else {                  /* RGB */
         gst_structure_set_value (st, "format", &supported_rgb_formats);
+      } else {                  /* RGB */
+        gst_structure_set_value (st, "format", &supported_formats);
       }
     }
     gst_structure_remove_fields (st, "colorimetry", "chroma-site",