Commit f91c7539 authored by Wim Taymans's avatar Wim Taymans
Browse files

probes: port to new API for blocking and probes

parent c7428aea
......@@ -409,8 +409,9 @@ gst_discoverer_set_timeout (GstDiscoverer * dc, GstClockTime timeout)
DISCO_UNLOCK (dc);
}
static gboolean
_event_probe (GstPad * pad, GstEvent * event, PrivateStream * ps)
static GstProbeReturn
_event_probe (GstPad * pad, GstProbeType type, GstEvent * event,
PrivateStream * ps)
{
if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) {
GstTagList *tl = NULL, *tmp;
......@@ -434,7 +435,7 @@ _event_probe (GstPad * pad, GstEvent * event, PrivateStream * ps)
DISCO_UNLOCK (ps->dc);
}
return TRUE;
return GST_PROBE_OK;
}
static void
......@@ -497,7 +498,8 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad,
gst_object_unref (sinkpad);
/* Add an event probe */
gst_pad_add_event_probe (pad, G_CALLBACK (_event_probe), ps);
gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT,
(GstPadProbeCallback) _event_probe, ps, NULL);
DISCO_LOCK (dc);
dc->priv->streams = g_list_append (dc->priv->streams, ps);
......@@ -989,8 +991,8 @@ discoverer_collect (GstDiscoverer * dc)
gst_caps_get_structure (dc->priv->current_info->stream_info->caps, 0);
if (g_str_has_prefix (gst_structure_get_name (st), "image/"))
((GstDiscovererVideoInfo *) dc->priv->current_info->
stream_info)->is_image = TRUE;
((GstDiscovererVideoInfo *) dc->priv->current_info->stream_info)->
is_image = TRUE;
}
}
......
......@@ -684,7 +684,7 @@ free_pad_probes (GstDecodeBin * decode_bin)
for (tmp = decode_bin->probes; tmp; tmp = g_list_next (tmp)) {
PadProbeData *data = (PadProbeData *) tmp->data;
gst_pad_remove_data_probe (data->pad, data->sigid);
gst_pad_remove_probe (data->pad, data->sigid);
g_free (data);
}
g_list_free (decode_bin->probes);
......@@ -702,7 +702,7 @@ free_pad_probe_for_element (GstDecodeBin * decode_bin, GstElement * element)
PadProbeData *data = (PadProbeData *) l->data;
if (GST_ELEMENT_CAST (GST_PAD_PARENT (data->pad)) == element) {
gst_pad_remove_data_probe (data->pad, data->sigid);
gst_pad_remove_probe (data->pad, data->sigid);
decode_bin->probes = g_list_delete_link (decode_bin->probes, l);
g_free (data);
return;
......@@ -774,9 +774,12 @@ remove_fakesink (GstDecodeBin * decode_bin)
}
/* this should be implemented with _pad_block() */
static gboolean
pad_probe (GstPad * pad, GstMiniObject * data, GstDecodeBin * decode_bin)
static GstProbeReturn
pad_probe (GstPad * pad, GstProbeType type, gpointer type_data,
gpointer user_data)
{
GstMiniObject *data = type_data;
GstDecodeBin *decode_bin = user_data;
GList *tmp;
gboolean alldone = TRUE;
......@@ -931,9 +934,9 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps,
data->pad = pad;
data->done = FALSE;
/* FIXME, use _pad_block() */
data->sigid = gst_pad_add_data_probe (pad, G_CALLBACK (pad_probe),
decode_bin);
/* FIXME, use pad blocking */
data->sigid = gst_pad_add_probe (pad, GST_PROBE_TYPE_DATA, pad_probe,
decode_bin, NULL);
decode_bin->numwaiting++;
decode_bin->probes = g_list_append (decode_bin->probes, data);
......
......@@ -465,6 +465,8 @@ struct _GstDecodePad
gboolean blocked; /* the *target* pad is blocked */
gboolean exposed; /* the pad is exposed */
gboolean drained; /* an EOS has been seen on the pad */
gulong block_id;
};
GType gst_decode_pad_get_type (void);
......@@ -480,7 +482,8 @@ static void gst_decode_pad_unblock (GstDecodePad * dpad);
static void gst_decode_pad_set_blocked (GstDecodePad * dpad, gboolean blocked);
static void gst_pending_pad_free (GstPendingPad * ppad);
static gboolean pad_event_cb (GstPad * pad, GstEvent * event, gpointer data);
static GstProbeReturn pad_event_cb (GstPad * pad, GstProbeType type,
gpointer type_data, gpointer data);
/********************************
* Standard GObject boilerplate *
......@@ -1614,7 +1617,7 @@ setup_caps_delay:
ppad->pad = gst_object_ref (pad);
ppad->chain = chain;
ppad->event_probe_id =
gst_pad_add_event_probe (pad, (GCallback) pad_event_cb, ppad);
gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, pad_event_cb, ppad, NULL);
chain->pending_pads = g_list_prepend (chain->pending_pads, ppad);
CHAIN_MUTEX_UNLOCK (chain);
g_signal_connect (G_OBJECT (pad), "notify::caps",
......@@ -1841,7 +1844,7 @@ connect_pad (GstDecodeBin * dbin, GstElement * src, GstDecodePad * dpad,
}
g_signal_handlers_disconnect_by_func (pp->pad, caps_notify_cb, chain);
gst_pad_remove_event_probe (pp->pad, pp->event_probe_id);
gst_pad_remove_probe (pp->pad, pp->event_probe_id);
gst_object_unref (pp->pad);
g_slice_free (GstPendingPad, pp);
......@@ -2135,9 +2138,11 @@ exit:
return;
}
static gboolean
pad_event_cb (GstPad * pad, GstEvent * event, gpointer data)
static GstProbeReturn
pad_event_cb (GstPad * pad, GstProbeType type, gpointer type_data,
gpointer data)
{
GstEvent *event = type_data;
GstPendingPad *ppad = (GstPendingPad *) data;
GstDecodeChain *chain = ppad->chain;
GstDecodeBin *dbin = chain->dbin;
......@@ -2159,7 +2164,7 @@ pad_event_cb (GstPad * pad, GstEvent * event, gpointer data)
default:
break;
}
return TRUE;
return GST_PROBE_OK;
}
static void
......@@ -3454,9 +3459,11 @@ gst_decode_pad_init (GstDecodePad * pad)
gst_object_ref_sink (pad);
}
static void
source_pad_blocked_cb (GstPad * pad, GstBlockType type, GstDecodePad * dpad)
static GstProbeReturn
source_pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
gpointer user_data)
{
GstDecodePad *dpad = user_data;
GstDecodeChain *chain;
GstDecodeBin *dbin;
......@@ -3473,11 +3480,17 @@ source_pad_blocked_cb (GstPad * pad, GstBlockType type, GstDecodePad * dpad)
GST_WARNING_OBJECT (dbin, "Couldn't expose group");
}
EXPOSE_UNLOCK (dbin);
return GST_PROBE_OK;
}
static gboolean
source_pad_event_probe (GstPad * pad, GstEvent * event, GstDecodePad * dpad)
static GstProbeReturn
source_pad_event_probe (GstPad * pad, GstProbeType type, gpointer type_data,
gpointer user_data)
{
GstEvent *event = type_data;
GstDecodePad *dpad = user_data;
GST_LOG_OBJECT (pad, "%s dpad:%p", GST_EVENT_TYPE_NAME (event), dpad);
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
......@@ -3489,7 +3502,7 @@ source_pad_event_probe (GstPad * pad, GstEvent * event, GstDecodePad * dpad)
gst_decode_pad_handle_eos (dpad);
}
/* never drop events */
return TRUE;
return GST_PROBE_OK;
}
static void
......@@ -3510,11 +3523,15 @@ gst_decode_pad_set_blocked (GstDecodePad * dpad, gboolean blocked)
* we do not consider/expect it blocked further below, but use other trick */
if (!blocked || !dbin->shutdown) {
if (blocked) {
gst_pad_block (opad, GST_BLOCK_TYPE_DATA,
(GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad),
(GDestroyNotify) gst_object_unref);
if (dpad->block_id == 0)
dpad->block_id = gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK,
source_pad_blocked_cb, gst_object_ref (dpad),
(GDestroyNotify) gst_object_unref);
} else {
gst_pad_unblock (opad);
if (dpad->block_id != 0) {
gst_pad_remove_probe (opad, dpad->block_id);
dpad->block_id = 0;
}
dpad->blocked = FALSE;
}
}
......@@ -3546,8 +3563,8 @@ out:
static void
gst_decode_pad_add_drained_check (GstDecodePad * dpad)
{
gst_pad_add_event_probe (GST_PAD_CAST (dpad),
G_CALLBACK (source_pad_event_probe), dpad);
gst_pad_add_probe (GST_PAD_CAST (dpad), GST_PROBE_TYPE_EVENT,
source_pad_event_probe, dpad, NULL);
}
static void
......@@ -3598,7 +3615,7 @@ gst_pending_pad_free (GstPendingPad * ppad)
g_assert (ppad->pad);
if (ppad->event_probe_id != 0)
gst_pad_remove_event_probe (ppad->pad, ppad->event_probe_id);
gst_pad_remove_probe (ppad->pad, ppad->event_probe_id);
gst_object_unref (ppad->pad);
g_slice_free (GstPendingPad, ppad);
}
......@@ -3675,7 +3692,10 @@ unblock_pads (GstDecodeBin * dbin)
continue;
GST_DEBUG_OBJECT (dpad, "unblocking");
gst_pad_unblock (opad);
if (dpad->block_id != 0) {
gst_pad_remove_probe (opad, dpad->block_id);
dpad->block_id = 0;
}
dpad->blocked = FALSE;
/* make flushing, prevent NOT_LINKED */
GST_PAD_SET_FLUSHING (GST_PAD_CAST (dpad));
......
......@@ -91,8 +91,8 @@ static gboolean has_all_raw_caps (GstPad * pad, gboolean * all_raw);
static gboolean prepare_output (GstPlayBaseBin * play_base_bin);
static void set_active_source (GstPlayBaseBin * play_base_bin,
GstStreamType type, gint source_num);
static gboolean probe_triggered (GstPad * pad, GstEvent * event,
gpointer user_data);
static GstProbeReturn probe_triggered (GstPad * pad, GstProbeType type,
gpointer type_data, gpointer user_data);
static void setup_substreams (GstPlayBaseBin * play_base_bin);
static GstPipelineClass *parent_class;
......@@ -527,9 +527,11 @@ fill_buffer (GstPlayBaseBin * play_base_bin, gint percent)
gst_message_new_buffering (GST_OBJECT_CAST (play_base_bin), percent));
}
static gboolean
check_queue_event (GstPad * pad, GstEvent * event, gpointer user_data)
static GstProbeReturn
check_queue_event (GstPad * pad, GstProbeType type, gpointer type_data,
gpointer user_data)
{
GstEvent *event = type_data;
GstElement *queue = GST_ELEMENT_CAST (user_data);
switch (GST_EVENT_TYPE (event)) {
......@@ -545,11 +547,12 @@ check_queue_event (GstPad * pad, GstEvent * event, gpointer user_data)
GST_DEBUG ("uninteresting event %s", GST_EVENT_TYPE_NAME (event));
break;
}
return TRUE;
return GST_PROBE_OK;
}
static gboolean
check_queue (GstPad * pad, GstBuffer * data, gpointer user_data)
static GstProbeReturn
check_queue (GstPad * pad, GstProbeType type, gpointer type_data,
gpointer user_data)
{
GstElement *queue = GST_ELEMENT_CAST (user_data);
GstPlayBaseBin *play_base_bin = g_object_get_data (G_OBJECT (queue), "pbb");
......@@ -571,7 +574,7 @@ check_queue (GstPad * pad, GstBuffer * data, gpointer user_data)
fill_buffer (play_base_bin, level);
/* continue! */
return TRUE;
return GST_PROBE_OK;
}
/* If a queue overruns and we are buffer in streaming mode (we have a min-time)
......@@ -638,7 +641,7 @@ queue_remove_probe (GstElement * queue, GstPlayBaseBin * play_base_bin)
GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
g_object_set_data (G_OBJECT (queue), "probe", NULL);
gst_pad_remove_buffer_probe (sinkpad, GPOINTER_TO_INT (data));
gst_pad_remove_probe (sinkpad, GPOINTER_TO_INT (data));
} else {
GST_DEBUG_OBJECT (play_base_bin,
"No buffer probe to remove from %s:%s (%p)",
......@@ -753,7 +756,8 @@ queue_out_of_data (GstElement * queue, GstPlayBaseBin * play_base_bin)
guint id;
sinkpad = gst_element_get_static_pad (queue, "sink");
id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), queue);
id = gst_pad_add_probe (sinkpad, GST_PROBE_TYPE_BUFFER, check_queue, queue,
NULL);
g_object_set_data (G_OBJECT (queue), "probe", GINT_TO_POINTER (id));
GST_DEBUG_OBJECT (play_base_bin,
"Re-attaching buffering probe to pad %s:%s %p",
......@@ -878,14 +882,15 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin,
/* give updates on queue size */
sinkpad = gst_element_get_static_pad (preroll, "sink");
id = gst_pad_add_buffer_probe (sinkpad, G_CALLBACK (check_queue), preroll);
id = gst_pad_add_probe (sinkpad, GST_PROBE_TYPE_BUFFER, check_queue,
preroll, NULL);
GST_DEBUG_OBJECT (play_base_bin, "Attaching probe to pad %s:%s (%p)",
GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
g_object_set_data (G_OBJECT (preroll), "probe", GINT_TO_POINTER (id));
/* catch eos and flush events so that we can ignore underruns */
id = gst_pad_add_event_probe (sinkpad, G_CALLBACK (check_queue_event),
preroll);
id = gst_pad_add_probe (sinkpad, GST_PROBE_TYPE_EVENT, check_queue_event,
preroll, NULL);
g_object_set_data (G_OBJECT (preroll), "eos_probe", GINT_TO_POINTER (id));
gst_object_unref (sinkpad);
......@@ -900,7 +905,8 @@ gen_preroll_element (GstPlayBaseBin * play_base_bin,
/* listen for EOS so we can switch groups when one ended. */
preroll_pad = gst_element_get_static_pad (preroll, "src");
gst_pad_add_event_probe (preroll_pad, G_CALLBACK (probe_triggered), info);
gst_pad_add_probe (preroll_pad, GST_PROBE_TYPE_EVENT, probe_triggered, info,
NULL);
gst_object_unref (preroll_pad);
/* add to group list */
......@@ -1159,27 +1165,29 @@ source_no_more_pads (GstElement * element, GstPlayBaseBin * bin)
no_more_pads_full (element, FALSE, bin);
}
static gboolean
probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data)
static GstProbeReturn
probe_triggered (GstPad * pad, GstProbeType type, gpointer type_data,
gpointer user_data)
{
GstEvent *event = type_data;
GstPlayBaseGroup *group;
GstPlayBaseBin *play_base_bin;
GstStreamInfo *info;
GstEventType type;
GstEventType etype;
type = GST_EVENT_TYPE (event);
etype = GST_EVENT_TYPE (event);
GST_LOG ("probe triggered, (%d) %s", type, gst_event_type_get_name (type));
/* we only care about EOS */
if (type != GST_EVENT_EOS)
return TRUE;
if (etype != GST_EVENT_EOS)
return GST_PROBE_OK;
info = GST_STREAM_INFO (user_data);
group = (GstPlayBaseGroup *) g_object_get_data (G_OBJECT (info), "group");
play_base_bin = group->bin;
if (type == GST_EVENT_EOS) {
if (etype == GST_EVENT_EOS) {
gint num_groups = 0;
gboolean have_left;
......@@ -1208,7 +1216,7 @@ probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data)
GROUP_UNLOCK (play_base_bin);
/* remove the EOS if we have something left */
return !have_left;
return (have_left ? GST_PROBE_DROP : GST_PROBE_OK);
}
if (have_left) {
......@@ -1236,14 +1244,14 @@ probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data)
g_object_notify (G_OBJECT (play_base_bin), "stream-info");
/* get rid of the EOS event */
return FALSE;
return GST_PROBE_DROP;
} else {
GROUP_UNLOCK (play_base_bin);
GST_LOG ("Last group done, EOS");
}
}
return TRUE;
return GST_PROBE_OK;
}
/* This function will be called when the sinkpad of the preroll element
......@@ -1283,8 +1291,8 @@ preroll_unlinked (GstPad * pad, GstPad * peerpad,
/* Mute stream on first data - for header-is-in-stream-stuff
* (vorbis, ogmtext). */
static gboolean
mute_stream (GstPad * pad, GstBuffer * buf, gpointer data)
static GstProbeReturn
mute_stream (GstPad * pad, GstProbeType type, gpointer type_data, gpointer data)
{
GstStreamInfo *info = GST_STREAM_INFO (data);
guint id;
......@@ -1295,20 +1303,21 @@ mute_stream (GstPad * pad, GstBuffer * buf, gpointer data)
id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info), "mute_probe"));
g_object_set_data (G_OBJECT (info), "mute_probe", NULL);
if (id > 0)
gst_pad_remove_buffer_probe (GST_PAD_CAST (info->object), id);
gst_pad_remove_probe (GST_PAD_CAST (info->object), id);
/* no data */
return FALSE;
return GST_PROBE_DROP;
}
/* Eat data. */
static gboolean
silence_stream (GstPad * pad, GstMiniObject * data, gpointer user_data)
static GstProbeReturn
silence_stream (GstPad * pad, GstProbeType type, gpointer type_data,
gpointer user_data)
{
GST_DEBUG ("silence stream triggered");
/* no data */
return FALSE;
return GST_PROBE_DROP;
}
/* Called by the signal handlers when a decodebin (main or subtitle) has
......@@ -1409,8 +1418,8 @@ new_decoded_pad_full (GstElement * element, GstPad * pad, gboolean last,
GST_DEBUG ("Adding silence_stream data probe on type %d (npads %d)", type,
group->type[type - 1].npads);
id = gst_pad_add_data_probe (GST_PAD_CAST (pad),
G_CALLBACK (silence_stream), info);
id = gst_pad_add_probe (GST_PAD_CAST (pad), GST_PROBE_TYPE_DATA,
silence_stream, info, NULL);
g_object_set_data (G_OBJECT (pad), "eat_probe", GINT_TO_POINTER (id));
}
......@@ -1760,7 +1769,7 @@ setup_substreams (GstPlayBaseBin * play_base_bin)
data = g_object_get_data (G_OBJECT (info->object), "eat_probe");
if (data) {
gst_pad_remove_data_probe (GST_PAD_CAST (info->object),
gst_pad_remove_probe (GST_PAD_CAST (info->object),
GPOINTER_TO_INT (data));
g_object_set_data (G_OBJECT (info->object), "eat_probe", NULL);
}
......@@ -1771,8 +1780,8 @@ setup_substreams (GstPlayBaseBin * play_base_bin)
id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info), "mute_probe"));
if (id == 0) {
id = gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
G_CALLBACK (mute_stream), info);
id = gst_pad_add_probe (GST_PAD_CAST (info->object),
GST_PROBE_TYPE_BUFFER, mute_stream, info, NULL);
g_object_set_data (G_OBJECT (info), "mute_probe", GINT_TO_POINTER (id));
}
}
......@@ -2515,8 +2524,8 @@ set_active_source (GstPlayBaseBin * play_base_bin,
GST_LOG_OBJECT (info->object, "Muting source %d of type %d", num, type);
id = gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
G_CALLBACK (mute_stream), info);
id = gst_pad_add_probe (GST_PAD_CAST (info->object),
GST_PROBE_TYPE_BUFFER, mute_stream, info, NULL);
g_object_set_data (G_OBJECT (info), "mute_probe", GINT_TO_POINTER (id));
}
num++;
......
......@@ -287,6 +287,10 @@ struct _GstPlayBin
/* indication if the pipeline is live */
gboolean is_live;
/* probes */
gulong text_id;
gulong sub_id;
};
struct _GstPlayBinClass
......@@ -504,9 +508,9 @@ gst_play_bin_dispose (GObject * object)
G_OBJECT_CLASS (parent_class)->dispose (object);
}
static void
gst_play_bin_vis_blocked (GstPad * tee_pad, GstBlockType type,
gpointer user_data)
static GstProbeReturn
gst_play_bin_vis_blocked (GstPad * tee_pad, GstProbeType type,
gpointer type_data, gpointer user_data)
{
GstPlayBin *play_bin = GST_PLAY_BIN (user_data);
GstBin *vis_bin = NULL;
......@@ -607,8 +611,8 @@ beach:
gst_object_unref (vis_bin);
}
/* Unblock the pad */
gst_pad_unblock (tee_pad);
/* unblock the pad and remove the probe */
return GST_PROBE_REMOVE;
}
static void
......@@ -690,7 +694,7 @@ gst_play_bin_set_property (GObject * object, guint prop_id,
play_bin->pending_visualisation = pending_visualisation;
/* Block with callback */
gst_pad_block (tee_pad, GST_BLOCK_TYPE_DATA,
gst_pad_add_probe (tee_pad, GST_PROBE_TYPE_BLOCK,
gst_play_bin_vis_blocked, play_bin, NULL);
beach:
if (vis_sink_pad) {
......@@ -1650,7 +1654,9 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
"file, ghosting to a suitable hierarchy");
/* Block the pad first, because as soon as we add a ghostpad, the queue
* will try and start pushing */
gst_pad_block (textsrcpad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
play_bin->text_id =
gst_pad_add_probe (textsrcpad, GST_PROBE_TYPE_BLOCK, NULL, NULL,
NULL);
origtextsrcpad = gst_object_ref (textsrcpad);
ghost = gst_ghost_pad_new ("text_src", textsrcpad);
......@@ -1694,7 +1700,10 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
if (textsrcpad)
gst_object_unref (textsrcpad);
if (origtextsrcpad) {
gst_pad_unblock (origtextsrcpad);
if (play_bin->text_id) {
gst_pad_remove_probe (origtextsrcpad, play_bin->text_id);
play_bin->text_id = 0;
}
gst_object_unref (origtextsrcpad);
}
......@@ -1709,12 +1718,17 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
spu_sink_pad = gst_element_get_static_pad (sink, "subpicture_sink");
if (subpic_pad && spu_sink_pad) {
GST_LOG_OBJECT (play_bin, "Linking DVD subpicture stream onto SPU");
gst_pad_block (subpic_pad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
play_bin->sub_id =
gst_pad_add_probe (subpic_pad, GST_PROBE_TYPE_BLOCK, NULL, NULL,
NULL);
if (gst_pad_link (subpic_pad, spu_sink_pad) != GST_PAD_LINK_OK) {
GST_WARNING_OBJECT (play_bin,
"Failed to link DVD subpicture stream onto SPU");
}
gst_pad_unblock (subpic_pad);
if (play_bin->sub_id) {
gst_pad_remove_probe (subpic_pad, play_bin->sub_id);
play_bin->sub_id = 0;
}
}
if (subpic_pad)
gst_object_unref (subpic_pad);
......
......@@ -266,6 +266,7 @@ struct _GstSourceSelect
*/
GstEvent *sinkpad_delayed_event;
gulong sinkpad_data_probe;
gulong block_id;
};
#define GST_SOURCE_GROUP_GET_LOCK(group) (((GstSourceGroup*)(group))->lock)
......@@ -324,6 +325,8 @@ struct _GstSourceGroup
gulong sub_no_more_pads_id;
gulong sub_autoplug_continue_id;
gulong block_id;
GMutex *stream_changed_pending_lock;
GList *stream_changed_pending;
......@@ -557,8 +560,8 @@ static void no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group);
static void pad_removed_cb (GstElement * decodebin, GstPad * pad,
GstSourceGroup * group);
static void gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
gboolean block);
static void gst_play_bin_suburidecodebin_block (GstSourceGroup * group,
GstElement * suburidecodebin, gboolean block);
static void gst_play_bin_suburidecodebin_seek_to_start (GstElement *
suburidecodebin);
......@@ -1131,7 +1134,7 @@ free_group (GstPlayBin * playbin, GstSourceGroup * group)
for (n = 0; n < PLAYBIN_STREAM_LAST; n++) {
GstSourceSelect *select = &group->selector[n];
if (select->sinkpad && select->sinkpad_data_probe)
gst_pad_remove_data_probe (select->sinkpad, select->sinkpad_data_probe);
gst_pad_remove_probe (select->sinkpad, select->sinkpad_data_probe);
if (select->sinkpad_delayed_event)
gst_event_unref (select->sinkpad_delayed_event);
}
......@@ -1613,8 +1616,8 @@ gst_play_bin_suburidecodebin_seek_to_start (GstElement * suburidecodebin)
}
static void
gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
gboolean block)
gst_play_bin_suburidecodebin_block (GstSourceGroup * group,
GstElement * suburidecodebin, gboolean block)
{
GstIterator *it = gst_element_iterate_src_pads (suburidecodebin);
gboolean done = FALSE;
......@@ -1630,10 +1633,14 @@ gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
switch (gst_iterator_next (it, &item)) {
case GST_ITERATOR_OK:
sinkpad = g_value_get_object (&item);
if (block)
gst_pad_block (sinkpad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
else
gst_pad_unblock (sinkpad);
if (block) {
group->block_id =
gst_pad_add_probe (sinkpad, GST_PROBE_TYPE_BLOCK, NULL, NULL,
NULL);
} else if (group->block_id) {
gst_pad_remove_probe (sinkpad, group->block_id);
group->block_id = 0;
}
g_value_reset (&item);
break;
case GST_ITERATOR_DONE:
......@@ -1722,7 +1729,8 @@ gst_play_bin_set_current_text_stream (GstPlayBin * playbin, gint stream)
/* Block all suburidecodebin sinkpads */
if (need_block)