GstQuery

## GstQuery GstQuery — Provide functions to create queries, and to set and parse values in them. |

## Synopsis

    #include <gst/gst.h>

    struct              GstQuery;
    enum                GstQueryTypeFlags;
    #define             GST_QUERY_TYPE_BOTH
    #define             GST_QUERY_MAKE_TYPE                 (num,
                                                             flags)
    enum                GstQueryType;
    #define             GST_QUERY_TYPE                      (query)
    #define             GST_QUERY_TYPE_NAME                 (query)
    #define             GST_QUERY_IS_UPSTREAM               (ev)
    #define             GST_QUERY_IS_DOWNSTREAM             (ev)
    #define             GST_QUERY_IS_SERIALIZED             (ev)
    GstQueryTypeFlags   gst_query_type_get_flags            (GstQueryType type);
    const gchar *       gst_query_type_get_name             (GstQueryType type);
    GQuark              gst_query_type_to_quark             (GstQueryType type);
    GstQuery *          gst_query_ref                       (GstQuery *q);
    void                gst_query_unref                     (GstQuery *q);
    GstQuery *          gst_query_copy                      (const GstQuery *q);
    #define             gst_query_make_writable             (q)
    #define             gst_query_is_writable               (q)
    gboolean            gst_query_replace                   (GstQuery **old_query,
                                                             GstQuery *new_query);
    GstStructure *      gst_query_writable_structure        (GstQuery *query);
    GstQuery *          gst_query_new_custom                (GstQueryType type,
                                                             GstStructure *structure);
    const GstStructure * gst_query_get_structure            (GstQuery *query);
    GstQuery *          gst_query_new_convert               (GstFormat src_format,
                                                             gint64 value,
                                                             GstFormat dest_format);
    void                gst_query_set_convert               (GstQuery *query,
                                                             GstFormat src_format,
                                                             gint64 src_value,
                                                             GstFormat dest_format,
                                                             gint64 dest_value);
    void                gst_query_parse_convert             (GstQuery *query,
                                                             GstFormat *src_format,
                                                             gint64 *src_value,
                                                             GstFormat *dest_format,
                                                             gint64 *dest_value);
    GstQuery *          gst_query_new_position              (GstFormat format);
    void                gst_query_set_position              (GstQuery *query,
                                                             GstFormat format,
                                                             gint64 cur);
    void                gst_query_parse_position            (GstQuery *query,
                                                             GstFormat *format,
                                                             gint64 *cur);
    GstQuery *          gst_query_new_duration              (GstFormat format);
    void                gst_query_set_duration              (GstQuery *query,
                                                             GstFormat format,
                                                             gint64 duration);
    void                gst_query_parse_duration            (GstQuery *query,
                                                             GstFormat *format,
                                                             gint64 *duration);
    GstQuery *          gst_query_new_latency               (void);
    void                gst_query_parse_latency             (GstQuery *query,
                                                             gboolean *live,
                                                             GstClockTime *min_latency,
                                                             GstClockTime *max_latency);
    void                gst_query_set_latency               (GstQuery *query,
                                                             gboolean live,
                                                             GstClockTime min_latency,
                                                             GstClockTime max_latency);
    GstQuery *          gst_query_new_seeking               (GstFormat format);
    void                gst_query_set_seeking               (GstQuery *query,
                                                             GstFormat format,
                                                             gboolean seekable,
                                                             gint64 segment_start,
                                                             gint64 segment_end);
    void                gst_query_parse_seeking             (GstQuery *query,
                                                             GstFormat *format,
                                                             gboolean *seekable,
                                                             gint64 *segment_start,
                                                             gint64 *segment_end);
    GstQuery *          gst_query_new_formats               (void);
    void                gst_query_set_formats               (GstQuery *query,
                                                             gint n_formats,
                                                             ...);
    void                gst_query_set_formatsv              (GstQuery *query,
                                                             gint n_formats,
                                                             const GstFormat *formats);
    void                gst_query_parse_n_formats           (GstQuery *query,
                                                             guint *n_formats);
    void                gst_query_parse_nth_format          (GstQuery *query,
                                                             guint nth,
                                                             GstFormat *format);
    GstQuery *          gst_query_new_segment               (GstFormat format);
    void                gst_query_set_segment               (GstQuery *query,
                                                             gdouble rate,
                                                             GstFormat format,
                                                             gint64 start_value,
                                                             gint64 stop_value);
    void                gst_query_parse_segment             (GstQuery *query,
                                                             gdouble *rate,
                                                             GstFormat *format,
                                                             gint64 *start_value,
                                                             gint64 *stop_value);
    GstQuery *          gst_query_new_caps                  (GstCaps *filter);
    void                gst_query_parse_caps                (GstQuery *query,
                                                             GstCaps **filter);
    void                gst_query_set_caps_result           (GstQuery *query,
                                                             GstCaps *caps);
    void                gst_query_parse_caps_result         (GstQuery *query,
                                                             GstCaps **caps);
    GstQuery *          gst_query_new_accept_caps           (GstCaps *caps);
    void                gst_query_parse_accept_caps         (GstQuery *query,
                                                             GstCaps **caps);
    void                gst_query_set_accept_caps_result    (GstQuery *query,
                                                             gboolean result);
    void                gst_query_parse_accept_caps_result  (GstQuery *query,
                                                             gboolean *result);
    enum                GstBufferingMode;
    GstQuery *          gst_query_new_buffering             (GstFormat format);
    void                gst_query_set_buffering_percent     (GstQuery *query,
                                                             gboolean busy,
                                                             gint percent);
    void                gst_query_parse_buffering_percent   (GstQuery *query,
                                                             gboolean *busy,
                                                             gint *percent);
    void                gst_query_set_buffering_stats       (GstQuery *query,
                                                             GstBufferingMode mode,
                                                             gint avg_in,
                                                             gint avg_out,
                                                             gint64 buffering_left);
    void                gst_query_parse_buffering_stats     (GstQuery *query,
                                                             GstBufferingMode *mode,
                                                             gint *avg_in,
                                                             gint *avg_out,
                                                             gint64 *buffering_left);
    void                gst_query_set_buffering_range       (GstQuery *query,
                                                             GstFormat format,
                                                             gint64 start,
                                                             gint64 stop,
                                                             gint64 estimated_total);
    void                gst_query_parse_buffering_range     (GstQuery *query,
                                                             GstFormat *format,
                                                             gint64 *start,
                                                             gint64 *stop,
                                                             gint64 *estimated_total);
    gboolean            gst_query_add_buffering_range       (GstQuery *query,
                                                             gint64 start,
                                                             gint64 stop);
    guint               gst_query_get_n_buffering_ranges    (GstQuery *query);
    gboolean            gst_query_parse_nth_buffering_range (GstQuery *query,
                                                             guint index,
                                                             gint64 *start,
                                                             gint64 *stop);
    GstQuery *          gst_query_new_uri                   (void);
    void                gst_query_parse_uri                 (GstQuery *query,
                                                             gchar **uri);
    void                gst_query_set_uri                   (GstQuery *query,
                                                             const gchar *uri);
    GstQuery *          gst_query_new_allocation            (GstCaps *caps,
                                                             gboolean need_pool);
    void                gst_query_parse_allocation          (GstQuery *query,
                                                             GstCaps **caps,
                                                             gboolean *need_pool);
    void                gst_query_add_allocation_pool       (GstQuery *query,
                                                             GstBufferPool *pool,
                                                             guint size,
                                                             guint min_buffers,
                                                             guint max_buffers);
    guint               gst_query_get_n_allocation_pools    (GstQuery *query);
    void                gst_query_parse_nth_allocation_pool (GstQuery *query,
                                                             guint index,
                                                             GstBufferPool **pool,
                                                             guint *size,
                                                             guint *min_buffers,
                                                             guint *max_buffers);
    void                gst_query_set_nth_allocation_pool   (GstQuery *query,
                                                             guint index,
                                                             GstBufferPool *pool,
                                                             guint size,
                                                             guint min_buffers,
                                                             guint max_buffers);
    void                gst_query_remove_nth_allocation_pool
                                                            (GstQuery *query,
                                                             guint index);
    void                gst_query_add_allocation_param      (GstQuery *query,
                                                             GstAllocator *allocator,
                                                             const GstAllocationParams *params);
    guint               gst_query_get_n_allocation_params   (GstQuery *query);
    void                gst_query_parse_nth_allocation_param
                                                            (GstQuery *query,
                                                             guint index,
                                                             GstAllocator **allocator,
                                                             GstAllocationParams *params);
    void                gst_query_set_nth_allocation_param  (GstQuery *query,
                                                             guint index,
                                                             GstAllocator *allocator,
                                                             const GstAllocationParams *params);
    void                gst_query_remove_nth_allocation_param
                                                            (GstQuery *query,
                                                             guint index);
    void                gst_query_add_allocation_meta       (GstQuery *query,
                                                             GType api,
                                                             const GstStructure *params);
    guint               gst_query_get_n_allocation_metas    (GstQuery *query);
    GType               gst_query_parse_nth_allocation_meta (GstQuery *query,
                                                             guint index,
                                                             const GstStructure **params);
    void                gst_query_remove_nth_allocation_meta
                                                            (GstQuery *query,
                                                             guint index);
    gboolean            gst_query_find_allocation_meta      (GstQuery *query,
                                                             GType api,
                                                             guint *index);
    enum                GstSchedulingFlags;
    GstQuery *          gst_query_new_scheduling            (void);
    void                gst_query_parse_scheduling          (GstQuery *query,
                                                             GstSchedulingFlags *flags,
                                                             gint *minsize,
                                                             gint *maxsize,
                                                             gint *align);
    void                gst_query_set_scheduling            (GstQuery *query,
                                                             GstSchedulingFlags flags,
                                                             gint minsize,
                                                             gint maxsize,
                                                             gint align);
    void                gst_query_add_scheduling_mode       (GstQuery *query,
                                                             GstPadMode mode);
    guint               gst_query_get_n_scheduling_modes    (GstQuery *query);
    GstPadMode          gst_query_parse_nth_scheduling_mode (GstQuery *query,
                                                             guint index);
    gboolean            gst_query_has_scheduling_mode       (GstQuery *query,
                                                             GstPadMode mode);
    gboolean            gst_query_has_scheduling_mode_with_flags
                                                            (GstQuery *query,
                                                             GstPadMode mode,
                                                             GstSchedulingFlags flags);
    GstQuery *          gst_query_new_drain                 (void);
    GstQuery *          gst_query_new_context               (const gchar *context_type);
    void                gst_query_set_context               (GstQuery *query,
                                                             GstContext *context);
    void                gst_query_parse_context             (GstQuery *query,
                                                             GstContext **context);
    gboolean            gst_query_parse_context_type        (GstQuery *query,
                                                             const gchar **context_type);

