Class (GI Struct)

Gst-1.0GstQuery

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);
Index

Constructors

Properties

Methods

add_allocation_meta add_allocation_param add_allocation_pool add_buffering_range add_scheduling_mode find_allocation_meta get_n_allocation_metas get_n_allocation_params get_n_allocation_pools get_n_buffering_ranges get_n_scheduling_modes get_structure has_scheduling_mode has_scheduling_mode_with_flags is_writable make_writable parse_accept_caps parse_accept_caps_result parse_allocation parse_bitrate parse_buffering_percent parse_buffering_range parse_buffering_stats parse_caps parse_caps_result parse_context parse_context_type parse_convert parse_duration parse_latency parse_n_formats parse_nth_allocation_meta parse_nth_allocation_param parse_nth_allocation_pool parse_nth_buffering_range parse_nth_format parse_nth_scheduling_mode parse_position parse_scheduling parse_seeking parse_segment parse_selectable parse_uri parse_uri_redirection parse_uri_redirection_permanent ref remove_nth_allocation_meta remove_nth_allocation_param remove_nth_allocation_pool set_accept_caps_result set_bitrate set_buffering_percent set_buffering_range set_buffering_stats set_caps_result set_context set_convert set_duration set_formatsv set_latency set_nth_allocation_param set_nth_allocation_pool set_position set_scheduling set_seeking set_segment set_selectable set_uri set_uri_redirection set_uri_redirection_permanent writable_structure new_accept_caps new_allocation new_bitrate new_buffering new_caps new_context new_convert new_custom new_drain new_duration new_formats new_latency new_position new_scheduling new_seeking new_segment new_selectable new_uri take

Constructors

Properties

$gtype: GType<Query>

