caps: make _normalize take ownership of input

Make gst_caps_normalize() take ownership of the input so that it can more
intelligently decide when to copy or not.
This commit is contained in:
Wim Taymans 2012-03-12 12:21:34 +01:00
parent 8a76c3269a
commit 67931bfded
2 changed files with 6 additions and 7 deletions

View file

@ -1616,13 +1616,15 @@ gst_caps_normalize_foreach (GQuark field_id, const GValue * value, gpointer ptr)
/** /**
* gst_caps_normalize: * gst_caps_normalize:
* @caps: a #GstCaps to normalize * @caps: (transfer full): a #GstCaps to normalize
* *
* Creates a new #GstCaps that represents the same set of formats as * Returns a #GstCaps that represents the same set of formats as
* @caps, but contains no lists. Each list is expanded into separate * @caps, but contains no lists. Each list is expanded into separate
* @GstStructures. * @GstStructures.
* *
* Returns: the new #GstCaps * This function takes ownership of @caps.
*
* Returns: (transfer full): the normalized #GstCaps
*/ */
GstCaps * GstCaps *
gst_caps_normalize (GstCaps * caps) gst_caps_normalize (GstCaps * caps)
@ -1633,7 +1635,7 @@ gst_caps_normalize (GstCaps * caps)
g_return_val_if_fail (GST_IS_CAPS (caps), NULL); g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
newcaps = _gst_caps_copy (caps); newcaps = gst_caps_make_writable (caps);
nf.caps = newcaps; nf.caps = newcaps;
for (i = 0; i < gst_caps_get_size (newcaps); i++) { for (i = 0; i < gst_caps_get_size (newcaps); i++) {

View file

@ -839,7 +839,6 @@ GST_START_TEST (test_normalize)
fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL));
} }
gst_caps_unref (in);
gst_caps_unref (out); gst_caps_unref (out);
gst_caps_unref (norm); gst_caps_unref (norm);
@ -858,7 +857,6 @@ GST_START_TEST (test_normalize)
fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL));
} }
gst_caps_unref (in);
gst_caps_unref (out); gst_caps_unref (out);
gst_caps_unref (norm); gst_caps_unref (norm);
@ -876,7 +874,6 @@ GST_START_TEST (test_normalize)
fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL)); fail_unless (gst_structure_foreach (st, _caps_is_fixed_foreach, NULL));
} }
gst_caps_unref (in);
gst_caps_unref (out); gst_caps_unref (out);
gst_caps_unref (norm); gst_caps_unref (norm);
} }