From a00e917811e2db8bebe093160d19cbffd2c78b10 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 30 Jan 2019 18:36:51 -0300 Subject: [PATCH] testbin: Forward seek to all sources --- gst/debugutils/gsttestsrcbin.c | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/gst/debugutils/gsttestsrcbin.c b/gst/debugutils/gsttestsrcbin.c index 26ea9f6f7c..aedc818ec9 100644 --- a/gst/debugutils/gsttestsrcbin.c +++ b/gst/debugutils/gsttestsrcbin.c @@ -195,6 +195,40 @@ gst_test_src_bin_set_element_property (GQuark property_id, const GValue * value, return TRUE; } +typedef struct +{ + GstEvent *event; + gboolean res; + GstObject *parent; +} ForwardEventData; + + +static gboolean +forward_seeks (GstElement * element, GstPad * pad, ForwardEventData * data) +{ + data->res &= + gst_pad_event_default (pad, data->parent, gst_event_ref (data->event)); + + return TRUE; +} + +static gboolean +gst_test_src_event_function (GstPad * pad, GstObject * parent, GstEvent * event) +{ + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_SEEK:{ + ForwardEventData data = { event, TRUE, parent }; + + gst_element_foreach_src_pad (GST_ELEMENT (parent), + (GstElementForeachPadFunc) forward_seeks, &data); + return data.res; + } + default: + break; + } + return gst_pad_event_default (pad, parent, event); +} + static void gst_test_src_bin_setup_src (GstTestSrcBin * self, const gchar * srcfactory, GstStaticPadTemplate * template, GstStreamType stype, @@ -231,6 +265,8 @@ gst_test_src_bin_setup_src (GstTestSrcBin * self, const gchar * srcfactory, gst_flow_combiner_add_pad (self->flow_combiner, ghost); gst_pad_set_chain_function (proxypad, (GstPadChainFunction) gst_test_src_bin_chain); + gst_pad_set_event_function (ghost, + (GstPadEventFunction) gst_test_src_event_function); gst_object_unref (proxypad); gst_element_add_pad (GST_ELEMENT (self), ghost); gst_object_unref (pad);