Debian Codegraph @

gstreamer/gstreamermm/message.cc

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gstreamermm/message.h>
7 #include <gstreamermm/private/message_p.h>
8
9
10 /* gstreamermm - a C++ wrapper for gstreamer
11 *
12 * Copyright 2008-2016 The gstreamermm Development Team
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29 #include <gst/gst.h>
30 #include <gstreamermm/element.h>
31 #include <gstreamermm/pad.h>
32 #include <gstreamermm/structure.h>
33 #include <gstreamermm/taglist.h>
34
35 #include <iostream>
36
37 namespace Gst
38 {
39
40 namespace Enums
41 {
42
43 Glib::ustring get_name(MessageType t)
44 {
45 return gst_message_type_get_name(static_cast<GstMessageType>(t));
46 }
47
48 Glib::QueryQuark get_quark(MessageType t)
49 {
50 return Glib::QueryQuark(gst_message_type_to_quark(static_cast<GstMessageType>(t)));
51 }
52
53 } //namespace Enums
54
55 Glib::RefPtr<Gst::Message> Message::create_writable()
56 {
57 return Glib::RefPtr<Message>::cast_static(MiniObject::create_writable());
58 }
59
60 void MessageError::parse(Glib::Error& error, std::string& debug) const
61 {
62 GError* c_error = nullptr;
63 gchar* c_debug = nullptr;
64 gst_message_parse_error(const_cast<GstMessage*>(gobj()), &c_error, &c_debug);
65
66 debug = c_debug;
67 if(c_debug)
68 g_free(c_debug);
69
70 error = Glib::Error(c_error);
71 }
72
73 Glib::Error MessageError::parse_error() const
74 {
75 GError* c_error = nullptr;
76 gst_message_parse_error(const_cast<GstMessage*>(gobj()), &c_error, nullptr);
77
78 return Glib::Error(c_error);
79 }
80
81 std::string MessageError::parse_debug() const
82 {
83 gchar* c_debug = nullptr;
84 GError* c_error = nullptr;
85
86 gst_message_parse_error(const_cast<GstMessage*>(gobj()), &c_error, &c_debug);
87
88 std::string result = c_debug;
89
90 if(c_debug)
91 g_free(c_debug);
92
93 if(c_error)
94 g_error_free(c_error);
95
96 return result;
97 }
98
99 void MessageWarning::parse(Glib::Error& error, std::string& debug) const
100 {
101 GError* c_error = nullptr;
102 gchar* c_debug = nullptr;
103 gst_message_parse_warning(const_cast<GstMessage*>(gobj()), &c_error, &c_debug);
104
105 debug = c_debug;
106 if(c_debug)
107 g_free(c_debug);
108
109 error = Glib::Error(c_error);
110 }
111
112 Glib::Error MessageWarning::parse_error() const
113 {
114 GError* c_error = nullptr;
115 gst_message_parse_warning(const_cast<GstMessage*>(gobj()), &c_error, nullptr);
116
117 return Glib::Error(c_error);
118 }
119
120 std::string MessageWarning::parse_debug() const
121 {
122 gchar* c_debug = nullptr;
123 GError* c_error = nullptr;
124
125 gst_message_parse_warning(const_cast<GstMessage*>(gobj()), &c_error,
126 &c_debug);
127
128 std::string result = c_debug;
129
130 if(c_debug)
131 g_free(c_debug);
132
133 if(c_error)
134 g_error_free(c_error);
135
136 return result;
137 }
138
139 void MessageInfo::parse(Glib::Error& error, std::string& debug) const
140 {
141 GError* c_error = nullptr;
142 gchar* c_debug = nullptr;
143 gst_message_parse_info(const_cast<GstMessage*>(gobj()), &c_error, &c_debug);
144
145 debug = c_debug;
146 if(c_debug)
147 g_free(c_debug);
148
149 error = Glib::Error(c_error);
150 }
151
152 Glib::Error MessageInfo::parse_error() const
153 {
154 GError* c_error = nullptr;
155 gst_message_parse_info(const_cast<GstMessage*>(gobj()), &c_error, nullptr);
156
157 return Glib::Error(c_error);
158 }
159
160 std::string MessageInfo::parse_debug() const
161 {
162 gchar* c_debug = nullptr;
163 GError* c_error = nullptr;
164
165 gst_message_parse_info(const_cast<GstMessage*>(gobj()), &c_error, &c_debug);
166
167 std::string result = c_debug;
168
169 if(c_debug)
170 g_free(c_debug);
171
172 if(c_error)
173 g_error_free(c_error);
174
175 return result;
176 }
177
178 Gst::TagList MessageTag::parse_tag_list() const
179 {
180 GstTagList* gst_tag_list = nullptr;
181 gst_message_parse_tag(const_cast<GstMessage*>(gobj()), &gst_tag_list);
182 return Gst::TagList(gst_tag_list);
183 }
184
185 int MessageBuffering::parse_buffering() const
186 {
187 int percent = 0;
188 gst_message_parse_buffering(const_cast<GstMessage*>(gobj()), &percent);
189 return percent;
190 }
191
192 void MessageBuffering::set_stats(BufferingMode mode, int avg_in, int avg_out,
193 gint64 buffering_left)
194 {
195 gst_message_set_buffering_stats(gobj(), static_cast<GstBufferingMode>(mode),
196 avg_in, avg_out, buffering_left);
197 }
198
199 void MessageBuffering::parse_stats(BufferingMode& mode, int& avg_in,
200 int& avg_out, gint64& buffering_left) const
201 {
202 gst_message_parse_buffering_stats(const_cast<GstMessage*>(gobj()),
203 reinterpret_cast<GstBufferingMode*>(&mode), &avg_in, &avg_out,
204 &buffering_left);
205 }
206
207 BufferingMode MessageBuffering::parse_stats_buffering_mode() const
208 {
209 GstBufferingMode mode = GST_BUFFERING_STREAM;
210
211 gst_message_parse_buffering_stats(const_cast<GstMessage*>(gobj()), &mode,
212 nullptr, nullptr, nullptr);
213 return static_cast<BufferingMode>(mode);
214 }
215
216 int MessageBuffering::parse_stats_avg_in() const
217 {
218 int avg_in = 0;
219
220 gst_message_parse_buffering_stats(const_cast<GstMessage*>(gobj()), nullptr,
221 &avg_in, nullptr, nullptr);
222 return avg_in;
223 }
224
225 int MessageBuffering::parse_stats_avg_out() const
226 {
227 int avg_out = 0;
228
229 gst_message_parse_buffering_stats(const_cast<GstMessage*>(gobj()), nullptr,
230 nullptr, &avg_out, nullptr);
231 return avg_out;
232 }
233
234 gint64 MessageBuffering::parse_stats_buffering_left() const
235 {
236 gint64 buffering_left = 0;
237
238 gst_message_parse_buffering_stats(const_cast<GstMessage*>(gobj()), nullptr,
239 nullptr, nullptr, &buffering_left);
240 return buffering_left;
241 }
242
243 void MessageStateChanged::parse(State& oldstate, State& newstate,
244 State& pending) const
245 {
246 gst_message_parse_state_changed(const_cast<GstMessage*>(gobj()),
247 reinterpret_cast<GstState*>(&oldstate),
248 reinterpret_cast<GstState*>(&newstate),
249 reinterpret_cast<GstState*>(&pending));
250 }
251
252 State MessageStateChanged::parse_new_state() const
253 {
254 GstState new_state = GST_STATE_NULL;
255
256 gst_message_parse_state_changed(const_cast<GstMessage*>(gobj()), nullptr,
257 &new_state, nullptr);
258 return State(new_state);
259 }
260
261 State MessageStateChanged::parse_old_state() const
262 {
263 GstState old_state = GST_STATE_NULL;
264
265 gst_message_parse_state_changed(const_cast<GstMessage*>(gobj()), &old_state,
266 nullptr, nullptr);
267 return State(old_state);
268 }
269
270 State MessageStateChanged::parse_pending_state() const
271 {
272 GstState pending_state = GST_STATE_NULL;
273 gst_message_parse_state_changed(const_cast<GstMessage*>(gobj()), nullptr,
274 nullptr, &pending_state);
275 return State(pending_state);
276 }
277
278 void MessageStepDone::parse(Gst::Format& format, guint64& amount, double& rate,
279 bool& flush, bool& intermediate, guint64& duration, bool& eos) const
280 {
281 gboolean gst_flush = FALSE;
282 gboolean gst_intermediate = FALSE;
283 gboolean gst_eos = FALSE;
284
285 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()),
286 reinterpret_cast<GstFormat*>(&format), &amount, &rate, &gst_flush,
287 &gst_intermediate, &duration, &gst_eos);
288
289 flush = gst_flush;
290 intermediate = gst_intermediate;
291 eos = gst_eos;
292 }
293
294 guint64 MessageStepDone::parse_duration() const
295 {
296 guint64 duration = 0;
297 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, nullptr, nullptr,
298 &duration, nullptr);
299 return duration;
300 }
301
302 Gst::Format MessageStepDone::parse_format() const
303 {
304 GstFormat format = GST_FORMAT_UNDEFINED;
305 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()),
306 reinterpret_cast<GstFormat*>(&format), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr);
307 return static_cast<Gst::Format>(format);
308 }
309
310 guint64 MessageStepDone::parse_amount() const
311 {
312 guint64 amount = 0;
313 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, &amount, nullptr,
314 nullptr, nullptr, nullptr, nullptr);
315 return amount;
316 }
317
318 double MessageStepDone::parse_rate() const
319 {
320 double rate = 0;
321 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, nullptr, &rate, nullptr,
322 nullptr, nullptr, nullptr);
323 return rate;
324 }
325
326 bool MessageStepDone::parse_flush() const
327 {
328 gboolean gst_flush = FALSE;
329 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr,
330 &gst_flush, nullptr, nullptr, nullptr);
331 return gst_flush;
332 }
333
334 bool MessageStepDone::parse_intermediate() const
335 {
336 gboolean gst_intermediate = FALSE;
337 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, nullptr,
338 &gst_intermediate, nullptr, nullptr);
339 return gst_intermediate;
340 }
341
342 bool MessageStepDone::parse_eos() const
343 {
344 gboolean gst_eos = FALSE;
345 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, nullptr, nullptr,
346 nullptr, &gst_eos);
347 return gst_eos;
348 }
349
350 void MessageClockProvide::parse(Glib::RefPtr<Gst::Clock>& clock, bool& ready) const
351 {
352 GstClock* cclock = nullptr;
353 gboolean ready_ = false;
354 gst_message_parse_clock_provide(const_cast<GstMessage*>(gobj()), &cclock,
355 &ready_);
356 clock = Glib::wrap(cclock);
357 ready = ready_;
358 }
359
360 Glib::RefPtr<Gst::Clock> MessageClockProvide::parse_clock_provide()
361 {
362 GstClock* cclock = nullptr;
363 gst_message_parse_clock_provide(gobj(), &cclock, nullptr);
364 return Glib::wrap(cclock);
365 }
366
367 Glib::RefPtr<const Gst::Clock> MessageClockProvide::parse_clock_provide() const
368 {
369 return parse_clock_provide();
370 }
371
372 bool MessageClockProvide::parse_ready() const
373 {
374 gboolean ready = FALSE;
375 gst_message_parse_clock_provide(const_cast<GstMessage*>(gobj()), nullptr,
376 &ready);
377 return ready;
378 }
379
380 Glib::RefPtr<Gst::Clock> MessageClockLost::parse_clock_lost()
381 {
382 GstClock* cclock = nullptr;
383 gst_message_parse_clock_lost(gobj(), &cclock);
384 return Glib::wrap(cclock, false);
385 }
386
387 Glib::RefPtr<const Gst::Clock> MessageClockLost::parse_clock_lost() const
388 {
389 return parse_clock_lost();
390 }
391
392 Glib::RefPtr<Gst::Clock> MessageNewClock::parse_new_clock()
393 {
394 GstClock* cclock = nullptr;
395 gst_message_parse_new_clock(gobj(), &cclock);
396 return Glib::wrap(cclock, false);
397 }
398
399 Glib::RefPtr<const Gst::Clock> MessageNewClock::parse_new_clock() const
400 {
401 return parse_new_clock();
402 }
403
404 Glib::RefPtr<Gst::MessageApplication> MessageApplication::create(const Glib::RefPtr<Gst::Object>& src, const Gst::Structure& structure)
405 {
406 return Gst::wrap_msg_derived<MessageApplication>(gst_message_new_application(Glib::unwrap(src), structure.gobj_copy()), false);
407 }
408
409 Glib::RefPtr<Gst::MessageElement> MessageElement::create(const Glib::RefPtr<Gst::Object>& src, const Gst::Structure& structure)
410 {
411 return Gst::wrap_msg_derived<MessageElement>(gst_message_new_element(Glib::unwrap(src), structure.gobj_copy()), false);
412 }
413
414 void MessageSegmentStart::parse(Format& format, gint64& position) const
415 {
416 gst_message_parse_segment_start(const_cast<GstMessage*>(gobj()),
417 reinterpret_cast<GstFormat*>(&format), &position);
418 }
419
420 gint64 MessageSegmentStart::parse_position() const
421 {
422 gint64 position = 0;
423 gst_message_parse_segment_start(const_cast<GstMessage*>(gobj()), nullptr,
424 &position);
425 return position;
426 }
427
428 Format MessageSegmentStart::parse_format() const
429 {
430 Format format = Gst::FORMAT_DEFAULT;
431 gst_message_parse_segment_start(const_cast<GstMessage*>(gobj()),
432 reinterpret_cast<GstFormat*>(&format), nullptr);
433 return format;
434 }
435
436 void MessageSegmentDone::parse(Format& format, gint64& position) const
437 {
438 gst_message_parse_segment_done(const_cast<GstMessage*>(gobj()),
439 reinterpret_cast<GstFormat*>(&format), &position);
440 }
441
442 gint64 MessageSegmentDone::parse_position() const
443 {
444 gint64 position = 0;
445 gst_message_parse_segment_done(const_cast<GstMessage*>(gobj()), nullptr,
446 &position);
447 return position;
448 }
449
450 Format MessageSegmentDone::parse_format() const
451 {
452 Format format = Gst::FORMAT_UNDEFINED;
453 gst_message_parse_segment_done(const_cast<GstMessage*>(gobj()),
454 reinterpret_cast<GstFormat*>(&format), nullptr);
455 return format;
456 }
457
458 Gst::ClockTime MessageAsyncDone::parse_running_time() const
459 {
460 GstClockTime running_time;
461 gst_message_parse_async_done(const_cast<GstMessage*>(gobj()), &running_time);
462 return static_cast<Gst::ClockTime>(running_time);
463 }
464
465 void MessageStepStart::parse(bool& active, Gst::Format& format,
466 guint64& amount, double& rate, bool& flush, bool& intermediate) const
467 {
468 gboolean gst_active = FALSE;
469 gboolean gst_flush = FALSE;
470 gboolean gst_intermediate = FALSE;
471
472 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), &gst_active,
473 reinterpret_cast<GstFormat*>(&format), &amount, &rate, &gst_flush,
474 &gst_intermediate);
475
476 active = gst_active;
477 flush = gst_flush;
478 intermediate = gst_intermediate;
479 }
480
481 guint64 MessageStepStart::parse_amount() const
482 {
483 guint64 amount = 0;
484 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), nullptr, nullptr, &amount,
485 nullptr, nullptr, nullptr);
486 return amount;
487 }
488
489 bool MessageStepStart::parse_active() const
490 {
491 gboolean gst_active = FALSE;
492 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), &gst_active, nullptr,
493 nullptr, nullptr, nullptr, nullptr);
494 return gst_active;
495 }
496
497 Gst::Format MessageStepStart::parse_format() const
498 {
499 GstFormat format = GST_FORMAT_UNDEFINED;
500 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), nullptr,
501 reinterpret_cast<GstFormat*>(&format), nullptr, nullptr, nullptr, nullptr);
502 return static_cast<Gst::Format>(format);
503 }
504
505 double MessageStepStart::parse_rate() const
506 {
507 double rate = 0;
508 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, &rate,
509 nullptr, nullptr);
510 return rate;
511 }
512
513 bool MessageStepStart::parse_flush() const
514 {
515 gboolean gst_flush = FALSE;
516 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, nullptr,
517 &gst_flush, nullptr);
518 return gst_flush;
519 }
520
521 bool MessageStepStart::parse_intermediate() const
522 {
523 gboolean gst_intermediate = FALSE;
524 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, nullptr, nullptr,
525 &gst_intermediate);
526 return gst_intermediate;
527 }
528
529 void MessageStructureChange::parse(Gst::StructureChangeType& type,
530 Glib::RefPtr<Gst::Element>& owner, bool& busy) const
531 {
532 GstElement* gst_element = nullptr;
533 gboolean gst_busy = false;
534 gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()),
535 reinterpret_cast<GstStructureChangeType*>(&type), &gst_element, &gst_busy);
536 owner = Glib::wrap(gst_element, true);
537 busy = gst_busy;
538 }
539
540 Gst::StructureChangeType MessageStructureChange::parse_type() const
541 {
542 GstStructureChangeType gst_type = GST_STRUCTURE_CHANGE_TYPE_PAD_LINK;
543 gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()),
544 &gst_type, nullptr, nullptr);
545 return static_cast<Gst::StructureChangeType>(gst_type);
546 }
547
548 Glib::RefPtr<Gst::Element> MessageStructureChange::parse_owner() const
549 {
550 GstElement* gst_element = nullptr;
551 gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()), nullptr,
552 &gst_element, nullptr);
553 return Glib::wrap(gst_element, true);
554 }
555
556 bool MessageStructureChange::parse_busy() const
557 {
558 gboolean gst_busy = false;
559 gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()), nullptr, nullptr,
560 &gst_busy);
561 return gst_busy;
562 }
563
564 Gst::State MessageRequestState::parse_state() const
565 {
566 GstState gst_state = GST_STATE_VOID_PENDING;
567 gst_message_parse_request_state(const_cast<GstMessage*>(gobj()),
568 &gst_state);
569 return static_cast<Gst::State>(gst_state);
570 }
571
572 void MessageStreamStatus::set_object(const Glib::RefPtr<Gst::Object>& object)
573 {
574 Glib::Value< Glib::RefPtr<Gst::Object> > value;
575 value.init(Glib::Value< Glib::RefPtr<Gst::Object> >::value_type());
576 value.set(object);
577
578 gst_message_set_stream_status_object(gobj(), value.gobj());
579 }
580
581 Glib::RefPtr<Gst::Object> MessageStreamStatus::get_object() const
582 {
583 const GValue* g_val =
584 gst_message_get_stream_status_object(const_cast<GstMessage*>(gobj()));
585 GstObject* gst_object = static_cast<GstObject*>(g_value_get_object(g_val));
586 return Glib::wrap(gst_object, true);
587 }
588
589 void MessageStreamStatus::parse(Gst::StreamStatusType& type,
590 Glib::RefPtr<Gst::Element>& owner) const
591 {
592 GstElement* gst_element;
593 gst_message_parse_stream_status(const_cast<GstMessage*>(gobj()),
594 reinterpret_cast<GstStreamStatusType*>(&type), &gst_element);
595 owner = Glib::wrap(gst_element, true);
596 }
597
598 Gst::StreamStatusType MessageStreamStatus::parse_type() const
599 {
600 GstStreamStatusType type;
601 gst_message_parse_stream_status(const_cast<GstMessage*>(gobj()),
602 &type, nullptr);
603 return static_cast<Gst::StreamStatusType>(type);
604 }
605
606 Glib::RefPtr<Gst::Element> MessageStreamStatus::parse_owner() const
607 {
608 GstElement* gst_element;
609 gst_message_parse_stream_status(const_cast<GstMessage*>(gobj()), nullptr,
610 &gst_element);
611 return Glib::wrap(gst_element, true);
612 }
613
614 void MessageQos::set_values(gint64 jitter, double proportion, gint quality)
615 {
616 gst_message_set_qos_values(gobj(), jitter, proportion, quality);
617 }
618
619 void MessageQos::set_stats(Gst::Format format, guint64 processed, guint64 dropped)
620 {
621 gst_message_set_qos_stats(gobj(), static_cast<GstFormat>(format),
622 processed, dropped);
623 }
624
625 void MessageQos::parse(bool& live, guint64& running_time, guint64& stream_time,
626 guint64& timestamp, guint64& duration) const
627 {
628 gboolean tmp_live;
629 gst_message_parse_qos(const_cast<GstMessage*>(gobj()), &tmp_live, &running_time,
630 &stream_time, &timestamp, &duration);
631 live = tmp_live;
632 }
633
634 void MessageQos::parse_values(gint64& jitter, double& proportion, gint& quality) const
635 {
636 gst_message_parse_qos_values(const_cast<GstMessage*>(gobj()), &jitter, &proportion, &quality);
637 }
638
639 void MessageQos::parse_stats(Gst::Format& format, guint64& processed, guint64& dropped) const
640 {
641 gst_message_parse_qos_stats(const_cast<GstMessage*>(gobj()),
642 reinterpret_cast<GstFormat*>(&format), &processed, &dropped);
643 }
644
645 void MessageStreamStart::set_group_id(guint group_id)
646 {
647 gst_message_set_group_id(gobj(), group_id);
648 }
649
650 bool MessageStreamStart::parse_group_id(guint& group_id) const
651 {
652 return gst_message_parse_group_id(const_cast<GstMessage*>(gobj()), &group_id);
653 }
654
655 Glib::RefPtr<Gst::Context> MessageHaveContext::parse_have_context()
656 {
657 GstContext* context;
658 gst_message_parse_have_context(const_cast<GstMessage*>(gobj()), &context);
659 return Glib::wrap(context, true);
660 }
661
662 Glib::RefPtr<const Gst::Context> MessageHaveContext::parse_have_context() const
663 {
664 return parse_have_context();
665 }
666
667 bool MessageNeedContext::parse(Glib::ustring& context_type) const
668 {
669 gchar* c_context_type = nullptr;
670 bool ret = gst_message_parse_context_type(const_cast<GstMessage*>(gobj()),
671 const_cast<const gchar**>(&c_context_type));
672 context_type = c_context_type;
673 if(c_context_type)
674 g_free(c_context_type);
675 return ret;
676 }
677
678 Gst::ClockTime MessageResetTime::parse_running_time() const
679 {
680 GstClockTime running_time;
681 gst_message_parse_reset_time(const_cast<GstMessage*>(gobj()),
682 &running_time);
683 return static_cast<GstClockTime>(running_time);
684 }
685
686 void MessageToc::parse(Glib::RefPtr<Gst::Toc>& toc, bool& updated) const
687 {
688 GstToc* c_toc;
689 gboolean c_updated;
690 gst_message_parse_toc(const_cast<GstMessage*>(gobj()), &c_toc, &c_updated);
691 toc = Glib::wrap(c_toc, true);
692 updated = updated;
693 }
694
695 void MessageProgress::parse(Gst::ProgressType& type, Glib::ustring& code, Glib::ustring& text) const
696 {
697 GstProgressType c_type;
698 gchar* c_code, * c_text;
699 gst_message_parse_progress(const_cast<GstMessage*>(gobj()), &c_type, &c_code, &c_text);
700 code = c_code;
701 text = c_text;
702 if(c_code)
703 g_free(c_code);
704 if(c_text)
705 g_free(c_text);
706 type = static_cast<Gst::ProgressType>(c_type);
707 }
708
709 Gst::ProgressType MessageProgress::parse_type() const
710 {
711 GstProgressType c_type;
712
713 gst_message_parse_progress(const_cast<GstMessage*>(gobj()),
714 &c_type, nullptr, nullptr);
715
716 return static_cast<Gst::ProgressType>(c_type);
717 }
718
719 Glib::ustring MessageProgress::parse_code() const
720 {
721 gchar* c_code;
722 Glib::ustring code;
723
724 gst_message_parse_progress(const_cast<GstMessage*>(gobj()),
725 nullptr, &c_code, nullptr);
726
727 code = c_code;
728
729 if(c_code)
730 g_free(c_code);
731
732 return code;
733 }
734
735 Glib::ustring MessageProgress::parse_text() const
736 {
737 gchar* c_text;
738 Glib::ustring text;
739
740 gst_message_parse_progress(const_cast<GstMessage*>(gobj()),
741 nullptr, nullptr, &c_text);
742
743 text = c_text;
744
745 if(c_text)
746 g_free(c_text);
747
748 return text;
749 }
750
751 } //namespace Gst
752
753 namespace
754 {
755 } // anonymous namespace
756
757 // static
758 GType Glib::Value<Gst::MessageType>::value_type()
759 {
760 return gst_message_type_get_type();
761 }
762
763 // static
764 GType Glib::Value<Gst::ProgressType>::value_type()
765 {
766 return gst_progress_type_get_type();
767 }
768
769 // static
770 GType Glib::Value<Gst::StructureChangeType>::value_type()
771 {
772 return gst_structure_change_type_get_type();
773 }
774
775 // static
776 GType Glib::Value<Gst::StreamStatusType>::value_type()
777 {
778 return gst_stream_status_type_get_type();
779 }
780
781
782 /* Why reinterpret_cast<Message*>(gobject) is needed:
783 *
784 * A Message instance is in fact always a GstMessage instance.
785 * Unfortunately, GstMessage cannot be a member of Message,
786 * because it is an opaque struct. Also, the C interface does not provide
787 * any hooks to install a destroy notification handler, thus we cannot
788 * wrap it dynamically either.
789 *
790 * The cast works because Message does not have any member data, and
791 * it is impossible to derive from it. This is ensured by using final on the
792 * class and by using = delete on the default constructor.
793 */
794
795 namespace Glib
796 {
797
798 Glib::RefPtr<Gst::Message> wrap(GstMessage* object, bool take_copy)
799 {
800 if(take_copy && object)
801 gst_message_ref(object);
802
803 // See the comment at the top of this file, if you want to know why the cast works.
804 return Glib::RefPtr<Gst::Message>(reinterpret_cast<Gst::Message*>(object));
805 }
806
807 } // namespace Glib
808
809
810 namespace Gst
811 {
812
813
814 void Message::reference() const
815 {
816 // See the comment at the top of this file, if you want to know why the cast works.
817 gst_message_ref(reinterpret_cast<GstMessage*>(const_cast<Message*>(this)));
818 }
819
820 void Message::unreference() const
821 {
822 // See the comment at the top of this file, if you want to know why the cast works.
823 gst_message_unref(reinterpret_cast<GstMessage*>(const_cast<Message*>(this)));
824 }
825
826 GstMessage* Message::gobj()
827 {
828 // See the comment at the top of this file, if you want to know why the cast works.
829 return reinterpret_cast<GstMessage*>(this);
830 }
831
832 const GstMessage* Message::gobj() const
833 {
834 // See the comment at the top of this file, if you want to know why the cast works.
835 return reinterpret_cast<const GstMessage*>(this);
836 }
837
838 GstMessage* Message::gobj_copy() const
839 {
840 // See the comment at the top of this file, if you want to know why the cast works.
841 const auto gobject = reinterpret_cast<GstMessage*>(const_cast<Message*>(this));
842 gst_message_ref(gobject);
843 return gobject;
844 }
845
846
847 Gst::Structure Message::get_structure() const
848 {
849 return Glib::wrap(const_cast<GstStructure*>(gst_message_get_structure(const_cast<GstMessage*>(gobj()))), true);
850 }
851
852 guint32 Message::get_seqnum() const
853 {
854 return gst_message_get_seqnum(const_cast<GstMessage*>(gobj()));
855 }
856
857 void Message::set_seqnum(guint32 seqnum)
858 {
859 gst_message_set_seqnum(gobj(), seqnum);
860 }
861
862 Glib::RefPtr<Gst::Message> Message::copy() const
863 {
864 return Glib::wrap(gst_message_copy(const_cast<GstMessage*>(gobj())));
865 }
866
867 MessageType Message::get_message_type() const
868 {
869 return ((MessageType)(gobj()->type));
870 }
871
872 Gst::ClockTime Message::get_timestamp() const
873 {
874 return (Gst::ClockTime)(gobj()->timestamp);
875 }
876
877 Glib::RefPtr<Gst::Object> Message::get_source()
878 {
879 Glib::RefPtr<Gst::Object> ref_ptr(Glib::wrap(gobj()->src));
880
881 if(ref_ptr)
882 ref_ptr->reference();
883
884 return ref_ptr;
885 }
886
887 Glib::RefPtr<const Gst::Object> Message::get_source() const
888 {
889 Glib::RefPtr<const Gst::Object> ref_ptr(Glib::wrap(gobj()->src));
890
891 if(ref_ptr)
892 ref_ptr->reference();
893
894 return ref_ptr;
895 }
896
897 bool Message::has_name(const Glib::ustring& name) const
898 {
899 return gst_message_has_name(const_cast<GstMessage*>(gobj()), name.c_str());
900 }
901
902
903 } // namespace Gst
904
905
906 namespace Gst
907 {
908
909
910 Glib::RefPtr<Gst::MessageEos> MessageEos::create(const Glib::RefPtr<Gst::Object>& src)
911 {
912 return Gst::wrap_msg_derived<MessageEos>(gst_message_new_eos(Glib::unwrap(src)), false);
913 }
914
915
916 } // namespace Gst
917
918
919 namespace Gst
920 {
921
922
923 Glib::RefPtr<Gst::MessageError> MessageError::create(const Glib::RefPtr<Gst::Object>& src, const Glib::Error& error, const std::string& debug)
924 {
925 return Gst::wrap_msg_derived<MessageError>(gst_message_new_error(Glib::unwrap(src), const_cast<GError*>(error.gobj()), debug.c_str()), false);
926 }
927
928
929 } // namespace Gst
930
931
932 namespace Gst
933 {
934
935
936 Glib::RefPtr<Gst::MessageWarning> MessageWarning::create(const Glib::RefPtr<Gst::Object>& src, const Glib::Error& error, const std::string& debug)
937 {
938 return Gst::wrap_msg_derived<MessageWarning>(gst_message_new_warning(Glib::unwrap(src), const_cast<GError*>(error.gobj()), debug.c_str()), false);
939 }
940
941
942 } // namespace Gst
943
944
945 namespace Gst
946 {
947
948
949 Glib::RefPtr<Gst::MessageInfo> MessageInfo::create(const Glib::RefPtr<Gst::Object>& src, const Glib::Error& error, const std::string& debug)
950 {
951 return Gst::wrap_msg_derived<MessageInfo>(gst_message_new_info(Glib::unwrap(src), const_cast<GError*>(error.gobj()), debug.c_str()), false);
952 }
953
954
955 } // namespace Gst
956
957
958 namespace Gst
959 {
960
961
962 Glib::RefPtr<Gst::MessageTag> MessageTag::create(const Glib::RefPtr<Gst::Object>& src, const Gst::TagList& taglist)
963 {
964 return Gst::wrap_msg_derived<MessageTag>(gst_message_new_tag(Glib::unwrap(src), const_cast<GstTagList*>(taglist.gobj())), false);
965 }
966
967
968 } // namespace Gst
969
970
971 namespace Gst
972 {
973
974
975 Glib::RefPtr<Gst::MessageBuffering> MessageBuffering::create(const Glib::RefPtr<Gst::Object>& src, int percent)
976 {
977 return Gst::wrap_msg_derived<MessageBuffering>(gst_message_new_buffering(Glib::unwrap(src), percent), false);
978 }
979
980
981 } // namespace Gst
982
983
984 namespace Gst
985 {
986
987
988 Glib::RefPtr<Gst::MessageStateChanged> MessageStateChanged::create(const Glib::RefPtr<Gst::Object>& src, State oldstate, State newstate, State pending)
989 {
990 return Gst::wrap_msg_derived<MessageStateChanged>(gst_message_new_state_changed(Glib::unwrap(src), ((GstState)(oldstate)), ((GstState)(newstate)), ((GstState)(pending))), false);
991 }
992
993
994 } // namespace Gst
995
996
997 namespace Gst
998 {
999
1000
1001 Glib::RefPtr<Gst::MessageStateDirty> MessageStateDirty::create(const Glib::RefPtr<Gst::Object>& src)
1002 {
1003 return Gst::wrap_msg_derived<MessageStateDirty>(gst_message_new_state_dirty(Glib::unwrap(src)), false);
1004 }
1005
1006
1007 } // namespace Gst
1008
1009
1010 namespace Gst
1011 {
1012
1013
1014 Glib::RefPtr<Gst::MessageStepDone> MessageStepDone::create(const Glib::RefPtr<Gst::Object>& src, Gst::Format format, guint64 amount, double rate, bool flush, bool intermediate, guint64 duration, bool eos)
1015 {
1016 return Gst::wrap_msg_derived<MessageStepDone>(gst_message_new_step_done(Glib::unwrap(src), ((GstFormat)(format)), amount, rate, static_cast<int>(flush), static_cast<int>(intermediate), duration, static_cast<int>(eos)), false);
1017 }
1018
1019
1020 } // namespace Gst
1021
1022
1023 namespace Gst
1024 {
1025
1026
1027 Glib::RefPtr<Gst::MessageClockProvide> MessageClockProvide::create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock, bool ready)
1028 {
1029 return Gst::wrap_msg_derived<MessageClockProvide>(gst_message_new_clock_provide(Glib::unwrap(src), Glib::unwrap(clock), static_cast<int>(ready)), false);
1030 }
1031
1032
1033 } // namespace Gst
1034
1035
1036 namespace Gst
1037 {
1038
1039
1040 Glib::RefPtr<Gst::MessageClockLost> MessageClockLost::create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock)
1041 {
1042 return Gst::wrap_msg_derived<MessageClockLost>(gst_message_new_clock_lost(Glib::unwrap(src), Glib::unwrap(clock)), false);
1043 }
1044
1045
1046 } // namespace Gst
1047
1048
1049 namespace Gst
1050 {
1051
1052
1053 Glib::RefPtr<Gst::MessageNewClock> MessageNewClock::create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Clock>& clock)
1054 {
1055 return Gst::wrap_msg_derived<MessageNewClock>(gst_message_new_new_clock(Glib::unwrap(src), Glib::unwrap(clock)), false);
1056 }
1057
1058
1059 } // namespace Gst
1060
1061
1062 namespace Gst
1063 {
1064
1065
1066 Glib::RefPtr<Gst::MessageApplication> MessageApplication::create(const Glib::RefPtr<Gst::Object>& src, Gst::Structure&& structure)
1067 {
1068 return Gst::wrap_msg_derived<MessageApplication>(gst_message_new_application(Glib::unwrap(src), (structure) ? structure.release() : nullptr), false);
1069 }
1070
1071
1072 } // namespace Gst
1073
1074
1075 namespace Gst
1076 {
1077
1078
1079 Glib::RefPtr<Gst::MessageElement> MessageElement::create(const Glib::RefPtr<Gst::Object>& src, Gst::Structure&& structure)
1080 {
1081 return Gst::wrap_msg_derived<MessageElement>(gst_message_new_element(Glib::unwrap(src), (structure) ? structure.release() : nullptr), false);
1082 }
1083
1084 Glib::RefPtr<Gst::MessageElement> MessageElement::create(const Glib::RefPtr<Gst::Object>& src)
1085 {
1086 return Gst::wrap_msg_derived<MessageElement>(gst_message_new_element(Glib::unwrap(src), nullptr), false);
1087 }
1088
1089
1090 } // namespace Gst
1091
1092
1093 namespace Gst
1094 {
1095
1096
1097 Glib::RefPtr<Gst::MessageCustom> MessageCustom::create(MessageType type, const Glib::RefPtr<Gst::Object>& src, Gst::Structure& structure)
1098 {
1099 return Gst::wrap_msg_derived<MessageCustom>(gst_message_new_custom(((GstMessageType)(type)), Glib::unwrap(src), structure.gobj()), false);
1100 }
1101
1102 Glib::RefPtr<Gst::MessageCustom> MessageCustom::create(MessageType type, const Glib::RefPtr<Gst::Object>& src)
1103 {
1104 return Gst::wrap_msg_derived<MessageCustom>(gst_message_new_custom(((GstMessageType)(type)), Glib::unwrap(src), nullptr), false);
1105 }
1106
1107
1108 } // namespace Gst
1109
1110
1111 namespace Gst
1112 {
1113
1114
1115 Glib::RefPtr<Gst::MessageSegmentStart> MessageSegmentStart::create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position)
1116 {
1117 return Gst::wrap_msg_derived<MessageSegmentStart>(gst_message_new_segment_start(Glib::unwrap(src), ((GstFormat)(format)), position), false);
1118 }
1119
1120
1121 } // namespace Gst
1122
1123
1124 namespace Gst
1125 {
1126
1127
1128 Glib::RefPtr<Gst::MessageSegmentDone> MessageSegmentDone::create(const Glib::RefPtr<Gst::Object>& src, Format format, gint64 position)
1129 {
1130 return Gst::wrap_msg_derived<MessageSegmentDone>(gst_message_new_segment_done(Glib::unwrap(src), ((GstFormat)(format)), position), false);
1131 }
1132
1133
1134 } // namespace Gst
1135
1136
1137 namespace Gst
1138 {
1139
1140
1141 Glib::RefPtr<Gst::MessageDurationChanged> MessageDurationChanged::create(const Glib::RefPtr<Gst::Object>& src)
1142 {
1143 return Gst::wrap_msg_derived<MessageDurationChanged>(gst_message_new_duration_changed(Glib::unwrap(src)), false);
1144 }
1145
1146
1147 } // namespace Gst
1148
1149
1150 namespace Gst
1151 {
1152
1153
1154 Glib::RefPtr<Gst::MessageLatency> MessageLatency::create(const Glib::RefPtr<Gst::Object>& src)
1155 {
1156 return Gst::wrap_msg_derived<MessageLatency>(gst_message_new_latency(Glib::unwrap(src)), false);
1157 }
1158
1159
1160 } // namespace Gst
1161
1162
1163 namespace Gst
1164 {
1165
1166
1167 Glib::RefPtr<Gst::MessageAsyncStart> MessageAsyncStart::create(const Glib::RefPtr<Gst::Object>& src)
1168 {
1169 return Gst::wrap_msg_derived<MessageAsyncStart>(gst_message_new_async_start(Glib::unwrap(src)), false);
1170 }
1171
1172
1173 } // namespace Gst
1174
1175
1176 namespace Gst
1177 {
1178
1179
1180 Glib::RefPtr<Gst::MessageAsyncDone> MessageAsyncDone::create(const Glib::RefPtr<Gst::Object>& src, Gst::ClockTime running_time)
1181 {
1182 return Gst::wrap_msg_derived<MessageAsyncDone>(gst_message_new_async_done(Glib::unwrap(src), ((GstClockTime)(running_time))), false);
1183 }
1184
1185
1186 } // namespace Gst
1187
1188
1189 namespace Gst
1190 {
1191
1192
1193 Glib::RefPtr<Gst::MessageStepStart> MessageStepStart::create(const Glib::RefPtr<Gst::Object>& src, bool active, Gst::Format format, guint64 amount, double rate, bool flush, bool intermediate)
1194 {
1195 return Gst::wrap_msg_derived<MessageStepStart>(gst_message_new_step_start(Glib::unwrap(src), static_cast<int>(active), ((GstFormat)(format)), amount, rate, static_cast<int>(flush), static_cast<int>(intermediate)), false);
1196 }
1197
1198
1199 } // namespace Gst
1200
1201
1202 namespace Gst
1203 {
1204
1205
1206 Glib::RefPtr<Gst::MessageStructureChange> MessageStructureChange::create(const Glib::RefPtr<Gst::Object>& src, Gst::StructureChangeType type, const Glib::RefPtr<Gst::Element>& owner, bool busy)
1207 {
1208 return Gst::wrap_msg_derived<MessageStructureChange>(gst_message_new_structure_change(Glib::unwrap(src), ((GstStructureChangeType)(type)), Glib::unwrap(owner), static_cast<int>(busy)), false);
1209 }
1210
1211
1212 } // namespace Gst
1213
1214
1215 namespace Gst
1216 {
1217
1218
1219 Glib::RefPtr<Gst::MessageRequestState> MessageRequestState::create(const Glib::RefPtr<Gst::Object>& src, Gst::State state)
1220 {
1221 return Gst::wrap_msg_derived<MessageRequestState>(gst_message_new_request_state(Glib::unwrap(src), ((GstState)(state))), false);
1222 }
1223
1224
1225 } // namespace Gst
1226
1227
1228 namespace Gst
1229 {
1230
1231
1232 Glib::RefPtr<Gst::MessageStreamStatus> MessageStreamStatus::create(const Glib::RefPtr<Gst::Object>& src, Gst::StreamStatusType type, const Glib::RefPtr<Gst::Element>& owner)
1233 {
1234 return Gst::wrap_msg_derived<MessageStreamStatus>(gst_message_new_stream_status(Glib::unwrap(src), ((GstStreamStatusType)(type)), Glib::unwrap(owner)), false);
1235 }
1236
1237
1238 } // namespace Gst
1239
1240
1241 namespace Gst
1242 {
1243
1244
1245 Glib::RefPtr<Gst::MessageQos> MessageQos::create(const Glib::RefPtr<Gst::Object>& src, bool live, guint64 running_time, guint64 stream_time, guint64 timestamp, guint64 duration)
1246 {
1247 return Gst::wrap_msg_derived<MessageQos>(gst_message_new_qos(Glib::unwrap(src), static_cast<int>(live), running_time, stream_time, timestamp, duration), false);
1248 }
1249
1250
1251 } // namespace Gst
1252
1253
1254 namespace Gst
1255 {
1256
1257
1258 Glib::RefPtr<Gst::MessageStreamStart> MessageStreamStart::create(const Glib::RefPtr<Gst::Object>& src)
1259 {
1260 return Gst::wrap_msg_derived<MessageStreamStart>(gst_message_new_stream_start(Glib::unwrap(src)), false);
1261 }
1262
1263
1264 } // namespace Gst
1265
1266
1267 namespace Gst
1268 {
1269
1270
1271 Glib::RefPtr<Gst::MessageHaveContext> MessageHaveContext::create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Context>& context)
1272 {
1273 return Gst::wrap_msg_derived<MessageHaveContext>(gst_message_new_have_context(Glib::unwrap(src), context->gobj()), false);
1274 }
1275
1276
1277 } // namespace Gst
1278
1279
1280 namespace Gst
1281 {
1282
1283
1284 Glib::RefPtr<Gst::MessageNeedContext> MessageNeedContext::create(const Glib::RefPtr<Gst::Object>& src, const Glib::ustring& context_type)
1285 {
1286 return Gst::wrap_msg_derived<MessageNeedContext>(gst_message_new_need_context(Glib::unwrap(src), context_type.c_str()), false);
1287 }
1288
1289
1290 } // namespace Gst
1291
1292
1293 namespace Gst
1294 {
1295
1296
1297 Glib::RefPtr<Gst::MessageResetTime> MessageResetTime::create(const Glib::RefPtr<Gst::Object>& src, Gst::ClockTime running_time)
1298 {
1299 return Gst::wrap_msg_derived<MessageResetTime>(gst_message_new_reset_time(Glib::unwrap(src), ((GstClockTime)(running_time))), false);
1300 }
1301
1302
1303 } // namespace Gst
1304
1305
1306 namespace Gst
1307 {
1308
1309
1310 Glib::RefPtr<Gst::MessageToc> MessageToc::create(const Glib::RefPtr<Gst::Object>& src, const Glib::RefPtr<Gst::Toc>& toc, bool updated)
1311 {
1312 return Gst::wrap_msg_derived<MessageToc>(gst_message_new_toc(Glib::unwrap(src), Glib::unwrap(toc), static_cast<int>(updated)), false);
1313 }
1314
1315
1316 } // namespace Gst
1317
1318
1319 namespace Gst
1320 {
1321
1322
1323 Glib::RefPtr<Gst::MessageProgress> MessageProgress::create(const Glib::RefPtr<Gst::Object>& src, Gst::ProgressType type, const Glib::ustring& code, const Glib::ustring& text)
1324 {
1325 return Gst::wrap_msg_derived<MessageProgress>(gst_message_new_progress(Glib::unwrap(src), ((GstProgressType)(type)), code.c_str(), text.c_str()), false);
1326 }
1327
1328
1329 } // namespace Gst
1330
1331