From dd89e924db1a6df5f93f8e9f0e93f5394f08703e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 17 May 2011 12:07:03 +0200 Subject: [PATCH] padtemplate: Improve reference handling of the template's caps gst_pad_template_new() does not take ownership of the caps anymore. --- docs/random/porting-to-0.11.txt | 2 ++ gst/gstpadtemplate.c | 16 +++------------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/docs/random/porting-to-0.11.txt b/docs/random/porting-to-0.11.txt index 5d50132998..0a3099e9e5 100644 --- a/docs/random/porting-to-0.11.txt +++ b/docs/random/porting-to-0.11.txt @@ -96,6 +96,8 @@ The 0.11 porting guide gst_pad_template_get_caps() returns a new reference of the caps and the return value needs to be unreffed after usage. + gst_pad_template_new() does not take ownership of the caps anymore. + * GstMiniObject A miniobject is now a simple refcounted structure holding the information common to buffers, events, messages, queries and caps. diff --git a/gst/gstpadtemplate.c b/gst/gstpadtemplate.c index 65a7f4dcee..e5a57ff1ca 100644 --- a/gst/gstpadtemplate.c +++ b/gst/gstpadtemplate.c @@ -336,12 +336,10 @@ gst_static_pad_template_get (GstStaticPadTemplate * pad_template) * @name_template: the name template. * @direction: the #GstPadDirection of the template. * @presence: the #GstPadPresence of the pad. - * @caps: (transfer full): a #GstCaps set for the template. The caps are - * taken ownership of. + * @caps: a #GstCaps set for the template. * * Creates a new pad template with a name according to the given template - * and with the given arguments. This functions takes ownership of the provided - * caps, so be sure to not use them afterwards. + * and with the given arguments. * * Returns: (transfer full): a new #GstPadTemplate. */ @@ -359,7 +357,6 @@ gst_pad_template_new (const gchar * name_template, || presence == GST_PAD_SOMETIMES || presence == GST_PAD_REQUEST, NULL); if (!name_is_valid (name_template, presence)) { - gst_caps_unref (caps); return NULL; } @@ -367,8 +364,6 @@ gst_pad_template_new (const gchar * name_template, "name", name_template, "name-template", name_template, "direction", direction, "presence", presence, "caps", caps, NULL); - gst_caps_unref (caps); - return new; } @@ -440,12 +435,7 @@ gst_pad_template_set_property (GObject * object, guint prop_id, GST_PAD_TEMPLATE_PRESENCE (object) = g_value_get_enum (value); break; case PROP_CAPS: - /* allow caps == NULL for backwards compatibility (ie. g_object_new() - * called without any of the new properties) (FIXME 0.11) */ - if (g_value_get_boxed (value) != NULL) { - GST_PAD_TEMPLATE_CAPS (object) = - gst_caps_copy (g_value_get_boxed (value)); - } + GST_PAD_TEMPLATE_CAPS (object) = g_value_dup_boxed (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);