Debian Codegraph @

gstreamer/gstreamermm/query.h

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2 #ifndef _GSTREAMERMM_QUERY_H
3 #define _GSTREAMERMM_QUERY_H
4
5
6 #include <glibmm/ustring.h>
7 #include <sigc++/sigc++.h>
8
9 /* gstreamermm - a C++ wrapper for gstreamer
10 *
11 * Copyright 2008 The gstreamermm Development Team
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28 #include <gst/gst.h>
29 #include <gstreamermm/miniobject.h>
30 #include <gstreamermm/structure.h>
31 #include <gstreamermm/format.h>
32 #include <gstreamermm/caps.h>
33 #include <gstreamermm/pad.h>
34 #include <gstreamermm/allocator.h>
35 #include <glibmm/arrayhandle.h>
36
37
38 namespace Glib
39 {
40 template<typename T>
41 Glib::RefPtr<T> wrap_query_derived(GstQuery* object, bool take_copy = false)
42 {
43 if(take_copy && object)
44 gst_query_ref(object);
45
46 // See the comment at the top of this file, if you want to know why the cast works.
47 return Glib::RefPtr<T>(reinterpret_cast<T*>(object));
48 }
49 }
50
51 namespace Gst
52 {
53
54 #define FLAG(name) GST_QUERY_TYPE_##name
55
56 /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */
57
58 /**
59 * @var BufferingMode BUFFERING_STREAM
60 * A small amount of data is buffered.
61 *
62 * @var BufferingMode BUFFERING_DOWNLOAD
63 * The stream is being downloaded.
64 *
65 * @var BufferingMode BUFFERING_TIMESHIFT
66 * The stream is being downloaded in a ringbuffer.
67 *
68 * @var BufferingMode BUFFERING_LIVE
69 * The stream is a live stream.
70 *
71 * @enum BufferingMode
72 *
73 * The different types of buffering methods.
74 *
75 * @ingroup gstreamermmEnums
76 */
77 enum BufferingMode
78 {
79 BUFFERING_STREAM,
80 BUFFERING_DOWNLOAD,
81 BUFFERING_TIMESHIFT,
82 BUFFERING_LIVE
83 };
84
85 } // namespace Gst
86
87 #ifndef DOXYGEN_SHOULD_SKIP_THIS
88 namespace Glib
89 {
90
91 template <>
92 class Value<Gst::BufferingMode> : public Glib::Value_Enum<Gst::BufferingMode>
93 {
94 public:
95 static GType value_type() G_GNUC_CONST;
96 };
97
98 } // namespace Glib
99 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
100
101 namespace Gst
102 {
103
104 /**
105 * @var QueryType QUERY_UNKNOWN
106 * Unknown query type.
107 *
108 * @var QueryType QUERY_POSITION
109 * Current position in stream.
110 *
111 * @var QueryType QUERY_DURATION
112 * Total duration of the stream.
113 *
114 * @var QueryType QUERY_LATENCY
115 * Latency of stream.
116 *
117 * @var QueryType QUERY_JITTER
118 * Current jitter of stream.
119 *
120 * @var QueryType QUERY_RATE
121 * Current rate of the stream.
122 *
123 * @var QueryType QUERY_SEEKING
124 * Seeking capabilities.
125 *
126 * @var QueryType QUERY_SEGMENT
127 * Segment start/stop positions.
128 *
129 * @var QueryType QUERY_CONVERT
130 * Convert values between formats.
131 *
132 * @var QueryType QUERY_FORMATS
133 * Query supported formats for convert.
134 *
135 * @var QueryType QUERY_BUFFERING
136 * Query available media for efficient seeking.
137 *
138 * @var QueryType QUERY_CUSTOM
139 * A custom application or element defined query.
140 *
141 * @var QueryType QUERY_URI
142 * Query the URI of the source or sink.
143 *
144 * @var QueryType QUERY_ALLOCATION
145 * The buffer allocation properties.
146 *
147 * @var QueryType QUERY_SCHEDULING
148 * The scheduling properties.
149 *
150 * @var QueryType QUERY_ACCEPT_CAPS
151 * The accept caps query.
152 *
153 * @var QueryType QUERY_CAPS
154 * The caps query.
155 *
156 * @var QueryType QUERY_DRAIN
157 * Wait till all serialized data is consumed downstream.
158 *
159 * @var QueryType QUERY_CONTEXT
160 * Query the pipeline-local context from
161 * downstream or upstream (since 1.2).
162 *
163 * @enum QueryType
164 *
165 * Standard predefined Query types
166 *
167 * @ingroup gstreamermmEnums
168 * @par Bitwise operators:
169 * <tt>%QueryType operator|(QueryType, QueryType)</tt><br>
170 * <tt>%QueryType operator&(QueryType, QueryType)</tt><br>
171 * <tt>%QueryType operator^(QueryType, QueryType)</tt><br>
172 * <tt>%QueryType operator~(QueryType)</tt><br>
173 * <tt>%QueryType& operator|=(QueryType&, QueryType)</tt><br>
174 * <tt>%QueryType& operator&=(QueryType&, QueryType)</tt><br>
175 * <tt>%QueryType& operator^=(QueryType&, QueryType)</tt><br>
176 */
177 enum QueryType
178 {
179 QUERY_UNKNOWN = GST_QUERY_MAKE_TYPE (0, 0),
180 QUERY_POSITION = GST_QUERY_MAKE_TYPE (10, FLAG(BOTH)),
181 QUERY_DURATION = GST_QUERY_MAKE_TYPE (20, FLAG(BOTH)),
182 QUERY_LATENCY = GST_QUERY_MAKE_TYPE (30, FLAG(BOTH)),
183 QUERY_JITTER = GST_QUERY_MAKE_TYPE (40, FLAG(BOTH)),
184 QUERY_RATE = GST_QUERY_MAKE_TYPE (50, FLAG(BOTH)),
185 QUERY_SEEKING = GST_QUERY_MAKE_TYPE (60, FLAG(BOTH)),
186 QUERY_SEGMENT = GST_QUERY_MAKE_TYPE (70, FLAG(BOTH)),
187 QUERY_CONVERT = GST_QUERY_MAKE_TYPE (80, FLAG(BOTH)),
188 QUERY_FORMATS = GST_QUERY_MAKE_TYPE (90, FLAG(BOTH)),
189 QUERY_BUFFERING = GST_QUERY_MAKE_TYPE (110, FLAG(BOTH)),
190 QUERY_CUSTOM = GST_QUERY_MAKE_TYPE (120, FLAG(BOTH)),
191 QUERY_URI = GST_QUERY_MAKE_TYPE (130, FLAG(BOTH)),
192 QUERY_ALLOCATION = GST_QUERY_MAKE_TYPE (140, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
193 QUERY_SCHEDULING = GST_QUERY_MAKE_TYPE (150, FLAG(UPSTREAM)),
194 QUERY_ACCEPT_CAPS = GST_QUERY_MAKE_TYPE (160, FLAG(BOTH)),
195 QUERY_CAPS = GST_QUERY_MAKE_TYPE (170, FLAG(BOTH)),
196 QUERY_DRAIN = GST_QUERY_MAKE_TYPE (180, FLAG(DOWNSTREAM) | FLAG(SERIALIZED)),
197 QUERY_CONTEXT = GST_QUERY_MAKE_TYPE (190, FLAG(BOTH))
198 };
199
200 /** @ingroup gstreamermmEnums */
201 inline QueryType operator|(QueryType lhs, QueryType rhs)
202 { return static_cast<QueryType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
203
204 /** @ingroup gstreamermmEnums */
205 inline QueryType operator&(QueryType lhs, QueryType rhs)
206 { return static_cast<QueryType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
207
208 /** @ingroup gstreamermmEnums */
209 inline QueryType operator^(QueryType lhs, QueryType rhs)
210 { return static_cast<QueryType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
211
212 /** @ingroup gstreamermmEnums */
213 inline QueryType operator~(QueryType flags)
214 { return static_cast<QueryType>(~static_cast<unsigned>(flags)); }
215
216 /** @ingroup gstreamermmEnums */
217 inline QueryType& operator|=(QueryType& lhs, QueryType rhs)
218 { return (lhs = static_cast<QueryType>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
219
220 /** @ingroup gstreamermmEnums */
221 inline QueryType& operator&=(QueryType& lhs, QueryType rhs)
222 { return (lhs = static_cast<QueryType>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
223
224 /** @ingroup gstreamermmEnums */
225 inline QueryType& operator^=(QueryType& lhs, QueryType rhs)
226 { return (lhs = static_cast<QueryType>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
227
228 } // namespace Gst
229
230 #ifndef DOXYGEN_SHOULD_SKIP_THIS
231 namespace Glib
232 {
233
234 template <>
235 class Value<Gst::QueryType> : public Glib::Value_Flags<Gst::QueryType>
236 {
237 public:
238 static GType value_type() G_GNUC_CONST;
239 };
240
241 } // namespace Glib
242 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
243
244 namespace Gst
245 {
246
247 /**
248 * @var QueryTypeFlags QUERY_TYPE_UPSTREAM
249 * Set if the query can travel upstream.
250 *
251 * @var QueryTypeFlags QUERY_TYPE_DOWNSTREAM
252 * Set if the query can travel downstream.
253 *
254 * @var QueryTypeFlags QUERY_TYPE_SERIALIZED
255 * Set if the query should be serialized with data
256 * flow.
257 *
258 * @enum QueryTypeFlags
259 *
260 * Gst::QueryTypeFlags indicate the aspects of the different Gst::QueryType
261 * values. You can get the type flags of a Gst::QueryType with the
262 * Gst::Query::type_get_flags() function.
263 *
264 * @ingroup gstreamermmEnums
265 * @par Bitwise operators:
266 * <tt>%QueryTypeFlags operator|(QueryTypeFlags, QueryTypeFlags)</tt><br>
267 * <tt>%QueryTypeFlags operator&(QueryTypeFlags, QueryTypeFlags)</tt><br>
268 * <tt>%QueryTypeFlags operator^(QueryTypeFlags, QueryTypeFlags)</tt><br>
269 * <tt>%QueryTypeFlags operator~(QueryTypeFlags)</tt><br>
270 * <tt>%QueryTypeFlags& operator|=(QueryTypeFlags&, QueryTypeFlags)</tt><br>
271 * <tt>%QueryTypeFlags& operator&=(QueryTypeFlags&, QueryTypeFlags)</tt><br>
272 * <tt>%QueryTypeFlags& operator^=(QueryTypeFlags&, QueryTypeFlags)</tt><br>
273 */
274 enum QueryTypeFlags
275 {
276 QUERY_TYPE_UPSTREAM = 1 << 0,
277 QUERY_TYPE_DOWNSTREAM = 1 << 1,
278 QUERY_TYPE_SERIALIZED = 1 << 2
279 };
280
281 /** @ingroup gstreamermmEnums */
282 inline QueryTypeFlags operator|(QueryTypeFlags lhs, QueryTypeFlags rhs)
283 { return static_cast<QueryTypeFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
284
285 /** @ingroup gstreamermmEnums */
286 inline QueryTypeFlags operator&(QueryTypeFlags lhs, QueryTypeFlags rhs)
287 { return static_cast<QueryTypeFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
288
289 /** @ingroup gstreamermmEnums */
290 inline QueryTypeFlags operator^(QueryTypeFlags lhs, QueryTypeFlags rhs)
291 { return static_cast<QueryTypeFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
292
293 /** @ingroup gstreamermmEnums */
294 inline QueryTypeFlags operator~(QueryTypeFlags flags)
295 { return static_cast<QueryTypeFlags>(~static_cast<unsigned>(flags)); }
296
297 /** @ingroup gstreamermmEnums */
298 inline QueryTypeFlags& operator|=(QueryTypeFlags& lhs, QueryTypeFlags rhs)
299 { return (lhs = static_cast<QueryTypeFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
300
301 /** @ingroup gstreamermmEnums */
302 inline QueryTypeFlags& operator&=(QueryTypeFlags& lhs, QueryTypeFlags rhs)
303 { return (lhs = static_cast<QueryTypeFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
304
305 /** @ingroup gstreamermmEnums */
306 inline QueryTypeFlags& operator^=(QueryTypeFlags& lhs, QueryTypeFlags rhs)
307 { return (lhs = static_cast<QueryTypeFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
308
309 } // namespace Gst
310
311 #ifndef DOXYGEN_SHOULD_SKIP_THIS
312 namespace Glib
313 {
314
315 template <>
316 class Value<Gst::QueryTypeFlags> : public Glib::Value_Flags<Gst::QueryTypeFlags>
317 {
318 public:
319 static GType value_type() G_GNUC_CONST;
320 };
321
322 } // namespace Glib
323 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
324
325 namespace Gst
326 {
327
328 /**
329 * @var SchedulingFlags SCHEDULING_FLAG_SEEKABLE
330 * If seeking is possible.
331 *
332 * @var SchedulingFlags SCHEDULING_FLAG_SEQUENTIAL
333 * If sequential access is recommended.
334 *
335 * @var SchedulingFlags SCHEDULING_FLAG_BANDWIDTH_LIMITED
336 * If bandwidth is limited and buffering possible (since 1.2).
337 *
338 * @enum SchedulingFlags
339 *
340 * The different scheduling flags.
341 *
342 * @ingroup gstreamermmEnums
343 * @par Bitwise operators:
344 * <tt>%SchedulingFlags operator|(SchedulingFlags, SchedulingFlags)</tt><br>
345 * <tt>%SchedulingFlags operator&(SchedulingFlags, SchedulingFlags)</tt><br>
346 * <tt>%SchedulingFlags operator^(SchedulingFlags, SchedulingFlags)</tt><br>
347 * <tt>%SchedulingFlags operator~(SchedulingFlags)</tt><br>
348 * <tt>%SchedulingFlags& operator|=(SchedulingFlags&, SchedulingFlags)</tt><br>
349 * <tt>%SchedulingFlags& operator&=(SchedulingFlags&, SchedulingFlags)</tt><br>
350 * <tt>%SchedulingFlags& operator^=(SchedulingFlags&, SchedulingFlags)</tt><br>
351 */
352 enum SchedulingFlags
353 {
354 SCHEDULING_FLAG_SEEKABLE = (1 << 0),
355 SCHEDULING_FLAG_SEQUENTIAL = (1 << 1),
356 SCHEDULING_FLAG_BANDWIDTH_LIMITED = (1 << 2)
357 };
358
359 /** @ingroup gstreamermmEnums */
360 inline SchedulingFlags operator|(SchedulingFlags lhs, SchedulingFlags rhs)
361 { return static_cast<SchedulingFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
362
363 /** @ingroup gstreamermmEnums */
364 inline SchedulingFlags operator&(SchedulingFlags lhs, SchedulingFlags rhs)
365 { return static_cast<SchedulingFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
366
367 /** @ingroup gstreamermmEnums */
368 inline SchedulingFlags operator^(SchedulingFlags lhs, SchedulingFlags rhs)
369 { return static_cast<SchedulingFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
370
371 /** @ingroup gstreamermmEnums */
372 inline SchedulingFlags operator~(SchedulingFlags flags)
373 { return static_cast<SchedulingFlags>(~static_cast<unsigned>(flags)); }
374
375 /** @ingroup gstreamermmEnums */
376 inline SchedulingFlags& operator|=(SchedulingFlags& lhs, SchedulingFlags rhs)
377 { return (lhs = static_cast<SchedulingFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
378
379 /** @ingroup gstreamermmEnums */
380 inline SchedulingFlags& operator&=(SchedulingFlags& lhs, SchedulingFlags rhs)
381 { return (lhs = static_cast<SchedulingFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
382
383 /** @ingroup gstreamermmEnums */
384 inline SchedulingFlags& operator^=(SchedulingFlags& lhs, SchedulingFlags rhs)
385 { return (lhs = static_cast<SchedulingFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
386
387 } // namespace Gst
388
389 #ifndef DOXYGEN_SHOULD_SKIP_THIS
390 namespace Glib
391 {
392
393 template <>
394 class Value<Gst::SchedulingFlags> : public Glib::Value_Flags<Gst::SchedulingFlags>
395 {
396 public:
397 static GType value_type() G_GNUC_CONST;
398 };
399
400 } // namespace Glib
401 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
402
403 namespace Gst
404 {
405
406
407 #undef FLAG
408
409 namespace Enums
410 {
411
412 /** Gets a printable name for the given query type.
413 *
414 * @param type The query type.
415 * @return The name of the query.
416 */
417 Glib::ustring get_name(QueryType type);
418
419
420 /** Gets the Gst::QueryTypeFlags associated with @a type.
421 *
422 * @param type a Gst::QueryType.
423 * @return a Gst::QueryTypeFlags;
424 */
425 Gst::QueryTypeFlags get_flags(QueryType type);
426
427
428 /** Gets the unique quark for the given query type.
429 *
430 * @param type The query type.
431 * @return The quark associated with the query type.
432 */
433 Glib::QueryQuark get_quark(QueryType type);
434
435
436 } //namespace Enums
437
438 /** A class used to perform queries on pads and elements.
439 *
440 * Queries can be performed on pads (gst_pad_query()) and elements
441 * (gst_element_query()). Please note that some queries might need a running
442 * pipeline to work.
443 *
444 * Queries can be created using the gst_query_new_*() functions.
445 * Query values can be set using gst_query_set_*(), and parsed using
446 * gst_query_parse_*() helpers.
447 *
448 * The following example shows how to query the duration of a pipeline:
449 *
450 * @code
451 * Glib::RefPtr<Gst::Query> query = Gst::QueryDuration::create(Gst::FORMAT_TIME);
452 * bool res = pipeline->query(query);
453 * if(res)
454 * {
455 * gint64 duration = Glib::RefPtr<Gst::QueryDuration>::cast_dynamic(query)->parse();
456 * ...
457 * }
458 * @endcode
459 */
460 class Query : public MiniObject
461 {
462 public:
463 #ifndef DOXYGEN_SHOULD_SKIP_THIS
464 using CppObjectType = Query;
465 using BaseObjectType = GstQuery;
466 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
467
468
469 /** Increment the reference count for this object.
470 * You should never need to do this manually - use the object via a RefPtr instead.
471 */
472 void reference() const;
473
474 /** Decrement the reference count for this object.
475 * You should never need to do this manually - use the object via a RefPtr instead.
476 */
477 void unreference() const;
478
479 ///Provides access to the underlying C instance.
480 GstQuery* gobj();
481
482 ///Provides access to the underlying C instance.
483 const GstQuery* gobj() const;
484
485 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
486 GstQuery* gobj_copy() const;
487
488 Query() = delete;
489
490 // noncopyable
491 Query(const Query&) = delete;
492 Query& operator=(const Query&) = delete;
493
494 protected:
495 // Do not derive this. Gst::Query can neither be constructed nor deleted.
496
497 void operator delete(void*, std::size_t);
498
499 private:
500
501
502 public:
503 /** Makes a writable query from the given query.
504 * @return A Gst::Query (possibly the same pointer) that is writable.
505 */
506 Glib::RefPtr<Gst::Query> create_writable();
507
508 // A copy is taken so that the original is not freed by the wrapper.
509
510
511 /** Get the structure of a query.
512 *
513 * @return The Gst::Structure of the query. The structure is
514 * still owned by the query and will therefore be freed when the query
515 * is unreffed.
516 */
517 Gst::Structure get_structure() const;
518
519
520 /** Constructs a new query object for querying the buffering status of
521 * a stream.
522 *
523 * Free-function: gst_query_unref
524 *
525 * @param format The default Gst::Format for the new query.
526 * @return A new Gst::Query.
527 */
528 static Glib::RefPtr<Gst::Query> create_buffering(Gst::Format format);
529
530
531 /** Constructs a new query object for querying the allocation properties.
532 *
533 * Free-function: gst_query_unref
534 *
535 * @param caps The negotiated caps.
536 * @param need_pool Return a pool.
537 * @return A new Gst::Query.
538 */
539 static Glib::RefPtr<Gst::Query> create_allocation(Glib::RefPtr<Gst::Caps> caps, bool need_pool);
540
541
542 /** Constructs a new query URI query object. Use unref()
543 * when done with it. An URI query is used to query the current URI
544 * that is used by the source or sink.
545 *
546 * Free-function: gst_query_unref
547 *
548 * @return A new Gst::Query.
549 */
550 static Glib::RefPtr<Gst::Query> create_uri();
551
552
553 /** Constructs a new query object for querying the scheduling properties.
554 *
555 * Free-function: gst_query_unref
556 *
557 * @return A new Gst::Query.
558 */
559 static Glib::RefPtr<Gst::Query> create_scheduling();
560
561
562 /** Constructs a new query object for querying the drain state.
563 *
564 * Free-function: gst_query_unref
565 *
566 * @return A new Gst::Query.
567 */
568 static Glib::RefPtr<Gst::Query> create_drain();
569
570
571 /** Constructs a new custom query object. Use unref()
572 * when done with it.
573 *
574 * Free-function: gst_query_unref
575 *
576 * @param type The query type.
577 * @param structure A structure for the query.
578 * @return A new Gst::Query.
579 */
580 static Glib::RefPtr<Gst::Query> create_custom(Gst::QueryType type, const Gst::Structure& structure);
581
582
583 /** Constructs a new convert query object. Use unref()
584 * when done with it. A convert query is used to ask for a conversion between
585 * one format and another.
586 *
587 * Free-function: gst_query_unref
588 *
589 * @param format The source Gst::Format for the new query.
590 * @param value The value to convert.
591 * @param dest_format The target Gst::Format.
592 * @return A Gst::Query.
593 */
594 static Glib::RefPtr<Gst::Query> create_convert(Gst::Format format, gint64 value, Gst::Format dest_format);
595
596
597 /** Constructs a new query stream position query object. Use unref()
598 * when done with it. A position query is used to query the current position
599 * of playback in the streams, in some format.
600 *
601 * Free-function: gst_query_unref
602 *
603 * @param format The default Gst::Format for the new query.
604 * @return A new Gst::Query.
605 */
606 static Glib::RefPtr<Gst::Query> create_position(Gst::Format format);
607
608
609 /** Constructs a new stream duration query object to query in the given format.
610 * Use unref() when done with it. A duration query will give the
611 * total length of the stream.
612 *
613 * Free-function: gst_query_unref
614 *
615 * @param format The Gst::Format for this duration query.
616 * @return A new Gst::Query.
617 */
618 static Glib::RefPtr<Gst::Query> create_duration(Gst::Format format);
619
620
621 /** Constructs a new latency query object.
622 * Use unref() when done with it. A latency query is usually performed
623 * by sinks to compensate for additional latency introduced by elements in the
624 * pipeline.
625 *
626 * Free-function: gst_query_unref
627 *
628 * @return A Gst::Query.
629 */
630 static Glib::RefPtr<Gst::Query> create_latency();
631
632
633 /** Constructs a new query object for querying seeking properties of
634 * the stream.
635 *
636 * Free-function: gst_query_unref
637 *
638 * @param format The default Gst::Format for the new query.
639 * @return A new Gst::Query.
640 */
641 static Glib::RefPtr<Gst::Query> create_seeking(Gst::Format format);
642
643
644 /** Constructs a new query object for querying formats of
645 * the stream.
646 *
647 * Free-function: gst_query_unref
648 *
649 * @return A new Gst::Query.
650 */
651 static Glib::RefPtr<Gst::Query> create_formats();
652
653
654 /** Constructs a new segment query object. Use unref()
655 * when done with it. A segment query is used to discover information about the
656 * currently configured segment for playback.
657 *
658 * Free-function: gst_query_unref
659 *
660 * @param format The Gst::Format for the new query.
661 * @return A new Gst::Query.
662 */
663 static Glib::RefPtr<Gst::Query> create_segment(Gst::Format format);
664
665
666 /** Constructs a new query object for querying the caps.
667 *
668 * The CAPS query should return the allowable caps for a pad in the context
669 * of the element's state, its link to other elements, and the devices or files
670 * it has opened. These caps must be a subset of the pad template caps. In the
671 * <tt>nullptr</tt> state with no links, the CAPS query should ideally return the same caps
672 * as the pad template. In rare circumstances, an object property can affect
673 * the caps returned by the CAPS query, but this is discouraged.
674 *
675 * For most filters, the caps returned by CAPS query is directly affected by the
676 * allowed caps on other pads. For demuxers and decoders, the caps returned by
677 * the srcpad's getcaps function is directly related to the stream data. Again,
678 * the CAPS query should return the most specific caps it reasonably can, since this
679 * helps with autoplugging.
680 *
681 * The @a filter is used to restrict the result caps, only the caps matching
682 * @a filter should be returned from the CAPS query. Specifying a filter might
683 * greatly reduce the amount of processing an element needs to do.
684 *
685 * Free-function: gst_query_unref
686 *
687 * @param filter A filter.
688 * @return A new Gst::Query.
689 */
690 static Glib::RefPtr<Gst::Query> create_caps(Glib::RefPtr<Gst::Caps> filter);
691
692
693 /** Constructs a new query object for querying if @a filter are accepted.
694 *
695 * Free-function: gst_query_unref
696 *
697 * @param filter A fixed Gst::Caps.
698 * @return A new Gst::Query.
699 */
700 static Glib::RefPtr<Gst::Query> create_accept_caps(Glib::RefPtr<Gst::Caps> filter);
701
702 /** Get the Gst::QueryType of the query.
703 */
704 QueryType get_query_type() const;
705
706
707 /** Copies the given query using the copy function of the parent Gst::Structure.
708 *
709 * Free-function: gst_query_unref
710 *
711 * @return A new copy of @a q.
712 */
713 Glib::RefPtr<Gst::Query> copy();
714
715
716 protected:
717 // This method is used in the create() methods to convert a wrapped GstQuery
718 // to one of the more specific Gst::Query types.
719 template <class QueryType>
720 static inline Glib::RefPtr<QueryType> wrap(GstQuery* query,
721 bool take_copy = false);
722
723
724 };
725
726 //TODO: Modify create methods of derived Query classes to return
727 //Glib::RefPtr<...> to the derived class and not just Gst::Query. Must deal
728 //with GstStructure immutability problem (bug #510301) first because casting
729 //Glib::RefPtrs references the objects which causes problems when GStreamer API
730 //tries to modify the GstStructures of the objects.
731
732 /** A custom application query object. See create() for more details.
733 */
734 class QueryApplication : public Query
735 {
736 public:
737
738 /** Constructs a new custom application query object. The Gst::Query may be
739 * used by applications in their own way. Please note that a custom
740 * Gst::QueryType must be used in order for the returned Gst::Query to
741 * actually be a Gst::QueryApplication type.
742 * @param type The query type.
743 * @param structure A structure for the query.
744 * @return The new Gst::QueryApplication.
745 */
746 static Glib::RefPtr<Gst::QueryApplication>
747 create(QueryType type, const Gst::Structure& structure);
748 };
749
750 /** A convert query object. See create() for more details.
751 */
752 class QueryConvert : public Query
753 {
754 public:
755
756 /** Constructs a new convert query object. A convert query is used to ask
757 * for a conversion between one format and another.
758 * @param src_format The source Gst::Format for the new query.
759 * @param value The value to convert.
760 * @param dest_format The target Gst::Format.
761 * @return The new Gst::QueryConvert.
762 */
763 static Glib::RefPtr<Gst::QueryConvert>
764 create(Format src_format, gint64 value, Format dest_format);
765
766 /** Answer a convert query by setting the requested values.
767 * @param src_format The source Gst::Format.
768 * @param src_value The source value.
769 * @param dest_format The destination Gst::Format.
770 * @param dest_value The destination value.
771 */
772 void set(Format src_format, gint64 src_value, Format dest_format, gint64 dest_value);
773
774 /** Parse a convert query answer. Use the other parse() methods for parsing
775 * individual values.
776 * @param src_format The storage for the Gst::Format of the source value.
777 * @param src_value The storage for the source value.
778 * @param dest_format The storage for the Gst::Format of the destination.
779 * value.
780 * @param dest_value The storage for the destination value.
781 */
782 void parse(Format& src_format, gint64& src_value, Format& dest_format, gint64& dest_value) const;
783
784 /** Parse the destination format and value of a convert query answer.
785 * @param dest_format The storage for the Gst::Format of the destination
786 * value.
787 * @param dest_value The storage for the destination value.
788 */
789 void parse(Format& dest_format, gint64& dest_value) const;
790
791 /** Parse the source format of a convert query answer, returning the format.
792 * @return The Gst::Format of the source value.
793 */
794 Format parse_src_format() const;
795
796 /** Parse the source value of a convert query answer returning, the value.
797 * @return The source value.
798 */
799 gint64 parse_src_value() const;
800
801 /** Parse the destination format of a convert query answer, returning the
802 * format.
803 * @return The Gst::Format of the destination value.
804 */
805 Format parse_dest_format() const;
806
807 /** Parse the destination value of a convert query answer, returning the
808 * value.
809 * @return The destination value.
810 */
811 gint64 parse_dest_value() const;
812 };
813
814 /** A stream position query object. See create() for more details.
815 */
816 class QueryPosition : public Query
817 {
818 public:
819
820 /** Constructs a new query stream position query object. A position query is
821 * used to query the current position of playback in the streams, in some
822 * format.
823 * @param format The default Gst::Format for the new query.
824 * @return The new Gst::QueryPosition.
825 */
826 static Glib::RefPtr<Gst::QueryPosition> create(Format format);
827
828 /** Answer a position query by setting the requested value in the given
829 * format.
830 * @param format The requested Gst::Format.
831 * @param position The position to set.
832 */
833 void set(Format format, gint64 position);
834
835 /** Parse a position query, writing the format into format, and the position
836 * into @a position. Use the other parse() methods for parsing individual
837 * values.
838 * @param format The storage for the Gst::Format of the position values.
839 * @param position The storage for the current position.
840 */
841 void parse(Format& format, gint64& position) const;
842
843 /** Parse the position of a position query, returning the position.
844 * @return The current position of the position query.
845 */
846 gint64 parse() const;
847
848 /** Parse the format of a position query, returning the format.
849 * @return The the Gst::Format of the position values.
850 */
851 Format parse_format() const;
852 };
853
854 /** A stream duration query object. See create() for more details.
855 */
856 class QueryDuration : public Query
857 {
858 public:
859
860 /** Constructs a new stream duration query object to query in the given
861 * format. A duration query will give the total length of the stream.
862 * @param format The Gst::Format for this duration query.
863 * @return The new Gst::QueryDuration.
864 */
865 static Glib::RefPtr<Gst::QueryDuration> create(Format format);
866
867 /** Answer a duration query by setting the requested value in the given
868 * format.
869 * @param format The Gst::Format for the duration.
870 * @param duration The duration of the stream.
871 */
872 void set(Format format, gint64 duration);
873
874 /** Parse a duration query answer. Write the format of the duration into
875 * @a format, and the value into @a duration. Use the other parse() methods
876 * for parsing individual values.
877 * @param format The storage for the Gst::Format of the duration value.
878 * @param duration The storage for the total duration.
879 */
880 void parse(Format& format, gint64& duration) const;
881
882 /** Parse a duration query answer, returning the duration.
883 * @return The total duration.
884 */
885 gint64 parse() const;
886
887 /** Parse a duration query answer, returning the format of the duration.
888 * @return The Gst::Format of the duration value.
889 */
890 Format parse_format() const;
891 };
892
893 /** A latency query object. See create() for more details.
894 */
895 class QueryLatency : public Query
896 {
897 public:
898
899 /** Constructs a new latency query object. A latency query is usually
900 * performed by sinks to compensate for additional latency introduced by
901 * elements in the pipeline.
902 * @return The new Gst::QueryLatency.
903 */
904 static Glib::RefPtr<Gst::QueryLatency> create();
905
906 /** Answer a latency query by setting the requested values in the given
907 * format.
908 * @param live If there is a live element upstream.
909 * @param min_latency The minimal latency of the live element.
910 * @param max_latency The maximal latency of the live element.
911 */
912 void set(bool live, ClockTime min_latency, ClockTime max_latency);
913
914 /** Parse a latency query answer. Use the other parse() methods for parsing
915 * individual values.
916 * @param live Storage for live.
917 * @param min_latency The storage for the min latency.
918 * @param max_latency The storage for the max latency.
919 */
920 void parse(bool& live, ClockTime& min_latency, ClockTime& max_latency) const;
921
922 /** Parse a latency query answer, returning the live status.
923 * @return the live satus.
924 */
925 bool parse_live() const;
926
927 /** Parse a latency query answer, returning the minimum latency.
928 * @return The minimum latency.
929 */
930 ClockTime parse_min() const;
931
932 /** Parse a latency query answer, returning the maximum latency.
933 * @return The maximum latency.
934 */
935 ClockTime parse_max() const;
936 };
937
938 /** A seeking query object. See create() for more details.
939 */
940 class QuerySeeking : public Query
941 {
942 public:
943
944 /** Constructs a new query object for querying seeking properties of the
945 * stream.
946 * @param format The default Gst::Format for the new query.
947 * @return The new Gst::QuerySeeking.
948 */
949 static Glib::RefPtr<Gst::QuerySeeking> create(Format format);
950
951 /** Set the seeking query result fields in query.
952 * @param format The format to set for @a the segment_start and
953 * @a segment_end values.
954 * @param seekable The seekable flag to set.
955 * @param segment_start The segment_start to set.
956 * @param segment_end The segment_end to set.
957 */
958 void set(Format format, bool seekable, gint64 segment_start, gint64 segment_end);
959
960 /** Parse a seeking query, writing the format into format, and other results
961 * into the passed parameters. Use the other parse() methods for parsing
962 * individual values.
963 * @param format The storage location for the foramt.
964 * @param seekable The storage location for the seekable flag.
965 * @param segment_start The storage location for the segment start value.
966 * @param segment_end The storage location for the segment end.
967 */
968 void parse(Format& format, bool& seekable, gint64& segment_start, gint64& segment_end) const;
969
970 /** Parse a seeking query, returning the format.
971 * @return The format.
972 */
973 Format parse_format() const;
974
975 /** Parse a seeking query, returning the seekable status.
976 * @return The seekable flag.
977 */
978 bool parse_seekable() const;
979
980 /** Parse a seeking query, returning the segment start value.
981 * @return The segment start.
982 */
983 gint64 parse_start() const;
984
985 /** Parse a seeking query, returning the segment end value.
986 * @return The segment end.
987 */
988 gint64 parse_end() const;
989 };
990
991 /** A formats query object. See create() for more details.
992 */
993 class QueryFormats : public Query
994 {
995 public:
996
997 /** Constructs a new query object for querying formats of the stream.
998 * @return The new Gst::QueryFormats.
999 */
1000 static Glib::RefPtr<Gst::QueryFormats> create();
1001
1002 /** Set the formats query result fields. All the formats in the array are
1003 * used.
1004 * @param formats An array containing Gst::Format values.
1005 */
1006 void set(const Glib::ArrayHandle<Format>& formats);
1007
1008 /** Set the formats query result fields using only @a n_formats from @a
1009 * formats. The number of formats passed in the formats array must be
1010 * greater than or equal to @a n_formats.
1011 * @param n_formats The number of formats to set.
1012 * @param formats An array containing at least @a n_formats Gst::Format
1013 * values.
1014 */
1015 void set(int n_formats, const Glib::ArrayHandle<Format>& formats);
1016
1017 /** Parse and return the number of formats in the formats query.
1018 * @return The number of formats in this query.
1019 */
1020 guint parse_length() const;
1021
1022 /** Parse the format query and return the @a nth format from it. If the list
1023 * contains less elements than @a nth, Gst::FORMAT_UNDEFINED will be
1024 * returned.
1025 * @param nth The index of the format to return.
1026 * @return the @a nth format or Gst::FORMAT_UNDEFINED.
1027 */
1028 Format parse(guint nth) const;
1029 };
1030
1031 /** A new segment query object. See create() for more details.
1032 */
1033 class QuerySegment : public Query
1034 {
1035 public:
1036
1037 /** Constructs a new segment query object. A segment query is used to
1038 * discover information about the currently configured segment for playback.
1039 * @param format The Gst::Format for the new query.
1040 * @return The new Gst::QuerySegment.
1041 */
1042 static Glib::RefPtr<Gst::QuerySegment> create(Format format);
1043
1044 /** Answer a segment query by setting the requested values. The normal
1045 * playback segment of a pipeline is 0 to duration at the default rate of
1046 * 1.0. If a seek was performed on the pipeline to play a different segment,
1047 * this query will return the range specified in the last seek.
1048 *
1049 * @a start_value and @a stop_value will respectively contain the configured
1050 * playback range start and stop values expressed in @a format. The values
1051 * are always between 0 and the duration of the media and @a start_value <=
1052 * @a stop_value. @a rate will contain the playback rate. For negative
1053 * rates, playback will actually happen from @a stop_value to @a start_value.
1054 *
1055 * @param rate The rate of the segment.
1056 * @param format The Gst::Format of the segment values (@a start_value and
1057 * @a stop_value).
1058 * @param start_value The start value.
1059 * @param stop_value The stop value.
1060 */
1061 void set(double rate, Format format, gint64 start_value, gint64 stop_value);
1062
1063 /** Parse a segment query answer. See set() for an explanation of the
1064 * function arguments. Use the other parse() methods to parse individual
1065 * values.
1066 *
1067 * @param rate The storage for the rate of the segment.
1068 * @param format The storage for the Gst::Format of the values.
1069 * @param start_value The storage for the start value.
1070 * @param stop_value The storage for the stop value.
1071 */
1072 void parse(double& rate, Format& format, gint64& start_value, gint64& stop_value) const;
1073
1074 /** Parse a segment query answer, returning the rate. See set() for an
1075 * explanation of the function arguments.
1076 * @return The rate of the segment.
1077 */
1078 double parse_rate() const;
1079
1080 /** Parse a segment query answer, returning the format. See set() for an
1081 * explanation of the function arguments.
1082 * @return The Gst::Format of the start and stop values.
1083 */
1084 Format parse_format() const;
1085
1086 /** Parse a segment query answer, returning the start value. See set() for
1087 * an explanation of the function arguments.
1088 * @return The start value.
1089 */
1090 gint64 parse_start() const;
1091
1092 /** Parse a segment query answer, returning the stop value. See set() for
1093 * an explanation of the function arguments.
1094 * @return The stop value.
1095 */
1096 gint64 parse_stop() const;
1097 };
1098
1099 /** A new buffering query object. See create() for more details.
1100 */
1101 class QueryBuffering : public Query
1102 {
1103 public:
1104
1105 /** Constructs a new query object for querying the buffering status of a
1106 * stream.
1107 * @param format The default Gst::Format for the new query.
1108 * @return The new Gst::QueryBuffering.
1109 */
1110 static Glib::RefPtr<Gst::QueryBuffering> create(Format format);
1111
1112 /** Set the percentage of buffered data. This is a value between 0 and 100.
1113 * The @a busy indicator is true when the buffering is in progress.
1114 * @param busy If buffering is busy.
1115 * @param percent A buffering percent.
1116 */
1117 void set(bool busy, int percent);
1118
1119 /** Get the busy flag and percentage of the buffered data. The percent is a
1120 * value between 0 and 100. The busy indicator is true when the buffering
1121 * is in progress. Use the other parse() methods to parse individual
1122 * values.
1123 * @param busy The location to store the buffering busy flag.
1124 * @param percent The location to store the buffering percent.
1125 */
1126 void parse(bool& busy, int& percent) const;
1127
1128 /** Get the busy flag of the buffered data. The busy indicator is true when
1129 * the buffering is in progress.
1130 * @return The buffering busy flag.
1131 */
1132 bool parse_busy() const;
1133
1134 /** Get the percentage of the buffered data. The percent is a value between
1135 * 0 and 100.
1136 * @return The buffering percent.
1137 */
1138 int parse_percent() const;
1139
1140 /** Configures the buffering stats values in query.
1141 * @param mode A buffering mode.
1142 * @param avg_in The average input rate.
1143 * @param avg_out The average output rate.
1144 * @param buffering_left Amount of buffering time left.
1145 */
1146 void set(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left);
1147
1148 /** Extracts the buffering stats values from the query. Use the other
1149 * parse() methods to parse individual values.
1150 * @param mode The location to store the buffering mode.
1151 * @param avg_in The location to store the average input rate.
1152 * @param avg_out The location to store the average output rate.
1153 * @param buffering_left The location to store the amount of buffering time
1154 * left.
1155 */
1156 void parse(BufferingMode& mode, int& avg_in, int& avg_out, gint64 buffering_left) const;
1157
1158 /** Extracts the buffering mode from the query.
1159 * @return The the buffering mode.
1160 */
1161 BufferingMode parse_mode() const;
1162
1163 /** Extracts the average input rate from the query.
1164 * @return The average input rate.
1165 */
1166 int parse_input_rate() const;
1167
1168 /** Extracts the average output rate from the query.
1169 * @return The average output rate.
1170 */
1171 int parse_output_rate() const;
1172
1173 /** Extracts the buffering time left from the query.
1174 * @return The the amount of buffering time left.
1175 */
1176 gint64 parse_time_left() const;
1177
1178 /** Set the available query result fields in query.
1179 * @param format The format to set for the start and stop values.
1180 * @param start The start to set.
1181 * @param stop The stop to set.
1182 * @param estimated_total Estimated total amount of download time.
1183 */
1184 void set(Format format, gint64 start, gint64 stop, gint64 estimated_total);
1185
1186 /** Parse the query, writing the format into format, and other
1187 * results into the passed parameters. Use the other parse() methods to
1188 * parse individual values.
1189 * @param format The location to store the format.
1190 * @param start The location to store the start.
1191 * @param stop The location to store the stop.
1192 * @param estimated_total The location to store the estimated total amount
1193 * of download time.
1194 */
1195 void parse(Format& format, gint64& start, gint64& stop, gint64& estimated_total) const;
1196
1197 /** Parse the query, returning the format.
1198 * @return The format.
1199 */
1200 Format parse_format() const;
1201
1202 /** Parse the query, returning the start range value.
1203 * @return The start value.
1204 */
1205 gint64 parse_start() const;
1206
1207 /** Parse the query, returning the stop range value.
1208 * @return The stop value.
1209 */
1210 gint64 parse_stop() const;
1211
1212 /** Parse the query, returning the estimated total amount of download time.
1213 * @return The estimated total amount of download time.
1214 */
1215 gint64 parse_total_time() const;
1216
1217 /** Retrieve the number of values currently stored in the
1218 * buffered-ranges array of the query's structure.
1219 * @return the range array size as a guint.
1220 */
1221 guint get_n_buffering_ranges() const;
1222
1223 /** Set the buffering-ranges array field in @a query. The current last
1224 * start position of the array should be inferior to @a start.
1225 * @param start start position of the range.
1226 * @param stop stop position of the range.
1227 * @return a bool indicating if the range was added or not.
1228 */
1229 bool add_buffering_range(gint64 start, gint64 stop);
1230
1231 /** Parse an available query and get the start and stop values stored
1232 * at the @a index of the buffered ranges array.
1233 * @param index position in the buffered-ranges array to read.
1234 * @param start the start position to set, or NULL.
1235 * @param stop the stop position to set, or NULL.
1236 * @return a bool indicating if the parsing succeeded.
1237 */
1238 bool parse_nth_buffering_range(guint index, gint64& start, gint64& stop) const;
1239 };
1240
1241 /** A new caps query object. See create() for more details.
1242 */
1243 class QueryCaps : public Query
1244 {
1245 public:
1246
1247 /** Constructs a new query object for querying the caps.
1248 *
1249 * The CAPS query should return the allowable caps for a pad in the context
1250 * of the element's state, its link to other elements, and the devices or files
1251 * it has opened. These caps must be a subset of the pad template caps. In the
1252 * NULL state with no links, the CAPS query should ideally return the same caps
1253 * as the pad template. In rare circumstances, an object property can affect
1254 * the caps returned by the CAPS query, but this is discouraged.
1255 * For most filters, the caps returned by CAPS query is directly affected by the
1256 * allowed caps on other pads. For demuxers and decoders, the caps returned by
1257 * the srcpad's getcaps function is directly related to the stream data. Again,
1258 * the CAPS query should return the most specific caps it reasonably can, since this
1259 * helps with autoplugging.
1260 *
1261 * The @a filter is used to restrict the result caps, only the caps matching
1262 * @a filter should be returned from the CAPS query. Specifying a filter might
1263 * greatly reduce the amount of processing an element needs to do.
1264 * @param filter a filter.
1265 * @return The new Gst::QureyCaps.
1266 */
1267 static Glib::RefPtr<Gst::QueryCaps>
1268 create(const Glib::RefPtr<Gst::Caps>& filter);
1269
1270 /** Get the filter from the caps @a query. The caps remains valid as long as
1271 * @a query remains valid.
1272 * @return caps filter.
1273 */
1274 Glib::RefPtr<Gst::Caps> parse() const;
1275
1276 /** Get the caps result from @a query. The caps remains valid as long as
1277 * @a query remains valid.
1278 * @return a pointer to the caps.
1279 */
1280 Glib::RefPtr<Gst::Caps> parse_caps_result() const;
1281
1282 /** Set the @a caps result in @a query.
1283 * @param caps a pointer to the caps.
1284 */
1285 void set_caps_result(const Glib::RefPtr<Gst::Caps>& caps);
1286 };
1287
1288 /** A new scheduling query object. See create() for more details.
1289 */
1290 class QueryScheduling : public Query
1291 {
1292 public:
1293
1294 /** Constructs a new query object for querying the scheduling properties.
1295 * @return A new Gst::QueryScheduling.
1296 */
1297 static Glib::RefPtr<Gst::QueryScheduling>
1298 create();
1299
1300 /** Set the scheduling properties.
1301 * @param flags Gst::SchedulingFlags.
1302 * @param minsize the suggested minimum size of pull requests.
1303 * @param maxsize the suggested maximum size of pull requests.
1304 * @param align the suggested alignment of pull requests.
1305 */
1306 void parse(Gst::SchedulingFlags& flags, gint& minsize, gint& maxsize, gint& align) const;
1307
1308 /** Set the scheduling properties.
1309 * @param flags Gst::SchedulingFlags.
1310 * @param minsize the suggested minimum size of pull requests.
1311 * @param maxsize the suggested maximum size of pull requests.
1312 * @param align the suggested alignment of pull requests.
1313 */
1314 void set(Gst::SchedulingFlags flags, gint minsize, gint maxsize, gint align);
1315
1316 /** Add @a mode as aone of the supported scheduling modes to @a query.
1317 *
1318 * @param mode A Gst::PadMode.
1319 */
1320 void add_scheduling_mode(Gst::PadMode mode);
1321
1322 /** Retrieve the number of values currently stored in the
1323 * scheduling mode array of the query's structure.
1324 * @return the scheduling mode array size as a guint.
1325 */
1326 guint get_n_scheduling_modes() const;
1327
1328 /** Parse an available query and get the scheduling mode
1329 * at @a index of the scheduling modes array.
1330 * @param index position in the scheduling modes array to read
1331 * @return a Gst::PadMode of the scheduling mode at @a index.
1332 */
1333 Gst::PadMode parse_nth_scheduling_mode(guint index) const;
1334
1335 /** Check if @a query has scheduling mode set.
1336 * @param mode the scheduling mode.
1337 * @return true when @a mode is in the list of scheduling modes.
1338 */
1339 bool has_scheduling_mode(Gst::PadMode mode) const;
1340
1341 /** Check if @a query has scheduling mode set and @a flags is set in
1342 * query scheduling flags.
1343 * @param mode the scheduling mode.
1344 * @param flags Gst::SchedulingFlags.
1345 */
1346 bool has_scheduling_mode_with_flags(Gst::PadMode mode, Gst::SchedulingFlags flags) const;
1347 };
1348
1349 /** A new scheduling query object. See create() for more details.
1350 */
1351 class QueryAllocation : public Query
1352 {
1353 public:
1354 /** Constructs a new query object for querying the allocation properties.
1355 * @param caps the negotiated caps.
1356 * @param need_pool return a pool.
1357 * @return a new Gst::Query.
1358 */
1359 static Glib::RefPtr<Gst::QueryAllocation>
1360 create(const Glib::RefPtr<Gst::Caps>& caps, bool need_pool);
1361
1362 /** Parse an allocation query, writing the requested caps in @a caps and
1363 * whether a pool is needed in @a need_pool, if the respective parameters
1364 * are non-NULL.
1365 * @param caps the Gst::Caps.
1366 * @param need_pool whether a Gst::BufferPool is needed.
1367 */
1368 void parse(Glib::RefPtr<Gst::Caps>& caps, bool& need_pool) const;
1369
1370 /** Retrieve the number of values currently stored in the
1371 * pool array of the query's structure.
1372 * @return the pool array size as a guint.
1373 */
1374 guint get_n_allocation_pools() const;
1375
1376 /** Remove the allocation pool at @a index of the allocation pool array.
1377 * @param index position in the allocation pool array to remove.
1378 */
1379 void remove_nth_allocation_pool(guint index);
1380
1381 /** Add @a allocator and its @a params as a supported memory allocator.
1382 * @param allocator the memory allocator.
1383 * @param params a Gst::AllocationParams.
1384 */
1385 void add_allocation_param(const Glib::RefPtr<Gst::Allocator>& allocator, const Gst::AllocationParams& params);
1386
1387 /** Retrieve the number of values currently stored in the
1388 * allocator params array of the query's structure.
1389 *
1390 * If no memory allocator is specified, the downstream element can handle
1391 * the default memory allocator. The first memory allocator in the query
1392 * should be generic and allow mapping to system memory, all following
1393 * allocators should be ordered by preference with the preferred one first.
1394 * @return the allocator array size as guint.
1395 */
1396 guint get_n_allocation_params() const;
1397
1398 /** Parse an available query and get the alloctor and its params
1399 * at @a index of the allocator array.
1400 * @param index position in the allocator array to read.
1401 * @param allocator variable to hold the result.
1402 * @param params parameters for the allocator.
1403 */
1404 void parse_nth_allocation_param(guint index, Glib::RefPtr<Gst::Allocator>& allocator, Gst::AllocationParams& params) const;
1405
1406 /** Parse an available query and get the alloctor and its params
1407 * at @a index of the allocator array.
1408 * @param index position in the allocator array to set.
1409 * @param allocator new allocator to set.
1410 * @param params parameters for the allocator.
1411 */
1412 void set_nth_allocation_param(guint index, const Glib::RefPtr<Gst::Allocator>& allocator, const Gst::AllocationParams& params);
1413
1414 /** Remove the allocation param at @a index of the allocation param array.
1415 * @param index position in the allocation param array to remove
1416 */
1417 void remove_nth_allocation_param(guint index);
1418
1419 /** Add @a api with @a params as one of the supported metadata API to @a query.
1420 * @param api the metadata API.
1421 * @param params API specific parameters.
1422 */
1423 void add_allocation_meta(GType api, const Gst::Structure& params);
1424
1425 /** Retrieve the number of values currently stored in the
1426 * meta API array of the query's structure.
1427 * @return the metadata API array size as a guint.
1428 */
1429 guint get_n_allocation_metas() const;
1430
1431 /** Parse an available query and get the metadata API
1432 * at @a index of the metadata API array.
1433 * @param index position in the metadata API array to read.
1434 * @param params API specific flags.
1435 */
1436 GType parse_nth_allocation_meta(guint index, Gst::Structure& params) const;
1437
1438 /** Remove the metadata API at @a index of the metadata API array.
1439 * @param index positon in the metadata API array to remove.
1440 */
1441 void remove_nth_allocation_meta(guint index);
1442
1443 /** Check if @a query has metadata @a api set. When this function returns TRUE,
1444 * @a index will contain the index where the requested API and the flags can be
1445 * found.
1446 * @param api the metadata API.
1447 * @param index the index
1448 * @return true when @a api is in the list of metadata.
1449 */
1450 bool find_allocation_meta(GType api, guint& index) const;
1451 };
1452
1453 /** A new uri query object. See create() for more details.
1454 */
1455 class QueryUri : public Query
1456 {
1457 public:
1458 /** Constructs a new query URI query object. Use gst_query_unref()
1459 * when done with it. An URI query is used to query the current URI
1460 * that is used by the source or sink.
1461 * @return a new Gst::Query.
1462 */
1463 static Glib::RefPtr<Gst::QueryUri> create();
1464
1465 /** Parse an URI query, writing the URI into @a uri as a newly
1466 * allocated string, if the respective parameters are non-NULL.
1467 * Free the string with g_free() after usage.
1468 * @return the storage for the current URI.
1469 */
1470 Glib::ustring parse() const;
1471
1472 /** Answer a URI query by setting the requested URI.
1473 * @param uri the URI to set.
1474 */
1475 void set(const Glib::ustring& uri);
1476
1477 /** Answer a URI query by setting the requested URI redirection.
1478 * @param uri the URI to set.
1479 */
1480 void set_uri_redirection(const Glib::ustring& uri);
1481
1482 /** Parse an URI query, return URI, if the respective parameters.
1483 * @return the storage for the redirect URI (may be empty).
1484 */
1485 Glib::ustring parse_uri_redirection() const;
1486 };
1487
1488 /** A new accept caps query object. See create() for more details.
1489 */
1490 class QueryAcceptCaps : public Query
1491 {
1492 public:
1493 /** Constructs a new query object for querying if @a caps are accepted.
1494 * @return a new Gst::Query.
1495 */
1496 static Glib::RefPtr<Gst::QueryAcceptCaps> create(const Glib::RefPtr<Gst::Caps>& caps);
1497
1498 /** Get the caps from @a query. The caps remains valid as long as @a query remains
1499 * valid.
1500 * @return a caps.
1501 */
1502 Glib::RefPtr<Gst::Caps> parse_accept_caps() const;
1503
1504 /** Parse the result from @a query and store in @a result.
1505 * @return location for the result.
1506 */
1507 bool parse_accept_caps_result() const;
1508
1509 /** Set @a result as the result for the @a query.
1510 * @param result the result to set.
1511 */
1512 void set_accept_caps_result(bool result);
1513 };
1514
1515 } //namespace Gst
1516
1517
1518 namespace Glib
1519 {
1520
1521 /** A Glib::wrap() method for this object.
1522 *
1523 * @param object The C instance.
1524 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
1525 * @result A C++ instance that wraps this C instance.
1526 *
1527 * @relates Gst::Query
1528 */
1529 Glib::RefPtr<Gst::Query> wrap(GstQuery* object, bool take_copy = false);
1530
1531 } // namespace Glib
1532
1533
1534 #endif /* _GSTREAMERMM_QUERY_H */
1535