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., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
25 * @title: GstIndexEntry
26 * @short_description: Generate indexes on objects
27 * @see_also: #GstIndexFactory
29 * #GstIndex is used to generate a stream index of one or more elements
32 * Elements will overload the set_index and get_index virtual methods in
33 * #GstElement. When streaming data, the element will add index entries if it
36 * Each element that adds to the index will do that using a writer_id. The
37 * writer_id is obtained from gst_index_get_writer_id().
39 * The application that wants to index the stream will create a new index object
40 * using gst_index_new() or gst_index_factory_make(). The index is assigned to a
41 * specific element, a bin or the whole pipeline. This will cause indexable
42 * elements to add entires to the index while playing.
45 /* FIXME: complete gobject annotations */
46 /* FIXME-0.11: cleanup API
47 * - no one seems to use GstIndexGroup, GstIndexCertainty
49 * - the API for application to use the index is mostly missing
50 * - apps need to get a list of writers
51 * - apps need to be able to iterate over each writers index entry collection
52 * - gst_index_get_assoc_entry() should pass ownership
53 * - the GstIndexEntry structure is large and contains repetitive information
54 * - we want to allow Indexers to implement a saner storage and create
55 * GstIndexEntries on demand (the app has to free them), might even make
56 * sense to ask the app to provide a ptr and fill it.
65 /* Index signals and args */
80 GST_DEBUG_CATEGORY_STATIC (index_debug);
81 #define GST_CAT_DEFAULT index_debug
84 static void gst_index_finalize (GObject * object);
86 static void gst_index_set_property (GObject * object, guint prop_id,
87 const GValue * value, GParamSpec * pspec);
88 static void gst_index_get_property (GObject * object, guint prop_id,
89 GValue * value, GParamSpec * pspec);
91 static GstIndexGroup *gst_index_group_new (guint groupnum);
92 static void gst_index_group_free (GstIndexGroup * group);
94 static gboolean gst_index_path_resolver (GstIndex * index, GstObject * writer,
95 gchar ** writer_string, gpointer data);
96 static gboolean gst_index_gtype_resolver (GstIndex * index, GstObject * writer,
97 gchar ** writer_string, gpointer data);
98 static void gst_index_add_entry (GstIndex * index, GstIndexEntry * entry);
100 static guint gst_index_signals[LAST_SIGNAL] = { 0 };
104 GstIndexResolverMethod method;
105 GstIndexResolver resolver;
110 static const ResolverEntry resolvers[] = {
111 {GST_INDEX_RESOLVER_CUSTOM, NULL, NULL},
112 {GST_INDEX_RESOLVER_GTYPE, gst_index_gtype_resolver, NULL},
113 {GST_INDEX_RESOLVER_PATH, gst_index_path_resolver, NULL},
116 #define GST_TYPE_INDEX_RESOLVER (gst_index_resolver_get_type())
118 gst_index_resolver_get_type (void)
120 static GType index_resolver_type = 0;
121 static const GEnumValue index_resolver[] = {
122 {GST_INDEX_RESOLVER_CUSTOM, "GST_INDEX_RESOLVER_CUSTOM", "custom"},
123 {GST_INDEX_RESOLVER_GTYPE, "GST_INDEX_RESOLVER_GTYPE", "gtype"},
124 {GST_INDEX_RESOLVER_PATH, "GST_INDEX_RESOLVER_PATH", "path"},
128 if (!index_resolver_type) {
129 index_resolver_type =
130 g_enum_register_static ("GstIndexResolver", index_resolver);
132 return index_resolver_type;
135 G_DEFINE_BOXED_TYPE (GstIndexEntry, gst_index_entry,
136 (GBoxedCopyFunc) gst_index_entry_copy,
137 (GBoxedFreeFunc) gst_index_entry_free);
142 GST_DEBUG_CATEGORY_INIT (index_debug, "GST_INDEX", GST_DEBUG_BOLD, \
143 "Generic indexing support"); \
147 G_DEFINE_TYPE (GstIndex, gst_index, GST_TYPE_OBJECT);
150 gst_index_class_init (GstIndexClass * klass)
152 GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
155 * GstIndex::entry-added
156 * @gstindex: the object which received the signal.
157 * @arg1: The entry added to the index.
159 * Is emitted when a new entry is added to the index.
161 gst_index_signals[ENTRY_ADDED] =
162 g_signal_new ("entry-added", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
163 G_STRUCT_OFFSET (GstIndexClass, entry_added), NULL, NULL,
164 g_cclosure_marshal_generic, G_TYPE_NONE, 1, GST_TYPE_INDEX_ENTRY);
166 gobject_class->set_property = gst_index_set_property;
167 gobject_class->get_property = gst_index_get_property;
168 gobject_class->finalize = gst_index_finalize;
170 g_object_class_install_property (gobject_class, ARG_RESOLVER,
171 g_param_spec_enum ("resolver", "Resolver",
172 "Select a predefined object to string mapper",
173 GST_TYPE_INDEX_RESOLVER, GST_INDEX_RESOLVER_PATH,
174 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
178 gst_index_init (GstIndex * index)
180 index->curgroup = gst_index_group_new (0);
182 index->groups = g_list_prepend (NULL, index->curgroup);
184 index->writers = g_hash_table_new (NULL, NULL);
187 index->method = GST_INDEX_RESOLVER_PATH;
188 index->resolver = resolvers[index->method].resolver;
189 index->resolver_user_data = resolvers[index->method].user_data;
191 GST_OBJECT_FLAG_SET (index, GST_INDEX_WRITABLE);
192 GST_OBJECT_FLAG_SET (index, GST_INDEX_READABLE);
194 GST_DEBUG ("created new index");
198 gst_index_free_writer (gpointer key, gpointer value, gpointer user_data)
200 GstIndexEntry *entry = (GstIndexEntry *) value;
203 gst_index_entry_free (entry);
208 gst_index_finalize (GObject * object)
210 GstIndex *index = GST_INDEX (object);
213 g_list_foreach (index->groups, (GFunc) gst_index_group_free, NULL);
214 g_list_free (index->groups);
215 index->groups = NULL;
218 if (index->writers) {
219 g_hash_table_foreach (index->writers, gst_index_free_writer, NULL);
220 g_hash_table_destroy (index->writers);
221 index->writers = NULL;
224 if (index->filter_user_data && index->filter_user_data_destroy)
225 index->filter_user_data_destroy (index->filter_user_data);
227 if (index->resolver_user_data && index->resolver_user_data_destroy)
228 index->resolver_user_data_destroy (index->resolver_user_data);
230 G_OBJECT_CLASS (gst_index_parent_class)->finalize (object);
234 gst_index_set_property (GObject * object, guint prop_id,
235 const GValue * value, GParamSpec * pspec)
239 index = GST_INDEX (object);
243 index->method = (GstIndexResolverMethod) g_value_get_enum (value);
244 index->resolver = resolvers[index->method].resolver;
245 index->resolver_user_data = resolvers[index->method].user_data;
248 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
254 gst_index_get_property (GObject * object, guint prop_id,
255 GValue * value, GParamSpec * pspec)
259 index = GST_INDEX (object);
263 g_value_set_enum (value, index->method);
266 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
271 static GstIndexGroup *
272 gst_index_group_new (guint groupnum)
274 GstIndexGroup *indexgroup = g_slice_new (GstIndexGroup);
276 indexgroup->groupnum = groupnum;
277 indexgroup->entries = NULL;
278 indexgroup->certainty = GST_INDEX_UNKNOWN;
279 indexgroup->peergroup = -1;
281 GST_DEBUG ("created new index group %d", groupnum);
287 gst_index_group_free (GstIndexGroup * group)
289 g_slice_free (GstIndexGroup, group);
292 /* do not resurrect this, add a derived dummy index class instead */
297 * Create a new dummy index object. Use gst_element_set_index() to assign that
298 * to an element or pipeline. This index is not storing anything, but will
299 * still emit e.g. the #GstIndex::entry-added signal.
301 * Returns: (transfer full): a new index object
308 index = g_object_new (gst_index_get_type (), NULL);
315 * @index: the index to commit
316 * @id: the writer that committed the index
318 * Tell the index that the writer with the given id is done
319 * with this index and is not going to write any more entries
323 gst_index_commit (GstIndex * index, gint id)
325 GstIndexClass *iclass;
327 iclass = GST_INDEX_GET_CLASS (index);
330 iclass->commit (index, id);
334 * gst_index_get_group:
335 * @index: the index to get the current group from
337 * Get the id of the current group.
339 * Returns: the id of the current group.
342 gst_index_get_group (GstIndex * index)
344 return index->curgroup->groupnum;
348 * gst_index_new_group:
349 * @index: the index to create the new group in
351 * Create a new group for the given index. It will be
352 * set as the current group.
354 * Returns: the id of the newly created group.
357 gst_index_new_group (GstIndex * index)
359 index->curgroup = gst_index_group_new (++index->maxgroup);
360 index->groups = g_list_append (index->groups, index->curgroup);
361 GST_DEBUG ("created new group %d in index", index->maxgroup);
362 return index->maxgroup;
366 * gst_index_set_group:
367 * @index: the index to set the new group in
368 * @groupnum: the groupnumber to set
370 * Set the current groupnumber to the given argument.
372 * Returns: %TRUE if the operation succeeded, %FALSE if the group
376 gst_index_set_group (GstIndex * index, gint groupnum)
379 GstIndexGroup *indexgroup;
381 /* first check for null change */
382 if (groupnum == index->curgroup->groupnum)
385 /* else search for the proper group */
386 list = index->groups;
388 indexgroup = (GstIndexGroup *) (list->data);
389 list = g_list_next (list);
390 if (indexgroup->groupnum == groupnum) {
391 index->curgroup = indexgroup;
392 GST_DEBUG ("switched to index group %d", indexgroup->groupnum);
397 /* couldn't find the group in question */
398 GST_DEBUG ("couldn't find index group %d", groupnum);
405 * gst_index_set_certainty:
406 * @index: the index to set the certainty on
407 * @certainty: the certainty to set
409 * Set the certainty of the given index.
412 gst_index_set_certainty (GstIndex * index, GstIndexCertainty certainty)
414 index->curgroup->certainty = certainty;
418 * gst_index_get_certainty:
419 * @index: the index to get the certainty of
421 * Get the certainty of the given index.
423 * Returns: the certainty of the index.
426 gst_index_get_certainty (GstIndex * index)
428 return index->curgroup->certainty;
434 * gst_index_set_filter:
435 * @index: the index to register the filter on
436 * @filter: the filter to register
437 * @user_data: data passed to the filter function
439 * Lets the app register a custom filter function so that
440 * it can select what entries should be stored in the index.
443 gst_index_set_filter (GstIndex * index,
444 GstIndexFilter filter, gpointer user_data)
446 g_return_if_fail (GST_IS_INDEX (index));
448 gst_index_set_filter_full (index, filter, user_data, NULL);
452 * gst_index_set_filter_full:
453 * @index: the index to register the filter on
454 * @filter: the filter to register
455 * @user_data: data passed to the filter function
456 * @user_data_destroy: function to call when @user_data is unset
458 * Lets the app register a custom filter function so that
459 * it can select what entries should be stored in the index.
462 gst_index_set_filter_full (GstIndex * index,
463 GstIndexFilter filter, gpointer user_data, GDestroyNotify user_data_destroy)
465 g_return_if_fail (GST_IS_INDEX (index));
467 if (index->filter_user_data && index->filter_user_data_destroy)
468 index->filter_user_data_destroy (index->filter_user_data);
470 index->filter = filter;
471 index->filter_user_data = user_data;
472 index->filter_user_data_destroy = user_data_destroy;
476 * gst_index_set_resolver:
477 * @index: the index to register the resolver on
478 * @resolver: the resolver to register
479 * @user_data: data passed to the resolver function
481 * Lets the app register a custom function to map index
482 * ids to writer descriptions.
485 gst_index_set_resolver (GstIndex * index,
486 GstIndexResolver resolver, gpointer user_data)
488 gst_index_set_resolver_full (index, resolver, user_data, NULL);
492 * gst_index_set_resolver_full:
493 * @index: the index to register the resolver on
494 * @resolver: the resolver to register
495 * @user_data: data passed to the resolver function
496 * @user_data_destroy: destroy function for @user_data
498 * Lets the app register a custom function to map index
499 * ids to writer descriptions.
502 gst_index_set_resolver_full (GstIndex * index, GstIndexResolver resolver,
503 gpointer user_data, GDestroyNotify user_data_destroy)
505 g_return_if_fail (GST_IS_INDEX (index));
507 if (index->resolver_user_data && index->resolver_user_data_destroy)
508 index->resolver_user_data_destroy (index->resolver_user_data);
510 index->resolver = resolver;
511 index->resolver_user_data = user_data;
512 index->resolver_user_data_destroy = user_data_destroy;
513 index->method = GST_INDEX_RESOLVER_CUSTOM;
518 * gst_index_entry_copy:
519 * @entry: the entry to copy
521 * Copies an entry and returns the result.
523 * Free-function: gst_index_entry_free
525 * Returns: (transfer full): a newly allocated #GstIndexEntry.
528 gst_index_entry_copy (GstIndexEntry * entry)
530 GstIndexEntry *new_entry = g_slice_new (GstIndexEntry);
532 memcpy (new_entry, entry, sizeof (GstIndexEntry));
537 * gst_index_entry_free:
538 * @entry: (transfer full): the entry to free
540 * Free the memory used by the given entry.
543 gst_index_entry_free (GstIndexEntry * entry)
545 switch (entry->type) {
546 case GST_INDEX_ENTRY_ID:
547 if (entry->data.id.description) {
548 g_free (entry->data.id.description);
549 entry->data.id.description = NULL;
552 case GST_INDEX_ENTRY_ASSOCIATION:
553 if (entry->data.assoc.assocs) {
554 g_free (entry->data.assoc.assocs);
555 entry->data.assoc.assocs = NULL;
558 case GST_INDEX_ENTRY_OBJECT:
560 case GST_INDEX_ENTRY_FORMAT:
564 g_slice_free (GstIndexEntry, entry);
569 * gst_index_add_format:
570 * @index: the index to add the entry to
571 * @id: the id of the index writer
572 * @format: the format to add to the index
574 * Adds a format entry into the index. This function is
575 * used to map dynamic #GstFormat ids to their original
578 * Free-function: gst_index_entry_free
580 * Returns: (transfer full): a pointer to the newly added entry in the index.
583 gst_index_add_format (GstIndex * index, gint id, GstFormat format)
585 GstIndexEntry *entry;
586 const GstFormatDefinition *def;
588 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
589 g_return_val_if_fail (format != 0, NULL);
591 if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
594 entry = g_slice_new (GstIndexEntry);
595 entry->type = GST_INDEX_ENTRY_FORMAT;
597 entry->data.format.format = format;
599 def = gst_format_get_details (format);
600 entry->data.format.key = def->nick;
602 gst_index_add_entry (index, entry);
610 * @index: the index to add the entry to
611 * @id: the id of the index writer
612 * @description: the description of the index writer
614 * Add an id entry into the index.
616 * Returns: a pointer to the newly added entry in the index.
619 gst_index_add_id (GstIndex * index, gint id, gchar * description)
621 GstIndexEntry *entry;
623 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
624 g_return_val_if_fail (description != NULL, NULL);
626 if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
629 entry = g_slice_new (GstIndexEntry);
630 entry->type = GST_INDEX_ENTRY_ID;
632 entry->data.id.description = description;
634 gst_index_add_entry (index, entry);
640 gst_index_path_resolver (GstIndex * index, GstObject * writer,
641 gchar ** writer_string, gpointer data)
643 *writer_string = gst_object_get_path_string (writer);
649 gst_index_gtype_resolver (GstIndex * index, GstObject * writer,
650 gchar ** writer_string, gpointer data)
652 g_return_val_if_fail (writer != NULL, FALSE);
654 if (GST_IS_PAD (writer)) {
655 GstObject *element = gst_object_get_parent (GST_OBJECT (writer));
658 name = gst_object_get_name (writer);
660 *writer_string = g_strdup_printf ("%s.%s",
661 G_OBJECT_TYPE_NAME (element), name);
662 gst_object_unref (element);
664 *writer_string = name;
671 *writer_string = g_strdup (G_OBJECT_TYPE_NAME (writer));
678 * gst_index_get_writer_id:
679 * @index: the index to get a unique write id for
680 * @writer: the #GstObject to allocate an id for
681 * @id: a pointer to a gint to hold the id
683 * Before entries can be added to the index, a writer
684 * should obtain a unique id. The methods to add new entries
685 * to the index require this id as an argument.
687 * The application can implement a custom function to map the writer object
688 * to a string. That string will be used to register or look up an id
691 * > The caller must not hold @writer's GST_OBJECT_LOCK(), as the default
692 * > resolver may call functions that take the object lock as well, and
693 * > the lock is not recursive.
695 * Returns: %TRUE if the writer would be mapped to an id.
698 gst_index_get_writer_id (GstIndex * index, GstObject * writer, gint * id)
700 gchar *writer_string = NULL;
701 GstIndexEntry *entry;
702 GstIndexClass *iclass;
703 gboolean success = FALSE;
705 g_return_val_if_fail (GST_IS_INDEX (index), FALSE);
706 g_return_val_if_fail (GST_IS_OBJECT (writer), FALSE);
707 g_return_val_if_fail (id, FALSE);
711 /* first try to get a previously cached id */
712 entry = g_hash_table_lookup (index->writers, writer);
715 iclass = GST_INDEX_GET_CLASS (index);
717 /* let the app make a string */
718 if (index->resolver) {
722 index->resolver (index, writer, &writer_string,
723 index->resolver_user_data);
727 g_warning ("no resolver found");
731 /* if the index has a resolver, make it map this string to an id */
732 if (iclass->get_writer_id) {
733 success = iclass->get_writer_id (index, id, writer_string);
735 /* if the index could not resolve, we allocate one ourselves */
737 *id = ++index->last_id;
740 entry = gst_index_add_id (index, *id, writer_string);
742 /* index is probably not writable, make an entry anyway
743 * to keep it in our cache */
744 entry = g_slice_new (GstIndexEntry);
745 entry->type = GST_INDEX_ENTRY_ID;
747 entry->data.id.description = writer_string;
749 g_hash_table_insert (index->writers, writer, entry);
758 gst_index_add_entry (GstIndex * index, GstIndexEntry * entry)
760 GstIndexClass *iclass;
762 iclass = GST_INDEX_GET_CLASS (index);
764 if (iclass->add_entry) {
765 iclass->add_entry (index, entry);
768 g_signal_emit (index, gst_index_signals[ENTRY_ADDED], 0, entry);
772 * gst_index_add_associationv:
773 * @index: the index to add the entry to
774 * @id: the id of the index writer
775 * @flags: optional flags for this entry
776 * @n: number of associations
777 * @list: (array length=n): list of associations
779 * Associate given format/value pairs with each other.
781 * Returns: a pointer to the newly added entry in the index.
784 gst_index_add_associationv (GstIndex * index, gint id,
785 GstIndexAssociationFlags flags, gint n, const GstIndexAssociation * list)
787 GstIndexEntry *entry;
789 g_return_val_if_fail (n > 0, NULL);
790 g_return_val_if_fail (list != NULL, NULL);
791 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
793 if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
796 entry = g_slice_new (GstIndexEntry);
798 entry->type = GST_INDEX_ENTRY_ASSOCIATION;
800 entry->data.assoc.flags = flags;
801 entry->data.assoc.assocs = g_memdup (list, sizeof (GstIndexAssociation) * n);
802 entry->data.assoc.nassocs = n;
804 gst_index_add_entry (index, entry);
811 * gst_index_add_association:
812 * @index: the index to add the entry to
813 * @id: the id of the index writer
814 * @flags: optional flags for this entry
815 * @format: the format of the value
817 * @...: other format/value pairs or 0 to end the list
819 * Associate given format/value pairs with each other.
820 * Be sure to pass gint64 values to this functions varargs,
821 * you might want to use a gint64 cast to be sure.
823 * Returns: a pointer to the newly added entry in the index.
826 gst_index_add_association (GstIndex * index, gint id,
827 GstIndexAssociationFlags flags, GstFormat format, gint64 value, ...)
830 GstIndexEntry *entry;
831 GstIndexAssociation *list;
833 GstFormat cur_format;
836 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
837 g_return_val_if_fail (format != 0, NULL);
839 if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
842 array = g_array_new (FALSE, FALSE, sizeof (GstIndexAssociation));
845 GstIndexAssociation a;
850 g_array_append_val (array, a);
853 va_start (args, value);
855 while ((cur_format = va_arg (args, GstFormat))) {
856 GstIndexAssociation a;
858 a.format = cur_format;
859 a.value = va_arg (args, gint64);
861 g_array_append_val (array, a);
866 list = (GstIndexAssociation *) g_array_free (array, FALSE);
868 entry = gst_index_add_associationv (index, id, flags, n_assocs, list);
875 * gst_index_add_object:
876 * @index: the index to add the object to
877 * @id: the id of the index writer
878 * @key: a key for the object
879 * @type: the GType of the object
880 * @object: a pointer to the object to add
882 * Add the given object to the index with the given key.
884 * This function is not yet implemented.
886 * Returns: a pointer to the newly added entry in the index.
889 gst_index_add_object (GstIndex * index, gint id, gchar * key,
890 GType type, gpointer object)
892 if (!GST_INDEX_IS_WRITABLE (index) || id == -1)
900 gst_index_compare_func (gconstpointer a, gconstpointer b, gpointer user_data)
910 * gst_index_get_assoc_entry:
911 * @index: the index to search
912 * @id: the id of the index writer
913 * @method: The lookup method to use
914 * @flags: Flags for the entry
915 * @format: the format of the value
916 * @value: the value to find
918 * Finds the given format/value in the index
920 * Returns: (nullable): the entry associated with the value or %NULL if the
921 * value was not found.
924 gst_index_get_assoc_entry (GstIndex * index, gint id,
925 GstIndexLookupMethod method, GstIndexAssociationFlags flags,
926 GstFormat format, gint64 value)
928 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
933 return gst_index_get_assoc_entry_full (index, id, method, flags, format,
934 value, gst_index_compare_func, NULL);
938 * gst_index_get_assoc_entry_full:
939 * @index: the index to search
940 * @id: the id of the index writer
941 * @method: The lookup method to use
942 * @flags: Flags for the entry
943 * @format: the format of the value
944 * @value: the value to find
945 * @func: the function used to compare entries
946 * @user_data: user data passed to the compare function
948 * Finds the given format/value in the index with the given
949 * compare function and user_data.
951 * Returns: (nullable): the entry associated with the value or %NULL if the
952 * value was not found.
955 gst_index_get_assoc_entry_full (GstIndex * index, gint id,
956 GstIndexLookupMethod method, GstIndexAssociationFlags flags,
957 GstFormat format, gint64 value, GCompareDataFunc func, gpointer user_data)
959 GstIndexClass *iclass;
961 g_return_val_if_fail (GST_IS_INDEX (index), NULL);
966 iclass = GST_INDEX_GET_CLASS (index);
968 if (iclass->get_assoc_entry)
969 return iclass->get_assoc_entry (index, id, method, flags, format, value,
976 * gst_index_entry_assoc_map:
977 * @entry: the index to search
978 * @format: the format of the value the find
979 * @value: a pointer to store the value
981 * Gets alternative formats associated with the indexentry.
983 * Returns: %TRUE if there was a value associated with the given
987 gst_index_entry_assoc_map (GstIndexEntry * entry,
988 GstFormat format, gint64 * value)
992 g_return_val_if_fail (entry != NULL, FALSE);
993 g_return_val_if_fail (value != NULL, FALSE);
995 for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) {
996 if (GST_INDEX_ASSOC_FORMAT (entry, i) == format) {
997 *value = GST_INDEX_ASSOC_VALUE (entry, i);