Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Generic glib-signal c++ wrapper
template<typename T>
static T transform(T p) { return p; }
static Glib::RefPtr<Gst::Caps> transform (GstCaps* c) { return Glib::wrap(c, true); }
static Glib::RefPtr<Gst::Pad> transform (GstPad* c) { return Glib::wrap(c, true); }
static Glib::RefPtr<Gst::Element> transform (GstElement* c) { return Glib::wrap(c, true); }
template<class T>
struct deduce_result_type
template<class U, typename=typename U::element_type::BaseObjectType>
static typename U::element_type::BaseObjectType* test (int);
template<class U>
static U test (...);
using type = decltype (test<T> (0));
template<typename SlotType, typename ...T>
static void signal_callback(GstElement* self, T... x,void* data)
using namespace Gst;
Gst::Element* obj = dynamic_cast<Gst::Element*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
template<typename ReturnType, typename ...T>
static Glib::SignalProxy< ReturnType, T... > signal_any(const Glib::RefPtr<Gst::Element>& element, const Glib::ustring name)
static const Glib::SignalProxyInfo TypeFindElement_signal_have_type_info =
(GCallback) &signal_callback<sigc::slot< ReturnType, T...>, typename deduce_result_type<T>::type...>,
(GCallback) &signal_callback<sigc::slot< ReturnType, T...> , typename deduce_result_type<T>::type...>
return Glib::SignalProxy< ReturnType,T...>(element.operator->(), &TypeFindElement_signal_have_type_info);
signal_any<void, guint, Glib::RefPtr<Gst::Caps>>(element_typefind, "have-type").connect([](guint, Glib::RefPtr<Gst::Caps>){std::cout << "Test" << std::endl;});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.