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 private import glib.Str;
69 private import glib.ListG;
70 private import gstreamer.TagList;
71 private import gstreamer.Toc;
72 
73 
74 
75 /**
76  * GstToc functions are used to create/free GstToc and GstTocEntry structures.
77  * Also they are used to convert GstToc into GstStructure and vice versa.
78  *
79  * GstToc lets you to inform other elements in pipeline or application that playing
80  * source has some kind of table of contents (TOC). These may be chapters, editions,
81  * angles or other types. For example: DVD chapters, Matroska chapters or cue sheet
82  * TOC. Such TOC will be useful for applications to display instead of just a
83  * playlist.
84  *
85  * Using TOC is very easy. Firstly, create GstToc structure which represents root
86  * contents of the source. You can also attach TOC-specific tags to it. Then fill
87  * it with GstTocEntry entries by appending them to the GstToc using
88  * gst_toc_append_entry(), and appending subentries to a GstTocEntry using
89  * gst_toc_entry_append_sub_entry().
90  *
91  * Note that root level of the TOC can contain only either editions or chapters. You
92  * should not mix them together at the same level. Otherwise you will get serialization
93  * /deserialization errors. Make sure that no one of the entries has negative start and
94  *  stop values.
95  *
96  * Use gst_event_new_toc() to create a new TOC GstEvent, and gst_event_parse_toc() to
97  * parse received TOC event. Use gst_event_new_toc_select() to create a new TOC select GstEvent,
98  * and gst_event_parse_toc_select() to parse received TOC select event. The same rule for
99  * the GstMessage: gst_message_new_toc() to create new TOC GstMessage, and
100  * gst_message_parse_toc() to parse received TOC message.
101  *
102  * TOCs can have global scope or current scope. Global scope TOCs contain
103  * all entries that can possibly be selected using a toc select event, and
104  * are what an application is usually interested in. TOCs with current scope
105  * only contain the parts of the TOC relevant to the currently selected/playing
106  * stream; the current scope TOC is used by downstream elements such as muxers
107  * to write correct TOC entries when transcoding files, for example. When
108  * playing a DVD, the global TOC would contain a hierarchy of all titles,
109  * chapters and angles, for example, while the current TOC would only contain
110  * the chapters for the currently playing title if playback of a specific
111  * title was requested.
112  *
113  * Applications and plugins should not rely on TOCs having a certain kind of
114  * structure, but should allow for different alternatives. For example, a
115  * simple CUE sheet embedded in a file may be presented as a flat list of
116  * track entries, or could have a top-level edition node (or some other
117  * alternative type entry) with track entries underneath that node; or even
118  * multiple top-level edition nodes (or some other alternative type entries)
119  * each with track entries underneath, in case the source file has extracted
120  * a track listing from different sources).
121  */
122 public class TocEntry
123 {
124 	
125 	/** the main Gtk struct */
126 	protected GstTocEntry* gstTocEntry;
127 	
128 	
129 	/** Get the main Gtk struct */
130 	public GstTocEntry* getTocEntryStruct()
131 	{
132 		return gstTocEntry;
133 	}
134 	
135 	
136 	/** the main Gtk struct as a void* */
137 	protected void* getStruct()
138 	{
139 		return cast(void*)gstTocEntry;
140 	}
141 	
142 	/**
143 	 * Sets our main struct and passes it to the parent class
144 	 */
145 	public this (GstTocEntry* gstTocEntry)
146 	{
147 		this.gstTocEntry = gstTocEntry;
148 	}
149 	
150 	/**
151 	 */
152 	
153 	/**
154 	 * Create new GstTocEntry structure.
155 	 * Params:
156 	 * type = entry type.
157 	 * uid = unique ID (UID) in the whole TOC.
158 	 * Throws: ConstructionException GTK+ fails to create the object.
159 	 */
160 	public this (GstTocEntryType type, string uid)
161 	{
162 		// GstTocEntry * gst_toc_entry_new (GstTocEntryType type,  const gchar *uid);
163 		auto p = gst_toc_entry_new(type, Str.toStringz(uid));
164 		if(p is null)
165 		{
166 			throw new ConstructionException("null returned by gst_toc_entry_new(type, Str.toStringz(uid))");
167 		}
168 		this(cast(GstTocEntry*) p);
169 	}
170 	
171 	/**
172 	 * Gets the parent GstToc of entry.
173 	 * Returns: The parent GstToc of entry. [transfer none]
174 	 */
175 	public Toc getToc()
176 	{
177 		// GstToc * gst_toc_entry_get_toc (GstTocEntry *entry);
178 		auto p = gst_toc_entry_get_toc(gstTocEntry);
179 		
180 		if(p is null)
181 		{
182 			return null;
183 		}
184 		
185 		return ObjectG.getDObject!(Toc)(cast(GstToc*) p);
186 	}
187 	
188 	/**
189 	 * Gets the UID of entry.
190 	 * Returns: The UID of entry. [transfer none]
191 	 */
192 	public string getUid()
193 	{
194 		// const gchar * gst_toc_entry_get_uid (const GstTocEntry *entry);
195 		return Str.toString(gst_toc_entry_get_uid(gstTocEntry));
196 	}
197 	
198 	/**
199 	 * Gets the parent GstTocEntry of entry.
200 	 * Returns: The parent GstTocEntry of entry. [transfer none]
201 	 */
202 	public TocEntry getParent()
203 	{
204 		// GstTocEntry * gst_toc_entry_get_parent (GstTocEntry *entry);
205 		auto p = gst_toc_entry_get_parent(gstTocEntry);
206 		
207 		if(p is null)
208 		{
209 			return null;
210 		}
211 		
212 		return ObjectG.getDObject!(TocEntry)(cast(GstTocEntry*) p);
213 	}
214 	
215 	/**
216 	 * Gets the sub-entries of entry.
217 	 * Returns: A GList of GstTocEntry of entry. [transfer none][element-type Gst.TocEntry]
218 	 */
219 	public ListG getSubEntries()
220 	{
221 		// GList * gst_toc_entry_get_sub_entries (const GstTocEntry *entry);
222 		auto p = gst_toc_entry_get_sub_entries(gstTocEntry);
223 		
224 		if(p is null)
225 		{
226 			return null;
227 		}
228 		
229 		return ObjectG.getDObject!(ListG)(cast(GList*) p);
230 	}
231 	
232 	/**
233 	 * Appends the GstTocEntry subentry to entry.
234 	 * Params:
235 	 * entry = A GstTocEntry instance
236 	 * subentry = A GstTocEntry. [transfer full]
237 	 */
238 	public void appendSubEntry(TocEntry subentry)
239 	{
240 		// void gst_toc_entry_append_sub_entry (GstTocEntry *entry,  GstTocEntry *subentry);
241 		gst_toc_entry_append_sub_entry(gstTocEntry, (subentry is null) ? null : subentry.getTocEntryStruct());
242 	}
243 	
244 	/**
245 	 * Get start and stop values from the entry and write them into appropriate storages.
246 	 * Params:
247 	 * start = the storage for the start value, leave NULL if not need. [out]
248 	 * stop = the storage for the stop value, leave NULL if not need. [out]
249 	 * Returns: TRUE if all non-NULL storage pointers were filled with appropriate values, FALSE otherwise.
250 	 */
251 	public int getStartStopTimes(out long start, out long stop)
252 	{
253 		// gboolean gst_toc_entry_get_start_stop_times (const GstTocEntry *entry,  gint64 *start,  gint64 *stop);
254 		return gst_toc_entry_get_start_stop_times(gstTocEntry, &start, &stop);
255 	}
256 	
257 	/**
258 	 * Set start and stop values for the entry.
259 	 * Params:
260 	 * start = start value to set.
261 	 * stop = stop value to set.
262 	 */
263 	public void setStartStopTimes(long start, long stop)
264 	{
265 		// void gst_toc_entry_set_start_stop_times (GstTocEntry *entry,  gint64 start,  gint64 stop);
266 		gst_toc_entry_set_start_stop_times(gstTocEntry, start, stop);
267 	}
268 	
269 	/**
270 	 * Gets the tags for entry.
271 	 * Returns: A GstTagList for entry. [transfer none]
272 	 */
273 	public TagList getTags()
274 	{
275 		// GstTagList * gst_toc_entry_get_tags (const GstTocEntry *entry);
276 		auto p = gst_toc_entry_get_tags(gstTocEntry);
277 		
278 		if(p is null)
279 		{
280 			return null;
281 		}
282 		
283 		return ObjectG.getDObject!(TagList)(cast(GstTagList*) p);
284 	}
285 	
286 	/**
287 	 * Merge tags into the existing tags of entry using mode.
288 	 * Params:
289 	 * tags = A GstTagList or NULL. [allow-none]
290 	 * mode = A GstTagMergeMode
291 	 */
292 	public void mergeTags(TagList tags, GstTagMergeMode mode)
293 	{
294 		// void gst_toc_entry_merge_tags (GstTocEntry *entry,  GstTagList *tags,  GstTagMergeMode mode);
295 		gst_toc_entry_merge_tags(gstTocEntry, (tags is null) ? null : tags.getTagListStruct(), mode);
296 	}
297 	
298 	/**
299 	 * Set a GstTagList with tags for the complete entry.
300 	 * Params:
301 	 * tags = A GstTagList or NULL. [allow-none][transfer full]
302 	 */
303 	public void setTags(TagList tags)
304 	{
305 		// void gst_toc_entry_set_tags (GstTocEntry *entry,  GstTagList *tags);
306 		gst_toc_entry_set_tags(gstTocEntry, (tags is null) ? null : tags.getTagListStruct());
307 	}
308 	
309 	/**
310 	 * Converts type to a string representation.
311 	 * Params:
312 	 * type = a GstTocEntryType.
313 	 * Returns: Returns a human-readable string for type. This string is only for debugging purpose and should not be displayed in a user interface.
314 	 */
315 	public static string typeGetNick(GstTocEntryType type)
316 	{
317 		// const gchar * gst_toc_entry_type_get_nick (GstTocEntryType type);
318 		return Str.toString(gst_toc_entry_type_get_nick(type));
319 	}
320 	
321 	/**
322 	 * Returns: entry's entry type
323 	 */
324 	public GstTocEntryType getEntryType()
325 	{
326 		// GstTocEntryType gst_toc_entry_get_entry_type (const GstTocEntry *entry);
327 		return gst_toc_entry_get_entry_type(gstTocEntry);
328 	}
329 	
330 	/**
331 	 * Returns: TRUE if entry's type is an alternative type, otherwise FALSE
332 	 */
333 	public int isAlternative()
334 	{
335 		// gboolean gst_toc_entry_is_alternative (const GstTocEntry *entry);
336 		return gst_toc_entry_is_alternative(gstTocEntry);
337 	}
338 	
339 	/**
340 	 * Returns: TRUE if entry's type is a sequence type, otherwise FALSE
341 	 */
342 	public int isSequence()
343 	{
344 		// gboolean gst_toc_entry_is_sequence (const GstTocEntry *entry);
345 		return gst_toc_entry_is_sequence(gstTocEntry);
346 	}
347 }