gstreamer_core/gst/gstindexfactory.c
branchRCL_3
changeset 30 7e817e7e631c
parent 29 567bb019e3e3
equal deleted inserted replaced
29:567bb019e3e3 30:7e817e7e631c
    41 static void gst_index_factory_finalize (GObject * object);
    41 static void gst_index_factory_finalize (GObject * object);
    42 
    42 
    43 static GstPluginFeatureClass *factory_parent_class = NULL;
    43 static GstPluginFeatureClass *factory_parent_class = NULL;
    44 
    44 
    45 /* static guint gst_index_factory_signals[LAST_SIGNAL] = { 0 }; */
    45 /* static guint gst_index_factory_signals[LAST_SIGNAL] = { 0 }; */
    46 G_DEFINE_TYPE (GstIndexFactory, gst_index_factory, GST_TYPE_PLUGIN_FEATURE);
    46 #ifdef __SYMBIAN32__
       
    47 EXPORT_C
       
    48 #endif
       
    49 
       
    50 
       
    51 GType
       
    52 gst_index_factory_get_type (void)
       
    53 {
       
    54   static GType indexfactory_type = 0;
       
    55 
       
    56   if (G_UNLIKELY (indexfactory_type == 0)) {
       
    57     static const GTypeInfo indexfactory_info = {
       
    58       sizeof (GstIndexFactoryClass),
       
    59       NULL,
       
    60       NULL,
       
    61       (GClassInitFunc) gst_index_factory_class_init,
       
    62       NULL,
       
    63       NULL,
       
    64       sizeof (GstIndexFactory),
       
    65       0,
       
    66       NULL,
       
    67       NULL
       
    68     };
       
    69 
       
    70     indexfactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
       
    71         "GstIndexFactory", &indexfactory_info, 0);
       
    72   }
       
    73   return indexfactory_type;
       
    74 }
    47 
    75 
    48 static void
    76 static void
    49 gst_index_factory_class_init (GstIndexFactoryClass * klass)
    77 gst_index_factory_class_init (GstIndexFactoryClass * klass)
    50 {
    78 {
    51   GObjectClass *gobject_class = (GObjectClass *) klass;
    79   GObjectClass *gobject_class;
       
    80   GstObjectClass *gstobject_class;
       
    81   GstPluginFeatureClass *gstpluginfeature_class;
       
    82 
       
    83   gobject_class = (GObjectClass *) klass;
       
    84   gstobject_class = (GstObjectClass *) klass;
       
    85   gstpluginfeature_class = (GstPluginFeatureClass *) klass;
    52 
    86 
    53   factory_parent_class = g_type_class_peek_parent (klass);
    87   factory_parent_class = g_type_class_peek_parent (klass);
    54 
    88 
    55   gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_index_factory_finalize);
    89   gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_index_factory_finalize);
    56 }
       
    57 
       
    58 static void
       
    59 gst_index_factory_init (GstIndexFactory * factory)
       
    60 {
       
    61 }
    90 }
    62 
    91 
    63 static void
    92 static void
    64 gst_index_factory_finalize (GObject * object)
    93 gst_index_factory_finalize (GObject * object)
    65 {
    94 {
   198 
   227 
   199 GstIndex *
   228 GstIndex *
   200 gst_index_factory_make (const gchar * name)
   229 gst_index_factory_make (const gchar * name)
   201 {
   230 {
   202   GstIndexFactory *factory;
   231   GstIndexFactory *factory;
   203   GstIndex *index;
       
   204 
   232 
   205   g_return_val_if_fail (name != NULL, NULL);
   233   g_return_val_if_fail (name != NULL, NULL);
   206 
   234 
   207   factory = gst_index_factory_find (name);
   235   factory = gst_index_factory_find (name);
   208 
   236 
   209   if (factory == NULL)
   237   if (factory == NULL)
   210     goto no_factory;
       
   211 
       
   212   index = gst_index_factory_create (factory);
       
   213 
       
   214   if (index == NULL)
       
   215     goto create_failed;
       
   216 
       
   217   gst_object_unref (factory);
       
   218   return index;
       
   219 
       
   220   /* ERRORS */
       
   221 no_factory:
       
   222   {
       
   223     GST_INFO ("no such index factory \"%s\"!", name);
       
   224     return NULL;
   238     return NULL;
   225   }
   239 
   226 create_failed:
   240   return gst_index_factory_create (factory);
   227   {
   241 }
   228     GST_INFO_OBJECT (factory, "couldn't create instance!");
       
   229     gst_object_unref (factory);
       
   230     return NULL;
       
   231   }
       
   232 }