Query

Queries can be performed on pads (gst.pad.Pad.query) and elements (gst.element.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);
class Query : Boxed {}

Members

Functions

addAllocationMeta
void addAllocationMeta(gobject.types.GType api, gst.structure.Structure params)

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

addAllocationParam
void addAllocationParam(gst.allocator.Allocator allocator, gst.allocation_params.AllocationParams params)

Add allocator and its params as a supported memory allocator.

addAllocationPool
void addAllocationPool(gst.buffer_pool.BufferPool pool, uint size, uint minBuffers, uint maxBuffers)

Set the pool parameters in query.

addBufferingRange
bool addBufferingRange(long start, long stop)

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

addSchedulingMode
void addSchedulingMode(gst.types.PadMode mode)

Add mode as one of the supported scheduling modes to query.

findAllocationMeta
bool findAllocationMeta(gobject.types.GType api, uint index)

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.

getNAllocationMetas
uint getNAllocationMetas()

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

getNAllocationParams
uint getNAllocationParams()

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

getNAllocationPools
uint getNAllocationPools()

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

getNBufferingRanges
uint getNBufferingRanges()

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

getNSchedulingModes
uint getNSchedulingModes()

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

getStructure
gst.structure.Structure getStructure()

Get the structure of a query.

hasSchedulingMode
bool hasSchedulingMode(gst.types.PadMode mode)

Check if query has scheduling mode set.

hasSchedulingModeWithFlags
bool hasSchedulingModeWithFlags(gst.types.PadMode mode, gst.types.SchedulingFlags flags)

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

parseAcceptCaps
void parseAcceptCaps(gst.caps.Caps caps)

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

parseAcceptCapsResult
void parseAcceptCapsResult(bool result)

Parse the result from query and store in result.

parseAllocation
void parseAllocation(gst.caps.Caps caps, bool needPool)

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.

parseBitrate
void parseBitrate(uint nominalBitrate)

Get the results of a bitrate query. See also gst.query.Query.setBitrate.

