Gjsify LogoGjsify Logo

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

Hierarchy

  • Query

Index

Constructors

Properties

mini_object: Gst.MiniObject

The parent #GstMiniObject type

field

the #GstQueryType

field
name: string

Methods

  • add_allocation_pool(pool: BufferPool, size: number, min_buffers: number, max_buffers: number): void
  • Set the pool parameters in query.

    Parameters

    • pool: BufferPool

      the #GstBufferPool

    • size: number

      the buffer size

    • min_buffers: number

      the min buffers

    • max_buffers: number

      the max buffers

    Returns void

  • add_buffering_range(start: number, stop: number): boolean
  • 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

  • add_scheduling_mode(mode: PadMode): void
  • find_allocation_meta(api: GType<unknown>): [boolean, number]
  • 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<unknown>

      the metadata API

    Returns [boolean, number]

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

    Returns number

  • get_n_allocation_params(): number
  • 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

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

    Returns number

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

    Returns number

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

    Returns number

  • has_scheduling_mode(mode: PadMode): boolean
  • 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

  • parse_accept_caps_result(): boolean
  • parse_allocation(): [Gst.Caps, 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]

  • parse_bitrate(): number
  • parse_buffering_percent(): [boolean, 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_buffering_range(): [Gst.Format, number, number, 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_context_type(): [boolean, string]
  • 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_latency(): [boolean, number, number]
  • parse_n_formats(): 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>, Gst.Structure]

  • parse_nth_allocation_pool(index: number): [BufferPool, number, number, number]
  • 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 [BufferPool, number, number, number]

  • parse_nth_buffering_range(index: number): [boolean, 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]

  • 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_nth_scheduling_mode(index: number): PadMode
  • 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 PadMode

  • 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_seeking(): [Gst.Format, boolean, number, 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_segment(): [number, Gst.Format, 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]

  • parse_uri(): 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_uri_redirection(): 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_uri_redirection_permanent(): boolean
  • 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_nth_allocation_meta(index: number): void
  • 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_nth_allocation_param(index: number): 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_nth_allocation_pool(index: number): 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_accept_caps_result(result: boolean): void
  • set_bitrate(nominal_bitrate: number): 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_buffering_percent(busy: boolean, percent: number): 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_buffering_range(format: Gst.Format, start: number, stop: number, estimated_total: number): 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

  • set_buffering_stats(mode: Gst.BufferingMode, avg_in: number, avg_out: number, buffering_left: number): 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

  • set_caps_result(caps: Gst.Caps): void
  • set_convert(src_format: Gst.Format, src_value: number, dest_format: Gst.Format, dest_value: number): void
  • Answer a convert query by setting the requested values.

    Parameters

    • src_format: Gst.Format

      the source #GstFormat

    • src_value: number

      the source value

    • dest_format: Gst.Format

      the destination #GstFormat

    • dest_value: number

      the destination value

    Returns void

  • set_duration(format: Gst.Format, duration: number): void
  • Answer a duration query by setting the requested value in the given format.

    Parameters

    • format: Gst.Format

      the #GstFormat for the duration

    • duration: number

      the duration of the stream

    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

  • set_latency(live: boolean, min_latency: number, max_latency: number): 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

    • allocator: Gst.Allocator

      new allocator to set

    • params: AllocationParams

      parameters for the allocator

    Returns void

  • set_nth_allocation_pool(index: number, pool: BufferPool, size: number, min_buffers: number, max_buffers: number): void
  • Set the pool parameters in query.

    Parameters

    • index: number

      index to modify

    • pool: BufferPool

      the #GstBufferPool

    • size: number

      the buffer size

    • min_buffers: number

      the min buffers

    • max_buffers: number

      the max buffers

    Returns void

  • set_position(format: Gst.Format, cur: number): void
  • Answer a position query by setting the requested value in the given format.

    Parameters

    • format: Gst.Format

      the requested #GstFormat

    • cur: number

      the position to set

    Returns void

  • set_scheduling(flags: SchedulingFlags, minsize: number, maxsize: number, align: number): void
  • Set the scheduling properties.

    Parameters

    • flags: SchedulingFlags

      #GstSchedulingFlags

    • 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_seeking(format: Gst.Format, seekable: boolean, segment_start: number, segment_end: number): 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

  • set_segment(rate: number, format: Gst.Format, start_value: number, stop_value: number): 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 #GstFormat of the segment values (start_value and stop_value)

    • start_value: number

      the start value

    • stop_value: number

      the stop value

    Returns void

  • set_uri(uri: string): void
  • set_uri_redirection(uri: string): void
  • Answer a URI query by setting the requested URI redirection.

    Parameters

    • uri: string

      the URI to set

    Returns void

  • set_uri_redirection_permanent(permanent: boolean): 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

  • Constructs a new query object for querying the allocation properties.

    Free-function: gst_query_unref()

    Parameters

    • caps: Gst.Caps

      the negotiated caps

    • need_pool: boolean

      return a pool

    Returns Gst.Query

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

    Free-function: gst_query_unref()

    Parameters

    • format: Gst.Format

      the default #GstFormat for the new query

    Returns Gst.Query

  • 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()

    Parameters

    Returns Gst.Query

  • new_context(context_type: string): Gst.Query
  • Constructs a new query object for querying the pipeline-local context.

    Free-function: gst_query_unref()

    Parameters

    • context_type: string

      Context type to query

    Returns Gst.Query

  • 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()

    Parameters

    • src_format: Gst.Format

      the source #GstFormat for the new query

    • value: number

      the value to convert

    • dest_format: Gst.Format

      the target #GstFormat

    Returns Gst.Query

  • 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()

    Parameters

    • format: Gst.Format

      the #GstFormat for this duration query

    Returns Gst.Query

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

  • 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()

    Parameters

    • format: Gst.Format

      the default #GstFormat for the new query

    Returns Gst.Query

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

    Free-function: gst_query_unref()

    Parameters

    • format: Gst.Format

      the default #GstFormat for the new query

    Returns Gst.Query

  • 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()

    Parameters

    • format: Gst.Format

      the #GstFormat for the new query

    Returns Gst.Query

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

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

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

    Parameters

    • old_query: Gst.Query

      pointer to a pointer to a #GstQuery to be stolen.

    • new_query: Gst.Query

      pointer to a #GstQuery that will replace the query pointed to by old_query.

    Returns [boolean, Gst.Query]

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method