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