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  = gstreamer-GstCapsFeatures.html
27  * outPack = gstreamer
28  * outFile = CapsFeatures
29  * strct   = GstCapsFeatures
30  * realStrct=
31  * ctorStrct=
32  * clss    = CapsFeatures
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_caps_features_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * 	- gst_caps_features_new_any
45  * omit signals:
46  * imports:
47  * 	- glib.Str
48  * structWrap:
49  * 	- GstCapsFeatures* -> CapsFeatures
50  * module aliases:
51  * local aliases:
52  * overrides:
53  * 	- toString
54  */
55 
56 module gstreamer.CapsFeatures;
57 
58 public  import gstreamerc.gstreamertypes;
59 
60 private import gstreamerc.gstreamer;
61 private import glib.ConstructionException;
62 private import gobject.ObjectG;
63 
64 
65 private import glib.Str;
66 
67 
68 
69 
70 /**
71  * GstCapsFeatures can optionally be set on a GstCaps to add requirements
72  * for additional features for a specific GstStructure. Caps structures with
73  * the same name but with a non-equal set of caps features are not compatible.
74  * If a pad supports multiple sets of features it has to add multiple equal
75  * structures with different feature sets to the caps.
76  *
77  * Empty GstCapsFeatures are equivalent with the GstCapsFeatures that only
78  * contain GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY. ANY GstCapsFeatures as
79  * created by gst_caps_features_new_any() are equal to any other GstCapsFeatures
80  * and can be used to specify that any GstCapsFeatures would be supported, e.g.
81  * for elements that don't touch buffer memory. GstCaps with ANY GstCapsFeatures
82  * are considered non-fixed and during negotiation some GstCapsFeatures have
83  * to be selected.
84  *
85  * Examples for caps features would be the requirement of a specific GstMemory
86  * types or the requirement of having a specific GstMeta on the buffer. Features
87  * are given as a string of the format "memory:GstMemoryTypeName" or
88  * "meta:GstMetaAPIName".
89  */
90 public class CapsFeatures
91 {
92 	
93 	/** the main Gtk struct */
94 	protected GstCapsFeatures* gstCapsFeatures;
95 	
96 	
97 	public GstCapsFeatures* getCapsFeaturesStruct()
98 	{
99 		return gstCapsFeatures;
100 	}
101 	
102 	
103 	/** the main Gtk struct as a void* */
104 	protected void* getStruct()
105 	{
106 		return cast(void*)gstCapsFeatures;
107 	}
108 	
109 	/**
110 	 * Sets our main struct and passes it to the parent class
111 	 */
112 	public this (GstCapsFeatures* gstCapsFeatures)
113 	{
114 		this.gstCapsFeatures = gstCapsFeatures;
115 	}
116 	
117 	/**
118 	 */
119 	
120 	/**
121 	 * Creates a new, empty GstCapsFeatures.
122 	 * Free-function: gst_caps_features_free
123 	 * Since 1.2
124 	 * Throws: ConstructionException GTK+ fails to create the object.
125 	 */
126 	public this ()
127 	{
128 		// GstCapsFeatures * gst_caps_features_new_empty (void);
129 		auto p = gst_caps_features_new_empty();
130 		if(p is null)
131 		{
132 			throw new ConstructionException("null returned by gst_caps_features_new_empty()");
133 		}
134 		this(cast(GstCapsFeatures*) p);
135 	}
136 	
137 	/**
138 	 * Creates a new GstCapsFeatures with the given features.
139 	 * Free-function: gst_caps_features_free
140 	 * Since 1.2
141 	 * Params:
142 	 * feature1 = name of first feature to set
143 	 * varargs = variable argument list
144 	 * Throws: ConstructionException GTK+ fails to create the object.
145 	 */
146 	public this (GQuark feature1, void* varargs)
147 	{
148 		// GstCapsFeatures * gst_caps_features_new_id_valist (GQuark feature1,  va_list varargs);
149 		auto p = gst_caps_features_new_id_valist(feature1, varargs);
150 		if(p is null)
151 		{
152 			throw new ConstructionException("null returned by gst_caps_features_new_id_valist(feature1, varargs)");
153 		}
154 		this(cast(GstCapsFeatures*) p);
155 	}
156 	
157 	/**
158 	 * Creates a new GstCapsFeatures with the given features.
159 	 * Free-function: gst_caps_features_free
160 	 * Since 1.2
161 	 * Params:
162 	 * feature1 = name of first feature to set
163 	 * varargs = variable argument list
164 	 * Throws: ConstructionException GTK+ fails to create the object.
165 	 */
166 	public this (string feature1, void* varargs)
167 	{
168 		// GstCapsFeatures * gst_caps_features_new_valist (const gchar *feature1,  va_list varargs);
169 		auto p = gst_caps_features_new_valist(Str.toStringz(feature1), varargs);
170 		if(p is null)
171 		{
172 			throw new ConstructionException("null returned by gst_caps_features_new_valist(Str.toStringz(feature1), varargs)");
173 		}
174 		this(cast(GstCapsFeatures*) p);
175 	}
176 	
177 	/**
178 	 * Duplicates a GstCapsFeatures and all its values.
179 	 * Free-function: gst_caps_features_free
180 	 * Since 1.2
181 	 * Returns: a new GstCapsFeatures. [transfer full]
182 	 */
183 	public CapsFeatures copy()
184 	{
185 		// GstCapsFeatures * gst_caps_features_copy (const GstCapsFeatures *features);
186 		auto p = gst_caps_features_copy(gstCapsFeatures);
187 		
188 		if(p is null)
189 		{
190 			return null;
191 		}
192 		
193 		return ObjectG.getDObject!(CapsFeatures)(cast(GstCapsFeatures*) p);
194 	}
195 	
196 	/**
197 	 * Frees a GstCapsFeatures and all its values. The caps features must not
198 	 * have a parent when this function is called.
199 	 * Since 1.2
200 	 */
201 	public void free()
202 	{
203 		// void gst_caps_features_free (GstCapsFeatures *features);
204 		gst_caps_features_free(gstCapsFeatures);
205 	}
206 	
207 	/**
208 	 * Creates a GstCapsFeatures from a string representation.
209 	 * Free-function: gst_caps_features_free
210 	 * Since 1.2
211 	 * Params:
212 	 * features = a string representation of a GstCapsFeatures.
213 	 * Returns: a new GstCapsFeatures or NULL when the string could not be parsed. Free with gst_caps_features_free() after use. [transfer full]
214 	 */
215 	public static CapsFeatures fromString(string features)
216 	{
217 		// GstCapsFeatures * gst_caps_features_from_string (const gchar *features);
218 		auto p = gst_caps_features_from_string(Str.toStringz(features));
219 		
220 		if(p is null)
221 		{
222 			return null;
223 		}
224 		
225 		return ObjectG.getDObject!(CapsFeatures)(cast(GstCapsFeatures*) p);
226 	}
227 	
228 	/**
229 	 * Converts features to a human-readable string representation.
230 	 * Since 1.2
231 	 * Returns: a pointer to string allocated by g_malloc(). g_free() after usage. [transfer full]
232 	 */
233 	public override string toString()
234 	{
235 		// gchar * gst_caps_features_to_string (const GstCapsFeatures *features);
236 		return Str.toString(gst_caps_features_to_string(gstCapsFeatures));
237 	}
238 	
239 	/**
240 	 * Sets the parent_refcount field of GstCapsFeatures. This field is used to
241 	 * determine whether a caps features is mutable or not. This function should only be
242 	 * called by code implementing parent objects of GstCapsFeatures, as described in
243 	 * the MT Refcounting section of the design documents.
244 	 * Since 1.2
245 	 * Params:
246 	 * refcount = a pointer to the parent's refcount. [in]
247 	 * Returns: TRUE if the parent refcount could be set.
248 	 */
249 	public int setParentRefcount(int* refcount)
250 	{
251 		// gboolean gst_caps_features_set_parent_refcount  (GstCapsFeatures *features,  gint *refcount);
252 		return gst_caps_features_set_parent_refcount(gstCapsFeatures, refcount);
253 	}
254 	
255 	/**
256 	 * Check if features1 and features2 are equal.
257 	 * Since 1.2
258 	 * Params:
259 	 * features2 = a GstCapsFeatures.
260 	 * Returns: TRUE if features1 and features2 are equal.
261 	 */
262 	public int isEqual(CapsFeatures features2)
263 	{
264 		// gboolean gst_caps_features_is_equal (const GstCapsFeatures *features1,  const GstCapsFeatures *features2);
265 		return gst_caps_features_is_equal(gstCapsFeatures, (features2 is null) ? null : features2.getCapsFeaturesStruct());
266 	}
267 	
268 	/**
269 	 * Check if features is GST_CAPS_FEATURES_ANY.
270 	 * Since 1.2
271 	 * Returns: TRUE if features is GST_CAPS_FEATURES_ANY.
272 	 */
273 	public int isAny()
274 	{
275 		// gboolean gst_caps_features_is_any (const GstCapsFeatures *features);
276 		return gst_caps_features_is_any(gstCapsFeatures);
277 	}
278 	
279 	/**
280 	 * Check if features contains feature.
281 	 * Since 1.2
282 	 * Params:
283 	 * feature = a feature
284 	 * Returns: TRUE if features contains feature.
285 	 */
286 	public int contains(string feature)
287 	{
288 		// gboolean gst_caps_features_contains (const GstCapsFeatures *features,  const gchar *feature);
289 		return gst_caps_features_contains(gstCapsFeatures, Str.toStringz(feature));
290 	}
291 	
292 	/**
293 	 * Check if features contains feature.
294 	 * Since 1.2
295 	 * Params:
296 	 * feature = a feature
297 	 * Returns: TRUE if features contains feature.
298 	 */
299 	public int containsId(GQuark feature)
300 	{
301 		// gboolean gst_caps_features_contains_id (const GstCapsFeatures *features,  GQuark feature);
302 		return gst_caps_features_contains_id(gstCapsFeatures, feature);
303 	}
304 	
305 	/**
306 	 * Returns the number of features in features.
307 	 * Since 1.2
308 	 * Returns: The number of features in features.
309 	 */
310 	public uint getSize()
311 	{
312 		// guint gst_caps_features_get_size (const GstCapsFeatures *features);
313 		return gst_caps_features_get_size(gstCapsFeatures);
314 	}
315 	
316 	/**
317 	 * Returns the i-th feature of features.
318 	 * Since 1.2
319 	 * Params:
320 	 * i = index of the feature
321 	 * Returns: The i-th feature of features.
322 	 */
323 	public string getNth(uint i)
324 	{
325 		// const gchar * gst_caps_features_get_nth (const GstCapsFeatures *features,  guint i);
326 		return Str.toString(gst_caps_features_get_nth(gstCapsFeatures, i));
327 	}
328 	
329 	/**
330 	 * Returns the i-th feature of features.
331 	 * Since 1.2
332 	 * Params:
333 	 * i = index of the feature
334 	 * Returns: The i-th feature of features.
335 	 */
336 	public GQuark getNthId(uint i)
337 	{
338 		// GQuark gst_caps_features_get_nth_id (const GstCapsFeatures *features,  guint i);
339 		return gst_caps_features_get_nth_id(gstCapsFeatures, i);
340 	}
341 	
342 	/**
343 	 * Adds feature to features.
344 	 * Since 1.2
345 	 * Params:
346 	 * feature = a feature.
347 	 */
348 	public void add(string feature)
349 	{
350 		// void gst_caps_features_add (GstCapsFeatures *features,  const gchar *feature);
351 		gst_caps_features_add(gstCapsFeatures, Str.toStringz(feature));
352 	}
353 	
354 	/**
355 	 * Adds feature to features.
356 	 * Since 1.2
357 	 * Params:
358 	 * feature = a feature.
359 	 */
360 	public void addId(GQuark feature)
361 	{
362 		// void gst_caps_features_add_id (GstCapsFeatures *features,  GQuark feature);
363 		gst_caps_features_add_id(gstCapsFeatures, feature);
364 	}
365 	
366 	/**
367 	 * Removes feature from features.
368 	 * Since 1.2
369 	 * Params:
370 	 * feature = a feature.
371 	 */
372 	public void remove(string feature)
373 	{
374 		// void gst_caps_features_remove (GstCapsFeatures *features,  const gchar *feature);
375 		gst_caps_features_remove(gstCapsFeatures, Str.toStringz(feature));
376 	}
377 	
378 	/**
379 	 * Removes feature from features.
380 	 * Since 1.2
381 	 * Params:
382 	 * feature = a feature.
383 	 */
384 	public void removeId(GQuark feature)
385 	{
386 		// void gst_caps_features_remove_id (GstCapsFeatures *features,  GQuark feature);
387 		gst_caps_features_remove_id(gstCapsFeatures, feature);
388 	}
389 }