mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-07 12:21:17 +00:00
videoconvert: improve fixation
Use the fixed upstream caps to fixate the output caps by taking the intersection.
This commit is contained in:
parent
18e45a8a5f
commit
7d58b0aa0b
1 changed files with 9 additions and 22 deletions
|
@ -136,35 +136,22 @@ static GstCaps *
|
||||||
gst_video_convert_fixate_caps (GstBaseTransform * trans,
|
gst_video_convert_fixate_caps (GstBaseTransform * trans,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
||||||
{
|
{
|
||||||
GstStructure *ss, *ds;
|
GstCaps *result;
|
||||||
const gchar *val;
|
|
||||||
|
|
||||||
othercaps = gst_caps_make_writable (othercaps);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (trans, "fixating caps %" GST_PTR_FORMAT, othercaps);
|
GST_DEBUG_OBJECT (trans, "fixating caps %" GST_PTR_FORMAT, othercaps);
|
||||||
|
|
||||||
ss = gst_caps_get_structure (caps, 0);
|
result = gst_caps_intersect (othercaps, caps);
|
||||||
ds = gst_caps_get_structure (othercaps, 0);
|
if (gst_caps_is_empty (result)) {
|
||||||
|
result = othercaps;
|
||||||
/* first try to preserve chroma-site and colorimetry */
|
} else {
|
||||||
if ((val = gst_structure_get_string (ss, "chroma-site"))) {
|
gst_caps_unref (othercaps);
|
||||||
if (gst_structure_has_field (ds, "chroma-site"))
|
|
||||||
gst_structure_fixate_field_string (ds, "chroma-site", val);
|
|
||||||
else
|
|
||||||
gst_structure_set (ds, "chroma-site", G_TYPE_STRING, val, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((val = gst_structure_get_string (ss, "colorimetry"))) {
|
|
||||||
if (gst_structure_has_field (ds, "colorimetry"))
|
|
||||||
gst_structure_fixate_field_string (ds, "colorimetry", val);
|
|
||||||
else
|
|
||||||
gst_structure_set (ds, "colorimetry", G_TYPE_STRING, val, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fixate remaining fields */
|
/* fixate remaining fields */
|
||||||
gst_caps_fixate (othercaps);
|
result = gst_caps_make_writable (result);
|
||||||
|
gst_caps_fixate (result);
|
||||||
|
|
||||||
return othercaps;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The caps can be transformed into any other caps with format info removed.
|
/* The caps can be transformed into any other caps with format info removed.
|
||||||
|
|
Loading…
Reference in a new issue