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