parseBufferingPercent
void parseBufferingPercent(bool busy, int 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.

parseBufferingRange
void parseBufferingRange(gst.types.Format format, long start, long stop, long estimatedTotal)

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

parseBufferingStats
void parseBufferingStats(gst.types.BufferingMode mode, int avgIn, int avgOut, long bufferingLeft)

Extracts the buffering stats values from query.

parseCaps
void parseCaps(gst.caps.Caps filter)

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

parseCapsResult
void parseCapsResult(gst.caps.Caps caps)

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

parseContext
void parseContext(gst.context.Context context)

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

parseContextType
bool parseContextType(string contextType)

Parse a context type from an existing GST_QUERY_CONTEXT query.

parseConvert
void parseConvert(gst.types.Format srcFormat, long srcValue, gst.types.Format destFormat, long destValue)

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.

parseDuration
void parseDuration(gst.types.Format format, long 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.

parseLatency
void parseLatency(bool live, gst.types.ClockTime minLatency, gst.types.ClockTime maxLatency)

Parse a latency query answer.

parseNFormats
void parseNFormats(uint nFormats)

Parse the number of formats in the formats query.

parseNthAllocationMeta
gobject.types.GType parseNthAllocationMeta(uint index, gst.structure.Structure params)

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

parseNthAllocationParam
void parseNthAllocationParam(uint index, gst.allocator.Allocator allocator, gst.allocation_params.AllocationParams params)

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

parseNthAllocationPool
void parseNthAllocationPool(uint index, gst.buffer_pool.BufferPool pool, uint size, uint minBuffers, uint maxBuffers)

Get the pool parameters in query.

parseNthBufferingRange
bool parseNthBufferingRange(uint index, long start, long stop)

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

parseNthFormat
void parseNthFormat(uint nth, gst.types.Format 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.

parseNthSchedulingMode
gst.types.PadMode parseNthSchedulingMode(uint index)

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

parsePosition
void parsePosition(gst.types.Format format, long cur)

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

parseScheduling
void parseScheduling(gst.types.SchedulingFlags flags, int minsize, int maxsize, int align_)

Set the scheduling properties.

parseSeeking
void parseSeeking(gst.types.Format format, bool seekable, long segmentStart, long segmentEnd)

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

parseSegment
void parseSegment(double rate, gst.types.Format format, long startValue, long stopValue)

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.

parseSelectable
void parseSelectable(bool selectable)

Get the results of a selectable query. See also gst.query.Query.setSelectable.

parseUri
void parseUri(string 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 glib.global.gfree after usage.

parseUriRedirection
void parseUriRedirection(string 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 glib.global.gfree after usage.

parseUriRedirectionPermanent
void parseUriRedirectionPermanent(bool permanent)

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.

removeNthAllocationMeta
void removeNthAllocationMeta(uint index)

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

removeNthAllocationParam
void removeNthAllocationParam(uint index)

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

removeNthAllocationPool
void removeNthAllocationPool(uint index)

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

setAcceptCapsResult
void setAcceptCapsResult(bool result)

Set result as the result for the query.

setBitrate
void setBitrate(uint nominalBitrate)

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

setBufferingPercent
void setBufferingPercent(bool busy, int 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.

setBufferingRange
void setBufferingRange(gst.types.Format format, long start, long stop, long estimatedTotal)

Set the available query result fields in query.

setBufferingStats
void setBufferingStats(gst.types.BufferingMode mode, int avgIn, int avgOut, long bufferingLeft)

Configures the buffering stats values in query.

setCapsResult
void setCapsResult(gst.caps.Caps caps)

Set the caps result in query.

setContext
void setContext(gst.context.Context context)

Answer a context query by setting the requested context.

setConvert
void setConvert(gst.types.Format srcFormat, long srcValue, gst.types.Format destFormat, long destValue)

Answer a convert query by setting the requested values.

setDuration
void setDuration(gst.types.Format format, long duration)

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

setFormatsv
void setFormatsv(gst.types.Format[] formats)

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

setLatency
void setLatency(bool live, gst.types.ClockTime minLatency, gst.types.ClockTime maxLatency)

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

setNthAllocationParam
void setNthAllocationParam(uint index, gst.allocator.Allocator allocator, gst.allocation_params.AllocationParams params)

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

setNthAllocationPool
void setNthAllocationPool(uint index, gst.buffer_pool.BufferPool pool, uint size, uint minBuffers, uint maxBuffers)

Set the pool parameters in query.

setPosition
void setPosition(gst.types.Format format, long cur)

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

setScheduling
void setScheduling(gst.types.SchedulingFlags flags, int minsize, int maxsize, int align_)

Set the scheduling properties.

setSeeking
void setSeeking(gst.types.Format format, bool seekable, long segmentStart, long segmentEnd)

Set the seeking query result fields in query.

setSegment
void setSegment(double rate, gst.types.Format format, long startValue, long stopValue)

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.

setSelectable
void setSelectable(bool selectable)

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

setUri
void setUri(string uri)

Answer a URI query by setting the requested URI.

setUriRedirection
void setUriRedirection(string uri)

Answer a URI query by setting the requested URI redirection.

setUriRedirectionPermanent
void setUriRedirectionPermanent(bool permanent)

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

writableStructure
gst.structure.Structure writableStructure()

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.

Static functions

newAcceptCaps
gst.query.Query newAcceptCaps(gst.caps.Caps caps)

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

newAllocation
gst.query.Query newAllocation(gst.caps.Caps caps, bool needPool)

Constructs a new query object for querying the allocation properties.

newBitrate
gst.query.Query newBitrate()

Constructs a new query object for querying the bitrate.

newBuffering
gst.query.Query newBuffering(gst.types.Format format)

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

newCaps
gst.query.Query newCaps(gst.caps.Caps filter)

Constructs a new query object for querying the caps.

newContext
gst.query.Query newContext(string contextType)

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

newConvert
gst.query.Query newConvert(gst.types.Format srcFormat, long value, gst.types.Format destFormat)

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.

newCustom
gst.query.Query newCustom(gst.types.QueryType type, gst.structure.Structure structure)

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

newDrain
gst.query.Query newDrain()

Constructs a new query object for querying the drain state.

newDuration
gst.query.Query newDuration(gst.types.Format 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.

newFormats
gst.query.Query newFormats()

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

newLatency
gst.query.Query newLatency()

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.

newPosition
gst.query.Query newPosition(gst.types.Format 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.

newScheduling
gst.query.Query newScheduling()

Constructs a new query object for querying the scheduling properties.

newSeeking
gst.query.Query newSeeking(gst.types.Format format)

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

newSegment
gst.query.Query newSegment(gst.types.Format 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.

newSelectable
gst.query.Query newSelectable()

Constructs a new query object for querying the stream selection capability.

newUri
gst.query.Query newUri()

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.

Inherited Members

From Boxed

cInstancePtr
void* cInstancePtr;

Pointer to the C boxed value

getType
GType getType()

Get the GType of this boxed type.

gType
GType gType [@property getter]

Boxed GType property.

self
Boxed self()

Convenience method to return this cast to a type. For use in D with statements.

copy_
void* copy_()

Make a copy of the wrapped C boxed data.

boxedCopy
void* boxedCopy(void* cBoxed)

Copy a C boxed value using g_boxed_copy.

boxedFree
void boxedFree(void* cBoxed)

Free a C boxed value using g_boxed_free.