more docs inlined, splitted gstindex.{c,h}
authorStefan Kost <ensonic@users.sourceforge.net>
Tue, 20 Sep 2005 20:40:00 +0000 (20:40 +0000)
committerStefan Kost <ensonic@users.sourceforge.net>
Tue, 20 Sep 2005 20:40:00 +0000 (20:40 +0000)
Original commit message from CVS:
* docs/gst/gstreamer-docs.sgml:
* docs/gst/gstreamer-sections.txt:
* docs/gst/tmpl/.cvsignore:
* gst/Makefile.am:
* gst/gst.h:
* gst/gstbin.c:
* gst/gstelement.h:
* gst/gstindex.c: (gst_index_class_init):
* gst/gstindex.h:
* gst/gstindexfactory.c: (gst_index_factory_get_type),
(gst_index_factory_class_init), (gst_index_factory_init),
(gst_index_factory_finalize), (gst_index_factory_new),
(gst_index_factory_destroy), (gst_index_factory_find),
(gst_index_factory_create), (gst_index_factory_make):
* gst/gstindexfactory.h:
* gst/gstpluginfeature.c:
* gst/gstpluginfeature.h:
* libs/gst/controller/gstcontroller.c: (gst_controller_new_valist):
more docs inlined, splitted gstindex.{c,h}

14 files changed:
ChangeLog
docs/gst/gstreamer-docs.sgml
docs/gst/gstreamer-sections.txt
docs/gst/tmpl/.gitignore
gst/Makefile.am
gst/gst.h
gst/gstbin.c
gst/gstelement.h
gst/gstindex.c
gst/gstindex.h
gst/gstindexfactory.c [new file with mode: 0644]
gst/gstindexfactory.h [new file with mode: 0644]
gst/gstpluginfeature.c
gst/gstpluginfeature.h

index dc2fa22..56416a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,31 @@
+2005-09-21  Stefan Kost  <ensonic@users.sf.net>
+
+       * docs/gst/gstreamer-docs.sgml:
+       * docs/gst/gstreamer-sections.txt:
+       * docs/gst/tmpl/.cvsignore:
+       * gst/Makefile.am:
+       * gst/gst.h:
+       * gst/gstbin.c:
+       * gst/gstelement.h:
+       * gst/gstindex.c: (gst_index_class_init):
+       * gst/gstindex.h:
+       * gst/gstindexfactory.c: (gst_index_factory_get_type),
+       (gst_index_factory_class_init), (gst_index_factory_init),
+       (gst_index_factory_finalize), (gst_index_factory_new),
+       (gst_index_factory_destroy), (gst_index_factory_find),
+       (gst_index_factory_create), (gst_index_factory_make):
+       * gst/gstindexfactory.h:
+       * gst/gstpluginfeature.c:
+       * gst/gstpluginfeature.h:
+       * libs/gst/controller/gstcontroller.c: (gst_controller_new_valist):
+          more docs inlined, splitted gstindex.{c,h}
+
 2005-09-20  Thomas Vander Stichele  <thomas at apestaart dot org>
 
        * libs/gst/controller/gstcontroller.c: (gst_controller_new_valist):
          fix a leak
 
-2005-09-20  Tim-Philipp Müller  <tim at centricular dot net>
+2005-09-20  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * gst/elements/gstfilesink.c: (gst_file_sink_init):
          Set sync to FALSE by default.
@@ -26,7 +48,7 @@
        so we don't timeout before popping a message with 0 timeout.
        Dump error messages after failed state change.
 
-2005-09-20  Tim-Philipp Müller  <tim at centricular dot net>
+2005-09-20  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * tools/gst-inspect.c: (print_element_properties_info):
          Fix two typos.
        * docs/libs/tmpl/gstgetbits.sgml:
        * docs/libs/tmpl/gstputbits.sgml:
 
-2005-09-19  Tim-Philipp Müller  <tim at centricular dot net>
+2005-09-19  Tim-Philipp M??ller  <tim at centricular dot net>
 
        * win32/gstenumtypes.c:
        * win32/gstenumtypes.h:
index 6960657..635d6ab 100644 (file)
@@ -46,7 +46,6 @@
 <!ENTITY GstTrace SYSTEM "xml/gsttrace.xml">
 <!ENTITY GstTypeFind SYSTEM "xml/gsttypefind.xml">
 <!ENTITY GstTypeFindFactory SYSTEM "xml/gsttypefindfactory.xml">
-<!ENTITY GstTypes SYSTEM "xml/gsttypes.xml">
 <!ENTITY GstUriHandler SYSTEM "xml/gsturihandler.xml">
 <!ENTITY GstUriType SYSTEM "xml/gsturitype.xml">
 <!ENTITY GstUtils SYSTEM "xml/gstutils.xml">
     &GstTagSetter;
     &GstTypeFind;
     &GstTypeFindFactory;
