1/* gstreamermm - a C++ wrapper for gstreamer 2 * 3 * Copyright 2008-2016 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/element.h> 22#include <gstreamermm/pad.h> 23#include <gstreamermm/structure.h> 24#include <gstreamermm/taglist.h> 25_PINCLUDE(gstreamermm/private/miniobject_p.h) 26#include <iostream> 27 28namespace Gst 29{ 30 31namespace Enums 32{ 33 34Glib::ustring get_name(MessageType t) 35{ 36 return gst_message_type_get_name(static_cast<GstMessageType>(t)); 37} 38 39Glib::QueryQuark get_quark(MessageType t) 40{ 41 return Glib::QueryQuark(gst_message_type_to_quark(static_cast<GstMessageType>(t))); 42} 43 44} //namespace Enums 45 46Glib::RefPtr<Gst::Message> Message::create_writable() 47{ 48 return Glib::RefPtr<Message>::cast_static(MiniObject::create_writable()); 49} 50 51void MessageError::parse(Glib::Error& error, std::string& debug) const 52{ 53 GError* c_error = nullptr; 54 gchar* c_debug = nullptr; 55 gst_message_parse_error(const_cast<GstMessage*>(gobj()), &c_error, &c_debug); 56 57 debug = c_debug; 58 if(c_debug) 59 g_free(c_debug); 60 61 error = Glib::Error(c_error); 62} 63 64Glib::Error MessageError::parse_error() const 65{ 66 GError* c_error = nullptr; 67 gst_message_parse_error(const_cast<GstMessage*>(gobj()), &c_error, nullptr); 68 69 return Glib::Error(c_error); 70} 71 72std::string MessageError::parse_debug() const 73{ 74 gchar* c_debug = nullptr; 75 GError* c_error = nullptr; 76 77 gst_message_parse_error(const_cast<GstMessage*>(gobj()), &c_error, &c_debug); 78 79 std::string result = c_debug; 80 81 if(c_debug) 82 g_free(c_debug); 83 84 if(c_error) 85 g_error_free(c_error); 86 87 return result; 88} 89 90void MessageWarning::parse(Glib::Error& error, std::string& debug) const 91{ 92 GError* c_error = nullptr; 93 gchar* c_debug = nullptr; 94 gst_message_parse_warning(const_cast<GstMessage*>(gobj()), &c_error, &c_debug); 95 96 debug = c_debug; 97 if(c_debug) 98 g_free(c_debug); 99 100 error = Glib::Error(c_error); 101} 102 103Glib::Error MessageWarning::parse_error() const 104{ 105 GError* c_error = nullptr; 106 gst_message_parse_warning(const_cast<GstMessage*>(gobj()), &c_error, nullptr); 107 108 return Glib::Error(c_error); 109} 110 111std::string MessageWarning::parse_debug() const 112{ 113 gchar* c_debug = nullptr; 114 GError* c_error = nullptr; 115 116 gst_message_parse_warning(const_cast<GstMessage*>(gobj()), &c_error, 117 &c_debug); 118 119 std::string result = c_debug; 120 121 if(c_debug) 122 g_free(c_debug); 123 124 if(c_error) 125 g_error_free(c_error); 126 127 return result; 128} 129 130void MessageInfo::parse(Glib::Error& error, std::string& debug) const 131{ 132 GError* c_error = nullptr; 133 gchar* c_debug = nullptr; 134 gst_message_parse_info(const_cast<GstMessage*>(gobj()), &c_error, &c_debug); 135 136 debug = c_debug; 137 if(c_debug) 138 g_free(c_debug); 139 140 error = Glib::Error(c_error); 141} 142 143Glib::Error MessageInfo::parse_error() const 144{ 145 GError* c_error = nullptr; 146 gst_message_parse_info(const_cast<GstMessage*>(gobj()), &c_error, nullptr); 147 148 return Glib::Error(c_error); 149} 150 151std::string MessageInfo::parse_debug() const 152{ 153 gchar* c_debug = nullptr; 154 GError* c_error = nullptr; 155 156 gst_message_parse_info(const_cast<GstMessage*>(gobj()), &c_error, &c_debug); 157 158 std::string result = c_debug; 159 160 if(c_debug) 161 g_free(c_debug); 162 163 if(c_error) 164 g_error_free(c_error); 165 166 return result; 167} 168 169Gst::TagList MessageTag::parse_tag_list() const 170{ 171 GstTagList* gst_tag_list = nullptr; 172 gst_message_parse_tag(const_cast<GstMessage*>(gobj()), &gst_tag_list); 173 return Gst::TagList(gst_tag_list); 174} 175 176int MessageBuffering::parse_buffering() const 177{ 178 int percent = 0; 179 gst_message_parse_buffering(const_cast<GstMessage*>(gobj()), &percent); 180 return percent; 181} 182 183void MessageBuffering::set_stats(BufferingMode mode, int avg_in, int avg_out, 184gint64 buffering_left) 185{ 186 gst_message_set_buffering_stats(gobj(), static_cast<GstBufferingMode>(mode), 187 avg_in, avg_out, buffering_left); 188} 189 190void MessageBuffering::parse_stats(BufferingMode& mode, int& avg_in, 191int& avg_out, gint64& buffering_left) const 192{ 193 gst_message_parse_buffering_stats(const_cast<GstMessage*>(gobj()), 194 reinterpret_cast<GstBufferingMode*>(&mode), &avg_in, &avg_out, 195 &buffering_left); 196} 197 198BufferingMode MessageBuffering::parse_stats_buffering_mode() const 199{ 200 GstBufferingMode mode = GST_BUFFERING_STREAM; 201 202 gst_message_parse_buffering_stats(const_cast<GstMessage*>(gobj()), &mode, 203 nullptr, nullptr, nullptr); 204 return static_cast<BufferingMode>(mode); 205} 206 207int MessageBuffering::parse_stats_avg_in() const 208{ 209 int avg_in = 0; 210 211 gst_message_parse_buffering_stats(const_cast<GstMessage*>(gobj()), nullptr, 212 &avg_in, nullptr, nullptr); 213 return avg_in; 214} 215 216int MessageBuffering::parse_stats_avg_out() const 217{ 218 int avg_out = 0; 219 220 gst_message_parse_buffering_stats(const_cast<GstMessage*>(gobj()), nullptr, 221 nullptr, &avg_out, nullptr); 222 return avg_out; 223} 224 225gint64 MessageBuffering::parse_stats_buffering_left() const 226{ 227 gint64 buffering_left = 0; 228 229 gst_message_parse_buffering_stats(const_cast<GstMessage*>(gobj()), nullptr, 230 nullptr, nullptr, &buffering_left); 231 return buffering_left; 232} 233 234void MessageStateChanged::parse(State& oldstate, State& newstate, 235State& pending) const 236{ 237 gst_message_parse_state_changed(const_cast<GstMessage*>(gobj()), 238 reinterpret_cast<GstState*>(&oldstate), 239 reinterpret_cast<GstState*>(&newstate), 240 reinterpret_cast<GstState*>(&pending)); 241} 242 243State MessageStateChanged::parse_new_state() const 244{ 245 GstState new_state = GST_STATE_NULL; 246 247 gst_message_parse_state_changed(const_cast<GstMessage*>(gobj()), nullptr, 248 &new_state, nullptr); 249 return State(new_state); 250} 251 252State MessageStateChanged::parse_old_state() const 253{ 254 GstState old_state = GST_STATE_NULL; 255 256 gst_message_parse_state_changed(const_cast<GstMessage*>(gobj()), &old_state, 257 nullptr, nullptr); 258 return State(old_state); 259} 260 261State MessageStateChanged::parse_pending_state() const 262{ 263 GstState pending_state = GST_STATE_NULL; 264 gst_message_parse_state_changed(const_cast<GstMessage*>(gobj()), nullptr, 265 nullptr, &pending_state); 266 return State(pending_state); 267} 268 269void MessageStepDone::parse(Gst::Format& format, guint64& amount, double& rate, 270 bool& flush, bool& intermediate, guint64& duration, bool& eos) const 271{ 272 gboolean gst_flush = FALSE; 273 gboolean gst_intermediate = FALSE; 274 gboolean gst_eos = FALSE; 275 276 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), 277 reinterpret_cast<GstFormat*>(&format), &amount, &rate, &gst_flush, 278 &gst_intermediate, &duration, &gst_eos); 279 280 flush = gst_flush; 281 intermediate = gst_intermediate; 282 eos = gst_eos; 283} 284 285guint64 MessageStepDone::parse_duration() const 286{ 287 guint64 duration = 0; 288 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, nullptr, nullptr, 289 &duration, nullptr); 290 return duration; 291} 292 293Gst::Format MessageStepDone::parse_format() const 294{ 295 GstFormat format = GST_FORMAT_UNDEFINED; 296 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), 297 reinterpret_cast<GstFormat*>(&format), nullptr, nullptr, nullptr, nullptr, nullptr, nullptr); 298 return static_cast<Gst::Format>(format); 299} 300 301guint64 MessageStepDone::parse_amount() const 302{ 303 guint64 amount = 0; 304 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, &amount, nullptr, 305 nullptr, nullptr, nullptr, nullptr); 306 return amount; 307} 308 309double MessageStepDone::parse_rate() const 310{ 311 double rate = 0; 312 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, nullptr, &rate, nullptr, 313 nullptr, nullptr, nullptr); 314 return rate; 315} 316 317bool MessageStepDone::parse_flush() const 318{ 319 gboolean gst_flush = FALSE; 320 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, 321 &gst_flush, nullptr, nullptr, nullptr); 322 return gst_flush; 323} 324 325bool MessageStepDone::parse_intermediate() const 326{ 327 gboolean gst_intermediate = FALSE; 328 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, nullptr, 329 &gst_intermediate, nullptr, nullptr); 330 return gst_intermediate; 331} 332 333bool MessageStepDone::parse_eos() const 334{ 335 gboolean gst_eos = FALSE; 336 gst_message_parse_step_done(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, nullptr, nullptr, 337 nullptr, &gst_eos); 338 return gst_eos; 339} 340 341void MessageClockProvide::parse(Glib::RefPtr<Gst::Clock>& clock, bool& ready) const 342{ 343 GstClock* cclock = nullptr; 344 gboolean ready_ = false; 345 gst_message_parse_clock_provide(const_cast<GstMessage*>(gobj()), &cclock, 346 &ready_); 347 clock = Glib::wrap(cclock); 348 ready = ready_; 349} 350 351Glib::RefPtr<Gst::Clock> MessageClockProvide::parse_clock_provide() 352{ 353 GstClock* cclock = nullptr; 354 gst_message_parse_clock_provide(gobj(), &cclock, nullptr); 355 return Glib::wrap(cclock); 356} 357 358Glib::RefPtr<const Gst::Clock> MessageClockProvide::parse_clock_provide() const 359{ 360 return parse_clock_provide(); 361} 362 363bool MessageClockProvide::parse_ready() const 364{ 365 gboolean ready = FALSE; 366 gst_message_parse_clock_provide(const_cast<GstMessage*>(gobj()), nullptr, 367 &ready); 368 return ready; 369} 370 371Glib::RefPtr<Gst::Clock> MessageClockLost::parse_clock_lost() 372{ 373 GstClock* cclock = nullptr; 374 gst_message_parse_clock_lost(gobj(), &cclock); 375 return Glib::wrap(cclock, false); 376} 377 378Glib::RefPtr<const Gst::Clock> MessageClockLost::parse_clock_lost() const 379{ 380 return parse_clock_lost(); 381} 382 383Glib::RefPtr<Gst::Clock> MessageNewClock::parse_new_clock() 384{ 385 GstClock* cclock = nullptr; 386 gst_message_parse_new_clock(gobj(), &cclock); 387 return Glib::wrap(cclock, false); 388} 389 390Glib::RefPtr<const Gst::Clock> MessageNewClock::parse_new_clock() const 391{ 392 return parse_new_clock(); 393} 394 395Glib::RefPtr<Gst::MessageApplication> MessageApplication::create(const Glib::RefPtr<Gst::Object>& src, const Gst::Structure& structure) 396{ 397 return Gst::wrap_msg_derived<MessageApplication>(gst_message_new_application(Glib::unwrap(src), structure.gobj_copy()), false); 398} 399 400Glib::RefPtr<Gst::MessageElement> MessageElement::create(const Glib::RefPtr<Gst::Object>& src, const Gst::Structure& structure) 401{ 402 return Gst::wrap_msg_derived<MessageElement>(gst_message_new_element(Glib::unwrap(src), structure.gobj_copy()), false); 403} 404 405void MessageSegmentStart::parse(Format& format, gint64& position) const 406{ 407 gst_message_parse_segment_start(const_cast<GstMessage*>(gobj()), 408 reinterpret_cast<GstFormat*>(&format), &position); 409} 410 411gint64 MessageSegmentStart::parse_position() const 412{ 413 gint64 position = 0; 414 gst_message_parse_segment_start(const_cast<GstMessage*>(gobj()), nullptr, 415 &position); 416 return position; 417} 418 419Format MessageSegmentStart::parse_format() const 420{ 421 Format format = Gst::FORMAT_DEFAULT; 422 gst_message_parse_segment_start(const_cast<GstMessage*>(gobj()), 423 reinterpret_cast<GstFormat*>(&format), nullptr); 424 return format; 425} 426 427void MessageSegmentDone::parse(Format& format, gint64& position) const 428{ 429 gst_message_parse_segment_done(const_cast<GstMessage*>(gobj()), 430 reinterpret_cast<GstFormat*>(&format), &position); 431} 432 433gint64 MessageSegmentDone::parse_position() const 434{ 435 gint64 position = 0; 436 gst_message_parse_segment_done(const_cast<GstMessage*>(gobj()), nullptr, 437 &position); 438 return position; 439} 440 441Format MessageSegmentDone::parse_format() const 442{ 443 Format format = Gst::FORMAT_UNDEFINED; 444 gst_message_parse_segment_done(const_cast<GstMessage*>(gobj()), 445 reinterpret_cast<GstFormat*>(&format), nullptr); 446 return format; 447} 448 449Gst::ClockTime MessageAsyncDone::parse_running_time() const 450{ 451 GstClockTime running_time; 452 gst_message_parse_async_done(const_cast<GstMessage*>(gobj()), &running_time); 453 return static_cast<Gst::ClockTime>(running_time); 454} 455 456void MessageStepStart::parse(bool& active, Gst::Format& format, 457 guint64& amount, double& rate, bool& flush, bool& intermediate) const 458{ 459 gboolean gst_active = FALSE; 460 gboolean gst_flush = FALSE; 461 gboolean gst_intermediate = FALSE; 462 463 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), &gst_active, 464 reinterpret_cast<GstFormat*>(&format), &amount, &rate, &gst_flush, 465 &gst_intermediate); 466 467 active = gst_active; 468 flush = gst_flush; 469 intermediate = gst_intermediate; 470} 471 472guint64 MessageStepStart::parse_amount() const 473{ 474 guint64 amount = 0; 475 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), nullptr, nullptr, &amount, 476 nullptr, nullptr, nullptr); 477 return amount; 478} 479 480bool MessageStepStart::parse_active() const 481{ 482 gboolean gst_active = FALSE; 483 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), &gst_active, nullptr, 484 nullptr, nullptr, nullptr, nullptr); 485 return gst_active; 486} 487 488Gst::Format MessageStepStart::parse_format() const 489{ 490 GstFormat format = GST_FORMAT_UNDEFINED; 491 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), nullptr, 492 reinterpret_cast<GstFormat*>(&format), nullptr, nullptr, nullptr, nullptr); 493 return static_cast<Gst::Format>(format); 494} 495 496double MessageStepStart::parse_rate() const 497{ 498 double rate = 0; 499 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, &rate, 500 nullptr, nullptr); 501 return rate; 502} 503 504bool MessageStepStart::parse_flush() const 505{ 506 gboolean gst_flush = FALSE; 507 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, nullptr, 508 &gst_flush, nullptr); 509 return gst_flush; 510} 511 512bool MessageStepStart::parse_intermediate() const 513{ 514 gboolean gst_intermediate = FALSE; 515 gst_message_parse_step_start(const_cast<GstMessage*>(gobj()), nullptr, nullptr, nullptr, nullptr, nullptr, 516 &gst_intermediate); 517 return gst_intermediate; 518} 519 520void MessageStructureChange::parse(Gst::StructureChangeType& type, 521 Glib::RefPtr<Gst::Element>& owner, bool& busy) const 522{ 523 GstElement* gst_element = nullptr; 524 gboolean gst_busy = false; 525 gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()), 526 reinterpret_cast<GstStructureChangeType*>(&type), &gst_element, &gst_busy); 527 owner = Glib::wrap(gst_element, true); 528 busy = gst_busy; 529} 530 531Gst::StructureChangeType MessageStructureChange::parse_type() const 532{ 533 GstStructureChangeType gst_type = GST_STRUCTURE_CHANGE_TYPE_PAD_LINK; 534 gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()), 535 &gst_type, nullptr, nullptr); 536 return static_cast<Gst::StructureChangeType>(gst_type); 537} 538 539Glib::RefPtr<Gst::Element> MessageStructureChange::parse_owner() const 540{ 541 GstElement* gst_element = nullptr; 542 gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()), nullptr, 543 &gst_element, nullptr); 544 return Glib::wrap(gst_element, true); 545} 546 547bool MessageStructureChange::parse_busy() const 548{ 549 gboolean gst_busy = false; 550 gst_message_parse_structure_change(const_cast<GstMessage*>(gobj()), nullptr, nullptr, 551 &gst_busy); 552 return gst_busy; 553} 554 555Gst::State MessageRequestState::parse_state() const 556{ 557 GstState gst_state = GST_STATE_VOID_PENDING; 558 gst_message_parse_request_state(const_cast<GstMessage*>(gobj()), 559 &gst_state); 560 return static_cast<Gst::State>(gst_state); 561} 562 563void MessageStreamStatus::set_object(const Glib::RefPtr<Gst::Object>& object) 564{ 565 Glib::Value< Glib::RefPtr<Gst::Object> > value; 566 value.init(Glib::Value< Glib::RefPtr<Gst::Object> >::value_type()); 567 value.set(object); 568 569 gst_message_set_stream_status_object(gobj(), value.gobj()); 570} 571 572Glib::RefPtr<Gst::Object> MessageStreamStatus::get_object() const 573{ 574 const GValue* g_val = 575 gst_message_get_stream_status_object(const_cast<GstMessage*>(gobj())); 576 GstObject* gst_object = static_cast<GstObject*>(g_value_get_object(g_val)); 577 return Glib::wrap(gst_object, true); 578} 579 580void MessageStreamStatus::parse(Gst::StreamStatusType& type, 581 Glib::RefPtr<Gst::Element>& owner) const 582{ 583 GstElement* gst_element; 584 gst_message_parse_stream_status(const_cast<GstMessage*>(gobj()), 585 reinterpret_cast<GstStreamStatusType*>(&type), &gst_element); 586 owner = Glib::wrap(gst_element, true); 587} 588 589Gst::StreamStatusType MessageStreamStatus::parse_type() const 590{ 591 GstStreamStatusType type; 592 gst_message_parse_stream_status(const_cast<GstMessage*>(gobj()), 593 &type, nullptr); 594 return static_cast<Gst::StreamStatusType>(type); 595} 596 597Glib::RefPtr<Gst::Element> MessageStreamStatus::parse_owner() const 598{ 599 GstElement* gst_element; 600 gst_message_parse_stream_status(const_cast<GstMessage*>(gobj()), nullptr, 601 &gst_element); 602 return Glib::wrap(gst_element, true); 603} 604 605void MessageQos::set_values(gint64 jitter, double proportion, gint quality) 606{ 607 gst_message_set_qos_values(gobj(), jitter, proportion, quality); 608} 609 610void MessageQos::set_stats(Gst::Format format, guint64 processed, guint64 dropped) 611{ 612 gst_message_set_qos_stats(gobj(), static_cast<GstFormat>(format), 613 processed, dropped); 614} 615 616void MessageQos::parse(bool& live, guint64& running_time, guint64& stream_time, 617 guint64& timestamp, guint64& duration) const 618{ 619 gboolean tmp_live; 620 gst_message_parse_qos(const_cast<GstMessage*>(gobj()), &tmp_live, &running_time, 621 &stream_time, ×tamp, &duration); 622 live = tmp_live; 623} 624 625void MessageQos::parse_values(gint64& jitter, double& proportion, gint& quality) const 626{ 627 gst_message_parse_qos_values(const_cast<GstMessage*>(gobj()), &jitter, &proportion, &quality); 628} 629 630void MessageQos::parse_stats(Gst::Format& format, guint64& processed, guint64& dropped) const 631{ 632 gst_message_parse_qos_stats(const_cast<GstMessage*>(gobj()), 633 reinterpret_cast<GstFormat*>(&format), &processed, &dropped); 634} 635 636void MessageStreamStart::set_group_id(guint group_id) 637{ 638 gst_message_set_group_id(gobj(), group_id); 639} 640 641bool MessageStreamStart::parse_group_id(guint& group_id) const 642{ 643 return gst_message_parse_group_id(const_cast<GstMessage*>(gobj()), &group_id); 644} 645 646Glib::RefPtr<Gst::Context> MessageHaveContext::parse_have_context() 647{ 648 GstContext* context; 649 gst_message_parse_have_context(const_cast<GstMessage*>(gobj()), &context); 650 return Glib::wrap(context, true); 651} 652 653Glib::RefPtr<const Gst::Context> MessageHaveContext::parse_have_context() const 654{ 655 return parse_have_context(); 656} 657 658bool MessageNeedContext::parse(Glib::ustring& context_type) const 659{ 660 gchar* c_context_type = nullptr; 661 bool ret = gst_message_parse_context_type(const_cast<GstMessage*>(gobj()), 662 const_cast<const gchar**>(&c_context_type)); 663 context_type = c_context_type; 664 if(c_context_type) 665 g_free(c_context_type); 666 return ret; 667} 668 669Gst::ClockTime MessageResetTime::parse_running_time() const 670{ 671 GstClockTime running_time; 672 gst_message_parse_reset_time(const_cast<GstMessage*>(gobj()), 673 &running_time); 674 return static_cast<GstClockTime>(running_time); 675} 676 677void MessageToc::parse(Glib::RefPtr<Gst::Toc>& toc, bool& updated) const 678{ 679 GstToc* c_toc; 680 gboolean c_updated; 681 gst_message_parse_toc(const_cast<GstMessage*>(gobj()), &c_toc, &c_updated); 682 toc = Glib::wrap(c_toc, true); 683 updated = updated; 684} 685 686void MessageProgress::parse(Gst::ProgressType& type, Glib::ustring& code, Glib::ustring& text) const 687{ 688 GstProgressType c_type; 689 gchar* c_code, * c_text; 690 gst_message_parse_progress(const_cast<GstMessage*>(gobj()), &c_type, &c_code, &c_text); 691 code = c_code; 692 text = c_text; 693 if(c_code) 694 g_free(c_code); 695 if(c_text) 696 g_free(c_text); 697 type = static_cast<Gst::ProgressType>(c_type); 698} 699 700Gst::ProgressType MessageProgress::parse_type() const 701{ 702 GstProgressType c_type; 703 704 gst_message_parse_progress(const_cast<GstMessage*>(gobj()), 705 &c_type, nullptr, nullptr); 706 707 return static_cast<Gst::ProgressType>(c_type); 708} 709 710Glib::ustring MessageProgress::parse_code() const 711{ 712 gchar* c_code; 713 Glib::ustring code; 714 715 gst_message_parse_progress(const_cast<GstMessage*>(gobj()), 716 nullptr, &c_code, nullptr); 717 718 code = c_code; 719 720 if(c_code) 721 g_free(c_code); 722 723 return code; 724} 725 726Glib::ustring MessageProgress::parse_text() const 727{ 728 gchar* c_text; 729 Glib::ustring text; 730 731 gst_message_parse_progress(const_cast<GstMessage*>(gobj()), 732 nullptr, nullptr, &c_text); 733 734 text = c_text; 735 736 if(c_text) 737 g_free(c_text); 738 739 return text; 740} 741 742} //namespace Gst 743