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