[gstreamermm] wrapped {query|event} functions
- From: Marcin Kolny <mkolny src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gstreamermm] wrapped {query|event} functions
- Date: Fri, 4 Oct 2013 09:03:06 +0000 (UTC)
commit 4bcdb15ebd73aed9a2b046c7253e56bd0a7b993b
Author: Marcin Kolny at Flytronic.pl <marcin kolny flytronic pl>
Date: Fri Oct 4 11:02:04 2013 +0200
wrapped {query|event} functions
gstreamer/src/pad.ccg | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
gstreamer/src/pad.hg | 10 ++++++++
2 files changed, 68 insertions(+), 0 deletions(-)
---
diff --git a/gstreamer/src/pad.ccg b/gstreamer/src/pad.ccg
index 6d57f0d..0ada720 100644
--- a/gstreamer/src/pad.ccg
+++ b/gstreamer/src/pad.ccg
@@ -193,12 +193,70 @@ GstFlowReturn Pad_Chain_gstreamermm_callback(GstPad* pad, GstObject* parent, Gst
return GST_FLOW_ERROR;
}
+gboolean Pad_Query_gstreamermm_callback(GstPad* pad, GstObject* parent, GstQuery* query)
+{
+ Gst::Pad *pad_wrapper = dynamic_cast<Gst::Pad*>
+ (static_cast<Glib::ObjectBase*>(
+ Glib::ObjectBase::_get_current_wrapper((GObject*)pad)
+ )
+ );
+ g_assert(pad);
+
+ try
+ {
+ Glib::RefPtr<Query> query_wrapped = Glib::wrap(query, false);
+
+ return pad_wrapper->slot_query(Glib::wrap(pad, true), query_wrapped);
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+
+ return false;
+}
+
+gboolean Pad_Event_gstreamermm_callback(GstPad* pad, GstObject* parent, GstEvent* event)
+{
+ Gst::Pad *pad_wrapper = dynamic_cast<Gst::Pad*>
+ (static_cast<Glib::ObjectBase*>(
+ Glib::ObjectBase::_get_current_wrapper((GObject*)pad)
+ )
+ );
+ g_assert(pad);
+
+ try
+ {
+ Glib::RefPtr<Event> event_wrapped = Glib::wrap(event, false);
+
+ return pad_wrapper->slot_event(Glib::wrap(pad, true), event_wrapped);
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+
+ return false;
+}
+
void Pad::set_chain_function(const SlotChain& slot)
{
slot_chain = slot;
gst_pad_set_chain_function(GST_PAD(gobj()), &Pad_Chain_gstreamermm_callback);
}
+void Pad::set_query_function(const SlotQuery& slot)
+{
+ slot_query = slot;
+ gst_pad_set_query_function(GST_PAD(gobj()), &Pad_Query_gstreamermm_callback);
+}
+
+void Pad::set_event_function(const SlotEvent& slot)
+{
+ slot_event = slot;
+ gst_pad_set_event_function(GST_PAD(gobj()), &Pad_Event_gstreamermm_callback);
+}
+
bool Pad::is_ghost_pad() const
{
return GST_IS_GHOST_PAD(gobj());
diff --git a/gstreamer/src/pad.hg b/gstreamer/src/pad.hg
index 94342ca..cb7e566 100644
--- a/gstreamer/src/pad.hg
+++ b/gstreamer/src/pad.hg
@@ -122,6 +122,10 @@ public:
typedef sigc::slot< Gst::FlowReturn, const Glib::RefPtr<Gst::Pad>&, Glib::RefPtr<Gst::Buffer>& > SlotChain;
+ typedef sigc::slot< gboolean, const Glib::RefPtr<Gst::Pad>&, Glib::RefPtr<Gst::Event>& > SlotEvent;
+
+ typedef sigc::slot< gboolean, const Glib::RefPtr<Gst::Pad>&, Glib::RefPtr<Gst::Query>& > SlotQuery;
+
/** Creates a new pad with the given name in the given direction.
*
* @param name The name of the new pad.
@@ -379,6 +383,10 @@ public:
friend GstFlowReturn Pad_Chain_gstreamermm_callback(GstPad* pad, GstObject* parent, GstBuffer *buffer);
void set_chain_function(const SlotChain& slot);
+ friend gboolean Pad_Event_gstreamermm_callback(GstPad* pad, GstObject* parent, GstEvent* event);
+ void set_event_function(const SlotEvent& slot);
+ friend gboolean Pad_Query_gstreamermm_callback(GstPad* pad, GstObject* parent, GstQuery* query);
+ void set_query_function(const SlotQuery& slot);
//C API specific pad callback setting functions are ignored.
_IGNORE(
@@ -429,6 +437,8 @@ public:
private:
SlotChain slot_chain;
+ SlotEvent slot_event;
+ SlotQuery slot_query;
};
class PadProbeInfo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]