mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 05:01:23 +00:00
gl: Remove format info in glcolorconvert's transform_caps function instead of on every caller
... and let glmixer actually transform the caps it is supposed to transform instead of inventing new caps.
This commit is contained in:
parent
5dfa3c8009
commit
f153b9ee59
1 changed files with 2 additions and 49 deletions
|
@ -326,60 +326,17 @@ gst_gl_mixer_set_caps_features (const GstCaps * caps,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* copies the given caps */
|
||||
static GstCaps *
|
||||
gst_gl_mixer_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_structure_remove_fields (st, "width", "height", NULL);
|
||||
|
||||
gst_caps_append_structure_full (res, st, gst_caps_features_copy (f));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
GstCaps *
|
||||
gst_gl_mixer_update_caps (GstGLMixer * mix, GstCaps * caps)
|
||||
{
|
||||
GstCaps *result, *tmp, *gl_caps;
|
||||
|
||||
gl_caps = gst_caps_from_string ("video/x-raw(memory:GLMemory),format=RGBA");
|
||||
GstCaps *result, *tmp;
|
||||
|
||||
result =
|
||||
gst_gl_color_convert_transform_caps (mix->context, GST_PAD_SRC, gl_caps,
|
||||
gst_gl_color_convert_transform_caps (mix->context, GST_PAD_SRC, caps,
|
||||
NULL);
|
||||
tmp = result;
|
||||
GST_DEBUG_OBJECT (mix, "convert returned caps %" GST_PTR_FORMAT, tmp);
|
||||
|
||||
result = gst_gl_mixer_caps_remove_format_info (tmp);
|
||||
gst_caps_unref (tmp);
|
||||
tmp = result;
|
||||
GST_DEBUG_OBJECT (mix, "remove format returned caps %" GST_PTR_FORMAT, tmp);
|
||||
|
||||
result = gst_gl_upload_transform_caps (mix->context, GST_PAD_SRC, tmp, NULL);
|
||||
gst_caps_unref (tmp);
|
||||
tmp = result;
|
||||
|
@ -740,10 +697,6 @@ gst_gl_mixer_query_caps (GstPad * pad, GstAggregator * agg, GstQuery * query)
|
|||
NULL);
|
||||
retcaps = gst_caps_merge (gl_caps, retcaps);
|
||||
gst_caps_unref (current_caps);
|
||||
current_caps = retcaps;
|
||||
|
||||
retcaps = gst_gl_mixer_caps_remove_format_info (current_caps);
|
||||
gst_caps_unref (current_caps);
|
||||
|
||||
if (filter) {
|
||||
current_caps =
|
||||
|
|
Loading…
Reference in a new issue