query: add gst_query_take()
[platform/upstream/gstreamer.git] / gst / gstquery.h
1 /* GStreamer
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>
5  *                    2011 Wim Taymans <wim.taymans@gmail.com>
6  *
7  * gstquery.h: GstQuery API declaration
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library General Public
20  * License along with this library; if not, write to the
21  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  */
24
25
26 #ifndef __GST_QUERY_H__
27 #define __GST_QUERY_H__
28
29 #include <glib.h>
30 #include <glib-object.h>
31 #include <gst/gstconfig.h>
32
33 G_BEGIN_DECLS
34
35 typedef struct _GstQuery GstQuery;
36
37 #include <gst/gstminiobject.h>
38
39 /**
40  * GstQueryTypeFlags:
41  * @GST_QUERY_TYPE_UPSTREAM:     Set if the query can travel upstream.
42  * @GST_QUERY_TYPE_DOWNSTREAM:   Set if the query can travel downstream.
43  * @GST_QUERY_TYPE_SERIALIZED:   Set if the query should be serialized with data
44  *                               flow.
45  *
46  * #GstQueryTypeFlags indicate the aspects of the different #GstQueryType
47  * values. You can get the type flags of a #GstQueryType with the
48  * gst_query_type_get_flags() function.
49  */
50 typedef enum {
51   GST_QUERY_TYPE_UPSTREAM       = 1 << 0,
52   GST_QUERY_TYPE_DOWNSTREAM     = 1 << 1,
53   GST_QUERY_TYPE_SERIALIZED     = 1 << 2
54 } GstQueryTypeFlags;
55
56 /**
57  * GST_QUERY_TYPE_BOTH: (value 3) (type GstQueryTypeFlags)
58  *
59  * The same thing as #GST_QUERY_TYPE_UPSTREAM | #GST_QUERY_TYPE_DOWNSTREAM.
60  */
61 #define GST_QUERY_TYPE_BOTH \
62     ((GstQueryTypeFlags)(GST_QUERY_TYPE_UPSTREAM | GST_QUERY_TYPE_DOWNSTREAM))
63
64 #define GST_QUERY_NUM_SHIFT     (8)
65
66 /**
67  * GST_QUERY_MAKE_TYPE:
68  * @num: the query number to create
69  * @flags: the query flags
70  *
71  * when making custom query types, use this macro with the num and
72  * the given flags
73  */
74 #define GST_QUERY_MAKE_TYPE(num,flags) \
75     (((num) << GST_QUERY_NUM_SHIFT) | (flags))
76
77 #define FLAG(name) GST_QUERY_TYPE_##name
78
79
80 /**
81  * GstQueryType:
82  * @GST_QUERY_UNKNOWN: unknown query type
83  * @GST_QUERY_POSITION: current position in stream
84  * @GST_QUERY_DURATION: total duration of the stream
85  * @GST_QUERY_LATENCY: latency of stream
86  * @GST_QUERY_JITTER: current jitter of stream
87  * @GST_QUERY_RATE: current rate of the stream
88  * @GST_QUERY_SEEKING: seeking capabilities
89  * @GST_QUERY_SEGMENT: segment start/stop positions
90  * @GST_QUERY_CONVERT: convert values between formats
91  * @GST_QUERY_FORMATS: query supported formats for convert
92  * @GST_QUERY_BUFFERING: query available media for efficient seeking.
93  * @GST_QUERY_CUSTOM: a custom application or element defined query.
94  * @GST_QUERY_URI: query the URI of the source or sink.
95  * @GST_QUERY_ALLOCATION: the buffer allocation properties
96  * @GST_QUERY_SCHEDULING: the scheduling properties
97  * @GST_QUERY_ACCEPT_CAPS: the accept caps query
98  * @GST_QUERY_CAPS: the caps query
99  * @GST_QUERY_DRAIN: wait till all serialized data is consumed downstream
100  * @GST_QUERY_CONTEXT: query the pipeline-local context from
101  *     downstream or upstream (since 1.2)
102  *
103  * Standard predefined Query types
104  */
105 /* NOTE: don't forget to update the table in gstquery.c when changing
106  * this enum */
107 typedef enum {
108   GST_QUERY_UNKNOWN      = GST_QUERY_MAKE_TYPE (0, 0),
109   GST_QUERY_POSITION     = GST_QUERY_MAKE_TYPE (10, FLAG(BOTH)),
110   GST_QUERY_DURATION     = GST_QUERY_MAKE_TYPE (20, FLAG(BOTH)),
111   GST_QUERY_LATENCY      = GST_QUERY_MAKE_TYPE (30, FLAG(BOTH)),
112   GST_QUERY_JITTER       = GST_QUERY_MAKE_TYPE (40, FLAG(BOTH)),
113   GST_QUERY_RATE         = GST_QUERY_MAKE_TYPE (50, FLAG(BOTH)),
114   GST_QUERY_SEEKING      = GST_QUERY_MAKE_TYPE (60, FLAG(BOTH)),
115   GST_QUERY_SEGMENT      = GST_QUERY_MAKE_TYPE (70, FLAG(BOTH)),
116   GST_QUERY_CONVERT      = GST_QUERY_MAKE_TYPE (80, FLAG(BOTH)),
117   GST_QUERY_FORMATS      = GST_QUERY_MAKE_TYPE (90, FLAG(BOTH)),
118   GST_QUERY_BUFFERING    = GST_QUERY_MAKE_TYPE (110, FLAG(BOTH)),
119   GST_QUERY_CUSTOM       = GST_QUERY_MAKE_TYPE (120, FLAG(BOTH)),
120   GST_QUERY_URI          = GST_QUERY_MAKE_TYPE (130, FLAG(BOTH)),
121   GST_QUERY_ALLOCATION   = GST_QUERY_MAKE_TYPE (140, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
122   GST_QUERY_SCHEDULING   = GST_QUERY_MAKE_TYPE (150, FLAG(UPSTREAM)),
123   GST_QUERY_ACCEPT_CAPS  = GST_QUERY_MAKE_TYPE (160, FLAG(BOTH)),
124   GST_QUERY_CAPS         = GST_QUERY_MAKE_TYPE (170, FLAG(BOTH)),
125   GST_QUERY_DRAIN        = GST_QUERY_MAKE_TYPE (180, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
126   GST_QUERY_CONTEXT      = GST_QUERY_MAKE_TYPE (190, FLAG(BOTH))
127 } GstQueryType;
128 #undef FLAG
129
130 GST_API GType _gst_query_type;
131
132 #define GST_TYPE_QUERY                         (_gst_query_type)
133 #define GST_IS_QUERY(obj)                      (GST_IS_MINI_OBJECT_TYPE (obj, GST_TYPE_QUERY))
134 #define GST_QUERY_CAST(obj)                    ((GstQuery*)(obj))
135 #define GST_QUERY(obj)                         (GST_QUERY_CAST(obj))
136
137 /**
138  * GST_QUERY_TYPE:
139  * @query: the query to query
140  *
141  * Get the #GstQueryType of the query.
142  */
143 #define GST_QUERY_TYPE(query)  (((GstQuery*)(query))->type)
144
145 /**
146  * GST_QUERY_TYPE_NAME:
147  * @query: the query to query
148  *
149  * Get a constant string representation of the #GstQueryType of the query.
150  */
151 #define GST_QUERY_TYPE_NAME(query) (gst_query_type_get_name(GST_QUERY_TYPE(query)))
152
153 /**
154  * GST_QUERY_IS_UPSTREAM:
155  * @ev: the query to query
156  *
157  * Check if an query can travel upstream.
158  */
159 #define GST_QUERY_IS_UPSTREAM(ev)       !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_UPSTREAM)
160 /**
161  * GST_QUERY_IS_DOWNSTREAM:
162  * @ev: the query to query
163  *
164  * Check if an query can travel downstream.
165  */
166 #define GST_QUERY_IS_DOWNSTREAM(ev)     !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_DOWNSTREAM)
167 /**
168  * GST_QUERY_IS_SERIALIZED:
169  * @ev: the query to query
170  *
171  * Check if an query is serialized with the data stream.
172  */
173 #define GST_QUERY_IS_SERIALIZED(ev)     !!(GST_QUERY_TYPE (ev) & GST_QUERY_TYPE_SERIALIZED)
174
175
176 /**
177  * GstQuery:
178  * @mini_object: The parent #GstMiniObject type
179  * @type: the #GstQueryType
180  *
181  * The #GstQuery structure.
182  */
183 struct _GstQuery
184 {
185   GstMiniObject mini_object;
186
187   /*< public > *//* with COW */
188   GstQueryType type;
189 };
190
191 /**
192  * GstBufferingMode:
193  * @GST_BUFFERING_STREAM: a small amount of data is buffered
194  * @GST_BUFFERING_DOWNLOAD: the stream is being downloaded
195  * @GST_BUFFERING_TIMESHIFT: the stream is being downloaded in a ringbuffer
196  * @GST_BUFFERING_LIVE: the stream is a live stream
197  *
198  * The different types of buffering methods.
199  */
200 typedef enum {
201   GST_BUFFERING_STREAM,
202   GST_BUFFERING_DOWNLOAD,
203   GST_BUFFERING_TIMESHIFT,
204   GST_BUFFERING_LIVE
205 } GstBufferingMode;
206
207 #include <gst/gstiterator.h>
208 #include <gst/gststructure.h>
209 #include <gst/gstformat.h>
210 #include <gst/gstpad.h>
211 #include <gst/gstallocator.h>
212 #include <gst/gsttoc.h>
213 #include <gst/gstcontext.h>
214
215 GST_API
216 const gchar*    gst_query_type_get_name        (GstQueryType type);
217
218 GST_API
219 GQuark          gst_query_type_to_quark        (GstQueryType type);
220
221 GST_API
222 GstQueryTypeFlags
223                 gst_query_type_get_flags       (GstQueryType type);
224
225
226 GST_API
227 GType           gst_query_get_type             (void);
228
229 /* refcounting */
230 /**
231  * gst_query_ref:
232  * @q: a #GstQuery to increase the refcount of.
233  *
234  * Increases the refcount of the given query by one.
235  *
236  * Returns: @q
237  */
238 static inline GstQuery *
239 gst_query_ref (GstQuery * q)
240 {
241   return GST_QUERY_CAST (gst_mini_object_ref (GST_MINI_OBJECT_CAST (q)));
242 }
243
244 /**
245  * gst_query_unref:
246  * @q: a #GstQuery to decrease the refcount of.
247  *
248  * Decreases the refcount of the query. If the refcount reaches 0, the query
249  * will be freed.
250  */
251 static inline void
252 gst_query_unref (GstQuery * q)
253 {
254   gst_mini_object_unref (GST_MINI_OBJECT_CAST (q));
255 }
256
257 /**
258  * gst_clear_query: (skip)
259  * @query_ptr: a pointer to a #GstQuery reference
260  *
261  * Clears a reference to a #GstQuery.
262  *
263  * @query_ptr must not be %NULL.
264  *
265  * If the reference is %NULL then this function does nothing. Otherwise, the
266  * reference count of the query is decreased and the pointer is set to %NULL.
267  *
268  * Since: 1.16
269  */
270 static inline void
271 gst_clear_query (GstQuery ** query_ptr)
272 {
273   gst_clear_mini_object (query_ptr);
274 }
275
276 /* copy query */
277 /**
278  * gst_query_copy:
279  * @q: a #GstQuery to copy.
280  *
281  * Copies the given query using the copy function of the parent #GstStructure.
282  *
283  * Free-function: gst_query_unref
284  *
285  * Returns: (transfer full): a new copy of @q.
286  */
287 static inline GstQuery *
288 gst_query_copy (const GstQuery * q)
289 {
290   return GST_QUERY_CAST (gst_mini_object_copy (GST_MINI_OBJECT_CONST_CAST (q)));
291 }
292
293 /**
294  * gst_query_is_writable:
295  * @q: a #GstQuery
296  *
297  * Tests if you can safely write data into a query's structure.
298  */
299 #define         gst_query_is_writable(q)     gst_mini_object_is_writable (GST_MINI_OBJECT_CAST (q))
300 /**
301  * gst_query_make_writable:
302  * @q: (transfer full): a #GstQuery to make writable
303  *
304  * Makes a writable query from the given query.
305  *
306  * Returns: (transfer full): a new writable query (possibly same as @q)
307  */
308 #define         gst_query_make_writable(q)      GST_QUERY_CAST (gst_mini_object_make_writable (GST_MINI_OBJECT_CAST (q)))
309 /**
310  * gst_query_replace:
311  * @old_query: (inout) (transfer full) (nullable): pointer to a pointer to a
312  *     #GstQuery to be replaced.
313  * @new_query: (allow-none) (transfer none): pointer to a #GstQuery that will
314  *     replace the query pointed to by @old_query.
315  *
316  * Modifies a pointer to a #GstQuery to point to a different #GstQuery. The
317  * modification is done atomically (so this is useful for ensuring thread safety
318  * in some cases), and the reference counts are updated appropriately (the old
319  * query is unreffed, the new one is reffed).
320  *
321  * Either @new_query or the #GstQuery pointed to by @old_query may be %NULL.
322  *
323  * Returns: %TRUE if @new_query was different from @old_query
324  */
325 static inline gboolean
326 gst_query_replace (GstQuery **old_query, GstQuery *new_query)
327 {
328   return gst_mini_object_replace ((GstMiniObject **) old_query, (GstMiniObject *) new_query);
329 }
330
331 /**
332  * gst_query_take:
333  * @old_query: (inout) (transfer full) (nullable): pointer to a
334  *     pointer to a #GstQuery to be stolen.
335  * @new_query: (allow-none) (transfer full): pointer to a #GstQuery that will
336  *     replace the query pointed to by @old_query.
337  *
338  * Modifies a pointer to a #GstQuery to point to a different #GstQuery. This
339  * function is similar to gst_query_replace() except that it takes ownership of
340  * @new_query.
341  *
342  * Either @new_query or the #GstQuery pointed to by @old_query may be %NULL.
343  *
344  * Returns: %TRUE if @new_query was different from @old_query
345  *
346  * Since: 1.16
347  */
348 static inline gboolean
349 gst_query_take (GstQuery **old_query, GstQuery *new_query)
350 {
351   return gst_mini_object_take ((GstMiniObject **) old_query,
352       (GstMiniObject *) new_query);
353 }
354
355 /* application specific query */
356
357 GST_API
358 GstQuery *      gst_query_new_custom            (GstQueryType type, GstStructure *structure) G_GNUC_MALLOC;
359
360 GST_API
361 const GstStructure *
362                 gst_query_get_structure         (GstQuery *query);
363
364 GST_API
365 GstStructure *  gst_query_writable_structure    (GstQuery *query);
366
367 /* position query */
368
369 GST_API
370 GstQuery*       gst_query_new_position          (GstFormat format) G_GNUC_MALLOC;
371
372 GST_API
373 void            gst_query_set_position          (GstQuery *query, GstFormat format, gint64 cur);
374
375 GST_API
376 void            gst_query_parse_position        (GstQuery *query, GstFormat *format, gint64 *cur);
377
378 /* duration query */
379
380 GST_API
381 GstQuery*       gst_query_new_duration          (GstFormat format) G_GNUC_MALLOC;
382
383 GST_API
384 void            gst_query_set_duration          (GstQuery *query, GstFormat format, gint64 duration);
385
386 GST_API
387 void            gst_query_parse_duration        (GstQuery *query, GstFormat *format, gint64 *duration);
388
389 /* latency query */
390
391 GST_API
392 GstQuery*       gst_query_new_latency           (void) G_GNUC_MALLOC;
393
394 GST_API
395 void            gst_query_set_latency           (GstQuery *query, gboolean live, GstClockTime min_latency,
396                                                  GstClockTime max_latency);
397
398 GST_API
399 void            gst_query_parse_latency         (GstQuery *query, gboolean *live, GstClockTime *min_latency,
400                                                  GstClockTime *max_latency);
401
402 /* convert query */
403
404 GST_API
405 GstQuery*       gst_query_new_convert           (GstFormat src_format, gint64 value, GstFormat dest_format) G_GNUC_MALLOC;
406
407 GST_API
408 void            gst_query_set_convert           (GstQuery *query, GstFormat src_format, gint64 src_value,
409                                                  GstFormat dest_format, gint64 dest_value);
410
411 GST_API
412 void            gst_query_parse_convert         (GstQuery *query, GstFormat *src_format, gint64 *src_value,
413                                                  GstFormat *dest_format, gint64 *dest_value);
414 /* segment query */
415
416 GST_API
417 GstQuery*       gst_query_new_segment           (GstFormat format) G_GNUC_MALLOC;
418
419 GST_API
420 void            gst_query_set_segment           (GstQuery *query, gdouble rate, GstFormat format,
421                                                  gint64 start_value, gint64 stop_value);
422
423 GST_API
424 void            gst_query_parse_segment         (GstQuery *query, gdouble *rate, GstFormat *format,
425                                                  gint64 *start_value, gint64 *stop_value);
426
427 /* seeking query */
428
429 GST_API
430 GstQuery*       gst_query_new_seeking           (GstFormat format) G_GNUC_MALLOC;
431
432 GST_API
433 void            gst_query_set_seeking           (GstQuery *query, GstFormat format,
434                                                  gboolean seekable,
435                                                  gint64 segment_start,
436                                                  gint64 segment_end);
437
438 GST_API
439 void            gst_query_parse_seeking         (GstQuery *query, GstFormat *format,
440                                                  gboolean *seekable,
441                                                  gint64 *segment_start,
442                                                  gint64 *segment_end);
443 /* formats query */
444
445 GST_API
446 GstQuery*       gst_query_new_formats           (void) G_GNUC_MALLOC;
447
448 GST_API
449 void            gst_query_set_formats           (GstQuery *query, gint n_formats, ...);
450
451 GST_API
452 void            gst_query_set_formatsv          (GstQuery *query, gint n_formats, const GstFormat *formats);
453
454 GST_API
455 void            gst_query_parse_n_formats       (GstQuery *query, guint *n_formats);
456
457 GST_API
458 void            gst_query_parse_nth_format      (GstQuery *query, guint nth, GstFormat *format);
459
460 /* buffering query */
461
462 GST_API
463 GstQuery*       gst_query_new_buffering           (GstFormat format) G_GNUC_MALLOC;
464
465 GST_API
466 void            gst_query_set_buffering_percent   (GstQuery *query, gboolean busy, gint percent);
467
468 GST_API
469 void            gst_query_parse_buffering_percent (GstQuery *query, gboolean *busy, gint *percent);
470
471 GST_API
472 void            gst_query_set_buffering_stats     (GstQuery *query, GstBufferingMode mode,
473                                                    gint avg_in, gint avg_out,
474                                                    gint64 buffering_left);
475
476 GST_API
477 void            gst_query_parse_buffering_stats    (GstQuery *query, GstBufferingMode *mode,
478                                                    gint *avg_in, gint *avg_out,
479                                                    gint64 *buffering_left);
480
481 GST_API
482 void            gst_query_set_buffering_range     (GstQuery *query, GstFormat format,
483                                                    gint64 start, gint64 stop,
484                                                    gint64 estimated_total);
485
486 GST_API
487 void            gst_query_parse_buffering_range   (GstQuery *query, GstFormat *format,
488                                                    gint64 *start, gint64 *stop,
489                                                    gint64 *estimated_total);
490
491 GST_API
492 gboolean        gst_query_add_buffering_range       (GstQuery *query,
493                                                      gint64 start, gint64 stop);
494
495 GST_API
496 guint           gst_query_get_n_buffering_ranges    (GstQuery *query);
497
498 GST_API
499 gboolean        gst_query_parse_nth_buffering_range (GstQuery *query,
500                                                      guint index, gint64 *start,
501                                                      gint64 *stop);
502
503 /* URI query */
504
505 GST_API
506 GstQuery *      gst_query_new_uri                    (void) G_GNUC_MALLOC;
507
508 GST_API
509 void            gst_query_parse_uri                  (GstQuery *query, gchar **uri);
510
511 GST_API
512 void            gst_query_set_uri                    (GstQuery *query, const gchar *uri);
513
514 GST_API
515 void            gst_query_parse_uri_redirection      (GstQuery *query, gchar **uri);
516
517 GST_API
518 void            gst_query_set_uri_redirection        (GstQuery *query, const gchar *uri);
519
520 GST_API
521 void            gst_query_parse_uri_redirection_permanent (GstQuery *query, gboolean * permanent);
522
523 GST_API
524 void            gst_query_set_uri_redirection_permanent (GstQuery *query, gboolean permanent);
525
526 /* allocation query */
527
528 GST_API
529 GstQuery *      gst_query_new_allocation             (GstCaps *caps, gboolean need_pool) G_GNUC_MALLOC;
530
531 GST_API
532 void            gst_query_parse_allocation           (GstQuery *query, GstCaps **caps, gboolean *need_pool);
533
534 /* pools */
535
536 GST_API
537 void            gst_query_add_allocation_pool        (GstQuery *query, GstBufferPool *pool,
538                                                       guint size, guint min_buffers,
539                                                       guint max_buffers);
540
541 GST_API
542 guint           gst_query_get_n_allocation_pools     (GstQuery *query);
543
544 GST_API
545 void            gst_query_parse_nth_allocation_pool  (GstQuery *query, guint index,
546                                                       GstBufferPool **pool,
547                                                       guint *size, guint *min_buffers,
548                                                       guint *max_buffers);
549
550 GST_API
551 void            gst_query_set_nth_allocation_pool    (GstQuery *query, guint index,
552                                                       GstBufferPool *pool,
553                                                       guint size, guint min_buffers,
554                                                       guint max_buffers);
555
556 GST_API
557 void            gst_query_remove_nth_allocation_pool (GstQuery *query, guint index);
558
559 /* allocators */
560
561 GST_API
562 void            gst_query_add_allocation_param       (GstQuery *query, GstAllocator *allocator,
563                                                       const GstAllocationParams *params);
564
565 GST_API
566 guint           gst_query_get_n_allocation_params    (GstQuery *query);
567
568 GST_API
569 void            gst_query_parse_nth_allocation_param (GstQuery *query, guint index,
570                                                       GstAllocator **allocator,
571                                                       GstAllocationParams *params);
572
573 GST_API
574 void            gst_query_set_nth_allocation_param   (GstQuery *query, guint index,
575                                                       GstAllocator *allocator,
576                                                       const GstAllocationParams *params);
577
578 GST_API
579 void            gst_query_remove_nth_allocation_param (GstQuery *query, guint index);
580
581 /* metadata */
582
583 GST_API
584 void            gst_query_add_allocation_meta        (GstQuery *query, GType api, const GstStructure *params);
585
586 GST_API
587 guint           gst_query_get_n_allocation_metas     (GstQuery *query);
588
589 GST_API
590 GType           gst_query_parse_nth_allocation_meta  (GstQuery *query, guint index,
591                                                       const GstStructure **params);
592
593 GST_API
594 void            gst_query_remove_nth_allocation_meta (GstQuery *query, guint index);
595
596 GST_API
597 gboolean        gst_query_find_allocation_meta       (GstQuery *query, GType api, guint *index);
598
599
600 /* scheduling query */
601 /**
602  * GstSchedulingFlags:
603  * @GST_SCHEDULING_FLAG_SEEKABLE: if seeking is possible
604  * @GST_SCHEDULING_FLAG_SEQUENTIAL: if sequential access is recommended
605  * @GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED: if bandwidth is limited and buffering possible (since 1.2)
606  *
607  * The different scheduling flags.
608  */
609 typedef enum {
610   GST_SCHEDULING_FLAG_SEEKABLE          = (1 << 0),
611   GST_SCHEDULING_FLAG_SEQUENTIAL        = (1 << 1),
612   GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED = (1 << 2)
613 } GstSchedulingFlags;
614
615 GST_API
616 GstQuery *      gst_query_new_scheduling          (void) G_GNUC_MALLOC;
617
618 GST_API
619 void            gst_query_set_scheduling          (GstQuery *query, GstSchedulingFlags flags,
620                                                    gint minsize, gint maxsize, gint align);
621
622 GST_API
623 void            gst_query_parse_scheduling        (GstQuery *query, GstSchedulingFlags *flags,
624                                                    gint *minsize, gint *maxsize, gint *align);
625
626 GST_API
627 void            gst_query_add_scheduling_mode       (GstQuery *query, GstPadMode mode);
628
629 GST_API
630 guint           gst_query_get_n_scheduling_modes    (GstQuery *query);
631
632 GST_API
633 GstPadMode      gst_query_parse_nth_scheduling_mode (GstQuery *query, guint index);
634
635 GST_API
636 gboolean        gst_query_has_scheduling_mode       (GstQuery *query, GstPadMode mode);
637
638 GST_API
639 gboolean        gst_query_has_scheduling_mode_with_flags (GstQuery * query, GstPadMode mode,
640                                                     GstSchedulingFlags flags);
641
642 /* accept-caps query */
643
644 GST_API
645 GstQuery *      gst_query_new_accept_caps          (GstCaps *caps) G_GNUC_MALLOC;
646
647 GST_API
648 void            gst_query_parse_accept_caps        (GstQuery *query, GstCaps **caps);
649
650 GST_API
651 void            gst_query_set_accept_caps_result   (GstQuery *query, gboolean result);
652
653 GST_API
654 void            gst_query_parse_accept_caps_result (GstQuery *query, gboolean *result);
655
656 /* caps query */
657
658 GST_API
659 GstQuery *      gst_query_new_caps                 (GstCaps *filter) G_GNUC_MALLOC;
660
661 GST_API
662 void            gst_query_parse_caps               (GstQuery *query, GstCaps **filter);
663
664 GST_API
665 void            gst_query_set_caps_result          (GstQuery *query, GstCaps *caps);
666
667 GST_API
668 void            gst_query_parse_caps_result        (GstQuery *query, GstCaps **caps);
669
670 /* drain query */
671
672 GST_API
673 GstQuery *      gst_query_new_drain                (void) G_GNUC_MALLOC;
674
675 /* context query */
676
677 GST_API
678 GstQuery *      gst_query_new_context              (const gchar * context_type) G_GNUC_MALLOC;
679
680 GST_API
681 gboolean        gst_query_parse_context_type       (GstQuery * query, const gchar ** context_type);
682
683 GST_API
684 void            gst_query_set_context              (GstQuery *query, GstContext *context);
685
686 GST_API
687 void            gst_query_parse_context            (GstQuery *query, GstContext **context);
688
689 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
690 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstQuery, gst_query_unref)
691 #endif
692
693 G_END_DECLS
694
695 #endif /* __GST_QUERY_H__ */
696