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

playbin: fixed for new pad block API

parent 29c3e31f
...@@ -3455,7 +3455,7 @@ gst_decode_pad_init (GstDecodePad * pad) ...@@ -3455,7 +3455,7 @@ gst_decode_pad_init (GstDecodePad * pad)
} }
static void static void
source_pad_blocked_cb (GstPad * pad, gboolean blocked, GstDecodePad * dpad) source_pad_blocked_cb (GstPad * pad, GstBlockType type, GstDecodePad * dpad)
{ {
GstDecodeChain *chain; GstDecodeChain *chain;
GstDecodeBin *dbin; GstDecodeBin *dbin;
...@@ -3463,18 +3463,16 @@ source_pad_blocked_cb (GstPad * pad, gboolean blocked, GstDecodePad * dpad) ...@@ -3463,18 +3463,16 @@ source_pad_blocked_cb (GstPad * pad, gboolean blocked, GstDecodePad * dpad)
chain = dpad->chain; chain = dpad->chain;
dbin = chain->dbin; dbin = chain->dbin;
GST_LOG_OBJECT (dpad, "blocked:%d, dpad->chain:%p", blocked, chain); GST_LOG_OBJECT (dpad, "blocked: dpad->chain:%p", chain);
dpad->blocked = blocked; dpad->blocked = TRUE;
if (dpad->blocked) { EXPOSE_LOCK (dbin);
EXPOSE_LOCK (dbin); if (gst_decode_chain_is_complete (dbin->decode_chain)) {
if (gst_decode_chain_is_complete (dbin->decode_chain)) { if (!gst_decode_bin_expose (dbin))
if (!gst_decode_bin_expose (dbin)) GST_WARNING_OBJECT (dbin, "Couldn't expose group");
GST_WARNING_OBJECT (dbin, "Couldn't expose group");
}
EXPOSE_UNLOCK (dbin);
} }
EXPOSE_UNLOCK (dbin);
} }
static gboolean static gboolean
...@@ -3510,10 +3508,16 @@ gst_decode_pad_set_blocked (GstDecodePad * dpad, gboolean blocked) ...@@ -3510,10 +3508,16 @@ gst_decode_pad_set_blocked (GstDecodePad * dpad, gboolean blocked)
/* do not block if shutting down. /* do not block if shutting down.
* we do not consider/expect it blocked further below, but use other trick */ * we do not consider/expect it blocked further below, but use other trick */
if (!blocked || !dbin->shutdown) if (!blocked || !dbin->shutdown) {
gst_pad_set_blocked (opad, blocked, if (blocked) {
(GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad), gst_pad_block (opad, GST_BLOCK_TYPE_DATA,
(GDestroyNotify) gst_object_unref); (GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad),
(GDestroyNotify) gst_object_unref);
} else {
gst_pad_unblock (opad);
dpad->blocked = FALSE;
}
}
if (blocked) { if (blocked) {
if (dbin->shutdown) { if (dbin->shutdown) {
...@@ -3671,9 +3675,8 @@ unblock_pads (GstDecodeBin * dbin) ...@@ -3671,9 +3675,8 @@ unblock_pads (GstDecodeBin * dbin)
continue; continue;
GST_DEBUG_OBJECT (dpad, "unblocking"); GST_DEBUG_OBJECT (dpad, "unblocking");
gst_pad_set_blocked (opad, FALSE, gst_pad_unblock (opad);
(GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad), dpad->blocked = FALSE;
(GDestroyNotify) gst_object_unref);
/* make flushing, prevent NOT_LINKED */ /* make flushing, prevent NOT_LINKED */
GST_PAD_SET_FLUSHING (GST_PAD_CAST (dpad)); GST_PAD_SET_FLUSHING (GST_PAD_CAST (dpad));
gst_object_unref (dpad); gst_object_unref (dpad);
......
...@@ -505,18 +505,7 @@ gst_play_bin_dispose (GObject * object) ...@@ -505,18 +505,7 @@ gst_play_bin_dispose (GObject * object)
} }
static void static void
gst_play_bin_vis_unblocked (GstPad * tee_pad, gboolean blocked, gst_play_bin_vis_blocked (GstPad * tee_pad, GstBlockType type,
gpointer user_data)
{
GstPlayBin *play_bin = GST_PLAY_BIN (user_data);
if (play_bin->pending_visualisation)
gst_pad_set_blocked (tee_pad, FALSE, gst_play_bin_vis_unblocked,
play_bin, NULL);
}
static void
gst_play_bin_vis_blocked (GstPad * tee_pad, gboolean blocked,
gpointer user_data) gpointer user_data)
{ {
GstPlayBin *play_bin = GST_PLAY_BIN (user_data); GstPlayBin *play_bin = GST_PLAY_BIN (user_data);
...@@ -619,8 +608,7 @@ beach: ...@@ -619,8 +608,7 @@ beach:
} }
/* Unblock the pad */ /* Unblock the pad */
gst_pad_set_blocked (tee_pad, FALSE, gst_play_bin_vis_unblocked, gst_pad_unblock (tee_pad);
play_bin, NULL);
} }
static void static void
...@@ -702,8 +690,8 @@ gst_play_bin_set_property (GObject * object, guint prop_id, ...@@ -702,8 +690,8 @@ gst_play_bin_set_property (GObject * object, guint prop_id,
play_bin->pending_visualisation = pending_visualisation; play_bin->pending_visualisation = pending_visualisation;
/* Block with callback */ /* Block with callback */
gst_pad_set_blocked (tee_pad, TRUE, gst_play_bin_vis_blocked, gst_pad_block (tee_pad, GST_BLOCK_TYPE_DATA,
play_bin, NULL); gst_play_bin_vis_blocked, play_bin, NULL);
beach: beach:
if (vis_sink_pad) { if (vis_sink_pad) {
gst_object_unref (vis_sink_pad); gst_object_unref (vis_sink_pad);
...@@ -1565,11 +1553,6 @@ subtitle_failed: ...@@ -1565,11 +1553,6 @@ subtitle_failed:
} }
} }
static void
dummy_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
{
}
static gboolean static gboolean
setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group) setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
{ {
...@@ -1667,7 +1650,7 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group) ...@@ -1667,7 +1650,7 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
"file, ghosting to a suitable hierarchy"); "file, ghosting to a suitable hierarchy");
/* Block the pad first, because as soon as we add a ghostpad, the queue /* Block the pad first, because as soon as we add a ghostpad, the queue
* will try and start pushing */ * will try and start pushing */
gst_pad_set_blocked (textsrcpad, TRUE, dummy_blocked_cb, NULL, NULL); gst_pad_block (textsrcpad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
origtextsrcpad = gst_object_ref (textsrcpad); origtextsrcpad = gst_object_ref (textsrcpad);
ghost = gst_ghost_pad_new ("text_src", textsrcpad); ghost = gst_ghost_pad_new ("text_src", textsrcpad);
...@@ -1711,7 +1694,7 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group) ...@@ -1711,7 +1694,7 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
if (textsrcpad) if (textsrcpad)
gst_object_unref (textsrcpad); gst_object_unref (textsrcpad);
if (origtextsrcpad) { if (origtextsrcpad) {
gst_pad_set_blocked (origtextsrcpad, FALSE, dummy_blocked_cb, NULL, NULL); gst_pad_unblock (origtextsrcpad);
gst_object_unref (origtextsrcpad); gst_object_unref (origtextsrcpad);
} }
...@@ -1726,12 +1709,12 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group) ...@@ -1726,12 +1709,12 @@ setup_sinks (GstPlayBaseBin * play_base_bin, GstPlayBaseGroup * group)
spu_sink_pad = gst_element_get_static_pad (sink, "subpicture_sink"); spu_sink_pad = gst_element_get_static_pad (sink, "subpicture_sink");
if (subpic_pad && spu_sink_pad) { if (subpic_pad && spu_sink_pad) {
GST_LOG_OBJECT (play_bin, "Linking DVD subpicture stream onto SPU"); GST_LOG_OBJECT (play_bin, "Linking DVD subpicture stream onto SPU");
gst_pad_set_blocked (subpic_pad, TRUE, dummy_blocked_cb, NULL, NULL); gst_pad_block (subpic_pad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
if (gst_pad_link (subpic_pad, spu_sink_pad) != GST_PAD_LINK_OK) { if (gst_pad_link (subpic_pad, spu_sink_pad) != GST_PAD_LINK_OK) {
GST_WARNING_OBJECT (play_bin, GST_WARNING_OBJECT (play_bin,
"Failed to link DVD subpicture stream onto SPU"); "Failed to link DVD subpicture stream onto SPU");
} }
gst_pad_set_blocked (subpic_pad, FALSE, dummy_blocked_cb, NULL, NULL); gst_pad_unblock (subpic_pad);
} }
if (subpic_pad) if (subpic_pad)
gst_object_unref (subpic_pad); gst_object_unref (subpic_pad);
......
...@@ -1583,12 +1583,6 @@ no_channels: ...@@ -1583,12 +1583,6 @@ no_channels:
} }
} }
static void
_suburidecodebin_blocked_cb (GstPad * pad, gboolean blocked, gpointer user_data)
{
GST_DEBUG_OBJECT (pad, "Pad blocked: %d", blocked);
}
static void static void
gst_play_bin_suburidecodebin_seek_to_start (GstElement * suburidecodebin) gst_play_bin_suburidecodebin_seek_to_start (GstElement * suburidecodebin)
{ {
...@@ -1636,8 +1630,10 @@ gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin, ...@@ -1636,8 +1630,10 @@ gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
switch (gst_iterator_next (it, &item)) { switch (gst_iterator_next (it, &item)) {
case GST_ITERATOR_OK: case GST_ITERATOR_OK:
sinkpad = g_value_get_object (&item); sinkpad = g_value_get_object (&item);
gst_pad_set_blocked (sinkpad, block, _suburidecodebin_blocked_cb, if (block)
NULL, NULL); gst_pad_block (sinkpad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
else
gst_pad_unblock (sinkpad);
g_value_reset (&item); g_value_reset (&item);
break; break;
case GST_ITERATOR_DONE: case GST_ITERATOR_DONE:
...@@ -2368,13 +2364,6 @@ selector_active_pad_changed (GObject * selector, GParamSpec * pspec, ...@@ -2368,13 +2364,6 @@ selector_active_pad_changed (GObject * selector, GParamSpec * pspec,
g_object_notify (G_OBJECT (playbin), property); g_object_notify (G_OBJECT (playbin), property);
} }
static void
selector_blocked (GstPad * pad, gboolean blocked, gpointer user_data)
{
/* no nothing */
GST_DEBUG_OBJECT (pad, "blocked callback, blocked: %d", blocked);
}
/* this callback sends a delayed event once the pad becomes unblocked */ /* this callback sends a delayed event once the pad becomes unblocked */
static gboolean static gboolean
stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data) stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
...@@ -2547,7 +2536,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group) ...@@ -2547,7 +2536,7 @@ pad_added_cb (GstElement * decodebin, GstPad * pad, GstSourceGroup * group)
* streams and connect the sinks, resulting in not-linked errors. After we * streams and connect the sinks, resulting in not-linked errors. After we
* configured the sinks we will unblock them all. */ * configured the sinks we will unblock them all. */
GST_DEBUG_OBJECT (playbin, "blocking %" GST_PTR_FORMAT, select->srcpad); GST_DEBUG_OBJECT (playbin, "blocking %" GST_PTR_FORMAT, select->srcpad);
gst_pad_set_blocked (select->srcpad, TRUE, selector_blocked, NULL, NULL); gst_pad_block (select->srcpad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
} }
/* get sinkpad for the new stream */ /* get sinkpad for the new stream */
...@@ -2861,8 +2850,7 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group) ...@@ -2861,8 +2850,7 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
if (select->srcpad) { if (select->srcpad) {
GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT, GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
select->srcpad); select->srcpad);
gst_pad_set_blocked (select->srcpad, FALSE, selector_blocked, gst_pad_unblock (select->srcpad);
NULL, NULL);
} }
} }
GST_SOURCE_GROUP_UNLOCK (group); GST_SOURCE_GROUP_UNLOCK (group);
...@@ -2894,8 +2882,7 @@ shutdown: ...@@ -2894,8 +2882,7 @@ shutdown:
} }
GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT, GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
select->srcpad); select->srcpad);
gst_pad_set_blocked (select->srcpad, FALSE, selector_blocked, gst_pad_unblock (select->srcpad);
NULL, NULL);
} }
} }
GST_SOURCE_GROUP_UNLOCK (group); GST_SOURCE_GROUP_UNLOCK (group);
......
...@@ -662,19 +662,7 @@ gst_play_sink_get_sink (GstPlaySink * playsink, GstPlaySinkType type) ...@@ -662,19 +662,7 @@ gst_play_sink_get_sink (GstPlaySink * playsink, GstPlaySinkType type)
} }
static void static void
gst_play_sink_vis_unblocked (GstPad * tee_pad, gboolean blocked, gst_play_sink_vis_blocked (GstPad * tee_pad, GstBlockType type,
gpointer user_data)
{
GstPlaySink *playsink;
playsink = GST_PLAY_SINK (user_data);
/* nothing to do here, we need a dummy callback here to make the async call
* non-blocking. */
GST_DEBUG_OBJECT (playsink, "vis pad unblocked");
}
static void
gst_play_sink_vis_blocked (GstPad * tee_pad, gboolean blocked,
gpointer user_data) gpointer user_data)
{ {
GstPlaySink *playsink; GstPlaySink *playsink;
...@@ -713,8 +701,7 @@ gst_play_sink_vis_blocked (GstPad * tee_pad, gboolean blocked, ...@@ -713,8 +701,7 @@ gst_play_sink_vis_blocked (GstPad * tee_pad, gboolean blocked,
done: done:
/* Unblock the pad */ /* Unblock the pad */
gst_pad_set_blocked (tee_pad, FALSE, gst_play_sink_vis_unblocked, gst_pad_unblock (tee_pad);
playsink, NULL);
GST_PLAY_SINK_UNLOCK (playsink); GST_PLAY_SINK_UNLOCK (playsink);
} }
...@@ -752,8 +739,8 @@ gst_play_sink_set_vis_plugin (GstPlaySink * playsink, GstElement * vis) ...@@ -752,8 +739,8 @@ gst_play_sink_set_vis_plugin (GstPlaySink * playsink, GstElement * vis)
* function returns FALSE but the previous pad block will do the right thing * function returns FALSE but the previous pad block will do the right thing
* anyway. */ * anyway. */
GST_DEBUG_OBJECT (playsink, "blocking vis pad"); GST_DEBUG_OBJECT (playsink, "blocking vis pad");
gst_pad_set_blocked (chain->blockpad, TRUE, gst_play_sink_vis_blocked, gst_pad_block (chain->blockpad, GST_BLOCK_TYPE_DATA,
playsink, NULL); gst_play_sink_vis_blocked, playsink, NULL);
done: done:
GST_PLAY_SINK_UNLOCK (playsink); GST_PLAY_SINK_UNLOCK (playsink);
...@@ -2872,7 +2859,7 @@ is_raw_pad (GstPad * pad) ...@@ -2872,7 +2859,7 @@ is_raw_pad (GstPad * pad)
} }
static void static void
sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data) sinkpad_blocked_cb (GstPad * blockedpad, GstBlockType type, gpointer user_data)
{ {
GstPlaySink *playsink = (GstPlaySink *) user_data; GstPlaySink *playsink = (GstPlaySink *) user_data;
GstPad *pad; GstPad *pad;
...@@ -2881,20 +2868,14 @@ sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data) ...@@ -2881,20 +2868,14 @@ sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data)
pad = GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (blockedpad))); pad = GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (blockedpad)));
if (pad == playsink->video_pad) { if (pad == playsink->video_pad) {
playsink->video_pad_blocked = blocked; playsink->video_pad_blocked = TRUE;
GST_DEBUG_OBJECT (pad, "Video pad blocked: %d", blocked); GST_DEBUG_OBJECT (pad, "Video pad blocked");
} else if (pad == playsink->audio_pad) { } else if (pad == playsink->audio_pad) {
playsink->audio_pad_blocked = blocked; playsink->audio_pad_blocked = TRUE;
GST_DEBUG_OBJECT (pad, "Audio pad blocked: %d", blocked); GST_DEBUG_OBJECT (pad, "Audio pad blocked");
} else if (pad == playsink->text_pad) { } else if (pad == playsink->text_pad) {
playsink->text_pad_blocked = blocked; playsink->text_pad_blocked = TRUE;
GST_DEBUG_OBJECT (pad, "Text pad blocked: %d", blocked); GST_DEBUG_OBJECT (pad, "Text pad blocked");
}
if (!blocked) {
gst_object_unref (pad);
GST_PLAY_SINK_UNLOCK (playsink);
return;
} }
if ((!playsink->video_pad || playsink->video_pad_blocked) && if ((!playsink->video_pad || playsink->video_pad_blocked) &&
...@@ -2920,27 +2901,27 @@ sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data) ...@@ -2920,27 +2901,27 @@ sinkpad_blocked_cb (GstPad * blockedpad, gboolean blocked, gpointer user_data)
GstPad *opad = GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad))); (playsink->video_pad)));
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb, gst_pad_unblock (opad);
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad); gst_object_unref (opad);
playsink->video_pad_blocked = FALSE;
} }
if (playsink->audio_pad) { if (playsink->audio_pad) {
GstPad *opad = GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad))); (playsink->audio_pad)));
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb, gst_pad_unblock (opad);
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad); gst_object_unref (opad);
playsink->audio_pad_blocked = FALSE;
} }
if (playsink->text_pad) { if (playsink->text_pad) {
GstPad *opad = GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad))); (playsink->text_pad)));
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb, gst_pad_unblock (opad);
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad); gst_object_unref (opad);
playsink->text_pad_blocked = FALSE;
} }
} }
...@@ -2984,7 +2965,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink) ...@@ -2984,7 +2965,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink)
GstPad *opad = GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad))); (playsink->video_pad)));
gst_pad_set_blocked (opad, TRUE, sinkpad_blocked_cb, gst_pad_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref); gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad); gst_object_unref (opad);
} }
...@@ -2993,7 +2974,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink) ...@@ -2993,7 +2974,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink)
GstPad *opad = GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad))); (playsink->audio_pad)));
gst_pad_set_blocked (opad, TRUE, sinkpad_blocked_cb, gst_pad_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref); gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad); gst_object_unref (opad);
} }
...@@ -3002,7 +2983,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink) ...@@ -3002,7 +2983,7 @@ caps_notify_cb (GstPad * pad, GParamSpec * unused, GstPlaySink * playsink)
GstPad *opad = GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad))); (playsink->text_pad)));
gst_pad_set_blocked (opad, TRUE, sinkpad_blocked_cb, gst_pad_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref); gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad); gst_object_unref (opad);
} }
...@@ -3117,7 +3098,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type) ...@@ -3117,7 +3098,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
GstPad *blockpad = GstPad *blockpad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (res))); GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (res)));
gst_pad_set_blocked (blockpad, TRUE, sinkpad_blocked_cb, gst_pad_block (blockpad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref); gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (blockpad); gst_object_unref (blockpad);
} }
...@@ -3369,10 +3350,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition) ...@@ -3369,10 +3350,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
GstPad *opad = GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad))); (playsink->video_pad)));
if (gst_pad_is_blocked (opad)) { gst_pad_unblock (opad);
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
}
gst_object_unref (opad); gst_object_unref (opad);
playsink->video_pad_blocked = FALSE; playsink->video_pad_blocked = FALSE;
} }
...@@ -3382,10 +3360,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition) ...@@ -3382,10 +3360,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad))); (playsink->audio_pad)));
if (gst_pad_is_blocked (opad)) { gst_pad_unblock (opad);
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
}
gst_object_unref (opad); gst_object_unref (opad);
playsink->audio_pad_blocked = FALSE; playsink->audio_pad_blocked = FALSE;
} }
...@@ -3394,10 +3369,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition) ...@@ -3394,10 +3369,7 @@ gst_play_sink_change_state (GstElement * element, GstStateChange transition)
GstPad *opad = GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad))); (playsink->text_pad)));
if (gst_pad_is_blocked (opad)) { gst_pad_unblock (opad);
gst_pad_set_blocked (opad, FALSE, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
}
gst_object_unref (opad); gst_object_unref (opad);
playsink->text_pad_blocked = FALSE; playsink->text_pad_blocked = FALSE;
} }
......
...@@ -80,10 +80,8 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self) ...@@ -80,10 +80,8 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
gboolean raw; gboolean raw;
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self); GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
self->sink_proxypad_blocked = blocked; self->sink_proxypad_blocked = TRUE;
GST_DEBUG_OBJECT (self, "Pad blocked: %d", blocked); GST_DEBUG_OBJECT (self, "Pad blocked");
if (!blocked)
goto done;
/* There must be a peer at this point */ /* There must be a peer at this point */
peer = gst_pad_get_peer (self->sinkpad); peer = gst_pad_get_peer (self->sinkpad);
...@@ -206,11 +204,9 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self) ...@@ -206,11 +204,9 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
} }
unblock: unblock:
gst_pad_set_blocked (self->sink_proxypad, FALSE, gst_pad_unblock (self->sink_proxypad);
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self), self->sink_proxypad_blocked = FALSE;
(GDestroyNotify) gst_object_unref);
done:
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self); GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
return; return;
...@@ -220,9 +216,8 @@ link_failed: ...@@ -220,9 +216,8 @@ link_failed:
(NULL), ("Failed to configure the audio converter.")); (NULL), ("Failed to configure the audio converter."));
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad), gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad),
self->sink_proxypad); self->sink_proxypad);
gst_pad_set_blocked (self->sink_proxypad, FALSE, gst_pad_unblock (self->sink_proxypad);
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self), self->sink_proxypad_blocked = FALSE;
(GDestroyNotify) gst_object_unref);
return; return;
} }
} }
...@@ -275,7 +270,7 @@ gst_play_sink_audio_convert_sink_setcaps (GstPad * pad, GstCaps * caps) ...@@ -275,7 +270,7 @@ gst_play_sink_audio_convert_sink_setcaps (GstPad * pad, GstCaps * caps)
if (!self->raw && !gst_pad_is_blocked (self->sink_proxypad)) { if (!self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
GST_DEBUG_OBJECT (self, "Changing caps from non-raw to raw"); GST_DEBUG_OBJECT (self, "Changing caps from non-raw to raw");
reconfigure = TRUE; reconfigure = TRUE;
gst_pad_set_blocked (self->sink_proxypad, TRUE, gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self), (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
(GDestroyNotify) gst_object_unref); (GDestroyNotify) gst_object_unref);