gstreamer_core/gst/gstindex.c
branchRCL_3
changeset 7 567bb019e3e3
parent 0 0e761a78d257
child 8 7e817e7e631c
equal deleted inserted replaced
6:9b2c3c7a1a9c 7:567bb019e3e3
    37 #include "gstmarshal.h"
    37 #include "gstmarshal.h"
    38 #include "gstregistry.h"
    38 #include "gstregistry.h"
    39 /* for constructing an entry name */
    39 /* for constructing an entry name */
    40 #include "gstelement.h"
    40 #include "gstelement.h"
    41 #include "gstpad.h"
    41 #include "gstpad.h"
       
    42 #include "gstinfo.h"
    42 
    43 
    43 /* Index signals and args */
    44 /* Index signals and args */
    44 enum
    45 enum
    45 {
    46 {
    46   ENTRY_ADDED,
    47   ENTRY_ADDED,
    51 {
    52 {
    52   ARG_0,
    53   ARG_0,
    53   ARG_RESOLVER
    54   ARG_RESOLVER
    54       /* FILL ME */
    55       /* FILL ME */
    55 };
    56 };
       
    57 
       
    58 GST_DEBUG_CATEGORY_STATIC (index_debug);
       
    59 #define GST_CAT_DEFAULT index_debug
    56 
    60 
    57 static void gst_index_class_init (GstIndexClass * klass);
    61 static void gst_index_class_init (GstIndexClass * klass);
    58 static void gst_index_init (GstIndex * index);
    62 static void gst_index_init (GstIndex * index);
    59 static void gst_index_finalize (GObject * object);
    63 static void gst_index_finalize (GObject * object);
    60 
    64 
    92 static GType
    96 static GType
    93 gst_index_resolver_get_type (void)
    97 gst_index_resolver_get_type (void)
    94 {
    98 {
    95   static GType index_resolver_type = 0;
    99   static GType index_resolver_type = 0;
    96   static const GEnumValue index_resolver[] = {
   100   static const GEnumValue index_resolver[] = {
    97     {GST_INDEX_RESOLVER_CUSTOM, "GST_INDEX_RESOLVER_CUSTOM",
   101     {GST_INDEX_RESOLVER_CUSTOM, "GST_INDEX_RESOLVER_CUSTOM", "custom"},
    98         "Use a custom resolver"},
   102     {GST_INDEX_RESOLVER_GTYPE, "GST_INDEX_RESOLVER_GTYPE", "gtype"},
    99     {GST_INDEX_RESOLVER_GTYPE, "GST_INDEX_RESOLVER_GTYPE",
   103     {GST_INDEX_RESOLVER_PATH, "GST_INDEX_RESOLVER_PATH", "path"},
   100         "Resolve an object to its GType[.padname]"},
       
   101     {GST_INDEX_RESOLVER_PATH, "GST_INDEX_RESOLVER_PATH",
       
   102         "Resolve an object to its path in the pipeline"},
       
   103     {0, NULL, NULL},
   104     {0, NULL, NULL},
   104   };
   105   };
   105 
   106 
   106   if (!index_resolver_type) {
   107   if (!index_resolver_type) {
   107     index_resolver_type =
   108     index_resolver_type =
   124         (GBoxedCopyFunc) gst_index_entry_copy,
   125         (GBoxedCopyFunc) gst_index_entry_copy,
   125         (GBoxedFreeFunc) gst_index_entry_free);
   126         (GBoxedFreeFunc) gst_index_entry_free);
   126   }
   127   }
   127   return index_entry_type;
   128   return index_entry_type;
   128 }
   129 }
   129 #ifdef __SYMBIAN32__
   130 
   130 EXPORT_C
   131 #define _do_init \
   131 #endif
   132 { \
   132 
   133   GST_DEBUG_CATEGORY_INIT (index_debug, "GST_INDEX", GST_DEBUG_BOLD, \
   133 
   134       "Generic indexing support"); \
   134 
   135 }
   135 GType
   136 
   136 gst_index_get_type (void)
   137 G_DEFINE_TYPE_WITH_CODE (GstIndex, gst_index, GST_TYPE_OBJECT, _do_init);
   137 {
       
   138   static GType index_type = 0;
       
   139 
       
   140   if (!index_type) {
       
   141     static const GTypeInfo index_info = {
       
   142       sizeof (GstIndexClass),
       
   143       NULL,
       
   144       NULL,
       
   145       (GClassInitFunc) gst_index_class_init,
       
   146       NULL,
       
   147       NULL,
       
   148       sizeof (GstIndex),
       
   149       0,
       
   150       (GInstanceInitFunc) gst_index_init,
       
   151       NULL
       
   152     };
       
   153 
       
   154     index_type =
       
   155         g_type_register_static (GST_TYPE_OBJECT, "GstIndex", &index_info, 0);
       
   156   }
       
   157   return index_type;
       
   158 }
       
   159 
   138 
   160 static void
   139 static void
   161 gst_index_class_init (GstIndexClass * klass)
   140 gst_index_class_init (GstIndexClass * klass)
   162 {
   141 {
   163   GObjectClass *gobject_class;
   142   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
   164 
       
   165   gobject_class = G_OBJECT_CLASS (klass);
       
   166 
   143 
   167   parent_class = g_type_class_peek_parent (klass);
   144   parent_class = g_type_class_peek_parent (klass);
   168 
   145 
   169   /**
   146   /**
   170    * GstIndex::entry-added
   147    * GstIndex::entry-added
   183   gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_index_finalize);
   160   gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_index_finalize);
   184 
   161 
   185   g_object_class_install_property (gobject_class, ARG_RESOLVER,
   162   g_object_class_install_property (gobject_class, ARG_RESOLVER,
   186       g_param_spec_enum ("resolver", "Resolver",
   163       g_param_spec_enum ("resolver", "Resolver",
   187           "Select a predefined object to string mapper",
   164           "Select a predefined object to string mapper",
   188           GST_TYPE_INDEX_RESOLVER, GST_INDEX_RESOLVER_PATH, G_PARAM_READWRITE));
   165           GST_TYPE_INDEX_RESOLVER, GST_INDEX_RESOLVER_PATH,
       
   166           G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
   189 }
   167 }
   190 
   168 
   191 static void
   169 static void
   192 gst_index_init (GstIndex * index)
   170 gst_index_init (GstIndex * index)
   193 {
   171 {