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
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
51 * - gstreamer.Structure
53 * - GstQuery* -> Query
54 * - GstStructure* -> Structure
59 module gstreamer
.Query
;
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
;
82 * GstQuery functions are used to register a new query types to the gstreamer
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
92 * query = gst_query_new_duration (GST_FORMAT_TIME);
93 * res = gst_element_query (pipeline, query);
96 * gst_query_parse_duration (query, NULL, duration);
97 * g_print ("duration = %"GST_TIME_FORMAT, GST_TIME_ARGS (duration));
100 * g_print ("duration query failed...");
102 * gst_query_unref (query);
103 * Last reviewed on 2006-02-14 (0.10.4)
108 /** the main Gtk struct */
109 protected GstQuery
* gstQuery
;
112 public GstQuery
* getQueryStruct()
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
)
131 if ( gstQuery
is null )
136 Stdout("struct gstQuery is null on constructor").newline
;
140 printf("struct gstQuery is null on constructor");
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.
157 * the default GstFormat for the new query
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
) );
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.
170 * the GstFormat for this duration query
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
) );
179 * Constructs a new query object for querying seeking properties of
182 * the default GstFormat for the new query
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
) );
191 * Constructs a new query object for querying formats of
197 public static Query
newFormats()
199 // GstQuery* gst_query_new_formats (void);
200 return new Query(cast(GstQuery
*)gst_query_new_formats() );
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.
206 * the GstFormat for the new query
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.
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.
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
254 * The nick of the new query
256 * The description of the new query
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.
270 * The nick of the query
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.
284 * The query array to search
286 * the GstQueryType to find
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.
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.
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()
331 * a structure for the query
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.
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.
360 * the source GstFormat for the new query
362 * the value to convert
364 * the target GstFormat
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.
379 * the source GstFormat
383 * the destination GstFormat
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.
399 * the storage for the GstFormat of the source value, or NULL
401 * the storage for the source value, or NULL
403 * the storage for the GstFormat of the destination value, or NULL
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.
417 * a GstQuery with query type GST_QUERY_POSITION
419 * the requested GstFormat
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.
435 * the storage for the GstFormat of the position values (may be NULL)
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.
451 * the GstFormat for the 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.
467 * the storage for the GstFormat of the duration value, or NULL.
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
488 // GstQuery* gst_query_new_latency (void);
489 this(cast(GstQuery
*)gst_query_new_latency() );
493 * Parse a latency query answer.
497 * storage for live or NULL
499 * the storage for the min latency or NULL
501 * the storage for the max latency or NULL
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.
515 * if there is a live element upstream
517 * the minimal latency of the live element
519 * the maximal latency of the live element
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.
534 * the format to set for the segment_start and segment_end values
536 * the seekable flag to set
538 * the segment_start to set
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
553 * a GST_QUERY_SEEKING type query GstQuery
555 * the format to set for the segment_start and segment_end values
557 * the seekable flag to set
559 * the segment_start to set
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.
576 * the number of formats to set.
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.
592 * the number of formats to set.
594 * An array containing n_formats GstFormat values.
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.
608 * the number of formats in this query.
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.
624 * the nth format to retrieve.
626 * a pointer to store the nth format
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
650 * the rate of the segment
652 * the GstFormat of the segment values (start_value and 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.
671 * the storage for the rate of the segment, or NULL
673 * the storage for the GstFormat of the values, or NULL
675 * the storage for the start value, or NULL
677 * the storage for the stop value, or NULL
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
);