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

miniObject: Gst.MiniObject

The parent #GstMiniObject type

field

the #GstQueryType

field
name: string

Methods

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

    Parameters

    Returns void

  • addAllocationPool(pool: BufferPool, size: number, minBuffers: number, maxBuffers: number): void
  • Set the pool parameters in query.

    Parameters

    • pool: BufferPool

      the #GstBufferPool

    • size: number

      the buffer size

    • minBuffers: number

      the min buffers

    • maxBuffers: number

      the max buffers

    Returns void

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

  • addSchedulingMode(mode: PadMode): void
  • Add mode as one of the supported scheduling modes to query.

    Parameters

    Returns void

  • findAllocationMeta(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]

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

    Returns number

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

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

    Returns number

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

    Returns number

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

    Returns number

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

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

    Parameters

    Returns boolean

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

    Returns Gst.Caps

  • parseAcceptCapsResult(): boolean
  • Parse the result from query and store in result.

    Returns boolean

  • parseAllocation(): [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]

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

    Returns number

  • parseBufferingPercent(): [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]

  • parseBufferingRange(): [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]

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

    Returns Gst.Caps

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

    Returns Gst.Caps

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

    Returns Gst.Context

  • parseContextType(): [boolean, string]
  • Parse a context type from an existing GST_QUERY_CONTEXT query.

    Returns [boolean, string]

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

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

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

  • parseLatency(): [boolean, number, number]
  • Parse a latency query answer.

    Returns [boolean, number, number]

  • parseNFormats(): number
  • Parse the number of formats in the formats query.

    Returns 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 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 read

    Returns [Gst.Allocator, AllocationParams]

  • parseNthAllocationPool(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]

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

  • parseNthSchedulingMode(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]

  • parseSeeking(): [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]

  • parseSegment(): [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]

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

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

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

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

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

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

  • setAcceptCapsResult(result: boolean): void
  • Set result as the result for the query.

    Parameters

    • result: boolean

      the result to set

    Returns void

  • setBitrate(nominalBitrate: 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

    • nominalBitrate: number

      the nominal bitrate in bits per second

    Returns void

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

  • setBufferingRange(format: Gst.Format, start: number, stop: number, estimatedTotal: 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

    • estimatedTotal: number

      estimated total amount of download time remaining in milliseconds

    Returns void

  • setBufferingStats(mode: Gst.BufferingMode, avgIn: number, avgOut: number, bufferingLeft: number): void
  • Configures the buffering stats values in query.

    Parameters

    • mode: Gst.BufferingMode

      a buffering mode

    • avgIn: number

      the average input rate

    • avgOut: number

      the average output rate

    • bufferingLeft: number

      amount of buffering time left in milliseconds

    Returns void

  • setCapsResult(caps: Gst.Caps): void
  • Answer a context query by setting the requested context.

    Parameters

    Returns void

  • setConvert(srcFormat: Gst.Format, srcValue: number, destFormat: Gst.Format, destValue: number): void
  • Answer a convert query by setting the requested values.

    Parameters

    • srcFormat: Gst.Format

      the source #GstFormat

    • srcValue: number

      the source value

    • destFormat: Gst.Format

      the destination #GstFormat

    • destValue: number

      the destination value

    Returns void

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

  • setLatency(live: boolean, minLatency: number, maxLatency: 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

    • minLatency: number

      the minimal latency of the upstream elements

    • maxLatency: 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

  • setNthAllocationPool(index: number, pool: BufferPool, size: number, minBuffers: number, maxBuffers: number): void
  • Set the pool parameters in query.

    Parameters

    • index: number

      index to modify

    • pool: BufferPool

      the #GstBufferPool

    • size: number

      the buffer size

    • minBuffers: number

      the min buffers

    • maxBuffers: number

      the max buffers

    Returns void

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

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

  • setSeeking(format: Gst.Format, seekable: boolean, segmentStart: number, segmentEnd: 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

    • segmentStart: number

      the segment_start to set

    • segmentEnd: number

      the segment_end to set

    Returns void

  • setSegment(rate: number, format: Gst.Format, startValue: number, stopValue: 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)

    • startValue: number

      the start value

    • stopValue: number

      the stop value

    Returns void

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

    Parameters

    • uri: string

      the URI to set

    Returns void

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

    Parameters

    • uri: string

      the URI to set

    Returns void

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

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

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

    Free-function: gst_query_unref()

    Parameters

    Returns Gst.Query

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

    Free-function: gst_query_unref()

    Parameters

    • caps: Gst.Caps

      the negotiated caps

    • needPool: boolean

      return a pool

    Returns Gst.Query

  • Constructs a new query object for querying the bitrate.

    Free-function: gst_query_unref()

    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

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

    Free-function: gst_query_unref()

    Parameters

    • contextType: 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

    • srcFormat: Gst.Format

      the source #GstFormat for the new query

    • value: number

      the value to convert

    • destFormat: Gst.Format

      the target #GstFormat

    Returns Gst.Query

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

    Free-function: gst_query_unref()

    Parameters

    Returns Gst.Query

  • Constructs a new query object for querying the drain state.

    Free-function: gst_query_unref()

    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 query object for querying formats of the stream.

    Free-function: gst_query_unref()

    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 the scheduling properties.

    Free-function: gst_query_unref()

    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

    • oldQuery: Gst.Query

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

    • newQuery: 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