-    &GstTypes;
     &GstUriHandler;
     &GstUriType;
     &GstUtils;
index 6a45acd..50d7347 100644 (file)
@@ -404,6 +404,8 @@ GST_DISABLE_URI
 GST_PTR_FORMAT
 GST_EXPORT
 GST_PLUGIN_EXPORT
+GST_PADDING
+GST_PADDING_INIT
 </SECTION>
 
 
@@ -413,7 +415,10 @@ GST_PLUGIN_EXPORT
 GstElement
 GstElementClass
 GstElementFlags
+GstState
 GstStateChange
+GstStateChangeReturn
+
 GST_STATE
 GST_STATE_PENDING
 GST_STATE_CHANGE
@@ -514,9 +519,15 @@ GST_ELEMENT_GET_CLASS
 GST_TYPE_ELEMENT
 GST_TYPE_ELEMENT_FLAGS
 GST_ELEMENT_CAST
+GST_TYPE_STATE
+GST_TYPE_STATE_CHANGE
+GST_TYPE_STATE_CHANGE_RETURN
 <SUBSECTION Private>
 gst_element_get_type
 gst_element_flags_get_type
+gst_state_get_type
+gst_state_change_get_type
+gst_state_change_return_get_type
 </SECTION>
 
 
@@ -1438,6 +1449,8 @@ GstPluginFeature
 GST_PLUGIN_FEATURE_NAME
 GstTypeNameData
 GstPluginFeatureFilter
+GstRank
+
 gst_plugin_feature_type_name_filter
 gst_plugin_feature_set_rank
 gst_plugin_feature_set_name
@@ -1453,8 +1466,10 @@ GST_PLUGIN_FEATURE_CLASS
 GST_IS_PLUGIN_FEATURE_CLASS
 GST_PLUGIN_FEATURE_GET_CLASS
 GST_TYPE_PLUGIN_FEATURE
+GST_TYPE_RANK
 <SUBSECTION Private>
 gst_plugin_feature_get_type
+gst_rank_get_type
 </SECTION>
 
 
@@ -1890,28 +1905,6 @@ gst_type_find_factory_get_type
 
 
 <SECTION>
-<FILE>gsttypes</FILE>
-<TITLE>GstTypes</TITLE>
-GstState
-GstStateChange
-GstStateChangeReturn
-GstRank
-<SUBSECTION Standard>
-GST_TYPE_STATE
-GST_TYPE_STATE_CHANGE
-GST_TYPE_STATE_CHANGE_RETURN
-GST_TYPE_RANK
-<SUBSECTION Private>
-GST_PADDING
-GST_PADDING_INIT
-gst_state_get_type
-gst_state_change_get_type
-gst_state_change_return_get_type
-gst_rank_get_type
-</SECTION>
-
-
-<SECTION>
 <FILE>gsturihandler</FILE>
 <TITLE>GstUriHandler</TITLE>
 GstURIHandler
index 037375c..2c3c189 100644 (file)
@@ -26,13 +26,15 @@ gstfilesink.sgml
 gstfilter.sgml
 gstformat.sgml
 gstghostpad.sgml
+gstindex.sgml
+gstindexfactory.sgml
 gstiterator.sgml
 gstmacros.sgml
 gstmemchunk.sgml
 gstmessage.sgml
 gstminiobject.sgml
 gstparse.sgml
-gstprobe.sgml
+gstpluginfeature.sgml
 gstpushsrc.sgml
 gstqueue.sgml
 gstquery.sgml
@@ -48,6 +50,7 @@ gsttrace.sgml
 gsttrashstack.sgml
 gsttypefind.sgml
 gsttypefindfactory.sgml
+gsttypes.sgml
 gsturihandler.sgml
 gsturitype.sgml
 gstutils.sgml
index 60d334b..de9037a 100644 (file)
@@ -38,7 +38,7 @@ if GST_DISABLE_INDEX
 GST_INDEX_SRC = 
 SUBDIRS_INDEX =
 else
-GST_INDEX_SRC = gstindex.c
+GST_INDEX_SRC = gstindex.c gstindexfactory.c
 SUBDIRS_INDEX = indexers
 endif
 
@@ -160,6 +160,7 @@ gst_headers =                       \
        gstformat.h             \
        gstghostpad.h           \
        gstindex.h              \
+       gstindexfactory.h       \
        gstinfo.h               \
        gstinterface.h          \
        gstiterator.h           \
index 84afc31..a79b370 100644 (file)
--- a/gst/gst.h
+++ b/gst/gst.h
@@ -39,6 +39,7 @@
 #include <gst/gstevent.h>
 #include <gst/gstghostpad.h>
 #include <gst/gstindex.h>
+#include <gst/gstindexfactory.h>
 #include <gst/gstinfo.h>
 #include <gst/gstinterface.h>
 #include <gst/gstiterator.h>
