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)
This commit is contained in:
Benjamin Otte 2005-02-19 13:02:45 +00:00
parent 70fd76df4f
commit 232f295af3
3 changed files with 21 additions and 9 deletions

View file

@ -1,3 +1,11 @@
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>
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_log_default):

View file

@ -324,6 +324,7 @@ gst_element_factory_create (GstElementFactory * factory, const gchar * name)
g_type_class_unref (oclass);
if (name)
gst_object_set_name (GST_OBJECT (element), name);
return element;

View file

@ -72,7 +72,7 @@ static guint gst_signal_object_signals[SO_LAST_SIGNAL] = { 0 };
#endif
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
static GObject *gst_object_constructor (GType type,
@ -89,6 +89,9 @@ static void gst_object_dispatch_properties_changed (GObject * object,
static void gst_object_dispose (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
static void gst_object_real_restore_thyself (GstObject * object,
xmlNodePtr self);
@ -110,7 +113,7 @@ gst_object_get_type (void)
NULL,
sizeof (GstObject),
0,
(GInstanceInitFunc) gst_object_init,
gst_object_init,
NULL
};
@ -177,11 +180,14 @@ gst_object_class_init (GstObjectClass * klass)
}
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->parent = NULL;
object->name = NULL;
gst_object_set_name_default (object, G_OBJECT_CLASS_NAME (g_class));
object->flags = 0;
GST_FLAG_SET (object, GST_FLOATING);
@ -433,13 +439,10 @@ gst_object_default_deep_notify (GObject * object, GstObject * orig,
}
static void
gst_object_set_name_default (GstObject * object)
gst_object_set_name_default (GstObject * object, const gchar * type_name)
{
gint count;
gchar *name, *tmp;
const gchar *type_name;
type_name = G_OBJECT_TYPE_NAME (object);
/* to ensure guaranteed uniqueness across threads, only one thread
* may ever assign a name */
@ -487,7 +490,7 @@ gst_object_set_name (GstObject * object, const gchar * name)
if (name != NULL)
object->name = g_strdup (name);
else
gst_object_set_name_default (object);
gst_object_set_name_default (object, G_OBJECT_TYPE_NAME (object));
}
/**