2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wim.taymans@chello.be>
4 * 2005 Wim Taymans <wim@fluendo.com>
6 * gstquery.c: GstQueryType registration and Query parsing/creation
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
26 * @short_description: Provide functions to create queries, and to set and parse
28 * @see_also: #GstPad, #GstElement
30 * Queries can be performed on pads (gst_pad_query()) and elements
31 * (gst_element_query()). Please note that some queries might need a running
34 * Queries can be created using the gst_query_new_*() functions.
35 * Query values can be set using gst_query_set_*(), and parsed using
36 * gst_query_parse_*() helpers.
38 * The following example shows how to query the duration of a pipeline:
41 * <title>Query duration on a pipeline</title>
45 * query = gst_query_new_duration (GST_FORMAT_TIME);
46 * res = gst_element_query (pipeline, query);
49 * gst_query_parse_duration (query, NULL, &duration);
50 * g_print ("duration = %"GST_TIME_FORMAT, GST_TIME_ARGS (duration));
53 * g_print ("duration query failed...");
55 * gst_query_unref (query);
59 * Last reviewed on 2012-03-29 (0.11.3)
63 #include "gst_private.h"
67 #include "gstenumtypes.h"
70 #include "gstbufferpool.h"
72 GST_DEBUG_CATEGORY_STATIC (gst_query_debug);
73 #define GST_CAT_DEFAULT gst_query_debug
75 static GType _gst_query_type = 0;
81 GstStructure *structure;
84 #define GST_QUERY_STRUCTURE(q) (((GstQueryImpl *)(q))->structure)
94 static GstQueryQuarks query_quarks[] = {
95 {GST_QUERY_UNKNOWN, "unknown", 0},
96 {GST_QUERY_POSITION, "position", 0},
97 {GST_QUERY_DURATION, "duration", 0},
98 {GST_QUERY_LATENCY, "latency", 0},
99 {GST_QUERY_JITTER, "jitter", 0},
100 {GST_QUERY_RATE, "rate", 0},
101 {GST_QUERY_SEEKING, "seeking", 0},
102 {GST_QUERY_SEGMENT, "segment", 0},
103 {GST_QUERY_CONVERT, "convert", 0},
104 {GST_QUERY_FORMATS, "formats", 0},
105 {GST_QUERY_BUFFERING, "buffering", 0},
106 {GST_QUERY_CUSTOM, "custom", 0},
107 {GST_QUERY_URI, "uri", 0},
108 {GST_QUERY_ALLOCATION, "allocation", 0},
109 {GST_QUERY_SCHEDULING, "scheduling", 0},
110 {GST_QUERY_ACCEPT_CAPS, "accept-caps", 0},
111 {GST_QUERY_CAPS, "caps", 0},
112 {GST_QUERY_DRAIN, "drain", 0},
113 {GST_QUERY_TOC, "toc", 0},
118 GST_DEFINE_MINI_OBJECT_TYPE (GstQuery, gst_query);
121 _priv_gst_query_initialize (void)
125 _gst_query_type = gst_query_get_type ();
127 GST_DEBUG_CATEGORY_INIT (gst_query_debug, "query", 0, "query system");
129 for (i = 0; query_quarks[i].name; i++) {
130 query_quarks[i].quark = g_quark_from_static_string (query_quarks[i].name);
135 * gst_query_type_get_name:
136 * @type: the query type
138 * Get a printable name for the given query type. Do not modify or free.
140 * Returns: a reference to the static name of the query.
143 gst_query_type_get_name (GstQueryType type)
147 for (i = 0; query_quarks[i].name; i++) {
148 if (type == query_quarks[i].type)
149 return query_quarks[i].name;
155 * gst_query_type_to_quark:
156 * @type: the query type
158 * Get the unique quark for the given query type.
160 * Returns: the quark associated with the query type
163 gst_query_type_to_quark (GstQueryType type)
167 for (i = 0; query_quarks[i].name; i++) {
168 if (type == query_quarks[i].type)
169 return query_quarks[i].quark;
175 * gst_query_type_get_flags:
176 * @type: a #GstQueryType
178 * Gets the #GstQueryTypeFlags associated with @type.
180 * Returns: a #GstQueryTypeFlags.
183 gst_query_type_get_flags (GstQueryType type)
185 GstQueryTypeFlags ret;
187 ret = type & ((1 << GST_QUERY_NUM_SHIFT) - 1);
193 _gst_query_free (GstQuery * query)
197 g_return_if_fail (query != NULL);
199 s = GST_QUERY_STRUCTURE (query);
201 gst_structure_set_parent_refcount (s, NULL);
202 gst_structure_free (s);
205 g_slice_free1 (sizeof (GstQueryImpl), query);
209 _gst_query_copy (GstQuery * query)
214 s = GST_QUERY_STRUCTURE (query);
216 s = gst_structure_copy (s);
218 copy = gst_query_new_custom (query->type, s);
224 * gst_query_new_position:
225 * @format: the default #GstFormat for the new query
227 * Constructs a new query stream position query object. Use gst_query_unref()
228 * when done with it. A position query is used to query the current position
229 * of playback in the streams, in some format.
231 * Free-function: gst_query_unref
233 * Returns: (transfer full): a new #GstQuery
236 gst_query_new_position (GstFormat format)
239 GstStructure *structure;
241 structure = gst_structure_new_id (GST_QUARK (QUERY_POSITION),
242 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
243 GST_QUARK (CURRENT), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
245 query = gst_query_new_custom (GST_QUERY_POSITION, structure);
251 * gst_query_set_position:
252 * @query: a #GstQuery with query type GST_QUERY_POSITION
253 * @format: the requested #GstFormat
254 * @cur: the position to set
256 * Answer a position query by setting the requested value in the given format.
259 gst_query_set_position (GstQuery * query, GstFormat format, gint64 cur)
263 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
265 s = GST_QUERY_STRUCTURE (query);
266 g_return_if_fail (format == g_value_get_enum (gst_structure_id_get_value (s,
267 GST_QUARK (FORMAT))));
269 gst_structure_id_set (s,
270 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
271 GST_QUARK (CURRENT), G_TYPE_INT64, cur, NULL);
275 * gst_query_parse_position:
276 * @query: a #GstQuery
277 * @format: (out) (allow-none): the storage for the #GstFormat of the
278 * position values (may be NULL)
279 * @cur: (out) (allow-none): the storage for the current position (may be NULL)
281 * Parse a position query, writing the format into @format, and the position
282 * into @cur, if the respective parameters are non-NULL.
285 gst_query_parse_position (GstQuery * query, GstFormat * format, gint64 * cur)
287 GstStructure *structure;
289 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_POSITION);
291 structure = GST_QUERY_STRUCTURE (query);
294 (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
295 GST_QUARK (FORMAT)));
297 *cur = g_value_get_int64 (gst_structure_id_get_value (structure,
298 GST_QUARK (CURRENT)));
303 * gst_query_new_duration:
304 * @format: the #GstFormat for this duration query
306 * Constructs a new stream duration query object to query in the given format.
307 * Use gst_query_unref() when done with it. A duration query will give the
308 * total length of the stream.
310 * Free-function: gst_query_unref
312 * Returns: (transfer full): a new #GstQuery
315 gst_query_new_duration (GstFormat format)
318 GstStructure *structure;
320 structure = gst_structure_new_id (GST_QUARK (QUERY_DURATION),
321 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
322 GST_QUARK (DURATION), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
324 query = gst_query_new_custom (GST_QUERY_DURATION, structure);
330 * gst_query_set_duration:
331 * @query: a #GstQuery
332 * @format: the #GstFormat for the duration
333 * @duration: the duration of the stream
335 * Answer a duration query by setting the requested value in the given format.
338 gst_query_set_duration (GstQuery * query, GstFormat format, gint64 duration)
342 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_DURATION);
344 s = GST_QUERY_STRUCTURE (query);
345 g_return_if_fail (format == g_value_get_enum (gst_structure_id_get_value (s,
346 GST_QUARK (FORMAT))));
347 gst_structure_id_set (s, GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
348 GST_QUARK (DURATION), G_TYPE_INT64, duration, NULL);
352 * gst_query_parse_duration:
353 * @query: a #GstQuery
354 * @format: (out) (allow-none): the storage for the #GstFormat of the duration
356 * @duration: (out) (allow-none): the storage for the total duration, or NULL.
358 * Parse a duration query answer. Write the format of the duration into @format,
359 * and the value into @duration, if the respective variables are non-NULL.
362 gst_query_parse_duration (GstQuery * query, GstFormat * format,
365 GstStructure *structure;
367 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_DURATION);
369 structure = GST_QUERY_STRUCTURE (query);
372 (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
373 GST_QUARK (FORMAT)));
375 *duration = g_value_get_int64 (gst_structure_id_get_value (structure,
376 GST_QUARK (DURATION)));
380 * gst_query_new_latency:
382 * Constructs a new latency query object.
383 * Use gst_query_unref() when done with it. A latency query is usually performed
384 * by sinks to compensate for additional latency introduced by elements in the
387 * Free-function: gst_query_unref
389 * Returns: (transfer full): a #GstQuery
394 gst_query_new_latency (void)
397 GstStructure *structure;
399 structure = gst_structure_new_id (GST_QUARK (QUERY_LATENCY),
400 GST_QUARK (LIVE), G_TYPE_BOOLEAN, FALSE,
401 GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (0),
402 GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, G_GUINT64_CONSTANT (-1), NULL);
404 query = gst_query_new_custom (GST_QUERY_LATENCY, structure);
410 * gst_query_set_latency:
411 * @query: a #GstQuery
412 * @live: if there is a live element upstream
413 * @min_latency: the minimal latency of the upstream elements
414 * @max_latency: the maximal latency of the upstream elements
416 * Answer a latency query by setting the requested values in the given format.
421 gst_query_set_latency (GstQuery * query, gboolean live,
422 GstClockTime min_latency, GstClockTime max_latency)
424 GstStructure *structure;
426 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY);
428 structure = GST_QUERY_STRUCTURE (query);
429 gst_structure_id_set (structure,
430 GST_QUARK (LIVE), G_TYPE_BOOLEAN, live,
431 GST_QUARK (MIN_LATENCY), G_TYPE_UINT64, min_latency,
432 GST_QUARK (MAX_LATENCY), G_TYPE_UINT64, max_latency, NULL);
436 * gst_query_parse_latency:
437 * @query: a #GstQuery
438 * @live: (out) (allow-none): storage for live or NULL
439 * @min_latency: (out) (allow-none): the storage for the min latency or NULL
440 * @max_latency: (out) (allow-none): the storage for the max latency or NULL
442 * Parse a latency query answer.
447 gst_query_parse_latency (GstQuery * query, gboolean * live,
448 GstClockTime * min_latency, GstClockTime * max_latency)
450 GstStructure *structure;
452 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_LATENCY);
454 structure = GST_QUERY_STRUCTURE (query);
457 g_value_get_boolean (gst_structure_id_get_value (structure,
460 *min_latency = g_value_get_uint64 (gst_structure_id_get_value (structure,
461 GST_QUARK (MIN_LATENCY)));
463 *max_latency = g_value_get_uint64 (gst_structure_id_get_value (structure,
464 GST_QUARK (MAX_LATENCY)));
468 * gst_query_new_convert:
469 * @src_format: the source #GstFormat for the new query
470 * @value: the value to convert
471 * @dest_format: the target #GstFormat
473 * Constructs a new convert query object. Use gst_query_unref()
474 * when done with it. A convert query is used to ask for a conversion between
475 * one format and another.
477 * Free-function: gst_query_unref
479 * Returns: (transfer full): a #GstQuery
482 gst_query_new_convert (GstFormat src_format, gint64 value,
483 GstFormat dest_format)
486 GstStructure *structure;
488 structure = gst_structure_new_id (GST_QUARK (QUERY_CONVERT),
489 GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format,
490 GST_QUARK (SRC_VALUE), G_TYPE_INT64, value,
491 GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format,
492 GST_QUARK (DEST_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
494 query = gst_query_new_custom (GST_QUERY_CONVERT, structure);
500 * gst_query_set_convert:
501 * @query: a #GstQuery
502 * @src_format: the source #GstFormat
503 * @src_value: the source value
504 * @dest_format: the destination #GstFormat
505 * @dest_value: the destination value
507 * Answer a convert query by setting the requested values.
510 gst_query_set_convert (GstQuery * query, GstFormat src_format, gint64 src_value,
511 GstFormat dest_format, gint64 dest_value)
513 GstStructure *structure;
515 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONVERT);
517 structure = GST_QUERY_STRUCTURE (query);
518 gst_structure_id_set (structure,
519 GST_QUARK (SRC_FORMAT), GST_TYPE_FORMAT, src_format,
520 GST_QUARK (SRC_VALUE), G_TYPE_INT64, src_value,
521 GST_QUARK (DEST_FORMAT), GST_TYPE_FORMAT, dest_format,
522 GST_QUARK (DEST_VALUE), G_TYPE_INT64, dest_value, NULL);
526 * gst_query_parse_convert:
527 * @query: a #GstQuery
528 * @src_format: (out) (allow-none): the storage for the #GstFormat of the
529 * source value, or NULL
530 * @src_value: (out) (allow-none): the storage for the source value, or NULL
531 * @dest_format: (out) (allow-none): the storage for the #GstFormat of the
532 * destination value, or NULL
533 * @dest_value: (out) (allow-none): the storage for the destination value,
536 * Parse a convert query answer. Any of @src_format, @src_value, @dest_format,
537 * and @dest_value may be NULL, in which case that value is omitted.
540 gst_query_parse_convert (GstQuery * query, GstFormat * src_format,
541 gint64 * src_value, GstFormat * dest_format, gint64 * dest_value)
543 GstStructure *structure;
545 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CONVERT);
547 structure = GST_QUERY_STRUCTURE (query);
550 (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
551 GST_QUARK (SRC_FORMAT)));
553 *src_value = g_value_get_int64 (gst_structure_id_get_value (structure,
554 GST_QUARK (SRC_VALUE)));
557 (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
558 GST_QUARK (DEST_FORMAT)));
560 *dest_value = g_value_get_int64 (gst_structure_id_get_value (structure,
561 GST_QUARK (DEST_VALUE)));
565 * gst_query_new_segment:
566 * @format: the #GstFormat for the new query
568 * Constructs a new segment query object. Use gst_query_unref()
569 * when done with it. A segment query is used to discover information about the
570 * currently configured segment for playback.
572 * Free-function: gst_query_unref
574 * Returns: (transfer full): a new #GstQuery
577 gst_query_new_segment (GstFormat format)
580 GstStructure *structure;
582 structure = gst_structure_new_id (GST_QUARK (QUERY_SEGMENT),
583 GST_QUARK (RATE), G_TYPE_DOUBLE, (gdouble) 0.0,
584 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
585 GST_QUARK (START_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
586 GST_QUARK (STOP_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
588 query = gst_query_new_custom (GST_QUERY_SEGMENT, structure);
594 * gst_query_set_segment:
595 * @query: a #GstQuery
596 * @rate: the rate of the segment
597 * @format: the #GstFormat of the segment values (@start_value and @stop_value)
598 * @start_value: the start value
599 * @stop_value: the stop value
601 * Answer a segment query by setting the requested values. The normal
602 * playback segment of a pipeline is 0 to duration at the default rate of
603 * 1.0. If a seek was performed on the pipeline to play a different
604 * segment, this query will return the range specified in the last seek.
606 * @start_value and @stop_value will respectively contain the configured
607 * playback range start and stop values expressed in @format.
608 * The values are always between 0 and the duration of the media and
609 * @start_value <= @stop_value. @rate will contain the playback rate. For
610 * negative rates, playback will actually happen from @stop_value to
614 gst_query_set_segment (GstQuery * query, gdouble rate, GstFormat format,
615 gint64 start_value, gint64 stop_value)
617 GstStructure *structure;
619 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT);
621 structure = GST_QUERY_STRUCTURE (query);
622 gst_structure_id_set (structure,
623 GST_QUARK (RATE), G_TYPE_DOUBLE, rate,
624 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
625 GST_QUARK (START_VALUE), G_TYPE_INT64, start_value,
626 GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop_value, NULL);
630 * gst_query_parse_segment:
631 * @query: a #GstQuery
632 * @rate: (out) (allow-none): the storage for the rate of the segment, or NULL
633 * @format: (out) (allow-none): the storage for the #GstFormat of the values,
635 * @start_value: (out) (allow-none): the storage for the start value, or NULL
636 * @stop_value: (out) (allow-none): the storage for the stop value, or NULL
638 * Parse a segment query answer. Any of @rate, @format, @start_value, and
639 * @stop_value may be NULL, which will cause this value to be omitted.
641 * See gst_query_set_segment() for an explanation of the function arguments.
644 gst_query_parse_segment (GstQuery * query, gdouble * rate, GstFormat * format,
645 gint64 * start_value, gint64 * stop_value)
647 GstStructure *structure;
649 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEGMENT);
651 structure = GST_QUERY_STRUCTURE (query);
653 *rate = g_value_get_double (gst_structure_id_get_value (structure,
657 (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
658 GST_QUARK (FORMAT)));
660 *start_value = g_value_get_int64 (gst_structure_id_get_value (structure,
661 GST_QUARK (START_VALUE)));
663 *stop_value = g_value_get_int64 (gst_structure_id_get_value (structure,
664 GST_QUARK (STOP_VALUE)));
668 * gst_query_new_custom:
669 * @type: the query type
670 * @structure: a structure for the query
672 * Constructs a new custom query object. Use gst_query_unref()
675 * Free-function: gst_query_unref
677 * Returns: (transfer full): a new #GstQuery
680 gst_query_new_custom (GstQueryType type, GstStructure * structure)
684 query = g_slice_new0 (GstQueryImpl);
686 GST_DEBUG ("creating new query %p %s", query, gst_query_type_get_name (type));
689 /* structure must not have a parent */
690 if (!gst_structure_set_parent_refcount (structure,
691 &query->query.mini_object.refcount))
695 gst_mini_object_init (GST_MINI_OBJECT_CAST (query), 0, _gst_query_type,
696 (GstMiniObjectCopyFunction) _gst_query_copy, NULL,
697 (GstMiniObjectFreeFunction) _gst_query_free);
699 GST_QUERY_TYPE (query) = type;
700 GST_QUERY_STRUCTURE (query) = structure;
702 return GST_QUERY_CAST (query);
707 g_slice_free1 (sizeof (GstQueryImpl), query);
708 g_warning ("structure is already owned by another object");
714 * gst_query_get_structure:
715 * @query: a #GstQuery
717 * Get the structure of a query.
719 * Returns: (transfer none): the #GstStructure of the query. The structure is
720 * still owned by the query and will therefore be freed when the query
724 gst_query_get_structure (GstQuery * query)
726 g_return_val_if_fail (GST_IS_QUERY (query), NULL);
728 return GST_QUERY_STRUCTURE (query);
732 * gst_query_writable_structure:
733 * @query: a #GstQuery
735 * Get the structure of a query. This method should be called with a writable
736 * @query so that the returned structure is guranteed to be writable.
738 * Returns: (transfer none): the #GstStructure of the query. The structure is
739 * still owned by the query and will therefore be freed when the query
743 gst_query_writable_structure (GstQuery * query)
745 g_return_val_if_fail (GST_IS_QUERY (query), NULL);
746 g_return_val_if_fail (gst_query_is_writable (query), NULL);
748 return GST_QUERY_STRUCTURE (query);
752 * gst_query_new_seeking:
753 * @format: the default #GstFormat for the new query
755 * Constructs a new query object for querying seeking properties of
758 * Free-function: gst_query_unref
760 * Returns: (transfer full): a new #GstQuery
763 gst_query_new_seeking (GstFormat format)
766 GstStructure *structure;
768 structure = gst_structure_new_id (GST_QUARK (QUERY_SEEKING),
769 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
770 GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, FALSE,
771 GST_QUARK (SEGMENT_START), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
772 GST_QUARK (SEGMENT_END), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
774 query = gst_query_new_custom (GST_QUERY_SEEKING, structure);
780 * gst_query_set_seeking:
781 * @query: a #GstQuery
782 * @format: the format to set for the @segment_start and @segment_end values
783 * @seekable: the seekable flag to set
784 * @segment_start: the segment_start to set
785 * @segment_end: the segment_end to set
787 * Set the seeking query result fields in @query.
790 gst_query_set_seeking (GstQuery * query, GstFormat format,
791 gboolean seekable, gint64 segment_start, gint64 segment_end)
793 GstStructure *structure;
795 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
796 g_return_if_fail (gst_query_is_writable (query));
798 structure = GST_QUERY_STRUCTURE (query);
799 gst_structure_id_set (structure,
800 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
801 GST_QUARK (SEEKABLE), G_TYPE_BOOLEAN, seekable,
802 GST_QUARK (SEGMENT_START), G_TYPE_INT64, segment_start,
803 GST_QUARK (SEGMENT_END), G_TYPE_INT64, segment_end, NULL);
807 * gst_query_parse_seeking:
808 * @query: a GST_QUERY_SEEKING type query #GstQuery
809 * @format: (out) (allow-none): the format to set for the @segment_start
810 * and @segment_end values, or NULL
811 * @seekable: (out) (allow-none): the seekable flag to set, or NULL
812 * @segment_start: (out) (allow-none): the segment_start to set, or NULL
813 * @segment_end: (out) (allow-none): the segment_end to set, or NULL
815 * Parse a seeking query, writing the format into @format, and
816 * other results into the passed parameters, if the respective parameters
820 gst_query_parse_seeking (GstQuery * query, GstFormat * format,
821 gboolean * seekable, gint64 * segment_start, gint64 * segment_end)
823 GstStructure *structure;
825 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SEEKING);
827 structure = GST_QUERY_STRUCTURE (query);
830 (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
831 GST_QUARK (FORMAT)));
833 *seekable = g_value_get_boolean (gst_structure_id_get_value (structure,
834 GST_QUARK (SEEKABLE)));
836 *segment_start = g_value_get_int64 (gst_structure_id_get_value (structure,
837 GST_QUARK (SEGMENT_START)));
839 *segment_end = g_value_get_int64 (gst_structure_id_get_value (structure,
840 GST_QUARK (SEGMENT_END)));
844 ensure_array (GstStructure * s, GQuark quark, gsize element_size,
845 GDestroyNotify clear_func)
850 value = gst_structure_id_get_value (s, quark);
852 array = (GArray *) g_value_get_boxed (value);
854 GValue new_array_val = { 0, };
856 array = g_array_new (FALSE, TRUE, element_size);
858 g_array_set_clear_func (array, clear_func);
860 g_value_init (&new_array_val, G_TYPE_ARRAY);
861 g_value_take_boxed (&new_array_val, array);
863 gst_structure_id_take_value (s, quark, &new_array_val);
869 * gst_query_new_formats:
871 * Constructs a new query object for querying formats of
874 * Free-function: gst_query_unref
876 * Returns: (transfer full): a new #GstQuery
881 gst_query_new_formats (void)
884 GstStructure *structure;
886 structure = gst_structure_new_id_empty (GST_QUARK (QUERY_FORMATS));
887 query = gst_query_new_custom (GST_QUERY_FORMATS, structure);
893 gst_query_list_add_format (GValue * list, GstFormat format)
895 GValue item = { 0, };
897 g_value_init (&item, GST_TYPE_FORMAT);
898 g_value_set_enum (&item, format);
899 gst_value_list_append_value (list, &item);
900 g_value_unset (&item);
904 * gst_query_set_formats:
905 * @query: a #GstQuery
906 * @n_formats: the number of formats to set.
907 * @...: A number of @GstFormats equal to @n_formats.
909 * Set the formats query result fields in @query. The number of formats passed
910 * must be equal to @n_formats.
913 gst_query_set_formats (GstQuery * query, gint n_formats, ...)
916 GValue list = { 0, };
918 GstStructure *structure;
920 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
921 g_return_if_fail (gst_query_is_writable (query));
923 g_value_init (&list, GST_TYPE_LIST);
925 va_start (ap, n_formats);
926 for (i = 0; i < n_formats; i++) {
927 gst_query_list_add_format (&list, va_arg (ap, GstFormat));
931 structure = GST_QUERY_STRUCTURE (query);
932 gst_structure_set_value (structure, "formats", &list);
934 g_value_unset (&list);
939 * gst_query_set_formatsv:
940 * @query: a #GstQuery
941 * @n_formats: the number of formats to set.
942 * @formats: (in) (array length=n_formats): an array containing @n_formats
945 * Set the formats query result fields in @query. The number of formats passed
946 * in the @formats array must be equal to @n_formats.
951 gst_query_set_formatsv (GstQuery * query, gint n_formats,
952 const GstFormat * formats)
954 GValue list = { 0, };
956 GstStructure *structure;
958 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
959 g_return_if_fail (gst_query_is_writable (query));
961 g_value_init (&list, GST_TYPE_LIST);
962 for (i = 0; i < n_formats; i++) {
963 gst_query_list_add_format (&list, formats[i]);
965 structure = GST_QUERY_STRUCTURE (query);
966 gst_structure_set_value (structure, "formats", &list);
968 g_value_unset (&list);
972 * gst_query_parse_n_formats:
973 * @query: a #GstQuery
974 * @n_formats: (out) (allow-none): the number of formats in this query.
976 * Parse the number of formats in the formats @query.
981 gst_query_parse_n_formats (GstQuery * query, guint * n_formats)
983 GstStructure *structure;
985 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
990 structure = GST_QUERY_STRUCTURE (query);
991 list = gst_structure_get_value (structure, "formats");
995 *n_formats = gst_value_list_get_size (list);
1000 * gst_query_parse_nth_format:
1001 * @query: a #GstQuery
1002 * @nth: (out): the nth format to retrieve.
1003 * @format: (out) (allow-none): a pointer to store the nth format
1005 * Parse the format query and retrieve the @nth format from it into
1006 * @format. If the list contains less elements than @nth, @format will be
1007 * set to GST_FORMAT_UNDEFINED.
1010 gst_query_parse_nth_format (GstQuery * query, guint nth, GstFormat * format)
1012 GstStructure *structure;
1014 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_FORMATS);
1019 structure = GST_QUERY_STRUCTURE (query);
1020 list = gst_structure_get_value (structure, "formats");
1022 *format = GST_FORMAT_UNDEFINED;
1024 if (nth < gst_value_list_get_size (list)) {
1026 (GstFormat) g_value_get_enum (gst_value_list_get_value (list, nth));
1028 *format = GST_FORMAT_UNDEFINED;
1034 * gst_query_new_buffering:
1035 * @format: the default #GstFormat for the new query
1037 * Constructs a new query object for querying the buffering status of
1040 * Free-function: gst_query_unref
1042 * Returns: (transfer full): a new #GstQuery
1047 gst_query_new_buffering (GstFormat format)
1050 GstStructure *structure;
1052 /* by default, we configure the answer as no buffering with a 100% buffering
1054 structure = gst_structure_new_id (GST_QUARK (QUERY_BUFFERING),
1055 GST_QUARK (BUSY), G_TYPE_BOOLEAN, FALSE,
1056 GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, 100,
1057 GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, GST_BUFFERING_STREAM,
1058 GST_QUARK (AVG_IN_RATE), G_TYPE_INT, -1,
1059 GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, -1,
1060 GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, G_GINT64_CONSTANT (0),
1061 GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
1062 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
1063 GST_QUARK (START_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1),
1064 GST_QUARK (STOP_VALUE), G_TYPE_INT64, G_GINT64_CONSTANT (-1), NULL);
1066 query = gst_query_new_custom (GST_QUERY_BUFFERING, structure);
1072 * gst_query_set_buffering_percent:
1073 * @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
1074 * @busy: if buffering is busy
1075 * @percent: a buffering percent
1077 * Set the percentage of buffered data. This is a value between 0 and 100.
1078 * The @busy indicator is %TRUE when the buffering is in progress.
1083 gst_query_set_buffering_percent (GstQuery * query, gboolean busy, gint percent)
1085 GstStructure *structure;
1087 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
1088 g_return_if_fail (gst_query_is_writable (query));
1089 g_return_if_fail (percent >= 0 && percent <= 100);
1091 structure = GST_QUERY_STRUCTURE (query);
1092 gst_structure_id_set (structure,
1093 GST_QUARK (BUSY), G_TYPE_BOOLEAN, busy,
1094 GST_QUARK (BUFFER_PERCENT), G_TYPE_INT, percent, NULL);
1098 * gst_query_parse_buffering_percent:
1099 * @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
1100 * @busy: (out) (allow-none): if buffering is busy, or NULL
1101 * @percent: (out) (allow-none): a buffering percent, or NULL
1103 * Get the percentage of buffered data. This is a value between 0 and 100.
1104 * The @busy indicator is %TRUE when the buffering is in progress.
1109 gst_query_parse_buffering_percent (GstQuery * query, gboolean * busy,
1112 GstStructure *structure;
1114 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
1116 structure = GST_QUERY_STRUCTURE (query);
1118 *busy = g_value_get_boolean (gst_structure_id_get_value (structure,
1121 *percent = g_value_get_int (gst_structure_id_get_value (structure,
1122 GST_QUARK (BUFFER_PERCENT)));
1126 * gst_query_set_buffering_stats:
1127 * @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
1128 * @mode: a buffering mode
1129 * @avg_in: the average input rate
1130 * @avg_out: the average output rate
1131 * @buffering_left: amount of buffering time left
1133 * Configures the buffering stats values in @query.
1138 gst_query_set_buffering_stats (GstQuery * query, GstBufferingMode mode,
1139 gint avg_in, gint avg_out, gint64 buffering_left)
1141 GstStructure *structure;
1143 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
1144 g_return_if_fail (gst_query_is_writable (query));
1146 structure = GST_QUERY_STRUCTURE (query);
1147 gst_structure_id_set (structure,
1148 GST_QUARK (BUFFERING_MODE), GST_TYPE_BUFFERING_MODE, mode,
1149 GST_QUARK (AVG_IN_RATE), G_TYPE_INT, avg_in,
1150 GST_QUARK (AVG_OUT_RATE), G_TYPE_INT, avg_out,
1151 GST_QUARK (BUFFERING_LEFT), G_TYPE_INT64, buffering_left, NULL);
1155 * gst_query_parse_buffering_stats:
1156 * @query: A valid #GstQuery of type GST_QUERY_BUFFERING.
1157 * @mode: (out) (allow-none): a buffering mode, or NULL
1158 * @avg_in: (out) (allow-none): the average input rate, or NULL
1159 * @avg_out: (out) (allow-none): the average output rat, or NULLe
1160 * @buffering_left: (out) (allow-none): amount of buffering time left, or NULL
1162 * Extracts the buffering stats values from @query.
1167 gst_query_parse_buffering_stats (GstQuery * query,
1168 GstBufferingMode * mode, gint * avg_in, gint * avg_out,
1169 gint64 * buffering_left)
1171 GstStructure *structure;
1173 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
1175 structure = GST_QUERY_STRUCTURE (query);
1177 *mode = (GstBufferingMode)
1178 g_value_get_enum (gst_structure_id_get_value (structure,
1179 GST_QUARK (BUFFERING_MODE)));
1181 *avg_in = g_value_get_int (gst_structure_id_get_value (structure,
1182 GST_QUARK (AVG_IN_RATE)));
1184 *avg_out = g_value_get_int (gst_structure_id_get_value (structure,
1185 GST_QUARK (AVG_OUT_RATE)));
1188 g_value_get_int64 (gst_structure_id_get_value (structure,
1189 GST_QUARK (BUFFERING_LEFT)));
1193 * gst_query_set_buffering_range:
1194 * @query: a #GstQuery
1195 * @format: the format to set for the @start and @stop values
1196 * @start: the start to set
1197 * @stop: the stop to set
1198 * @estimated_total: estimated total amount of download time
1200 * Set the available query result fields in @query.
1205 gst_query_set_buffering_range (GstQuery * query, GstFormat format,
1206 gint64 start, gint64 stop, gint64 estimated_total)
1208 GstStructure *structure;
1210 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
1211 g_return_if_fail (gst_query_is_writable (query));
1213 structure = GST_QUERY_STRUCTURE (query);
1214 gst_structure_id_set (structure,
1215 GST_QUARK (FORMAT), GST_TYPE_FORMAT, format,
1216 GST_QUARK (START_VALUE), G_TYPE_INT64, start,
1217 GST_QUARK (STOP_VALUE), G_TYPE_INT64, stop,
1218 GST_QUARK (ESTIMATED_TOTAL), G_TYPE_INT64, estimated_total, NULL);
1222 * gst_query_parse_buffering_range:
1223 * @query: a GST_QUERY_BUFFERING type query #GstQuery
1224 * @format: (out) (allow-none): the format to set for the @segment_start
1225 * and @segment_end values, or NULL
1226 * @start: (out) (allow-none): the start to set, or NULL
1227 * @stop: (out) (allow-none): the stop to set, or NULL
1228 * @estimated_total: (out) (allow-none): estimated total amount of download
1231 * Parse an available query, writing the format into @format, and
1232 * other results into the passed parameters, if the respective parameters
1238 gst_query_parse_buffering_range (GstQuery * query, GstFormat * format,
1239 gint64 * start, gint64 * stop, gint64 * estimated_total)
1241 GstStructure *structure;
1243 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING);
1245 structure = GST_QUERY_STRUCTURE (query);
1248 (GstFormat) g_value_get_enum (gst_structure_id_get_value (structure,
1249 GST_QUARK (FORMAT)));
1251 *start = g_value_get_int64 (gst_structure_id_get_value (structure,
1252 GST_QUARK (START_VALUE)));
1254 *stop = g_value_get_int64 (gst_structure_id_get_value (structure,
1255 GST_QUARK (STOP_VALUE)));
1256 if (estimated_total)
1258 g_value_get_int64 (gst_structure_id_get_value (structure,
1259 GST_QUARK (ESTIMATED_TOTAL)));
1262 /* GstQueryBufferingRange: internal struct for GArray */
1267 } GstQueryBufferingRange;
1270 * gst_query_add_buffering_range:
1271 * @query: a GST_QUERY_BUFFERING type query #GstQuery
1272 * @start: start position of the range
1273 * @stop: stop position of the range
1275 * Set the buffering-ranges array field in @query. The current last
1276 * start position of the array should be inferior to @start.
1278 * Returns: a #gboolean indicating if the range was added or not.
1283 gst_query_add_buffering_range (GstQuery * query, gint64 start, gint64 stop)
1285 GstQueryBufferingRange range;
1286 GstStructure *structure;
1289 g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, FALSE);
1290 g_return_val_if_fail (gst_query_is_writable (query), FALSE);
1292 if (G_UNLIKELY (start >= stop))
1295 structure = GST_QUERY_STRUCTURE (query);
1296 array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES),
1297 sizeof (GstQueryBufferingRange), NULL);
1299 if (array->len > 1) {
1300 GstQueryBufferingRange *last;
1302 last = &g_array_index (array, GstQueryBufferingRange, array->len - 1);
1304 if (G_UNLIKELY (start <= last->start))
1308 range.start = start;
1310 g_array_append_val (array, range);
1316 * gst_query_get_n_buffering_ranges:
1317 * @query: a GST_QUERY_BUFFERING type query #GstQuery
1319 * Retrieve the number of values currently stored in the
1320 * buffered-ranges array of the query's structure.
1322 * Returns: the range array size as a #guint.
1327 gst_query_get_n_buffering_ranges (GstQuery * query)
1329 GstStructure *structure;
1332 g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, 0);
1334 structure = GST_QUERY_STRUCTURE (query);
1335 array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES),
1336 sizeof (GstQueryBufferingRange), NULL);
1343 * gst_query_parse_nth_buffering_range:
1344 * @query: a GST_QUERY_BUFFERING type query #GstQuery
1345 * @index: position in the buffered-ranges array to read
1346 * @start: (out) (allow-none): the start position to set, or NULL
1347 * @stop: (out) (allow-none): the stop position to set, or NULL
1349 * Parse an available query and get the start and stop values stored
1350 * at the @index of the buffered ranges array.
1352 * Returns: a #gboolean indicating if the parsing succeeded.
1357 gst_query_parse_nth_buffering_range (GstQuery * query, guint index,
1358 gint64 * start, gint64 * stop)
1360 GstQueryBufferingRange *range;
1361 GstStructure *structure;
1364 g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_BUFFERING, FALSE);
1366 structure = GST_QUERY_STRUCTURE (query);
1368 array = ensure_array (structure, GST_QUARK (BUFFERING_RANGES),
1369 sizeof (GstQueryBufferingRange), NULL);
1370 g_return_val_if_fail (index < array->len, FALSE);
1372 range = &g_array_index (array, GstQueryBufferingRange, index);
1375 *start = range->start;
1377 *stop = range->stop;
1384 * gst_query_new_uri:
1386 * Constructs a new query URI query object. Use gst_query_unref()
1387 * when done with it. An URI query is used to query the current URI
1388 * that is used by the source or sink.
1390 * Free-function: gst_query_unref
1392 * Returns: (transfer full): a new #GstQuery
1397 gst_query_new_uri (void)
1400 GstStructure *structure;
1402 structure = gst_structure_new_id (GST_QUARK (QUERY_URI),
1403 GST_QUARK (URI), G_TYPE_STRING, NULL, NULL);
1405 query = gst_query_new_custom (GST_QUERY_URI, structure);
1411 * gst_query_set_uri:
1412 * @query: a #GstQuery with query type GST_QUERY_URI
1413 * @uri: the URI to set
1415 * Answer a URI query by setting the requested URI.
1420 gst_query_set_uri (GstQuery * query, const gchar * uri)
1422 GstStructure *structure;
1424 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
1425 g_return_if_fail (gst_query_is_writable (query));
1426 g_return_if_fail (gst_uri_is_valid (uri));
1428 structure = GST_QUERY_STRUCTURE (query);
1429 gst_structure_id_set (structure, GST_QUARK (URI), G_TYPE_STRING, uri, NULL);
1433 * gst_query_parse_uri:
1434 * @query: a #GstQuery
1435 * @uri: (out callee-allocates) (allow-none): the storage for the current URI
1438 * Parse an URI query, writing the URI into @uri as a newly
1439 * allocated string, if the respective parameters are non-NULL.
1440 * Free the string with g_free() after usage.
1445 gst_query_parse_uri (GstQuery * query, gchar ** uri)
1447 GstStructure *structure;
1449 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_URI);
1451 structure = GST_QUERY_STRUCTURE (query);
1453 *uri = g_value_dup_string (gst_structure_id_get_value (structure,
1458 * gst_query_new_allocation:
1459 * @caps: the negotiated caps
1460 * @need_pool: return a pool
1462 * Constructs a new query object for querying the allocation properties.
1464 * Free-function: gst_query_unref
1466 * Returns: (transfer full): a new #GstQuery
1469 gst_query_new_allocation (GstCaps * caps, gboolean need_pool)
1472 GstStructure *structure;
1474 structure = gst_structure_new_id (GST_QUARK (QUERY_ALLOCATION),
1475 GST_QUARK (CAPS), GST_TYPE_CAPS, caps,
1476 GST_QUARK (NEED_POOL), G_TYPE_BOOLEAN, need_pool, NULL);
1478 query = gst_query_new_custom (GST_QUERY_ALLOCATION, structure);
1484 * gst_query_parse_allocation:
1485 * @query: a #GstQuery
1486 * @caps: (out) (transfer none) (allow-none): The #GstCaps
1487 * @need_pool: (out) (allow-none): Whether a #GstBufferPool is needed
1489 * Parse an allocation query, writing the requested caps in @caps and
1490 * whether a pool is needed in @need_pool, if the respective parameters
1494 gst_query_parse_allocation (GstQuery * query, GstCaps ** caps,
1495 gboolean * need_pool)
1497 GstStructure *structure;
1499 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
1501 structure = GST_QUERY_STRUCTURE (query);
1503 *caps = g_value_get_boxed (gst_structure_id_get_value (structure,
1506 gst_structure_id_get (structure,
1507 GST_QUARK (NEED_POOL), G_TYPE_BOOLEAN, need_pool, NULL);
1512 GstBufferPool *pool;
1519 allocation_pool_free (AllocationPool * ap)
1522 gst_object_unref (ap->pool);
1526 * gst_query_add_allocation_pool:
1527 * @query: A valid #GstQuery of type GST_QUERY_ALLOCATION.
1528 * @pool: the #GstBufferPool
1530 * @min_buffers: the min buffers
1531 * @max_buffers: the max buffers
1533 * Set the pool parameters in @query.
1536 gst_query_add_allocation_pool (GstQuery * query, GstBufferPool * pool,
1537 guint size, guint min_buffers, guint max_buffers)
1540 GstStructure *structure;
1543 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
1544 g_return_if_fail (gst_query_is_writable (query));
1545 g_return_if_fail (size != 0);
1547 structure = GST_QUERY_STRUCTURE (query);
1548 array = ensure_array (structure, GST_QUARK (POOL),
1549 sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
1551 if ((ap.pool = pool))
1552 gst_object_ref (pool);
1554 ap.min_buffers = min_buffers;
1555 ap.max_buffers = max_buffers;
1557 g_array_append_val (array, ap);
1562 * gst_query_get_n_allocation_pools:
1563 * @query: a GST_QUERY_ALLOCATION type query #GstQuery
1565 * Retrieve the number of values currently stored in the
1566 * pool array of the query's structure.
1568 * Returns: the pool array size as a #guint.
1571 gst_query_get_n_allocation_pools (GstQuery * query)
1574 GstStructure *structure;
1576 g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
1578 structure = GST_QUERY_STRUCTURE (query);
1579 array = ensure_array (structure, GST_QUARK (POOL),
1580 sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
1586 * gst_query_parse_nth_allocation_pool:
1587 * @query: A valid #GstQuery of type GST_QUERY_ALLOCATION.
1588 * @index: index to parse
1589 * @pool: (out) (allow-none) (transfer none): the #GstBufferPool
1590 * @size: (out) (allow-none): the size
1591 * @min_buffers: (out) (allow-none): the min buffers
1592 * @max_buffers: (out) (allow-none): the max buffers
1594 * Get the pool parameters in @query.
1597 gst_query_parse_nth_allocation_pool (GstQuery * query, guint index,
1598 GstBufferPool ** pool, guint * size, guint * min_buffers,
1599 guint * max_buffers)
1602 GstStructure *structure;
1605 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
1607 structure = GST_QUERY_STRUCTURE (query);
1608 array = ensure_array (structure, GST_QUARK (POOL),
1609 sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
1610 g_return_if_fail (index < array->len);
1612 ap = &g_array_index (array, AllocationPool, index);
1615 if ((*pool = ap->pool))
1616 gst_object_ref (*pool);
1620 *min_buffers = ap->min_buffers;
1622 *max_buffers = ap->max_buffers;
1626 * gst_query_set_nth_allocation_pool:
1627 * @index: index to modify
1628 * @query: A valid #GstQuery of type GST_QUERY_ALLOCATION.
1629 * @pool: the #GstBufferPool
1631 * @min_buffers: the min buffers
1632 * @max_buffers: the max buffers
1634 * Set the pool parameters in @query.
1637 gst_query_set_nth_allocation_pool (GstQuery * query, guint index,
1638 GstBufferPool * pool, guint size, guint min_buffers, guint max_buffers)
1641 GstStructure *structure;
1642 AllocationPool *oldap, ap;
1644 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
1646 structure = GST_QUERY_STRUCTURE (query);
1647 array = ensure_array (structure, GST_QUARK (POOL),
1648 sizeof (AllocationPool), (GDestroyNotify) allocation_pool_free);
1649 g_return_if_fail (index < array->len);
1651 oldap = &g_array_index (array, AllocationPool, index);
1652 allocation_pool_free (oldap);
1654 if ((ap.pool = pool))
1655 gst_object_ref (pool);
1657 ap.min_buffers = min_buffers;
1658 ap.max_buffers = max_buffers;
1659 g_array_index (array, AllocationPool, index) = ap;
1663 * gst_query_add_allocation_meta:
1664 * @query: a GST_QUERY_ALLOCATION type query #GstQuery
1665 * @api: the metadata API
1667 * Add @api as aone of the supported metadata API to @query.
1670 gst_query_add_allocation_meta (GstQuery * query, GType api)
1673 GstStructure *structure;
1675 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
1676 g_return_if_fail (api != 0);
1677 g_return_if_fail (gst_query_is_writable (query));
1679 structure = GST_QUERY_STRUCTURE (query);
1680 array = ensure_array (structure, GST_QUARK (META), sizeof (GType), NULL);
1682 g_array_append_val (array, api);
1686 * gst_query_get_n_allocation_metas:
1687 * @query: a GST_QUERY_ALLOCATION type query #GstQuery
1689 * Retrieve the number of values currently stored in the
1690 * meta API array of the query's structure.
1692 * Returns: the metadata API array size as a #guint.
1695 gst_query_get_n_allocation_metas (GstQuery * query)
1698 GstStructure *structure;
1700 g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
1702 structure = GST_QUERY_STRUCTURE (query);
1703 array = ensure_array (structure, GST_QUARK (META), sizeof (GType), NULL);
1709 * gst_query_parse_nth_allocation_meta:
1710 * @query: a GST_QUERY_ALLOCATION type query #GstQuery
1711 * @index: position in the metadata API array to read
1713 * Parse an available query and get the metadata API
1714 * at @index of the metadata API array.
1716 * Returns: a #GType of the metadata API at @index.
1719 gst_query_parse_nth_allocation_meta (GstQuery * query, guint index)
1722 GstStructure *structure;
1724 g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
1726 structure = GST_QUERY_STRUCTURE (query);
1727 array = ensure_array (structure, GST_QUARK (META), sizeof (GType), NULL);
1729 g_return_val_if_fail (index < array->len, 0);
1731 return g_array_index (array, GType, index);
1735 * gst_query_remove_nth_allocation_meta:
1736 * @query: a GST_QUERY_ALLOCATION type query #GstQuery
1737 * @index: position in the metadata API array to remove
1739 * Remove the metadata API at @index of the metadata API array.
1742 gst_query_remove_nth_allocation_meta (GstQuery * query, guint index)
1745 GstStructure *structure;
1747 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
1748 g_return_if_fail (gst_query_is_writable (query));
1750 structure = GST_QUERY_STRUCTURE (query);
1751 array = ensure_array (structure, GST_QUARK (META), sizeof (GType), NULL);
1752 g_return_if_fail (index < array->len);
1754 g_array_remove_index (array, index);
1758 * gst_query_has_allocation_meta:
1759 * @query: a GST_QUERY_ALLOCATION type query #GstQuery
1760 * @api: the metadata API
1762 * Check if @query has metadata @api set.
1764 * Returns: TRUE when @api is in the list of metadata.
1767 gst_query_has_allocation_meta (GstQuery * query, GType api)
1770 GstStructure *structure;
1773 g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, FALSE);
1774 g_return_val_if_fail (api != 0, FALSE);
1776 structure = GST_QUERY_STRUCTURE (query);
1777 array = ensure_array (structure, GST_QUARK (META), sizeof (GType), NULL);
1780 for (i = 0; i < len; i++) {
1781 if (g_array_index (array, GType, i) == api)
1789 GstAllocator *allocator;
1790 GstAllocationParams params;
1794 allocation_param_free (AllocationParam * ap)
1797 gst_allocator_unref (ap->allocator);
1801 * gst_query_add_allocation_param:
1802 * @query: a GST_QUERY_ALLOCATION type query #GstQuery
1803 * @allocator: the memory allocator
1804 * @params: a #GstAllocationParams
1806 * Add @allocator and its @params as a supported memory allocator.
1809 gst_query_add_allocation_param (GstQuery * query, GstAllocator * allocator,
1810 const GstAllocationParams * params)
1813 GstStructure *structure;
1816 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
1817 g_return_if_fail (gst_query_is_writable (query));
1818 g_return_if_fail (allocator != NULL || params != NULL);
1820 structure = GST_QUERY_STRUCTURE (query);
1821 array = ensure_array (structure, GST_QUARK (ALLOCATOR),
1822 sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
1824 if ((ap.allocator = allocator))
1825 gst_allocator_ref (allocator);
1827 ap.params = *params;
1829 gst_allocation_params_init (&ap.params);
1831 g_array_append_val (array, ap);
1835 * gst_query_get_n_allocation_params:
1836 * @query: a GST_QUERY_ALLOCATION type query #GstQuery
1838 * Retrieve the number of values currently stored in the
1839 * allocator params array of the query's structure.
1841 * If no memory allocator is specified, the downstream element can handle
1842 * the default memory allocator.
1844 * Returns: the allocator array size as a #guint.
1847 gst_query_get_n_allocation_params (GstQuery * query)
1850 GstStructure *structure;
1852 g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION, 0);
1854 structure = GST_QUERY_STRUCTURE (query);
1855 array = ensure_array (structure, GST_QUARK (ALLOCATOR),
1856 sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
1862 * gst_query_parse_nth_allocation_param:
1863 * @query: a GST_QUERY_ALLOCATION type query #GstQuery
1864 * @index: position in the allocator array to read
1865 * @allocator: (transfer none): variable to hold the result
1866 * @params: parameters for the allocator
1868 * Parse an available query and get the alloctor and its params
1869 * at @index of the allocator array.
1872 gst_query_parse_nth_allocation_param (GstQuery * query, guint index,
1873 GstAllocator ** allocator, GstAllocationParams * params)
1876 GstStructure *structure;
1877 AllocationParam *ap;
1879 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
1881 structure = GST_QUERY_STRUCTURE (query);
1882 array = ensure_array (structure, GST_QUARK (ALLOCATOR),
1883 sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
1884 g_return_if_fail (index < array->len);
1886 ap = &g_array_index (array, AllocationParam, index);
1889 if ((*allocator = ap->allocator))
1890 gst_allocator_ref (*allocator);
1892 *params = ap->params;
1896 * gst_query_set_nth_allocation_param:
1897 * @query: a GST_QUERY_ALLOCATION type query #GstQuery
1898 * @index: position in the allocator array to set
1899 * @allocator: (transfer full): new allocator to set
1900 * @params: parameters for the allocator
1902 * Parse an available query and get the alloctor and its params
1903 * at @index of the allocator array.
1906 gst_query_set_nth_allocation_param (GstQuery * query, guint index,
1907 GstAllocator * allocator, const GstAllocationParams * params)
1910 GstStructure *structure;
1911 AllocationParam *old, ap;
1913 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ALLOCATION);
1915 structure = GST_QUERY_STRUCTURE (query);
1916 array = ensure_array (structure, GST_QUARK (ALLOCATOR),
1917 sizeof (AllocationParam), (GDestroyNotify) allocation_param_free);
1918 g_return_if_fail (index < array->len);
1920 old = &g_array_index (array, AllocationParam, index);
1921 allocation_param_free (old);
1923 if ((ap.allocator = allocator))
1924 gst_allocator_ref (allocator);
1926 ap.params = *params;
1928 gst_allocation_params_init (&ap.params);
1930 g_array_index (array, AllocationParam, index) = ap;
1934 * gst_query_new_scheduling:
1936 * Constructs a new query object for querying the scheduling properties.
1938 * Free-function: gst_query_unref
1940 * Returns: (transfer full): a new #GstQuery
1943 gst_query_new_scheduling (void)
1946 GstStructure *structure;
1948 structure = gst_structure_new_id (GST_QUARK (QUERY_SCHEDULING),
1949 GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, 0,
1950 GST_QUARK (MINSIZE), G_TYPE_INT, 1,
1951 GST_QUARK (MAXSIZE), G_TYPE_INT, -1,
1952 GST_QUARK (ALIGN), G_TYPE_INT, 0, NULL);
1953 query = gst_query_new_custom (GST_QUERY_SCHEDULING, structure);
1959 * gst_query_set_scheduling:
1960 * @query: A valid #GstQuery of type GST_QUERY_SCHEDULING.
1961 * @flags: #GstSchedulingFlags
1962 * @minsize: the suggested minimum size of pull requests
1963 * @maxsize: the suggested maximum size of pull requests
1964 * @align: the suggested alignment of pull requests
1966 * Set the scheduling properties.
1969 gst_query_set_scheduling (GstQuery * query, GstSchedulingFlags flags,
1970 gint minsize, gint maxsize, gint align)
1972 GstStructure *structure;
1974 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
1975 g_return_if_fail (gst_query_is_writable (query));
1977 structure = GST_QUERY_STRUCTURE (query);
1978 gst_structure_id_set (structure,
1979 GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, flags,
1980 GST_QUARK (MINSIZE), G_TYPE_INT, minsize,
1981 GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize,
1982 GST_QUARK (ALIGN), G_TYPE_INT, align, NULL);
1986 * gst_query_parse_scheduling:
1987 * @query: A valid #GstQuery of type GST_QUERY_SCHEDULING.
1988 * @flags: (out) (allow-none): #GstSchedulingFlags
1989 * @minsize: (out) (allow-none): the suggested minimum size of pull requests
1990 * @maxsize: (out) (allow-none): the suggested maximum size of pull requests:
1991 * @align: (out) (allow-none): the suggested alignment of pull requests
1993 * Set the scheduling properties.
1996 gst_query_parse_scheduling (GstQuery * query, GstSchedulingFlags * flags,
1997 gint * minsize, gint * maxsize, gint * align)
1999 GstStructure *structure;
2001 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
2003 structure = GST_QUERY_STRUCTURE (query);
2004 gst_structure_id_get (structure,
2005 GST_QUARK (FLAGS), GST_TYPE_SCHEDULING_FLAGS, flags,
2006 GST_QUARK (MINSIZE), G_TYPE_INT, minsize,
2007 GST_QUARK (MAXSIZE), G_TYPE_INT, maxsize,
2008 GST_QUARK (ALIGN), G_TYPE_INT, align, NULL);
2012 * gst_query_add_scheduling_mode:
2013 * @query: a GST_QUERY_SCHEDULING type query #GstQuery
2014 * @mode: a #GstPadMode
2016 * Add @mode as aone of the supported scheduling modes to @query.
2019 gst_query_add_scheduling_mode (GstQuery * query, GstPadMode mode)
2021 GstStructure *structure;
2024 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING);
2025 g_return_if_fail (gst_query_is_writable (query));
2027 structure = GST_QUERY_STRUCTURE (query);
2029 ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
2031 g_array_append_val (array, mode);
2035 * gst_query_get_n_scheduling_modes:
2036 * @query: a GST_QUERY_SCHEDULING type query #GstQuery
2038 * Retrieve the number of values currently stored in the
2039 * scheduling mode array of the query's structure.
2041 * Returns: the scheduling mode array size as a #guint.
2044 gst_query_get_n_scheduling_modes (GstQuery * query)
2047 GstStructure *structure;
2049 g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, 0);
2051 structure = GST_QUERY_STRUCTURE (query);
2053 ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
2059 * gst_query_parse_nth_scheduling_mode:
2060 * @query: a GST_QUERY_SCHEDULING type query #GstQuery
2061 * @index: position in the scheduling modes array to read
2063 * Parse an available query and get the scheduling mode
2064 * at @index of the scheduling modes array.
2066 * Returns: a #GstPadMode of the scheduling mode at @index.
2069 gst_query_parse_nth_scheduling_mode (GstQuery * query, guint index)
2071 GstStructure *structure;
2074 g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING,
2077 structure = GST_QUERY_STRUCTURE (query);
2079 ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
2080 g_return_val_if_fail (index < array->len, GST_PAD_MODE_NONE);
2082 return g_array_index (array, GstPadMode, index);
2086 * gst_query_has_scheduling_mode:
2087 * @query: a GST_QUERY_SCHEDULING type query #GstQuery
2088 * @mode: the scheduling mode
2090 * Check if @query has scheduling mode set.
2092 * Returns: TRUE when @mode is in the list of scheduling modes.
2095 gst_query_has_scheduling_mode (GstQuery * query, GstPadMode mode)
2097 GstStructure *structure;
2101 g_return_val_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_SCHEDULING, FALSE);
2103 structure = GST_QUERY_STRUCTURE (query);
2105 ensure_array (structure, GST_QUARK (MODES), sizeof (GstPadMode), NULL);
2108 for (i = 0; i < len; i++) {
2109 if (mode == g_array_index (array, GstPadMode, i))
2116 * gst_query_new_accept_caps:
2117 * @caps: a fixed #GstCaps
2119 * Constructs a new query object for querying if @caps are accepted.
2121 * Free-function: gst_query_unref
2123 * Returns: (transfer full): a new #GstQuery
2126 gst_query_new_accept_caps (GstCaps * caps)
2129 GstStructure *structure;
2131 g_return_val_if_fail (gst_caps_is_fixed (caps), NULL);
2133 structure = gst_structure_new_id (GST_QUARK (QUERY_ACCEPT_CAPS),
2134 GST_QUARK (CAPS), GST_TYPE_CAPS, caps,
2135 GST_QUARK (RESULT), G_TYPE_BOOLEAN, FALSE, NULL);
2136 query = gst_query_new_custom (GST_QUERY_ACCEPT_CAPS, structure);
2142 * gst_query_parse_accept_caps:
2143 * @query: The query to parse
2144 * @caps: (out): A pointer to the caps
2146 * Get the caps from @query. The caps remains valid as long as @query remains
2150 gst_query_parse_accept_caps (GstQuery * query, GstCaps ** caps)
2152 GstStructure *structure;
2154 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS);
2155 g_return_if_fail (caps != NULL);
2157 structure = GST_QUERY_STRUCTURE (query);
2158 *caps = g_value_get_boxed (gst_structure_id_get_value (structure,
2163 * gst_query_set_accept_caps_result:
2164 * @query: a GST_QUERY_ACCEPT_CAPS type query #GstQuery
2165 * @result: the result to set
2167 * Set @result as the result for the @query.
2170 gst_query_set_accept_caps_result (GstQuery * query, gboolean result)
2172 GstStructure *structure;
2174 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS);
2175 g_return_if_fail (gst_query_is_writable (query));
2177 structure = GST_QUERY_STRUCTURE (query);
2178 gst_structure_id_set (structure,
2179 GST_QUARK (RESULT), G_TYPE_BOOLEAN, result, NULL);
2183 * gst_query_parse_accept_caps_result:
2184 * @query: a GST_QUERY_ACCEPT_CAPS type query #GstQuery
2185 * @result: location for the result
2187 * Parse the result from @query and store in @result.
2190 gst_query_parse_accept_caps_result (GstQuery * query, gboolean * result)
2192 GstStructure *structure;
2194 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_ACCEPT_CAPS);
2196 structure = GST_QUERY_STRUCTURE (query);
2197 gst_structure_id_get (structure,
2198 GST_QUARK (RESULT), G_TYPE_BOOLEAN, result, NULL);
2202 * gst_query_new_caps:
2205 * Constructs a new query object for querying the caps.
2207 * The CAPS query should return the allowable caps for a pad in the context
2208 * of the element's state, its link to other elements, and the devices or files
2209 * it has opened. These caps must be a subset of the pad template caps. In the
2210 * NULL state with no links, the CAPS query should ideally return the same caps
2211 * as the pad template. In rare circumstances, an object property can affect
2212 * the caps returned by the CAPS query, but this is discouraged.
2214 * For most filters, the caps returned by CAPS query is directly affected by the
2215 * allowed caps on other pads. For demuxers and decoders, the caps returned by
2216 * the srcpad's getcaps function is directly related to the stream data. Again,
2217 * the CAPS query should return the most specific caps it reasonably can, since this
2218 * helps with autoplugging.
2220 * The @filter is used to restrict the result caps, only the caps matching
2221 * @filter should be returned from the CAPS query. Specifying a filter might
2222 * greatly reduce the amount of processing an element needs to do.
2224 * Free-function: gst_query_unref
2226 * Returns: (transfer full): a new #GstQuery
2229 gst_query_new_caps (GstCaps * filter)
2232 GstStructure *structure;
2234 structure = gst_structure_new_id (GST_QUARK (QUERY_CAPS),
2235 GST_QUARK (FILTER), GST_TYPE_CAPS, filter,
2236 GST_QUARK (CAPS), GST_TYPE_CAPS, NULL, NULL);
2237 query = gst_query_new_custom (GST_QUERY_CAPS, structure);
2243 * gst_query_parse_caps:
2244 * @query: The query to parse
2245 * @filter: (out): A pointer to the caps filter
2247 * Get the filter from the caps @query. The caps remains valid as long as
2248 * @query remains valid.
2251 gst_query_parse_caps (GstQuery * query, GstCaps ** filter)
2253 GstStructure *structure;
2255 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CAPS);
2256 g_return_if_fail (filter != NULL);
2258 structure = GST_QUERY_STRUCTURE (query);
2259 *filter = g_value_get_boxed (gst_structure_id_get_value (structure,
2260 GST_QUARK (FILTER)));
2264 * gst_query_set_caps_result:
2265 * @query: The query to use
2266 * @caps: (in): A pointer to the caps
2268 * Set the @caps result in @query.
2271 gst_query_set_caps_result (GstQuery * query, GstCaps * caps)
2273 GstStructure *structure;
2275 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CAPS);
2276 g_return_if_fail (gst_query_is_writable (query));
2278 structure = GST_QUERY_STRUCTURE (query);
2279 gst_structure_id_set (structure, GST_QUARK (CAPS), GST_TYPE_CAPS, caps, NULL);
2283 * gst_query_parse_caps_result:
2284 * @query: The query to parse
2285 * @caps: (out): A pointer to the caps
2287 * Get the caps result from @query. The caps remains valid as long as
2288 * @query remains valid.
2291 gst_query_parse_caps_result (GstQuery * query, GstCaps ** caps)
2293 GstStructure *structure;
2295 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_CAPS);
2296 g_return_if_fail (caps != NULL);
2298 structure = GST_QUERY_STRUCTURE (query);
2299 *caps = g_value_get_boxed (gst_structure_id_get_value (structure,
2305 gst_query_intersect_caps_result (GstQuery * query, GstCaps * filter,
2306 GstCapsIntersectMode mode)
2308 GstCaps *res, *caps = NULL;
2310 gst_query_parse_caps_result (query, &caps);
2311 res = gst_caps_intersect_full (filter, caps, GST_CAPS_INTERSECT_FIRST);
2312 gst_query_set_caps_result (query, res);
2313 gst_caps_unref (res);
2318 * gst_query_new_drain:
2320 * Constructs a new query object for querying the drain state.
2322 * Free-function: gst_query_unref
2324 * Returns: (transfer full): a new #GstQuery
2327 gst_query_new_drain (void)
2330 GstStructure *structure;
2332 structure = gst_structure_new_id_empty (GST_QUARK (QUERY_DRAIN));
2333 query = gst_query_new_custom (GST_QUERY_DRAIN, structure);
2339 * gst_query_new_toc:
2341 * Constructs a new query TOC query object. Use gst_query_unref()
2342 * when done with it. A TOC query is used to query the full TOC with
2343 * the UID marker for TOC extending (to insert some new entries).
2345 * Returns: A #GstQuery.
2348 gst_query_new_toc (void)
2351 GstStructure *structure;
2353 structure = gst_structure_new_id_empty (GST_QUARK (QUERY_TOC));
2354 query = gst_query_new_custom (GST_QUERY_TOC, structure);
2360 * gst_query_set_toc:
2361 * @query: a #GstQuery with query type GST_QUERY_TOC.
2362 * @toc: (transfer none): the GstToc to set.
2363 * @extend_uid: UID which can be used for TOC extending (may be NULL),
2364 * 0 means root TOC level.
2366 * Answer a TOC query by setting appropriate #GstToc structure.
2369 gst_query_set_toc (GstQuery * query, GstToc * toc, const gchar * extend_uid)
2371 g_return_if_fail (query != NULL);
2372 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_TOC);
2373 g_return_if_fail (gst_query_is_writable (query));
2374 g_return_if_fail (toc != NULL);
2376 gst_structure_id_set (GST_QUERY_STRUCTURE (query),
2377 GST_QUARK (TOC), GST_TYPE_TOC, toc,
2378 GST_QUARK (EXTEND_UID), G_TYPE_STRING, extend_uid, NULL);
2382 * gst_query_parse_toc:
2383 * @query: a #GstQuery.
2384 * @toc: (out) (allow-none) (transfer full): the storage for the received
2385 * TOC (may be NULL).
2386 * @extend_uid: (out) (allow-none) (transfer full): the storage for the
2387 received extend UID marker (may be NULL), 0 means root TOC level.
2389 * Parse a TOC query, writing the TOC into @toc as a newly
2390 * allocated #GstToc and extend UID into @extend_uid, if the respective parameters
2391 * are non-NULL. Use @extend_uid value to insert new entries into the TOC
2392 * (@extend_uid will act as root entry for newly inserted entries).
2393 * Free @toc with gst_toc_unref() and @extend_uid with g_free() after usage.
2396 gst_query_parse_toc (GstQuery * query, GstToc ** toc, gchar ** extend_uid)
2398 const GstStructure *structure;
2400 g_return_if_fail (query != NULL);
2401 g_return_if_fail (GST_QUERY_TYPE (query) == GST_QUERY_TOC);
2403 structure = gst_query_get_structure (query);
2405 gst_structure_id_get (structure,
2406 GST_QUARK (TOC), GST_TYPE_TOC, toc,
2407 GST_QUARK (EXTEND_UID), G_TYPE_STRING, extend_uid, NULL);