summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-03-18 09:36:35 +0100
committerSebastian Dröge <sebastian@centricular.com>2015-03-18 09:37:47 +0100
commit78bdbadc4eb3c555d810f0c71cc3c1725749e025 (patch)
treea3f8be81fa2ac883257bbe2cc5e3a3f2d06df543
parent187570aded5be17223cb6ac567d2b96d49306c72 (diff)
funnel: Add support for buffer lists
-rw-r--r--plugins/elements/gstfunnel.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/plugins/elements/gstfunnel.c b/plugins/elements/gstfunnel.c
index 6c6af2baa..048a90e40 100644
--- a/plugins/elements/gstfunnel.c
+++ b/plugins/elements/gstfunnel.c
@@ -112,6 +112,8 @@ static void gst_funnel_release_pad (GstElement * element, GstPad * pad);
static GstFlowReturn gst_funnel_sink_chain (GstPad * pad, GstObject * parent,
GstBuffer * buffer);
+static GstFlowReturn gst_funnel_sink_chain_list (GstPad * pad,
+ GstObject * parent, GstBufferList * list);
static gboolean gst_funnel_sink_event (GstPad * pad, GstObject * parent,
GstEvent * event);
@@ -183,6 +185,8 @@ gst_funnel_request_new_pad (GstElement * element, GstPadTemplate * templ,
gst_pad_set_chain_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_funnel_sink_chain));
+ gst_pad_set_chain_list_function (sinkpad,
+ GST_DEBUG_FUNCPTR (gst_funnel_sink_chain_list));
gst_pad_set_event_function (sinkpad,
GST_DEBUG_FUNCPTR (gst_funnel_sink_event));
@@ -261,12 +265,13 @@ forward_events (GstPad * pad, GstEvent ** event, gpointer user_data)
}
static GstFlowReturn
-gst_funnel_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+gst_funnel_sink_chain_object (GstPad * pad, GstFunnel * funnel,
+ gboolean is_list, GstMiniObject * obj)
{
GstFlowReturn res;
- GstFunnel *funnel = GST_FUNNEL (parent);
- GST_DEBUG_OBJECT (funnel, "received buffer %p", buffer);
+ GST_DEBUG_OBJECT (funnel, "received buffer%s %p", (is_list ? "list" : ""),
+ obj);
GST_PAD_STREAM_LOCK (funnel->srcpad);
@@ -277,15 +282,38 @@ gst_funnel_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
gst_pad_sticky_events_foreach (pad, forward_events, funnel->srcpad);
}
- res = gst_pad_push (funnel->srcpad, buffer);
+ if (is_list)
+ res = gst_pad_push_list (funnel->srcpad, GST_BUFFER_LIST_CAST (obj));
+ else
+ res = gst_pad_push (funnel->srcpad, GST_BUFFER_CAST (obj));
GST_PAD_STREAM_UNLOCK (funnel->srcpad);
- GST_LOG_OBJECT (funnel, "handled buffer %s", gst_flow_get_name (res));
+ GST_LOG_OBJECT (funnel, "handled buffer%s %s", (is_list ? "list" : ""),
+ gst_flow_get_name (res));
return res;
}
+static GstFlowReturn
+gst_funnel_sink_chain_list (GstPad * pad, GstObject * parent,
+ GstBufferList * list)
+{
+ GstFunnel *funnel = GST_FUNNEL (parent);
+
+ return gst_funnel_sink_chain_object (pad, funnel, TRUE,
+ GST_MINI_OBJECT_CAST (list));
+}
+
+static GstFlowReturn
+gst_funnel_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
+{
+ GstFunnel *funnel = GST_FUNNEL (parent);
+
+ return gst_funnel_sink_chain_object (pad, funnel, FALSE,
+ GST_MINI_OBJECT_CAST (buffer));
+}
+
static gboolean
gst_funnel_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
{