mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-03 21:12:26 +00:00
glcolorconvert: try harder to passthrough
This makes a pipeline like: ... ! video/x-raw(memory:GLMemory),format=UYVY ! glcolorconvert ! video/x-raw(memory:GLMemory),format={UYVY, NV12} ! ... passthrough instead of converting UYVY => NV12. The conversion would happen before this change since the element (and basetransform) transform the src caps to format={NV12, UYVY} (since NV12 comes first in the glcolorconvert:src template) and then the default caps fixate func would fixate to NV12. Blah. Also there's no need to intersect against the template caps in ::transform_caps since basetransform does that right after calling the vfunc.
This commit is contained in:
parent
731f9928dd
commit
c2a6c97a1d
1 changed files with 28 additions and 14 deletions
|
@ -828,25 +828,38 @@ GstCaps *
|
||||||
gst_gl_color_convert_transform_caps (GstGLContext * convert,
|
gst_gl_color_convert_transform_caps (GstGLContext * convert,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
|
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
|
||||||
{
|
{
|
||||||
GstCaps *templ, *result;
|
|
||||||
|
|
||||||
templ = gst_caps_from_string (GST_GL_COLOR_CONVERT_VIDEO_CAPS);
|
|
||||||
|
|
||||||
caps = gst_gl_color_convert_caps_remove_format_info (caps);
|
caps = gst_gl_color_convert_caps_remove_format_info (caps);
|
||||||
|
|
||||||
result = gst_caps_intersect (caps, templ);
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
gst_caps_unref (templ);
|
|
||||||
|
|
||||||
if (filter) {
|
if (filter) {
|
||||||
GstCaps *tmp;
|
GstCaps *tmp;
|
||||||
|
|
||||||
tmp = gst_caps_intersect_full (filter, result, GST_CAPS_INTERSECT_FIRST);
|
tmp = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
|
||||||
gst_caps_unref (result);
|
gst_caps_unref (caps);
|
||||||
result = tmp;
|
caps = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return caps;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_gl_color_convert_fixate_format (GstStructure * ins, GstStructure * outs)
|
||||||
|
{
|
||||||
|
const gchar *in_format = gst_structure_get_string (ins, "format");
|
||||||
|
const GValue *out_formats = gst_structure_get_value (outs, "format");
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
if (in_format == NULL || !GST_VALUE_HOLDS_LIST (out_formats))
|
||||||
|
/* we don't need to or don't know how to fixate */
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < gst_value_list_get_size (out_formats); i++) {
|
||||||
|
const gchar *format =
|
||||||
|
g_value_get_string (gst_value_list_get_value (out_formats, i));
|
||||||
|
if (!strcmp (format, in_format)) {
|
||||||
|
gst_structure_set (outs, "format", G_TYPE_STRING, format, NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GstCaps *
|
GstCaps *
|
||||||
|
@ -869,7 +882,9 @@ gst_gl_color_convert_fixate_caps (GstGLContext * convert,
|
||||||
targets_mask = gst_gl_value_get_texture_target_mask (targets);
|
targets_mask = gst_gl_value_get_texture_target_mask (targets);
|
||||||
other_targets_mask = gst_gl_value_get_texture_target_mask (other_targets);
|
other_targets_mask = gst_gl_value_get_texture_target_mask (other_targets);
|
||||||
|
|
||||||
/* XXX: attempt to fixate the format/colorimetry/etc */
|
gst_gl_color_convert_fixate_format (s, s_other);
|
||||||
|
|
||||||
|
/* XXX: attempt to fixate the colorimetry/etc */
|
||||||
other = gst_caps_fixate (other);
|
other = gst_caps_fixate (other);
|
||||||
|
|
||||||
result_mask = targets_mask & other_targets_mask;
|
result_mask = targets_mask & other_targets_mask;
|
||||||
|
@ -878,7 +893,6 @@ gst_gl_color_convert_fixate_caps (GstGLContext * convert,
|
||||||
return other;
|
return other;
|
||||||
}
|
}
|
||||||
|
|
||||||
caps = gst_caps_copy (caps);
|
|
||||||
caps = gst_caps_fixate (caps);
|
caps = gst_caps_fixate (caps);
|
||||||
|
|
||||||
gst_video_info_from_caps (&info, caps);
|
gst_video_info_from_caps (&info, caps);
|
||||||
|
|
Loading…
Reference in a new issue