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-GstQuery.html 27 * outPack = gstreamer 28 * outFile = Query 29 * strct = GstQuery 30 * realStrct= 31 * ctorStrct= 32 * clss = Query 33 * interf = 34 * class Code: Yes 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_query_ 41 * - gst_ 42 * omit structs: 43 * omit prefixes: 44 * omit code: 45 * - gst_query_new_position 46 * - gst_query_new_duration 47 * - gst_query_new_seeking 48 * - gst_query_new_formats 49 * - gst_query_new_segment 50 * omit signals: 51 * imports: 52 * - glib.Str 53 * - gstreamer.Iterator 54 * - gstreamer.Structure 55 * structWrap: 56 * - GstIterator* -> Iterator 57 * - GstQuery* -> Query 58 * - GstStructure* -> Structure 59 * module aliases: 60 * local aliases: 61 * overrides: 62 */ 63 64 module gstreamer.Query; 65 66 public import gstreamerc.gstreamertypes; 67 68 private import gstreamerc.gstreamer; 69 private import glib.ConstructionException; 70 private import gobject.ObjectG; 71 72 73 private import glib.Str; 74 private import gstreamer.Iterator; 75 private import gstreamer.Structure; 76 77 78 79 80 /** 81 * Description 82 * GstQuery functions are used to register a new query types to the gstreamer 83 * core. 84 * Query types can be used to perform queries on pads and elements. 85 * Queries can be created using the gst_query_new_xxx() functions. 86 * Query values can be set using gst_query_set_xxx(), and parsed using 87 * gst_query_parse_xxx() helpers. 88 * The following example shows how to query the duration of a pipeline: 89 * $(DDOC_COMMENT example) 90 * Last reviewed on 2006-02-14 (0.10.4) 91 */ 92 public class Query 93 { 94 95 /** the main Gtk struct */ 96 protected GstQuery* gstQuery; 97 98 99 public GstQuery* getQueryStruct() 100 { 101 return gstQuery; 102 } 103 104 105 /** the main Gtk struct as a void* */ 106 protected void* getStruct() 107 { 108 return cast(void*)gstQuery; 109 } 110 111 /** 112 * Sets our main struct and passes it to the parent class 113 */ 114 public this (GstQuery* gstQuery) 115 { 116 this.gstQuery = gstQuery; 117 } 118 119 /** 120 * Constructs a new query stream position query object. Use gst_query_unref() 121 * when done with it. A position query is used to query the current position 122 * of playback in the streams, in some format. 123 * Params: 124 * format = the default GstFormat for the new query 125 * Returns: 126 * A GstQuery 127 */ 128 public static Query newPosition(GstFormat format) 129 { 130 // GstQuery* gst_query_new_position (GstFormat format); 131 return new Query( cast(GstQuery*)gst_query_new_position(format) ); 132 } /** 133 * Constructs a new stream duration query object to query in the given format. 134 * Use gst_query_unref() when done with it. A duration query will give the 135 * total length of the stream. 136 * Params: 137 * format = the GstFormat for this duration query 138 * Returns: 139 * A GstQuery 140 */ 141 public static Query newDuration(GstFormat format) 142 { 143 // GstQuery* gst_query_new_duration (GstFormat format); 144 return new Query( cast(GstQuery*)gst_query_new_duration(format) ); 145 } /** 146 * Constructs a new query object for querying seeking properties of 147 * the stream. 148 * Params: 149 * format = the default GstFormat for the new query 150 * Returns: 151 * A GstQuery 152 */ 153 public static Query newSeeking(GstFormat format) 154 { 155 // GstQuery* gst_query_new_seeking (GstFormat format); 156 return new Query(cast(GstQuery*)gst_query_new_seeking(format) ); 157 } /** 158 * Constructs a new query object for querying formats of 159 * the stream. 160 * Since 0.10.4 161 * Returns: 162 * A GstQuery 163 */ 164 public static Query newFormats() 165 { 166 // GstQuery* gst_query_new_formats (void); 167 return new Query(cast(GstQuery*)gst_query_new_formats() ); 168 } /** 169 * Constructs a new segment query object. Use gst_query_unref() 170 * when done with it. A segment query is used to discover information about the 171 * currently configured segment for playback. 172 * Params: 173 * format = the GstFormat for the new query 174 * Returns: 175 * a GstQuery 176 */ 177 public static Query newSegment(GstFormat format) 178 { 179 // GstQuery* gst_query_new_segment (GstFormat format); 180 return new Query(cast(GstQuery*)gst_query_new_segment(format) ); 181 } 182 183 /** 184 */ 185 186 /** 187 * Get a printable name for the given query type. Do not modify or free. 188 * Params: 189 * query = the query type 190 * Returns: a reference to the static name of the query. 191 */ 192 public static string typeGetName(GstQueryType query) 193 { 194 // const gchar* gst_query_type_get_name (GstQueryType query); 195 return Str.toString(gst_query_type_get_name(query)); 196 } 197 198 /** 199 * Get the unique quark for the given query type. 200 * Params: 201 * query = the query type 202 * Returns: the quark associated with the query type 203 */ 204 public static GQuark typeToQuark(GstQueryType query) 205 { 206 // GQuark gst_query_type_to_quark (GstQueryType query); 207 return gst_query_type_to_quark(query); 208 } 209 210 /** 211 * Create a new GstQueryType based on the nick or return an 212 * already registered query with that nick 213 * Params: 214 * nick = The nick of the new query 215 * description = The description of the new query 216 * Returns: A new GstQueryType or an already registered query with the same nick. 217 */ 218 public static GstQueryType typeRegister(string nick, string description) 219 { 220 // GstQueryType gst_query_type_register (const gchar *nick, const gchar *description); 221 return gst_query_type_register(Str.toStringz(nick), Str.toStringz(description)); 222 } 223 224 /** 225 * Get the query type registered with nick. 226 * Params: 227 * nick = The nick of the query 228 * Returns: The query registered with nick or GST_QUERY_NONE if the query was not registered. 229 */ 230 public static GstQueryType typeGetByNick(string nick) 231 { 232 // GstQueryType gst_query_type_get_by_nick (const gchar *nick); 233 return gst_query_type_get_by_nick(Str.toStringz(nick)); 234 } 235 236 /** 237 * See if the given GstQueryType is inside the types query types array. 238 * Params: 239 * types = The query array to search 240 * type = the GstQueryType to find 241 * Returns: TRUE if the type is found inside the array 242 */ 243 public static int typesContains(GstQueryType* types, GstQueryType type) 244 { 245 // gboolean gst_query_types_contains (const GstQueryType *types, GstQueryType type); 246 return gst_query_types_contains(types, type); 247 } 248 249 /** 250 * Get details about the given GstQueryType. 251 * Params: 252 * type = a GstQueryType 253 * Returns: The GstQueryTypeDefinition for type or NULL on failure. 254 */ 255 public static GstQueryTypeDefinition* typeGetDetails(GstQueryType type) 256 { 257 // const GstQueryTypeDefinition* gst_query_type_get_details (GstQueryType type); 258 return gst_query_type_get_details(type); 259 } 260 261 /** 262 * Get a GstIterator of all the registered query types. The definitions 263 * iterated over are read only. 264 * Returns: A GstIterator of GstQueryTypeDefinition. 265 */ 266 public static Iterator typeIterateDefinitions() 267 { 268 // GstIterator* gst_query_type_iterate_definitions (void); 269 auto p = gst_query_type_iterate_definitions(); 270 271 if(p is null) 272 { 273 return null; 274 } 275 276 return ObjectG.getDObject!(Iterator)(cast(GstIterator*) p); 277 } 278 279 /** 280 * Constructs a new custom application query object. Use gst_query_unref() 281 * when done with it. 282 * Params: 283 * type = the query type 284 * structure = a structure for the query 285 * Throws: ConstructionException GTK+ fails to create the object. 286 */ 287 public this (GstQueryType type, Structure structure) 288 { 289 // GstQuery* gst_query_new_application (GstQueryType type, GstStructure *structure); 290 auto p = gst_query_new_application(type, (structure is null) ? null : structure.getStructureStruct()); 291 if(p is null) 292 { 293 throw new ConstructionException("null returned by gst_query_new_application(type, (structure is null) ? null : structure.getStructureStruct())"); 294 } 295 this(cast(GstQuery*) p); 296 } 297 298 /** 299 * Get the structure of a query. 300 * Returns: The GstStructure of the query. The structure is still owned by the query and will therefore be freed when the query is unreffed. 301 */ 302 public Structure getStructure() 303 { 304 // GstStructure* gst_query_get_structure (GstQuery *query); 305 auto p = gst_query_get_structure(gstQuery); 306 307 if(p is null) 308 { 309 return null; 310 } 311 312 return ObjectG.getDObject!(Structure)(cast(GstStructure*) p); 313 } 314 315 /** 316 * Constructs a new convert query object. Use gst_query_unref() 317 * when done with it. A convert query is used to ask for a conversion between 318 * one format and another. 319 * Params: 320 * srcFormat = the source GstFormat for the new query 321 * value = the value to convert 322 * destFormat = the target GstFormat 323 * Throws: ConstructionException GTK+ fails to create the object. 324 */ 325 public this (GstFormat srcFormat, long value, GstFormat destFormat) 326 { 327 // GstQuery* gst_query_new_convert (GstFormat src_format, gint64 value, GstFormat dest_format); 328 auto p = gst_query_new_convert(srcFormat, value, destFormat); 329 if(p is null) 330 { 331 throw new ConstructionException("null returned by gst_query_new_convert(srcFormat, value, destFormat)"); 332 } 333 this(cast(GstQuery*) p); 334 } 335 336 /** 337 * Answer a convert query by setting the requested values. 338 * Params: 339 * srcFormat = the source GstFormat 340 * srcValue = the source value 341 * destFormat = the destination GstFormat 342 * destValue = the destination value 343 */ 344 public void setConvert(GstFormat srcFormat, long srcValue, GstFormat destFormat, long destValue) 345 { 346 // void gst_query_set_convert (GstQuery *query, GstFormat src_format, gint64 src_value, GstFormat dest_format, gint64 dest_value); 347 gst_query_set_convert(gstQuery, srcFormat, srcValue, destFormat, destValue); 348 } 349 350 /** 351 * Parse a convert query answer. Any of src_format, src_value, dest_format, 352 * and dest_value may be NULL, in which case that value is omitted. 353 * Params: 354 * srcFormat = the storage for the GstFormat of the source value, or NULL 355 * srcValue = the storage for the source value, or NULL 356 * destFormat = the storage for the GstFormat of the destination value, or NULL 357 * destValue = the storage for the destination value, or NULL 358 */ 359 public void parseConvert(ref GstFormat srcFormat, ref long srcValue, ref GstFormat destFormat, ref long destValue) 360 { 361 // void gst_query_parse_convert (GstQuery *query, GstFormat *src_format, gint64 *src_value, GstFormat *dest_format, gint64 *dest_value); 362 gst_query_parse_convert(gstQuery, &srcFormat, &srcValue, &destFormat, &destValue); 363 } 364 365 /** 366 * Answer a position query by setting the requested value in the given format. 367 * Params: 368 * format = the requested GstFormat 369 * cur = the position to set 370 */ 371 public void setPosition(GstFormat format, long cur) 372 { 373 // void gst_query_set_position (GstQuery *query, GstFormat format, gint64 cur); 374 gst_query_set_position(gstQuery, format, cur); 375 } 376 377 /** 378 * Parse a position query, writing the format into format, and the position 379 * into cur, if the respective parameters are non-NULL. 380 * Params: 381 * format = the storage for the GstFormat of the position values (may be NULL) 382 * cur = the storage for the current position (may be NULL) 383 */ 384 public void parsePosition(ref GstFormat format, ref long cur) 385 { 386 // void gst_query_parse_position (GstQuery *query, GstFormat *format, gint64 *cur); 387 gst_query_parse_position(gstQuery, &format, &cur); 388 } 389 390 /** 391 * Answer a duration query by setting the requested value in the given format. 392 * Params: 393 * format = the GstFormat for the duration 394 * duration = the duration of the stream 395 */ 396 public void setDuration(GstFormat format, long duration) 397 { 398 // void gst_query_set_duration (GstQuery *query, GstFormat format, gint64 duration); 399 gst_query_set_duration(gstQuery, format, duration); 400 } 401 402 /** 403 * Parse a duration query answer. Write the format of the duration into format, 404 * and the value into duration, if the respective variables are non-NULL. 405 * Params: 406 * format = the storage for the GstFormat of the duration value, or NULL. 407 * duration = the storage for the total duration, or NULL. 408 */ 409 public void parseDuration(ref GstFormat format, ref long duration) 410 { 411 // void gst_query_parse_duration (GstQuery *query, GstFormat *format, gint64 *duration); 412 gst_query_parse_duration(gstQuery, &format, &duration); 413 } 414 415 /** 416 * Constructs a new latency query object. 417 * Use gst_query_unref() when done with it. A latency query is usually performed 418 * by sinks to compensate for additional latency introduced by elements in the 419 * pipeline. 420 * Throws: ConstructionException GTK+ fails to create the object. 421 */ 422 public this () 423 { 424 // GstQuery* gst_query_new_latency (void); 425 auto p = gst_query_new_latency(); 426 if(p is null) 427 { 428 throw new ConstructionException("null returned by gst_query_new_latency()"); 429 } 430 this(cast(GstQuery*) p); 431 } 432 433 /** 434 * Parse a latency query answer. 435 * Params: 436 * live = storage for live or NULL 437 * minLatency = the storage for the min latency or NULL 438 * maxLatency = the storage for the max latency or NULL 439 * Since 0.10.12 440 */ 441 public void parseLatency(ref int live, ref GstClockTime minLatency, ref GstClockTime maxLatency) 442 { 443 // void gst_query_parse_latency (GstQuery *query, gboolean *live, GstClockTime *min_latency, GstClockTime *max_latency); 444 gst_query_parse_latency(gstQuery, &live, &minLatency, &maxLatency); 445 } 446 447 /** 448 * Answer a latency query by setting the requested values in the given format. 449 * Params: 450 * live = if there is a live element upstream 451 * minLatency = the minimal latency of the live element 452 * maxLatency = the maximal latency of the live element 453 * Since 0.10.12 454 */ 455 public void setLatency(int live, GstClockTime minLatency, GstClockTime maxLatency) 456 { 457 // void gst_query_set_latency (GstQuery *query, gboolean live, GstClockTime min_latency, GstClockTime max_latency); 458 gst_query_set_latency(gstQuery, live, minLatency, maxLatency); 459 } 460 461 /** 462 * Set the seeking query result fields in query. 463 * Params: 464 * format = the format to set for the segment_start and segment_end values 465 * seekable = the seekable flag to set 466 * segmentStart = the segment_start to set 467 * segmentEnd = the segment_end to set 468 */ 469 public void setSeeking(GstFormat format, int seekable, long segmentStart, long segmentEnd) 470 { 471 // void gst_query_set_seeking (GstQuery *query, GstFormat format, gboolean seekable, gint64 segment_start, gint64 segment_end); 472 gst_query_set_seeking(gstQuery, format, seekable, segmentStart, segmentEnd); 473 } 474 475 /** 476 * Parse a seeking query, writing the format into format, and 477 * other results into the passed parameters, if the respective parameters 478 * are non-NULL 479 * Params: 480 * format = the format to set for the segment_start and segment_end values 481 * seekable = the seekable flag to set 482 * segmentStart = the segment_start to set 483 * segmentEnd = the segment_end to set 484 */ 485 public void parseSeeking(ref GstFormat format, ref int seekable, ref long segmentStart, ref long segmentEnd) 486 { 487 // void gst_query_parse_seeking (GstQuery *query, GstFormat *format, gboolean *seekable, gint64 *segment_start, gint64 *segment_end); 488 gst_query_parse_seeking(gstQuery, &format, &seekable, &segmentStart, &segmentEnd); 489 } 490 491 /** 492 * Set the formats query result fields in query. The number of formats passed 493 * in the formats array must be equal to n_formats. 494 * Params: 495 * formats = An array containing n_formats GstFormat values. 496 * Since 0.10.4 497 */ 498 public void setFormatsv(GstFormat[] formats) 499 { 500 // void gst_query_set_formatsv (GstQuery *query, gint n_formats, GstFormat *formats); 501 gst_query_set_formatsv(gstQuery, cast(int) formats.length, formats.ptr); 502 } 503 504 /** 505 * Parse the number of formats in the formats query. 506 * Params: 507 * nFormats = the number of formats in this query. 508 * Since 0.10.4 509 */ 510 public void parseFormatsLength(out uint nFormats) 511 { 512 // void gst_query_parse_formats_length (GstQuery *query, guint *n_formats); 513 gst_query_parse_formats_length(gstQuery, &nFormats); 514 } 515 516 /** 517 * Parse the format query and retrieve the nth format from it into 518 * format. If the list contains less elements than nth, format will be 519 * set to GST_FORMAT_UNDEFINED. 520 * Params: 521 * nth = the nth format to retrieve. 522 * format = a pointer to store the nth format 523 * Since 0.10.4 524 */ 525 public void parseFormatsNth(uint nth, out GstFormat format) 526 { 527 // void gst_query_parse_formats_nth (GstQuery *query, guint nth, GstFormat *format); 528 gst_query_parse_formats_nth(gstQuery, nth, &format); 529 } 530 531 /** 532 * Answer a segment query by setting the requested values. The normal 533 * playback segment of a pipeline is 0 to duration at the default rate of 534 * 1.0. If a seek was performed on the pipeline to play a different 535 * segment, this query will return the range specified in the last seek. 536 * start_value and stop_value will respectively contain the configured 537 * playback range start and stop values expressed in format. 538 * The values are always between 0 and the duration of the media and 539 * start_value <= stop_value. rate will contain the playback rate. For 540 * negative rates, playback will actually happen from stop_value to 541 * start_value. 542 * Params: 543 * rate = the rate of the segment 544 * format = the GstFormat of the segment values (start_value and stop_value) 545 * startValue = the start value 546 * stopValue = the stop value 547 */ 548 public void setSegment(double rate, GstFormat format, long startValue, long stopValue) 549 { 550 // void gst_query_set_segment (GstQuery *query, gdouble rate, GstFormat format, gint64 start_value, gint64 stop_value); 551 gst_query_set_segment(gstQuery, rate, format, startValue, stopValue); 552 } 553 554 /** 555 * Parse a segment query answer. Any of rate, format, start_value, and 556 * stop_value may be NULL, which will cause this value to be omitted. 557 * See gst_query_set_segment() for an explanation of the function arguments. 558 * Params: 559 * rate = the storage for the rate of the segment, or NULL 560 * format = the storage for the GstFormat of the values, or NULL 561 * startValue = the storage for the start value, or NULL 562 * stopValue = the storage for the stop value, or NULL 563 */ 564 public void parseSegment(ref double rate, ref GstFormat format, ref long startValue, ref long stopValue) 565 { 566 // void gst_query_parse_segment (GstQuery *query, gdouble *rate, GstFormat *format, gint64 *start_value, gint64 *stop_value); 567 gst_query_parse_segment(gstQuery, &rate, &format, &startValue, &stopValue); 568 } 569 }