Commit 232f295a authored by Benjamin Otte's avatar Benjamin Otte
Browse files

gst/: name objects by default, not in gst_element_factory_create. Allows using...

gst/: name objects by default, not in gst_element_factory_create. Allows using elements created with g_object_new. (f...

Original commit message from CVS:
* gst/gstelementfactory.c: (gst_element_factory_create):
* gst/gstobject.c: (gst_object_init),
(gst_object_set_name_default), (gst_object_set_name):
name objects by default, not in gst_element_factory_create. Allows
using elements created with g_object_new. (fixes #167283)
parent 70fd76df
2005-02-19 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/gstelementfactory.c: (gst_element_factory_create):
* gst/gstobject.c: (gst_object_init),
(gst_object_set_name_default), (gst_object_set_name):
name objects by default, not in gst_element_factory_create. Allows
using elements created with g_object_new. (fixes #167283)
2005-02-19 Benjamin Otte <in7y118@public.uni-hamburg.de> 2005-02-19 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_log_default): * gst/gstinfo.c: (_gst_debug_init), (gst_debug_log_default):
......
...@@ -324,7 +324,8 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name) ...@@ -324,7 +324,8 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name)
g_type_class_unref (oclass); g_type_class_unref (oclass);
gst_object_set_name (GST_OBJECT (element), name); if (name)
gst_object_set_name (GST_OBJECT (element), name);
return element; return element;
} }
......
...@@ -72,7 +72,7 @@ static guint gst_signal_object_signals[SO_LAST_SIGNAL] = { 0 }; ...@@ -72,7 +72,7 @@ static guint gst_signal_object_signals[SO_LAST_SIGNAL] = { 0 };
#endif #endif
static void gst_object_class_init (GstObjectClass * klass); static void gst_object_class_init (GstObjectClass * klass);
static void gst_object_init (GstObject * object); static void gst_object_init (GTypeInstance * instance, gpointer g_class);
#ifndef GST_DISABLE_TRACE #ifndef GST_DISABLE_TRACE
static GObject *gst_object_constructor (GType type, static GObject *gst_object_constructor (GType type,
...@@ -89,6 +89,9 @@ static void gst_object_dispatch_properties_changed (GObject * object, ...@@ -89,6 +89,9 @@ static void gst_object_dispatch_properties_changed (GObject * object,
static void gst_object_dispose (GObject * object); static void gst_object_dispose (GObject * object);
static void gst_object_finalize (GObject * object); static void gst_object_finalize (GObject * object);
static void gst_object_set_name_default (GstObject * object,
const gchar * type_name);
#ifndef GST_DISABLE_LOADSAVE_REGISTRY #ifndef GST_DISABLE_LOADSAVE_REGISTRY
static void gst_object_real_restore_thyself (GstObject * object, static void gst_object_real_restore_thyself (GstObject * object,
xmlNodePtr self); xmlNodePtr self);
...@@ -110,7 +113,7 @@ gst_object_get_type (void) ...@@ -110,7 +113,7 @@ gst_object_get_type (void)
NULL, NULL,
sizeof (GstObject), sizeof (GstObject),
0, 0,
(GInstanceInitFunc) gst_object_init, gst_object_init,
NULL NULL
}; };
...@@ -177,11 +180,14 @@ gst_object_class_init (GstObjectClass * klass) ...@@ -177,11 +180,14 @@ gst_object_class_init (GstObjectClass * klass)
} }
static void static void
gst_object_init (GstObject * object) gst_object_init (GTypeInstance * instance, gpointer g_class)
{ {
GstObject *object = GST_OBJECT (instance);
object->lock = g_mutex_new (); object->lock = g_mutex_new ();
object->parent = NULL; object->parent = NULL;
object->name = NULL; object->name = NULL;
gst_object_set_name_default (object, G_OBJECT_CLASS_NAME (g_class));
object->flags = 0; object->flags = 0;
GST_FLAG_SET (object, GST_FLOATING); GST_FLAG_SET (object, GST_FLOATING);
...@@ -433,13 +439,10 @@ gst_object_default_deep_notify (GObject * object, GstObject * orig, ...@@ -433,13 +439,10 @@ gst_object_default_deep_notify (GObject * object, GstObject * orig,
} }
static void static void
gst_object_set_name_default (GstObject * object) gst_object_set_name_default (GstObject * object, const gchar * type_name)
{ {
gint count; gint count;
gchar *name, *tmp; gchar *name, *tmp;
const gchar *type_name;
type_name = G_OBJECT_TYPE_NAME (object);
/* to ensure guaranteed uniqueness across threads, only one thread /* to ensure guaranteed uniqueness across threads, only one thread
* may ever assign a name */ * may ever assign a name */
...@@ -487,7 +490,7 @@ gst_object_set_name (GstObject * object, const gchar * name) ...@@ -487,7 +490,7 @@ gst_object_set_name (GstObject * object, const gchar * name)
if (name != NULL) if (name != NULL)
object->name = g_strdup (name); object->name = g_strdup (name);
else else
gst_object_set_name_default (object); gst_object_set_name_default (object, G_OBJECT_TYPE_NAME (object));
} }
/** /**
......
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