gst: Store more basic type GTypes in variables
[platform/upstream/gstreamer.git] / gst / gsttoc.h
1 /* GStreamer
2  * (c) 2010, 2012 Alexander Saprykin <xelfium@gmail.com>
3  *
4  * gsttoc.h: generic TOC API declaration
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., 51 Franklin St, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21
22 #ifndef __GST_TOC_H__
23 #define __GST_TOC_H__
24
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>
30
31 G_BEGIN_DECLS
32
33 GST_EXPORT GType _gst_toc_type;
34 GST_EXPORT GType _gst_toc_entry_type;
35
36 #define GST_TYPE_TOC (_gst_toc_type)
37 #define GST_TYPE_TOC_ENTRY (_gst_toc_entry_type)
38
39 typedef struct _GstTocEntry GstTocEntry;
40 typedef struct _GstToc GstToc;
41
42 /**
43  * GstTocScope:
44  * @GST_TOC_SCOPE_GLOBAL: global TOC representing all selectable options
45  *     (this is what applications are usually interested in)
46  * @GST_TOC_SCOPE_CURRENT: TOC for the currently active/selected stream
47  *     (this is a TOC representing the current stream from start to EOS,
48  *     and is what a TOC writer / muxer is usually interested in; it will
49  *     usually be a subset of the global TOC, e.g. just the chapters of
50  *     the current title, or the chapters selected for playback from the
51  *     current title)
52  *
53  * The scope of a TOC.
54  */
55 typedef enum {
56   GST_TOC_SCOPE_GLOBAL = 1,
57   GST_TOC_SCOPE_CURRENT = 2
58 } GstTocScope;
59
60 /**
61  * GstTocEntryType:
62  * @GST_TOC_ENTRY_TYPE_ANGLE: entry is an angle (i.e. an alternative)
63  * @GST_TOC_ENTRY_TYPE_VERSION: entry is a version (i.e. alternative)
64  * @GST_TOC_ENTRY_TYPE_EDITION: entry is an edition (i.e. alternative)
65  * @GST_TOC_ENTRY_TYPE_INVALID: invalid entry type value
66  * @GST_TOC_ENTRY_TYPE_TITLE: entry is a title (i.e. a part of a sequence)
67  * @GST_TOC_ENTRY_TYPE_TRACK: entry is a track (i.e. a part of a sequence)
68  * @GST_TOC_ENTRY_TYPE_CHAPTER: entry is a chapter (i.e. a part of a sequence)
69  *
70  * The different types of TOC entries (see #GstTocEntry).
71  *
72  * There are two types of TOC entries: alternatives or parts in a sequence.
73  */
74 typedef enum {
75   GST_TOC_ENTRY_TYPE_ANGLE       = -3,
76   GST_TOC_ENTRY_TYPE_VERSION     = -2,
77   GST_TOC_ENTRY_TYPE_EDITION     = -1,
78   GST_TOC_ENTRY_TYPE_INVALID     = 0,
79   GST_TOC_ENTRY_TYPE_TITLE       = 1,
80   GST_TOC_ENTRY_TYPE_TRACK       = 2,
81   GST_TOC_ENTRY_TYPE_CHAPTER     = 3,
82 } GstTocEntryType;
83
84 #define GST_TOC_ENTRY_TYPE_IS_ALTERNATIVE(entry_type)  (entry_type < 0)
85 #define GST_TOC_ENTRY_TYPE_IS_SEQUENCE(entry_type)     (entry_type > 0)
86
87 /**
88  * GstTocLoopType:
89  * @GST_TOC_LOOP_NONE: single forward playback
90  * @GST_TOC_LOOP_FORWARD: repeat forward
91  * @GST_TOC_LOOP_REVERSE: repeat backward
92  * @GST_TOC_LOOP_PING_PONG: repeat forward and backward
93  *
94  * How a #GstTocEntry should be repeated. By default, entries are played a
95  * single time.
96  *
97  * Since: 1.4
98  */
99 typedef enum {
100   GST_TOC_LOOP_NONE = 0,
101   GST_TOC_LOOP_FORWARD,
102   GST_TOC_LOOP_REVERSE,
103   GST_TOC_LOOP_PING_PONG
104 } GstTocLoopType;
105
106 /**
107  * GST_TOC_REPEAT_COUNT_INFINITE:
108  *
109  * Special value for the repeat_count set in gst_toc_entry_set_loop() or
110  * returned by gst_toc_entry_set_loop() to indicate infinite looping.
111  *
112  * Since: 1.4
113  */
114 #define GST_TOC_REPEAT_COUNT_INFINITE (-1)
115
116 /* functions to return type structures */
117 GType           gst_toc_get_type                (void);
118 GType           gst_toc_entry_get_type          (void);
119
120 /* functions to create, ref and unref/free TOCs */
121 GstToc *           gst_toc_new                     (GstTocScope scope);
122
123 GstTocScope        gst_toc_get_scope               (const GstToc *toc);
124
125 void               gst_toc_set_tags                (GstToc *toc, GstTagList * tags);
126 void               gst_toc_merge_tags              (GstToc *toc, GstTagList *tags, GstTagMergeMode mode);
127 GstTagList *       gst_toc_get_tags                (const GstToc *toc);
128
129 void               gst_toc_append_entry               (GstToc *toc, GstTocEntry *entry);
130 GList *            gst_toc_get_entries             (const GstToc *toc);
131
132 void               gst_toc_dump                    (GstToc *toc);
133
134 #define gst_toc_ref(toc)            (GstToc*)gst_mini_object_ref(GST_MINI_OBJECT_CAST(toc))
135 #define gst_toc_unref(toc)          gst_mini_object_unref(GST_MINI_OBJECT_CAST(toc))
136 #define gst_toc_copy(toc)           (GstToc*)gst_mini_object_copy(GST_MINI_OBJECT_CAST(toc))
137 #define gst_toc_make_writable(toc)  (GstToc*)gst_mini_object_make_writable(GST_MINI_OBJECT_CAST(toc))
138
139 /* functions to create, ref and unref/free TOC entries */
140 GstTocEntry *   gst_toc_entry_new               (GstTocEntryType type, const gchar *uid);
141
142 #define gst_toc_entry_ref(entry)            (GstTocEntry*)gst_mini_object_ref(GST_MINI_OBJECT_CAST(entry))
143 #define gst_toc_entry_unref(entry)          gst_mini_object_unref(GST_MINI_OBJECT_CAST(entry))
144 #define gst_toc_entry_copy(entry)           (GstTocEntry*)gst_mini_object_copy(GST_MINI_OBJECT_CAST(entry))
145 #define gst_toc_entry_make_writable(entry)  (GstTocEntry*)gst_mini_object_make_writable(GST_MINI_OBJECT_CAST(entry))
146
147 GstTocEntry *      gst_toc_find_entry                    (const GstToc *toc, const gchar *uid);
148
149 GstTocEntryType    gst_toc_entry_get_entry_type          (const GstTocEntry *entry);
150 const gchar *      gst_toc_entry_get_uid                 (const GstTocEntry *entry);
151
152 void               gst_toc_entry_append_sub_entry           (GstTocEntry *entry, GstTocEntry *subentry);
153 GList *            gst_toc_entry_get_sub_entries         (const GstTocEntry *entry);
154
155 void               gst_toc_entry_set_tags                (GstTocEntry *entry, GstTagList *tags);
156 void               gst_toc_entry_merge_tags              (GstTocEntry *entry, GstTagList *tags, GstTagMergeMode mode);
157 GstTagList *       gst_toc_entry_get_tags                (const GstTocEntry *entry);
158
159 gboolean           gst_toc_entry_is_alternative          (const GstTocEntry *entry);
160 gboolean           gst_toc_entry_is_sequence             (const GstTocEntry *entry);
161
162 void               gst_toc_entry_set_start_stop_times    (GstTocEntry *entry, gint64 start, gint64 stop);
163 gboolean           gst_toc_entry_get_start_stop_times    (const GstTocEntry *entry, gint64 *start, gint64 *stop);
164
165 void               gst_toc_entry_set_loop                (GstTocEntry *entry, GstTocLoopType loop_type, gint repeat_count);
166 gboolean           gst_toc_entry_get_loop                (const GstTocEntry *entry, GstTocLoopType *loop_type, gint *repeat_count);
167
168 GstToc *           gst_toc_entry_get_toc                 (GstTocEntry *entry);
169 GstTocEntry *      gst_toc_entry_get_parent              (GstTocEntry *entry);
170
171
172 const gchar *      gst_toc_entry_type_get_nick     (GstTocEntryType type);
173
174 G_END_DECLS
175
176 #endif /* __GST_TOC_H__ */
177