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