// Generated by gmmproc 2.50.1 -- DO NOT MODIFY! #include #include #include /* gstreamermm - a C++ wrapper for gstreamer * * Copyright 2008-2016 The gstreamermm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include #include #include #include #include namespace Gst { Bin::Bin() : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(nullptr), Element(Glib::ConstructParams(bin_class_.init(), "name",nullptr, nullptr)) {} Glib::RefPtr Bin::add(const Glib::RefPtr& element) { if(!element) gstreamermm_handle_error("Failed to add null element."); GstElement* celement = Glib::unwrap(element); // The following is needed because when adding an element to a bin, the bin // likes to have the last reference and then destroy it when the bin itself // is destroyed. Without the extra reference, when the last Glib::RefPtr<> // to the element goes out of scope, the element may be destroyed before the // bin and GStreamer complains about it. The extra reference to the element // is removed when the bin is destroyed or when the element is removed from // the bin (see gst_bin_remove). if(G_LIKELY(g_object_is_floating(celement))) element->reference(); const bool result = gst_bin_add(gobj(), celement); // If addition successful, return RefPtr<..> to this bin, otherwise throw an // exception if(!result) gstreamermm_handle_error("Failed to add " + element->get_name() + " element."); return Glib::wrap(gobj(), true); } Glib::RefPtr Bin::remove(const Glib::RefPtr& element) { if(!element) gstreamermm_handle_error("Failed to remove null element."); const bool result = gst_bin_remove(gobj(), Glib::unwrap(element)); // If removal successful, return RefPtr<..> to this bin, otherwise throw an // exception if(!result) gstreamermm_handle_error("Failed to remove " + element->get_name() + " element."); return Glib::wrap(gobj(), true); } Glib::RefPtr Bin::add_ghost_pad(const Glib::RefPtr& element, const Glib::ustring& pad_name, const Glib::ustring& name) { Glib::RefPtr static_pad = element->get_static_pad(pad_name); Glib::RefPtr ghost_pad = Gst::GhostPad::create(static_pad, name); add_pad(ghost_pad); return ghost_pad; } } //namespace Gst namespace { static void Bin_signal_element_added_callback(GstBin* self, GstElement* p0,void* data) { using namespace Gst; using SlotType = sigc::slot< void,const Glib::RefPtr& >; auto obj = dynamic_cast(Glib::ObjectBase::_get_current_wrapper((GObject*) self)); // Do not try to call a signal on a disassociated wrapper. if(obj) { try { if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data)) (*static_cast(slot))(Glib::wrap(p0, true) ); } catch(...) { Glib::exception_handlers_invoke(); } } } static const Glib::SignalProxyInfo Bin_signal_element_added_info = { "element-added", (GCallback) &Bin_signal_element_added_callback, (GCallback) &Bin_signal_element_added_callback }; static void Bin_signal_element_removed_callback(GstBin* self, GstElement* p0,void* data) { using namespace Gst; using SlotType = sigc::slot< void,const Glib::RefPtr& >; auto obj = dynamic_cast(Glib::ObjectBase::_get_current_wrapper((GObject*) self)); // Do not try to call a signal on a disassociated wrapper. if(obj) { try { if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data)) (*static_cast(slot))(Glib::wrap(p0, true) ); } catch(...) { Glib::exception_handlers_invoke(); } } } static const Glib::SignalProxyInfo Bin_signal_element_removed_info = { "element-removed", (GCallback) &Bin_signal_element_removed_callback, (GCallback) &Bin_signal_element_removed_callback }; static gboolean Bin_signal_do_latency_callback(GstBin* self, void* data) { using namespace Gst; using SlotType = sigc::slot< bool >; auto obj = dynamic_cast(Glib::ObjectBase::_get_current_wrapper((GObject*) self)); // Do not try to call a signal on a disassociated wrapper. if(obj) { try { if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data)) return static_cast((*static_cast(slot))()); } catch(...) { Glib::exception_handlers_invoke(); } } using RType = gboolean; return RType(); } static gboolean Bin_signal_do_latency_notify_callback(GstBin* self, void* data) { using namespace Gst; using SlotType = sigc::slot< void >; auto obj = dynamic_cast(Glib::ObjectBase::_get_current_wrapper((GObject*) self)); // Do not try to call a signal on a disassociated wrapper. if(obj) { try { if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data)) (*static_cast(slot))(); } catch(...) { Glib::exception_handlers_invoke(); } } using RType = gboolean; return RType(); } static const Glib::SignalProxyInfo Bin_signal_do_latency_info = { "do-latency", (GCallback) &Bin_signal_do_latency_callback, (GCallback) &Bin_signal_do_latency_notify_callback }; } // anonymous namespace // static GType Glib::Value::value_type() { return gst_bin_flags_get_type(); } namespace Glib { Glib::RefPtr wrap(GstBin* object, bool take_copy) { return Glib::RefPtr( dynamic_cast (Glib::wrap_auto ((GObject*)(object), take_copy)) ); //We use dynamic_cast<> in case of multiple inheritance. } } /* namespace Glib */ namespace Gst { /* The *_Class implementation: */ const Glib::Class& Bin_Class::init() { if(!gtype_) // create the GType if necessary { // Glib::Class has to know the class init function to clone custom types. class_init_func_ = &Bin_Class::class_init_function; // This is actually just optimized away, apparently with no harm. // Make sure that the parent type has been created. //CppClassParent::CppObjectType::get_type(); // Create the wrapper type, with the same class/instance size as the base type. register_derived_type(gst_bin_get_type()); // Add derived versions of interfaces, if the C type implements any interfaces: ChildProxy::add_interface(get_type()); } return *this; } void Bin_Class::class_init_function(void* g_class, void* class_data) { const auto klass = static_cast(g_class); CppClassParent::class_init_function(klass, class_data); klass->add_element = &add_element_vfunc_callback; klass->remove_element = &remove_element_vfunc_callback; klass->handle_message = &handle_message_vfunc_callback; klass->element_added = &element_added_callback; klass->element_removed = &element_removed_callback; klass->do_latency = &do_latency_callback; } gboolean Bin_Class::add_element_vfunc_callback(GstBin* self, GstElement* element) { const auto obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { const auto obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { try // Trap C++ exceptions which would normally be lost because this is a C callback. { // Call the virtual member method, which derived classes might override. return static_cast(obj->add_element_vfunc(Glib::wrap(element, true) )); } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->add_element) return (*base->add_element)(self, element); using RType = gboolean; return RType(); } gboolean Bin_Class::remove_element_vfunc_callback(GstBin* self, GstElement* element) { const auto obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { const auto obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { try // Trap C++ exceptions which would normally be lost because this is a C callback. { // Call the virtual member method, which derived classes might override. return static_cast(obj->remove_element_vfunc(Glib::wrap(element, true) )); } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->remove_element) return (*base->remove_element)(self, element); using RType = gboolean; return RType(); } void Bin_Class::handle_message_vfunc_callback(GstBin* self, GstMessage* message) { const auto obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { const auto obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { try // Trap C++ exceptions which would normally be lost because this is a C callback. { // Call the virtual member method, which derived classes might override. obj->handle_message_vfunc(Glib::wrap(message, true) ); return; } catch(...) { Glib::exception_handlers_invoke(); } } } BaseClassType *const base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->handle_message) (*base->handle_message)(self, message); } void Bin_Class::element_added_callback(GstBin* self, GstElement* p0) { const auto obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { const auto obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { try // Trap C++ exceptions which would normally be lost because this is a C callback. { // Call the virtual member method, which derived classes might override. obj->on_element_added(Glib::wrap(p0, true) ); return; } catch(...) { Glib::exception_handlers_invoke(); } } } const auto base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->element_added) (*base->element_added)(self, p0); } void Bin_Class::element_removed_callback(GstBin* self, GstElement* p0) { const auto obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { const auto obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { try // Trap C++ exceptions which would normally be lost because this is a C callback. { // Call the virtual member method, which derived classes might override. obj->on_element_removed(Glib::wrap(p0, true) ); return; } catch(...) { Glib::exception_handlers_invoke(); } } } const auto base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->element_removed) (*base->element_removed)(self, p0); } gboolean Bin_Class::do_latency_callback(GstBin* self) { const auto obj_base = static_cast( Glib::ObjectBase::_get_current_wrapper((GObject*)self)); // Non-gtkmmproc-generated custom classes implicitly call the default // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc- // generated classes can use this optimisation, which avoids the unnecessary // parameter conversions if there is no possibility of the virtual function // being overridden: if(obj_base && obj_base->is_derived_()) { const auto obj = dynamic_cast(obj_base); if(obj) // This can be NULL during destruction. { try // Trap C++ exceptions which would normally be lost because this is a C callback. { // Call the virtual member method, which derived classes might override. return static_cast(obj->on_do_latency()); } catch(...) { Glib::exception_handlers_invoke(); } } } const auto base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class). ); // Call the original underlying C function: if(base && base->do_latency) return (*base->do_latency)(self); using RType = gboolean; return RType(); } Glib::ObjectBase* Bin_Class::wrap_new(GObject* object) { return new Bin((GstBin*)object); } /* The implementation: */ GstBin* Bin::gobj_copy() { reference(); return gobj(); } Bin::Bin(const Glib::ConstructParams& construct_params) : Element(construct_params) { } Bin::Bin(GstBin* castitem) : Element((GstElement*)(castitem)) {} Bin::Bin(Bin&& src) noexcept : Element(std::move(src)) , ChildProxy(std::move(src)) {} Bin& Bin::operator=(Bin&& src) noexcept { Element::operator=(std::move(src)); ChildProxy::operator=(std::move(src)); return *this; } Bin::~Bin() noexcept {} Bin::CppClassType Bin::bin_class_; // initialize static member GType Bin::get_type() { return bin_class_.init().get_type(); } GType Bin::get_base_type() { return gst_bin_get_type(); } Bin::Bin(const Glib::ustring& name) : // Mark this class as non-derived to allow C++ vfuncs to be skipped. Glib::ObjectBase(nullptr), Element(Glib::ConstructParams(bin_class_.init(), "name", name.c_str(), nullptr)) { } Glib::RefPtr Bin::create(const Glib::ustring& name) { return Glib::RefPtr( new Bin(name) ); } Glib::RefPtr Bin::create() { return Glib::RefPtr( new Bin() ); } Glib::RefPtr Bin::get_element(const Glib::ustring& name) { return Glib::wrap(gst_bin_get_by_name(gobj(), name.c_str())); } Glib::RefPtr Bin::get_element(const Glib::ustring& name) const { return const_cast(this)->get_element(name); } Glib::RefPtr Bin::get_element_recurse_up(const Glib::ustring& name) { return Glib::wrap(gst_bin_get_by_name_recurse_up(gobj(), name.c_str())); } Glib::RefPtr Bin::get_element_recurse_up(const Glib::ustring& name) const { return const_cast(this)->get_element_recurse_up(name); } Glib::RefPtr Bin::get_element(GType interface) { return Glib::wrap(gst_bin_get_by_interface(gobj(), interface)); } Glib::RefPtr Bin::get_element(GType interface) const { return const_cast(this)->get_element(interface); } Glib::RefPtr Bin::find_unlinked_pad(PadDirection dir) { return Glib::wrap(gst_bin_find_unlinked_pad(gobj(), ((GstPadDirection)(dir)))); } Glib::RefPtr Bin::find_unlinked_pad(PadDirection dir) const { return const_cast(this)->find_unlinked_pad(dir); } Gst::Iterator Bin::iterate_elements() { return Gst::Iterator(gst_bin_iterate_elements(gobj())); } Gst::Iterator Bin::iterate_elements() const { return Gst::Iterator(gst_bin_iterate_elements(const_cast(gobj()))); } Gst::Iterator Bin::iterate_recurse() { return Gst::Iterator(gst_bin_iterate_recurse(gobj())); } Gst::Iterator Bin::iterate_recurse() const { return Gst::Iterator(gst_bin_iterate_recurse(const_cast(gobj()))); } Gst::Iterator Bin::iterate_sorted() { return Gst::Iterator(gst_bin_iterate_sorted(gobj())); } Gst::Iterator Bin::iterate_sorted() const { return Gst::Iterator(gst_bin_iterate_sorted(const_cast(gobj()))); } Gst::Iterator Bin::iterate_sources() { return Gst::Iterator(gst_bin_iterate_sources(gobj())); } Gst::Iterator Bin::iterate_sources() const { return Gst::Iterator(gst_bin_iterate_sources(const_cast(gobj()))); } Gst::Iterator Bin::iterate_sinks() { return Gst::Iterator(gst_bin_iterate_sinks(gobj())); } Gst::Iterator Bin::iterate_sinks() const { return Gst::Iterator(gst_bin_iterate_sinks(const_cast(gobj()))); } Gst::Iterator Bin::iterate_by_interface(GType iface) { return Gst::Iterator(gst_bin_iterate_all_by_interface(gobj(), iface)); } Gst::Iterator Bin::iterate_by_interface(GType iface) const { return Gst::Iterator(gst_bin_iterate_all_by_interface(const_cast(gobj()), iface)); } bool Bin::sync_children_states() { return gst_bin_sync_children_states(gobj()); } bool Bin::recalculate_latency() { return gst_bin_recalculate_latency(gobj()); } Glib::ListHandle< Glib::RefPtr > Bin::get_children() const { return Glib::ListHandle< Glib::RefPtr >(gobj()->children, Glib::OWNERSHIP_NONE); } guint32 Bin::get_children_cookie() const { return gobj()->children_cookie; } int Bin::get_num_children() const { return gobj()->numchildren; } Glib::RefPtr Bin::get_child_bus() { Glib::RefPtr ref_ptr(Glib::wrap(gobj()->child_bus)); if(ref_ptr) ref_ptr->reference(); return ref_ptr; } Glib::RefPtr Bin::get_child_bus() const { Glib::RefPtr ref_ptr(Glib::wrap(gobj()->child_bus)); if(ref_ptr) ref_ptr->reference(); return ref_ptr; } Glib::ListHandle< Glib::RefPtr > Bin::get_messages() const { return Glib::ListHandle< Glib::RefPtr >(gobj()->messages, Glib::OWNERSHIP_NONE); } bool Bin::get_polling() const { return gobj()->polling; } bool Bin::get_clock_dirty() const { return gobj()->clock_dirty; } Glib::RefPtr Bin::get_provided_clock() { Glib::RefPtr ref_ptr(Glib::wrap(gobj()->provided_clock)); if(ref_ptr) ref_ptr->reference(); return ref_ptr; } Glib::RefPtr Bin::get_provided_clock() const { Glib::RefPtr ref_ptr(Glib::wrap(gobj()->provided_clock)); if(ref_ptr) ref_ptr->reference(); return ref_ptr; } Glib::RefPtr Bin::get_clock_provider() { Glib::RefPtr ref_ptr(Glib::wrap(gobj()->clock_provider)); if(ref_ptr) ref_ptr->reference(); return ref_ptr; } Glib::RefPtr Bin::get_clock_provider() const { Glib::RefPtr ref_ptr(Glib::wrap(gobj()->clock_provider)); if(ref_ptr) ref_ptr->reference(); return ref_ptr; } Glib::SignalProxy< void,const Glib::RefPtr& > Bin::signal_element_added() { return Glib::SignalProxy< void,const Glib::RefPtr& >(this, &Bin_signal_element_added_info); } Glib::SignalProxy< void,const Glib::RefPtr& > Bin::signal_element_removed() { return Glib::SignalProxy< void,const Glib::RefPtr& >(this, &Bin_signal_element_removed_info); } Glib::SignalProxy< bool > Bin::signal_do_latency() { return Glib::SignalProxy< bool >(this, &Bin_signal_do_latency_info); } Glib::PropertyProxy< bool > Bin::property_async_handling() { return Glib::PropertyProxy< bool >(this, "async-handling"); } Glib::PropertyProxy_ReadOnly< bool > Bin::property_async_handling() const { return Glib::PropertyProxy_ReadOnly< bool >(this, "async-handling"); } Glib::PropertyProxy< bool > Bin::property_message_forward() { return Glib::PropertyProxy< bool >(this, "message-forward"); } Glib::PropertyProxy_ReadOnly< bool > Bin::property_message_forward() const { return Glib::PropertyProxy_ReadOnly< bool >(this, "message-forward"); } void Gst::Bin::on_element_added(const Glib::RefPtr& element) { const auto base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->element_added) (*base->element_added)(gobj(),Glib::unwrap(element)); } void Gst::Bin::on_element_removed(const Glib::RefPtr& element) { const auto base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->element_removed) (*base->element_removed)(gobj(),Glib::unwrap(element)); } bool Gst::Bin::on_do_latency() { const auto base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->do_latency) return (*base->do_latency)(gobj()); using RType = bool; return RType(); } bool Gst::Bin::add_element_vfunc(const Glib::RefPtr& element) { const auto base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->add_element) { bool retval((*base->add_element)(gobj(),Glib::unwrap(element))); return retval; } using RType = bool; return RType(); } bool Gst::Bin::remove_element_vfunc(const Glib::RefPtr& element) { const auto base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->remove_element) { bool retval((*base->remove_element)(gobj(),Glib::unwrap(element))); return retval; } using RType = bool; return RType(); } void Gst::Bin::handle_message_vfunc(const Glib::RefPtr& message) { const auto base = static_cast( g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class). ); if(base && base->handle_message) { (*base->handle_message)(gobj(),Glib::unwrap(message)); } } } // namespace Gst