MMFMWK-8190 glupload: refine transform caps of directviv uploader

if downstream only accept YUV format (eg, add capsfilter), then
we should passthrough color format and don't extend to directviv
support format

upstream status: Pending
https://bugzilla.gnome.org/show_bug.cgi?id=797002
diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
index 8e78e03..0009cb3 100644
--- a/gst-libs/gst/gl/gstglupload.c
+++ b/gst-libs/gst/gl/gstglupload.c
@@ -1475,13 +1475,25 @@
     gst_caps_unref (ret);
     ret = tmp;
   } else {
-    GstCaps *tmp;
-    tmp = gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
+    GstCaps *caps_copy, *caps_intersect;
+    caps_copy = gst_caps_copy (caps);
+    gst_caps_set_simple (caps_copy, "format", G_TYPE_STRING, "RGBA", NULL);
+    caps_intersect = gst_caps_intersect (caps_copy, caps);
+    if (gst_caps_is_empty (caps_intersect)) {
+      ret =
+          _set_caps_features_with_passthrough (caps,
+          GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY, passthrough);
+    } else {
+      GstCaps *tmp;
+      tmp = gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
         (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY, GST_GL_DIRECTVIV_FORMAT));
-    ret =
-        _set_caps_features_with_passthrough (tmp,
-        GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY, passthrough);
-    gst_caps_unref (tmp);
+      ret =
+          _set_caps_features_with_passthrough (tmp,
+          GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY, passthrough);
+      gst_caps_unref (tmp);
+    }
+    gst_caps_unref (caps_copy);
+    gst_caps_unref (caps_intersect);
   }
 
   gst_caps_features_free (passthrough);