alternative to assert
[gtkD.git] / gtkD / srcgstreamer / gstreamer / Query.d
blob3d3e16297351102dfe0d998b453a097e8051fa2a
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 private import gstreamerc.gstreamertypes;
63 private import gstreamerc.gstreamer;
65 private import glib.Str;
66 private import gstreamer.Structure;
70 /**
71 * Description
72 * GstQuery functions are used to register a new query types to the gstreamer
73 * core.
74 * Query types can be used to perform queries on pads and elements.
75 * Queries can be created using the gst_query_new_xxx() functions.
76 * Query values can be set using gst_query_set_xxx(), and parsed using
77 * gst_query_parse_xxx() helpers.
78 * The following example shows how to query the duration of a pipeline:
79 * Example13.Query duration on a pipeline
80 * GstQuery *query;
81 * gboolean res;
82 * query = gst_query_new_duration (GST_FORMAT_TIME);
83 * res = gst_element_query (pipeline, query);
84 * if (res) {
85 * gint64 duration;
86 * gst_query_parse_duration (query, NULL, duration);
87 * g_print ("duration = %"GST_TIME_FORMAT, GST_TIME_ARGS (duration));
88 * }
89 * else {
90 * g_print ("duration query failed...");
91 * }
92 * gst_query_unref (query);
93 * Last reviewed on 2006-02-14 (0.10.4)
95 public class Query
98 /** the main Gtk struct */
99 protected GstQuery* gstQuery;
102 public GstQuery* getQueryStruct()
104 return gstQuery;
108 /** the main Gtk struct as a void* */
109 protected void* getStruct()
111 return cast(void*)gstQuery;
115 * Sets our main struct and passes it to the parent class
117 public this (GstQuery* gstQuery)
119 this.gstQuery = gstQuery;
123 * Constructs a new query stream position query object. Use gst_query_unref()
124 * when done with it. A position query is used to query the current position
125 * of playback in the streams, in some format.
126 * format:
127 * the default GstFormat for the new query
128 * Returns:
129 * A GstQuery
131 public static Query newPosition(GstFormat format)
133 // GstQuery* gst_query_new_position (GstFormat format);
134 return new Query( cast(GstQuery*)gst_query_new_position(format) );
135 } /**
136 * Constructs a new stream duration query object to query in the given format.
137 * Use gst_query_unref() when done with it. A duration query will give the
138 * total length of the stream.
139 * format:
140 * the GstFormat for this duration query
141 * Returns:
142 * A GstQuery
144 public static Query newDuration(GstFormat format)
146 // GstQuery* gst_query_new_duration (GstFormat format);
147 return new Query( cast(GstQuery*)gst_query_new_duration(format) );
148 } /**
149 * Constructs a new query object for querying seeking properties of
150 * the stream.
151 * format:
152 * the default GstFormat for the new query
153 * Returns:
154 * A GstQuery
156 public static Query newSeeking(GstFormat format)
158 // GstQuery* gst_query_new_seeking (GstFormat format);
159 return new Query(cast(GstQuery*)gst_query_new_seeking(format) );
160 } /**
161 * Constructs a new query object for querying formats of
162 * the stream.
163 * Returns:
164 * A GstQuery
165 * Since 0.10.4
167 public static Query newFormats()
169 // GstQuery* gst_query_new_formats (void);
170 return new Query(cast(GstQuery*)gst_query_new_formats() );
171 } /**
172 * Constructs a new segment query object. Use gst_query_unref()
173 * when done with it. A segment query is used to discover information about the
174 * currently configured segment for playback.
175 * format:
176 * the GstFormat for the new query
177 * Returns:
178 * a GstQuery
180 public static Query newSegment(GstFormat format)
182 // GstQuery* gst_query_new_segment (GstFormat format);
183 return new Query(cast(GstQuery*)gst_query_new_segment(format) );
195 * Get a printable name for the given query type. Do not modify or free.
196 * query:
197 * the query type
198 * Returns:
199 * a reference to the static name of the query.
201 public static char[] typeGetName(GstQueryType query)
203 // const gchar* gst_query_type_get_name (GstQueryType query);
204 return Str.toString(gst_query_type_get_name(query) );
208 * Get the unique quark for the given query type.
209 * query:
210 * the query type
211 * Returns:
212 * the quark associated with the query type
214 public static GQuark typeToQuark(GstQueryType query)
216 // GQuark gst_query_type_to_quark (GstQueryType query);
217 return gst_query_type_to_quark(query);
221 * Create a new GstQueryType based on the nick or return an
222 * already registered query with that nick
223 * nick:
224 * The nick of the new query
225 * description:
226 * The description of the new query
227 * Returns:
228 * A new GstQueryType or an already registered query
229 * with the same nick.
231 public static GstQueryType typeRegister(char[] nick, char[] description)
233 // GstQueryType gst_query_type_register (const gchar *nick, const gchar *description);
234 return gst_query_type_register(Str.toStringz(nick), Str.toStringz(description));
238 * Get the query type registered with nick.
239 * nick:
240 * The nick of the query
241 * Returns:
242 * The query registered with nick or GST_QUERY_NONE
243 * if the query was not registered.
245 public static GstQueryType typeGetByNick(char[] nick)
247 // GstQueryType gst_query_type_get_by_nick (const gchar *nick);
248 return gst_query_type_get_by_nick(Str.toStringz(nick));
252 * See if the given GstQueryType is inside the types query types array.
253 * types:
254 * The query array to search
255 * type:
256 * the GstQueryType to find
257 * Returns:
258 * TRUE if the type is found inside the array
260 public static int typesContains(GstQueryType* types, GstQueryType type)
262 // gboolean gst_query_types_contains (const GstQueryType *types, GstQueryType type);
263 return gst_query_types_contains(types, type);
267 * Get details about the given GstQueryType.
268 * type:
269 * a GstQueryType
270 * Returns:
271 * The GstQueryTypeDefinition for type or NULL on failure.
273 public static GstQueryTypeDefinition* typeGetDetails(GstQueryType type)
275 // const GstQueryTypeDefinition* gst_query_type_get_details (GstQueryType type);
276 return gst_query_type_get_details(type);
280 * Get a GstIterator of all the registered query types. The definitions
281 * iterated over are read only.
282 * Returns:
283 * A GstIterator of GstQueryTypeDefinition.
285 public static GstIterator* typeIterateDefinitions()
287 // GstIterator* gst_query_type_iterate_definitions (void);
288 return gst_query_type_iterate_definitions();
296 * Constructs a new custom application query object. Use gst_query_unref()
297 * when done with it.
298 * type:
299 * the query type
300 * structure:
301 * a structure for the query
302 * Returns:
303 * a GstQuery
305 public this (GstQueryType type, Structure structure)
307 // GstQuery* gst_query_new_application (GstQueryType type, GstStructure *structure);
308 this(cast(GstQuery*)gst_query_new_application(type, (structure is null) ? null : structure.getStructureStruct()) );
312 * Get the structure of a query.
313 * query:
314 * a GstQuery
315 * Returns:
316 * The GstStructure of the query. The structure is still owned
317 * by the query and will therefore be freed when the query is unreffed.
319 public Structure getStructure()
321 // GstStructure* gst_query_get_structure (GstQuery *query);
322 return new Structure( gst_query_get_structure(gstQuery) );
326 * Constructs a new convert query object. Use gst_query_unref()
327 * when done with it. A convert query is used to ask for a conversion between
328 * one format and another.
329 * src_format:
330 * the source GstFormat for the new query
331 * value:
332 * the value to convert
333 * dest_format:
334 * the target GstFormat
335 * Returns:
336 * A GstQuery
338 public this (GstFormat srcFormat, long value, GstFormat destFormat)
340 // GstQuery* gst_query_new_convert (GstFormat src_format, gint64 value, GstFormat dest_format);
341 this(cast(GstQuery*)gst_query_new_convert(srcFormat, value, destFormat) );
345 * Answer a convert query by setting the requested values.
346 * query:
347 * a GstQuery
348 * src_format:
349 * the source GstFormat
350 * src_value:
351 * the source value
352 * dest_format:
353 * the destination GstFormat
354 * dest_value:
355 * the destination value
357 public void setConvert(GstFormat srcFormat, long srcValue, GstFormat destFormat, long destValue)
359 // void gst_query_set_convert (GstQuery *query, GstFormat src_format, gint64 src_value, GstFormat dest_format, gint64 dest_value);
360 gst_query_set_convert(gstQuery, srcFormat, srcValue, destFormat, destValue);
364 * Parse a convert query answer. Any of src_format, src_value, dest_format,
365 * and dest_value may be NULL, in which case that value is omitted.
366 * query:
367 * a GstQuery
368 * src_format:
369 * the storage for the GstFormat of the source value, or NULL
370 * src_value:
371 * the storage for the source value, or NULL
372 * dest_format:
373 * the storage for the GstFormat of the destination value, or NULL
374 * dest_value:
375 * the storage for the destination value, or NULL
377 public void parseConvert(GstFormat* srcFormat, long* srcValue, GstFormat* destFormat, long* destValue)
379 // void gst_query_parse_convert (GstQuery *query, GstFormat *src_format, gint64 *src_value, GstFormat *dest_format, gint64 *dest_value);
380 gst_query_parse_convert(gstQuery, srcFormat, srcValue, destFormat, destValue);
385 * Answer a position query by setting the requested value in the given format.
386 * query:
387 * a GstQuery with query type GST_QUERY_POSITION
388 * format:
389 * the requested GstFormat
390 * cur:
391 * the position to set
393 public void setPosition(GstFormat format, long cur)
395 // void gst_query_set_position (GstQuery *query, GstFormat format, gint64 cur);
396 gst_query_set_position(gstQuery, format, cur);
400 * Parse a position query, writing the format into format, and the position
401 * into cur, if the respective parameters are non-NULL.
402 * query:
403 * a GstQuery
404 * format:
405 * the storage for the GstFormat of the position values (may be NULL)
406 * cur:
407 * the storage for the current position (may be NULL)
409 public void parsePosition(GstFormat* format, long* cur)
411 // void gst_query_parse_position (GstQuery *query, GstFormat *format, gint64 *cur);
412 gst_query_parse_position(gstQuery, format, cur);
417 * Answer a duration query by setting the requested value in the given format.
418 * query:
419 * a GstQuery
420 * format:
421 * the GstFormat for the duration
422 * duration:
423 * the duration of the stream
425 public void setDuration(GstFormat format, long duration)
427 // void gst_query_set_duration (GstQuery *query, GstFormat format, gint64 duration);
428 gst_query_set_duration(gstQuery, format, duration);
432 * Parse a duration query answer. Write the format of the duration into format,
433 * and the value into duration, if the respective variables are non-NULL.
434 * query:
435 * a GstQuery
436 * format:
437 * the storage for the GstFormat of the duration value, or NULL.
438 * duration:
439 * the storage for the total duration, or NULL.
441 public void parseDuration(GstFormat* format, long* duration)
443 // void gst_query_parse_duration (GstQuery *query, GstFormat *format, gint64 *duration);
444 gst_query_parse_duration(gstQuery, format, duration);
448 * Constructs a new latency query object.
449 * Use gst_query_unref() when done with it. A latency query is usually performed
450 * by sinks to compensate for additional latency introduced by elements in the
451 * pipeline.
452 * Returns:
453 * A GstQuery
454 * Since 0.10.12
456 public this ()
458 // GstQuery* gst_query_new_latency (void);
459 this(cast(GstQuery*)gst_query_new_latency() );
463 * Parse a latency query answer.
464 * query:
465 * a GstQuery
466 * live:
467 * storage for live or NULL
468 * min_latency:
469 * the storage for the min latency or NULL
470 * max_latency:
471 * the storage for the max latency or NULL
472 * Since 0.10.12
474 public void parseLatency(int* live, GstClockTime* minLatency, GstClockTime* maxLatency)
476 // void gst_query_parse_latency (GstQuery *query, gboolean *live, GstClockTime *min_latency, GstClockTime *max_latency);
477 gst_query_parse_latency(gstQuery, live, minLatency, maxLatency);
481 * Answer a latency query by setting the requested values in the given format.
482 * query:
483 * a GstQuery
484 * live:
485 * if there is a live element upstream
486 * min_latency:
487 * the minimal latency of the live element
488 * max_latency:
489 * the maximal latency of the live element
490 * Since 0.10.12
492 public void setLatency(int live, GstClockTime minLatency, GstClockTime maxLatency)
494 // void gst_query_set_latency (GstQuery *query, gboolean live, GstClockTime min_latency, GstClockTime max_latency);
495 gst_query_set_latency(gstQuery, live, minLatency, maxLatency);
500 * Set the seeking query result fields in query.
501 * query:
502 * a GstQuery
503 * format:
504 * the format to set for the segment_start and segment_end values
505 * seekable:
506 * the seekable flag to set
507 * segment_start:
508 * the segment_start to set
509 * segment_end:
510 * the segment_end to set
512 public void setSeeking(GstFormat format, int seekable, long segmentStart, long segmentEnd)
514 // void gst_query_set_seeking (GstQuery *query, GstFormat format, gboolean seekable, gint64 segment_start, gint64 segment_end);
515 gst_query_set_seeking(gstQuery, format, seekable, segmentStart, segmentEnd);
519 * Parse a seeking query, writing the format into format, and
520 * other results into the passed parameters, if the respective parameters
521 * are non-NULL
522 * query:
523 * a GST_QUERY_SEEKING type query GstQuery
524 * format:
525 * the format to set for the segment_start and segment_end values
526 * seekable:
527 * the seekable flag to set
528 * segment_start:
529 * the segment_start to set
530 * segment_end:
531 * the segment_end to set
533 public void parseSeeking(GstFormat* format, int* seekable, long* segmentStart, long* segmentEnd)
535 // void gst_query_parse_seeking (GstQuery *query, GstFormat *format, gboolean *seekable, gint64 *segment_start, gint64 *segment_end);
536 gst_query_parse_seeking(gstQuery, format, seekable, segmentStart, segmentEnd);
541 * Set the formats query result fields in query. The number of formats passed
542 * must be equal to n_formats.
543 * query:
544 * a GstQuery
545 * n_formats:
546 * the number of formats to set.
547 * ...:
548 * A number of GstFormats equal to n_formats.
550 public void setFormats(int nFormats, ... )
552 // void gst_query_set_formats (GstQuery *query, gint n_formats, ...);
553 gst_query_set_formats(gstQuery, nFormats);
557 * Set the formats query result fields in query. The number of formats passed
558 * in the formats array must be equal to n_formats.
559 * query:
560 * a GstQuery
561 * n_formats:
562 * the number of formats to set.
563 * formats:
564 * An array containing n_formats GstFormat values.
565 * Since 0.10.4
567 public void setFormatsv(int nFormats, GstFormat* formats)
569 // void gst_query_set_formatsv (GstQuery *query, gint n_formats, GstFormat *formats);
570 gst_query_set_formatsv(gstQuery, nFormats, formats);
574 * Parse the number of formats in the formats query.
575 * query:
576 * a GstQuery
577 * n_formats:
578 * the number of formats in this query.
579 * Since 0.10.4
581 public void parseFormatsLength(uint* nFormats)
583 // void gst_query_parse_formats_length (GstQuery *query, guint *n_formats);
584 gst_query_parse_formats_length(gstQuery, nFormats);
588 * Parse the format query and retrieve the nth format from it into
589 * format. If the list contains less elements than nth, format will be
590 * set to GST_FORMAT_UNDEFINED.
591 * query:
592 * a GstQuery
593 * nth:
594 * the nth format to retrieve.
595 * format:
596 * a pointer to store the nth format
597 * Since 0.10.4
599 public void parseFormatsNth(uint nth, GstFormat* format)
601 // void gst_query_parse_formats_nth (GstQuery *query, guint nth, GstFormat *format);
602 gst_query_parse_formats_nth(gstQuery, nth, format);
607 * Answer a segment query by setting the requested values. The normal
608 * playback segment of a pipeline is 0 to duration at the default rate of
609 * 1.0. If a seek was performed on the pipeline to play a different
610 * segment, this query will return the range specified in the last seek.
611 * start_value and stop_value will respectively contain the configured
612 * playback range start and stop values expressed in format.
613 * The values are always between 0 and the duration of the media and
614 * start_value <= stop_value. rate will contain the playback rate. For
615 * negative rates, playback will actually happen from stop_value to
616 * start_value.
617 * query:
618 * a GstQuery
619 * rate:
620 * the rate of the segment
621 * format:
622 * the GstFormat of the segment values (start_value and stop_value)
623 * start_value:
624 * the start value
625 * stop_value:
626 * the stop value
628 public void setSegment(double rate, GstFormat format, long startValue, long stopValue)
630 // void gst_query_set_segment (GstQuery *query, gdouble rate, GstFormat format, gint64 start_value, gint64 stop_value);
631 gst_query_set_segment(gstQuery, rate, format, startValue, stopValue);
635 * Parse a segment query answer. Any of rate, format, start_value, and
636 * stop_value may be NULL, which will cause this value to be omitted.
637 * See gst_query_set_segment() for an explanation of the function arguments.
638 * query:
639 * a GstQuery
640 * rate:
641 * the storage for the rate of the segment, or NULL
642 * format:
643 * the storage for the GstFormat of the values, or NULL
644 * start_value:
645 * the storage for the start value, or NULL
646 * stop_value:
647 * the storage for the stop value, or NULL
648 * See Also
649 * GstPad, GstElement
651 public void parseSegment(double* rate, GstFormat* format, long* startValue, long* stopValue)
653 // void gst_query_parse_segment (GstQuery *query, gdouble *rate, GstFormat *format, gint64 *start_value, gint64 *stop_value);
654 gst_query_parse_segment(gstQuery, rate, format, startValue, stopValue);