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:
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);
- public Query.accept_caps (Caps caps)
Constructs a new query object for querying if caps
are
accepted.
- public Query.allocation (Caps caps, bool need_pool)
Constructs a new query object for querying the allocation properties.
- public Query.bitrate ()
Constructs a new query object for querying the bitrate.
- public Query.buffering (Format format)
Constructs a new query object for querying the buffering status of a
stream.
- public Query.caps (Caps filter)
Constructs a new query object for querying the caps.
- public Query.context (string context_type)
Constructs a new query object for querying the pipeline-local context.
- public Query.convert (Format src_format, int64 value, Format dest_format)
Constructs a new convert query object.
- public Query.custom (QueryType type, owned Structure? structure)
Constructs a new custom query object.
- public Query.drain ()
Constructs a new query object for querying the drain state.
- public Query.duration (Format format)
Constructs a new stream duration query object to query in the given
format.
- public Query.formats ()
Constructs a new query object for querying formats of the stream.
- public Query.latency ()
Constructs a new latency query object.
- public Query.position (Format format)
Constructs a new query stream position query object.
- public Query.scheduling ()
Constructs a new query object for querying the scheduling properties.
- public Query.seeking (Format format)
Constructs a new query object for querying seeking properties of the
stream.
- public Query.segment (Format format)
Constructs a new segment query object.
- public Query.selectable ()
Constructs a new query object for querying the stream selection
capability.
- public Query.uri ()
Constructs a new query URI query object.
- public unowned Query @ref ()
Increases the refcount of the given query by one.
- public void add_allocation_meta (Type api, Structure? @params)
Add api
with params
as one of the supported
metadata API to this.
- public void add_allocation_param (Allocator? allocator, AllocationParams? @params)
Add allocator
and its params
as a supported
memory allocator.
- public void add_allocation_pool (BufferPool? pool, uint size, uint min_buffers, uint max_buffers)
Set the pool parameters in this.
- public bool add_buffering_range (int64 start, int64 stop)
Set the buffering-ranges array field in
this.
- public void add_scheduling_mode (PadMode mode)
Add mode
as one of the supported scheduling modes to
this.
- public bool find_allocation_meta (Type api, out uint index)
Check if this has metadata api
set.
- public uint get_n_allocation_metas ()
Retrieve the number of values currently stored in the meta API array
of the query's structure.
- public uint get_n_allocation_params ()
Retrieve the number of values currently stored in the allocator params
array of the query's structure.
- public uint get_n_allocation_pools ()
Retrieve the number of values currently stored in the pool array of
the query's structure.
- public uint get_n_buffering_ranges ()
Retrieve the number of values currently stored in the buffered-ranges
array of the query's structure.
- public uint get_n_scheduling_modes ()
Retrieve the number of values currently stored in the scheduling mode
array of the query's structure.
- public unowned Structure? get_structure ()
Get the structure of a query.
- public bool has_scheduling_mode (PadMode mode)
Check if this has scheduling mode
set.
- public bool has_scheduling_mode_with_flags (PadMode mode, SchedulingFlags flags)
Check if this has scheduling mode
set and flags
is set in query scheduling flags.
- public void parse_accept_caps (out unowned Caps caps)
Get the caps from this.
- public void parse_accept_caps_result (out bool result)
Parse the result from this and store
in result
.
- public void parse_allocation (out unowned Caps caps, out bool need_pool)
Parse an allocation query, writing the requested caps in caps
and whether a pool is needed in need_pool
, if the respective parameters are non-%NULL.
- public void parse_bitrate (out uint nominal_bitrate)
Get the results of a bitrate query.
- public void parse_buffering_percent (out bool busy, out int percent)
Get the percentage of buffered data.
- 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
this.
- public void parse_caps (out unowned Caps filter)
Get the filter from the caps this.
- public void parse_caps_result (out unowned Caps caps)
Get the caps result from this.
- public void parse_context (out unowned Context context)
Get the context from the context this
.
- public bool parse_context_type (out unowned string context_type)
Parse a context type from an existing GST_QUERY_CONTEXT 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.
- public void parse_duration (out Format format, out int64 duration)
Parse a duration query answer.
- public void parse_latency (out bool live, out ClockTime min_latency, out ClockTime max_latency)
Parse a latency query answer.
- public void parse_n_formats (out uint n_formats)
Parse the number of formats in the formats
this.
- public Type parse_nth_allocation_meta (uint index, out unowned Structure @params)
Parse an available query and get the metadata API at index
of the metadata API array.
- public void parse_nth_allocation_param (uint index, out Allocator allocator, out unowned AllocationParams @params)
Parse an available query and get the allocator and its params at
index
of the allocator array.
- public void parse_nth_allocation_pool (uint index, out BufferPool pool, out uint size, out uint min_buffers, out uint max_buffers)
Get the pool parameters in this.
- public bool parse_nth_buffering_range (uint index, out int64 start, out 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_nth_format (uint nth, out Format format)
Parse the format query and retrieve the nth
format from
it into format
.
- public PadMode parse_nth_scheduling_mode (uint index)
Parse an available query and get the scheduling mode at index
of the scheduling modes 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_scheduling (out SchedulingFlags flags, out int minsize, out int maxsize, out int align)
Set the scheduling properties.
- 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.
- public void parse_selectable (out bool selectable)
Get the results of a selectable query.
- 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.
- public void parse_uri_redirection (out string uri)
Parse an URI query, writing the URI into uri
as a newly
allocated string, if the respective parameters are non-%NULL.
- public void parse_uri_redirection_permanent (out bool permanent)
Parse an URI query, and set permanent
to true
if there is a redirection and it should be considered permanent.
- public void remove_nth_allocation_meta (uint index)
Remove the metadata API at index
of the metadata API
array.
- public void remove_nth_allocation_param (uint index)
Remove the allocation param at index
of the allocation
param array.
- public void remove_nth_allocation_pool (uint index)
Remove the allocation pool at index
of the allocation
pool array.
- public void set_accept_caps_result (bool result)
Set result
as the result for the
this.
- public void set_bitrate (uint nominal_bitrate)
Set the results of a bitrate query.
- public void set_buffering_percent (bool busy, int percent)
Set the percentage of buffered data.
- public void set_buffering_range (Format format, int64 start, int64 stop, int64 estimated_total)
Set the available query result fields in
this.
- public void set_buffering_stats (BufferingMode mode, int avg_in, int avg_out, int64 buffering_left)
Configures the buffering stats values in
this.
- public void set_caps_result (Caps caps)
Set the caps
result in this
.
- public void set_context (Context context)
Answer a context query by setting the requested context.
- 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, Format[] formats)
Set the formats query result fields in this
.
- public void set_formatsv (Format[] formats)
Set the formats query result fields in this
.
- 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_nth_allocation_param (uint index, Allocator? allocator, AllocationParams? @params)
Parse an available query and get the allocator and its params at
index
of the allocator array.
- public void set_nth_allocation_pool (uint index, BufferPool? pool, uint size, uint min_buffers, uint max_buffers)
Set the pool parameters in this.
- public void set_position (Format format, int64 cur)
Answer a position query by setting the requested value in the given
format.
- public void set_scheduling (SchedulingFlags flags, int minsize, int maxsize, int align)
Set the scheduling properties.
- public void set_seeking (Format format, bool seekable, int64 segment_start, int64 segment_end)
Set the seeking query result fields in this
.
- public void set_segment (double rate, Format format, int64 start_value, int64 stop_value)
Answer a segment query by setting the requested values.
- public void set_selectable (bool selectable)
Set the results of a selectable query.
- public void set_uri (string uri)
Answer a URI query by setting the requested URI.
- public void set_uri_redirection (string uri)
Answer a URI query by setting the requested URI redirection.
- public void set_uri_redirection_permanent (bool permanent)
Answer a URI query by setting the requested URI redirection to
permanent or not.
- public unowned Structure writable_structure ()
Get the structure of a query.