mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
pad: rework pad probes
Make a separate cookie to detect chancges in the list of probes and keeping track of what hooks have been invoked yet. Remove the requirement to have probes on srcpads in push mode and sinkpads in pull mode. Add some more debug. Keep track of what callbacks got executed. If no callback is called and we are a blocking pad, let the item pass. This allows you to block pads on selected items only. Explicitly have an UPSTREAM and DOWNSTREAM PadProbeType. This allows you to only block the pad on upstream or downstream items. Add convenience macros to only block on downstream/upstream items.
This commit is contained in:
parent
ea71090002
commit
24e596a1fb
10 changed files with 111 additions and 93 deletions
120
gst/gstpad.c
120
gst/gstpad.c
|
@ -110,7 +110,8 @@ struct _GstPadPrivate
|
|||
PadEvent events[GST_EVENT_MAX_STICKY];
|
||||
|
||||
gint using;
|
||||
gint probe_cookie;
|
||||
guint probe_list_cookie;
|
||||
guint probe_cookie;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
|
@ -126,8 +127,9 @@ typedef struct
|
|||
GstPad *pad;
|
||||
GstPadProbeType mask;
|
||||
gpointer type_data;
|
||||
GstPadProbeReturn ret;
|
||||
gboolean dropped;
|
||||
gboolean pass;
|
||||
gboolean marshalled;
|
||||
guint cookie;
|
||||
} ProbeMarshall;
|
||||
|
||||
|
@ -1048,11 +1050,6 @@ gst_pad_is_active (GstPad * pad)
|
|||
* Be notified of different states of pads. The provided callback is called for
|
||||
* every state that matches @mask.
|
||||
*
|
||||
* <note>
|
||||
* Pad probe handlers are only called for source pads in push mode
|
||||
* and sink pads in pull mode.
|
||||
* </note>
|
||||
*
|
||||
* Returns: an id or 0 on error. The id can be used to remove the probe with
|
||||
* gst_pad_remove_probe().
|
||||
*
|
||||
|
@ -1071,18 +1068,6 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask,
|
|||
|
||||
GST_OBJECT_LOCK (pad);
|
||||
|
||||
/* FIXME : I'm not checking for != GST_PAD_ACTIVATE_correct_direction
|
||||
* because the pad might not be activated yet.
|
||||
* This means that _add_probe() might return a valid probeid ...
|
||||
* which will potentially never be called if the pad
|
||||
* is activated in the wrong direction */
|
||||
if (G_UNLIKELY ((mask & GST_PAD_PROBE_TYPE_PUSH) &&
|
||||
(GST_PAD_ACTIVATE_MODE (pad) == GST_PAD_ACTIVATE_PULL)))
|
||||
goto wrong_direction;
|
||||
if (G_UNLIKELY ((mask & GST_PAD_PROBE_TYPE_PULL) &&
|
||||
(GST_PAD_ACTIVATE_MODE (pad) == GST_PAD_ACTIVATE_PUSH)))
|
||||
goto wrong_direction;
|
||||
|
||||
/* make a new probe */
|
||||
hook = g_hook_alloc (&pad->probes);
|
||||
|
||||
|
@ -1091,8 +1076,8 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask,
|
|||
|
||||
/* when no contraints are given for the types, assume all types are
|
||||
* acceptable */
|
||||
if ((mask & GST_PAD_PROBE_TYPE_DATA) == 0)
|
||||
mask |= GST_PAD_PROBE_TYPE_DATA;
|
||||
if ((mask & GST_PAD_PROBE_TYPE_DATA_BOTH) == 0)
|
||||
mask |= GST_PAD_PROBE_TYPE_DATA_BOTH;
|
||||
if ((mask & GST_PAD_PROBE_TYPE_SCHEDULING) == 0)
|
||||
mask |= GST_PAD_PROBE_TYPE_SCHEDULING;
|
||||
|
||||
|
@ -1101,14 +1086,13 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask,
|
|||
hook->func = callback;
|
||||
hook->data = user_data;
|
||||
hook->destroy = destroy_data;
|
||||
PROBE_COOKIE (hook) = 0;
|
||||
|
||||
/* incremenent cookie so that the new hook get's called */
|
||||
pad->priv->probe_cookie++;
|
||||
PROBE_COOKIE (hook) = (pad->priv->probe_cookie - 1);
|
||||
|
||||
/* add the probe */
|
||||
g_hook_prepend (&pad->probes, hook);
|
||||
pad->num_probes++;
|
||||
/* incremenent cookie so that the new hook get's called */
|
||||
pad->priv->probe_list_cookie++;
|
||||
|
||||
/* get the id of the hook, we return this and it can be used to remove the
|
||||
* probe later */
|
||||
|
@ -1145,15 +1129,6 @@ gst_pad_add_probe (GstPad * pad, GstPadProbeType mask,
|
|||
GST_OBJECT_UNLOCK (pad);
|
||||
}
|
||||
return res;
|
||||
|
||||
wrong_direction:
|
||||
{
|
||||
GST_CAT_INFO_OBJECT (GST_CAT_SCHEDULING, pad, "pad block on the wrong pad, "
|
||||
"block src pads in push mode and sink pads in pull mode.");
|
||||
GST_OBJECT_UNLOCK (pad);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -3349,24 +3324,31 @@ probe_hook_marshal (GHook * hook, ProbeMarshall * data)
|
|||
GstPadProbeCallback callback;
|
||||
GstPadProbeReturn ret;
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||
"hook %lu, cookie %u checking", hook->hook_id, PROBE_COOKIE (hook));
|
||||
|
||||
/* if we have called this callback, do nothing */
|
||||
if (PROBE_COOKIE (hook) == data->cookie)
|
||||
if (PROBE_COOKIE (hook) == data->cookie) {
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||
"hook %lu, cookie %u already called", hook->hook_id,
|
||||
PROBE_COOKIE (hook));
|
||||
return;
|
||||
}
|
||||
|
||||
PROBE_COOKIE (hook) = data->cookie;
|
||||
|
||||
flags = hook->flags >> G_HOOK_FLAG_USER_SHIFT;
|
||||
|
||||
/* one of the data types */
|
||||
if ((flags & GST_PAD_PROBE_TYPE_DATA & data->mask) == 0)
|
||||
return;
|
||||
if ((flags & GST_PAD_PROBE_TYPE_DATA_BOTH & data->mask) == 0)
|
||||
goto no_match;
|
||||
/* one of the scheduling types */
|
||||
if ((flags & GST_PAD_PROBE_TYPE_SCHEDULING & data->mask) == 0)
|
||||
return;
|
||||
goto no_match;
|
||||
/* all of the blocking types must match */
|
||||
if ((flags & GST_PAD_PROBE_TYPE_BLOCKING) !=
|
||||
(data->mask & GST_PAD_PROBE_TYPE_BLOCKING))
|
||||
return;
|
||||
goto no_match;
|
||||
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||
"hook %lu with flags 0x%08x matches", hook->hook_id, flags);
|
||||
|
@ -3380,6 +3362,7 @@ probe_hook_marshal (GHook * hook, ProbeMarshall * data)
|
|||
ret = callback (pad, data->mask, data->type_data, hook->data);
|
||||
|
||||
GST_OBJECT_LOCK (pad);
|
||||
data->marshalled = TRUE;
|
||||
|
||||
switch (ret) {
|
||||
case GST_PAD_PROBE_REMOVE:
|
||||
|
@ -3392,7 +3375,7 @@ probe_hook_marshal (GHook * hook, ProbeMarshall * data)
|
|||
* anymore */
|
||||
GST_DEBUG_OBJECT (pad, "asked to drop item");
|
||||
data->mask = GST_PAD_PROBE_TYPE_INVALID;
|
||||
data->ret = GST_PAD_PROBE_DROP;
|
||||
data->dropped = TRUE;
|
||||
break;
|
||||
case GST_PAD_PROBE_PASS:
|
||||
/* inform the pad block to let things pass */
|
||||
|
@ -3403,6 +3386,15 @@ probe_hook_marshal (GHook * hook, ProbeMarshall * data)
|
|||
GST_DEBUG_OBJECT (pad, "probe returned %d", ret);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
no_match:
|
||||
{
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||
"hook %lu with flags 0x%08x does not match %08x", hook->hook_id,
|
||||
flags, data->mask);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#define PROBE_FULL(pad,mask,data,label,defaultval) \
|
||||
|
@ -3423,35 +3415,48 @@ do_probe_callbacks (GstPad * pad, GstPadProbeType mask, gpointer type_data,
|
|||
{
|
||||
ProbeMarshall data;
|
||||
guint cookie;
|
||||
gboolean is_block;
|
||||
|
||||
is_block = (mask & GST_PAD_PROBE_TYPE_BLOCK) == GST_PAD_PROBE_TYPE_BLOCK;
|
||||
|
||||
data.pad = pad;
|
||||
data.mask = mask;
|
||||
data.type_data = type_data;
|
||||
data.ret = GST_PAD_PROBE_OK;
|
||||
data.pass = FALSE;
|
||||
data.cookie = pad->priv->probe_cookie++;
|
||||
data.marshalled = FALSE;
|
||||
data.dropped = FALSE;
|
||||
data.cookie = ++pad->priv->probe_cookie;
|
||||
|
||||
again:
|
||||
cookie = pad->priv->probe_cookie;
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||
"do probes cookie %u", data.cookie);
|
||||
cookie = pad->priv->probe_list_cookie;
|
||||
|
||||
g_hook_list_marshal (&pad->probes, FALSE,
|
||||
g_hook_list_marshal (&pad->probes, TRUE,
|
||||
(GHookMarshaller) probe_hook_marshal, &data);
|
||||
|
||||
/* if the list changed, call the new callbacks (they will not have their
|
||||
* cookie set to data.cookie */
|
||||
if (cookie != pad->priv->probe_cookie) {
|
||||
if (cookie != pad->priv->probe_list_cookie) {
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||
"probe list changed, restarting");
|
||||
goto again;
|
||||
}
|
||||
|
||||
if (data.ret == GST_PAD_PROBE_DROP)
|
||||
/* the first item that dropped will stop the hooks and then we drop here */
|
||||
if (data.dropped)
|
||||
goto dropped;
|
||||
|
||||
/* if no handler matched and we are blocking, let the item pass */
|
||||
if (!data.marshalled && is_block)
|
||||
goto passed;
|
||||
|
||||
/* At this point, all handlers returned either OK or PASS. If one handler
|
||||
* returned PASS, let the item pass */
|
||||
if (data.pass)
|
||||
goto passed;
|
||||
|
||||
if (mask & GST_PAD_PROBE_TYPE_BLOCK) {
|
||||
if (is_block) {
|
||||
while (GST_PAD_IS_BLOCKED (pad)) {
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
|
||||
"we are blocked %d times", pad->num_blocked);
|
||||
|
@ -4233,11 +4238,17 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
|
|||
GstPad *peerpad;
|
||||
gboolean result;
|
||||
gboolean stored = FALSE;
|
||||
GstPadProbeType type;
|
||||
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_EVENT (event), FALSE);
|
||||
|
||||
if (GST_EVENT_IS_DOWNSTREAM (event))
|
||||
type = GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM;
|
||||
else
|
||||
type = GST_PAD_PROBE_TYPE_EVENT_UPSTREAM;
|
||||
|
||||
GST_OBJECT_LOCK (pad);
|
||||
|
||||
peerpad = GST_PAD_PEER (pad);
|
||||
|
@ -4332,16 +4343,15 @@ gst_pad_push_event (GstPad * pad, GstEvent * event)
|
|||
if (G_UNLIKELY (GST_PAD_IS_FLUSHING (pad)))
|
||||
goto flushed;
|
||||
|
||||
PROBE (pad, GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_EVENT
|
||||
| GST_PAD_PROBE_TYPE_BLOCK, event, probe_stopped);
|
||||
PROBE (pad, type | GST_PAD_PROBE_TYPE_PUSH |
|
||||
GST_PAD_PROBE_TYPE_BLOCK, event, probe_stopped);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* send probes after modifying the events above */
|
||||
PROBE (pad, GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_EVENT, event,
|
||||
probe_stopped);
|
||||
PROBE (pad, type | GST_PAD_PROBE_TYPE_PUSH, event, probe_stopped);
|
||||
|
||||
/* now check the peer pad */
|
||||
if (peerpad == NULL)
|
||||
|
@ -4433,6 +4443,7 @@ gst_pad_send_event (GstPad * pad, GstEvent * event)
|
|||
GstFlowReturn ret;
|
||||
gboolean result = FALSE;
|
||||
gboolean serialized, need_unlock = FALSE, needs_events, sticky;
|
||||
GstPadProbeType type;
|
||||
|
||||
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
|
||||
g_return_val_if_fail (event != NULL, FALSE);
|
||||
|
@ -4443,11 +4454,13 @@ gst_pad_send_event (GstPad * pad, GstEvent * event)
|
|||
goto wrong_direction;
|
||||
serialized = GST_EVENT_IS_SERIALIZED (event);
|
||||
sticky = GST_EVENT_IS_STICKY (event);
|
||||
type = GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM;
|
||||
} else if (GST_PAD_IS_SRC (pad)) {
|
||||
if (G_UNLIKELY (!GST_EVENT_IS_UPSTREAM (event)))
|
||||
goto wrong_direction;
|
||||
/* events on srcpad never are serialized and sticky */
|
||||
serialized = sticky = FALSE;
|
||||
type = GST_PAD_PROBE_TYPE_EVENT_UPSTREAM;
|
||||
} else
|
||||
goto unknown_direction;
|
||||
|
||||
|
@ -4545,11 +4558,10 @@ gst_pad_send_event (GstPad * pad, GstEvent * event)
|
|||
goto flushing;
|
||||
|
||||
PROBE (pad,
|
||||
GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_EVENT |
|
||||
type | GST_PAD_PROBE_TYPE_PUSH |
|
||||
GST_PAD_PROBE_TYPE_BLOCK, event, probe_stopped);
|
||||
|
||||
PROBE (pad, GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_EVENT, event,
|
||||
probe_stopped);
|
||||
PROBE (pad, type | GST_PAD_PROBE_TYPE_PUSH, event, probe_stopped);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
35
gst/gstpad.h
35
gst/gstpad.h
|
@ -472,7 +472,8 @@ typedef gboolean (*GstPadForwardFunction) (GstPad *pad, gpointer user_data);
|
|||
* @GST_PAD_PROBE_TYPE_BLOCK: probe and block pads
|
||||
* @GST_PAD_PROBE_TYPE_BUFFER: probe buffers
|
||||
* @GST_PAD_PROBE_TYPE_BUFFER_LIST: probe buffer lists
|
||||
* @GST_PAD_PROBE_TYPE_EVENT: probe events
|
||||
* @GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM: probe downstream events
|
||||
* @GST_PAD_PROBE_TYPE_EVENT_UPSTREAM: probe upstream events
|
||||
* @GST_PAD_PROBE_TYPE_PUSH: probe push
|
||||
* @GST_PAD_PROBE_TYPE_PULL: probe pull
|
||||
*
|
||||
|
@ -482,23 +483,31 @@ typedef gboolean (*GstPadForwardFunction) (GstPad *pad, gpointer user_data);
|
|||
*/
|
||||
typedef enum
|
||||
{
|
||||
GST_PAD_PROBE_TYPE_INVALID = 0,
|
||||
GST_PAD_PROBE_TYPE_INVALID = 0,
|
||||
/* flags to control blocking */
|
||||
GST_PAD_PROBE_TYPE_IDLE = (1 << 0),
|
||||
GST_PAD_PROBE_TYPE_BLOCK = (1 << 1),
|
||||
GST_PAD_PROBE_TYPE_IDLE = (1 << 0),
|
||||
GST_PAD_PROBE_TYPE_BLOCK = (1 << 1),
|
||||
/* flags to select datatypes */
|
||||
GST_PAD_PROBE_TYPE_BUFFER = (1 << 2),
|
||||
GST_PAD_PROBE_TYPE_BUFFER_LIST = (1 << 3),
|
||||
GST_PAD_PROBE_TYPE_EVENT = (1 << 4),
|
||||
GST_PAD_PROBE_TYPE_BUFFER = (1 << 2),
|
||||
GST_PAD_PROBE_TYPE_BUFFER_LIST = (1 << 3),
|
||||
GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM = (1 << 4),
|
||||
GST_PAD_PROBE_TYPE_EVENT_UPSTREAM = (1 << 5),
|
||||
/* flags to select scheduling mode */
|
||||
GST_PAD_PROBE_TYPE_PUSH = (1 << 5),
|
||||
GST_PAD_PROBE_TYPE_PULL = (1 << 6),
|
||||
GST_PAD_PROBE_TYPE_PUSH = (1 << 6),
|
||||
GST_PAD_PROBE_TYPE_PULL = (1 << 7),
|
||||
} GstPadProbeType;
|
||||
|
||||
#define GST_PAD_PROBE_TYPE_BLOCKING (GST_PAD_PROBE_TYPE_IDLE | GST_PAD_PROBE_TYPE_BLOCK)
|
||||
#define GST_PAD_PROBE_TYPE_DATA (GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_EVENT | \
|
||||
GST_PAD_PROBE_TYPE_BUFFER_LIST)
|
||||
#define GST_PAD_PROBE_TYPE_SCHEDULING (GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_PULL)
|
||||
#define GST_PAD_PROBE_TYPE_BLOCKING (GST_PAD_PROBE_TYPE_IDLE | GST_PAD_PROBE_TYPE_BLOCK)
|
||||
#define GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM (GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM)
|
||||
#define GST_PAD_PROBE_TYPE_BLOCK_UPSTREAM (GST_PAD_PROBE_TYPE_BLOCK | GST_PAD_PROBE_TYPE_DATA_UPSTREAM)
|
||||
#define GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM (GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST | \
|
||||
GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM)
|
||||
#define GST_PAD_PROBE_TYPE_DATA_UPSTREAM (GST_PAD_PROBE_TYPE_EVENT_UPSTREAM)
|
||||
#define GST_PAD_PROBE_TYPE_DATA_BOTH (GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM | \
|
||||
GST_PAD_PROBE_TYPE_DATA_UPSTREAM)
|
||||
#define GST_PAD_PROBE_TYPE_EVENT_BOTH (GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM | \
|
||||
GST_PAD_PROBE_TYPE_EVENT_UPSTREAM)
|
||||
#define GST_PAD_PROBE_TYPE_SCHEDULING (GST_PAD_PROBE_TYPE_PUSH | GST_PAD_PROBE_TYPE_PULL)
|
||||
|
||||
/**
|
||||
* GstPadProbeReturn:
|
||||
|
|
|
@ -120,7 +120,7 @@ gst_consistency_checker_new (GstPad * pad)
|
|||
consist = g_new0 (GstStreamConsistency, 1);
|
||||
consist->pad = g_object_ref (pad);
|
||||
consist->probeid =
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_DATA,
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_DATA_DOWNSTREAM,
|
||||
(GstPadProbeCallback) source_pad_data_cb, consist, NULL);
|
||||
|
||||
return consist;
|
||||
|
|
|
@ -76,7 +76,7 @@ setup_output_pad (GstElement * element, GstStaticPadTemplate * tmpl)
|
|||
|
||||
/* add probe */
|
||||
probe_id =
|
||||
gst_pad_add_probe (output_pad, GST_PAD_PROBE_TYPE_DATA,
|
||||
gst_pad_add_probe (output_pad, GST_PAD_PROBE_TYPE_DATA_BOTH,
|
||||
(GstPadProbeCallback) probe_cb, NULL, NULL);
|
||||
g_object_set_data (G_OBJECT (output_pad), "probe_id",
|
||||
GINT_TO_POINTER (probe_id));
|
||||
|
@ -317,7 +317,7 @@ run_input_selector_buffer_count (gint num_input_pads,
|
|||
}
|
||||
/* add probe */
|
||||
probe_id =
|
||||
gst_pad_add_probe (output_pad, GST_PAD_PROBE_TYPE_DATA,
|
||||
gst_pad_add_probe (output_pad, GST_PAD_PROBE_TYPE_DATA_BOTH,
|
||||
(GstPadProbeCallback) probe_cb, NULL, NULL);
|
||||
g_object_set_data (G_OBJECT (output_pad), "probe_id",
|
||||
GINT_TO_POINTER (probe_id));
|
||||
|
|
|
@ -772,9 +772,6 @@ pad_blocked_cb (GstPad * pad, GstPadProbeType type, gpointer type_data,
|
|||
g_cond_signal (blocked_cond);
|
||||
g_mutex_unlock (blocked_lock);
|
||||
|
||||
if (GST_IS_EVENT (type_data) && GST_EVENT_IS_UPSTREAM (type_data))
|
||||
return GST_PAD_PROBE_PASS;
|
||||
|
||||
return GST_PAD_PROBE_OK;
|
||||
}
|
||||
|
||||
|
@ -806,8 +803,8 @@ GST_START_TEST (test_add_live2)
|
|||
GST_DEBUG ("blocking srcpad");
|
||||
/* block source pad */
|
||||
srcpad = gst_element_get_static_pad (src, "src");
|
||||
id = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_BLOCK, pad_blocked_cb,
|
||||
NULL, NULL);
|
||||
id = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_BLOCK_DOWNSTREAM,
|
||||
pad_blocked_cb, NULL, NULL);
|
||||
|
||||
/* set source to PAUSED without adding it to the pipeline */
|
||||
ret = gst_element_set_state (src, GST_STATE_PAUSED);
|
||||
|
|
|
@ -488,11 +488,11 @@ GST_START_TEST (send_custom_events)
|
|||
|
||||
/* add pad-probes to faksrc.src and fakesink.sink */
|
||||
fail_if ((srcpad = gst_element_get_static_pad (fakesrc, "src")) == NULL);
|
||||
gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT,
|
||||
gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT_BOTH,
|
||||
event_probe, GINT_TO_POINTER (TRUE), NULL);
|
||||
|
||||
fail_if ((sinkpad = gst_element_get_static_pad (fakesink, "sink")) == NULL);
|
||||
gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_EVENT,
|
||||
gst_pad_add_probe (sinkpad, GST_PAD_PROBE_TYPE_EVENT_BOTH,
|
||||
event_probe, GINT_TO_POINTER (FALSE), NULL);
|
||||
|
||||
/* Upstream events */
|
||||
|
|
|
@ -295,7 +295,7 @@ GST_START_TEST (test_push_unlinked)
|
|||
ASSERT_MINI_OBJECT_REFCOUNT (buffer, "buffer", 1);
|
||||
gst_buffer_unref (buffer);
|
||||
|
||||
/* adding a probe that returns FALSE will drop the buffer without trying
|
||||
/* adding a probe that returns _DROP will drop the buffer without trying
|
||||
* to chain */
|
||||
id = gst_pad_add_probe (src, GST_PAD_PROBE_TYPE_BUFFER,
|
||||
(GstPadProbeCallback) _probe_handler, GINT_TO_POINTER (0), NULL);
|
||||
|
@ -306,7 +306,7 @@ GST_START_TEST (test_push_unlinked)
|
|||
gst_buffer_unref (buffer);
|
||||
gst_pad_remove_probe (src, id);
|
||||
|
||||
/* adding a probe that returns TRUE will still chain the buffer,
|
||||
/* adding a probe that returns _OK will still chain the buffer,
|
||||
* and hence drop because pad is unlinked */
|
||||
id = gst_pad_add_probe (src, GST_PAD_PROBE_TYPE_BUFFER,
|
||||
(GstPadProbeCallback) _probe_handler, GINT_TO_POINTER (1), NULL);
|
||||
|
|
|
@ -97,20 +97,20 @@ GST_START_TEST (test_buffer_probe_n_times)
|
|||
pad = gst_element_get_static_pad (fakesink, "sink");
|
||||
|
||||
/* add the probes we need for the test */
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_DATA, data_probe,
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_DATA_BOTH, data_probe,
|
||||
SPECIAL_POINTER (0), NULL);
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER, buffer_probe,
|
||||
SPECIAL_POINTER (1), NULL);
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT, event_probe,
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_BOTH, event_probe,
|
||||
SPECIAL_POINTER (2), NULL);
|
||||
|
||||
/* add some string probes just to test that the data is free'd
|
||||
* properly as it should be */
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_DATA, probe_do_nothing,
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_DATA_BOTH, probe_do_nothing,
|
||||
g_strdup ("data probe string"), (GDestroyNotify) g_free);
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER, probe_do_nothing,
|
||||
g_strdup ("buffer probe string"), (GDestroyNotify) g_free);
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT, probe_do_nothing,
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_BOTH, probe_do_nothing,
|
||||
g_strdup ("event probe string"), (GDestroyNotify) g_free);
|
||||
|
||||
gst_object_unref (pad);
|
||||
|
@ -194,13 +194,13 @@ GST_START_TEST (test_buffer_probe_once)
|
|||
|
||||
pad = gst_element_get_static_pad (fakesink, "sink");
|
||||
id1 =
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_DATA,
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_DATA_BOTH,
|
||||
(GstPadProbeCallback) data_probe_once, &id1, NULL);
|
||||
id2 =
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER,
|
||||
(GstPadProbeCallback) buffer_probe_once, &id2, NULL);
|
||||
id3 =
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT,
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_BOTH,
|
||||
(GstPadProbeCallback) event_probe_once, &id3, NULL);
|
||||
gst_object_unref (pad);
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ GST_START_TEST (basesrc_eos_events_push_live_op)
|
|||
srcpad = gst_element_get_static_pad (src, "src");
|
||||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT,
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT_BOTH,
|
||||
(GstPadProbeCallback) eos_event_counter, &num_eos, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipe);
|
||||
|
@ -155,7 +155,7 @@ GST_START_TEST (basesrc_eos_events_push)
|
|||
srcpad = gst_element_get_static_pad (src, "src");
|
||||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT,
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT_BOTH,
|
||||
(GstPadProbeCallback) eos_event_counter, &num_eos, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipe);
|
||||
|
@ -222,7 +222,7 @@ GST_START_TEST (basesrc_eos_events_pull_live_op)
|
|||
srcpad = gst_element_get_static_pad (src, "src");
|
||||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT,
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT_BOTH,
|
||||
(GstPadProbeCallback) eos_event_counter, &num_eos, NULL);
|
||||
|
||||
gst_element_set_state (pipe, GST_STATE_PLAYING);
|
||||
|
@ -294,7 +294,7 @@ GST_START_TEST (basesrc_eos_events_pull)
|
|||
srcpad = gst_element_get_static_pad (src, "src");
|
||||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT,
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT_BOTH,
|
||||
(GstPadProbeCallback) eos_event_counter, &num_eos, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipe);
|
||||
|
@ -364,7 +364,7 @@ GST_START_TEST (basesrc_eos_events_push_live_eos)
|
|||
srcpad = gst_element_get_static_pad (src, "src");
|
||||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT,
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT_BOTH,
|
||||
(GstPadProbeCallback) eos_event_counter, &num_eos, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipe);
|
||||
|
@ -441,7 +441,7 @@ GST_START_TEST (basesrc_eos_events_pull_live_eos)
|
|||
srcpad = gst_element_get_static_pad (src, "src");
|
||||
fail_unless (srcpad != NULL);
|
||||
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT,
|
||||
probe = gst_pad_add_probe (srcpad, GST_PAD_PROBE_TYPE_EVENT_BOTH,
|
||||
(GstPadProbeCallback) eos_event_counter, &num_eos, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipe);
|
||||
|
@ -535,7 +535,7 @@ GST_START_TEST (basesrc_seek_events_rate_update)
|
|||
probe_pad = gst_element_get_static_pad (sink, "sink");
|
||||
fail_unless (probe_pad != NULL);
|
||||
|
||||
probe = gst_pad_add_probe (probe_pad, GST_PAD_PROBE_TYPE_EVENT,
|
||||
probe = gst_pad_add_probe (probe_pad, GST_PAD_PROBE_TYPE_EVENT_BOTH,
|
||||
(GstPadProbeCallback) segment_event_catcher, &seg_event, NULL);
|
||||
|
||||
/* prepare the seek */
|
||||
|
|
|
@ -71,7 +71,7 @@ GST_START_TEST (test_queue)
|
|||
pad = gst_element_get_static_pad (queue, "sink");
|
||||
fail_unless (pad != NULL);
|
||||
probe =
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT,
|
||||
gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM,
|
||||
(GstPadProbeCallback) modify_caps, filter, NULL);
|
||||
|
||||
bus = gst_element_get_bus (pipeline);
|
||||
|
|
Loading…
Reference in a new issue