## GstQuery

GstQuery — Dynamically register new query types

## Synopsis

    #include <gst/gst.h>

    enum        GstQueryType;
    #define     GST_QUERY_TYPE_RATE_DEN
                GstQueryTypeDefinition;
    #define     GST_QUERY_TYPE_FUNCTION         (type, functionname, ...)
    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);
    const GList* gst_query_type_get_definitions (void);

## Description

GstQuery functions are used to register a new query types to GStreamer's core. Query types can be used to perform queries on pads and elements.

## Details

### enum GstQueryType

    typedef enum {
      GST_QUERY_NONE = 0,
      GST_QUERY_TOTAL,
      GST_QUERY_POSITION,
      GST_QUERY_LATENCY,
      GST_QUERY_JITTER,
      GST_QUERY_START,
      GST_QUERY_SEGMENT_END,
      GST_QUERY_RATE
    } GstQueryType;

Standard predefined Query types

`GST_QUERY_NONE` | invalid query type
`GST_QUERY_TOTAL` | total length of stream
`GST_QUERY_POSITION` | current position in stream
`GST_QUERY_LATENCY` | latency of stream
`GST_QUERY_JITTER` | current jitter of stream
`GST_QUERY_START` | start of configured segment
`GST_QUERY_SEGMENT_END` | end of configured segment
`GST_QUERY_RATE` | current rate of the stream

### GST_QUERY_TYPE_RATE_DEN

    #define GST_QUERY_TYPE_RATE_DEN          G_GINT64_CONSTANT (1000000)

Rates are relative to this value

### GstQueryTypeDefinition

    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

### GST_QUERY_TYPE_FUNCTION()

    #define     GST_QUERY_TYPE_FUNCTION(type, functionname, ...)

Convenience function to define a function that returns an array of query types.

`type` : | Type of first argument for function
`functionname` : | The name of the function
`...` : | query types, 0 to end the list

### gst_query_type_register ()

    GstQueryType gst_query_type_register        (const gchar *nick,
                                                 const gchar *description);

Create a new GstQueryType based on the nick or return an already 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.

### gst_query_type_get_by_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.

### gst_query_types_contains ()

    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

### gst_query_type_get_details ()

    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.

### gst_query_type_get_definitions ()

    const GList* gst_query_type_get_definitions (void);

Get a list of all the registered query types.

Returns : | A GList of GstQueryTypeDefinition.

## See Also

GstPad, GstElement