Methods

  • Set the pool parameters in query.

    Parameters

    • pool: Gst.BufferPool
    • size: number

      the buffer size

    • min_buffers: number

      the min buffers

    • max_buffers: number

      the max buffers

    Returns void

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

    Parameters

    • start: number

      start position of the range

    • stop: number

      stop position of the range

    Returns boolean

    a gboolean indicating if the range was added or not.

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

    Parameters

    • api: GType

      the metadata API

    Returns [boolean, number]

    true when api is in the list of metadata.

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

    Returns number

    the metadata API array size as a guint.

  • 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.

    Returns number

    the allocator array size as a guint.

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

    Returns number

    the pool array size as a guint.

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

    Returns number

    the range array size as a guint.

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

    Returns number

    the scheduling mode array size as a guint.

  • Check if query has scheduling mode set.

    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).

    Parameters

    Returns boolean

    true when mode is in the list of scheduling modes.

  • Tests if you can safely modify query. It is only safe to modify query when there is only one owner of the query - ie, the object is writable.

    Returns boolean

  • Returns a writable copy of query.

    If there is only one reference count on query, the caller must be the owner, and so this function will return the query object unchanged. If on the other hand there is more than one reference on the object, a new query object will be returned. The caller's reference on query will be removed, and instead the caller will own a reference to the returned object.

    In short, this function unrefs the query in the argument and refs the query that it returns. Don't access the argument after calling this function. See also: gst_query_ref().

    Returns Query

    a writable query which may or may not be the same as query

  • Parse the result from query and store in result.

    Returns boolean

  • 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.

    Pool details can be retrieved using gst_query_get_n_allocation_pools() and gst_query_parse_nth_allocation_pool().

    Returns [Gst.Caps, boolean]

  • Get the results of a bitrate query. See also gst_query_set_bitrate().

    Returns number

  • 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.

    Returns [boolean, number]

  • Parse an available query, writing the format into format, and other results into the passed parameters, if the respective parameters are non-null

    Returns [Gst.Format, number, number, number]

  • Parse a context type from an existing GST_QUERY_CONTEXT query.

    Returns [boolean, string]

    a gboolean indicating if the parsing succeeded.

  • 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.

    Returns [Gst.Format, number]

  • Parse a latency query answer.

    Returns [boolean, number, number]

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

    Parameters

    • index: number

      position in the metadata API array to read

    Returns [GType<unknown>, Structure]

    a GObject.GType of the metadata API at index.

  • Get the pool parameters in query.

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

    Parameters

    • index: number

      index to parse

    Returns [Gst.BufferPool, number, number, number]

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

    Parameters

    • index: number

      position in the buffered-ranges array to read

    Returns [boolean, number, number]

    a gboolean indicating if the parsing succeeded.

  • 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.

    Parameters

    • nth: number

      the nth format to retrieve.

    Returns Gst.Format

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

    Parameters

    • index: number

      position in the scheduling modes array to read

    Returns Gst.PadMode

    a Gst.PadMode of the scheduling mode at index.

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

    Returns [Gst.Format, number]

  • Parse a seeking query, writing the format into format, and other results into the passed parameters, if the respective parameters are non-null

    Returns [Gst.Format, boolean, number, number]

  • 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.

    Returns [number, Gst.Format, number, number]

  • Get the results of a selectable query. See also gst_query_set_selectable().

    Returns boolean

  • 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.

    Returns string

  • 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.

    Returns string

  • Parse an URI query, and set permanent to true if there is a redirection and it should be considered permanent. If a redirection is permanent, applications should update their internal storage of the URI, otherwise they should make all future requests to the original URI.

    Returns boolean

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

    Parameters

    • index: number

      position in the metadata API array to remove

    Returns void

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

    Parameters

    • index: number

      position in the allocation param array to remove

    Returns void

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

    Parameters

    • index: number

      position in the allocation pool array to remove

    Returns void

  • Set result as the result for the query.

    Parameters

    • result: boolean

      the result to set

    Returns void

  • Set the results of a bitrate query. The nominal bitrate is the average bitrate expected over the length of the stream as advertised in file headers (or similar).

    Parameters

    • nominal_bitrate: number

      the nominal bitrate in bits per second

    Returns void

  • 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.

    Parameters

    • busy: boolean

      if buffering is busy

    • percent: number

      a buffering percent

    Returns void

  • Set the available query result fields in query.

    Parameters

    • format: Gst.Format

      the format to set for the start and stop values

    • start: number

      the start to set

    • stop: number

      the stop to set

    • estimated_total: number

      estimated total amount of download time remaining in milliseconds

    Returns void

  • Configures the buffering stats values in query.

    Parameters

    • mode: Gst.BufferingMode

      a buffering mode

    • avg_in: number

      the average input rate

    • avg_out: number

      the average output rate

    • buffering_left: number

      amount of buffering time left in milliseconds

    Returns void

  • Answer a convert query by setting the requested values.

    Parameters

    Returns void

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

    Parameters

    Returns void

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

    Parameters

    • formats: Gst.Format[]

      an array containing n_formats GstFormat values.

    Returns void

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

    Parameters

    • live: boolean

      if there is a live element upstream

    • min_latency: number

      the minimal latency of the upstream elements

    • max_latency: number

      the maximal latency of the upstream elements

    Returns void

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

    Parameters

    • index: number

      position in the allocator array to set

    • Optionalallocator: Gst.Allocator

      new allocator to set

    • Optionalparams: AllocationParams

      parameters for the allocator

    Returns void

  • Set the pool parameters in query.

    Parameters

    • index: number

      index to modify

    • pool: Gst.BufferPool
    • size: number

      the buffer size

    • min_buffers: number

      the min buffers

    • max_buffers: number

      the max buffers

    Returns void

  • Set the scheduling properties.

    Parameters

    • flags: Gst.SchedulingFlags
    • minsize: number

      the suggested minimum size of pull requests

    • maxsize: number

      the suggested maximum size of pull requests

    • align: number

      the suggested alignment of pull requests

    Returns void

  • Set the seeking query result fields in query.

    Parameters

    • format: Gst.Format

      the format to set for the segment_start and segment_end values

    • seekable: boolean

      the seekable flag to set

    • segment_start: number

      the segment_start to set

    • segment_end: number

      the segment_end to set

    Returns void

  • 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.

    Parameters

    • rate: number

      the rate of the segment

    • format: Gst.Format

      the Gst.Format of the segment values (start_value and stop_value)

    • start_value: number

      the start value

    • stop_value: number

      the stop value

    Returns void

  • Set the results of a selectable query. If the element answering the query can handle stream selection, selectable should be set to true.

    Parameters

    • selectable: boolean

      Whether the element can handle stream selection.

    Returns void

  • Answer a URI query by setting the requested URI.

    Parameters

    • Optionaluri: string

      the URI to set

    Returns void

  • Answer a URI query by setting the requested URI redirection.

    Parameters

    • Optionaluri: string

      the URI to set

    Returns void

  • Answer a URI query by setting the requested URI redirection to permanent or not.

    Parameters

    • permanent: boolean

      whether the redirect is permanent or not

    Returns void

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

    Returns Structure

    the Gst.Structure of the query. The structure is still owned by the query and will therefore be freed when the query is unreffed.

  • Modifies a pointer to a Gst.Query to point to a different Gst.Query. This function is similar to gst_query_replace() except that it takes ownership of new_query.

    Either new_query or the Gst.Query pointed to by old_query may be null.

    Parameters

    • Optionalold_query: Query

      pointer to a pointer to a Gst.Query to be stolen.

    • Optionalnew_query: Query

      pointer to a Gst.Query that will replace the query pointed to by old_query.

    Returns [boolean, Query]