## Description

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:

Example 12. Query duration on a pipeline

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    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 2012-03-29 (0.11.3)

## Details

### struct GstQuery

    struct GstQuery {
      GstMiniObject mini_object;

      GstQueryType type;
    };

The GstQuery structure.

GstMiniObject `mini_object`; | The parent GstMiniObject type
GstQueryType `type`; | the GstQueryType

### enum GstQueryTypeFlags

    typedef enum {
      GST_QUERY_TYPE_UPSTREAM       = 1 << 0,
      GST_QUERY_TYPE_DOWNSTREAM     = 1 << 1,
      GST_QUERY_TYPE_SERIALIZED     = 1 << 2
    } GstQueryTypeFlags;

GstQueryTypeFlags indicate the aspects of the different GstQueryType values. You can get the type flags of a GstQueryType with the `gst_query_type_get_flags()` function.

`GST_QUERY_TYPE_UPSTREAM` | Set if the query can travel upstream.
`GST_QUERY_TYPE_DOWNSTREAM` | Set if the query can travel downstream.
`GST_QUERY_TYPE_SERIALIZED` | Set if the query should be serialized with data flow.

### GST_QUERY_TYPE_BOTH

    #define             GST_QUERY_TYPE_BOTH

The same thing as GST_QUERY_TYPE_UPSTREAM | GST_QUERY_TYPE_DOWNSTREAM.

### GST_QUERY_MAKE_TYPE()

    #define             GST_QUERY_MAKE_TYPE(num,flags)

when making custom query types, use this macro with the num and the given flags

`num` : | the query number to create
`flags` : | the query flags

