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