summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2019-01-30 18:36:51 -0300
committerMathieu Duponchelle <mduponchelle1@gmail.com>2019-01-31 01:20:13 +0000
commita00e917811e2db8bebe093160d19cbffd2c78b10 (patch)
treed7da20762aff4e20b39eac7f6d96b388770e3421 /gst
parent68ae46ae143b28a6b07517f3e9663d3e987ae60e (diff)
downloadgstreamer-plugins-bad-a00e917811e2db8bebe093160d19cbffd2c78b10.tar.gz
testbin: Forward seek to all sources
Diffstat (limited to 'gst')
-rw-r--r--gst/debugutils/gsttestsrcbin.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gst/debugutils/gsttestsrcbin.c b/gst/debugutils/gsttestsrcbin.c
index 26ea9f6f7..aedc818ec 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);