I've no idea here...
[gtkD.git] / gtkD / srcgstreamer / gstreamer / Query.d
blob3b7074c47c39841685ad843bbe241d4c3cd629cb
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = gstreamer-GstQuery.html
26 * outPack = gstreamer
27 * outFile = Query
28 * strct = GstQuery
29 * realStrct=
30 * ctorStrct=
31 * clss = Query
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - gst_query_
40 * - gst_
41 * omit structs:
42 * omit prefixes:
43 * omit code:
44 * - gst_query_new_position
45 * - gst_query_new_duration
46 * - gst_query_new_seeking
47 * - gst_query_new_formats
48 * - gst_query_new_segment
49 * imports:
50 * - glib.Str
51 * - gstreamer.Structure
52 * structWrap:
53 * - GstQuery* -> Query
54 * - GstStructure* -> Structure
55 * module aliases:
56 * local aliases:
59 module gstreamer.Query;
61 version(noAssert)
63 version(Tango)
65 import tango.io.Stdout; // use the tango loging?
69 private import gstreamerc.gstreamertypes;
71 private import gstreamerc.gstreamer;
74 private import glib.Str;
75 private import gstreamer.Structure;
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 * Example13.Query duration on a pipeline
90 * GstQuery *query;
91 * gboolean res;
92 * query = gst_query_new_duration (GST_FORMAT_TIME);
93 * res = gst_element_query (pipeline, query);
94 * if (res) {
95 * gint64 duration;
96 * gst_query_parse_duration (query, NULL, duration);
97 * g_print ("duration = %"GST_TIME_FORMAT, GST_TIME_ARGS (duration));
98 * }
99 * else {
100 * g_print ("duration query failed...");
102 * gst_query_unref (query);
103 * Last reviewed on 2006-02-14 (0.10.4)
105 public class Query
108 /** the main Gtk struct */
109 protected GstQuery* gstQuery;
112 public GstQuery* getQueryStruct()
114 return gstQuery;
118 /** the main Gtk struct as a void* */
119 protected void* getStruct()
121 return cast(void*)gstQuery;
125 * Sets our main struct and passes it to the parent class
127 public this (GstQuery* gstQuery)
129 version(noAssert)
131 if ( gstQuery is null )
133 int zero = 0;
134 version(Tango)
136 Stdout("struct gstQuery is null on constructor").newline;
138 else
140 printf("struct gstQuery is null on constructor");
142 zero = zero / zero;
145 else
147 assert(gstQuery !is null, "struct gstQuery is null on constructor");
149 this.gstQuery = gstQuery;
153 * Constructs a new query stream position query object. Use gst_query_unref()
154 * when done with it. A position query is used to query the current position
155 * of playback in the streams, in some format.
156 * format:
157 * the default GstFormat for the new query
158 * Returns:
159 * A GstQuery
161 public static Query newPosition(GstFormat format)
163 // GstQuery* gst_query_new_position (GstFormat format);
164 return new Query( cast(GstQuery*)gst_query_new_position(format) );
165 } /**
166 * Constructs a new stream duration query object to query in the given format.
167 * Use gst_query_unref() when done with it. A duration query will give the
168 * total length of the stream.
169 * format:
170 * the GstFormat for this duration query
171 * Returns:
172 * A GstQuery
174 public static Query newDuration(GstFormat format)
176 // GstQuery* gst_query_new_duration (GstFormat format);
177 return new Query( cast(GstQuery*)gst_query_new_duration(format) );
178 } /**
179 * Constructs a new query object for querying seeking properties of
180 * the stream.
181 * format:
182 * the default GstFormat for the new query
183 * Returns:
184 * A GstQuery
186 public static Query newSeeking(GstFormat format)
188 // GstQuery* gst_query_new_seeking (GstFormat format);
189 return new Query(cast(GstQuery*)gst_query_new_seeking(format) );
190 } /**
191 * Constructs a new query object for querying formats of
192 * the stream.
193 * Returns:
194 * A GstQuery
195 * Since 0.10.4
197 public static Query newFormats()
199 // GstQuery* gst_query_new_formats (void);
200 return new Query(cast(GstQuery*)gst_query_new_formats() );
201 } /**
202 * Constructs a new segment query object. Use gst_query_unref()
203 * when done with it. A segment query is used to discover information about the
204 * currently configured segment for playback.
205 * format:
206 * the GstFormat for the new query
207 * Returns:
208 * a GstQuery
210 public static Query newSegment(GstFormat format)
212 // GstQuery* gst_query_new_segment (GstFormat format);
213 return new Query(cast(GstQuery*)gst_query_new_segment(format) );
225 * Get a printable name for the given query type. Do not modify or free.
226 * query:
227 * the query type
228 * Returns:
229 * a reference to the static name of the query.
231 public static char[] typeGetName(GstQueryType query)
233 // const gchar* gst_query_type_get_name (GstQueryType query);
234 return Str.toString(gst_query_type_get_name(query) );
238 * Get the unique quark for the given query type.
239 * query:
240 * the query type
241 * Returns:
242 * the quark associated with the query type
244 public static GQuark typeToQuark(GstQueryType query)
246 // GQuark gst_query_type_to_quark (GstQueryType query);
247 return gst_query_type_to_quark(query);
251 * Create a new GstQueryType based on the nick or return an
252 * already registered query with that nick
253 * nick:
254 * The nick of the new query
255 * description:
256 * The description of the new query
257 * Returns:
258 * A new GstQueryType or an already registered query
259 * with the same nick.
261 public static GstQueryType typeRegister(char[] nick, char[] description)
263 // GstQueryType gst_query_type_register (const gchar *nick, const gchar *description);
264 return gst_query_type_register(Str.toStringz(nick), Str.toStringz(description));
268 * Get the query type registered with nick.
269 * nick:
270 * The nick of the query
271 * Returns:
272 * The query registered with nick or GST_QUERY_NONE
273 * if the query was not registered.
275 public static GstQueryType typeGetByNick(char[] nick)
277 // GstQueryType gst_query_type_get_by_nick (const gchar *nick);
278 return gst_query_type_get_by_nick(Str.toStringz(nick));
282 * See if the given GstQueryType is inside the types query types array.
283 * types:
284 * The query array to search
285 * type:
286 * the GstQueryType to find
287 * Returns:
288 * TRUE if the type is found inside the array
290 public static int typesContains(GstQueryType* types, GstQueryType type)
292 // gboolean gst_query_types_contains (const GstQueryType *types, GstQueryType type);
293 return gst_query_types_contains(types, type);
297 * Get details about the given GstQueryType.
298 * type:
299 * a GstQueryType
300 * Returns:
301 * The GstQueryTypeDefinition for type or NULL on failure.
303 public static GstQueryTypeDefinition* typeGetDetails(GstQueryType type)
305 // const GstQueryTypeDefinition* gst_query_type_get_details (GstQueryType type);
306 return gst_query_type_get_details(type);
310 * Get a GstIterator of all the registered query types. The definitions
311 * iterated over are read only.
312 * Returns:
313 * A GstIterator of GstQueryTypeDefinition.
315 public static GstIterator* typeIterateDefinitions()
317 // GstIterator* gst_query_type_iterate_definitions (void);
318 return gst_query_type_iterate_definitions();
326 * Constructs a new custom application query object. Use gst_query_unref()
327 * when done with it.
328 * type:
329 * the query type
330 * structure:
331 * a structure for the query
332 * Returns:
333 * a GstQuery
335 public this (GstQueryType type, Structure structure)
337 // GstQuery* gst_query_new_application (GstQueryType type, GstStructure *structure);
338 this(cast(GstQuery*)gst_query_new_application(type, (structure is null) ? null : structure.getStructureStruct()) );
342 * Get the structure of a query.
343 * query:
344 * a GstQuery
345 * Returns:
346 * The GstStructure of the query. The structure is still owned
347 * by the query and will therefore be freed when the query is unreffed.
349 public Structure getStructure()
351 // GstStructure* gst_query_get_structure (GstQuery *query);
352 return new Structure( gst_query_get_structure(gstQuery) );
356 * Constructs a new convert query object. Use gst_query_unref()
357 * when done with it. A convert query is used to ask for a conversion between
358 * one format and another.
359 * src_format:
360 * the source GstFormat for the new query
361 * value:
362 * the value to convert
363 * dest_format:
364 * the target GstFormat
365 * Returns:
366 * A GstQuery
368 public this (GstFormat srcFormat, long value, GstFormat destFormat)
370 // GstQuery* gst_query_new_convert (GstFormat src_format, gint64 value, GstFormat dest_format);
371 this(cast(GstQuery*)gst_query_new_convert(srcFormat, value, destFormat) );
375 * Answer a convert query by setting the requested values.
376 * query:
377 * a GstQuery
378 * src_format:
379 * the source GstFormat
380 * src_value:
381 * the source value
382 * dest_format:
383 * the destination GstFormat
384 * dest_value:
385 * the destination value
387 public void setConvert(GstFormat srcFormat, long srcValue, GstFormat destFormat, long destValue)
389 // void gst_query_set_convert (GstQuery *query, GstFormat src_format, gint64 src_value, GstFormat dest_format, gint64 dest_value);
390 gst_query_set_convert(gstQuery, srcFormat, srcValue, destFormat, destValue);
394 * Parse a convert query answer. Any of src_format, src_value, dest_format,
395 * and dest_value may be NULL, in which case that value is omitted.
396 * query:
397 * a GstQuery
398 * src_format:
399 * the storage for the GstFormat of the source value, or NULL
400 * src_value:
401 * the storage for the source value, or NULL
402 * dest_format:
403 * the storage for the GstFormat of the destination value, or NULL
404 * dest_value:
405 * the storage for the destination value, or NULL
407 public void parseConvert(GstFormat* srcFormat, long* srcValue, GstFormat* destFormat, long* destValue)
409 // void gst_query_parse_convert (GstQuery *query, GstFormat *src_format, gint64 *src_value, GstFormat *dest_format, gint64 *dest_value);
410 gst_query_parse_convert(gstQuery, srcFormat, srcValue, destFormat, destValue);
415 * Answer a position query by setting the requested value in the given format.
416 * query:
417 * a GstQuery with query type GST_QUERY_POSITION
418 * format:
419 * the requested GstFormat
420 * cur:
421 * the position to set
423 public void setPosition(GstFormat format, long cur)
425 // void gst_query_set_position (GstQuery *query, GstFormat format, gint64 cur);
426 gst_query_set_position(gstQuery, format, cur);
430 * Parse a position query, writing the format into format, and the position
431 * into cur, if the respective parameters are non-NULL.
432 * query:
433 * a GstQuery
434 * format:
435 * the storage for the GstFormat of the position values (may be NULL)
436 * cur:
437 * the storage for the current position (may be NULL)
439 public void parsePosition(GstFormat* format, long* cur)
441 // void gst_query_parse_position (GstQuery *query, GstFormat *format, gint64 *cur);
442 gst_query_parse_position(gstQuery, format, cur);
447 * Answer a duration query by setting the requested value in the given format.
448 * query:
449 * a GstQuery
450 * format:
451 * the GstFormat for the duration
452 * duration:
453 * the duration of the stream
455 public void setDuration(GstFormat format, long duration)
457 // void gst_query_set_duration (GstQuery *query, GstFormat format, gint64 duration);
458 gst_query_set_duration(gstQuery, format, duration);
462 * Parse a duration query answer. Write the format of the duration into format,
463 * and the value into duration, if the respective variables are non-NULL.
464 * query:
465 * a GstQuery
466 * format:
467 * the storage for the GstFormat of the duration value, or NULL.
468 * duration:
469 * the storage for the total duration, or NULL.
471 public void parseDuration(GstFormat* format, long* duration)
473 // void gst_query_parse_duration (GstQuery *query, GstFormat *format, gint64 *duration);
474 gst_query_parse_duration(gstQuery, format, duration);
478 * Constructs a new latency query object.
479 * Use gst_query_unref() when done with it. A latency query is usually performed
480 * by sinks to compensate for additional latency introduced by elements in the
481 * pipeline.
482 * Returns:
483 * A GstQuery
484 * Since 0.10.12
486 public this ()
488 // GstQuery* gst_query_new_latency (void);
489 this(cast(GstQuery*)gst_query_new_latency() );
493 * Parse a latency query answer.
494 * query:
495 * a GstQuery
496 * live:
497 * storage for live or NULL
498 * min_latency:
499 * the storage for the min latency or NULL
500 * max_latency:
501 * the storage for the max latency or NULL
502 * Since 0.10.12
504 public void parseLatency(int* live, GstClockTime* minLatency, GstClockTime* maxLatency)
506 // void gst_query_parse_latency (GstQuery *query, gboolean *live, GstClockTime *min_latency, GstClockTime *max_latency);
507 gst_query_parse_latency(gstQuery, live, minLatency, maxLatency);
511 * Answer a latency query by setting the requested values in the given format.
512 * query:
513 * a GstQuery
514 * live:
515 * if there is a live element upstream
516 * min_latency:
517 * the minimal latency of the live element
518 * max_latency:
519 * the maximal latency of the live element
520 * Since 0.10.12
522 public void setLatency(int live, GstClockTime minLatency, GstClockTime maxLatency)
524 // void gst_query_set_latency (GstQuery *query, gboolean live, GstClockTime min_latency, GstClockTime max_latency);
525 gst_query_set_latency(gstQuery, live, minLatency, maxLatency);
530 * Set the seeking query result fields in query.
531 * query:
532 * a GstQuery
533 * format:
534 * the format to set for the segment_start and segment_end values
535 * seekable:
536 * the seekable flag to set
537 * segment_start:
538 * the segment_start to set
539 * segment_end:
540 * the segment_end to set
542 public void setSeeking(GstFormat format, int seekable, long segmentStart, long segmentEnd)
544 // void gst_query_set_seeking (GstQuery *query, GstFormat format, gboolean seekable, gint64 segment_start, gint64 segment_end);
545 gst_query_set_seeking(gstQuery, format, seekable, segmentStart, segmentEnd);
549 * Parse a seeking query, writing the format into format, and
550 * other results into the passed parameters, if the respective parameters
551 * are non-NULL
552 * query:
553 * a GST_QUERY_SEEKING type query GstQuery
554 * format:
555 * the format to set for the segment_start and segment_end values
556 * seekable:
557 * the seekable flag to set
558 * segment_start:
559 * the segment_start to set
560 * segment_end:
561 * the segment_end to set
563 public void parseSeeking(GstFormat* format, int* seekable, long* segmentStart, long* segmentEnd)
565 // void gst_query_parse_seeking (GstQuery *query, GstFormat *format, gboolean *seekable, gint64 *segment_start, gint64 *segment_end);
566 gst_query_parse_seeking(gstQuery, format, seekable, segmentStart, segmentEnd);
571 * Set the formats query result fields in query. The number of formats passed
572 * must be equal to n_formats.
573 * query:
574 * a GstQuery
575 * n_formats:
576 * the number of formats to set.
577 * ...:
578 * A number of GstFormats equal to n_formats.
580 public void setFormats(int nFormats, ... )
582 // void gst_query_set_formats (GstQuery *query, gint n_formats, ...);
583 gst_query_set_formats(gstQuery, nFormats);
587 * Set the formats query result fields in query. The number of formats passed
588 * in the formats array must be equal to n_formats.
589 * query:
590 * a GstQuery
591 * n_formats:
592 * the number of formats to set.
593 * formats:
594 * An array containing n_formats GstFormat values.
595 * Since 0.10.4
597 public void setFormatsv(int nFormats, GstFormat* formats)
599 // void gst_query_set_formatsv (GstQuery *query, gint n_formats, GstFormat *formats);
600 gst_query_set_formatsv(gstQuery, nFormats, formats);
604 * Parse the number of formats in the formats query.
605 * query:
606 * a GstQuery
607 * n_formats:
608 * the number of formats in this query.
609 * Since 0.10.4
611 public void parseFormatsLength(uint* nFormats)
613 // void gst_query_parse_formats_length (GstQuery *query, guint *n_formats);
614 gst_query_parse_formats_length(gstQuery, nFormats);
618 * Parse the format query and retrieve the nth format from it into
619 * format. If the list contains less elements than nth, format will be
620 * set to GST_FORMAT_UNDEFINED.
621 * query:
622 * a GstQuery
623 * nth:
624 * the nth format to retrieve.
625 * format:
626 * a pointer to store the nth format
627 * Since 0.10.4
629 public void parseFormatsNth(uint nth, GstFormat* format)
631 // void gst_query_parse_formats_nth (GstQuery *query, guint nth, GstFormat *format);
632 gst_query_parse_formats_nth(gstQuery, nth, format);
637 * Answer a segment query by setting the requested values. The normal
638 * playback segment of a pipeline is 0 to duration at the default rate of
639 * 1.0. If a seek was performed on the pipeline to play a different
640 * segment, this query will return the range specified in the last seek.
641 * start_value and stop_value will respectively contain the configured
642 * playback range start and stop values expressed in format.
643 * The values are always between 0 and the duration of the media and
644 * start_value <= stop_value. rate will contain the playback rate. For
645 * negative rates, playback will actually happen from stop_value to
646 * start_value.
647 * query:
648 * a GstQuery
649 * rate:
650 * the rate of the segment
651 * format:
652 * the GstFormat of the segment values (start_value and stop_value)
653 * start_value:
654 * the start value
655 * stop_value:
656 * the stop value
658 public void setSegment(double rate, GstFormat format, long startValue, long stopValue)
660 // void gst_query_set_segment (GstQuery *query, gdouble rate, GstFormat format, gint64 start_value, gint64 stop_value);
661 gst_query_set_segment(gstQuery, rate, format, startValue, stopValue);
665 * Parse a segment query answer. Any of rate, format, start_value, and
666 * stop_value may be NULL, which will cause this value to be omitted.
667 * See gst_query_set_segment() for an explanation of the function arguments.
668 * query:
669 * a GstQuery
670 * rate:
671 * the storage for the rate of the segment, or NULL
672 * format:
673 * the storage for the GstFormat of the values, or NULL
674 * start_value:
675 * the storage for the start value, or NULL
676 * stop_value:
677 * the storage for the stop value, or NULL
678 * See Also
679 * GstPad, GstElement
681 public void parseSegment(double* rate, GstFormat* format, long* startValue, long* stopValue)
683 // void gst_query_parse_segment (GstQuery *query, gdouble *rate, GstFormat *format, gint64 *start_value, gint64 *stop_value);
684 gst_query_parse_segment(gstQuery, rate, format, startValue, stopValue);