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 change21 // find conversion definition on APILookup.txt22 // implement new conversion functionalities on the wrap.utils pakage23 24 25 modulegstreamer.CapsFeatures;
26 27 privateimportglib.ConstructionException;
28 privateimportglib.Str;
29 privateimportglib.c.functions;
30 privateimportgobject.ObjectG;
31 privateimportgstreamer.c.functions;
32 publicimportgstreamer.c.types;
33 privateimportgtkd.Loader;
34 35 36 /**
37 * #GstCapsFeatures can optionally be set on a #GstCaps to add requirements
38 * for additional features for a specific #GstStructure. Caps structures with
39 * the same name but with a non-equal set of caps features are not compatible.
40 * If a pad supports multiple sets of features it has to add multiple equal
41 * structures with different feature sets to the caps.
42 *
43 * Empty #GstCapsFeatures are equivalent with the #GstCapsFeatures that only
44 * contain #GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY. ANY #GstCapsFeatures as
45 * created by gst_caps_features_new_any() are equal to any other #GstCapsFeatures
46 * and can be used to specify that any #GstCapsFeatures would be supported, e.g.
47 * for elements that don't touch buffer memory. #GstCaps with ANY #GstCapsFeatures
48 * are considered non-fixed and during negotiation some #GstCapsFeatures have
49 * to be selected.
50 *
51 * Examples for caps features would be the requirement of a specific #GstMemory
52 * types or the requirement of having a specific #GstMeta on the buffer. Features
53 * are given as a string of the format "memory:GstMemoryTypeName" or
54 * "meta:GstMetaAPIName".
55 *
56 * Since: 1.2
57 */58 publicclassCapsFeatures59 {
60 /** the main Gtk struct */61 protectedGstCapsFeatures* gstCapsFeatures;
62 protectedboolownedRef;
63 64 /** Get the main Gtk struct */65 publicGstCapsFeatures* getCapsFeaturesStruct(booltransferOwnership = false)
66 {
67 if (transferOwnership)
68 ownedRef = false;
69 returngstCapsFeatures;
70 }
71 72 /** the main Gtk struct as a void* */73 protectedvoid* getStruct()
74 {
75 returncast(void*)gstCapsFeatures;
76 }
77 78 /**
79 * Sets our main struct and passes it to the parent class.
80 */81 publicthis (GstCapsFeatures* gstCapsFeatures, boolownedRef = false)
82 {
83 this.gstCapsFeatures = gstCapsFeatures;
84 this.ownedRef = ownedRef;
85 }
86 87 ~this ()
88 {
89 if ( Linker.isLoaded(LIBRARY_GSTREAMER) && ownedRef )
90 gst_caps_features_free(gstCapsFeatures);
91 }
92 93 /**
94 * Creates a new, ANY #GstCapsFeatures. This will be equal
95 * to any other #GstCapsFeatures but caps with these are
96 * unfixed.
97 *
98 * Free-function: gst_caps_features_free
99 *
100 * Return: a new, ANY #GstCapsFeatures
101 *
102 * Since: 1.2
103 *
104 * Throws: ConstructionException GTK+ fails to create the object.
105 */106 publicstaticnewAny()
107 {
108 autop = gst_caps_features_new_any();
109 110 if(pisnull)
111 {
112 thrownewConstructionException("null returned by new_any");
113 }
114 115 returnnewCapsFeatures(cast(GstCapsFeatures*)p);
116 }
117 118 /**
119 */120 121 /** */122 publicstaticGTypegetType()
123 {
124 returngst_caps_features_get_type();
125 }
126 127 /**
128 * Creates a new, empty #GstCapsFeatures.
129 *
130 * Free-function: gst_caps_features_free
131 *
132 * Returns: a new, empty #GstCapsFeatures
133 *
134 * Since: 1.2
135 *
136 * Throws: ConstructionException GTK+ fails to create the object.
137 */138 publicthis()
139 {
140 auto__p = gst_caps_features_new_empty();
141 142 if(__pisnull)
143 {
144 thrownewConstructionException("null returned by new_empty");
145 }
146 147 this(cast(GstCapsFeatures*) __p);
148 }
149 150 /**
151 * Creates a new #GstCapsFeatures with the given features.
152 *
153 * Free-function: gst_caps_features_free
154 *
155 * Params:
156 * feature1 = name of first feature to set
157 * varargs = variable argument list
158 *
159 * Returns: a new, empty #GstCapsFeatures
160 *
161 * Since: 1.2
162 *
163 * Throws: ConstructionException GTK+ fails to create the object.
164 */165 publicthis(GQuarkfeature1, void* varargs)
166 {
167 auto__p = gst_caps_features_new_id_valist(feature1, varargs);
168 169 if(__pisnull)
170 {
171 thrownewConstructionException("null returned by new_id_valist");
172 }
173 174 this(cast(GstCapsFeatures*) __p);
175 }
176 177 /**
178 * Creates a new #GstCapsFeatures with the given features.
179 *
180 * Free-function: gst_caps_features_free
181 *
182 * Params:
183 * feature1 = name of first feature to set
184 * varargs = variable argument list
185 *
186 * Returns: a new, empty #GstCapsFeatures
187 *
188 * Since: 1.2
189 *
190 * Throws: ConstructionException GTK+ fails to create the object.
191 */192 publicthis(stringfeature1, void* varargs)
193 {
194 auto__p = gst_caps_features_new_valist(Str.toStringz(feature1), varargs);
195 196 if(__pisnull)
197 {
198 thrownewConstructionException("null returned by new_valist");
199 }
200 201 this(cast(GstCapsFeatures*) __p);
202 }
203 204 /**
205 * Adds @feature to @features.
206 *
207 * Params:
208 * feature = a feature.
209 *
210 * Since: 1.2
211 */212 publicvoidadd(stringfeature)
213 {
214 gst_caps_features_add(gstCapsFeatures, Str.toStringz(feature));
215 }
216 217 /**
218 * Adds @feature to @features.
219 *
220 * Params:
221 * feature = a feature.
222 *
223 * Since: 1.2
224 */225 publicvoidaddId(GQuarkfeature)
226 {
227 gst_caps_features_add_id(gstCapsFeatures, feature);
228 }
229 230 /**
231 * Check if @features contains @feature.
232 *
233 * Params:
234 * feature = a feature
235 *
236 * Returns: %TRUE if @features contains @feature.
237 *
238 * Since: 1.2
239 */240 publicboolcontains(stringfeature)
241 {
242 returngst_caps_features_contains(gstCapsFeatures, Str.toStringz(feature)) != 0;
243 }
244 245 /**
246 * Check if @features contains @feature.
247 *
248 * Params:
249 * feature = a feature
250 *
251 * Returns: %TRUE if @features contains @feature.
252 *
253 * Since: 1.2
254 */255 publicboolcontainsId(GQuarkfeature)
256 {
257 returngst_caps_features_contains_id(gstCapsFeatures, feature) != 0;
258 }
259 260 /**
261 * Duplicates a #GstCapsFeatures and all its values.
262 *
263 * Free-function: gst_caps_features_free
264 *
265 * Returns: a new #GstCapsFeatures.
266 *
267 * Since: 1.2
268 */269 publicCapsFeaturescopy()
270 {
271 auto__p = gst_caps_features_copy(gstCapsFeatures);
272 273 if(__pisnull)
274 {
275 returnnull;
276 }
277 278 returnObjectG.getDObject!(CapsFeatures)(cast(GstCapsFeatures*) __p, true);
279 }
280 281 /**
282 * Frees a #GstCapsFeatures and all its values. The caps features must not
283 * have a parent when this function is called.
284 *
285 * Since: 1.2
286 */287 publicvoidfree()
288 {
289 gst_caps_features_free(gstCapsFeatures);
290 ownedRef = false;
291 }
292 293 /**
294 * Returns the @i-th feature of @features.
295 *
296 * Params:
297 * i = index of the feature
298 *
299 * Returns: The @i-th feature of @features.
300 *
301 * Since: 1.2
302 */303 publicstringgetNth(uinti)
304 {
305 returnStr.toString(gst_caps_features_get_nth(gstCapsFeatures, i));
306 }
307 308 /**
309 * Returns the @i-th feature of @features.
310 *
311 * Params:
312 * i = index of the feature
313 *
314 * Returns: The @i-th feature of @features.
315 *
316 * Since: 1.2
317 */318 publicGQuarkgetNthId(uinti)
319 {
320 returngst_caps_features_get_nth_id(gstCapsFeatures, i);
321 }
322 323 /**
324 * Returns the number of features in @features.
325 *
326 * Returns: The number of features in @features.
327 *
328 * Since: 1.2
329 */330 publicuintgetSize()
331 {
332 returngst_caps_features_get_size(gstCapsFeatures);
333 }
334 335 /**
336 * Check if @features is %GST_CAPS_FEATURES_ANY.
337 *
338 * Returns: %TRUE if @features is %GST_CAPS_FEATURES_ANY.
339 *
340 * Since: 1.2
341 */342 publicboolisAny()
343 {
344 returngst_caps_features_is_any(gstCapsFeatures) != 0;
345 }
346 347 /**
348 * Check if @features1 and @features2 are equal.
349 *
350 * Params:
351 * features2 = a #GstCapsFeatures.
352 *
353 * Returns: %TRUE if @features1 and @features2 are equal.
354 *
355 * Since: 1.2
356 */357 publicboolisEqual(CapsFeaturesfeatures2)
358 {
359 returngst_caps_features_is_equal(gstCapsFeatures, (features2isnull) ? null : features2.getCapsFeaturesStruct()) != 0;
360 }
361 362 /**
363 * Removes @feature from @features.
364 *
365 * Params:
366 * feature = a feature.
367 *
368 * Since: 1.2
369 */370 publicvoidremove(stringfeature)
371 {
372 gst_caps_features_remove(gstCapsFeatures, Str.toStringz(feature));
373 }
374 375 /**
376 * Removes @feature from @features.
377 *
378 * Params:
379 * feature = a feature.
380 *
381 * Since: 1.2
382 */383 publicvoidremoveId(GQuarkfeature)
384 {
385 gst_caps_features_remove_id(gstCapsFeatures, feature);
386 }
387 388 /**
389 * Sets the parent_refcount field of #GstCapsFeatures. This field is used to
390 * determine whether a caps features is mutable or not. This function should only be
391 * called by code implementing parent objects of #GstCapsFeatures, as described in
392 * the MT Refcounting section of the design documents.
393 *
394 * Params:
395 * refcount = a pointer to the parent's refcount
396 *
397 * Returns: %TRUE if the parent refcount could be set.
398 *
399 * Since: 1.2
400 */401 publicboolsetParentRefcount(int* refcount)
402 {
403 returngst_caps_features_set_parent_refcount(gstCapsFeatures, refcount) != 0;
404 }
405 406 /**
407 * Converts @features to a human-readable string representation.
408 *
409 * For debugging purposes its easier to do something like this:
410 * |[<!-- language="C" -->
411 * GST_LOG ("features is %" GST_PTR_FORMAT, features);
412 * ]|
413 * This prints the features in human readable form.
414 *
415 * Free-function: g_free
416 *
417 * Returns: a pointer to string allocated by g_malloc().
418 * g_free() after usage.
419 *
420 * Since: 1.2
421 */422 publicoverridestringtoString()
423 {
424 autoretStr = gst_caps_features_to_string(gstCapsFeatures);
425 426 scope(exit) Str.freeString(retStr);
427 returnStr.toString(retStr);
428 }
429 430 /**
431 * Creates a #GstCapsFeatures from a string representation.
432 *
433 * Free-function: gst_caps_features_free
434 *
435 * Params:
436 * features = a string representation of a #GstCapsFeatures.
437 *
438 * Returns: a new #GstCapsFeatures or
439 * %NULL when the string could not be parsed. Free with
440 * gst_caps_features_free() after use.
441 *
442 * Since: 1.2
443 */444 publicstaticCapsFeaturesfromString(stringfeatures)
445 {
446 auto__p = gst_caps_features_from_string(Str.toStringz(features));
447 448 if(__pisnull)
449 {
450 returnnull;
451 }
452 453 returnObjectG.getDObject!(CapsFeatures)(cast(GstCapsFeatures*) __p, true);
454 }
455 }