Merge branch '0.10'
[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., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21
22 #ifndef __GST_TOC_H__
23 #define __GST_TOC_H__
24
25 #include <gst/gstconfig.h>
26 #include <gst/gsttaglist.h>
27 #include <gst/gstformat.h>
28
29 G_BEGIN_DECLS
30
31 typedef struct _GstTocEntry GstTocEntry;
32 typedef struct _GstToc GstToc;
33
34 /**
35  * GstTocEntryType:
36  * @GST_TOC_ENTRY_TYPE_CHAPTER: a chapter type entry.
37  * @GST_TOC_ENTRY_TYPE_EDITION: an edition entry (angle or alternative in other terms).
38  *
39  * The different types of TOC entry.
40  */
41 typedef enum {
42   GST_TOC_ENTRY_TYPE_CHAPTER     = 0,
43   GST_TOC_ENTRY_TYPE_EDITION     = 1
44 } GstTocEntryType;
45
46 /**
47  * GstTocEntry:
48  * @uid: unique (for a whole TOC) id of the entry. This value should be persistent and
49  * should not be changed while updating TOC. @uid should be handled as "opaque" value
50  * without meaning (e.g. applications should not assume the /editionX/chapterY/chapter/Z structure,
51  * other demuxers could do something else), it should help to track updates of certain entries.
52  * @type: #GstTocEntryType of this entry.
53  * @subentries: list of #GstTocEntry children.
54  * @pads: list of #GstPad objects, related to this #GstTocEntry.
55  * @tags: tags related to this entry.
56  * @info: extra information related to this entry.
57  *
58  * Definition of TOC entry structure.
59  */
60 struct _GstTocEntry {
61   gchar *uid;
62   GstTocEntryType type;
63   GList *subentries;
64   GList *pads;
65   GstTagList *tags;
66   GstStructure *info;
67
68   /*< private >*/
69   gpointer _gst_reserved[GST_PADDING];
70 };
71
72 /* FIXME: pad member should be GstPad type, but that's
73  * impossible due to recursive includes */
74
75 /**
76  * GstToc:
77  * @entries: list of #GstTocEntry entries of the TOC.
78  * @tags: tags related to the whole TOC.
79  * @info: extra information related to the TOC.
80  *
81  * Definition of TOC structure.
82  */
83 struct _GstToc {
84   GList *entries;
85   GstTagList *tags;
86   GstStructure *info;
87
88   /*< private >*/
89   gpointer _gst_reserved[GST_PADDING];
90 };
91
92 /* functions to create new structures */
93 GstToc *        gst_toc_new                     (void);
94 GstTocEntry *   gst_toc_entry_new               (GstTocEntryType type, const gchar *uid);
95 GstTocEntry *   gst_toc_entry_new_with_pad      (GstTocEntryType type, const gchar *uid, gpointer pad);
96
97 /* functions to free structures */
98 void            gst_toc_entry_free              (GstTocEntry *entry);
99 void            gst_toc_free                    (GstToc *toc);
100
101 GstTocEntry *   gst_toc_find_entry              (const GstToc *toc, const gchar *uid);
102 GstTocEntry *   gst_toc_entry_copy              (const GstTocEntry *entry);
103 GstToc      *   gst_toc_copy                    (const GstToc *toc);
104
105 void            gst_toc_entry_set_start_stop    (GstTocEntry *entry, gint64 start, gint64 stop);
106 gboolean        gst_toc_entry_get_start_stop    (const GstTocEntry *entry, gint64 *start, gint64 *stop);
107
108 G_END_DECLS
109
110 #endif /* __GST_TOC_H__ */
111