1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19  
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 /*
25  * Conversion parameters:
26  * inFile  = gstreamer-GstToc.html
27  * outPack = gstreamer
28  * outFile = Toc
29  * strct   = GstToc
30  * realStrct=
31  * ctorStrct=
32  * clss    = Toc
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_toc_
41  * omit structs:
42  * omit prefixes:
43  * 	- gst_toc_entry_
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * 	- glib.ListG
49  * 	- gstreamer.TagList
50  * 	- gstreamer.TocEntry
51  * structWrap:
52  * 	- GList* -> ListG
53  * 	- GstTagList* -> TagList
54  * 	- GstTocEntry* -> TocEntry
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gstreamer.Toc;
61 
62 public  import gstreamerc.gstreamertypes;
63 
64 private import gstreamerc.gstreamer;
65 private import glib.ConstructionException;
66 private import gobject.ObjectG;
67 
68 
69 private import glib.Str;
70 private import glib.ListG;
71 private import gstreamer.TagList;
72 private import gstreamer.TocEntry;
73 
74 
75 
76 
77 /**
78  * GstToc functions are used to create/free GstToc and GstTocEntry structures.
79  * Also they are used to convert GstToc into GstStructure and vice versa.
80  *
81  * GstToc lets you to inform other elements in pipeline or application that playing
82  * source has some kind of table of contents (TOC). These may be chapters, editions,
83  * angles or other types. For example: DVD chapters, Matroska chapters or cue sheet
84  * TOC. Such TOC will be useful for applications to display instead of just a
85  * playlist.
86  *
87  * Using TOC is very easy. Firstly, create GstToc structure which represents root
88  * contents of the source. You can also attach TOC-specific tags to it. Then fill
89  * it with GstTocEntry entries by appending them to the GstToc using
90  * gst_toc_append_entry(), and appending subentries to a GstTocEntry using
91  * gst_toc_entry_append_sub_entry().
92  *
93  * Note that root level of the TOC can contain only either editions or chapters. You
94  * should not mix them together at the same level. Otherwise you will get serialization
95  * /deserialization errors. Make sure that no one of the entries has negative start and
96  *  stop values.
97  *
98  * Use gst_event_new_toc() to create a new TOC GstEvent, and gst_event_parse_toc() to
99  * parse received TOC event. Use gst_event_new_toc_select() to create a new TOC select GstEvent,
100  * and gst_event_parse_toc_select() to parse received TOC select event. The same rule for
101  * the GstMessage: gst_message_new_toc() to create new TOC GstMessage, and
102  * gst_message_parse_toc() to parse received TOC message.
103  *
104  * TOCs can have global scope or current scope. Global scope TOCs contain
105  * all entries that can possibly be selected using a toc select event, and
106  * are what an application is usually interested in. TOCs with current scope
107  * only contain the parts of the TOC relevant to the currently selected/playing
108  * stream; the current scope TOC is used by downstream elements such as muxers
109  * to write correct TOC entries when transcoding files, for example. When
110  * playing a DVD, the global TOC would contain a hierarchy of all titles,
111  * chapters and angles, for example, while the current TOC would only contain
112  * the chapters for the currently playing title if playback of a specific
113  * title was requested.
114  *
115  * Applications and plugins should not rely on TOCs having a certain kind of
116  * structure, but should allow for different alternatives. For example, a
117  * simple CUE sheet embedded in a file may be presented as a flat list of
118  * track entries, or could have a top-level edition node (or some other
119  * alternative type entry) with track entries underneath that node; or even
120  * multiple top-level edition nodes (or some other alternative type entries)
121  * each with track entries underneath, in case the source file has extracted
122  * a track listing from different sources).
123  */
124 public class Toc
125 {
126 	
127 	/** the main Gtk struct */
128 	protected GstToc* gstToc;
129 	
130 	
131 	public GstToc* getTocStruct()
132 	{
133 		return gstToc;
134 	}
135 	
136 	
137 	/** the main Gtk struct as a void* */
138 	protected void* getStruct()
139 	{
140 		return cast(void*)gstToc;
141 	}
142 	
143 	/**
144 	 * Sets our main struct and passes it to the parent class
145 	 */
146 	public this (GstToc* gstToc)
147 	{
148 		this.gstToc = gstToc;
149 	}
150 	
151 	/**
152 	 */
153 	
154 	/**
155 	 * Create a new GstToc structure.
156 	 * Throws: ConstructionException GTK+ fails to create the object.
157 	 */
158 	public this (GstTocScope scop)
159 	{
160 		// GstToc * gst_toc_new (GstTocScope scope);
161 		auto p = gst_toc_new(scop);
162 		if(p is null)
163 		{
164 			throw new ConstructionException("null returned by gst_toc_new(scop)");
165 		}
166 		this(cast(GstToc*) p);
167 	}
168 	
169 	/**
170 	 * Returns: scope of toc
171 	 */
172 	public GstTocScope getScope()
173 	{
174 		// GstTocScope gst_toc_get_scope (const GstToc *toc);
175 		return gst_toc_get_scope(gstToc);
176 	}
177 	
178 	/**
179 	 * Gets the list of GstTocEntry of toc.
180 	 * Returns: A GList of GstTocEntry for entry. [transfer none][element-type Gst.TocEntry]
181 	 */
182 	public ListG getEntries()
183 	{
184 		// GList * gst_toc_get_entries (const GstToc *toc);
185 		auto p = gst_toc_get_entries(gstToc);
186 		
187 		if(p is null)
188 		{
189 			return null;
190 		}
191 		
192 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
193 	}
194 	
195 	/**
196 	 * Appends the GstTocEntry entry to toc.
197 	 * Params:
198 	 * entry = A GstTocEntry. [transfer full]
199 	 */
200 	public void appendEntry(TocEntry entry)
201 	{
202 		// void gst_toc_append_entry (GstToc *toc,  GstTocEntry *entry);
203 		gst_toc_append_entry(gstToc, (entry is null) ? null : entry.getTocEntryStruct());
204 	}
205 	
206 	/**
207 	 * Gets the tags for toc.
208 	 * Returns: A GstTagList for entry. [transfer none]
209 	 */
210 	public TagList getTags()
211 	{
212 		// GstTagList * gst_toc_get_tags (const GstToc *toc);
213 		auto p = gst_toc_get_tags(gstToc);
214 		
215 		if(p is null)
216 		{
217 			return null;
218 		}
219 		
220 		return ObjectG.getDObject!(TagList)(cast(GstTagList*) p);
221 	}
222 	
223 	/**
224 	 * Merge tags into the existing tags of toc using mode.
225 	 * Params:
226 	 * tags = A GstTagList or NULL. [allow-none]
227 	 * mode = A GstTagMergeMode
228 	 */
229 	public void mergeTags(TagList tags, GstTagMergeMode mode)
230 	{
231 		// void gst_toc_merge_tags (GstToc *toc,  GstTagList *tags,  GstTagMergeMode mode);
232 		gst_toc_merge_tags(gstToc, (tags is null) ? null : tags.getTagListStruct(), mode);
233 	}
234 	
235 	/**
236 	 * Set a GstTagList with tags for the complete toc.
237 	 * Params:
238 	 * tags = A GstTagList or NULL. [allow-none][transfer full]
239 	 */
240 	public void setTags(TagList tags)
241 	{
242 		// void gst_toc_set_tags (GstToc *toc,  GstTagList *tags);
243 		gst_toc_set_tags(gstToc, (tags is null) ? null : tags.getTagListStruct());
244 	}
245 	
246 	/**
247 	 */
248 	public void dump()
249 	{
250 		// void gst_toc_dump (GstToc *toc);
251 		gst_toc_dump(gstToc);
252 	}
253 	
254 	/**
255 	 * Find GstTocEntry with given uid in the toc.
256 	 * Params:
257 	 * uid = UID to find GstTocEntry with.
258 	 * Returns: GstTocEntry with specified uid from the toc, or NULL if not found. [transfer none]
259 	 */
260 	public TocEntry findEntry(string uid)
261 	{
262 		// GstTocEntry * gst_toc_find_entry (const GstToc *toc,  const gchar *uid);
263 		auto p = gst_toc_find_entry(gstToc, Str.toStringz(uid));
264 		
265 		if(p is null)
266 		{
267 			return null;
268 		}
269 		
270 		return ObjectG.getDObject!(TocEntry)(cast(GstTocEntry*) p);
271 	}
272 }