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