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