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 module gstreamer.TocEntry;
26 
27 private import glib.ConstructionException;
28 private import glib.ListG;
29 private import glib.Str;
30 private import gobject.ObjectG;
31 private import gstreamer.TagList;
32 private import gstreamer.Toc;
33 private import gstreamerc.gstreamer;
34 public  import gstreamerc.gstreamertypes;
35 
36 
37 /** */
38 public class TocEntry
39 {
40 	/** the main Gtk struct */
41 	protected GstTocEntry* gstTocEntry;
42 	protected bool ownedRef;
43 
44 	/** Get the main Gtk struct */
45 	public GstTocEntry* getTocEntryStruct()
46 	{
47 		return gstTocEntry;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected void* getStruct()
52 	{
53 		return cast(void*)gstTocEntry;
54 	}
55 
56 	/**
57 	 * Sets our main struct and passes it to the parent class.
58 	 */
59 	public this (GstTocEntry* gstTocEntry, bool ownedRef = false)
60 	{
61 		this.gstTocEntry = gstTocEntry;
62 		this.ownedRef = ownedRef;
63 	}
64 
65 
66 	/** */
67 	public static GType getType()
68 	{
69 		return gst_toc_entry_get_type();
70 	}
71 
72 	/**
73 	 * Create new #GstTocEntry structure.
74 	 *
75 	 * Params:
76 	 *     type = entry type.
77 	 *     uid = unique ID (UID) in the whole TOC.
78 	 *
79 	 * Return: newly allocated #GstTocEntry structure, free it with gst_toc_entry_unref().
80 	 *
81 	 * Throws: ConstructionException GTK+ fails to create the object.
82 	 */
83 	public this(GstTocEntryType type, string uid)
84 	{
85 		auto p = gst_toc_entry_new(type, Str.toStringz(uid));
86 		
87 		if(p is null)
88 		{
89 			throw new ConstructionException("null returned by new");
90 		}
91 		
92 		this(cast(GstTocEntry*) p);
93 	}
94 
95 	/**
96 	 * Appends the #GstTocEntry @subentry to @entry.
97 	 *
98 	 * Params:
99 	 *     subentry = A #GstTocEntry
100 	 */
101 	public void appendSubEntry(TocEntry subentry)
102 	{
103 		gst_toc_entry_append_sub_entry(gstTocEntry, (subentry is null) ? null : subentry.getTocEntryStruct());
104 	}
105 
106 	/**
107 	 * Return: @entry's entry type
108 	 */
109 	public GstTocEntryType getEntryType()
110 	{
111 		return gst_toc_entry_get_entry_type(gstTocEntry);
112 	}
113 
114 	/**
115 	 * Get @loop_type and @repeat_count values from the @entry and write them into
116 	 * appropriate storages. Loops are e.g. used by sampled instruments. GStreamer
117 	 * is not automatically applying the loop. The application can process this
118 	 * meta data and use it e.g. to send a seek-event to loop a section.
119 	 *
120 	 * Params:
121 	 *     loopType = the storage for the loop_type
122 	 *         value, leave %NULL if not need.
123 	 *     repeatCount = the storage for the repeat_count
124 	 *         value, leave %NULL if not need.
125 	 *
126 	 * Return: %TRUE if all non-%NULL storage pointers were filled with appropriate
127 	 *     values, %FALSE otherwise.
128 	 *
129 	 * Since: 1.4
130 	 */
131 	public bool getLoop(out GstTocLoopType loopType, out int repeatCount)
132 	{
133 		return gst_toc_entry_get_loop(gstTocEntry, &loopType, &repeatCount) != 0;
134 	}
135 
136 	/**
137 	 * Gets the parent #GstTocEntry of @entry.
138 	 *
139 	 * Return: The parent #GstTocEntry of @entry
140 	 */
141 	public TocEntry getParent()
142 	{
143 		auto p = gst_toc_entry_get_parent(gstTocEntry);
144 		
145 		if(p is null)
146 		{
147 			return null;
148 		}
149 		
150 		return ObjectG.getDObject!(TocEntry)(cast(GstTocEntry*) p);
151 	}
152 
153 	/**
154 	 * Get @start and @stop values from the @entry and write them into appropriate
155 	 * storages.
156 	 *
157 	 * Params:
158 	 *     start = the storage for the start value, leave
159 	 *         %NULL if not need.
160 	 *     stop = the storage for the stop value, leave
161 	 *         %NULL if not need.
162 	 *
163 	 * Return: %TRUE if all non-%NULL storage pointers were filled with appropriate
164 	 *     values, %FALSE otherwise.
165 	 */
166 	public bool getStartStopTimes(out long start, out long stop)
167 	{
168 		return gst_toc_entry_get_start_stop_times(gstTocEntry, &start, &stop) != 0;
169 	}
170 
171 	/**
172 	 * Gets the sub-entries of @entry.
173 	 *
174 	 * Return: A #GList of #GstTocEntry of @entry
175 	 */
176 	public ListG getSubEntries()
177 	{
178 		auto p = gst_toc_entry_get_sub_entries(gstTocEntry);
179 		
180 		if(p is null)
181 		{
182 			return null;
183 		}
184 		
185 		return new ListG(cast(GList*) p);
186 	}
187 
188 	/**
189 	 * Gets the tags for @entry.
190 	 *
191 	 * Return: A #GstTagList for @entry
192 	 */
193 	public TagList getTags()
194 	{
195 		auto p = gst_toc_entry_get_tags(gstTocEntry);
196 		
197 		if(p is null)
198 		{
199 			return null;
200 		}
201 		
202 		return ObjectG.getDObject!(TagList)(cast(GstTagList*) p);
203 	}
204 
205 	/**
206 	 * Gets the parent #GstToc of @entry.
207 	 *
208 	 * Return: The parent #GstToc of @entry
209 	 */
210 	public Toc getToc()
211 	{
212 		auto p = gst_toc_entry_get_toc(gstTocEntry);
213 		
214 		if(p is null)
215 		{
216 			return null;
217 		}
218 		
219 		return ObjectG.getDObject!(Toc)(cast(GstToc*) p);
220 	}
221 
222 	/**
223 	 * Gets the UID of @entry.
224 	 *
225 	 * Return: The UID of @entry
226 	 */
227 	public string getUid()
228 	{
229 		return Str.toString(gst_toc_entry_get_uid(gstTocEntry));
230 	}
231 
232 	/**
233 	 * Return: %TRUE if @entry's type is an alternative type, otherwise %FALSE
234 	 */
235 	public bool isAlternative()
236 	{
237 		return gst_toc_entry_is_alternative(gstTocEntry) != 0;
238 	}
239 
240 	/**
241 	 * Return: %TRUE if @entry's type is a sequence type, otherwise %FALSE
242 	 */
243 	public bool isSequence()
244 	{
245 		return gst_toc_entry_is_sequence(gstTocEntry) != 0;
246 	}
247 
248 	/**
249 	 * Merge @tags into the existing tags of @entry using @mode.
250 	 *
251 	 * Params:
252 	 *     tags = A #GstTagList or %NULL
253 	 *     mode = A #GstTagMergeMode
254 	 */
255 	public void mergeTags(TagList tags, GstTagMergeMode mode)
256 	{
257 		gst_toc_entry_merge_tags(gstTocEntry, (tags is null) ? null : tags.getTagListStruct(), mode);
258 	}
259 
260 	/**
261 	 * Set @loop_type and @repeat_count values for the @entry.
262 	 *
263 	 * Params:
264 	 *     loopType = loop_type value to set.
265 	 *     repeatCount = repeat_count value to set.
266 	 *
267 	 * Since: 1.4
268 	 */
269 	public void setLoop(GstTocLoopType loopType, int repeatCount)
270 	{
271 		gst_toc_entry_set_loop(gstTocEntry, loopType, repeatCount);
272 	}
273 
274 	/**
275 	 * Set @start and @stop values for the @entry.
276 	 *
277 	 * Params:
278 	 *     start = start value to set.
279 	 *     stop = stop value to set.
280 	 */
281 	public void setStartStopTimes(long start, long stop)
282 	{
283 		gst_toc_entry_set_start_stop_times(gstTocEntry, start, stop);
284 	}
285 
286 	/**
287 	 * Set a #GstTagList with tags for the complete @entry.
288 	 *
289 	 * Params:
290 	 *     tags = A #GstTagList or %NULL
291 	 */
292 	public void setTags(TagList tags)
293 	{
294 		gst_toc_entry_set_tags(gstTocEntry, (tags is null) ? null : tags.getTagListStruct());
295 	}
296 }