index c6afc2d..546fe35 100644 (file)
@@ -73,6 +73,7 @@
 #include "gsterror.h"
 
 #include "gstindex.h"
+#include "gstindexfactory.h"
 #include "gstutils.h"
 #include "gstchildproxy.h"
 
index 1f4c9f8..305b8e7 100644 (file)
@@ -48,6 +48,7 @@ typedef enum {
 #include <gst/gstplugin.h>
 #include <gst/gstpluginfeature.h>
 #include <gst/gstindex.h>
+#include <gst/gstindexfactory.h>
 #include <gst/gstiterator.h>
 #include <gst/gstmessage.h>
 #include <gst/gsttaglist.h>
index f592b09..35f026d 100644 (file)
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+/**
+ * SECTION:gstindex
+ * @short_description: Generate indexes on objects
+ * @see_also: #GstIndexFactory
+ *
+ * GstIndex is used to generate a stream index of one or more elements
+ * in a pipeline.
+ */
 
 #include "gst_private.h"
 
 #include "gstinfo.h"
 #include "gstindex.h"
+#include "gstindexfactory.h"
 #include "gstmarshal.h"
 #include "gstregistry.h"
 /* for constructing an entry name */
@@ -149,6 +158,13 @@ gst_index_class_init (GstIndexClass * klass)
 
   parent_class = g_type_class_ref (GST_TYPE_OBJECT);
 
+  /**
+   * GstIndex::entry-added
+   * @gstindex: the object which received the signal.
+   * @arg1: The entry added to the index.
+   *
+   * Is emitted when a new entry is added to the index.
+   */
   gst_index_signals[ENTRY_ADDED] =
       g_signal_new ("entry-added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
       G_STRUCT_OFFSET (GstIndexClass, entry_added), NULL, NULL,
@@ -845,186 +861,3 @@ gst_index_entry_assoc_map (GstIndexEntry * entry,
   }
   return FALSE;
 }
-
-
-static void gst_index_factory_class_init (GstIndexFactoryClass * klass);
-static void gst_index_factory_init (GstIndexFactory * factory);
-static void gst_index_factory_finalize (GObject * object);
-
-static GstPluginFeatureClass *factory_parent_class = NULL;
-
-/* static guint gst_index_factory_signals[LAST_SIGNAL] = { 0 }; */
-
-GType
-gst_index_factory_get_type (void)
-{
-  static GType indexfactory_type = 0;
-
-  if (!indexfactory_type) {
-    static const GTypeInfo indexfactory_info = {
-      sizeof (GstIndexFactoryClass),
-      NULL,
-      NULL,
-      (GClassInitFunc) gst_index_factory_class_init,
-      NULL,
-      NULL,
-      sizeof (GstIndexFactory),
-      0,
-      (GInstanceInitFunc) gst_index_factory_init,
-      NULL
-    };
-
-    indexfactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
-        "GstIndexFactory", &indexfactory_info, 0);
-  }
-  return indexfactory_type;
-}
-
-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;
-
-  factory_parent_class = g_type_class_ref (GST_TYPE_PLUGIN_FEATURE);
-
-  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_index_factory_finalize);
-}
-
-static void
-gst_index_factory_init (GstIndexFactory * factory)
-{
-}
-
-static void
-gst_index_factory_finalize (GObject * object)
-{
-  GstIndexFactory *factory = GST_INDEX_FACTORY (object);
-
-  g_free (factory->longdesc);
-
-  G_OBJECT_CLASS (factory_parent_class)->finalize (object);
-
-}
-
-/**
- * gst_index_factory_new:
- * @name: name of indexfactory to create
- * @longdesc: long description of indexfactory to create
- * @type: the GType of the GstIndex element of this factory
- *
- * Create a new indexfactory with the given parameters
- *
- * Returns: a new #GstIndexFactory.
- */
-GstIndexFactory *
-gst_index_factory_new (const gchar * name, const gchar * longdesc, GType type)
-{
-  GstIndexFactory *factory;
-
-  g_return_val_if_fail (name != NULL, NULL);
-  factory = GST_INDEX_FACTORY (g_object_new (GST_TYPE_INDEX_FACTORY, NULL));
-
-  GST_PLUGIN_FEATURE_NAME (factory) = g_strdup (name);
-  if (factory->longdesc)
-    g_free (factory->longdesc);
-  factory->longdesc = g_strdup (longdesc);
-  factory->type = type;
-
-  return factory;
-}
-
-/**
- * gst_index_factory_destroy:
- * @factory: factory to destroy
- *
- * Removes the index from the global list.
- */
-void
-gst_index_factory_destroy (GstIndexFactory * factory)
-{
-  g_return_if_fail (factory != NULL);
-
-  /* we don't free the struct bacause someone might  have a handle to it.. */
-}
-
-/**
- * gst_index_factory_find:
- * @name: name of indexfactory to find
- *
- * Search for an indexfactory of the given name.
- *
- * Returns: #GstIndexFactory if found, NULL otherwise
- */
-GstIndexFactory *
-gst_index_factory_find (const gchar * name)
-{
-  GstPluginFeature *feature;
-
-  g_return_val_if_fail (name != NULL, NULL);
-
-  GST_DEBUG ("gstindex: find \"%s\"", name);
-
-  feature = gst_registry_find_feature (gst_registry_get_default (), name,
-      GST_TYPE_INDEX_FACTORY);
-  if (feature)
-    return GST_INDEX_FACTORY (feature);
-
-  return NULL;
-}
-
-/**
- * gst_index_factory_create:
- * @factory: the factory used to create the instance
- *
- * Create a new #GstIndex instance from the 
- * given indexfactory.
- *
- * Returns: A new #GstIndex instance.
- */
-GstIndex *
-gst_index_factory_create (GstIndexFactory * factory)
-{
-  GstIndex *new = NULL;
-
-  g_return_val_if_fail (factory != NULL, NULL);
-
-  factory =
-      GST_INDEX_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
-          (factory)));
-  if (factory == NULL)
-    return NULL;
-
-  new = GST_INDEX (g_object_new (factory->type, NULL));
-
-  return new;
-}
-
-/**
- * gst_index_factory_make:
- * @name: the name of the factory used to create the instance
- *
- * Create a new #GstIndex instance from the 
- * indexfactory with the given name.
- *
- * Returns: A new #GstIndex instance.
- */
-GstIndex *
-gst_index_factory_make (const gchar * name)
-{
-  GstIndexFactory *factory;
-
-  g_return_val_if_fail (name != NULL, NULL);
-
-  factory = gst_index_factory_find (name);
-
-  if (factory == NULL)
-    return NULL;
-
-  return gst_index_factory_create (factory);
-}
index a22f787..fbad222 100644 (file)
@@ -44,12 +44,29 @@ typedef struct _GstIndexGroup GstIndexGroup;
 typedef struct _GstIndex GstIndex;
 typedef struct _GstIndexClass GstIndexClass;
 
