From: Wim Taymans Date: Wed, 22 Feb 2012 14:31:12 +0000 (+0100) Subject: videoconvert: improve fixation X-Git-Tag: 1.19.3~511^2~6757 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d58b0aa0b245bcde98279b6162863bc47cffa78;p=platform%2Fupstream%2Fgstreamer.git videoconvert: improve fixation Use the fixed upstream caps to fixate the output caps by taking the intersection. --- diff --git a/gst/videoconvert/gstvideoconvert.c b/gst/videoconvert/gstvideoconvert.c index 5c4ca4b..d337797 100644 --- a/gst/videoconvert/gstvideoconvert.c +++ b/gst/videoconvert/gstvideoconvert.c @@ -136,35 +136,22 @@ static GstCaps * gst_video_convert_fixate_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) { - GstStructure *ss, *ds; - const gchar *val; - - othercaps = gst_caps_make_writable (othercaps); + GstCaps *result; GST_DEBUG_OBJECT (trans, "fixating caps %" GST_PTR_FORMAT, othercaps); - ss = gst_caps_get_structure (caps, 0); - ds = gst_caps_get_structure (othercaps, 0); - - /* first try to preserve chroma-site and colorimetry */ - if ((val = gst_structure_get_string (ss, "chroma-site"))) { - 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); + result = gst_caps_intersect (othercaps, caps); + if (gst_caps_is_empty (result)) { + result = othercaps; + } else { + gst_caps_unref (othercaps); } /* 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.