Commit 0838cd0b authored by Stefan Kost's avatar Stefan Kost

more docs inlined, splitted gstindex.{c,h}

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}
parent 77d2059f
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.
......@@ -157,7 +179,7 @@
* 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:
......
......@@ -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">
......@@ -134,7 +133,6 @@
&GstTagSetter;
&GstTypeFind;
&GstTypeFindFactory;
&GstTypes;
&GstUriHandler;
&GstUriType;
&GstUtils;
......
......@@ -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>
......@@ -1889,28 +1904,6 @@ gst_type_find_factory_get_type
</SECTION>
<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>
......
......@@ -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
......
......@@ -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 \
......
......@@ -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>
......
......@@ -73,6 +73,7 @@
#include "gsterror.h"
#include "gstindex.h"
#include "gstindexfactory.h"
#include "gstutils.h"
#include "gstchildproxy.h"
......
......@@ -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>
......
......@@ -19,11 +19,20 @@
* 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);
}
......@@ -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