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