mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 18:51:11 +00:00
glfilter: Remove format information to allow color convert again
We also need to remove the format information, as glfilter can do color convertion. This code was imported from videoconvert. https://bugzilla.gnome.org/show_bug.cgi?id=729861
This commit is contained in:
parent
ee04a6e6eb
commit
d85c344204
1 changed files with 39 additions and 5 deletions
|
@ -687,6 +687,41 @@ gst_gl_filter_set_caps_features (const GstCaps * caps,
|
|||
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)
|
||||
|
@ -694,6 +729,8 @@ gst_gl_filter_transform_caps (GstBaseTransform * bt,
|
|||
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);
|
||||
|
@ -704,18 +741,15 @@ gst_gl_filter_transform_caps (GstBaseTransform * bt,
|
|||
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);
|
||||
|
|
Loading…
Reference in a new issue