mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
v4l2object: append non colorimetry structure to probed caps
If the stream has a special colorimetry that is not in the colorimetry list, it will cause negotiation to fail. We should allow passing any colorimetry, so add an extra structure without the colorimetry field. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7029>
This commit is contained in:
parent
5dffbd492c
commit
7576d14762
1 changed files with 32 additions and 0 deletions
|
@ -1832,6 +1832,31 @@ add_alternate_variant (GstV4l2Object * v4l2object, GstCaps * caps,
|
|||
gst_caps_features_new (GST_CAPS_FEATURE_FORMAT_INTERLACED, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
add_non_colorimetry_caps (GstV4l2Object * v4l2object, GstCaps * caps)
|
||||
{
|
||||
gint caps_size;
|
||||
gint i;
|
||||
|
||||
caps_size = gst_caps_get_size (caps);
|
||||
for (i = 0; i < caps_size; i++) {
|
||||
GstStructure *structure = gst_caps_get_structure (caps, i);
|
||||
GstCapsFeatures *features = gst_caps_get_features (caps, i);
|
||||
|
||||
if (gst_structure_has_name (structure, "video/x-raw")
|
||||
&& gst_structure_has_field (structure, "colorimetry")) {
|
||||
GstStructure *alt_s = gst_structure_copy (structure);
|
||||
gst_structure_remove_field (alt_s, "colorimetry");
|
||||
if (gst_caps_features_contains (features,
|
||||
GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY))
|
||||
gst_caps_append_structure (caps, alt_s);
|
||||
else
|
||||
gst_caps_append_structure_full (caps, alt_s,
|
||||
gst_caps_features_copy (features));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_v4l2_object_get_caps_helper (GstV4L2FormatFlags flags)
|
||||
{
|
||||
|
@ -5122,6 +5147,13 @@ gst_v4l2_object_probe_caps (GstV4l2Object * v4l2object, GstCaps * filter)
|
|||
gst_caps_unref (tmp);
|
||||
}
|
||||
|
||||
/* Add a variant of the caps without the colorimetry so that we can negotiate
|
||||
successfully even if the detected colorimetry from upstream is not supported
|
||||
by the device */
|
||||
if (ret) {
|
||||
add_non_colorimetry_caps (v4l2object, ret);
|
||||
}
|
||||
|
||||
GST_INFO_OBJECT (v4l2object->dbg_obj, "probed caps: %" GST_PTR_FORMAT, ret);
|
||||
|
||||
return ret;
|
||||
|
|
Loading…
Reference in a new issue