Commit 67931bfd authored by Wim Taymans's avatar Wim Taymans
Browse files

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.
parent 8a76c326
...@@ -1616,13 +1616,15 @@ gst_caps_normalize_foreach (GQuark field_id, const GValue * value, gpointer ptr) ...@@ -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) ...@@ -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++) {
......
...@@ -839,7 +839,6 @@ GST_START_TEST (test_normalize) ...@@ -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) ...@@ -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) ...@@ -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);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment