gstreamer_core/gst/gstindexfactory.c
changeset 8 4a7fac7dd34a
parent 0 0e761a78d257
child 30 7e817e7e631c
--- a/gstreamer_core/gst/gstindexfactory.c	Fri Mar 19 09:35:09 2010 +0200
+++ b/gstreamer_core/gst/gstindexfactory.c	Fri Apr 16 15:15:52 2010 +0300
@@ -43,46 +43,12 @@
 static GstPluginFeatureClass *factory_parent_class = NULL;
 
 /* static guint gst_index_factory_signals[LAST_SIGNAL] = { 0 }; */
-#ifdef __SYMBIAN32__
-EXPORT_C
-#endif
-
-
-GType
-gst_index_factory_get_type (void)
-{
-  static GType indexfactory_type = 0;
-
-  if (G_UNLIKELY (indexfactory_type == 0)) {
-    static const GTypeInfo indexfactory_info = {
-      sizeof (GstIndexFactoryClass),
-      NULL,
-      NULL,
-      (GClassInitFunc) gst_index_factory_class_init,
-      NULL,
-      NULL,
-      sizeof (GstIndexFactory),
-      0,
-      NULL,
-      NULL
-    };
-
-    indexfactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
-        "GstIndexFactory", &indexfactory_info, 0);
-  }
-  return indexfactory_type;
-}
+G_DEFINE_TYPE (GstIndexFactory, gst_index_factory, GST_TYPE_PLUGIN_FEATURE);
 
 static void
 gst_index_factory_class_init (GstIndexFactoryClass * klass)
 {
-  GObjectClass *gobject_class;
-  GstObjectClass *gstobject_class;
-  GstPluginFeatureClass *gstpluginfeature_class;
-
-  gobject_class = (GObjectClass *) klass;
-  gstobject_class = (GstObjectClass *) klass;
-  gstpluginfeature_class = (GstPluginFeatureClass *) klass;
+  GObjectClass *gobject_class = (GObjectClass *) klass;
 
   factory_parent_class = g_type_class_peek_parent (klass);
 
@@ -90,6 +56,11 @@
 }
 
 static void
+gst_index_factory_init (GstIndexFactory * factory)
+{
+}
+
+static void
 gst_index_factory_finalize (GObject * object)
 {
   GstIndexFactory *factory = GST_INDEX_FACTORY (object);
@@ -229,13 +200,33 @@
 gst_index_factory_make (const gchar * name)
 {
   GstIndexFactory *factory;
+  GstIndex *index;
 
   g_return_val_if_fail (name != NULL, NULL);
 
   factory = gst_index_factory_find (name);
 
   if (factory == NULL)
-    return NULL;
+    goto no_factory;
+
+  index = gst_index_factory_create (factory);
+
+  if (index == NULL)
+    goto create_failed;
+
+  gst_object_unref (factory);
+  return index;
 
-  return gst_index_factory_create (factory);
+  /* ERRORS */
+no_factory:
+  {
+    GST_INFO ("no such index factory \"%s\"!", name);
+    return NULL;
+  }
+create_failed:
+  {
+    GST_INFO_OBJECT (factory, "couldn't create instance!");
+    gst_object_unref (factory);
+    return NULL;
+  }
 }