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