2 * Copyright (C) 2001 RidgeRun (http://www.ridgerun.com/)
3 * Written by Erik Walthinsen <omega@ridgerun.com>
5 * gstindex.c: Index for mappings and other data
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
25 * @short_description: Generate indexes on objects
26 * @see_also: #GstIndexFactory
28 * GstIndex is used to generate a stream index of one or more elements
31 * Elements will overload the set_index and get_index virtual methods in
32 * #GstElement. When streaming data, the element will add index entries if it
35 * Each element that adds to the index will do that using a writer_id. The
36 * writer_id is obtained from gst_index_get_writer_id().
38 * The application that wants to index the stream will create a new index object
39 * using gst_index_new() or gst_index_factory_make(). The index is assigned to a
40 * specific element, a bin or the whole pipeline. This will cause indexable
41 * elements to add entires to the index while playing.
44 /* FIXME: complete gobject annotations */
45 /* FIXME-0.11: cleanup API
46 * - no one seems to use GstIndexGroup, GstIndexCertainty
48 * - the API for application to use the index is mostly missing
49 * - apps need to get a list of writers
50 * - apps need to be able to iterate over each writers index entry collection
51 * - gst_index_get_assoc_entry() should pass ownership
52 * - the GstIndexEntry structure is large and contains repetitive information
53 * - we want to allow Indexers to implement a saner storage and create
54 * GstIndexEntries on demand (the app has to free them), might even make
55 * sense to ask the app to provide a ptr and fill it.
64 /* Index signals and args */
79 GST_DEBUG_CATEGORY_STATIC (index_debug);
80 #define GST_CAT_DEFAULT index_debug
83 static void gst_index_finalize (GObject * object);
85 static void gst_index_set_property (GObject * object, guint prop_id,
86 const GValue * value, GParamSpec * pspec);
87 static void gst_index_get_property (GObject * object, guint prop_id,
88 GValue * value, GParamSpec * pspec);
90 static GstIndexGroup *gst_index_group_new (guint groupnum);
91 static void gst_index_group_free (GstIndexGroup * group);
93 static gboolean gst_index_path_resolver (GstIndex * index, GstObject * writer,
94 gchar ** writer_string, gpointer data);
95 static gboolean gst_index_gtype_resolver (GstIndex * index, GstObject * writer,
96 gchar ** writer_string, gpointer data);
97 static void gst_index_add_entry (GstIndex * index, GstIndexEntry * entry);
99 static guint gst_index_signals[LAST_SIGNAL] = { 0 };
103 GstIndexResolverMethod method;
104 GstIndexResolver resolver;
109 static const ResolverEntry resolvers[] = {
110 {GST_INDEX_RESOLVER_CUSTOM, NULL, NULL},
111 {GST_INDEX_RESOLVER_GTYPE, gst_index_gtype_resolver, NULL},
112 {GST_INDEX_RESOLVER_PATH, gst_index_path_resolver, NULL},
115 #define GST_TYPE_INDEX_RESOLVER (gst_index_resolver_get_type())
117 gst_index_resolver_get_type (void)
119 static GType index_resolver_type = 0;
120 static const GEnumValue index_resolver[] = {
121 {GST_INDEX_RESOLVER_CUSTOM, "GST_INDEX_RESOLVER_CUSTOM", "custom"},
122 {GST_INDEX_RESOLVER_GTYPE, "GST_INDEX_RESOLVER_GTYPE", "gtype"},
123 {GST_INDEX_RESOLVER_PATH, "GST_INDEX_RESOLVER_PATH", "path"},
127 if (!index_resolver_type) {
128 index_resolver_type =
129 g_enum_register_static ("GstIndexResolver", index_resolver);
131 return index_resolver_type;
135 gst_index_entry_get_type (void)
137 static GType index_entry_type = 0;
139 if (!index_entry_type) {
140 index_entry_type = g_boxed_type_register_static ("GstIndexEntry",
141 (GBoxedCopyFunc) gst_index_entry_copy,
142 (GBoxedFreeFunc) gst_index_entry_free);
144 return index_entry_type;
150 GST_DEBUG_CATEGORY_INIT (index_debug, "GST_INDEX", GST_DEBUG_BOLD, \
151 "Generic indexing support"); \
155 G_DEFINE_TYPE (GstIndex, gst_index, GST_TYPE_OBJECT);
158 gst_index_class_init (GstIndexClass * klass)
160 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
163 * GstIndex::entry-added
164 * @gstindex: the object which received the signal.
165 * @arg1: The entry added to the index.
167 * Is emitted when a new entry is added to the index.
169 gst_index_signals[ENTRY_ADDED] =
170 g_signal_new ("entry-added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
171 G_STRUCT_OFFSET (GstIndexClass, entry_added), NULL, NULL,
172 gst_marshal_VOID__BOXED, G_TYPE_NONE, 1, GST_TYPE_INDEX_ENTRY);
174 gobject_class->set_property = gst_index_set_property;
175 gobject_class->get_property = gst_index_get_property;
176 gobject_class->finalize = gst_index_finalize;
178 g_object_class_install_property (gobject_class, ARG_RESOLVER,
179 g_param_spec_enum ("resolver", "Resolver",
180 "Select a predefined object to string mapper",
181 GST_TYPE_INDEX_RESOLVER, GST_INDEX_RESOLVER_PATH,
182 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
186 gst_index_init (GstIndex * index)
188 index->curgroup = gst_index_group_new (0);
190 index->groups = g_list_prepend (NULL, index->curgroup);
192 index->writers = g_hash_table_new (NULL, NULL);
195 index->method = GST_INDEX_RESOLVER_PATH;
196 index->resolver = resolvers[index->method].resolver;
197 index->resolver_user_data = resolvers[index->method].user_data;
199 GST_OBJECT_FLAG_SET (index, GST_INDEX_WRITABLE);
200 GST_OBJECT_FLAG_SET (index, GST_INDEX_READABLE);
202 GST_DEBUG ("created new index");
206 gst_index_free_writer (gpointer key, gpointer value, gpointer user_data)
208 GstIndexEntry *entry = (GstIndexEntry *) value;
211 gst_index_entry_free (entry);
216 gst_index_finalize (GObject * object)
218 GstIndex *index = GST_INDEX (object);
221 g_list_foreach (index->groups, (GFunc) gst_index_group_free, NULL);
222 g_list_free (index->groups);
223 index->groups = NULL;
226 if (index->writers) {
227 g_hash_table_foreach (index->writers, gst_index_free_writer, NULL);
228 g_hash_table_destroy (index->writers);
229 index->writers = NULL;
232 if (index->filter_user_data && index->filter_user_data_destroy)
233 index->filter_user_data_destroy (index->filter_user_data);
235 if (index->resolver_user_data && index->resolver_user_data_destroy)
236 index->resolver_user_data_destroy (index->resolver_user_data);
238 G_OBJECT_CLASS (gst_index_parent_class)->finalize (object);
242 gst_index_set_property (GObject * object, guint prop_id,
243 const GValue * value, GParamSpec * pspec)
247 index = GST_INDEX (object);
251 index->method = (GstIndexResolverMethod) g_value_get_enum (value);
252 index->resolver = resolvers[index->method].resolver;
253 index->resolver_user_data = resolvers[index->method].user_data;
256 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
262 gst_index_get_property (GObject * object, guint prop_id,
263 GValue * value, GParamSpec * pspec)
267 index = GST_INDEX (object);
271 g_value_set_enum (value, index->method);
274 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
279 static GstIndexGroup *
280 gst_index_group_new (guint groupnum)
282 GstIndexGroup *indexgroup = g_slice_new (GstIndexGroup);
284 indexgroup->groupnum = groupnum;
285 indexgroup->entries = NULL;
286 indexgroup->certainty = GST_INDEX_UNKNOWN;
287 indexgroup->peergroup = -1;
289 GST_DEBUG ("created new index group %d", groupnum);
295 gst_index_group_free (GstIndexGroup * group)
297 g_slice_free (GstIndexGroup, group);
300 /* do not resurrect this, add a derived dummy index class instead */
305 * Create a new dummy index object. Use gst_element_set_index() to assign that
306 * to an element or pipeline. This index is not storing anything, but will
307 * still emit e.g. the #GstIndex::entry-added signal.
309 * Returns: (transfer full): a new index object
316 index = g_object_newv (gst_index_get_type (), 0, NULL);
323 * @index: the index to commit
324 * @id: the writer that commited the index
326 * Tell the index that the writer with the given id is done
327 * with this index and is not going to write any more entries
331 gst_index_commit (GstIndex * index, gint id)
333 GstIndexClass *iclass;
335 iclass = GST_INDEX_GET_CLASS (index);
338 iclass->commit (index, id);
342 * gst_index_get_group:
343 * @index: the index to get the current group from
345 * Get the id of the current group.
347 * Returns: the id of the current group.
350 gst_index_get_group (GstIndex * index)
352 return index->curgroup->groupnum;
356 * gst_index_new_group:
357 * @index: the index to create the new group in
359 * Create a new group for the given index. It will be
360 * set as the current group.
362 * Returns: the id of the newly created group.
365 gst_index_new_group (GstIndex * index)
367 index->curgroup = gst_index_group_new (++index->maxgroup);
368 index->groups = g_list_append (index->groups, index->curgroup);
369 GST_DEBUG ("created new group %d in index", index->maxgroup);
370 return index->maxgroup;
374 * gst_index_set_group:
375 * @index: the index to set the new group in
376 * @groupnum: the groupnumber to set
378 * Set the current groupnumber to the given argument.
380 * Returns: TRUE if the operation succeeded, FALSE if the group
384 gst_index_set_group (GstIndex * index, gint groupnum)
387 GstIndexGroup *indexgroup;
389 /* first check for null change */
390 if (groupnum == index->curgroup->groupnum)
393 /* else search for the proper group */
394 list = index->groups;
396 indexgroup = (GstIndexGroup *) (list->data);
397 list = g_list_next (list);
398 if (indexgroup->groupnum == groupnum) {
399 index->curgroup = indexgroup;
400 GST_DEBUG ("switched to index group %d", indexgroup->groupnum);
405 /* couldn't find the group in question */
406 GST_DEBUG ("couldn't find index group %d", groupnum);
413 * gst_index_set_certainty:
414 * @index: the index to set the certainty on
415 * @certainty: the certainty to set
417 * Set the certainty of the given index.
420 gst_index_set_certainty (GstIndex * index, GstIndexCertainty certainty)
422 index->curgroup->certainty = certainty;
426 * gst_index_get_certainty:
427 * @index: the index to get the certainty of
429 * Get the certainty of the given index.
431 * Returns: the certainty of the index.
434 gst_index_get_certainty (GstIndex * index)
436 return index->curgroup->certainty;
442 * gst_index_set_filter:
443 * @index: the index to register the filter on
444 * @filter: the filter to register
445 * @user_data: data passed to the filter function
447 * Lets the app register a custom filter function so that
448 * it can select what entries should be stored in the index.
451 gst_index_set_filter (GstIndex * index,
452 GstIndexFilter filter, gpointer user_data)
454 g_return_if_fail (GST_IS_INDEX (index));
456 gst_index_set_filter_full (index, filter, user_data, NULL);
460 * gst_index_set_filter_full:
461 * @index: the index to register the filter on
462 * @filter: the filter to register
463 * @user_data: data passed to the filter function
464 * @user_data_destroy: function to call when @user_data is unset
466 * Lets the app register a custom filter function so that
467 * it can select what entries should be stored in the index.
470 gst_index_set_filter_full (GstIndex * index,
471 GstIndexFilter filter, gpointer user_data, GDestroyNotify user_data_destroy)
473 g_return_if_fail (GST_IS_INDEX (index));
475 if (index->filter_user_data && index->filter_user_data_destroy)
476 index->filter_user_data_destroy (index->filter_user_data);
478 index->filter = filter;
479 index->filter_user_data = user_data;
480 index->filter_user_data_destroy = user_data_destroy;
484 * gst_index_set_resolver:
485 * @index: the index to register the resolver on
486 * @resolver: the resolver to register
487 * @user_data: data passed to the resolver function
489 * Lets the app register a custom function to map index
490 * ids to writer descriptions.
493 gst_index_set_resolver (GstIndex * index,
494 GstIndexResolver resolver, gpointer user_data)
496 gst_index_set_resolver_full (index, resolver, user_data, NULL);
500 * gst_index_set_resolver_full:
501 * @index: the index to register the resolver on
502 * @resolver: the resolver to register
503 * @user_data: data passed to the resolver function
504 * @user_data_destroy: destroy function for @user_data
506 * Lets the app register a custom function to map index
507 * ids to writer descriptions.
512 gst_index_set_resolver_full (GstIndex * index, GstIndexResolver resolver,
513 gpointer user_data, GDestroyNotify user_data_destroy)
515 g_return_if_fail (GST_IS_INDEX (index));
517 if (index->resolver_user_data && index->resolver_user_data_destroy)
518 index->resolver_user_data_destroy (index->resolver_user_data);
520 index->resolver = resolver;
521 index->resolver_user_data = user_data;
522 index->resolver_user_data_destroy = user_data_destroy;
523 index->method = GST_INDEX_RESOLVER_CUSTOM;
528 * gst_index_entry_copy:
529 * @entry: the entry to copy
531 * Copies an entry and returns the result.
533 * Free-function: gst_index_entry_free
535 * Returns: (transfer full): a newly allocated #GstIndexEntry.
538 gst_index_entry_copy (GstIndexEntry * entry)
540 GstIndexEntry *new_entry = g_slice_new (GstIndexEntry);
542 memcpy (new_entry, entry, sizeof (GstIndexEntry));
547 * gst_index_entry_free:
548 * @entry: (transfer full): the entry to free
550 * Free the memory used by the given entry.
553 gst_index_entry_free (GstIndexEntry * entry)
555 switch (entry->type) {
556 case GST_INDEX_ENTRY_ID:
557 if (entry->data.id.description) {
558 g_free (entry->data.id.description);
559 entry->data.id.description = NULL;
562 case GST_INDEX_ENTRY_ASSOCIATION:
563 if (entry->data.assoc.assocs) {
564 g_free (entry->data.assoc.assocs);
565 entry->data.assoc.assocs = NULL;
568 case GST_INDEX_ENTRY_OBJECT:
570 case GST_INDEX_ENTRY_FORMAT:
574 g_slice_free (GstIndexEntry, entry);
579 * gst_index_add_format:
580 * @index: the index to add the entry to
581 * @id: the id of the index writer
582 * @format: the format to add to the index
584 * Adds a format entry into the index. This function is
585 * used to map dynamic GstFormat ids to their original
588 * Free-function: gst_index_entry_free
590 * Returns: (transfer full): a pointer to the newly added entry in the index.
593 gst_index_add_format (GstIndex * index, gint id, GstFormat format)
595 GstIndexEntry *entry;
596 const GstFormatDefinition *def;
598 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
599 g_return_val_if_fail (format != 0, NULL);
601 if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
604 entry = g_slice_new (GstIndexEntry);
605 entry->type = GST_INDEX_ENTRY_FORMAT;
607 entry->data.format.format = format;
609 def = gst_format_get_details (format);
610 entry->data.format.key = def->nick;
612 gst_index_add_entry (index, entry);
620 * @index: the index to add the entry to
621 * @id: the id of the index writer
622 * @description: the description of the index writer
624 * Add an id entry into the index.
626 * Returns: a pointer to the newly added entry in the index.
629 gst_index_add_id (GstIndex * index, gint id, gchar * description)
631 GstIndexEntry *entry;
633 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
634 g_return_val_if_fail (description != NULL, NULL);
636 if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
639 entry = g_slice_new (GstIndexEntry);
640 entry->type = GST_INDEX_ENTRY_ID;
642 entry->data.id.description = description;
644 gst_index_add_entry (index, entry);
650 gst_index_path_resolver (GstIndex * index, GstObject * writer,
651 gchar ** writer_string, gpointer data)
653 *writer_string = gst_object_get_path_string (writer);
659 gst_index_gtype_resolver (GstIndex * index, GstObject * writer,
660 gchar ** writer_string, gpointer data)
662 g_return_val_if_fail (writer != NULL, FALSE);
664 if (GST_IS_PAD (writer)) {
665 GstObject *element = gst_object_get_parent (GST_OBJECT (writer));
668 name = gst_object_get_name (writer);
670 *writer_string = g_strdup_printf ("%s.%s",
671 G_OBJECT_TYPE_NAME (element), name);
672 gst_object_unref (element);
674 *writer_string = name;
681 *writer_string = g_strdup (G_OBJECT_TYPE_NAME (writer));
688 * gst_index_get_writer_id:
689 * @index: the index to get a unique write id for
690 * @writer: the GstObject to allocate an id for
691 * @id: a pointer to a gint to hold the id
693 * Before entries can be added to the index, a writer
694 * should obtain a unique id. The methods to add new entries
695 * to the index require this id as an argument.
697 * The application can implement a custom function to map the writer object
698 * to a string. That string will be used to register or look up an id
702 * The caller must not hold @writer's #GST_OBJECT_LOCK, as the default
703 * resolver may call functions that take the object lock as well, and
704 * the lock is not recursive.
707 * Returns: TRUE if the writer would be mapped to an id.
710 gst_index_get_writer_id (GstIndex * index, GstObject * writer, gint * id)
712 gchar *writer_string = NULL;
713 GstIndexEntry *entry;
714 GstIndexClass *iclass;
715 gboolean success = FALSE;
717 g_return_val_if_fail (GST_IS_INDEX (index), FALSE);
718 g_return_val_if_fail (GST_IS_OBJECT (writer), FALSE);
719 g_return_val_if_fail (id, FALSE);
723 /* first try to get a previously cached id */
724 entry = g_hash_table_lookup (index->writers, writer);
727 iclass = GST_INDEX_GET_CLASS (index);
729 /* let the app make a string */
730 if (index->resolver) {
734 index->resolver (index, writer, &writer_string,
735 index->resolver_user_data);
739 g_warning ("no resolver found");
743 /* if the index has a resolver, make it map this string to an id */
744 if (iclass->get_writer_id) {
745 success = iclass->get_writer_id (index, id, writer_string);
747 /* if the index could not resolve, we allocate one ourselves */
749 *id = ++index->last_id;
752 entry = gst_index_add_id (index, *id, writer_string);
754 /* index is probably not writable, make an entry anyway
755 * to keep it in our cache */
756 entry = g_slice_new (GstIndexEntry);
757 entry->type = GST_INDEX_ENTRY_ID;
759 entry->data.id.description = writer_string;
761 g_hash_table_insert (index->writers, writer, entry);
770 gst_index_add_entry (GstIndex * index, GstIndexEntry * entry)
772 GstIndexClass *iclass;
774 iclass = GST_INDEX_GET_CLASS (index);
776 if (iclass->add_entry) {
777 iclass->add_entry (index, entry);
780 g_signal_emit (index, gst_index_signals[ENTRY_ADDED], 0, entry);
784 * gst_index_add_associationv:
785 * @index: the index to add the entry to
786 * @id: the id of the index writer
787 * @flags: optinal flags for this entry
788 * @n: number of associations
789 * @list: list of associations
791 * Associate given format/value pairs with each other.
793 * Returns: a pointer to the newly added entry in the index.
796 gst_index_add_associationv (GstIndex * index, gint id,
797 GstIndexAssociationFlags flags, gint n, const GstIndexAssociation * list)
799 GstIndexEntry *entry;
801 g_return_val_if_fail (n > 0, NULL);
802 g_return_val_if_fail (list != NULL, NULL);
803 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
805 if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
808 entry = g_slice_new (GstIndexEntry);
810 entry->type = GST_INDEX_ENTRY_ASSOCIATION;
812 entry->data.assoc.flags = flags;
813 entry->data.assoc.assocs = g_memdup (list, sizeof (GstIndexAssociation) * n);
814 entry->data.assoc.nassocs = n;
816 gst_index_add_entry (index, entry);
823 * gst_index_add_association:
824 * @index: the index to add the entry to
825 * @id: the id of the index writer
826 * @flags: optinal flags for this entry
827 * @format: the format of the value
829 * @...: other format/value pairs or 0 to end the list
831 * Associate given format/value pairs with each other.
832 * Be sure to pass gint64 values to this functions varargs,
833 * you might want to use a gint64 cast to be sure.
835 * Returns: a pointer to the newly added entry in the index.
838 gst_index_add_association (GstIndex * index, gint id,
839 GstIndexAssociationFlags flags, GstFormat format, gint64 value, ...)
842 GstIndexEntry *entry;
843 GstIndexAssociation *list;
845 GstFormat cur_format;
848 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
849 g_return_val_if_fail (format != 0, NULL);
851 if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
854 array = g_array_new (FALSE, FALSE, sizeof (GstIndexAssociation));
857 GstIndexAssociation a;
862 g_array_append_val (array, a);
865 va_start (args, value);
867 while ((cur_format = va_arg (args, GstFormat))) {
868 GstIndexAssociation a;
870 a.format = cur_format;
871 a.value = va_arg (args, gint64);
873 g_array_append_val (array, a);
878 list = (GstIndexAssociation *) g_array_free (array, FALSE);
880 entry = gst_index_add_associationv (index, id, flags, n_assocs, list);
887 * gst_index_add_object:
888 * @index: the index to add the object to
889 * @id: the id of the index writer
890 * @key: a key for the object
891 * @type: the GType of the object
892 * @object: a pointer to the object to add
894 * Add the given object to the index with the given key.
896 * This function is not yet implemented.
898 * Returns: a pointer to the newly added entry in the index.
901 gst_index_add_object (GstIndex * index, gint id, gchar * key,
902 GType type, gpointer object)
904 if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
912 gst_index_compare_func (gconstpointer a, gconstpointer b, gpointer user_data)
922 * gst_index_get_assoc_entry:
923 * @index: the index to search
924 * @id: the id of the index writer
925 * @method: The lookup method to use
926 * @flags: Flags for the entry
927 * @format: the format of the value
928 * @value: the value to find
930 * Finds the given format/value in the index
932 * Returns: the entry associated with the value or NULL if the
933 * value was not found.
936 gst_index_get_assoc_entry (GstIndex * index, gint id,
937 GstIndexLookupMethod method, GstIndexAssociationFlags flags,
938 GstFormat format, gint64 value)
940 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
945 return gst_index_get_assoc_entry_full (index, id, method, flags, format,
946 value, gst_index_compare_func, NULL);
950 * gst_index_get_assoc_entry_full:
951 * @index: the index to search
952 * @id: the id of the index writer
953 * @method: The lookup method to use
954 * @flags: Flags for the entry
955 * @format: the format of the value
956 * @value: the value to find
957 * @func: the function used to compare entries
958 * @user_data: user data passed to the compare function
960 * Finds the given format/value in the index with the given
961 * compare function and user_data.
963 * Returns: the entry associated with the value or NULL if the
964 * value was not found.
967 gst_index_get_assoc_entry_full (GstIndex * index, gint id,
968 GstIndexLookupMethod method, GstIndexAssociationFlags flags,
969 GstFormat format, gint64 value, GCompareDataFunc func, gpointer user_data)
971 GstIndexClass *iclass;
973 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
978 iclass = GST_INDEX_GET_CLASS (index);
980 if (iclass->get_assoc_entry)
981 return iclass->get_assoc_entry (index, id, method, flags, format, value,
988 * gst_index_entry_assoc_map:
989 * @entry: the index to search
990 * @format: the format of the value the find
991 * @value: a pointer to store the value
993 * Gets alternative formats associated with the indexentry.
995 * Returns: TRUE if there was a value associated with the given
999 gst_index_entry_assoc_map (GstIndexEntry * entry,
1000 GstFormat format, gint64 * value)
1004 g_return_val_if_fail (entry != NULL, FALSE);
1005 g_return_val_if_fail (value != NULL, FALSE);
1007 for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) {
1008 if (GST_INDEX_ASSOC_FORMAT (entry, i) == format) {
1009 *value = GST_INDEX_ASSOC_VALUE (entry, i);