mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 08:17:01 +00:00
glcolorconvert: try to keep the same texture-target if possible
Fixes issues attempting to passthrough external-oes textures
This commit is contained in:
parent
6c97be6dfa
commit
87137e3353
1 changed files with 27 additions and 12 deletions
|
@ -790,6 +790,7 @@ gst_gl_color_convert_fixate_caps (GstGLContext * convert,
|
||||||
GValue item = G_VALUE_INIT;
|
GValue item = G_VALUE_INIT;
|
||||||
const GValue *targets, *other_targets;
|
const GValue *targets, *other_targets;
|
||||||
guint targets_mask = 0, other_targets_mask = 0, result_mask;
|
guint targets_mask = 0, other_targets_mask = 0, result_mask;
|
||||||
|
GstVideoInfo info, other_info;
|
||||||
GstStructure *s, *s_other;
|
GstStructure *s, *s_other;
|
||||||
|
|
||||||
other = gst_caps_make_writable (other);
|
other = gst_caps_make_writable (other);
|
||||||
|
@ -802,22 +803,37 @@ gst_gl_color_convert_fixate_caps (GstGLContext * convert,
|
||||||
targets_mask = _get_target_bitmask_from_g_value (targets);
|
targets_mask = _get_target_bitmask_from_g_value (targets);
|
||||||
other_targets_mask = _get_target_bitmask_from_g_value (other_targets);
|
other_targets_mask = _get_target_bitmask_from_g_value (other_targets);
|
||||||
|
|
||||||
|
/* XXX: attempt to fixate the format/colorimetry/etc */
|
||||||
|
other = gst_caps_fixate (other);
|
||||||
|
|
||||||
result_mask = targets_mask & other_targets_mask;
|
result_mask = targets_mask & other_targets_mask;
|
||||||
if (result_mask == 0) {
|
if (result_mask == 0) {
|
||||||
/* nothing we can do here */
|
/* nothing we can do here */
|
||||||
return gst_caps_fixate (other);
|
return other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
caps = gst_caps_copy (caps);
|
||||||
|
caps = gst_caps_fixate (caps);
|
||||||
|
|
||||||
|
gst_video_info_from_caps (&info, caps);
|
||||||
|
gst_video_info_from_caps (&other_info, other);
|
||||||
|
|
||||||
|
if (!_gst_gl_color_convert_can_passthrough_info (&info, &other_info)) {
|
||||||
if (direction == GST_PAD_SINK) {
|
if (direction == GST_PAD_SINK) {
|
||||||
|
/* this effectively limits us to 2D | RECTANGLE for case where we
|
||||||
|
* have to convert */
|
||||||
result_mask &=
|
result_mask &=
|
||||||
(1 << GST_GL_TEXTURE_TARGET_2D | 1 << GST_GL_TEXTURE_TARGET_RECTANGLE);
|
(1 << GST_GL_TEXTURE_TARGET_2D | 1 <<
|
||||||
|
GST_GL_TEXTURE_TARGET_RECTANGLE);
|
||||||
} else {
|
} else {
|
||||||
/* if the src caps has 2D support we can 'convert' to anything */
|
/* if the src caps has 2D support we can 'convert' to anything */
|
||||||
if (targets_mask & (1 << GST_GL_TEXTURE_TARGET_2D))
|
if (targets_mask & (1 << GST_GL_TEXTURE_TARGET_2D | 1 <<
|
||||||
|
GST_GL_TEXTURE_TARGET_RECTANGLE))
|
||||||
result_mask = -1;
|
result_mask = -1;
|
||||||
else
|
else
|
||||||
result_mask = other_targets_mask;
|
result_mask = other_targets_mask;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
g_value_init (&item, G_TYPE_STRING);
|
g_value_init (&item, G_TYPE_STRING);
|
||||||
if (result_mask & (1 << GST_GL_TEXTURE_TARGET_2D)) {
|
if (result_mask & (1 << GST_GL_TEXTURE_TARGET_2D)) {
|
||||||
|
@ -831,8 +847,7 @@ gst_gl_color_convert_fixate_caps (GstGLContext * convert,
|
||||||
gst_structure_set_value (s_other, "texture-target", &item);
|
gst_structure_set_value (s_other, "texture-target", &item);
|
||||||
|
|
||||||
g_value_unset (&item);
|
g_value_unset (&item);
|
||||||
|
gst_caps_unref (caps);
|
||||||
other = gst_caps_fixate (other);
|
|
||||||
|
|
||||||
return other;
|
return other;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue