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  = 
27  * outPack = gstreamer
28  * outFile = TocEntry
29  * strct   = GstTocEntry
30  * realStrct=
31  * ctorStrct=
32  * clss    = TocEntry
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_toc_entry_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ListG
48  * 	- gstreamer.TagList
49  * 	- gstreamer.Toc
50  * structWrap:
51  * 	- GList* -> ListG
52  * 	- GstTagList* -> TagList
53  * 	- GstToc* -> Toc
54  * 	- GstTocEntry* -> TocEntry
55  * module aliases:
56  * local aliases:
57  * overrides:
58  */
59 
60 module gstreamer.TocEntry;
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.Toc;
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 TocEntry
125 {
126 	
127 	/** the main Gtk struct */
128 	protected GstTocEntry* gstTocEntry;
129 	
130 	
131 	public GstTocEntry* getTocEntryStruct()
132 	{
133 		return gstTocEntry;
134 	}
135 	
136 	
137 	/** the main Gtk struct as a void* */
138 	protected void* getStruct()
139 	{
140 		return cast(void*)gstTocEntry;
141 	}
142 	
143 	/**
144 	 * Sets our main struct and passes it to the parent class
145 	 */
146 	public this (GstTocEntry* gstTocEntry)
147 	{
148 		this.gstTocEntry = gstTocEntry;
149 	}
150 	
151 	/**
152 	 */
153 	
154 	/**
155 	 * Create new GstTocEntry structure.
156 	 * Params:
157 	 * type = entry type.
158 	 * uid = unique ID (UID) in the whole TOC.
159 	 * Throws: ConstructionException GTK+ fails to create the object.
160 	 */
161 	public this (GstTocEntryType type, string uid)
162 	{
163 		// GstTocEntry * gst_toc_entry_new (GstTocEntryType type,  const gchar *uid);
164 		auto p = gst_toc_entry_new(type, Str.toStringz(uid));
165 		if(p is null)
166 		{
167 			throw new ConstructionException("null returned by gst_toc_entry_new(type, Str.toStringz(uid))");
168 		}
169 		this(cast(GstTocEntry*) p);
170 	}
171 	
172 	/**
173 	 * Gets the parent GstToc of entry.
174 	 * Returns: The parent GstToc of entry. [transfer none]
175 	 */
176 	public Toc getToc()
177 	{
178 		// GstToc * gst_toc_entry_get_toc (GstTocEntry *entry);
179 		auto p = gst_toc_entry_get_toc(gstTocEntry);
180 		
181 		if(p is null)
182 		{
183 			return null;
184 		}
185 		
186 		return ObjectG.getDObject!(Toc)(cast(GstToc*) p);
187 	}
188 	
189 	/**
190 	 * Gets the UID of entry.
191 	 * Returns: The UID of entry. [transfer none]
192 	 */
193 	public string getUid()
194 	{
195 		// const gchar * gst_toc_entry_get_uid (const GstTocEntry *entry);
196 		return Str.toString(gst_toc_entry_get_uid(gstTocEntry));
197 	}
198 	
199 	/**
200 	 * Gets the parent GstTocEntry of entry.
201 	 * Returns: The parent GstTocEntry of entry. [transfer none]
202 	 */
203 	public TocEntry getParent()
204 	{
205 		// GstTocEntry * gst_toc_entry_get_parent (GstTocEntry *entry);
206 		auto p = gst_toc_entry_get_parent(gstTocEntry);
207 		
208 		if(p is null)
209 		{
210 			return null;
211 		}
212 		
213 		return ObjectG.getDObject!(TocEntry)(cast(GstTocEntry*) p);
214 	}
215 	
216 	/**
217 	 * Gets the sub-entries of entry.
218 	 * Returns: A GList of GstTocEntry of entry. [transfer none][element-type Gst.TocEntry]
219 	 */
220 	public ListG getSubEntries()
221 	{
222 		// GList * gst_toc_entry_get_sub_entries (const GstTocEntry *entry);
223 		auto p = gst_toc_entry_get_sub_entries(gstTocEntry);
224 		
225 		if(p is null)
226 		{
227 			return null;
228 		}
229 		
230 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
231 	}
232 	
233 	/**
234 	 * Appends the GstTocEntry subentry to entry.
235 	 * Params:
236 	 * entry = A GstTocEntry instance
237 	 * subentry = A GstTocEntry. [transfer full]
238 	 */
239 	public void appendSubEntry(TocEntry subentry)
240 	{
241 		// void gst_toc_entry_append_sub_entry (GstTocEntry *entry,  GstTocEntry *subentry);
242 		gst_toc_entry_append_sub_entry(gstTocEntry, (subentry is null) ? null : subentry.getTocEntryStruct());
243 	}
244 	
245 	/**
246 	 * Get start and stop values from the entry and write them into appropriate storages.
247 	 * Params:
248 	 * start = the storage for the start value, leave NULL if not need. [out]
249 	 * stop = the storage for the stop value, leave NULL if not need. [out]
250 	 * Returns: TRUE if all non-NULL storage pointers were filled with appropriate values, FALSE otherwise.
251 	 */
252 	public int getStartStopTimes(out long start, out long stop)
253 	{
254 		// gboolean gst_toc_entry_get_start_stop_times (const GstTocEntry *entry,  gint64 *start,  gint64 *stop);
255 		return gst_toc_entry_get_start_stop_times(gstTocEntry, &start, &stop);
256 	}
257 	
258 	/**
259 	 * Set start and stop values for the entry.
260 	 * Params:
261 	 * start = start value to set.
262 	 * stop = stop value to set.
263 	 */
264 	public void setStartStopTimes(long start, long stop)
265 	{
266 		// void gst_toc_entry_set_start_stop_times (GstTocEntry *entry,  gint64 start,  gint64 stop);
267 		gst_toc_entry_set_start_stop_times(gstTocEntry, start, stop);
268 	}
269 	
270 	/**
271 	 * Gets the tags for entry.
272 	 * Returns: A GstTagList for entry. [transfer none]
273 	 */
274 	public TagList getTags()
275 	{
276 		// GstTagList * gst_toc_entry_get_tags (const GstTocEntry *entry);
277 		auto p = gst_toc_entry_get_tags(gstTocEntry);
278 		
279 		if(p is null)
280 		{
281 			return null;
282 		}
283 		
284 		return ObjectG.getDObject!(TagList)(cast(GstTagList*) p);
285 	}
286 	
287 	/**
288 	 * Merge tags into the existing tags of entry using mode.
289 	 * Params:
290 	 * tags = A GstTagList or NULL. [allow-none]
291 	 * mode = A GstTagMergeMode
292 	 */
293 	public void mergeTags(TagList tags, GstTagMergeMode mode)
294 	{
295 		// void gst_toc_entry_merge_tags (GstTocEntry *entry,  GstTagList *tags,  GstTagMergeMode mode);
296 		gst_toc_entry_merge_tags(gstTocEntry, (tags is null) ? null : tags.getTagListStruct(), mode);
297 	}
298 	
299 	/**
300 	 * Set a GstTagList with tags for the complete entry.
301 	 * Params:
302 	 * tags = A GstTagList or NULL. [allow-none][transfer full]
303 	 */
304 	public void setTags(TagList tags)
305 	{
306 		// void gst_toc_entry_set_tags (GstTocEntry *entry,  GstTagList *tags);
307 		gst_toc_entry_set_tags(gstTocEntry, (tags is null) ? null : tags.getTagListStruct());
308 	}
309 	
310 	/**
311 	 * Converts type to a string representation.
312 	 * Params:
313 	 * type = a GstTocEntryType.
314 	 * Returns: Returns a human-readable string for type. This string is only for debugging purpose and should not be displayed in a user interface.
315 	 */
316 	public static string typeGetNick(GstTocEntryType type)
317 	{
318 		// const gchar * gst_toc_entry_type_get_nick (GstTocEntryType type);
319 		return Str.toString(gst_toc_entry_type_get_nick(type));
320 	}
321 	
322 	/**
323 	 * Returns: entry's entry type
324 	 */
325 	public GstTocEntryType getEntryType()
326 	{
327 		// GstTocEntryType gst_toc_entry_get_entry_type (const GstTocEntry *entry);
328 		return gst_toc_entry_get_entry_type(gstTocEntry);
329 	}
330 	
331 	/**
332 	 * Returns: TRUE if entry's type is an alternative type, otherwise FALSE
333 	 */
334 	public int isAlternative()
335 	{
336 		// gboolean gst_toc_entry_is_alternative (const GstTocEntry *entry);
337 		return gst_toc_entry_is_alternative(gstTocEntry);
338 	}
339 	
340 	/**
341 	 * Returns: TRUE if entry's type is a sequence type, otherwise FALSE
342 	 */
343 	public int isSequence()
344 	{
345 		// gboolean gst_toc_entry_is_sequence (const GstTocEntry *entry);
346 		return gst_toc_entry_is_sequence(gstTocEntry);
347 	}
348 }