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