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;
DISCO_UNLOCK (ps->dc);
}
- return TRUE;
+ return GST_PROBE_OK;
}
static void
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);
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;
}
}
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);
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;
}
/* 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;
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);
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);
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 *
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",
}
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);
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;
default:
break;
}
- return TRUE;
+ return GST_PROBE_OK;
}
static void
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;
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) {
gst_decode_pad_handle_eos (dpad);
}
/* never drop events */
- return TRUE;
+ return GST_PROBE_OK;
}
static void
* 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;
}
}
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
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);
}
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));
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;
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)) {
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");
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)
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)",
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",
/* 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);
/* 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 */
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;
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) {
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
/* 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;
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
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));
}
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);
}
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));
}
}
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++;
/* indication if the pipeline is live */
gboolean is_live;
+
+ /* probes */
+ gulong text_id;
+ gulong sub_id;
};
struct _GstPlayBinClass
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;
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
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) {
"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);
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);
}
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);
*/
GstEvent *sinkpad_delayed_event;
gulong sinkpad_data_probe;
+ gulong block_id;
};
#define GST_SOURCE_GROUP_GET_LOCK(group) (((GstSourceGroup*)(group))->lock)
gulong sub_no_more_pads_id;
gulong sub_autoplug_continue_id;
+ gulong block_id;
+
GMutex *stream_changed_pending_lock;
GList *stream_changed_pending;
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);
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);
}
}
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;
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:
/* Block all suburidecodebin sinkpads */
if (need_block)
- gst_play_bin_suburidecodebin_block (group->suburidecodebin, TRUE);
+ gst_play_bin_suburidecodebin_block (group, group->suburidecodebin,
+ TRUE);
/* activate the selected pad */
g_object_set (selector, "active-pad", sinkpad, NULL);
/* Unblock pads if necessary */
if (need_unblock)
- gst_play_bin_suburidecodebin_block (group->suburidecodebin, FALSE);
+ gst_play_bin_suburidecodebin_block (group, group->suburidecodebin,
+ FALSE);
/* seek to the beginning */
if (need_seek)
}
/* this callback sends a delayed event once the pad becomes unblocked */
-static gboolean
-stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
+static GstProbeReturn
+stream_changed_data_probe (GstPad * pad, GstProbeType type,
+ GstMiniObject * object, gpointer data)
{
GstSourceSelect *select = (GstSourceSelect *) data;
GstEvent *e;
/* we need do this just once, so cleanup first */
- gst_pad_remove_data_probe (pad, select->sinkpad_data_probe);
+ gst_pad_remove_probe (pad, select->sinkpad_data_probe);
select->sinkpad_data_probe = 0;
e = select->sinkpad_delayed_event;
select->sinkpad_delayed_event = NULL;
/* really, this should not happen */
if (!e) {
GST_WARNING ("Data probed called, but no delayed event");
- return TRUE;
+ return GST_PROBE_OK;
}
if (GST_IS_EVENT (object)
gst_event_ref (GST_EVENT_CAST (object));
gst_pad_send_event (pad, GST_EVENT_CAST (object));
gst_pad_send_event (pad, e);
- return FALSE;
+ return GST_PROBE_DROP;
} else {
/* send delayed event, then allow the caller to go on */
gst_pad_send_event (pad, e);
- return TRUE;
+ return GST_PROBE_OK;
}
}
* streams and connect the sinks, resulting in not-linked errors. After we
* configured the sinks we will unblock them all. */
GST_DEBUG_OBJECT (playbin, "blocking %" GST_PTR_FORMAT, select->srcpad);
- gst_pad_block (select->srcpad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
+ select->block_id =
+ gst_pad_add_probe (select->srcpad, GST_PROBE_TYPE_BLOCK, NULL, NULL,
+ NULL);
}
/* get sinkpad for the new stream */
gst_event_unref (select->sinkpad_delayed_event);
select->sinkpad_delayed_event = event;
if (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);
/* we go to the trouble of setting a probe on the pad to send
the playbin2-stream-changed event as sending it here might
pad might not be linked yet. Additionally, sending it here
apparently would be on the wrong thread */
select->sinkpad_data_probe =
- gst_pad_add_data_probe (select->sinkpad,
- (GCallback) stream_changed_data_probe, (gpointer) select);
+ gst_pad_add_probe (select->sinkpad, GST_PROBE_TYPE_DATA,
+ (GstPadProbeCallback) stream_changed_data_probe, (gpointer) select,
+ NULL);
g_mutex_unlock (group->stream_changed_pending_lock);
gst_message_unref (msg);
if (select->srcpad) {
GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
select->srcpad);
- gst_pad_unblock (select->srcpad);
+ if (select->block_id) {
+ gst_pad_remove_probe (select->srcpad, select->block_id);
+ select->block_id = 0;
+ }
}
}
GST_SOURCE_GROUP_UNLOCK (group);
}
GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
select->srcpad);
- gst_pad_unblock (select->srcpad);
+ if (select->block_id) {
+ gst_pad_remove_probe (select->srcpad, select->block_id);
+ select->block_id = 0;
+ }
}
}
GST_SOURCE_GROUP_UNLOCK (group);
gboolean audio_pad_blocked;
GstPad *audio_srcpad_stream_synchronizer;
GstPad *audio_sinkpad_stream_synchronizer;
+ gulong audio_block_id;
/* audio tee */
GstElement *audio_tee;
GstPad *audio_tee_sink;
gboolean video_pad_blocked;
GstPad *video_srcpad_stream_synchronizer;
GstPad *video_sinkpad_stream_synchronizer;
+ gulong video_block_id;
/* text */
GstPad *text_pad;
gboolean text_pad_blocked;
GstPad *text_srcpad_stream_synchronizer;
GstPad *text_sinkpad_stream_synchronizer;
+ gulong text_block_id;
/* properties */
GstElement *audio_sink;
return result;
}
-static void
-gst_play_sink_vis_blocked (GstPad * tee_pad, GstBlockType type,
- gpointer user_data)
+static GstProbeReturn
+gst_play_sink_vis_blocked (GstPad * tee_pad, GstProbeType type,
+ gpointer type_data, gpointer user_data)
{
GstPlaySink *playsink;
GstPlayVisChain *chain;
chain->vissrcpad);
done:
- /* Unblock the pad */
- gst_pad_unblock (tee_pad);
GST_PLAY_SINK_UNLOCK (playsink);
+
+ /* remove the probe and unblock the pad */
+ return GST_PROBE_REMOVE;
}
void
* function returns FALSE but the previous pad block will do the right thing
* anyway. */
GST_DEBUG_OBJECT (playsink, "blocking vis pad");
- gst_pad_block (chain->blockpad, GST_BLOCK_TYPE_DATA,
+ gst_pad_add_probe (chain->blockpad, GST_PROBE_TYPE_BLOCK,
gst_play_sink_vis_blocked, playsink, NULL);
done:
GST_PLAY_SINK_UNLOCK (playsink);
return raw;
}
-static void
-sinkpad_blocked_cb (GstPad * blockedpad, GstBlockType type, gpointer user_data)
+static GstProbeReturn
+sinkpad_blocked_cb (GstPad * blockedpad, GstProbeType type, gpointer type_data,
+ gpointer user_data)
{
GstPlaySink *playsink = (GstPlaySink *) user_data;
GstPad *pad;
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad)));
- gst_pad_unblock (opad);
+ gst_pad_remove_probe (opad, playsink->video_block_id);
+ playsink->video_block_id = 0;
gst_object_unref (opad);
playsink->video_pad_blocked = FALSE;
}
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad)));
- gst_pad_unblock (opad);
+ gst_pad_remove_probe (opad, playsink->audio_block_id);
+ playsink->audio_block_id = 0;
gst_object_unref (opad);
playsink->audio_pad_blocked = FALSE;
}
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad)));
- gst_pad_unblock (opad);
+ gst_pad_remove_probe (opad, playsink->text_block_id);
+ playsink->text_block_id = 0;
gst_object_unref (opad);
playsink->text_pad_blocked = FALSE;
}
gst_object_unref (pad);
GST_PLAY_SINK_UNLOCK (playsink);
+
+ return GST_PROBE_OK;
}
static void
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad)));
- gst_pad_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
- gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
+ if (playsink->video_block_id == 0)
+ playsink->video_block_id =
+ gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb,
+ gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad);
}
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad)));
- gst_pad_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
- gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
+ if (playsink->audio_block_id == 0)
+ playsink->audio_block_id =
+ gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb,
+ gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad);
}
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad)));
- gst_pad_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
- gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
+ if (playsink->text_block_id == 0)
+ playsink->text_block_id =
+ gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb,
+ gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (opad);
}
GST_PLAY_SINK_UNLOCK (playsink);
gboolean created = FALSE;
gboolean activate = TRUE;
const gchar *pad_name = NULL;
+ gulong *block_id = NULL;
GST_DEBUG_OBJECT (playsink, "request pad type %d", type);
}
playsink->audio_pad_raw = FALSE;
res = playsink->audio_pad;
+ block_id = &playsink->audio_block_id;
break;
case GST_PLAY_SINK_TYPE_VIDEO_RAW:
case GST_PLAY_SINK_TYPE_VIDEO:
}
playsink->video_pad_raw = FALSE;
res = playsink->video_pad;
+ block_id = &playsink->video_block_id;
break;
case GST_PLAY_SINK_TYPE_TEXT:
GST_LOG_OBJECT (playsink, "ghosting text");
created = TRUE;
}
res = playsink->text_pad;
+ block_id = &playsink->text_block_id;
break;
case GST_PLAY_SINK_TYPE_FLUSHING:
{
* element is 'running' */
gst_pad_set_active (res, TRUE);
gst_element_add_pad (GST_ELEMENT_CAST (playsink), res);
- if (type != GST_PLAY_SINK_TYPE_FLUSHING) {
+ if (block_id && *block_id == 0) {
GstPad *blockpad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD (res)));
- gst_pad_block (blockpad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
+ *block_id =
+ gst_pad_add_probe (blockpad, GST_PROBE_TYPE_BLOCK, sinkpad_blocked_cb,
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
gst_object_unref (blockpad);
}
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->video_pad)));
- gst_pad_unblock (opad);
+ gst_pad_remove_probe (opad, playsink->video_block_id);
+ playsink->video_block_id = 0;
gst_object_unref (opad);
playsink->video_pad_blocked = FALSE;
}
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->audio_pad)));
- gst_pad_unblock (opad);
+ gst_pad_remove_probe (opad, playsink->audio_block_id);
+ playsink->audio_block_id = 0;
gst_object_unref (opad);
playsink->audio_pad_blocked = FALSE;
}
GstPad *opad =
GST_PAD_CAST (gst_proxy_pad_get_internal (GST_PROXY_PAD
(playsink->text_pad)));
- gst_pad_unblock (opad);
+ gst_pad_remove_probe (opad, playsink->text_block_id);
+ playsink->text_block_id = 0;
gst_object_unref (opad);
playsink->text_pad_blocked = FALSE;
}
gst_element_post_message (GST_ELEMENT_CAST (self), msg);
}
-static void
-pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
+static GstProbeReturn
+pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
+ gpointer user_data)
{
+ GstPlaySinkAudioConvert *self = user_data;
GstPad *peer;
GstCaps *caps;
gboolean raw;
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
- self->sink_proxypad_blocked = TRUE;
GST_DEBUG_OBJECT (self, "Pad blocked");
/* There must be a peer at this point */
}
unblock:
- gst_pad_unblock (self->sink_proxypad);
- self->sink_proxypad_blocked = FALSE;
-
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
- return;
+
+ return GST_PROBE_REMOVE;
link_failed:
{
(NULL), ("Failed to configure the audio converter."));
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad),
self->sink_proxypad);
- gst_pad_unblock (self->sink_proxypad);
- self->sink_proxypad_blocked = FALSE;
- return;
+ GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
+
+ return GST_PROBE_REMOVE;
+ }
+}
+
+static void
+block_proxypad (GstPlaySinkAudioConvert * self)
+{
+ if (self->sink_proxypad_block_id == 0) {
+ self->sink_proxypad_block_id =
+ gst_pad_add_probe (self->sink_proxypad, GST_PROBE_TYPE_BLOCK,
+ pad_blocked_cb, gst_object_ref (self),
+ (GDestroyNotify) gst_object_unref);
+ }
+}
+
+static void
+unblock_proxypad (GstPlaySinkAudioConvert * self)
+{
+ if (self->sink_proxypad_block_id != 0) {
+ gst_pad_remove_probe (self->sink_proxypad, self->sink_proxypad_block_id);
+ self->sink_proxypad_block_id = 0;
}
}
if (!self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
GST_DEBUG_OBJECT (self, "Changing caps from non-raw to raw");
reconfigure = TRUE;
- gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
- (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_proxypad (self);
}
} else {
if (self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
GST_DEBUG_OBJECT (self, "Changing caps from raw to non-raw");
reconfigure = TRUE;
- gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
- (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_proxypad (self);
}
}
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
- gst_pad_unblock (self->sink_proxypad);
- self->sink_proxypad_blocked = FALSE;
+ unblock_proxypad (self);
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
break;
default:
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
- gst_pad_unblock (self->sink_proxypad);
- self->sink_proxypad_blocked = FALSE;
+ unblock_proxypad (self);
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
default:
break;
GMutex *lock;
GstPad *sinkpad, *sink_proxypad;
- gboolean sink_proxypad_blocked;
+ gulong sink_proxypad_block_id;
GstSegment segment;
GstPad *srcpad;
gst_element_post_message (GST_ELEMENT_CAST (self), msg);
}
-static void
-pad_blocked_cb (GstPad * pad, GstBlockType type, GstPlaySinkVideoConvert * self)
+static GstProbeReturn
+pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
+ gpointer user_data)
{
+ GstPlaySinkVideoConvert *self = user_data;
GstPad *peer;
GstCaps *caps;
gboolean raw;
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
- self->sink_proxypad_blocked = TRUE;
GST_DEBUG_OBJECT (self, "Pad blocked");
/* There must be a peer at this point */
}
unblock:
- gst_pad_unblock (self->sink_proxypad);
- self->sink_proxypad_blocked = FALSE;
-
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
- return;
+
+ return GST_PROBE_REMOVE;
link_failed:
{
(NULL), ("Failed to configure the video converter."));
gst_ghost_pad_set_target (GST_GHOST_PAD_CAST (self->srcpad),
self->sink_proxypad);
- gst_pad_unblock (self->sink_proxypad);
- self->sink_proxypad_blocked = FALSE;
+ GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
+
+ return GST_PROBE_REMOVE;
+ }
+}
+
+static void
+block_proxypad (GstPlaySinkVideoConvert * self)
+{
+ if (self->sink_proxypad_block_id != 0)
return;
+
+ self->sink_proxypad_block_id =
+ gst_pad_add_probe (self->sink_proxypad, GST_PROBE_TYPE_BLOCK,
+ pad_blocked_cb, gst_object_ref (self), (GDestroyNotify) gst_object_unref);
+}
+
+static void
+unblock_proxypad (GstPlaySinkVideoConvert * self)
+{
+ if (self->sink_proxypad_block_id != 0) {
+ gst_pad_remove_probe (self->sink_proxypad, self->sink_proxypad_block_id);
+ self->sink_proxypad_block_id = 0;
}
}
if (!self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
GST_DEBUG_OBJECT (self, "Changing caps from non-raw to raw");
reconfigure = TRUE;
- gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
- (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_proxypad (self);
}
} else {
if (self->raw && !gst_pad_is_blocked (self->sink_proxypad)) {
GST_DEBUG_OBJECT (self, "Changing caps from raw to non-raw");
reconfigure = TRUE;
- gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
- (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_proxypad (self);
}
}
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
- gst_pad_unblock (self->sink_proxypad);
- self->sink_proxypad_blocked = FALSE;
+ unblock_proxypad (self);
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
break;
default:
case GST_STATE_CHANGE_READY_TO_PAUSED:
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
if (!gst_pad_is_blocked (self->sink_proxypad))
- gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
- (GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_proxypad (self);
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
default:
break;
GMutex *lock;
GstPad *sinkpad, *sink_proxypad;
- gboolean sink_proxypad_blocked;
+ gulong sink_proxypad_block_id;
GstSegment segment;
GstPad *srcpad;
stream_info->caps = NULL;
}
-static gboolean
-cb_probe (GstPad * pad, GstEvent * e, gpointer user_data)
+static GstProbeReturn
+cb_probe (GstPad * pad, GstProbeType type, gpointer type_data,
+ gpointer user_data)
{
+ GstEvent *e = type_data;
GstStreamInfo *info = user_data;
if (GST_EVENT_TYPE (e) == GST_EVENT_TAG) {
gst_object_ref (object);
if (GST_IS_PAD (object)) {
- gst_pad_add_event_probe (GST_PAD_CAST (object),
- G_CALLBACK (cb_probe), info);
+ gst_pad_add_probe (GST_PAD_CAST (object), GST_PROBE_TYPE_EVENT,
+ cb_probe, info, NULL);
}
info->object = object;
info->type = type;
#define gst_subtitle_overlay_parent_class parent_class
G_DEFINE_TYPE (GstSubtitleOverlay, gst_subtitle_overlay, GST_TYPE_BIN);
-static void _pad_blocked_cb (GstPad * pad, GstBlockType type,
- gpointer user_data);
-
static GQuark _subtitle_overlay_event_marker_id = 0;
static void
}
}
+static GstProbeReturn
+_pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
+ gpointer user_data);
+
+static void
+block_video (GstSubtitleOverlay * self)
+{
+ if (self->video_block_id != 0)
+ return;
+
+ if (self->video_block_pad) {
+ self->video_block_id =
+ gst_pad_add_probe (self->video_block_pad, GST_PROBE_TYPE_BLOCK,
+ _pad_blocked_cb, gst_object_ref (self),
+ (GDestroyNotify) gst_object_unref);
+ }
+}
+
+static void
+unblock_video (GstSubtitleOverlay * self)
+{
+ if (self->video_block_id) {
+ gst_pad_remove_probe (self->video_block_pad, self->video_block_id);
+ self->video_sink_blocked = FALSE;
+ self->video_block_id = 0;
+ }
+}
+
+static void
+block_subtitle (GstSubtitleOverlay * self)
+{
+ if (self->subtitle_block_id != 0)
+ return;
+
+ if (self->subtitle_block_pad) {
+ self->subtitle_block_id =
+ gst_pad_add_probe (self->subtitle_block_pad, GST_PROBE_TYPE_BLOCK,
+ _pad_blocked_cb, gst_object_ref (self),
+ (GDestroyNotify) gst_object_unref);
+ }
+}
+
+static void
+unblock_subtitle (GstSubtitleOverlay * self)
+{
+ if (self->subtitle_block_id) {
+ gst_pad_remove_probe (self->subtitle_block_pad, self->subtitle_block_id);
+ self->subtitle_sink_blocked = FALSE;
+ self->subtitle_block_id = 0;
+ }
+}
+
static void
gst_subtitle_overlay_finalize (GObject * object)
{
out:
/* Unblock pads */
- gst_pad_unblock (self->video_block_pad);
- self->video_sink_blocked = FALSE;
-
- if (self->subtitle_sink_blocked) {
- gst_pad_unblock (self->subtitle_block_pad);
- self->subtitle_sink_blocked = FALSE;
- }
+ unblock_video (self);
+ unblock_subtitle (self);
return TRUE;
}
return (pspec && pspec->value_type == G_TYPE_STRING);
}
-static void
-_pad_blocked_cb (GstPad * pad, GstBlockType type, gpointer user_data)
+static GstProbeReturn
+_pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
+ gpointer user_data)
{
GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY_CAST (user_data);
GstCaps *subcaps;
gst_object_unref (target);
/* Unblock pads */
- gst_pad_unblock (self->video_block_pad);
- self->video_sink_blocked = FALSE;
-
- if (self->subtitle_sink_blocked) {
- gst_pad_unblock (self->subtitle_block_pad);
- self->subtitle_sink_blocked = FALSE;
- }
+ unblock_video (self);
+ unblock_subtitle (self);
goto out;
} else if (target) {
if (self->subtitle_sink_blocked && !self->video_sink_blocked) {
GST_DEBUG_OBJECT (self, "Subtitle sink blocked but video not blocked");
- gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_video (self);
goto out;
}
do_async_done (self);
} else {
GST_DEBUG_OBJECT (self, "Everything worked, unblocking pads");
- gst_pad_unblock (self->video_block_pad);
- self->video_sink_blocked = FALSE;
- gst_pad_unblock (self->subtitle_block_pad);
- self->subtitle_sink_blocked = FALSE;
+ unblock_video (self);
+ unblock_subtitle (self);
do_async_done (self);
}
if (factories)
gst_plugin_feature_list_free (factories);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
+
+ return GST_PROBE_OK;
}
static GstStateChangeReturn
GST_SUBTITLE_OVERLAY_LOCK (self);
/* Set the internal pads to blocking */
- gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_video (self);
+ block_subtitle (self);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
break;
case GST_STATE_CHANGE_READY_TO_PAUSED:
do_async_done (self);
break;
- case GST_STATE_CHANGE_READY_TO_NULL:{
- GstPad *pad;
-
+ case GST_STATE_CHANGE_READY_TO_NULL:
GST_DEBUG_OBJECT (self, "State change READY->NULL");
GST_SUBTITLE_OVERLAY_LOCK (self);
NULL);
/* Unblock pads */
- if (self->video_block_pad) {
- pad = self->video_block_pad;
- gst_pad_unblock (pad);
- self->video_sink_blocked = FALSE;
- }
-
- if (self->subtitle_block_pad) {
- pad = self->subtitle_block_pad;
- gst_pad_unblock (pad);
- self->subtitle_sink_blocked = FALSE;
- }
+ unblock_video (self);
+ unblock_subtitle (self);
/* Remove elements */
self->silent_property = NULL;
GST_SUBTITLE_OVERLAY_UNLOCK (self);
break;
- }
default:
break;
}
GST_SUBTITLE_OVERLAY_LOCK (self);
self->subtitle_error = TRUE;
- gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_subtitle (self);
+ block_video (self);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
}
}
else if (self->renderer)
g_object_set (self->renderer, self->silent_property, silent, NULL);
} else {
- gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_subtitle (self);
+ block_video (self);
}
GST_SUBTITLE_OVERLAY_UNLOCK (self);
break;
gst_flow_get_name (ret));
GST_SUBTITLE_OVERLAY_LOCK (self);
self->subtitle_error = TRUE;
- gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_subtitle (self);
+ block_video (self);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
return GST_FLOW_OK;
gst_flow_get_name (ret));
GST_SUBTITLE_OVERLAY_LOCK (self);
self->subtitle_error = TRUE;
- gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_subtitle (self);
+ block_video (self);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
return GST_FLOW_OK;
GST_DEBUG_OBJECT (pad, "Target did not accept caps");
self->subtitle_error = FALSE;
-
- gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_subtitle (self);
+ block_video (self);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
out:
self->subtitle_error = FALSE;
- gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_subtitle (self);
+ block_video (self);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
gst_caps_unref (caps);
}
GST_SUBTITLE_OVERLAY_LOCK (self);
self->subtitle_error = FALSE;
- if (self->subtitle_block_pad)
- gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
-
- if (self->video_block_pad)
- gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_subtitle (self);
+ block_video (self);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
gst_object_unref (self);
GST_SUBTITLE_OVERLAY_LOCK (self);
self->subtitle_flush = TRUE;
self->subtitle_error = FALSE;
- if (self->subtitle_block_pad)
- gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
- if (self->video_block_pad)
- gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
- _pad_blocked_cb, gst_object_ref (self),
- (GDestroyNotify) gst_object_unref);
+ block_subtitle (self);
+ block_video (self);
GST_SUBTITLE_OVERLAY_UNLOCK (self);
gst_event_unref (event);
GstPad *video_sinkpad;
GstPad *video_block_pad;
+ gulong video_block_id;
gboolean video_sink_blocked;
GstSegment video_segment;
gint fps_n, fps_d;
GstPad *subtitle_sinkpad;
GstPad *subtitle_block_pad;
+ gulong subtitle_block_id;
gboolean subtitle_sink_blocked;
GstSegment subtitle_segment;
gboolean subtitle_flush;
gst_object_unref (queue);
}
-static gboolean
-decoded_pad_event_probe (GstPad * pad, GstEvent * event,
- GstURIDecodeBin * decoder)
+static GstProbeReturn
+decoded_pad_event_probe (GstPad * pad, GstProbeType type, gpointer type_data,
+ gpointer user_data)
{
+ GstEvent *event = type_data;
+ GstURIDecodeBin *decoder = user_data;
+
GST_LOG_OBJECT (pad, "%s, decoder %p", GST_EVENT_TYPE_NAME (event), decoder);
/* look for a bitrate tag */
if (stream) {
stream->bitrate = bitrate;
/* no longer need this probe now */
- gst_pad_remove_event_probe (pad, stream->probe_id);
+ gst_pad_remove_probe (pad, stream->probe_id);
/* configure buffer if possible */
configure_stream_buffering (decoder);
}
}
/* never drop */
- return TRUE;
+ return GST_PROBE_OK;
}
/* Called by the signal handlers when a decodebin has
/* add event probe to monitor tags */
stream = g_slice_alloc0 (sizeof (GstURIDecodeBinStream));
stream->probe_id =
- gst_pad_add_event_probe (pad, G_CALLBACK (decoded_pad_event_probe),
- decoder);
+ gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, decoded_pad_event_probe,
+ decoder, NULL);
GST_URI_DECODE_BIN_LOCK (decoder);
g_hash_table_insert (decoder->streams, pad, stream);
GST_URI_DECODE_BIN_UNLOCK (decoder);
gst_element_add_pad (GST_ELEMENT_CAST (decoder), newpad);
}
-static gboolean
-source_pad_event_probe (GstPad * pad, GstEvent * event,
- GstURIDecodeBin * decoder)
+static GstProbeReturn
+source_pad_event_probe (GstPad * pad, GstProbeType type, gpointer type_data,
+ gpointer user_data)
{
+ GstEvent *event = type_data;
+ GstURIDecodeBin *decoder = user_data;
+
GST_LOG_OBJECT (pad, "%s, decoder %p", GST_EVENT_TYPE_NAME (event), decoder);
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
gst_uri_decode_bin_signals[SIGNAL_DRAINED], 0, NULL);
}
/* never drop events */
- return TRUE;
+ return GST_PROBE_OK;
}
/* called when we found a raw pad on the source element. We need to set up a
expose_decoded_pad (GstElement * element, GstPad * pad,
GstURIDecodeBin * decoder)
{
- gst_pad_add_event_probe (pad, G_CALLBACK (source_pad_event_probe), decoder);
+ gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, source_pad_event_probe, decoder,
+ NULL);
new_decoded_pad_cb (element, pad, FALSE, decoder);
}
}
}
-static gboolean
-print_buffer_ts (GstPad * pad, GstBuffer * buffer, gpointer user_data)
+static GstProbeReturn
+print_buffer_ts (GstPad * pad, GstProbeType type, gpointer type_data,
+ gpointer user_data)
{
+ GstBuffer *buffer = type_data;
+
GST_DEBUG_OBJECT (pad, " ts: %" GST_TIME_FORMAT,
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
- return TRUE;
+
+ return GST_PROBE_OK;
}
gint
}
src_pad = gst_element_get_static_pad (src, "src");
- gst_pad_add_buffer_probe (src_pad, G_CALLBACK (print_buffer_ts), NULL);
+ gst_pad_add_probe (src_pad, GST_PROBE_TYPE_BUFFER, print_buffer_ts, NULL,
+ NULL);
gst_object_unref (src_pad);
/* add a controller to the source */