mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 07:47:17 +00:00
pads: Improve readability for gst_pad_fixate_caps()
Just truncate and then fixate. We check for empty caps in the begin and a fixate-func that empties a caps would be broken. It also helps lazy caps impl. in bug 618853 by avoiding the gst_caps_get_size().
This commit is contained in:
parent
53c122df2b
commit
21b4ef4d0f
1 changed files with 8 additions and 12 deletions
20
gst/gstpad.c
20
gst/gstpad.c
|
@ -2416,13 +2416,16 @@ void
|
|||
gst_pad_fixate_caps (GstPad * pad, GstCaps * caps)
|
||||
{
|
||||
GstPadFixateCapsFunction fixatefunc;
|
||||
guint len;
|
||||
GstStructure *s;
|
||||
|
||||
g_return_if_fail (GST_IS_PAD (pad));
|
||||
g_return_if_fail (caps != NULL);
|
||||
g_return_if_fail (!gst_caps_is_empty (caps));
|
||||
/* FIXME-0.11: do not allow fixating any-caps
|
||||
* g_return_if_fail (!gst_caps_is_any (caps));
|
||||
*/
|
||||
|
||||
if (gst_caps_is_fixed (caps))
|
||||
if (gst_caps_is_fixed (caps) || gst_caps_is_any (caps))
|
||||
return;
|
||||
|
||||
fixatefunc = GST_PAD_FIXATECAPSFUNC (pad);
|
||||
|
@ -2431,16 +2434,9 @@ gst_pad_fixate_caps (GstPad * pad, GstCaps * caps)
|
|||
}
|
||||
|
||||
/* default fixation */
|
||||
len = gst_caps_get_size (caps);
|
||||
if (len > 0) {
|
||||
GstStructure *s = gst_caps_get_structure (caps, 0);
|
||||
|
||||
gst_structure_foreach (s, gst_pad_default_fixate, s);
|
||||
}
|
||||
|
||||
if (len > 1) {
|
||||
gst_caps_truncate (caps);
|
||||
}
|
||||
gst_caps_truncate (caps);
|
||||
s = gst_caps_get_structure (caps, 0);
|
||||
gst_structure_foreach (s, gst_pad_default_fixate, s);
|
||||
}
|
||||
|
||||
/* Default accept caps implementation just checks against
|
||||
|
|
Loading…
Reference in a new issue