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