return tmp;
}
+/* copies the given caps */
+static GstCaps *
+gst_gl_filter_caps_remove_format_info (GstCaps * caps)
+{
+ GstStructure *st;
+ GstCapsFeatures *f;
+ gint i, n;
+ GstCaps *res;
+
+ res = gst_caps_new_empty ();
+
+ n = gst_caps_get_size (caps);
+ for (i = 0; i < n; i++) {
+ st = gst_caps_get_structure (caps, i);
+ f = gst_caps_get_features (caps, i);
+
+ /* If this is already expressed by the existing caps
+ * skip this structure */
+ if (i > 0 && gst_caps_is_subset_structure_full (res, st, f))
+ continue;
+
+ st = gst_structure_copy (st);
+ /* Only remove format info for the cases when we can actually convert */
+ if (!gst_caps_features_is_any (f)
+ && gst_caps_features_is_equal (f,
+ GST_CAPS_FEATURES_MEMORY_SYSTEM_MEMORY))
+ gst_structure_remove_fields (st, "format", "colorimetry", "chroma-site",
+ NULL);
+
+ gst_caps_append_structure_full (res, st, gst_caps_features_copy (f));
+ }
+
+ return res;
+}
+
static GstCaps *
gst_gl_filter_transform_caps (GstBaseTransform * bt,
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
GstCaps *tmp = NULL;
GstCaps *result = NULL;
+ tmp = gst_caps_new_empty ();
+
if (direction == GST_PAD_SINK) {
GstCaps *glcaps = gst_gl_filter_set_caps_features (caps,
GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
GstCaps *uploadcaps = gst_gl_filter_set_caps_features (caps,
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META);
- tmp = gst_caps_new_empty ();
-
tmp = gst_caps_merge (tmp, glcaps);
#if GST_GL_HAVE_PLATFORM_EGL
tmp = gst_caps_merge (tmp, eglcaps);
#endif
tmp = gst_caps_merge (tmp, uploadcaps);
- tmp = gst_caps_merge (tmp, gst_caps_copy (caps));
- } else {
- tmp = gst_caps_copy (caps);
}
+ tmp = gst_caps_merge (tmp, gst_gl_filter_caps_remove_format_info (caps));
+
if (filter) {
result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (tmp);