GstQuery functions are used to register new query types to the gstreamer core and use them. Queries can be performed on pads
(gst_pad_query()) and elements (gst_element_query()). Please note that some queries might need a running pipeline to work. Queries can be
created using the gst_query_new_*() functions. Query values can be set using gst_query_set_*(), and parsed using gst_query_parse_*()
helpers. The following example shows how to query the duration of a pipeline:
Query duration on a pipeline:
GstQuery *query;
gboolean res;
query = gst_query_new_duration (GST_FORMAT_TIME);
res = gst_element_query (pipeline, query);
if (res) {
gint64 duration;
gst_query_parse_duration (query, NULL, &duration);
g_print ("duration = %"GST_TIME_FORMAT, GST_TIME_ARGS (duration));
}
else {
g_print ("duration query failed...");
}
gst_query_unref (query);
Last reviewed on 2006-02-14 (0.10.4)
-
public bool add_buffering_range (int64 start, int64 stop)
Set the buffering-ranges array field in query. The current last start position of the array
should be inferior to start.
-
public Query copy ()
-
public uint get_n_buffering_ranges ()
Retrieve the number of values currently stored in the buffered-ranges array of the query's structure.
-
public unowned Structure get_structure ()
Get the structure of a query. still owned by the query and will therefore be freed when the query is
unreffed.
-
public void make_writable ()
-
public void parse_buffering_percent (out bool busy, out int percent)
Get the percentage of buffered data. This is a value between 0 and 100. The busy indicator
is true when the buffering is in progress.
-
public void parse_buffering_range (out Format format, out int64 start, out int64 stop, out int64 estimated_total)
Parse an available query, writing the format into format, and other results into the passed
parameters, if the respective parameters are non-NULL
-
public void parse_buffering_stats (out BufferingMode mode, out int avg_in, out int avg_out, out int64 buffering_left)
Extracts the buffering stats values from query.
-
public void parse_convert (out Format src_format, out int64 src_value, out Format dest_format, out int64 dest_value)
Parse a convert query answer. Any of src_format, src_value, dest_format
, and dest_value may be NULL, in which case that value is omitted.
-
public void parse_duration (out Format format, out int64 duration)
Parse a duration query answer. Write the format of the duration into format, and the value
into duration, if the respective variables are non-NULL.
-
public void parse_formats_length (out uint n_formats)
Parse the number of formats in the formats query.
-
public void parse_formats_nth (uint nth, out Format format)
Parse the format query and retrieve the nth format from it into set to
GST_FORMAT_UNDEFINED.
-
public void parse_latency (out bool live, out ClockTime min_latency, out ClockTime max_latency)
Parse a latency query answer.
-
public bool parse_nth_buffering_range (uint index, int64 start, int64 stop)
Parse an available query and get the start and stop values stored at the index of the
buffered ranges array.
-
public void parse_position (out Format format, out int64 cur)
Parse a position query, writing the format into format, and the position into cur
, if the respective parameters are non-NULL.
-
public void parse_seeking (out Format format, out bool seekable, out int64 segment_start, out int64 segment_end)
Parse a seeking query, writing the format into format, and other results into the passed
parameters, if the respective parameters are non-NULL
-
public void parse_segment (out double rate, out Format format, out int64 start_value, out int64 stop_value)
Parse a segment query answer. Any of rate, format, start_value,
and See set_segment for an explanation of the function arguments.
-
public void parse_uri (out string uri)
Parse an URI query, writing the URI into uri as a newly allocated string, if the respective
parameters are non-NULL. Free the string with g_free after usage.
-
public weak Query ref ()
-
public void set_buffering_percent (bool busy, int percent)
Set the percentage of buffered data. This is a value between 0 and 100. The busy indicator
is true when the buffering is in progress.
-
public void set_buffering_range (Format format, int64 start, int64 stop, int64 estimated_total)
Set the available query result fields in query.
-
public void set_buffering_stats (BufferingMode mode, int avg_in, int avg_out, int64 buffering_left)
Configures the buffering stats values in query.
-
public void set_convert (Format src_format, int64 src_value, Format dest_format, int64 dest_value)
Answer a convert query by setting the requested values.
-
public void set_duration (Format format, int64 duration)
Answer a duration query by setting the requested value in the given format.
-
public void set_formats (int n_formats, ...)
Set the formats query result fields in query. The number of formats passed must be equal to
n_formats.
-
public void set_formatsv (Format[] formats)
Set the formats query result fields in query. The number of formats passed in the
formats array must be equal to n_formats.
-
public void set_latency (bool live, ClockTime min_latency, ClockTime max_latency)
Answer a latency query by setting the requested values in the given format.
-
public void set_position (Format format, int64 cur)
Answer a position query by setting the requested value in the given format.
-
public void set_seeking (Format format, bool seekable, int64 segment_start, int64 segment_end)
Set the seeking query result fields in query.
-
public void set_segment (double rate, Format format, int64 start_value, int64 stop_value)
Answer a segment query by setting the requested values. The normal playback segment of a pipeline is 0
to duration at the default rate of 1.0. If a seek was performed on the pipeline to play a different segment, this query will return
the range specified in the last seek. playback range start and stop values expressed in format. The values are always
between 0 and the duration of the media and negative rates, playback will actually happen from stop_value to
-
public void set_uri (string uri)
Answer a URI query by setting the requested URI.
-
public void unref ()