g_type_init() is no longer required and deprecated in glib >= 2.35.0
[platform/upstream/gstreamer.git] / gst / gsttoc.c
1 /* GStreamer
2  * (c) 2010, 2012 Alexander Saprykin <xelfium@gmail.com>
3  *
4  * gsttoc.c: GstToc initialization and parsing/creation
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 /**
23  * SECTION:gsttoc
24  * @short_description: Generic table of contents support
25  * @see_also: #GstStructure, #GstEvent, #GstMessage, #GstQuery
26  *
27  * #GstToc functions are used to create/free #GstToc and #GstTocEntry structures.
28  * Also they are used to convert #GstToc into #GstStructure and vice versa.
29  *
30  * #GstToc lets you to inform other elements in pipeline or application that playing
31  * source has some kind of table of contents (TOC). These may be chapters, editions,
32  * angles or other types. For example: DVD chapters, Matroska chapters or cue sheet
33  * TOC. Such TOC will be useful for applications to display instead of just a
34  * playlist.
35  *
36  * Using TOC is very easy. Firstly, create #GstToc structure which represents root
37  * contents of the source. You can also attach TOC-specific tags to it. Then fill
38  * it with #GstTocEntry entries by appending them to the #GstToc using
39  * gst_toc_append_entry(), and appending subentries to a #GstTocEntry using
40  * gst_toc_entry_append_sub_entry().
41  *
42  * Note that root level of the TOC can contain only either editions or chapters. You
43  * should not mix them together at the same level. Otherwise you will get serialization
44  * /deserialization errors. Make sure that no one of the entries has negative start and
45  *  stop values.
46  *
47  * Use gst_event_new_toc() to create a new TOC #GstEvent, and gst_event_parse_toc() to
48  * parse received TOC event. Use gst_event_new_toc_select() to create a new TOC select #GstEvent,
49  * and gst_event_parse_toc_select() to parse received TOC select event. The same rule for
50  * the #GstMessage: gst_message_new_toc() to create new TOC #GstMessage, and
51  * gst_message_parse_toc() to parse received TOC message.
52  *
53  * TOCs can have global scope or current scope. Global scope TOCs contain
54  * all entries that can possibly be selected using a toc select event, and
55  * are what an application is usually interested in. TOCs with current scope
56  * only contain the parts of the TOC relevant to the currently selected/playing
57  * stream; the current scope TOC is used by downstream elements such as muxers
58  * to write correct TOC entries when transcoding files, for example. When
59  * playing a DVD, the global TOC would contain a hierarchy of all titles,
60  * chapters and angles, for example, while the current TOC would only contain
61  * the chapters for the currently playing title if playback of a specific
62  * title was requested.
63  */
64
65 #ifdef HAVE_CONFIG_H
66 #  include "config.h"
67 #endif
68
69 #include "gst_private.h"
70 #include "gstenumtypes.h"
71 #include "gsttaglist.h"
72 #include "gststructure.h"
73 #include "gstvalue.h"
74 #include "gsttoc.h"
75 #include "gstpad.h"
76 #include "gstquark.h"
77
78 struct _GstTocEntry
79 {
80   GstMiniObject mini_object;
81
82   GstToc *toc;
83   GstTocEntry *parent;
84
85   gchar *uid;
86   GstTocEntryType type;
87   GstClockTime start, stop;
88   GList *subentries;
89   GstTagList *tags;
90 };
91
92 struct _GstToc
93 {
94   GstMiniObject mini_object;
95
96   GstTocScope scope;
97   GList *entries;
98   GstTagList *tags;
99 };
100
101 #undef gst_toc_copy
102 static GstToc *gst_toc_copy (const GstToc * toc);
103 static void gst_toc_free (GstToc * toc);
104 #undef gst_toc_entry_copy
105 static GstTocEntry *gst_toc_entry_copy (const GstTocEntry * toc);
106 static void gst_toc_entry_free (GstTocEntry * toc);
107
108 GST_DEFINE_MINI_OBJECT_TYPE (GstToc, gst_toc);
109 GST_DEFINE_MINI_OBJECT_TYPE (GstTocEntry, gst_toc_entry);
110
111 /**
112  * gst_toc_new:
113  * @scope: scope of this TOC
114  *
115  * Create a new #GstToc structure.
116  *
117  * Returns: (transfer full): newly allocated #GstToc structure, free it
118  *     with gst_toc_unref().
119  */
120 GstToc *
121 gst_toc_new (GstTocScope scope)
122 {
123   GstToc *toc;
124
125   g_return_val_if_fail (scope == GST_TOC_SCOPE_GLOBAL ||
126       scope == GST_TOC_SCOPE_CURRENT, NULL);
127
128   toc = g_slice_new0 (GstToc);
129
130   gst_mini_object_init (GST_MINI_OBJECT_CAST (toc), 0, GST_TYPE_TOC,
131       (GstMiniObjectCopyFunction) gst_toc_copy, NULL,
132       (GstMiniObjectFreeFunction) gst_toc_free);
133
134   toc->scope = scope;
135   toc->tags = gst_tag_list_new_empty ();
136
137   return toc;
138 }
139
140 /**
141  * gst_toc_get_scope:
142  * @toc: a #GstToc instance
143  *
144  * Returns: scope of @toc
145  */
146 GstTocScope
147 gst_toc_get_scope (const GstToc * toc)
148 {
149   g_return_val_if_fail (toc != NULL, GST_TOC_SCOPE_GLOBAL);
150
151   return toc->scope;
152 }
153
154 /**
155  * gst_toc_set_tags:
156  * @toc: A #GstToc instance
157  * @tags: (allow-none) (transfer full): A #GstTagList or %NULL
158  *
159  * Set a #GstTagList with tags for the complete @toc.
160  */
161 void
162 gst_toc_set_tags (GstToc * toc, GstTagList * tags)
163 {
164   g_return_if_fail (toc != NULL);
165   g_return_if_fail (gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (toc)));
166
167   if (toc->tags)
168     gst_tag_list_unref (toc->tags);
169   toc->tags = tags;
170 }
171
172 /**
173  * gst_toc_merge_tags:
174  * @toc: A #GstToc instance
175  * @tags: (allow-none): A #GstTagList or %NULL
176  * @mode: A #GstTagMergeMode
177  *
178  * Merge @tags into the existing tags of @toc using @mode.
179  */
180 void
181 gst_toc_merge_tags (GstToc * toc, GstTagList * tags, GstTagMergeMode mode)
182 {
183   g_return_if_fail (toc != NULL);
184   g_return_if_fail (gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (toc)));
185
186   if (!toc->tags) {
187     toc->tags = gst_tag_list_ref (tags);
188   } else {
189     GstTagList *tmp = gst_tag_list_merge (toc->tags, tags, mode);
190     gst_tag_list_unref (toc->tags);
191     toc->tags = tmp;
192   }
193 }
194
195 /**
196  * gst_toc_get_tags:
197  * @toc: A #GstToc instance
198  *
199  * Gets the tags for @toc.
200  *
201  * Returns: (transfer none): A #GstTagList for @entry
202  */
203 GstTagList *
204 gst_toc_get_tags (const GstToc * toc)
205 {
206   g_return_val_if_fail (toc != NULL, NULL);
207
208   return toc->tags;
209 }
210
211 /**
212  * gst_toc_append_entry:
213  * @toc: A #GstToc instance
214  * @entry: (transfer full): A #GstTocEntry
215  *
216  * Appends the #GstTocEntry @entry to @toc.
217  */
218 void
219 gst_toc_append_entry (GstToc * toc, GstTocEntry * entry)
220 {
221   g_return_if_fail (toc != NULL);
222   g_return_if_fail (gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (toc)));
223   g_return_if_fail (gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (entry)));
224   g_return_if_fail (entry->toc == NULL);
225   g_return_if_fail (entry->parent == NULL);
226
227   toc->entries = g_list_append (toc->entries, entry);
228   entry->toc = toc;
229
230   GST_LOG ("appended %s entry with uid %s to toc %p",
231       gst_toc_entry_type_get_nick (entry->type), entry->uid, toc);
232
233   gst_toc_dump (toc);
234 }
235
236 /**
237  * gst_toc_get_entries:
238  * @toc: A #GstToc instance
239  *
240  * Gets the list of #GstTocEntry of @toc.
241  *
242  * Returns: (transfer none) (element-type Gst.TocEntry): A #GList of #GstTocEntry for @entry
243  */
244 GList *
245 gst_toc_get_entries (const GstToc * toc)
246 {
247   g_return_val_if_fail (toc != NULL, NULL);
248
249   return toc->entries;
250 }
251
252 static GstTocEntry *
253 gst_toc_entry_new_internal (GstTocEntryType type, const gchar * uid)
254 {
255   GstTocEntry *entry;
256
257   entry = g_slice_new0 (GstTocEntry);
258
259   gst_mini_object_init (GST_MINI_OBJECT_CAST (entry), 0, GST_TYPE_TOC_ENTRY,
260       (GstMiniObjectCopyFunction) gst_toc_entry_copy, NULL,
261       (GstMiniObjectFreeFunction) gst_toc_entry_free);
262
263   entry->uid = g_strdup (uid);
264   entry->type = type;
265   entry->tags = NULL;
266   entry->start = entry->stop = GST_CLOCK_TIME_NONE;
267
268   return entry;
269 }
270
271 /**
272  * gst_toc_entry_new:
273  * @type: entry type.
274  * @uid: unique ID (UID) in the whole TOC.
275  *
276  * Create new #GstTocEntry structure.
277  *
278  * Returns: newly allocated #GstTocEntry structure, free it with gst_toc_entry_unref().
279  */
280 GstTocEntry *
281 gst_toc_entry_new (GstTocEntryType type, const gchar * uid)
282 {
283   g_return_val_if_fail (uid != NULL, NULL);
284
285   return gst_toc_entry_new_internal (type, uid);
286 }
287
288 static void
289 gst_toc_free (GstToc * toc)
290 {
291   g_list_foreach (toc->entries, (GFunc) gst_mini_object_unref, NULL);
292   g_list_free (toc->entries);
293
294   if (toc->tags != NULL)
295     gst_tag_list_unref (toc->tags);
296
297   g_slice_free (GstToc, toc);
298 }
299
300 static void
301 gst_toc_entry_free (GstTocEntry * entry)
302 {
303   g_return_if_fail (entry != NULL);
304
305   g_list_foreach (entry->subentries, (GFunc) gst_mini_object_unref, NULL);
306   g_list_free (entry->subentries);
307
308   g_free (entry->uid);
309
310   if (entry->tags != NULL)
311     gst_tag_list_unref (entry->tags);
312
313   g_slice_free (GstTocEntry, entry);
314 }
315
316 static GstTocEntry *
317 gst_toc_entry_find_sub_entry (const GstTocEntry * entry, const gchar * uid)
318 {
319   GList *cur;
320   GstTocEntry *subentry, *subsubentry;
321
322   g_return_val_if_fail (entry != NULL, NULL);
323   g_return_val_if_fail (uid != NULL, NULL);
324
325   cur = entry->subentries;
326   while (cur != NULL) {
327     subentry = cur->data;
328
329     if (g_strcmp0 (subentry->uid, uid) == 0)
330       return subentry;
331
332     subsubentry = gst_toc_entry_find_sub_entry (subentry, uid);
333     if (subsubentry != NULL)
334       return subsubentry;
335
336     cur = cur->next;
337   }
338
339   return NULL;
340 }
341
342 /**
343  * gst_toc_find_entry:
344  * @toc: #GstToc to search in.
345  * @uid: UID to find #GstTocEntry with.
346  *
347  * Find #GstTocEntry with given @uid in the @toc.
348  *
349  * Returns: (transfer none): #GstTocEntry with specified @uid from the @toc, or NULL if not found.
350  */
351 GstTocEntry *
352 gst_toc_find_entry (const GstToc * toc, const gchar * uid)
353 {
354   GList *cur;
355   GstTocEntry *entry, *subentry;
356
357   g_return_val_if_fail (toc != NULL, NULL);
358   g_return_val_if_fail (uid != NULL, NULL);
359
360   cur = toc->entries;
361   while (cur != NULL) {
362     entry = cur->data;
363
364     if (g_strcmp0 (entry->uid, uid) == 0)
365       return entry;
366
367     subentry = gst_toc_entry_find_sub_entry (entry, uid);
368     if (subentry != NULL)
369       return subentry;
370     cur = cur->next;
371   }
372
373   return NULL;
374 }
375
376 /**
377  * gst_toc_entry_copy:
378  * @entry: #GstTocEntry to copy.
379  *
380  * Copy #GstTocEntry with all subentries (deep copy).
381  *
382  * Returns: newly allocated #GstTocEntry in case of success, NULL otherwise;
383  * free it when done with gst_toc_entry_unref().
384  */
385 static GstTocEntry *
386 gst_toc_entry_copy (const GstTocEntry * entry)
387 {
388   GstTocEntry *ret, *sub;
389   GstTagList *list;
390   GList *cur;
391
392   g_return_val_if_fail (entry != NULL, NULL);
393
394   ret = gst_toc_entry_new (entry->type, entry->uid);
395
396   ret->start = entry->start;
397   ret->stop = entry->stop;
398
399   if (GST_IS_TAG_LIST (entry->tags)) {
400     list = gst_tag_list_copy (entry->tags);
401     if (ret->tags)
402       gst_tag_list_unref (ret->tags);
403     ret->tags = list;
404   }
405
406   cur = entry->subentries;
407   while (cur != NULL) {
408     sub = gst_toc_entry_copy (cur->data);
409
410     if (sub != NULL)
411       ret->subentries = g_list_prepend (ret->subentries, sub);
412
413     cur = cur->next;
414   }
415   ret->subentries = g_list_reverse (ret->subentries);
416
417   return ret;
418 }
419
420 /**
421  * gst_toc_copy:
422  * @toc: #GstToc to copy.
423  *
424  * Copy #GstToc with all subentries (deep copy).
425  *
426  * Returns: newly allocated #GstToc in case of success, NULL otherwise;
427  * free it when done with gst_toc_unref().
428  */
429 static GstToc *
430 gst_toc_copy (const GstToc * toc)
431 {
432   GstToc *ret;
433   GstTocEntry *entry;
434   GList *cur;
435   GstTagList *list;
436
437   g_return_val_if_fail (toc != NULL, NULL);
438
439   ret = gst_toc_new (toc->scope);
440
441   if (GST_IS_TAG_LIST (toc->tags)) {
442     list = gst_tag_list_copy (toc->tags);
443     gst_tag_list_unref (ret->tags);
444     ret->tags = list;
445   }
446
447   cur = toc->entries;
448   while (cur != NULL) {
449     entry = gst_toc_entry_copy (cur->data);
450
451     if (entry != NULL)
452       ret->entries = g_list_prepend (ret->entries, entry);
453
454     cur = cur->next;
455   }
456   ret->entries = g_list_reverse (ret->entries);
457   return ret;
458 }
459
460 /**
461  * gst_toc_entry_set_start_stop_times:
462  * @entry: #GstTocEntry to set values.
463  * @start: start value to set.
464  * @stop: stop value to set.
465  *
466  * Set @start and @stop values for the @entry.
467  */
468 void
469 gst_toc_entry_set_start_stop_times (GstTocEntry * entry, gint64 start,
470     gint64 stop)
471 {
472   g_return_if_fail (entry != NULL);
473
474   entry->start = start;
475   entry->stop = stop;
476 }
477
478 /**
479  * gst_toc_entry_get_start_stop_times:
480  * @entry: #GstTocEntry to get values from.
481  * @start: (out): the storage for the start value, leave #NULL if not need.
482  * @stop: (out): the storage for the stop value, leave #NULL if not need.
483  *
484  * Get start and stop values from the @entry and write them into appropriate storages.
485  *
486  * Returns: TRUE if all non-NULL storage pointers were filled with appropriate values,
487  * FALSE otherwise.
488  */
489 gboolean
490 gst_toc_entry_get_start_stop_times (const GstTocEntry * entry, gint64 * start,
491     gint64 * stop)
492 {
493   gboolean ret = TRUE;
494
495   g_return_val_if_fail (entry != NULL, FALSE);
496
497   if (start != NULL)
498     *start = entry->start;
499   if (stop != NULL)
500     *stop = entry->stop;
501
502   return ret;
503 }
504
505 /**
506  * gst_toc_entry_type_get_nick:
507  * @type: a #GstTocEntryType.
508  *
509  * Converts @type to a string representation.
510  *
511  * Returns: Returns a human-readable string for @type. This string is
512  *    only for debugging purpose and should not be displayed in a user
513  *    interface.
514  */
515 const gchar *
516 gst_toc_entry_type_get_nick (GstTocEntryType type)
517 {
518   switch (type) {
519     case GST_TOC_ENTRY_TYPE_ANGLE:
520       return "angle";
521     case GST_TOC_ENTRY_TYPE_VERSION:
522       return "version";
523     case GST_TOC_ENTRY_TYPE_EDITION:
524       return "edition";
525     case GST_TOC_ENTRY_TYPE_TITLE:
526       return "title";
527     case GST_TOC_ENTRY_TYPE_TRACK:
528       return "track";
529     case GST_TOC_ENTRY_TYPE_CHAPTER:
530       return "chapter";
531     default:
532       break;
533   }
534   return "invalid";
535 }
536
537 /**
538  * gst_toc_entry_get_entry_type:
539  * @entry: a #GstTocEntry
540  *
541  * Returns: @entry's entry type
542  */
543 GstTocEntryType
544 gst_toc_entry_get_entry_type (const GstTocEntry * entry)
545 {
546   g_return_val_if_fail (entry != NULL, GST_TOC_ENTRY_TYPE_INVALID);
547
548   return entry->type;
549 }
550
551 /**
552  * gst_toc_entry_is_alternative:
553  * @entry: a #GstTocEntry
554  *
555  * Returns: %TRUE if @entry's type is an alternative type, otherwise %FALSE
556  */
557 gboolean
558 gst_toc_entry_is_alternative (const GstTocEntry * entry)
559 {
560   g_return_val_if_fail (entry != NULL, FALSE);
561
562   return GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE (entry->type);
563 }
564
565 /**
566  * gst_toc_entry_is_sequence:
567  * @entry: a #GstTocEntry
568  *
569  * Returns: %TRUE if @entry's type is a sequence type, otherwise %FALSE
570  */
571 gboolean
572 gst_toc_entry_is_sequence (const GstTocEntry * entry)
573 {
574   g_return_val_if_fail (entry != NULL, FALSE);
575
576   return GST_TOC_ENTRY_TYPE_IS_SEQUENCE (entry->type);
577 }
578
579 /**
580  * gst_toc_entry_get_uid:
581  * @entry: A #GstTocEntry instance
582  *
583  * Gets the UID of @entry.
584  *
585  * Returns: (transfer none): The UID of @entry
586  */
587 const gchar *
588 gst_toc_entry_get_uid (const GstTocEntry * entry)
589 {
590   g_return_val_if_fail (entry != NULL, NULL);
591
592   return entry->uid;
593 }
594
595 /**
596  * gst_toc_entry_append_sub_entry:
597  * @entry: A #GstTocEntry instance
598  * @subentry: (transfer full): A #GstTocEntry
599  *
600  * Appends the #GstTocEntry @subentry to @entry.
601  */
602 void
603 gst_toc_entry_append_sub_entry (GstTocEntry * entry, GstTocEntry * subentry)
604 {
605   g_return_if_fail (entry != NULL);
606   g_return_if_fail (subentry != NULL);
607   g_return_if_fail (gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (entry)));
608   g_return_if_fail (gst_mini_object_is_writable (GST_MINI_OBJECT_CAST
609           (subentry)));
610   g_return_if_fail (subentry->toc == NULL);
611   g_return_if_fail (subentry->parent == NULL);
612
613   entry->subentries = g_list_append (entry->subentries, subentry);
614   subentry->toc = entry->toc;
615   subentry->parent = entry;
616
617   GST_LOG ("appended %s subentry with uid %s to entry %s",
618       gst_toc_entry_type_get_nick (subentry->type), subentry->uid, entry->uid);
619 }
620
621 /**
622  * gst_toc_entry_get_sub_entries:
623  * @entry: A #GstTocEntry instance
624  *
625  * Gets the sub-entries of @entry.
626  *
627  * Returns: (transfer none) (element-type Gst.TocEntry): A #GList of #GstTocEntry of @entry
628  */
629 GList *
630 gst_toc_entry_get_sub_entries (const GstTocEntry * entry)
631 {
632   g_return_val_if_fail (entry != NULL, NULL);
633
634   return entry->subentries;
635 }
636
637 /**
638  * gst_toc_entry_set_tags:
639  * @entry: A #GstTocEntry instance
640  * @tags: (allow-none) (transfer full): A #GstTagList or %NULL
641  *
642  * Set a #GstTagList with tags for the complete @entry.
643  */
644 void
645 gst_toc_entry_set_tags (GstTocEntry * entry, GstTagList * tags)
646 {
647   g_return_if_fail (entry != NULL);
648   g_return_if_fail (gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (entry)));
649
650   if (entry->tags)
651     gst_tag_list_unref (entry->tags);
652   entry->tags = tags;
653 }
654
655 /**
656  * gst_toc_entry_merge_tags:
657  * @entry: A #GstTocEntry instance
658  * @tags: (allow-none): A #GstTagList or %NULL
659  * @mode: A #GstTagMergeMode
660  *
661  * Merge @tags into the existing tags of @entry using @mode.
662  */
663 void
664 gst_toc_entry_merge_tags (GstTocEntry * entry, GstTagList * tags,
665     GstTagMergeMode mode)
666 {
667   g_return_if_fail (entry != NULL);
668   g_return_if_fail (gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (entry)));
669
670   if (!entry->tags) {
671     entry->tags = gst_tag_list_ref (tags);
672   } else {
673     GstTagList *tmp = gst_tag_list_merge (entry->tags, tags, mode);
674     gst_tag_list_unref (entry->tags);
675     entry->tags = tmp;
676   }
677 }
678
679 /**
680  * gst_toc_entry_get_tags:
681  * @entry: A #GstTocEntry instance
682  *
683  * Gets the tags for @entry.
684  *
685  * Returns: (transfer none): A #GstTagList for @entry
686  */
687 GstTagList *
688 gst_toc_entry_get_tags (const GstTocEntry * entry)
689 {
690   g_return_val_if_fail (entry != NULL, NULL);
691
692   return entry->tags;
693 }
694
695 /**
696  * gst_toc_entry_get_toc:
697  * @entry: A #GstTocEntry instance
698  *
699  * Gets the parent #GstToc of @entry.
700  *
701  * Returns: (transfer none): The parent #GstToc of @entry
702  */
703 GstToc *
704 gst_toc_entry_get_toc (GstTocEntry * entry)
705 {
706   g_return_val_if_fail (entry != NULL, NULL);
707
708   return entry->toc;
709 }
710
711 /**
712  * gst_toc_entry_get_parent:
713  * @entry: A #GstTocEntry instance
714  *
715  * Gets the parent #GstTocEntry of @entry.
716  *
717  * Returns: (transfer none): The parent #GstTocEntry of @entry
718  */
719 GstTocEntry *
720 gst_toc_entry_get_parent (GstTocEntry * entry)
721 {
722   g_return_val_if_fail (entry != NULL, NULL);
723
724   return entry->parent;
725 }
726
727 #ifndef GST_DISABLE_GST_DEBUG
728 static void
729 gst_toc_dump_entries (GList * entries, guint depth)
730 {
731   GList *e;
732   gchar *indent;
733
734   indent = g_malloc0 (depth + 1);
735   memset (indent, ' ', depth);
736   for (e = entries; e != NULL; e = e->next) {
737     GstTocEntry *entry = e->data;
738
739     GST_TRACE ("%s+ %s (%s), %" GST_TIME_FORMAT " - %" GST_TIME_FORMAT ", "
740         "tags: %" GST_PTR_FORMAT, indent, entry->uid,
741         gst_toc_entry_type_get_nick (entry->type),
742         GST_TIME_ARGS (entry->start), GST_TIME_ARGS (entry->stop), entry->tags);
743
744     if (entry->subentries != NULL)
745       gst_toc_dump_entries (entry->subentries, depth + 2);
746   }
747   g_free (indent);
748 }
749 #endif
750
751 void
752 gst_toc_dump (GstToc * toc)
753 {
754 #ifndef GST_DISABLE_GST_DEBUG
755   GST_TRACE ("        Toc %p, scope: %s, tags: %" GST_PTR_FORMAT, toc,
756       (toc->scope == GST_TOC_SCOPE_GLOBAL) ? "global" : "current", toc->tags);
757   gst_toc_dump_entries (toc->entries, 2);
758 #endif
759 }