code cleanup fixes

Original commit message from CVS:
code cleanup fixes
This commit is contained in:
Thomas Vander Stichele 2002-08-28 10:45:57 +00:00
parent de527dd234
commit 789b347d71
2 changed files with 24 additions and 14 deletions

View file

@ -188,9 +188,10 @@ gst_element_factory_create (GstElementFactory *factory,
GstElement *element;
GstElementClass *oclass;
g_return_val_if_fail(factory != NULL, NULL);
g_return_val_if_fail (factory != NULL, NULL);
GST_DEBUG (GST_CAT_ELEMENT_FACTORY,"creating element from factory \"%s\" with name \"%s\" and type %d",
GST_DEBUG (GST_CAT_ELEMENT_FACTORY,
"creating element from factory \"%s\" (name \"%s\", type %d)",
GST_OBJECT_NAME (factory), name, (gint) factory->type);
if (!gst_plugin_feature_ensure_loaded (GST_PLUGIN_FEATURE (factory)))
@ -203,16 +204,17 @@ gst_element_factory_create (GstElementFactory *factory,
}
/* create an instance of the element */
element = GST_ELEMENT(g_object_new(factory->type,NULL));
g_assert(element != NULL);
element = GST_ELEMENT (g_object_new (factory->type, NULL));
g_assert (element != NULL);
/* attempt to set the elemenfactory class pointer if necessary */
oclass = GST_ELEMENT_CLASS(G_OBJECT_GET_CLASS(element));
oclass = GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (element));
if (oclass->elementfactory == NULL) {
GST_DEBUG (GST_CAT_ELEMENT_FACTORY,"class %s", GST_OBJECT_NAME (factory));
GST_DEBUG (GST_CAT_ELEMENT_FACTORY, "class %s", GST_OBJECT_NAME (factory));
oclass->elementfactory = factory;
/* copy pad template pointers to the element class, allow for custom padtemplates */
/* copy pad template pointers to the element class,
* allow for custom padtemplates */
oclass->padtemplates = g_list_concat (oclass->padtemplates,
g_list_copy (factory->padtemplates));
oclass->numpadtemplates += factory->numpadtemplates;
@ -243,17 +245,21 @@ gst_element_factory_make (const gchar *factoryname, const gchar *name)
g_return_val_if_fail (factoryname != NULL, NULL);
GST_DEBUG (GST_CAT_ELEMENT_FACTORY, "gstelementfactory: make \"%s\" \"%s\"", factoryname, name);
GST_DEBUG (GST_CAT_ELEMENT_FACTORY, "gstelementfactory: make \"%s\" \"%s\"",
factoryname, name);
/* gst_plugin_load_element_factory(factoryname); */
factory = gst_element_factory_find(factoryname);
/* gst_plugin_load_element_factory (factoryname); */
factory = gst_element_factory_find (factoryname);
if (factory == NULL) {
GST_INFO (GST_CAT_ELEMENT_FACTORY,"no such elementfactory \"%s\"!",factoryname);
GST_INFO (GST_CAT_ELEMENT_FACTORY,"no such element factory \"%s\"!",
factoryname);
return NULL;
}
element = gst_element_factory_create (factory, name);
if (element == NULL) {
GST_INFO (GST_CAT_ELEMENT_FACTORY,"couldn't create instance of elementfactory \"%s\"!",factoryname);
GST_INFO (GST_CAT_ELEMENT_FACTORY,
"couldn't create instance of element factory \"%s\"!",
factoryname);
return NULL;
}

View file

@ -274,13 +274,16 @@ gst_object_set_name_default (GstObject *object)
type_name = G_OBJECT_TYPE_NAME (object);
/* to ensure guaranteed uniqueness across threads, only one thread
* may ever assign a name */
G_LOCK (object_name_mutex);
if (!object_name_counts)
object_name_counts = g_hash_table_new (g_str_hash, g_str_equal);
count = GPOINTER_TO_INT (g_hash_table_lookup (object_name_counts, type_name));
g_hash_table_insert (object_name_counts, g_strdup (type_name), GINT_TO_POINTER (count+1));
g_hash_table_insert (object_name_counts, g_strdup (type_name),
GINT_TO_POINTER (count + 1));
G_UNLOCK (object_name_mutex);
@ -300,7 +303,8 @@ gst_object_set_name_default (GstObject *object)
* @object: GstObject to set the name of
* @name: new name of object
*
* Set the name of the object.
* Sets the name of the object, or gives the element a guaranteed unique
* name (if @name is NULL).
*/
void
gst_object_set_name (GstObject *object, const gchar *name)