+/**
+ * GstIndexCertainty:
+ * @GST_INDEX_UNKNOWN: accuracy is not known
+ * @GST_INDEX_CERTAIN: accuracy is perfect
+ * @GST_INDEX_FUZZY: accuracy is fuzzy
+ * 
+ * The certainty of a group in the index.
+ */
 typedef enum {
   GST_INDEX_UNKNOWN,
   GST_INDEX_CERTAIN,
   GST_INDEX_FUZZY
 } GstIndexCertainty;
 
+/**
+ * GstIndexEntryType:
+ * @GST_INDEX_ENTRY_ID: This entry is an id that maps an index id to its owner object
+ * @GST_INDEX_ENTRY_ASSOCIATION: This entry is an association between formats
+ * @GST_INDEX_ENTRY_OBJECT: An object
+ * @GST_INDEX_ENTRY_FORMAT: A format definition
+ * 
+ * The different types of entries in the index.
+ */
 typedef enum {
   GST_INDEX_ENTRY_ID,
   GST_INDEX_ENTRY_ASSOCIATION,
@@ -57,24 +74,79 @@ typedef enum {
   GST_INDEX_ENTRY_FORMAT
 } GstIndexEntryType;
 
+/**
+ * GstIndexLookupMethod:
+ * @GST_INDEX_LOOKUP_EXACT: There has to be an exact indexentry with the given format/value
+ * @GST_INDEX_LOOKUP_BEFORE: The exact entry or the one before it
+ * @GST_INDEX_LOOKUP_AFTER: The exact entry or the one after it
+ * 
+ * Specify the method to find an index entry in the index.
+ */
 typedef enum {
   GST_INDEX_LOOKUP_EXACT,
   GST_INDEX_LOOKUP_BEFORE,
   GST_INDEX_LOOKUP_AFTER
 } GstIndexLookupMethod;
 
+/**
+ * GST_INDEX_NASSOCS:
+ * @entry: The entry to query
+ *
+ * Get the number of associations in the entry.
+ */
 #define GST_INDEX_NASSOCS(entry)               ((entry)->data.assoc.nassocs)
+
+/**
+ * GST_INDEX_ASSOC_FLAGS:
+ * @entry: The entry to query
+ *
+ *  Get the flags for this entry.
+ */
 #define GST_INDEX_ASSOC_FLAGS(entry)           ((entry)->data.assoc.flags)
+
+/**
+ * GST_INDEX_ASSOC_FORMAT:
+ * @entry: The entry to query
+ * @i: The format index
+ *
+ * Get the i-th format of the entry.
+ */
 #define GST_INDEX_ASSOC_FORMAT(entry,i)                ((entry)->data.assoc.assocs[(i)].format)
+
+/**
+ * GST_INDEX_ASSOC_VALUE:
+ * @entry: The entry to query
+ * @i: The value index
+ *
+ * Get the i-th value of the entry.
+ */
 #define GST_INDEX_ASSOC_VALUE(entry,i)         ((entry)->data.assoc.assocs[(i)].value)
 
 typedef struct _GstIndexAssociation GstIndexAssociation;
 
+/**
+ * GstIndexAssociation:
+ * @format: the format of the association
+ * @value: the value of the association
+ *
+ * An association in an entry.
+ */
 struct _GstIndexAssociation {
   GstFormat    format;
   gint64       value;
 };
 
+/**
+ * GstAssocFlags:
+ * @GST_ASSOCIATION_FLAG_NONE: no extra flags
+ * @GST_ASSOCIATION_FLAG_KEY_UNIT: the entry marks a key unit, a key unit is one
+ *  that marks a place where one can randomly seek to.
+ * @GST_ASSOCIATION_FLAG_DELTA_UNIT: the entry marks a delta unit, a delta unit
+ *  is one that marks a place where one can relatively seek to.
+ * @GST_ASSOCIATION_FLAG_LAST: extra user defined flags should start here.
+ *
+ * Flags for an association entry.
+ */
 typedef enum {
   GST_ASSOCIATION_FLAG_NONE    = 0,
   GST_ASSOCIATION_FLAG_KEY_UNIT = (1 << 0),
@@ -84,13 +156,42 @@ typedef enum {
   GST_ASSOCIATION_FLAG_LAST    = (1 << 8)
 } GstAssocFlags;
 
+/**
+ * GST_INDEX_FORMAT_FORMAT:
+ * @entry: The entry to query
+ *
+ * Get the format of the format entry
+ */
 #define GST_INDEX_FORMAT_FORMAT(entry)         ((entry)->data.format.format)
+
+/**
+ * GST_INDEX_FORMAT_KEY:
+ * @entry: The entry to query
+ *
+ * Get the key of the format entry
+ */
 #define GST_INDEX_FORMAT_KEY(entry)            ((entry)->data.format.key)
 
+/**
+ * GST_INDEX_ID_INVALID:
+ *
+ * Constant for an invalid index id
+ */
 #define GST_INDEX_ID_INVALID                   (-1)
 
+/**
+ * GST_INDEX_ID_DESCRIPTION:
+ * @entry: The entry to query
+ *
+ * Get the description of the id entry
+ */
 #define GST_INDEX_ID_DESCRIPTION(entry)                ((entry)->data.id.description)
 
+/**
+ * GstIndexEntry:
+ *
+ * The basic element of an index.
+ */
 struct _GstIndexEntry {
   GstIndexEntryType     type;
   gint                  id;
@@ -117,6 +218,12 @@ struct _GstIndexEntry {
   } data;
 };
 
+/**
+ * GstIndexGroup:
+ *
+ * A group of related entries in an index.
+ */
+
 struct _GstIndexGroup {
   /* unique ID of group in index */
   gint groupnum;
@@ -131,19 +238,57 @@ struct _GstIndexGroup {
   gint peergroup;
 };
 
+/**
+ * GstIndexFilter:
+ * @index: The index being queried
+ * @entry: The entry to be added.
+ *
+ * Function to filter out entries in the index.
+ *
+ * Returns: This function should return %TRUE if the entry is to be added
+ * to the index, %FALSE otherwise.
+ *
+ */
 typedef gboolean       (*GstIndexFilter)               (GstIndex *index, 
                                                         GstIndexEntry *entry);
-
+/**
+ * GstIndexResolverMethod:
+ * @GST_INDEX_RESOLVER_CUSTOM: Use a custom resolver
+ * @GST_INDEX_RESOLVER_GTYPE: Resolve based on the GType of the object
+ * @GST_INDEX_RESOLVER_PATH: Resolve on the path in graph
+ *
+ * The method used to resolve index writers
+ */
 typedef enum {
   GST_INDEX_RESOLVER_CUSTOM,
   GST_INDEX_RESOLVER_GTYPE,
   GST_INDEX_RESOLVER_PATH
 } GstIndexResolverMethod;
 
+/**
+ * GstIndexResolver:
+ * @index: the index being queried.
+ * @writer: The object that wants to write
+ * @writer_string: A description of the writer.
+ * @user_data: user_data as registered
+ *
+ * Function to resolve ids to writer descriptions.
+ *
+ * Returns: %TRUE if an id could be assigned to the writer.
+ */
 typedef gboolean       (*GstIndexResolver)             (GstIndex *index, 
                                                         GstObject *writer, 
                                                         gchar **writer_string,
                                                         gpointer user_data);
+
+/**
+ * GstIndexFlags:
+ * @GST_INDEX_WRITABLE: The index is writable
+ * @GST_INDEX_READABLE: The index is readable
+ * @GST_INDEX_FLAG_LAST: First flag that can be used by subclasses
+ *
+ * Flags for this index
+ */
 typedef enum {
   GST_INDEX_WRITABLE           = GST_OBJECT_FLAG_LAST, 
   GST_INDEX_READABLE,  
@@ -151,7 +296,20 @@ typedef enum {
   GST_INDEX_FLAG_LAST          = GST_OBJECT_FLAG_LAST + 8
 } GstIndexFlags;
 
+/**
+ * GST_INDEX_IS_READABLE:
+ * @obj: The index to check
+ *
+ * Check if the index can be read from
+ */
 #define GST_INDEX_IS_READABLE(obj)    (GST_FLAG_IS_SET (obj, GST_INDEX_READABLE))
+
+/**
+ * GST_INDEX_IS_WRITABLE:
+ * @obj: The index to check
+ *
+ * Check if the index can be written to
+ */
 #define GST_INDEX_IS_WRITABLE(obj)    (GST_FLAG_IS_SET (obj, GST_INDEX_WRITABLE))
 
 struct _GstIndex {
@@ -237,45 +395,6 @@ GstIndexEntry *         gst_index_entry_copy            (GstIndexEntry *entry);
 void                   gst_index_entry_free            (GstIndexEntry *entry);
 gboolean               gst_index_entry_assoc_map       (GstIndexEntry *entry,
                                                         GstFormat format, gint64 *value);
-/*
- * creating indexs
- *
- */
-#define GST_TYPE_INDEX_FACTORY                 (gst_index_factory_get_type())
-#define GST_INDEX_FACTORY(obj)                         (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_INDEX_FACTORY, GstIndexFactory))
-#define GST_IS_INDEX_FACTORY(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_INDEX_FACTORY))
-#define GST_INDEX_FACTORY_CLASS(klass)                 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_INDEX_FACTORY, GstIndexFactoryClass))
-#define GST_IS_INDEX_FACTORY_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_INDEX_FACTORY))
-#define GST_INDEX_FACTORY_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_INDEX_FACTORY, GstIndexFactoryClass))
-
-typedef struct _GstIndexFactory GstIndexFactory;
-typedef struct _GstIndexFactoryClass GstIndexFactoryClass;
-
-struct _GstIndexFactory {
-  GstPluginFeature feature;
-           
-  gchar *longdesc;            /* long description of the index (well, don't overdo it..) */
-  GType type;                 /* unique GType of the index */
-
-  gpointer _gst_reserved[GST_PADDING];
-};
-
-struct _GstIndexFactoryClass {
-  GstPluginFeatureClass parent; 
-
-  gpointer _gst_reserved[GST_PADDING];
-};
-
-GType                  gst_index_factory_get_type      (void);
-
-GstIndexFactory*       gst_index_factory_new           (const gchar *name, 
-                                                        const gchar *longdesc, GType type);
-void                   gst_index_factory_destroy       (GstIndexFactory *factory);
-
-GstIndexFactory*       gst_index_factory_find          (const gchar *name);
-
-GstIndex*              gst_index_factory_create        (GstIndexFactory *factory);
-GstIndex*              gst_index_factory_make          (const gchar *name);
 
 G_END_DECLS
 
diff --git a/gst/gstindexfactory.c b/gst/gstindexfactory.c
new file mode 100644 (file)
index 0000000..6fbaef5
--- /dev/null
@@ -0,0 +1,219 @@
+/* GStreamer
+ * Copyright (C) 2001 RidgeRun (http://www.ridgerun.com/)
+ * Written by Erik Walthinsen <omega@ridgerun.com>
+ *
+ * gstindexfactory.c: Index for mappings and other data
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+/**
+ * SECTION:gstindexfactory
+ * @short_description: Create GstIndexes from a factory
+ * @see_also: #GstIndex
+ *
+ * GstIndexFactory is used to dynamically create GstIndex implementations.
+ */
+
+
+#include "gst_private.h"
+
+#include "gstinfo.h"
+#include "gstindex.h"
+#include "gstindexfactory.h"
+#include "gstmarshal.h"
+#include "gstregistry.h"
+
+static void gst_index_factory_class_init (GstIndexFactoryClass * klass);
+static void gst_index_factory_init (GstIndexFactory * factory);
+static void gst_index_factory_finalize (GObject * object);
+
+static GstPluginFeatureClass *factory_parent_class = NULL;
+
+/* static guint gst_index_factory_signals[LAST_SIGNAL] = { 0 }; */
+
+GType
+gst_index_factory_get_type (void)
+{
+  static GType indexfactory_type = 0;
+
+  if (!indexfactory_type) {
+    static const GTypeInfo indexfactory_info = {
+      sizeof (GstIndexFactoryClass),
+      NULL,
+      NULL,
+      (GClassInitFunc) gst_index_factory_class_init,
+      NULL,
+      NULL,
+      sizeof (GstIndexFactory),
+      0,
+      (GInstanceInitFunc) gst_index_factory_init,
+      NULL
+    };
+
+    indexfactory_type = g_type_register_static (GST_TYPE_PLUGIN_FEATURE,
+        "GstIndexFactory", &indexfactory_info, 0);
+  }
+  return indexfactory_type;
+}
+
+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;
+
+  factory_parent_class = g_type_class_ref (GST_TYPE_PLUGIN_FEATURE);
+
+  gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_index_factory_finalize);
+}
+
+static void
+gst_index_factory_init (GstIndexFactory * factory)
+{
+}
+
+static void
+gst_index_factory_finalize (GObject * object)
+{
+  GstIndexFactory *factory = GST_INDEX_FACTORY (object);
+
+  g_free (factory->longdesc);
+
+  G_OBJECT_CLASS (factory_parent_class)->finalize (object);
+
+}
+
+/**
+ * gst_index_factory_new:
+ * @name: name of indexfactory to create
+ * @longdesc: long description of indexfactory to create
+ * @type: the GType of the GstIndex element of this factory
+ *
+ * Create a new indexfactory with the given parameters
+ *
+ * Returns: a new #GstIndexFactory.
+ */
+GstIndexFactory *
+gst_index_factory_new (const gchar * name, const gchar * longdesc, GType type)
+{
+  GstIndexFactory *factory;
+
+  g_return_val_if_fail (name != NULL, NULL);
+  factory = GST_INDEX_FACTORY (g_object_new (GST_TYPE_INDEX_FACTORY, NULL));
+
+  GST_PLUGIN_FEATURE_NAME (factory) = g_strdup (name);
+  if (factory->longdesc)
+    g_free (factory->longdesc);
+  factory->longdesc = g_strdup (longdesc);
+  factory->type = type;
+
+  return factory;
+}
+
+/**
+ * gst_index_factory_destroy:
+ * @factory: factory to destroy
+ *
+ * Removes the index from the global list.
+ */
+void
+gst_index_factory_destroy (GstIndexFactory * factory)
+{
+  g_return_if_fail (factory != NULL);
+
+  /* we don't free the struct bacause someone might  have a handle to it.. */
+}
+
+/**
+ * gst_index_factory_find:
+ * @name: name of indexfactory to find
+ *
+ * Search for an indexfactory of the given name.
+ *
+ * Returns: #GstIndexFactory if found, NULL otherwise
+ */
+GstIndexFactory *
+gst_index_factory_find (const gchar * name)
+{
+  GstPluginFeature *feature;
+
+  g_return_val_if_fail (name != NULL, NULL);
+
+  GST_DEBUG ("gstindex: find \"%s\"", name);
+
+  feature = gst_registry_find_feature (gst_registry_get_default (), name,
+      GST_TYPE_INDEX_FACTORY);
+  if (feature)
+    return GST_INDEX_FACTORY (feature);
+
+  return NULL;
+}
+
+/**
+ * gst_index_factory_create:
+ * @factory: the factory used to create the instance
+ *
+ * Create a new #GstIndex instance from the 
+ * given indexfactory.
+ *
+ * Returns: A new #GstIndex instance.
+ */
+GstIndex *
+gst_index_factory_create (GstIndexFactory * factory)
+{
+  GstIndex *new = NULL;
+
+  g_return_val_if_fail (factory != NULL, NULL);
+
+  factory =
+      GST_INDEX_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE
+          (factory)));
+  if (factory == NULL)
+    return NULL;
+
+  new = GST_INDEX (g_object_new (factory->type, NULL));
+
+  return new;
+}
+
+/**
+ * gst_index_factory_make:
+ * @name: the name of the factory used to create the instance
+ *
+ * Create a new #GstIndex instance from the 
+ * indexfactory with the given name.
+ *
+ * Returns: A new #GstIndex instance.
+ */
+GstIndex *
+gst_index_factory_make (const gchar * name)
+{
+  GstIndexFactory *factory;
+
+  g_return_val_if_fail (name != NULL, NULL);
+
+  factory = gst_index_factory_find (name);
+
+  if (factory == NULL)
+    return NULL;
+
+  return gst_index_factory_create (factory);
+}
diff --git a/gst/gstindexfactory.h b/gst/gstindexfactory.h
new file mode 100644 (file)
index 0000000..0ac9bff
--- /dev/null
@@ -0,0 +1,76 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wim.taymans@chello.be>
+ *
+ * gstindexfactory.h: Header for GstIndexFactory, base class to handle efficient
+ *                    storage or caching of seeking information.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_INDEX_FACTORY_H__
+#define __GST_INDEX_FACTORY_H__
+
+#include <gst/gstobject.h>
+#include <gst/gstformat.h>
+#include <gst/gstpluginfeature.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_INDEX_FACTORY                 (gst_index_factory_get_type())
+#define GST_INDEX_FACTORY(obj)                         (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_INDEX_FACTORY, GstIndexFactory))
+#define GST_IS_INDEX_FACTORY(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_INDEX_FACTORY))
+#define GST_INDEX_FACTORY_CLASS(klass)                 (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_INDEX_FACTORY, GstIndexFactoryClass))
+#define GST_IS_INDEX_FACTORY_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_INDEX_FACTORY))
+#define GST_INDEX_FACTORY_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_INDEX_FACTORY, GstIndexFactoryClass))
+
+typedef struct _GstIndexFactory GstIndexFactory;
+typedef struct _GstIndexFactoryClass GstIndexFactoryClass;
+
+/**
+ * GstIndexFactory:
+ *
+ * The GstIndexFactory object
+ */
+struct _GstIndexFactory {
+  GstPluginFeature feature;
+           
+  gchar *longdesc;            /* long description of the index (well, don't overdo it..) */
+  GType type;                 /* unique GType of the index */
+
+  gpointer _gst_reserved[GST_PADDING];
+};
+
+struct _GstIndexFactoryClass {
+  GstPluginFeatureClass parent; 
+
+  gpointer _gst_reserved[GST_PADDING];
+};
+
+GType                  gst_index_factory_get_type      (void);
+
+GstIndexFactory*       gst_index_factory_new           (const gchar *name, 
+                                                        const gchar *longdesc, GType type);
+void                   gst_index_factory_destroy       (GstIndexFactory *factory);
+
+GstIndexFactory*       gst_index_factory_find          (const gchar *name);
+
+GstIndex*              gst_index_factory_create        (GstIndexFactory *factory);
+GstIndex*              gst_index_factory_make          (const gchar *name);
+
+G_END_DECLS
+
+#endif /* __GST_INDEX_FACTORY_H__ */
index fc6079c..5e8037c 100644 (file)
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+/**
+ * SECTION:gstpluginfeature
+ * @short_description: Base class for contents of a GstPlugin
+ * @see_also: #GstPlugin
+ *
+ * This is a base class for anything that can be added to a #GstPlugin.
+ */
 
 #include "gst_private.h"
 
index 0fa88f7..2b30f19 100644 (file)
@@ -36,12 +36,32 @@ G_BEGIN_DECLS
 #define GST_IS_PLUGIN_FEATURE_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLUGIN_FEATURE))
 #define GST_PLUGIN_FEATURE_GET_CLASS(obj)      (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PLUGIN_FEATURE, GstPluginFeatureClass))
 
+/**
+ * GST_PLUGIN_FEATURE_NAME:
+ * @feature: The feature to query
+ *
+ * Get the name of the feature
+ */
 #define GST_PLUGIN_FEATURE_NAME(feature)  (GST_PLUGIN_FEATURE (feature)->name)
 
 typedef struct _GstPluginFeature GstPluginFeature;
 typedef struct _GstPluginFeatureClass GstPluginFeatureClass;
 
-/* some predefined ranks */
+/**
+ * GstRank:
+ * @GST_RANK_NONE: will be chosen last or not at all
+ * @GST_RANK_MARGINAL: unlikly to be chosen
+ * @GST_RANK_SECONDARY: likely to be chosen
+ * @GST_RANK_PRIMARY: will be chosen first
+ *
+ * Element priority ranks. Defines the order in which the autoplugger (or
+ * similar rank-picking mechanisms) will choose this element over an alternative
+ * one with the same function.
+ *
+ * The rank is a unsigned integer ranging from 0 (GST_RANK_NONE) to 256
+ * (GST_RANK_PRIMARY). These constants serve as a rough guidiance for defining
+ * the rank of a #GstPlugin using gst_plugin_feature_set_rank().
+ */
 typedef enum {
   GST_RANK_NONE                 = 0,
   GST_RANK_MARGINAL             = 64,
@@ -76,7 +96,17 @@ typedef struct {
   GType                 type;
 } GstTypeNameData;
 
-/* filter */
+/**
+ * GstPluginFeatureFilter:
+ * @feature: the pluginfeature to check
+ * @user_data: the user_data that has been passed on e.g.
+ *  gst_registry_feature_filter()
+ *
+ * A function that can be used with e.g. gst_registry_feature_filter()
+ * to get a list of pluginfeature that match certain criteria.
+ *
+ * Returns: %TRUE for a positive match, %FALSE otherwise
+ */
 typedef gboolean        (*GstPluginFeatureFilter)       (GstPluginFeature *feature,
                                                          gpointer user_data);