diff options
author | Rob Clark <rob@ti.com> | 2009-09-09 15:37:11 -0500 |
---|---|---|
committer | Wim Taymans <wim@metal.(none)> | 2009-10-28 16:36:13 +0100 |
commit | 746284f8071c2f33a488eaecfc6f6a1d88cf32c9 (patch) | |
tree | ac93a23a31789a6b600e76abac088aef07c7fa8b | |
parent | f5df3dea7d79d4ca5fdbb5a2f29f0d4eb31f40ca (diff) |
pad: make _fixate_caps() also truncate when neededwork2
The default gst_pad_fixate_caps() previously would only fixate each individual
struct. In case there are multiple structs, the resulting caps would still not
be fixed. In the spirit of how individual structs are fixated, this patch
changes gst_pad_fixate_caps() to remove all but the first struct.
Fixes #595886
-rw-r--r-- | gst/gstpad.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gst/gstpad.c b/gst/gstpad.c index 4dc3dc925..cf4be1cfa 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2404,7 +2404,7 @@ void gst_pad_fixate_caps (GstPad * pad, GstCaps * caps) { GstPadFixateCapsFunction fixatefunc; - guint n, len; + guint len; g_return_if_fail (GST_IS_PAD (pad)); g_return_if_fail (caps != NULL); @@ -2419,11 +2419,15 @@ gst_pad_fixate_caps (GstPad * pad, GstCaps * caps) /* default fixation */ len = gst_caps_get_size (caps); - for (n = 0; n < len; n++) { - GstStructure *s = gst_caps_get_structure (caps, n); + 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); + } } /* Default accept caps implementation just checks against |