Debian Codegraph @

gstreamer/src/query.ccg

raw
1 /* gstreamermm - a C++ wrapper for gstreamer
2 *
3 * Copyright 2008 The gstreamermm Development Team
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <gst/gst.h>
21 #include <gstreamermm/iterator.h>
22 #include <gstreamermm/pad.h>
23
24 _PINCLUDE(gstreamermm/private/miniobject_p.h)
25 #include <iostream>
26
27 namespace Gst
28 {
29
30 namespace Enums
31 {
32
33 Glib::ustring get_name(QueryType t)
34 {
35 return gst_query_type_get_name(static_cast<GstQueryType>(t));
36 }
37
38 Gst::QueryTypeFlags get_flags(QueryType type)
39 {
40 return static_cast<Gst::QueryTypeFlags>(gst_query_type_get_flags(static_cast<GstQueryType>(type)));
41 }
42
43 Glib::QueryQuark get_quark(QueryType t)
44 {
45 return Glib::QueryQuark(gst_query_type_to_quark(static_cast<GstQueryType>(t)));
46 }
47
48 } //namespace Enums
49
50 Glib::RefPtr<Query> Query::create_writable()
51 {
52 return Glib::RefPtr<Query>::cast_static(MiniObject::create_writable());
53 }
54
55 Glib::RefPtr<Gst::QueryApplication>
56 QueryApplication::create(QueryType type, const Gst::Structure& structure)
57 {
58 // Create copy because query takes ownership of structure:
59 GstStructure* copy_struct = gst_structure_copy(structure.gobj());
60 GstQuery* query = gst_query_new_custom(GstQueryType(type),
61 copy_struct);
62 return Glib::wrap_query_derived<Gst::QueryApplication>(query);
63 }
64
65 Glib::RefPtr<Gst::QueryConvert>
66 QueryConvert::create(Format src_format, gint64 value, Format dest_format)
67 {
68 GstQuery* query = gst_query_new_convert(GstFormat(src_format), value,
69 GstFormat(dest_format));
70 return Glib::wrap_query_derived<Gst::QueryConvert>(query);
71 }
72
73 void QueryConvert::set(Format src_format, gint64 src_value, Format dest_format, gint64 dest_value)
74 {
75 gst_query_set_convert(gobj(), GstFormat(src_format), src_value, GstFormat(dest_format), dest_value);
76 }
77
78 void QueryConvert::parse(Format& src_format, gint64& src_value, Format& dest_format, gint64& dest_value) const
79 {
80 gst_query_parse_convert(const_cast<GstQuery*>(gobj()),
81 reinterpret_cast<GstFormat*>(&src_format), &src_value,
82 reinterpret_cast<GstFormat*>(&dest_format), &dest_value);
83 }
84
85 void QueryConvert::parse(Format& dest_format, gint64& dest_value) const
86 {
87 gst_query_parse_convert(const_cast<GstQuery*>(gobj()), nullptr, nullptr,
88 reinterpret_cast<GstFormat*>(&dest_format), &dest_value);
89 }
90
91 Format QueryConvert::parse_src_format() const
92 {
93 Format src_format = Gst::FORMAT_UNDEFINED;
94 gst_query_parse_convert(const_cast<GstQuery*>(gobj()),
95 reinterpret_cast<GstFormat*>(&src_format), nullptr, nullptr, nullptr);
96 return src_format;
97 }
98
99 gint64 QueryConvert::parse_src_value() const
100 {
101 gint64 src_value = 0;
102 gst_query_parse_convert(const_cast<GstQuery*>(gobj()), nullptr, &src_value,
103 nullptr, nullptr);
104 return src_value;
105 }
106
107 Format QueryConvert::parse_dest_format() const
108 {
109 Format dest_format = Gst::FORMAT_UNDEFINED;
110 gst_query_parse_convert(const_cast<GstQuery*>(gobj()), nullptr, nullptr,
111 reinterpret_cast<GstFormat*>(&dest_format), nullptr);
112 return dest_format;
113 }
114
115 gint64 QueryConvert::parse_dest_value() const
116 {
117 gint64 dest_value = 0;
118 gst_query_parse_convert(const_cast<GstQuery*>(gobj()), nullptr, nullptr, nullptr,
119 &dest_value);
120 return dest_value;
121 }
122
123 Glib::RefPtr<Gst::QueryPosition> QueryPosition::create(Format format)
124 {
125 GstQuery* query = gst_query_new_position(GstFormat(format));
126 return Glib::wrap_query_derived<Gst::QueryPosition>(query);
127 }
128
129 void QueryPosition::set(Format format, gint64 position)
130 {
131 gst_query_set_position(gobj(), GstFormat(format), position);
132 }
133
134 void QueryPosition::parse(Format& format, gint64& position) const
135 {
136 gst_query_parse_position(const_cast<GstQuery*>(gobj()),
137 reinterpret_cast<GstFormat*>(&format), &position);
138 }
139
140 gint64 QueryPosition::parse() const
141 {
142 gint64 position = 0;
143 gst_query_parse_position(const_cast<GstQuery*>(gobj()), nullptr, &position);
144 return position;
145 }
146
147 Format QueryPosition::parse_format() const
148 {
149 Format format = Gst::FORMAT_UNDEFINED;
150 gst_query_parse_position(const_cast<GstQuery*>(gobj()),
151 reinterpret_cast<GstFormat*>(&format), nullptr);
152 return format;
153 }
154
155 Glib::RefPtr<Gst::QueryDuration> QueryDuration::create(Format format)
156 {
157 GstQuery* query = gst_query_new_duration(GstFormat(format));
158 return Glib::wrap_query_derived<Gst::QueryDuration>(query);
159 }
160
161 void QueryDuration::set(Format format, gint64 duration)
162 {
163 gst_query_set_duration(gobj(), GstFormat(format), duration);
164 }
165
166 void QueryDuration::parse(Format& format, gint64& duration) const
167 {
168 gst_query_parse_duration(const_cast<GstQuery*>(gobj()),
169 reinterpret_cast<GstFormat*>(&format), &duration);
170 }
171
172 gint64 QueryDuration::parse() const
173 {
174 gint64 duration = 0;
175 gst_query_parse_duration(const_cast<GstQuery*>(gobj()), nullptr, &duration);
176 return duration;
177 }
178
179 Format QueryDuration::parse_format() const
180 {
181 Format format = Gst::FORMAT_UNDEFINED;
182 gst_query_parse_duration(const_cast<GstQuery*>(gobj()),
183 reinterpret_cast<GstFormat*>(&format), 0);
184 return format;
185 }
186
187 Glib::RefPtr<Gst::QueryLatency> QueryLatency::create()
188 {
189 GstQuery* query = gst_query_new_latency();
190 return Glib::wrap_query_derived<Gst::QueryLatency>(query);
191 }
192
193 void QueryLatency::set(bool live, ClockTime min_latency, ClockTime max_latency)
194 {
195 gst_query_set_latency(gobj(), live, GstClockTime(min_latency), GstClockTime(max_latency));
196 }
197
198 void QueryLatency::parse(bool& live, ClockTime& min_latency, ClockTime& max_latency) const
199 {
200 gboolean glive = FALSE;
201 gst_query_parse_latency(const_cast<GstQuery*>(gobj()), &glive,
202 reinterpret_cast<ClockTime*>(&min_latency),
203 reinterpret_cast<ClockTime*>(&max_latency));
204 live = glive;
205 }
206
207 bool QueryLatency::parse_live() const
208 {
209 gboolean glive = FALSE;
210 gst_query_parse_latency(const_cast<GstQuery*>(gobj()), &glive, nullptr, nullptr);
211 return glive;
212 }
213
214 ClockTime QueryLatency::parse_min() const
215 {
216 ClockTime min = 0;
217 gst_query_parse_latency(const_cast<GstQuery*>(gobj()), nullptr,
218 reinterpret_cast<ClockTime*>(&min), nullptr);
219 return min;
220 }
221
222 ClockTime QueryLatency::parse_max() const
223 {
224 ClockTime max = 0;
225 gst_query_parse_latency(const_cast<GstQuery*>(gobj()), nullptr, nullptr,
226 reinterpret_cast<ClockTime*>(&max));
227 return max;
228 }
229
230 Glib::RefPtr<Gst::QuerySeeking> QuerySeeking::create(Format format)
231 {
232 GstQuery* query = gst_query_new_seeking(GstFormat(format));
233 return Glib::wrap_query_derived<Gst::QuerySeeking>(query);
234 }
235
236 void QuerySeeking::set(Format format, bool seekable, gint64 segment_start, gint64 segment_end)
237 {
238 gst_query_set_seeking(gobj(), GstFormat(format), seekable, segment_start, segment_end);
239 }
240
241 void QuerySeeking::parse(Format& format, bool& seekable, gint64& segment_start, gint64& segment_end) const
242 {
243 gboolean gseekable = FALSE;
244 gst_query_parse_seeking(const_cast<GstQuery*>(gobj()),
245 reinterpret_cast<GstFormat*>(&format), &gseekable, &segment_start,
246 &segment_end);
247 seekable = gseekable;
248 }
249
250 Format QuerySeeking::parse_format() const
251 {
252 Format format = Gst::FORMAT_UNDEFINED;
253 gst_query_parse_seeking(const_cast<GstQuery*>(gobj()),
254 reinterpret_cast<GstFormat*>(&format), nullptr, nullptr, nullptr);
255 return format;
256 }
257
258 bool QuerySeeking::parse_seekable() const
259 {
260 gboolean gseekable = FALSE;
261 gst_query_parse_seeking(const_cast<GstQuery*>(gobj()), nullptr,
262 &gseekable, nullptr, nullptr);
263 return gseekable;
264 }
265
266 gint64 QuerySeeking::parse_start() const
267 {
268 gint64 start = 0;
269 gst_query_parse_seeking(const_cast<GstQuery*>(gobj()), nullptr, nullptr,
270 &start, nullptr);
271 return start;
272 }
273
274 gint64 QuerySeeking::parse_end() const
275 {
276 gint64 end = 0;
277 gst_query_parse_seeking(const_cast<GstQuery*>(gobj()), nullptr, nullptr, nullptr,
278 &end);
279 return end;
280 }
281
282 Glib::RefPtr<Gst::QueryFormats> QueryFormats::create()
283 {
284 GstQuery* query = gst_query_new_formats();
285 return Glib::wrap_query_derived<Gst::QueryFormats>(query);
286 }
287
288 void QueryFormats::set(const Glib::ArrayHandle<Format>& formats)
289 {
290 gst_query_set_formatsv(gobj(), formats.size(),
291 reinterpret_cast<GstFormat*>(const_cast<Gst::Format*>(formats.data())));
292 }
293
294 void QueryFormats::set(int n_formats, const Glib::ArrayHandle<Format>& formats)
295 {
296 gst_query_set_formatsv(gobj(), n_formats,
297 reinterpret_cast<GstFormat*>(const_cast<Gst::Format*>(formats.data())));
298 }
299
300 guint QueryFormats::parse_length() const
301 {
302 guint n_formats = 0;
303 gst_query_parse_n_formats(const_cast<GstQuery*>(gobj()), &n_formats);
304 return n_formats;
305 }
306
307 Format QueryFormats::parse(guint nth) const
308 {
309 Format format = Gst::FORMAT_UNDEFINED;
310 gst_query_parse_nth_format(const_cast<GstQuery*>(gobj()), nth,
311 reinterpret_cast<GstFormat*>(&format));
312 return format;
313 }
314
315 Glib::RefPtr<Gst::QuerySegment> QuerySegment::create(Format format)
316 {
317 GstQuery* query = gst_query_new_segment(GstFormat(format));
318 return Glib::wrap_query_derived<Gst::QuerySegment>(query);
319 }
320
321 void QuerySegment::set(double rate, Format format, gint64 start_value, gint64 stop_value)
322 {
323 gst_query_set_segment(gobj(), rate, static_cast<GstFormat>(format),
324 start_value, stop_value);
325 }
326
327 void QuerySegment::parse(double& rate, Format& format, gint64& start_value, gint64& stop_value) const
328 {
329 gst_query_parse_segment(const_cast<GstQuery*>(gobj()), &rate,
330 reinterpret_cast<GstFormat*>(&format), &start_value, &stop_value);
331 }
332
333 double QuerySegment::parse_rate() const
334 {
335 double rate = 0;
336 gst_query_parse_segment(const_cast<GstQuery*>(gobj()), &rate, nullptr,
337 nullptr, nullptr);
338 return rate;
339 }
340
341 Format QuerySegment::parse_format() const
342 {
343 Format format = Gst::FORMAT_UNDEFINED;
344 gst_query_parse_segment(const_cast<GstQuery*>(gobj()), nullptr,
345 reinterpret_cast<GstFormat*>(&format), nullptr, nullptr);
346 return format;
347 }
348
349 gint64 QuerySegment::parse_start() const
350 {
351 gint64 start = 0;
352 gst_query_parse_segment(const_cast<GstQuery*>(gobj()), nullptr, nullptr,
353 &start, nullptr);
354 return start;
355 }
356
357 gint64 QuerySegment::parse_stop() const
358 {
359 gint64 stop = 0;
360 gst_query_parse_segment(const_cast<GstQuery*>(gobj()), nullptr, nullptr,
361 nullptr, &stop);
362 return stop;
363 }
364
365 Glib::RefPtr<Gst::QueryBuffering> QueryBuffering::create(Format format)
366 {
367 GstQuery* query = gst_query_new_buffering(GstFormat(format));
368 return Glib::wrap_query_derived<Gst::QueryBuffering>(query);
369 }
370
371 void QueryBuffering::set(bool busy, int percent)
372 {
373 gst_query_set_buffering_percent(gobj(), busy, percent);
374 }
375
376 void QueryBuffering::parse(bool& busy, int& percent) const
377 {
378 gboolean gbusy = FALSE;
379 gst_query_parse_buffering_percent(const_cast<GstQuery*>(gobj()), &gbusy,
380 &percent);
381 busy = gbusy;
382 }
383
384 bool QueryBuffering::parse_busy() const
385 {
386 gboolean gbusy = FALSE;
387 gst_query_parse_buffering_percent(const_cast<GstQuery*>(gobj()), &gbusy,
388 0);
389 return gbusy;
390 }
391
392 int QueryBuffering::parse_percent() const
393 {
394 int percent = 0;
395 gst_query_parse_buffering_percent(const_cast<GstQuery*>(gobj()), nullptr,
396 &percent);
397 return percent;
398 }
399
400 void QueryBuffering::set(BufferingMode mode, int avg_in, int avg_out, gint64 buffering_left)
401 {
402 gst_query_set_buffering_stats(gobj(), static_cast<GstBufferingMode>(mode),
403 avg_in, avg_out, buffering_left);
404 }
405
406 void QueryBuffering::parse(BufferingMode& mode, int& avg_in, int& avg_out, gint64 buffering_left) const
407 {
408 gst_query_parse_buffering_stats(const_cast<GstQuery*>(gobj()),
409 reinterpret_cast<GstBufferingMode*>(&mode), &avg_in, &avg_out,
410 &buffering_left);
411 }
412
413 BufferingMode QueryBuffering::parse_mode() const
414 {
415 BufferingMode mode = Gst::BUFFERING_STREAM;
416 gst_query_parse_buffering_stats(const_cast<GstQuery*>(gobj()),
417 reinterpret_cast<GstBufferingMode*>(&mode), nullptr, nullptr, nullptr);
418 return mode;
419 }
420
421 int QueryBuffering::parse_input_rate() const
422 {
423 int avg_in = 0;
424 gst_query_parse_buffering_stats(const_cast<GstQuery*>(gobj()), nullptr,
425 &avg_in, nullptr, nullptr);
426 return avg_in;
427 }
428
429 int QueryBuffering::parse_output_rate() const
430 {
431 int avg_out = 0;
432 gst_query_parse_buffering_stats(const_cast<GstQuery*>(gobj()), nullptr, nullptr,
433 &avg_out, nullptr);
434 return avg_out;
435 }
436
437 gint64 QueryBuffering::parse_time_left() const
438 {
439 gint64 buffering_left = Gst::BUFFERING_STREAM;
440 gst_query_parse_buffering_stats(const_cast<GstQuery*>(gobj()), nullptr,
441 nullptr, nullptr, &buffering_left);
442 return buffering_left;
443 }
444
445 void QueryBuffering::set(Format format, gint64 start, gint64 stop, gint64 estimated_total)
446 {
447 gst_query_set_buffering_range(gobj(), static_cast<GstFormat>(format),
448 start, stop, estimated_total);
449 }
450
451 void QueryBuffering::parse(Format& format, gint64& start, gint64& stop, gint64& estimated_total) const
452 {
453 gst_query_parse_buffering_range(const_cast<GstQuery*>(gobj()),
454 reinterpret_cast<GstFormat*>(&format), &start, &stop, &estimated_total);
455 }
456
457 Format QueryBuffering::parse_format() const
458 {
459 Format format = Gst::FORMAT_UNDEFINED;
460 gst_query_parse_buffering_range(const_cast<GstQuery*>(gobj()),
461 reinterpret_cast<GstFormat*>(&format), nullptr, nullptr, nullptr);
462 return format;
463 }
464
465 gint64 QueryBuffering::parse_start() const
466 {
467 gint64 start = 0;
468 gst_query_parse_buffering_range(const_cast<GstQuery*>(gobj()), nullptr,
469 &start, nullptr, nullptr);
470 return start;
471 }
472
473 gint64 QueryBuffering::parse_stop() const
474 {
475 gint64 stop = 0;
476 gst_query_parse_buffering_range(const_cast<GstQuery*>(gobj()), nullptr,
477 nullptr, &stop, nullptr);
478 return stop;
479 }
480
481 gint64 QueryBuffering::parse_total_time() const
482 {
483 gint64 estimated_total = 0;
484 gst_query_parse_buffering_range(const_cast<GstQuery*>(gobj()), nullptr,
485 nullptr, nullptr, &estimated_total);
486 return estimated_total;
487 }
488
489 Glib::RefPtr<Gst::QueryCaps> QueryCaps::create(const Glib::RefPtr<Gst::Caps>& filter)
490 {
491 GstQuery* query = gst_query_new_caps(filter->gobj());
492 return Glib::wrap_query_derived<Gst::QueryCaps>(query);
493 }
494
495 Glib::RefPtr<Gst::Caps> QueryCaps::parse() const
496 {
497 GstCaps* caps;
498 gst_query_parse_caps(const_cast<GstQuery*>(gobj()), &caps);
499 return Glib::wrap(caps, true);
500 }
501
502 Glib::RefPtr<Gst::Caps> QueryCaps::parse_caps_result() const
503 {
504 GstCaps* caps;
505 gst_query_parse_caps_result(const_cast<GstQuery*>(gobj()), &caps);
506 return Glib::wrap(caps, false);
507 }
508
509 void QueryCaps::set_caps_result(const Glib::RefPtr<Gst::Caps>& caps)
510 {
511 gst_query_set_caps_result(gobj(), caps->gobj());
512 }
513
514 Glib::RefPtr<QueryScheduling> QueryScheduling::create()
515 {
516 GstQuery* query = gst_query_new_scheduling();
517 return Glib::wrap_query_derived<QueryScheduling>(query);
518 }
519
520 void QueryScheduling::parse(SchedulingFlags& flags, gint& minsize, gint& maxsize, gint& align) const
521 {
522 GstSchedulingFlags gst_flags;
523 gst_query_parse_scheduling(const_cast<GstQuery*>(gobj()), &gst_flags, &minsize, &maxsize, &align);
524 flags = SchedulingFlags(gst_flags);
525 }
526
527 void QueryScheduling::set(SchedulingFlags flags, gint minsize, gint maxsize, gint align)
528 {
529 gst_query_set_scheduling(gobj(), GstSchedulingFlags(flags), minsize, maxsize, align);
530 }
531
532 void QueryScheduling::add_scheduling_mode(PadMode mode)
533 {
534 gst_query_add_scheduling_mode(gobj(), GstPadMode(mode));
535 }
536
537 guint QueryScheduling::get_n_scheduling_modes() const
538 {
539 return gst_query_get_n_scheduling_modes(const_cast<GstQuery*>(gobj()));
540 }
541
542 PadMode QueryScheduling::parse_nth_scheduling_mode(guint index) const
543 {
544 return PadMode(gst_query_parse_nth_scheduling_mode(const_cast<GstQuery*>(gobj()), index));
545 }
546
547 bool QueryScheduling::has_scheduling_mode(PadMode mode) const
548 {
549 return PadMode(gst_query_has_scheduling_mode(const_cast<GstQuery*>(gobj()), GstPadMode(mode)));
550 }
551
552 bool QueryScheduling::has_scheduling_mode_with_flags(PadMode mode, SchedulingFlags flags) const
553 {
554 return PadMode(gst_query_has_scheduling_mode_with_flags(const_cast<GstQuery*>(gobj()), GstPadMode(mode), GstSchedulingFlags(flags)));
555 }
556
557 Glib::RefPtr<QueryAllocation> QueryAllocation::create(const Glib::RefPtr<Gst::Caps>& caps, bool need_pool)
558 {
559 GstQuery* query = gst_query_new_allocation(caps->gobj(), need_pool);
560 return Glib::wrap_query_derived<QueryAllocation>(query);
561 }
562
563 void QueryAllocation::parse(Glib::RefPtr<Caps>& caps, bool& need_pool) const
564 {
565 GstCaps* n_caps;
566 gboolean gst_need_pool;
567 gst_query_parse_allocation(const_cast<GstQuery*>(gobj()), &n_caps, &gst_need_pool);
568 caps = Glib::wrap(n_caps, false);
569 need_pool = gst_need_pool;
570 }
571
572 guint QueryAllocation::get_n_allocation_pools() const
573 {
574 return gst_query_get_n_allocation_pools(const_cast<GstQuery*>(gobj()));
575 }
576
577 void QueryAllocation::remove_nth_allocation_pool(guint index)
578 {
579 gst_query_remove_nth_allocation_pool(gobj(), index);
580 }
581
582 void QueryAllocation::add_allocation_param(const Glib::RefPtr<Allocator>& allocator, const AllocationParams& params)
583 {
584 gst_query_add_allocation_param(gobj(), allocator->gobj(), params.gobj());
585 }
586
587 guint QueryAllocation::get_n_allocation_params() const
588 {
589 return gst_query_get_n_allocation_params(const_cast<GstQuery*>(gobj()));
590 }
591
592 void QueryAllocation::parse_nth_allocation_param(guint index, Glib::RefPtr<Allocator>& allocator, AllocationParams& params) const
593 {
594 GstAllocator* n_allocator;
595 gst_query_parse_nth_allocation_param(const_cast<GstQuery*>(gobj()), index, &n_allocator, params.gobj());
596 allocator = Glib::wrap(n_allocator, false);
597 }
598
599 void QueryAllocation::set_nth_allocation_param(guint index, const Glib::RefPtr<Allocator>& allocator, const AllocationParams& params)
600 {
601 gst_query_set_nth_allocation_param(gobj(), index, allocator->gobj(), params.gobj());
602 }
603
604 void QueryAllocation::remove_nth_allocation_param(guint index)
605 {
606 gst_query_remove_nth_allocation_param(gobj(), index);
607 }
608
609 void QueryAllocation::add_allocation_meta(GType api, const Structure& params)
610 {
611 gst_query_add_allocation_meta(gobj(), api, params.gobj());
612 }
613
614 guint QueryAllocation::get_n_allocation_metas() const
615 {
616 return gst_query_get_n_allocation_metas(const_cast<GstQuery*>(gobj()));
617 }
618
619 GType QueryAllocation::parse_nth_allocation_meta(guint index, Structure& params) const
620 {
621 GstStructure *gst_params;
622 GType ret = gst_query_parse_nth_allocation_meta(const_cast<GstQuery*>(gobj()), index, (const GstStructure**)&gst_params);
623 params = Glib::wrap(gst_params, true);
624 return ret;
625 }
626
627 void QueryAllocation::remove_nth_allocation_meta(guint index)
628 {
629 gst_query_remove_nth_allocation_meta(gobj(), index);
630 }
631
632 bool QueryAllocation::find_allocation_meta(GType api, guint& index) const
633 {
634 return gst_query_find_allocation_meta(const_cast<GstQuery*>(gobj()), api, &index);
635 }
636
637 Glib::RefPtr<QueryUri> QueryUri::create()
638 {
639 GstQuery* query = gst_query_new_uri();
640 return Glib::wrap_query_derived<QueryUri>(query);
641 }
642
643 Glib::ustring QueryUri::parse() const
644 {
645 gchar* gst_uri;
646 Glib::ustring uri;
647 gst_query_parse_uri(const_cast<GstQuery*>(gobj()), &gst_uri);
648 if (gst_uri != nullptr)
649 {
650 uri = gst_uri;
651 g_free(gst_uri);
652 }
653
654 return uri;
655 }
656
657 void QueryUri::set(const Glib::ustring& uri)
658 {
659 gst_query_set_uri(gobj(), uri.c_str());
660 }
661
662 void QueryUri::set_uri_redirection(const Glib::ustring& uri)
663 {
664 gst_query_set_uri_redirection(gobj(), uri.c_str());
665 }
666
667 Glib::ustring QueryUri::parse_uri_redirection() const
668 {
669 gchar* c_uri;
670 Glib::ustring uri;
671 gst_query_parse_uri_redirection(const_cast<GstQuery*>(gobj()), &c_uri);
672
673 if (c_uri != nullptr)
674 {
675 uri = c_uri;
676 g_free(c_uri);
677 }
678
679 return uri;
680 }
681
682 Glib::RefPtr<QueryAcceptCaps> QueryAcceptCaps::create(const Glib::RefPtr<Gst::Caps>& caps)
683 {
684 GstQuery* query = gst_query_new_accept_caps(caps->gobj());
685 return Glib::wrap_query_derived<QueryAcceptCaps>(query);
686 }
687
688
689 Glib::RefPtr<Gst::Caps> QueryAcceptCaps::parse_accept_caps() const
690 {
691 GstCaps *c_caps;
692 gst_query_parse_accept_caps(const_cast<GstQuery*>(gobj()), &c_caps);
693 return Glib::wrap(c_caps, false);
694 }
695
696 bool QueryAcceptCaps::parse_accept_caps_result() const
697 {
698 gboolean c_result;
699 gst_query_parse_accept_caps_result(const_cast<GstQuery*>(gobj()), &c_result);
700 return bool(c_result);
701 }
702
703 void QueryAcceptCaps::set_accept_caps_result(bool result)
704 {
705 gst_query_set_accept_caps_result(gobj(), result);
706 }
707 } //namesapce Gst