2 * (c) 2010, 2012 Alexander Saprykin <xelfium@gmail.com>
4 * gsttoc.h: generic TOC API declaration
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.
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.
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., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
25 #include <gst/gstconfig.h>
26 #include <gst/gstminiobject.h>
27 #include <gst/gststructure.h>
28 #include <gst/gsttaglist.h>
29 #include <gst/gstformat.h>
33 #define GST_TYPE_TOC (gst_toc_get_type ())
34 #define GST_TYPE_TOC_ENTRY (gst_toc_entry_get_type ())
36 typedef struct _GstTocEntry GstTocEntry;
37 typedef struct _GstToc GstToc;
41 * @GST_TOC_SCOPE_GLOBAL: global TOC representing all selectable options
42 * (this is what applications are usually interested in)
43 * @GST_TOC_SCOPE_CURRENT: TOC for the currently active/selected stream
44 * (this is a TOC representing the current stream from start to EOS,
45 * and is what a TOC writer / muxer is usually interested in; it will
46 * usually be a subset of the global TOC, e.g. just the chapters of
47 * the current title, or the chapters selected for playback from the
53 GST_TOC_SCOPE_GLOBAL = 1,
54 GST_TOC_SCOPE_CURRENT = 2
59 * @GST_TOC_ENTRY_TYPE_ANGLE: entry is an angle (i.e. an alternative)
60 * @GST_TOC_ENTRY_TYPE_VERSION: entry is a version (i.e. alternative)
61 * @GST_TOC_ENTRY_TYPE_EDITION: entry is an edition (i.e. alternative)
62 * @GST_TOC_ENTRY_TYPE_INVALID: invalid entry type value
63 * @GST_TOC_ENTRY_TYPE_TITLE: entry is a title (i.e. a part of a sequence)
64 * @GST_TOC_ENTRY_TYPE_TRACK: entry is a track (i.e. a part of a sequence)
65 * @GST_TOC_ENTRY_TYPE_CHAPTER: entry is a chapter (i.e. a part of a sequence)
67 * The different types of TOC entries (see #GstTocEntry).
69 * There are two types of TOC entries: alternatives or parts in a sequence.
72 GST_TOC_ENTRY_TYPE_ANGLE = -3,
73 GST_TOC_ENTRY_TYPE_VERSION = -2,
74 GST_TOC_ENTRY_TYPE_EDITION = -1,
75 GST_TOC_ENTRY_TYPE_INVALID = 0,
76 GST_TOC_ENTRY_TYPE_TITLE = 1,
77 GST_TOC_ENTRY_TYPE_TRACK = 2,
78 GST_TOC_ENTRY_TYPE_CHAPTER = 3,
81 #define GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE(entry_type) (entry_type < 0)
82 #define GST_TOC_ENTRY_TYPE_IS_SEQUENCE(entry_type) (entry_type > 0)
84 /* functions to return type structures */
85 GType gst_toc_get_type (void);
86 GType gst_toc_entry_get_type (void);
88 /* functions to create, ref and unref/free TOCs */
89 GstToc * gst_toc_new (GstTocScope scope);
91 GstTocScope gst_toc_get_scope (const GstToc *toc);
93 void gst_toc_set_tags (GstToc *toc, GstTagList * tags);
94 void gst_toc_merge_tags (GstToc *toc, GstTagList *tags, GstTagMergeMode mode);
95 GstTagList * gst_toc_get_tags (const GstToc *toc);
97 void gst_toc_append_entry (GstToc *toc, GstTocEntry *entry);
98 GList * gst_toc_get_entries (const GstToc *toc);
100 void gst_toc_dump (GstToc *toc);
102 #define gst_toc_ref(toc) (GstToc*)gst_mini_object_ref(GST_MINI_OBJECT_CAST(toc))
103 #define gst_toc_unref(toc) gst_mini_object_unref(GST_MINI_OBJECT_CAST(toc))
104 #define gst_toc_copy(toc) (GstToc*)gst_mini_object_copy(GST_MINI_OBJECT_CAST(toc))
105 #define gst_toc_make_writable(toc) (GstToc*)gst_mini_object_make_writable(GST_MINI_OBJECT_CAST(toc))
107 /* functions to create, ref and unref/free TOC entries */
108 GstTocEntry * gst_toc_entry_new (GstTocEntryType type, const gchar *uid);
110 #define gst_toc_entry_ref(entry) (GstTocEntry*)gst_mini_object_ref(GST_MINI_OBJECT_CAST(entry))
111 #define gst_toc_entry_unref(entry) gst_mini_object_unref(GST_MINI_OBJECT_CAST(entry))
112 #define gst_toc_entry_copy(entry) (GstTocEntry*)gst_mini_object_copy(GST_MINI_OBJECT_CAST(entry))
113 #define gst_toc_entry_make_writable(entry) (GstTocEntry*)gst_mini_object_make_writable(GST_MINI_OBJECT_CAST(entry))
115 GstTocEntry * gst_toc_find_entry (const GstToc *toc, const gchar *uid);
117 GstTocEntryType gst_toc_entry_get_entry_type (const GstTocEntry *entry);
118 const gchar * gst_toc_entry_get_uid (const GstTocEntry *entry);
120 void gst_toc_entry_append_sub_entry (GstTocEntry *entry, GstTocEntry *subentry);
121 GList * gst_toc_entry_get_sub_entries (const GstTocEntry *entry);
123 void gst_toc_entry_set_tags (GstTocEntry *entry, GstTagList *tags);
124 void gst_toc_entry_merge_tags (GstTocEntry *entry, GstTagList *tags, GstTagMergeMode mode);
125 GstTagList * gst_toc_entry_get_tags (const GstTocEntry *entry);
127 gboolean gst_toc_entry_is_alternative (const GstTocEntry *entry);
128 gboolean gst_toc_entry_is_sequence (const GstTocEntry *entry);
130 void gst_toc_entry_set_start_stop_times (GstTocEntry *entry, gint64 start, gint64 stop);
131 gboolean gst_toc_entry_get_start_stop_times (const GstTocEntry *entry, gint64 *start, gint64 *stop);
133 GstToc * gst_toc_entry_get_toc (GstTocEntry *entry);
134 GstTocEntry * gst_toc_entry_get_parent (GstTocEntry *entry);
137 const gchar * gst_toc_entry_type_get_nick (GstTocEntryType type);
141 #endif /* __GST_TOC_H__ */