![]() |
![]() |
![]() |
GStreamer 0.9 Core Reference Manual | ![]() |
---|
GstQueryGstQuery — Dynamically register new query types and parse results |
#include <gst/gst.h> GstQuery; enum GstQueryType; #define GST_QUERY_TYPE_RATE_DEN GstQueryTypeDefinition; GstQueryType gst_query_type_register (const gchar *nick, const gchar *description); GstQueryType gst_query_type_get_by_nick (const gchar *nick); gboolean gst_query_types_contains (const GstQueryType *types, GstQueryType type); const GstQueryTypeDefinition* gst_query_type_get_details (GstQueryType type); #define gst_query_copy (msg) GstStructure* gst_query_get_structure (GstQuery *query); #define gst_query_make_writable (msg) GstQuery* gst_query_new_application (GstQueryType type, GstStructure *structure); GstQuery* gst_query_new_convert (GstFormat src_fmt, gint64 value, GstFormat dest_fmt); GstQuery* gst_query_new_position (GstFormat format); void gst_query_parse_convert (GstQuery *query, GstFormat *src_format, gint64 *src_value, GstFormat *dest_format, gint64 *dest_value); void gst_query_parse_position (GstQuery *query, GstFormat *format, gint64 *cur, gint64 *end); void gst_query_parse_seeking_query (GstQuery *query, GstFormat *format); void gst_query_parse_seeking_response (GstQuery *query, GstFormat *format, gboolean *seekable, gint64 *segment_start, gint64 *segment_end); #define gst_query_ref (msg) void gst_query_set_convert (GstQuery *query, GstFormat src_format, gint64 src_value, GstFormat dest_format, gint64 dest_value); void gst_query_set_formats (GstQuery *query, gint n_formats, ...); void gst_query_set_position (GstQuery *query, GstFormat format, gint64 cur, gint64 end); void gst_query_set_seeking (GstQuery *query, GstFormat format, gboolean seekable, gint64 segment_start, gint64 segment_end); GstIterator* gst_query_type_iterate_definitions (void); #define gst_query_unref (msg)
GstQuery functions are used to register a new query types to the gstreamer core. Query types can be used to perform queries on pads and elements.
Query answer can be parsed using gst_query_parse_xxx()
helpers.
typedef struct { GstMiniObject mini_object; GstQueryType type; GstStructure *structure; } GstQuery;
typedef enum { GST_QUERY_NONE = 0, GST_QUERY_POSITION, GST_QUERY_LATENCY, GST_QUERY_JITTER, /* not in draft-query, necessary? */ GST_QUERY_RATE, GST_QUERY_SEEKING, GST_QUERY_CONVERT, GST_QUERY_FORMATS } GstQueryType;
Standard predefined Query types
GST_QUERY_NONE |
invalid query type |
GST_QUERY_POSITION |
current/end position in stream |
GST_QUERY_LATENCY |
latency of stream |
GST_QUERY_JITTER |
current jitter of stream |
GST_QUERY_RATE |
current rate of the stream |
GST_QUERY_SEEKING |
seeking start/stop positions |
GST_QUERY_CONVERT |
convert values |
GST_QUERY_FORMATS |
query supported formats for convert |
#define GST_QUERY_TYPE_RATE_DEN G_GINT64_CONSTANT (1000000)
Rates are relative to this value
typedef struct { GstQueryType value; gchar *nick; gchar *description; } GstQueryTypeDefinition;
A Query Type definition
GstQueryType value ; |
the unique id of the Query type |
gchar *nick ; |
a short nick |
gchar *description ; |
a longer description of the query type |
GstQueryType gst_query_type_register (const gchar *nick, const gchar *description);
Create a new GstQueryType based on the nick or return an allrady registered query with that nick
nick : |
The nick of the new query |
description : |
The description of the new query |
Returns : | A new GstQueryType or an already registered query with the same nick. |
GstQueryType gst_query_type_get_by_nick (const gchar *nick);
Return the query registered with the given nick.
nick : |
The nick of the query |
Returns : | The query with nick or GST_QUERY_NONE
if the query was not registered.
|
gboolean gst_query_types_contains (const GstQueryType *types, GstQueryType type);
See if the given query is inside the query array.
types : |
The query array to search |
type : |
the querytype to find |
Returns : | TRUE if the query is found inside the array |
const GstQueryTypeDefinition* gst_query_type_get_details (GstQueryType type);
Get details about the given query.
type : |
The query to get details of |
Returns : | The GstQueryTypeDefinition for query or NULL on failure.
|
#define gst_query_copy(msg) GST_QUERY (gst_mini_object_copy (GST_MINI_OBJECT (msg)))
msg : |
GstStructure* gst_query_get_structure (GstQuery *query);
query : |
|
Returns : |
#define gst_query_make_writable(msg) GST_QUERY (gst_mini_object_make_writable (GST_MINI_OBJECT (msg)))
msg : |
GstQuery* gst_query_new_application (GstQueryType type, GstStructure *structure);
type : |
|
structure : |
|
Returns : |
GstQuery* gst_query_new_convert (GstFormat src_fmt, gint64 value, GstFormat dest_fmt);
src_fmt : |
|
value : |
|
dest_fmt : |
|
Returns : |
GstQuery* gst_query_new_position (GstFormat format);
Constructs a new query stream position query object. Use gst_query_unref()
when done with it.
void gst_query_parse_convert (GstQuery *query, GstFormat *src_format, gint64 *src_value, GstFormat *dest_format, gint64 *dest_value);
query : |
|
src_format : |
|
src_value : |
|
dest_format : |
|
dest_value : |
void gst_query_parse_position (GstQuery *query, GstFormat *format, gint64 *cur, gint64 *end);
Parse a position query answer.
query : |
the query to fill in |
format : |
the requested GstFormat or NULL for the default (used when creating the query) |
cur : |
the storage for the current position |
end : |
the storage for the end position |
void gst_query_parse_seeking_query (GstQuery *query, GstFormat *format);
query : |
|
format : |
void gst_query_parse_seeking_response (GstQuery *query, GstFormat *format, gboolean *seekable, gint64 *segment_start, gint64 *segment_end);
query : |
|
format : |
|
seekable : |
|
segment_start : |
|
segment_end : |
#define gst_query_ref(msg) GST_QUERY (gst_mini_object_ref (GST_MINI_OBJECT (msg)))
msg : |
void gst_query_set_convert (GstQuery *query, GstFormat src_format, gint64 src_value, GstFormat dest_format, gint64 dest_value);
query : |
|
src_format : |
|
src_value : |
|
dest_format : |
|
dest_value : |
void gst_query_set_formats (GstQuery *query, gint n_formats, ...);
query : |
|
n_formats : |
|
... : |
void gst_query_set_position (GstQuery *query, GstFormat format, gint64 cur, gint64 end);
Answer a position query by setting the requested values.
query : |
the query to fill in |
format : |
the requested GstFormat |
cur : |
the current position |
end : |
the end position |
void gst_query_set_seeking (GstQuery *query, GstFormat format, gboolean seekable, gint64 segment_start, gint64 segment_end);
query : |
|
format : |
|
seekable : |
|
segment_start : |
|
segment_end : |
GstIterator* gst_query_type_iterate_definitions (void);
Get an Iterator of all the registered query types. The querytype definition is read only.
Returns : | A GstIterator of GstQueryTypeDefinition. |
<< GstProbe | GstQueue >> |