testbin: Forward seek to all sources

This commit is contained in:
Thibault Saunier 2019-01-30 18:36:51 -03:00 committed by Mathieu Duponchelle
parent 68ae46ae14
commit a00e917811

View file

@ -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);