### enum GstQueryType

    typedef enum {
      GST_QUERY_UNKNOWN      = GST_QUERY_MAKE_TYPE (0, 0),
      GST_QUERY_POSITION     = GST_QUERY_MAKE_TYPE (10, FLAG(BOTH)),
      GST_QUERY_DURATION     = GST_QUERY_MAKE_TYPE (20, FLAG(BOTH)),
      GST_QUERY_LATENCY      = GST_QUERY_MAKE_TYPE (30, FLAG(BOTH)),
      GST_QUERY_JITTER       = GST_QUERY_MAKE_TYPE (40, FLAG(BOTH)),
      GST_QUERY_RATE         = GST_QUERY_MAKE_TYPE (50, FLAG(BOTH)),
      GST_QUERY_SEEKING      = GST_QUERY_MAKE_TYPE (60, FLAG(BOTH)),
      GST_QUERY_SEGMENT      = GST_QUERY_MAKE_TYPE (70, FLAG(BOTH)),
      GST_QUERY_CONVERT      = GST_QUERY_MAKE_TYPE (80, FLAG(BOTH)),
      GST_QUERY_FORMATS      = GST_QUERY_MAKE_TYPE (90, FLAG(BOTH)),
      GST_QUERY_BUFFERING    = GST_QUERY_MAKE_TYPE (110, FLAG(BOTH)),
      GST_QUERY_CUSTOM       = GST_QUERY_MAKE_TYPE (120, FLAG(BOTH)),
      GST_QUERY_URI          = GST_QUERY_MAKE_TYPE (130, FLAG(BOTH)),
      GST_QUERY_ALLOCATION   = GST_QUERY_MAKE_TYPE (140, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
      GST_QUERY_SCHEDULING   = GST_QUERY_MAKE_TYPE (150, FLAG(UPSTREAM)),
      GST_QUERY_ACCEPT_CAPS  = GST_QUERY_MAKE_TYPE (160, FLAG(BOTH)),
      GST_QUERY_CAPS         = GST_QUERY_MAKE_TYPE (170, FLAG(BOTH)),
      GST_QUERY_DRAIN        = GST_QUERY_MAKE_TYPE (180, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
      GST_QUERY_CONTEXT      = GST_QUERY_MAKE_TYPE (190, FLAG(BOTH))
    } GstQueryType;

Standard predefined Query types

`GST_QUERY_UNKNOWN` | unknown query type
`GST_QUERY_POSITION` | current position in stream
`GST_QUERY_DURATION` | total duration of the 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 capabilities
`GST_QUERY_SEGMENT` | segment start/stop positions
`GST_QUERY_CONVERT` | convert values between formats
`GST_QUERY_FORMATS` | query supported formats for convert
`GST_QUERY_BUFFERING` | query available media for efficient seeking.
`GST_QUERY_CUSTOM` | a custom application or element defined query.
`GST_QUERY_URI` | query the URI of the source or sink.
`GST_QUERY_ALLOCATION` | the buffer allocation properties
`GST_QUERY_SCHEDULING` | the scheduling properties
`GST_QUERY_ACCEPT_CAPS` | the accept caps query
`GST_QUERY_CAPS` | the caps query
`GST_QUERY_DRAIN` | wait till all serialized data is consumed downstream
`GST_QUERY_CONTEXT` | query the pipeline-local context from downstream or upstream (since 1.2)

### GST_QUERY_TYPE()

    #define GST_QUERY_TYPE(query)  (((GstQuery*)(query))->type)

Get the GstQueryType of the query.

`query` : | the query to query

### GST_QUERY_TYPE_NAME()

    #define GST_QUERY_TYPE_NAME(query) (gst_query_type_get_name(GST_QUERY_TYPE(query)))

Get a constant string representation of the GstQueryType of the query.

`query` : | the query to query

### GST_QUERY_IS_UPSTREAM()

    #define GST_QUERY_IS_UPSTREAM(ev)       !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_UPSTREAM)

Check if an query can travel upstream.

`ev` : | the query to query

### GST_QUERY_IS_DOWNSTREAM()

    #define GST_QUERY_IS_DOWNSTREAM(ev)     !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_DOWNSTREAM)

Check if an query can travel downstream.

`ev` : | the query to query

### GST_QUERY_IS_SERIALIZED()

    #define GST_QUERY_IS_SERIALIZED(ev)     !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_SERIALIZED)

Check if an query is serialized with the data stream.

`ev` : | the query to query

### gst_query_type_get_flags ()

    GstQueryTypeFlags   gst_query_type_get_flags            (GstQueryType type);

Gets the GstQueryTypeFlags associated with `type`.

`type` : | a GstQueryType
Returns : | a GstQueryTypeFlags.

### gst_query_type_get_name ()

    const gchar *       gst_query_type_get_name             (GstQueryType type);

Get a printable name for the given query type. Do not modify or free.

`type` : | the query type
Returns : | a reference to the static name of the query.

### gst_query_type_to_quark ()

    GQuark              gst_query_type_to_quark             (GstQueryType type);

Get the unique quark for the given query type.

`type` : | the query type
Returns : | the quark associated with the query type

### gst_query_ref ()

    GstQuery *          gst_query_ref                       (GstQuery *q);

Increases the refcount of the given query by one.

`q` : | a GstQuery to increase the refcount of.
Returns : | `q`

### gst_query_unref ()

    void                gst_query_unref                     (GstQuery *q);

Decreases the refcount of the query. If the refcount reaches 0, the query will be freed.

`q` : | a GstQuery to decrease the refcount of.

### gst_query_copy ()

    GstQuery *          gst_query_copy                      (const GstQuery *q);

Copies the given query using the copy function of the parent GstStructure.

Free-function: gst_query_unref

`q` : | a GstQuery to copy.
Returns : | a new copy of `q`. [transfer full]

### gst_query_make_writable()

    #define         gst_query_make_writable(q)      GST_QUERY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (q)))

Makes a writable query from the given query.

`q` : | a GstQuery to make writable. [transfer full]
Returns : | a new writable query (possibly same as `q`). [transfer full]

### gst_query_is_writable()

    #define         gst_query_is_writable(q)     gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (q))

Tests if you can safely write data into a query's structure.

`q` : | a GstQuery

### gst_query_replace ()

    gboolean            gst_query_replace                   (GstQuery **old_query,
                                                             GstQuery *new_query);

Modifies a pointer to a GstQuery to point to a different GstQuery. The modification is done atomically (so this is useful for ensuring thread safety in some cases), and the reference counts are updated appropriately (the old query is unreffed, the new one is reffed).

Either `new_query` or the GstQuery pointed to by `old_query` may be NULL.

`old_query` : | pointer to a pointer to a GstQuery to be replaced. [inout][transfer full]
`new_query` : | pointer to a GstQuery that will replace the query pointed to by `old_query`. [allow-none][transfer none]
Returns : | TRUE if `new_query` was different from `old_query`

### gst_query_writable_structure ()

    GstStructure *      gst_query_writable_structure        (GstQuery *query);

Get the structure of a query. This method should be called with a writable `query` so that the returned structure is guranteed to be writable.

`query` : | a GstQuery
Returns : | the GstStructure of the query. The structure is still owned by the query and will therefore be freed when the query is unreffed. [transfer none]

### gst_query_new_custom ()

    GstQuery *          gst_query_new_custom                (GstQueryType type,
                                                             GstStructure *structure);

Constructs a new custom query object. Use `gst_query_unref()` when done with it.

Free-function: gst_query_unref

`type` : | the query type
`structure` : | a structure for the query. [allow-none][transfer full]
Returns : | a new GstQuery. [transfer full]

### gst_query_get_structure ()

    const GstStructure * gst_query_get_structure            (GstQuery *query);

Get the structure of a query.

`query` : | a GstQuery
Returns : | the GstStructure of the query. The structure is still owned by the query and will therefore be freed when the query is unreffed. [transfer none]

### gst_query_new_convert ()

    GstQuery *          gst_query_new_convert               (GstFormat src_format,
                                                             gint64 value,
                                                             GstFormat dest_format);

Constructs a new convert query object. Use `gst_query_unref()` when done with it. A convert query is used to ask for a conversion between one format and another.

Free-function: gst_query_unref

`src_format` : | the source GstFormat for the new query
`value` : | the value to convert
`dest_format` : | the target GstFormat
Returns : | a GstQuery. [transfer full]

### gst_query_set_convert ()

    void                gst_query_set_convert               (GstQuery *query,
                                                             GstFormat src_format,
                                                             gint64 src_value,
                                                             GstFormat dest_format,
                                                             gint64 dest_value);

Answer a convert query by setting the requested values.

`query` : | a GstQuery
`src_format` : | the source GstFormat
`src_value` : | the source value
`dest_format` : | the destination GstFormat
`dest_value` : | the destination value

### gst_query_parse_convert ()

    void                gst_query_parse_convert             (GstQuery *query,
                                                             GstFormat *src_format,
                                                             gint64 *src_value,
                                                             GstFormat *dest_format,
                                                             gint64 *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.

`query` : | a GstQuery
`src_format` : | the storage for the GstFormat of the source value, or NULL. [out][allow-none]
`src_value` : | the storage for the source value, or NULL. [out][allow-none]
`dest_format` : | the storage for the GstFormat of the destination value, or NULL. [out][allow-none]
`dest_value` : | the storage for the destination value, or NULL. [out][allow-none]

### gst_query_new_position ()

    GstQuery *          gst_query_new_position              (GstFormat format);

Constructs a new query stream position query object. Use `gst_query_unref()` when done with it. A position query is used to query the current position of playback in the streams, in some format.

Free-function: gst_query_unref

`format` : | the default GstFormat for the new query
Returns : | a new GstQuery. [transfer full]

### gst_query_set_position ()

    void                gst_query_set_position              (GstQuery *query,
                                                             GstFormat format,
                                                             gint64 cur);

Answer a position query by setting the requested value in the given format.

`query` : | a GstQuery with query type GST_QUERY_POSITION
`format` : | the requested GstFormat
`cur` : | the position to set

### gst_query_parse_position ()

    void                gst_query_parse_position            (GstQuery *query,
                                                             GstFormat *format,
                                                             gint64 *cur);

Parse a position query, writing the format into `format`, and the position into `cur`, if the respective parameters are non-NULL.

`query` : | a GstQuery
`format` : | the storage for the GstFormat of the position values (may be NULL). [out][allow-none]
`cur` : | the storage for the current position (may be NULL). [out][allow-none]

### gst_query_new_duration ()

    GstQuery *          gst_query_new_duration              (GstFormat format);

Constructs a new stream duration query object to query in the given format. Use `gst_query_unref()` when done with it. A duration query will give the total length of the stream.

Free-function: gst_query_unref

`format` : | the GstFormat for this duration query
Returns : | a new GstQuery. [transfer full]

### gst_query_set_duration ()

    void                gst_query_set_duration              (GstQuery *query,
                                                             GstFormat format,
                                                             gint64 duration);

Answer a duration query by setting the requested value in the given format.

`query` : | a GstQuery
`format` : | the GstFormat for the duration
`duration` : | the duration of the stream

### gst_query_parse_duration ()

    void                gst_query_parse_duration            (GstQuery *query,
                                                             GstFormat *format,
                                                             gint64 *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.

`query` : | a GstQuery
`format` : | the storage for the GstFormat of the duration value, or NULL. [out][allow-none]
`duration` : | the storage for the total duration, or NULL. [out][allow-none]

### gst_query_new_latency ()

    GstQuery *          gst_query_new_latency               (void);

Constructs a new latency query object. Use `gst_query_unref()` when done with it. A latency query is usually performed by sinks to compensate for additional latency introduced by elements in the pipeline.

Free-function: gst_query_unref

Returns : | a GstQuery. [transfer full]

### gst_query_parse_latency ()

    void                gst_query_parse_latency             (GstQuery *query,
                                                             gboolean *live,
                                                             GstClockTime *min_latency,
                                                             GstClockTime *max_latency);

Parse a latency query answer.

`query` : | a GstQuery
`live` : | storage for live or NULL. [out][allow-none]
`min_latency` : | the storage for the min latency or NULL. [out][allow-none]
`max_latency` : | the storage for the max latency or NULL. [out][allow-none]

### gst_query_set_latency ()

    void                gst_query_set_latency               (GstQuery *query,
                                                             gboolean live,
                                                             GstClockTime min_latency,
                                                             GstClockTime max_latency);

Answer a latency query by setting the requested values in the given format.

`query` : | a GstQuery
`live` : | if there is a live element upstream
`min_latency` : | the minimal latency of the upstream elements
`max_latency` : | the maximal latency of the upstream elements

### gst_query_new_seeking ()

    GstQuery *          gst_query_new_seeking               (GstFormat format);

Constructs a new query object for querying seeking properties of the stream.

Free-function: gst_query_unref

`format` : | the default GstFormat for the new query
Returns : | a new GstQuery. [transfer full]

### gst_query_set_seeking ()

    void                gst_query_set_seeking               (GstQuery *query,
                                                             GstFormat format,
                                                             gboolean seekable,
                                                             gint64 segment_start,
                                                             gint64 segment_end);

Set the seeking query result fields in `query`.

`query` : | a GstQuery
`format` : | the format to set for the `segment_start` and `segment_end` values
`seekable` : | the seekable flag to set
`segment_start` : | the segment_start to set
`segment_end` : | the segment_end to set

### gst_query_parse_seeking ()

    void                gst_query_parse_seeking             (GstQuery *query,
                                                             GstFormat *format,
                                                             gboolean *seekable,
                                                             gint64 *segment_start,
                                                             gint64 *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

`query` : | a GST_QUERY_SEEKING type query GstQuery
`format` : | the format to set for the `segment_start` and `segment_end` values, or NULL. [out][allow-none]
`seekable` : | the seekable flag to set, or NULL. [out][allow-none]
`segment_start` : | the segment_start to set, or NULL. [out][allow-none]
`segment_end` : | the segment_end to set, or NULL. [out][allow-none]

### gst_query_new_formats ()

    GstQuery *          gst_query_new_formats               (void);

Constructs a new query object for querying formats of the stream.

Free-function: gst_query_unref

Returns : | a new GstQuery. [transfer full]

### gst_query_set_formats ()

    void                gst_query_set_formats               (GstQuery *query,
                                                             gint n_formats,
                                                             ...);

Set the formats query result fields in `query`. The number of formats passed must be equal to `n_formats`.

`query` : | a GstQuery
`n_formats` : | the number of formats to set.
`...` : | A number of `GstFormats` equal to `n_formats`.

### gst_query_set_formatsv ()

    void                gst_query_set_formatsv              (GstQuery *query,
                                                             gint n_formats,
                                                             const GstFormat *formats);

Set the formats query result fields in `query`. The number of formats passed in the `formats` array must be equal to `n_formats`.

`query` : | a GstQuery
`n_formats` : | the number of formats to set.
`formats` : | an array containing `n_formats` `GstFormat` values. [in][array length=n_formats]

### gst_query_parse_n_formats ()

    void                gst_query_parse_n_formats           (GstQuery *query,
                                                             guint *n_formats);

Parse the number of formats in the formats `query`.

`query` : | a GstQuery
`n_formats` : | the number of formats in this query. [out][allow-none]

### gst_query_parse_nth_format ()

    void                gst_query_parse_nth_format          (GstQuery *query,
                                                             guint nth,
                                                             GstFormat *format);

Parse the format query and retrieve the `nth` format from it into `format`. If the list contains less elements than `nth`, `format` will be set to GST_FORMAT_UNDEFINED.

`query` : | a GstQuery
`nth` : | the nth format to retrieve. [out]
`format` : | a pointer to store the nth format. [out][allow-none]

### gst_query_new_segment ()

    GstQuery *          gst_query_new_segment               (GstFormat format);

Constructs a new segment query object. Use `gst_query_unref()` when done with it. A segment query is used to discover information about the currently configured segment for playback.

Free-function: gst_query_unref

`format` : | the GstFormat for the new query
Returns : | a new GstQuery. [transfer full]

### gst_query_set_segment ()

    void                gst_query_set_segment               (GstQuery *query,
                                                             gdouble rate,
                                                             GstFormat format,
                                                             gint64 start_value,
                                                             gint64 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.

`start_value` and `stop_value` will respectively contain the configured playback range start and stop values expressed in `format`. The values are always between 0 and the duration of the media and `start_value` <= `stop_value`. `rate` will contain the playback rate. For negative rates, playback will actually happen from `stop_value` to `start_value`.

`query` : | a GstQuery
`rate` : | the rate of the segment
`format` : | the GstFormat of the segment values (`start_value` and `stop_value`)
`start_value` : | the start value
`stop_value` : | the stop value

### gst_query_parse_segment ()

    void                gst_query_parse_segment             (GstQuery *query,
                                                             gdouble *rate,
                                                             GstFormat *format,
                                                             gint64 *start_value,
                                                             gint64 *stop_value);

Parse a segment query answer. Any of `rate`, `format`, `start_value`, and `stop_value` may be NULL, which will cause this value to be omitted.

See `gst_query_set_segment()` for an explanation of the function arguments.

`query` : | a GstQuery
`rate` : | the storage for the rate of the segment, or NULL. [out][allow-none]
`format` : | the storage for the GstFormat of the values, or NULL. [out][allow-none]
`start_value` : | the storage for the start value, or NULL. [out][allow-none]
`stop_value` : | the storage for the stop value, or NULL. [out][allow-none]

### gst_query_new_caps ()

    GstQuery *          gst_query_new_caps                  (GstCaps *filter);

Constructs a new query object for querying the caps.

The CAPS query should return the allowable caps for a pad in the context of the element's state, its link to other elements, and the devices or files it has opened. These caps must be a subset of the pad template caps. In the NULL state with no links, the CAPS query should ideally return the same caps as the pad template. In rare circumstances, an object property can affect the caps returned by the CAPS query, but this is discouraged.

For most filters, the caps returned by CAPS query is directly affected by the allowed caps on other pads. For demuxers and decoders, the caps returned by the srcpad's getcaps function is directly related to the stream data. Again, the CAPS query should return the most specific caps it reasonably can, since this helps with autoplugging.

The `filter` is used to restrict the result caps, only the caps matching `filter` should be returned from the CAPS query. Specifying a filter might greatly reduce the amount of processing an element needs to do.

Free-function: gst_query_unref

`filter` : | a filter
Returns : | a new GstQuery. [transfer full]

### gst_query_parse_caps ()

    void                gst_query_parse_caps                (GstQuery *query,
                                                             GstCaps **filter);

Get the filter from the caps `query`. The caps remains valid as long as `query` remains valid.

`query` : | The query to parse
`filter` : | A pointer to the caps filter. [out][transfer none]

### gst_query_set_caps_result ()

    void                gst_query_set_caps_result           (GstQuery *query,
                                                             GstCaps *caps);

Set the `caps` result in `query`.

`query` : | The query to use
`caps` : | A pointer to the caps. [in]

### gst_query_parse_caps_result ()

    void                gst_query_parse_caps_result         (GstQuery *query,
                                                             GstCaps **caps);

Get the caps result from `query`. The caps remains valid as long as `query` remains valid.

`query` : | The query to parse
`caps` : | A pointer to the caps. [out][transfer none]

### gst_query_new_accept_caps ()

    GstQuery *          gst_query_new_accept_caps           (GstCaps *caps);

Constructs a new query object for querying if `caps` are accepted.

Free-function: gst_query_unref

`caps` : | a fixed GstCaps
Returns : | a new GstQuery. [transfer full]

### gst_query_parse_accept_caps ()

    void                gst_query_parse_accept_caps         (GstQuery *query,
                                                             GstCaps **caps);

Get the caps from `query`. The caps remains valid as long as `query` remains valid.

`query` : | The query to parse
`caps` : | A pointer to the caps. [out][transfer none]

### gst_query_set_accept_caps_result ()

    void                gst_query_set_accept_caps_result    (GstQuery *query,
                                                             gboolean result);

Set `result` as the result for the `query`.

`query` : | a GST_QUERY_ACCEPT_CAPS type query GstQuery
`result` : | the result to set

### gst_query_parse_accept_caps_result ()

    void                gst_query_parse_accept_caps_result  (GstQuery *query,
                                                             gboolean *result);

Parse the result from `query` and store in `result`.

`query` : | a GST_QUERY_ACCEPT_CAPS type query GstQuery
`result` : | location for the result

### enum GstBufferingMode

    typedef enum {
      GST_BUFFERING_STREAM,
      GST_BUFFERING_DOWNLOAD,
      GST_BUFFERING_TIMESHIFT,
      GST_BUFFERING_LIVE
    } GstBufferingMode;

The different types of buffering methods.

`GST_BUFFERING_STREAM` | a small amount of data is buffered
`GST_BUFFERING_DOWNLOAD` | the stream is being downloaded
`GST_BUFFERING_TIMESHIFT` | the stream is being downloaded in a ringbuffer
`GST_BUFFERING_LIVE` | the stream is a live stream

### gst_query_new_buffering ()

    GstQuery *          gst_query_new_buffering             (GstFormat format);

Constructs a new query object for querying the buffering status of a stream.

Free-function: gst_query_unref

`format` : | the default GstFormat for the new query
Returns : | a new GstQuery. [transfer full]

### gst_query_set_buffering_percent ()

    void                gst_query_set_buffering_percent     (GstQuery *query,
                                                             gboolean busy,
                                                             gint 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.

`query` : | A valid GstQuery of type GST_QUERY_BUFFERING.
`busy` : | if buffering is busy
`percent` : | a buffering percent

### gst_query_parse_buffering_percent ()

    void                gst_query_parse_buffering_percent   (GstQuery *query,
                                                             gboolean *busy,
                                                             gint *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.

`query` : | A valid GstQuery of type GST_QUERY_BUFFERING.
`busy` : | if buffering is busy, or NULL. [out][allow-none]
`percent` : | a buffering percent, or NULL. [out][allow-none]

### gst_query_set_buffering_stats ()

    void                gst_query_set_buffering_stats       (GstQuery *query,
                                                             GstBufferingMode mode,
                                                             gint avg_in,
                                                             gint avg_out,
                                                             gint64 buffering_left);

Configures the buffering stats values in `query`.

`query` : | A valid GstQuery of type GST_QUERY_BUFFERING.
`mode` : | a buffering mode
`avg_in` : | the average input rate
`avg_out` : | the average output rate
`buffering_left` : | amount of buffering time left in milliseconds

### gst_query_parse_buffering_stats ()

    void                gst_query_parse_buffering_stats     (GstQuery *query,
                                                             GstBufferingMode *mode,
                                                             gint *avg_in,
                                                             gint *avg_out,
                                                             gint64 *buffering_left);

Extracts the buffering stats values from `query`.

`query` : | A valid GstQuery of type GST_QUERY_BUFFERING.
`mode` : | a buffering mode, or NULL. [out][allow-none]
`avg_in` : | the average input rate, or NULL. [out][allow-none]
`avg_out` : | the average output rat, or NULLe. [out][allow-none]
`buffering_left` : | amount of buffering time left in milliseconds, or NULL. [out][allow-none]

### gst_query_set_buffering_range ()

    void                gst_query_set_buffering_range       (GstQuery *query,
                                                             GstFormat format,
                                                             gint64 start,
                                                             gint64 stop,
                                                             gint64 estimated_total);

Set the available query result fields in `query`.

`query` : | a GstQuery
`format` : | the format to set for the `start` and `stop` values
`start` : | the start to set
`stop` : | the stop to set
`estimated_total` : | estimated total amount of download time remaining in miliseconds

### gst_query_parse_buffering_range ()

    void                gst_query_parse_buffering_range     (GstQuery *query,
                                                             GstFormat *format,
                                                             gint64 *start,
                                                             gint64 *stop,
                                                             gint64 *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

`query` : | a GST_QUERY_BUFFERING type query GstQuery
`format` : | the format to set for the `segment_start` and `segment_end` values, or NULL. [out][allow-none]
`start` : | the start to set, or NULL. [out][allow-none]
`stop` : | the stop to set, or NULL. [out][allow-none]
`estimated_total` : | estimated total amount of download time remaining in miliseconds, or NULL. [out][allow-none]

### gst_query_add_buffering_range ()

    gboolean            gst_query_add_buffering_range       (GstQuery *query,
                                                             gint64 start,
                                                             gint64 stop);

Set the buffering-ranges array field in `query`. The current last start position of the array should be inferior to `start`.

`query` : | a GST_QUERY_BUFFERING type query GstQuery
`start` : | start position of the range
`stop` : | stop position of the range
Returns : | a gboolean indicating if the range was added or not.

### gst_query_get_n_buffering_ranges ()

    guint               gst_query_get_n_buffering_ranges    (GstQuery *query);

Retrieve the number of values currently stored in the buffered-ranges array of the query's structure.

`query` : | a GST_QUERY_BUFFERING type query GstQuery
Returns : | the range array size as a guint.

### gst_query_parse_nth_buffering_range ()

    gboolean            gst_query_parse_nth_buffering_range (GstQuery *query,
                                                             guint index,
                                                             gint64 *start,
                                                             gint64 *stop);

Parse an available query and get the start and stop values stored at the `index` of the buffered ranges array.

`query` : | a GST_QUERY_BUFFERING type query GstQuery
`index` : | position in the buffered-ranges array to read
`start` : | the start position to set, or NULL. [out][allow-none]
`stop` : | the stop position to set, or NULL. [out][allow-none]
Returns : | a gboolean indicating if the parsing succeeded.

### gst_query_new_uri ()

    GstQuery *          gst_query_new_uri                   (void);

Constructs a new query URI query object. Use `gst_query_unref()` when done with it. An URI query is used to query the current URI that is used by the source or sink.

Free-function: gst_query_unref

Returns : | a new GstQuery. [transfer full]

### gst_query_parse_uri ()

    void                gst_query_parse_uri                 (GstQuery *query,
                                                             gchar **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.

`query` : | a GstQuery
`uri` : | the storage for the current URI (may be NULL). [out][transfer full][allow-none]

### gst_query_set_uri ()

    void                gst_query_set_uri                   (GstQuery *query,
                                                             const gchar *uri);

Answer a URI query by setting the requested URI.

`query` : | a GstQuery with query type GST_QUERY_URI
`uri` : | the URI to set

### gst_query_new_allocation ()

    GstQuery *          gst_query_new_allocation            (GstCaps *caps,
                                                             gboolean need_pool);

Constructs a new query object for querying the allocation properties.

Free-function: gst_query_unref

`caps` : | the negotiated caps
`need_pool` : | return a pool
Returns : | a new GstQuery. [transfer full]

### gst_query_parse_allocation ()

    void                gst_query_parse_allocation          (GstQuery *query,
                                                             GstCaps **caps,
                                                             gboolean *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.

`query` : | a GstQuery
`caps` : | The GstCaps. [out][transfer none][allow-none]
`need_pool` : | Whether a GstBufferPool is needed. [out][allow-none]

### gst_query_add_allocation_pool ()

    void                gst_query_add_allocation_pool       (GstQuery *query,
                                                             GstBufferPool *pool,
                                                             guint size,
                                                             guint min_buffers,
                                                             guint max_buffers);

Set the pool parameters in `query`.

`query` : | A valid GstQuery of type GST_QUERY_ALLOCATION.
`pool` : | the GstBufferPool
`size` : | the size
`min_buffers` : | the min buffers
`max_buffers` : | the max buffers

### gst_query_get_n_allocation_pools ()

    guint               gst_query_get_n_allocation_pools    (GstQuery *query);

Retrieve the number of values currently stored in the pool array of the query's structure.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
Returns : | the pool array size as a guint.

### gst_query_parse_nth_allocation_pool ()

    void                gst_query_parse_nth_allocation_pool (GstQuery *query,
                                                             guint index,
                                                             GstBufferPool **pool,
                                                             guint *size,
                                                             guint *min_buffers,
                                                             guint *max_buffers);

Get the pool parameters in `query`.

Unref `pool` with `gst_object_unref()` when it's not needed any more.

`query` : | A valid GstQuery of type GST_QUERY_ALLOCATION.
`index` : | index to parse
`pool` : | the GstBufferPool. [out][allow-none][transfer full]
`size` : | the size. [out][allow-none]
`min_buffers` : | the min buffers. [out][allow-none]
`max_buffers` : | the max buffers. [out][allow-none]

### gst_query_set_nth_allocation_pool ()

    void                gst_query_set_nth_allocation_pool   (GstQuery *query,
                                                             guint index,
                                                             GstBufferPool *pool,
                                                             guint size,
                                                             guint min_buffers,
                                                             guint max_buffers);

Set the pool parameters in `query`.

`index` : | index to modify
`query` : | A valid GstQuery of type GST_QUERY_ALLOCATION.
`pool` : | the GstBufferPool
`size` : | the size
`min_buffers` : | the min buffers
`max_buffers` : | the max buffers

### gst_query_remove_nth_allocation_pool ()

    void                gst_query_remove_nth_allocation_pool
                                                            (GstQuery *query,
                                                             guint index);

Remove the allocation pool at `index` of the allocation pool array.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
`index` : | position in the allocation pool array to remove

Since 1.2

### gst_query_add_allocation_param ()

    void                gst_query_add_allocation_param      (GstQuery *query,
                                                             GstAllocator *allocator,
                                                             const GstAllocationParams *params);

Add `allocator` and its `params` as a supported memory allocator.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
`allocator` : | the memory allocator. [transfer none][allow-none]
`params` : | a GstAllocationParams. [transfer none][allow-none]

### gst_query_get_n_allocation_params ()

    guint               gst_query_get_n_allocation_params   (GstQuery *query);

Retrieve the number of values currently stored in the allocator params array of the query's structure.

If no memory allocator is specified, the downstream element can handle the default memory allocator. The first memory allocator in the query should be generic and allow mapping to system memory, all following allocators should be ordered by preference with the preferred one first.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
Returns : | the allocator array size as a guint.

### gst_query_parse_nth_allocation_param ()

    void                gst_query_parse_nth_allocation_param
                                                            (GstQuery *query,
                                                             guint index,
                                                             GstAllocator **allocator,
                                                             GstAllocationParams *params);

Parse an available query and get the alloctor and its params at `index` of the allocator array.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
`index` : | position in the allocator array to read
`allocator` : | variable to hold the result. [out][transfer full][allow-none]
`params` : | parameters for the allocator. [out][allow-none]

### gst_query_set_nth_allocation_param ()

    void                gst_query_set_nth_allocation_param  (GstQuery *query,
                                                             guint index,
                                                             GstAllocator *allocator,
                                                             const GstAllocationParams *params);

Parse an available query and get the alloctor and its params at `index` of the allocator array.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
`index` : | position in the allocator array to set
`allocator` : | new allocator to set. [transfer none][allow-none]
`params` : | parameters for the allocator. [transfer none][allow-none]

### gst_query_remove_nth_allocation_param ()

    void                gst_query_remove_nth_allocation_param
                                                            (GstQuery *query,
                                                             guint index);

Remove the allocation param at `index` of the allocation param array.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
`index` : | position in the allocation param array to remove

Since 1.2

### gst_query_add_allocation_meta ()

    void                gst_query_add_allocation_meta       (GstQuery *query,
                                                             GType api,
                                                             const GstStructure *params);

Add `api` with `params` as one of the supported metadata API to `query`.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
`api` : | the metadata API
`params` : | API specific parameters. [transfer none][allow-none]

### gst_query_get_n_allocation_metas ()

    guint               gst_query_get_n_allocation_metas    (GstQuery *query);

Retrieve the number of values currently stored in the meta API array of the query's structure.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
Returns : | the metadata API array size as a guint.

### gst_query_parse_nth_allocation_meta ()

    GType               gst_query_parse_nth_allocation_meta (GstQuery *query,
                                                             guint index,
                                                             const GstStructure **params);

Parse an available query and get the metadata API at `index` of the metadata API array.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
`index` : | position in the metadata API array to read
`params` : | API specific flags. [out][transfer none][allow-none]
Returns : | a GType of the metadata API at `index`.

### gst_query_remove_nth_allocation_meta ()

    void                gst_query_remove_nth_allocation_meta
                                                            (GstQuery *query,
                                                             guint index);

Remove the metadata API at `index` of the metadata API array.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
`index` : | position in the metadata API array to remove

### gst_query_find_allocation_meta ()

    gboolean            gst_query_find_allocation_meta      (GstQuery *query,
                                                             GType api,
                                                             guint *index);

Check if `query` has metadata `api` set. When this function returns TRUE, `index` will contain the index where the requested API and the flags can be found.

`query` : | a GST_QUERY_ALLOCATION type query GstQuery
`api` : | the metadata API
`index` : | the index. [out][transfer none][allow-none]
Returns : | TRUE when `api` is in the list of metadata.

### enum GstSchedulingFlags

    typedef enum {
      GST_SCHEDULING_FLAG_SEEKABLE          = (1 << 0),
      GST_SCHEDULING_FLAG_SEQUENTIAL        = (1 << 1),
      GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED = (1 << 2)
    } GstSchedulingFlags;

The different scheduling flags.

`GST_SCHEDULING_FLAG_SEEKABLE` | if seeking is possible
`GST_SCHEDULING_FLAG_SEQUENTIAL` | if sequential access is recommended
`GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED` | if bandwidth is limited and buffering possible (since 1.2)

### gst_query_new_scheduling ()

    GstQuery *          gst_query_new_scheduling            (void);

Constructs a new query object for querying the scheduling properties.

Free-function: gst_query_unref

Returns : | a new GstQuery. [transfer full]

### gst_query_parse_scheduling ()

    void                gst_query_parse_scheduling          (GstQuery *query,
                                                             GstSchedulingFlags *flags,
                                                             gint *minsize,
                                                             gint *maxsize,
                                                             gint *align);

Set the scheduling properties.

`query` : | A valid GstQuery of type GST_QUERY_SCHEDULING.
`flags` : | GstSchedulingFlags. [out][allow-none]
`minsize` : | the suggested minimum size of pull requests. [out][allow-none]
`maxsize` : | the suggested maximum size of pull requests:. [out][allow-none]
`align` : | the suggested alignment of pull requests. [out][allow-none]

### gst_query_set_scheduling ()

    void                gst_query_set_scheduling            (GstQuery *query,
                                                             GstSchedulingFlags flags,
                                                             gint minsize,
                                                             gint maxsize,
                                                             gint align);

Set the scheduling properties.

`query` : | A valid GstQuery of type GST_QUERY_SCHEDULING.
`flags` : | GstSchedulingFlags
`minsize` : | the suggested minimum size of pull requests
`maxsize` : | the suggested maximum size of pull requests
`align` : | the suggested alignment of pull requests

### gst_query_add_scheduling_mode ()

    void                gst_query_add_scheduling_mode       (GstQuery *query,
                                                             GstPadMode mode);

Add `mode` as aone of the supported scheduling modes to `query`.

`query` : | a GST_QUERY_SCHEDULING type query GstQuery
`mode` : | a GstPadMode

### gst_query_get_n_scheduling_modes ()

    guint               gst_query_get_n_scheduling_modes    (GstQuery *query);

Retrieve the number of values currently stored in the scheduling mode array of the query's structure.

`query` : | a GST_QUERY_SCHEDULING type query GstQuery
Returns : | the scheduling mode array size as a guint.

### gst_query_parse_nth_scheduling_mode ()

    GstPadMode          gst_query_parse_nth_scheduling_mode (GstQuery *query,
                                                             guint index);

Parse an available query and get the scheduling mode at `index` of the scheduling modes array.

`query` : | a GST_QUERY_SCHEDULING type query GstQuery
`index` : | position in the scheduling modes array to read
Returns : | a GstPadMode of the scheduling mode at `index`.

### gst_query_has_scheduling_mode ()

    gboolean            gst_query_has_scheduling_mode       (GstQuery *query,
                                                             GstPadMode mode);

Check if `query` has scheduling mode set.

### Note

When checking if upstream supports pull mode, it is usually not enough to just check for GST_PAD_MODE_PULL with this function, you also want to check whether the scheduling flags returned by `gst_query_parse_scheduling()` have the seeking flag set (meaning random access is supported, not only sequential pulls).

`query` : | a GST_QUERY_SCHEDULING type query GstQuery
`mode` : | the scheduling mode
Returns : | TRUE when `mode` is in the list of scheduling modes.

### gst_query_has_scheduling_mode_with_flags ()

    gboolean            gst_query_has_scheduling_mode_with_flags
                                                            (GstQuery *query,
                                                             GstPadMode mode,
                                                             GstSchedulingFlags flags);

Check if `query` has scheduling mode set and `flags` is set in query scheduling flags.

`query` : | a GST_QUERY_SCHEDULING type query GstQuery
`mode` : | the scheduling mode
`flags` : | GstSchedulingFlags
Returns : | TRUE when `mode` is in the list of scheduling modes and `flags` are compatible with query flags.

### gst_query_new_drain ()

    GstQuery *          gst_query_new_drain                 (void);

Constructs a new query object for querying the drain state.

Free-function: gst_query_unref

Returns : | a new GstQuery. [transfer full]

### gst_query_new_context ()

    GstQuery *          gst_query_new_context               (const gchar *context_type);

Constructs a new query object for querying the pipeline-local context.

Free-function: gst_query_unref

`context_type` : | Context type to query
Returns : | a new GstQuery. [transfer full]

Since 1.2

### gst_query_set_context ()

    void                gst_query_set_context               (GstQuery *query,
                                                             GstContext *context);

Answer a context query by setting the requested context.

`query` : | a GstQuery with query type GST_QUERY_CONTEXT
`context` : | the requested GstContext

Since 1.2

### gst_query_parse_context ()

    void                gst_query_parse_context             (GstQuery *query,
                                                             GstContext **context);

Get the context from the context `query`. The context remains valid as long as `query` remains valid.

`query` : | The query to parse
`context` : | A pointer to store the GstContext. [out][transfer none]

Since 1.2

### gst_query_parse_context_type ()

    gboolean            gst_query_parse_context_type        (GstQuery *query,
                                                             const gchar **context_type);

Parse a context type from an existing GST_QUERY_CONTEXT query.

`query` : | a GST_QUERY_CONTEXT type query
`context_type` : | the context type, or NULL. [out][transfer none][allow-none]
Returns : | a gboolean indicating if the parsing succeeded.

Since 1.2

## See Also

GstPad, GstElement