diff options
author | Stefan Kost <ensonic@users.sf.net> | 2009-12-14 11:05:41 +0200 |
---|---|---|
committer | Stefan Kost <ensonic@users.sf.net> | 2009-12-14 11:08:48 +0200 |
commit | e243a41165ed76937610e9c79ae4b0f36bfb4169 (patch) | |
tree | 7edcb3155baeda7f04068fb70412dad33d602178 /gst/gstelementfactory.c | |
parent | 076aeeb74bdd70af261d6e0ef002f365c522d64b (diff) |
gstelementfactory: set object name earlier if applicable
Setting an object name is nice for proper debug logging. Ideally this would
still happens earlier (.e.g when pads are added to an element, its not yet set).
Diffstat (limited to 'gst/gstelementfactory.c')
-rw-r--r-- | gst/gstelementfactory.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index 0cdb5ffd2..3a87790e5 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -405,8 +405,14 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name) if (factory->type == 0) goto no_type; - /* create an instance of the element, cast so we don't assert on NULL */ - element = GST_ELEMENT_CAST (g_object_newv (factory->type, 0, NULL)); + /* create an instance of the element, cast so we don't assert on NULL + * also set name as early as we can + */ + if (name) + element = + GST_ELEMENT_CAST (g_object_new (factory->type, "name", name, NULL)); + else + element = GST_ELEMENT_CAST (g_object_newv (factory->type, 0, NULL)); if (G_UNLIKELY (element == NULL)) goto no_element; @@ -420,9 +426,6 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name) (gpointer) & oclass->elementfactory, NULL, factory)) gst_object_unref (factory); - if (name) - gst_object_set_name (GST_OBJECT_CAST (element), name); - GST_DEBUG ("created element \"%s\"", GST_PLUGIN_FEATURE_NAME (factory)); return element; |