From: Stefan Kost Date: Thu, 17 Feb 2011 12:50:40 +0000 (+0200) Subject: index: fix creation of writer id for unparented pads X-Git-Tag: RELEASE-0.10.33~348 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=af156262589cbfba6a237e97f3f6ebe47438d35b;p=platform%2Fupstream%2Fgstreamer.git index: fix creation of writer id for unparented pads Also do some cleanup in the impl. --- diff --git a/gst/gstindex.c b/gst/gstindex.c index b686eeebfa..5f4b2fbd72 100644 --- a/gst/gstindex.c +++ b/gst/gstindex.c @@ -633,20 +633,23 @@ gst_index_gtype_resolver (GstIndex * index, GstObject * writer, g_return_val_if_fail (writer != NULL, FALSE); if (GST_IS_PAD (writer)) { - GstElement *element = - (GstElement *) gst_object_get_parent (GST_OBJECT (writer)); + GstObject *element = gst_object_get_parent (GST_OBJECT (writer)); gchar *name; name = gst_object_get_name (writer); - *writer_string = g_strdup_printf ("%s.%s", - g_type_name (G_OBJECT_TYPE (element)), name); + if (element) { + *writer_string = g_strdup_printf ("%s.%s", + G_OBJECT_TYPE_NAME (element), name); + gst_object_unref (element); + } else { + *writer_string = name; + name = NULL; + } - gst_object_unref (element); g_free (name); } else { - *writer_string = - g_strdup_printf ("%s", g_type_name (G_OBJECT_TYPE (writer))); + *writer_string = g_strdup (G_OBJECT_TYPE_NAME (writer)); } return TRUE;