diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2011-11-24 00:38:21 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2011-11-24 00:38:21 +0000 |
commit | e0d4715b7731c2c528eedea6a84b1b28b5d6774b (patch) | |
tree | 195bbaaa5af132841f23786eaf24735065096e57 | |
parent | e3957d141793282518c015a02f81c52b2118b2ff (diff) |
gnl, tests: update for pad probe API changes
But unit tests time out after pad gets blocked,
so still something missing somewhere.
-rw-r--r-- | gnl/gnlcomposition.c | 16 | ||||
-rw-r--r-- | gnl/gnlghostpad.c | 20 | ||||
-rw-r--r-- | gnl/gnlsource.c | 13 | ||||
-rw-r--r-- | tests/check/gnl/common.h | 10 | ||||
-rw-r--r-- | tests/check/gnl/complex.c | 4 | ||||
-rw-r--r-- | tests/check/gnl/gnlcomposition.c | 8 | ||||
-rw-r--r-- | tests/check/gnl/gnloperation.c | 2 | ||||
-rw-r--r-- | tests/check/gnl/gnlsource.c | 4 | ||||
-rw-r--r-- | tests/check/gnl/seek.c | 2 | ||||
-rw-r--r-- | tests/check/gnl/simple.c | 8 |
10 files changed, 46 insertions, 41 deletions
diff --git a/gnl/gnlcomposition.c b/gnl/gnlcomposition.c index 9ad12c7..2a3be81 100644 --- a/gnl/gnlcomposition.c +++ b/gnl/gnlcomposition.c @@ -167,8 +167,8 @@ static GstStateChangeReturn gnl_composition_change_state (GstElement * element, GstStateChange transition); static GstPad *get_src_pad (GstElement * element); -static GstPadProbeReturn pad_blocked (GstPad * pad, GstPadProbeType type, - gpointer type_data, GnlComposition * comp); +static GstPadProbeReturn pad_blocked (GstPad * pad, GstPadProbeInfo * info, + GnlComposition * comp); static inline void gnl_composition_remove_ghostpad (GnlComposition * comp); static gboolean @@ -997,9 +997,10 @@ handle_seek_event (GnlComposition * comp, GstEvent * event) } static gboolean -gnl_composition_event_handler (GstPad * ghostpad, GstEvent * event) +gnl_composition_event_handler (GstPad * ghostpad, GstObject * parent, + GstEvent * event) { - GnlComposition *comp = (GnlComposition *) gst_pad_get_parent (ghostpad); + GnlComposition *comp = (GnlComposition *) parent; GnlCompositionPrivate *priv = comp->priv; gboolean res = TRUE; @@ -1101,7 +1102,7 @@ gnl_composition_event_handler (GstPad * ghostpad, GstEvent * event) * configured at this point*/ if (priv->waitingpads == 0) { GST_DEBUG_OBJECT (comp, "About to call gnl_event_pad_func()"); - res = priv->gnl_event_pad_func (priv->ghostpad, event); + res = priv->gnl_event_pad_func (priv->ghostpad, parent, event); GST_DEBUG_OBJECT (comp, "Done calling gnl_event_pad_func() %d", res); } else gst_event_unref (event); @@ -1116,8 +1117,7 @@ beach: } static GstPadProbeReturn -pad_blocked (GstPad * pad, GstPadProbeType type, gpointer type_data, - GnlComposition * comp) +pad_blocked (GstPad * pad, GstPadProbeInfo * info, GnlComposition * comp) { GST_DEBUG_OBJECT (comp, "Pad : %s:%s", GST_DEBUG_PAD_NAME (pad)); @@ -1211,7 +1211,7 @@ gnl_composition_ghost_pad_set_target (GnlComposition * comp, GstPad * target, if (target && (priv->ghosteventprobe == 0)) { priv->ghosteventprobe = - gst_pad_add_probe (target, GST_PAD_PROBE_TYPE_EVENT, + gst_pad_add_probe (target, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, (GstPadProbeCallback) ghost_event_probe_handler, comp, NULL); GST_DEBUG_OBJECT (comp, "added event probe %d", priv->ghosteventprobe); } diff --git a/gnl/gnlghostpad.c b/gnl/gnlghostpad.c index de9fe8a..f3dee17 100644 --- a/gnl/gnlghostpad.c +++ b/gnl/gnlghostpad.c @@ -303,7 +303,8 @@ translate_incoming_segment (GnlObject * object, GstEvent * event) } static gboolean -internalpad_event_function (GstPad * internal, GstEvent * event) +internalpad_event_function (GstPad * internal, GstObject * parent, + GstEvent * event) { GnlPadPrivate *priv = gst_pad_get_element_private (internal); GnlObject *object = priv->object; @@ -343,7 +344,7 @@ internalpad_event_function (GstPad * internal, GstEvent * event) break; } GST_DEBUG_OBJECT (internal, "Calling priv->eventfunc %p", priv->eventfunc); - res = priv->eventfunc (internal, event); + res = priv->eventfunc (internal, parent, event); return res; } @@ -429,7 +430,8 @@ translate_incoming_duration_query (GnlObject * object, GstQuery * query) } static gboolean -internalpad_query_function (GstPad * internal, GstQuery * query) +internalpad_query_function (GstPad * internal, GstObject * parent, + GstQuery * query) { GnlPadPrivate *priv = gst_pad_get_element_private (internal); GnlObject *object = priv->object; @@ -444,7 +446,7 @@ internalpad_query_function (GstPad * internal, GstQuery * query) return FALSE; } - if ((ret = priv->queryfunc (internal, query))) { + if ((ret = priv->queryfunc (internal, parent, query))) { switch (priv->dir) { case GST_PAD_SRC: @@ -466,7 +468,8 @@ internalpad_query_function (GstPad * internal, GstQuery * query) } static gboolean -ghostpad_event_function (GstPad * ghostpad, GstEvent * event) +ghostpad_event_function (GstPad * ghostpad, GstObject * parent, + GstEvent * event) { GnlPadPrivate *priv; GnlObject *object; @@ -508,7 +511,7 @@ ghostpad_event_function (GstPad * ghostpad, GstEvent * event) if (event) { GST_DEBUG_OBJECT (ghostpad, "Calling priv->eventfunc"); - ret = priv->eventfunc (ghostpad, event); + ret = priv->eventfunc (ghostpad, parent, event); GST_DEBUG_OBJECT (ghostpad, "Returned from calling priv->eventfunc : %d", ret); } @@ -525,7 +528,8 @@ no_function: } static gboolean -ghostpad_query_function (GstPad * ghostpad, GstQuery * query) +ghostpad_query_function (GstPad * ghostpad, GstObject * parent, + GstQuery * query) { GnlPadPrivate *priv = gst_pad_get_element_private (ghostpad); GnlObject *object = GNL_OBJECT (GST_PAD_PARENT (ghostpad)); @@ -538,7 +542,7 @@ ghostpad_query_function (GstPad * ghostpad, GstQuery * query) /* skip duration upstream query, we'll fill it in ourselves */ break; default: - pret = priv->queryfunc (ghostpad, query); + pret = priv->queryfunc (ghostpad, parent, query); } if (pret) { diff --git a/gnl/gnlsource.c b/gnl/gnlsource.c index a3b206a..91e7096 100644 --- a/gnl/gnlsource.c +++ b/gnl/gnlsource.c @@ -79,8 +79,7 @@ static GstStateChangeReturn gnl_source_change_state (GstElement * element, GstStateChange transition); static GstPadProbeReturn -pad_blocked_cb (GstPad * pad, GstPadProbeType probetype, - gpointer udata, GnlSource * source); +pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, GnlSource * source); static gboolean gnl_source_control_element_func (GnlSource * source, GstElement * element); @@ -212,7 +211,8 @@ element_pad_added_cb (GstElement * element G_GNUC_UNUSED, GstPad * pad, return; } - srccaps = gst_pad_get_caps (pad, NULL); + /* FIXME: pass filter caps to query_caps directly */ + srccaps = gst_pad_query_caps (pad, NULL); if (!gst_caps_can_intersect (srccaps, GNL_OBJECT (source)->caps)) { gst_caps_unref (srccaps); GST_DEBUG_OBJECT (source, "Pad doesn't have valid caps, ignoring"); @@ -277,7 +277,8 @@ compare_src_pad (GValue * item, GstCaps * caps) GST_DEBUG_OBJECT (pad, "Trying pad for caps %" GST_PTR_FORMAT, caps); - padcaps = gst_pad_get_caps (pad, NULL); + /* FIXME: can pass the filter caps right away.. */ + padcaps = gst_pad_query_caps (pad, NULL); if (gst_caps_can_intersect (padcaps, caps)) ret = 0; @@ -357,13 +358,13 @@ beach: } static GstPadProbeReturn -pad_blocked_cb (GstPad * pad, GstPadProbeType ptype, gpointer unused_data, - GnlSource * source) +pad_blocked_cb (GstPad * pad, GstPadProbeInfo * info, GnlSource * source) { GST_DEBUG_OBJECT (pad, "probe callback"); if (!source->priv->ghostpad && !source->priv->areblocked) { source->priv->areblocked = TRUE; + GST_DEBUG_OBJECT (pad, "starting thread to call ghost_seek_pad"); g_thread_create ((GThreadFunc) ghost_seek_pad, source, FALSE, NULL); } diff --git a/tests/check/gnl/common.h b/tests/check/gnl/common.h index 1827934..72c8998 100644 --- a/tests/check/gnl/common.h +++ b/tests/check/gnl/common.h @@ -122,12 +122,12 @@ sinkpad_buffer_probe (GstPad * sinkpad, GstBuffer * buffer, CollectStructure * c } static GstPadProbeReturn -sinkpad_probe (GstPad *sinkpad, GstPadProbeType ptype, gpointer data, CollectStructure * collect) +sinkpad_probe (GstPad *sinkpad, GstPadProbeInfo * info, CollectStructure * collect) { - if (ptype & GST_PAD_PROBE_TYPE_BUFFER) - return sinkpad_buffer_probe (sinkpad, (GstBuffer*) data, collect); - if (ptype & GST_PAD_PROBE_TYPE_EVENT) - return sinkpad_event_probe (sinkpad, (GstEvent *) data, collect); + if (info->type & GST_PAD_PROBE_TYPE_BUFFER) + return sinkpad_buffer_probe (sinkpad, (GstBuffer*) info->data, collect); + if (info->type & GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM) + return sinkpad_event_probe (sinkpad, (GstEvent *) info->data, collect); return GST_PAD_PROBE_OK; } diff --git a/tests/check/gnl/complex.c b/tests/check/gnl/complex.c index 2eedb00..14e830b 100644 --- a/tests/check/gnl/complex.c +++ b/tests/check/gnl/complex.c @@ -29,7 +29,7 @@ fill_pipeline_and_check (GstElement * comp, GList * segments) G_CALLBACK (composition_pad_added_cb), collect); sinkpad = gst_element_get_static_pad (sink, "sink"); - gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA, + gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM, (GstPadProbeCallback) sinkpad_probe, collect, NULL); bus = gst_element_get_bus (GST_ELEMENT (pipeline)); @@ -535,7 +535,7 @@ GST_START_TEST (test_renegotiation) G_CALLBACK (composition_pad_added_cb), collect); sinkpad = gst_element_get_static_pad (sink, "sink"); - gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA, + gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM, (GstPadProbeCallback) sinkpad_probe, collect, NULL); bus = gst_element_get_bus (GST_ELEMENT (pipeline)); diff --git a/tests/check/gnl/gnlcomposition.c b/tests/check/gnl/gnlcomposition.c index 13319a8..20ac7c3 100644 --- a/tests/check/gnl/gnlcomposition.c +++ b/tests/check/gnl/gnlcomposition.c @@ -30,10 +30,10 @@ static int seek_events; static gulong blockprobeid; static GstPadProbeReturn -on_source1_pad_event_cb (GstPad * pad, GstPadProbeType ptype, - GstEvent * event, gpointer user_data) +on_source1_pad_event_cb (GstPad * pad, GstPadProbeInfo * info, + gpointer user_data) { - if (event->type == GST_EVENT_SEEK) + if (GST_EVENT_TYPE (info->data) == GST_EVENT_SEEK) ++seek_events; return GST_PAD_PROBE_OK; @@ -42,7 +42,7 @@ on_source1_pad_event_cb (GstPad * pad, GstPadProbeType ptype, static void on_source1_pad_added_cb (GstElement * source, GstPad * pad, gpointer user_data) { - gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT, + gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_UPSTREAM, (GstPadProbeCallback) on_source1_pad_event_cb, NULL, NULL); } diff --git a/tests/check/gnl/gnloperation.c b/tests/check/gnl/gnloperation.c index bec3ef0..2ebdf84 100644 --- a/tests/check/gnl/gnloperation.c +++ b/tests/check/gnl/gnloperation.c @@ -29,7 +29,7 @@ fill_pipeline_and_check (GstElement * comp, GList * segments) G_CALLBACK (composition_pad_added_cb), collect); sinkpad = gst_element_get_static_pad (sink, "sink"); - gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA, + gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM, (GstPadProbeCallback) sinkpad_probe, collect, NULL); bus = gst_element_get_bus (GST_ELEMENT (pipeline)); diff --git a/tests/check/gnl/gnlsource.c b/tests/check/gnl/gnlsource.c index 41bf6db..1325a09 100644 --- a/tests/check/gnl/gnlsource.c +++ b/tests/check/gnl/gnlsource.c @@ -44,7 +44,7 @@ GST_START_TEST (test_simple_videotestsrc) sinkpad = gst_element_get_static_pad (sink, "sink"); fail_if (sinkpad == NULL); - gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA, + gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM, (GstPadProbeCallback) sinkpad_probe, collect, NULL); bus = gst_element_get_bus (pipeline); @@ -145,7 +145,7 @@ GST_START_TEST (test_videotestsrc_in_bin) sinkpad = gst_element_get_static_pad (sink, "sink"); fail_if (sinkpad == NULL); - gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA, + gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM, (GstPadProbeCallback) sinkpad_probe, collect, NULL); bus = gst_element_get_bus (pipeline); diff --git a/tests/check/gnl/seek.c b/tests/check/gnl/seek.c index 0547b26..be5c96c 100644 --- a/tests/check/gnl/seek.c +++ b/tests/check/gnl/seek.c @@ -51,7 +51,7 @@ fill_pipeline_and_check (GstElement * comp, GList * segments, GList * seeks) G_CALLBACK (composition_pad_added_cb), collect); sinkpad = gst_element_get_static_pad (sink, "sink"); - gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_EVENT, + gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, (GstPadProbeCallback) sinkpad_probe, collect, NULL); bus = gst_element_get_bus (GST_ELEMENT (pipeline)); diff --git a/tests/check/gnl/simple.c b/tests/check/gnl/simple.c index ee25309..0a11725 100644 --- a/tests/check/gnl/simple.c +++ b/tests/check/gnl/simple.c @@ -62,7 +62,7 @@ test_simplest_full (gboolean async) G_CALLBACK (composition_pad_added_cb), collect); sinkpad = gst_element_get_static_pad (sink, "sink"); - gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA, + gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM, (GstPadProbeCallback) sinkpad_probe, collect, NULL); bus = gst_element_get_bus (GST_ELEMENT (pipeline)); @@ -339,7 +339,7 @@ test_one_after_other_full (gboolean async) G_CALLBACK (composition_pad_added_cb), collect); sinkpad = gst_element_get_static_pad (sink, "sink"); - gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA, + gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM, (GstPadProbeCallback) sinkpad_probe, collect, NULL); bus = gst_element_get_bus (GST_ELEMENT (pipeline)); @@ -539,7 +539,7 @@ test_one_under_another_full (gboolean async) G_CALLBACK (composition_pad_added_cb), collect); sinkpad = gst_element_get_static_pad (sink, "sink"); - gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA, + gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM, (GstPadProbeCallback) sinkpad_probe, collect, NULL); bus = gst_element_get_bus (GST_ELEMENT (pipeline)); @@ -687,7 +687,7 @@ test_one_bin_after_other_full (gboolean async) G_CALLBACK (composition_pad_added_cb), collect); sinkpad = gst_element_get_static_pad (sink, "sink"); - gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA, + gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM, (GstPadProbeCallback) sinkpad_probe, collect, NULL); bus = gst_element_get_bus (GST_ELEMENT (pipeline)); |