mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
probes: port to new API for blocking and probes
This commit is contained in:
parent
c7428aeaae
commit
f91c753959
16 changed files with 404 additions and 295 deletions
|
@ -409,8 +409,9 @@ gst_discoverer_set_timeout (GstDiscoverer * dc, GstClockTime timeout)
|
||||||
DISCO_UNLOCK (dc);
|
DISCO_UNLOCK (dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
_event_probe (GstPad * pad, GstEvent * event, PrivateStream * ps)
|
_event_probe (GstPad * pad, GstProbeType type, GstEvent * event,
|
||||||
|
PrivateStream * ps)
|
||||||
{
|
{
|
||||||
if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) {
|
if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) {
|
||||||
GstTagList *tl = NULL, *tmp;
|
GstTagList *tl = NULL, *tmp;
|
||||||
|
@ -434,7 +435,7 @@ _event_probe (GstPad * pad, GstEvent * event, PrivateStream * ps)
|
||||||
DISCO_UNLOCK (ps->dc);
|
DISCO_UNLOCK (ps->dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -497,7 +498,8 @@ uridecodebin_pad_added_cb (GstElement * uridecodebin, GstPad * pad,
|
||||||
gst_object_unref (sinkpad);
|
gst_object_unref (sinkpad);
|
||||||
|
|
||||||
/* Add an event probe */
|
/* 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);
|
DISCO_LOCK (dc);
|
||||||
dc->priv->streams = g_list_append (dc->priv->streams, ps);
|
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);
|
gst_caps_get_structure (dc->priv->current_info->stream_info->caps, 0);
|
||||||
|
|
||||||
if (g_str_has_prefix (gst_structure_get_name (st), "image/"))
|
if (g_str_has_prefix (gst_structure_get_name (st), "image/"))
|
||||||
((GstDiscovererVideoInfo *) dc->priv->current_info->
|
((GstDiscovererVideoInfo *) dc->priv->current_info->stream_info)->
|
||||||
stream_info)->is_image = TRUE;
|
is_image = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -684,7 +684,7 @@ free_pad_probes (GstDecodeBin * decode_bin)
|
||||||
for (tmp = decode_bin->probes; tmp; tmp = g_list_next (tmp)) {
|
for (tmp = decode_bin->probes; tmp; tmp = g_list_next (tmp)) {
|
||||||
PadProbeData *data = (PadProbeData *) tmp->data;
|
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_free (data);
|
||||||
}
|
}
|
||||||
g_list_free (decode_bin->probes);
|
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;
|
PadProbeData *data = (PadProbeData *) l->data;
|
||||||
|
|
||||||
if (GST_ELEMENT_CAST (GST_PAD_PARENT (data->pad)) == element) {
|
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);
|
decode_bin->probes = g_list_delete_link (decode_bin->probes, l);
|
||||||
g_free (data);
|
g_free (data);
|
||||||
return;
|
return;
|
||||||
|
@ -774,9 +774,12 @@ remove_fakesink (GstDecodeBin * decode_bin)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* this should be implemented with _pad_block() */
|
/* this should be implemented with _pad_block() */
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
pad_probe (GstPad * pad, GstMiniObject * data, GstDecodeBin * decode_bin)
|
pad_probe (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GstMiniObject *data = type_data;
|
||||||
|
GstDecodeBin *decode_bin = user_data;
|
||||||
GList *tmp;
|
GList *tmp;
|
||||||
gboolean alldone = TRUE;
|
gboolean alldone = TRUE;
|
||||||
|
|
||||||
|
@ -931,9 +934,9 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps,
|
||||||
data->pad = pad;
|
data->pad = pad;
|
||||||
data->done = FALSE;
|
data->done = FALSE;
|
||||||
|
|
||||||
/* FIXME, use _pad_block() */
|
/* FIXME, use pad blocking */
|
||||||
data->sigid = gst_pad_add_data_probe (pad, G_CALLBACK (pad_probe),
|
data->sigid = gst_pad_add_probe (pad, GST_PROBE_TYPE_DATA, pad_probe,
|
||||||
decode_bin);
|
decode_bin, NULL);
|
||||||
decode_bin->numwaiting++;
|
decode_bin->numwaiting++;
|
||||||
|
|
||||||
decode_bin->probes = g_list_append (decode_bin->probes, data);
|
decode_bin->probes = g_list_append (decode_bin->probes, data);
|
||||||
|
|
|
@ -465,6 +465,8 @@ struct _GstDecodePad
|
||||||
gboolean blocked; /* the *target* pad is blocked */
|
gboolean blocked; /* the *target* pad is blocked */
|
||||||
gboolean exposed; /* the pad is exposed */
|
gboolean exposed; /* the pad is exposed */
|
||||||
gboolean drained; /* an EOS has been seen on the pad */
|
gboolean drained; /* an EOS has been seen on the pad */
|
||||||
|
|
||||||
|
gulong block_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_decode_pad_get_type (void);
|
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_decode_pad_set_blocked (GstDecodePad * dpad, gboolean blocked);
|
||||||
|
|
||||||
static void gst_pending_pad_free (GstPendingPad * ppad);
|
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 *
|
* Standard GObject boilerplate *
|
||||||
|
@ -1614,7 +1617,7 @@ setup_caps_delay:
|
||||||
ppad->pad = gst_object_ref (pad);
|
ppad->pad = gst_object_ref (pad);
|
||||||
ppad->chain = chain;
|
ppad->chain = chain;
|
||||||
ppad->event_probe_id =
|
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->pending_pads = g_list_prepend (chain->pending_pads, ppad);
|
||||||
CHAIN_MUTEX_UNLOCK (chain);
|
CHAIN_MUTEX_UNLOCK (chain);
|
||||||
g_signal_connect (G_OBJECT (pad), "notify::caps",
|
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);
|
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);
|
gst_object_unref (pp->pad);
|
||||||
g_slice_free (GstPendingPad, pp);
|
g_slice_free (GstPendingPad, pp);
|
||||||
|
|
||||||
|
@ -2135,9 +2138,11 @@ exit:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
pad_event_cb (GstPad * pad, GstEvent * event, gpointer data)
|
pad_event_cb (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer data)
|
||||||
{
|
{
|
||||||
|
GstEvent *event = type_data;
|
||||||
GstPendingPad *ppad = (GstPendingPad *) data;
|
GstPendingPad *ppad = (GstPendingPad *) data;
|
||||||
GstDecodeChain *chain = ppad->chain;
|
GstDecodeChain *chain = ppad->chain;
|
||||||
GstDecodeBin *dbin = chain->dbin;
|
GstDecodeBin *dbin = chain->dbin;
|
||||||
|
@ -2159,7 +2164,7 @@ pad_event_cb (GstPad * pad, GstEvent * event, gpointer data)
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3454,9 +3459,11 @@ gst_decode_pad_init (GstDecodePad * pad)
|
||||||
gst_object_ref_sink (pad);
|
gst_object_ref_sink (pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstProbeReturn
|
||||||
source_pad_blocked_cb (GstPad * pad, GstBlockType type, GstDecodePad * dpad)
|
source_pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GstDecodePad *dpad = user_data;
|
||||||
GstDecodeChain *chain;
|
GstDecodeChain *chain;
|
||||||
GstDecodeBin *dbin;
|
GstDecodeBin *dbin;
|
||||||
|
|
||||||
|
@ -3473,11 +3480,17 @@ source_pad_blocked_cb (GstPad * pad, GstBlockType type, GstDecodePad * dpad)
|
||||||
GST_WARNING_OBJECT (dbin, "Couldn't expose group");
|
GST_WARNING_OBJECT (dbin, "Couldn't expose group");
|
||||||
}
|
}
|
||||||
EXPOSE_UNLOCK (dbin);
|
EXPOSE_UNLOCK (dbin);
|
||||||
|
|
||||||
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
source_pad_event_probe (GstPad * pad, GstEvent * event, GstDecodePad * dpad)
|
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);
|
GST_LOG_OBJECT (pad, "%s dpad:%p", GST_EVENT_TYPE_NAME (event), dpad);
|
||||||
|
|
||||||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
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);
|
gst_decode_pad_handle_eos (dpad);
|
||||||
}
|
}
|
||||||
/* never drop events */
|
/* never drop events */
|
||||||
return TRUE;
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 */
|
* we do not consider/expect it blocked further below, but use other trick */
|
||||||
if (!blocked || !dbin->shutdown) {
|
if (!blocked || !dbin->shutdown) {
|
||||||
if (blocked) {
|
if (blocked) {
|
||||||
gst_pad_block (opad, GST_BLOCK_TYPE_DATA,
|
if (dpad->block_id == 0)
|
||||||
(GstPadBlockCallback) source_pad_blocked_cb, gst_object_ref (dpad),
|
dpad->block_id = gst_pad_add_probe (opad, GST_PROBE_TYPE_BLOCK,
|
||||||
(GDestroyNotify) gst_object_unref);
|
source_pad_blocked_cb, gst_object_ref (dpad),
|
||||||
|
(GDestroyNotify) gst_object_unref);
|
||||||
} else {
|
} 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;
|
dpad->blocked = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3546,8 +3563,8 @@ out:
|
||||||
static void
|
static void
|
||||||
gst_decode_pad_add_drained_check (GstDecodePad * dpad)
|
gst_decode_pad_add_drained_check (GstDecodePad * dpad)
|
||||||
{
|
{
|
||||||
gst_pad_add_event_probe (GST_PAD_CAST (dpad),
|
gst_pad_add_probe (GST_PAD_CAST (dpad), GST_PROBE_TYPE_EVENT,
|
||||||
G_CALLBACK (source_pad_event_probe), dpad);
|
source_pad_event_probe, dpad, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -3598,7 +3615,7 @@ gst_pending_pad_free (GstPendingPad * ppad)
|
||||||
g_assert (ppad->pad);
|
g_assert (ppad->pad);
|
||||||
|
|
||||||
if (ppad->event_probe_id != 0)
|
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);
|
gst_object_unref (ppad->pad);
|
||||||
g_slice_free (GstPendingPad, ppad);
|
g_slice_free (GstPendingPad, ppad);
|
||||||
}
|
}
|
||||||
|
@ -3675,7 +3692,10 @@ unblock_pads (GstDecodeBin * dbin)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (dpad, "unblocking");
|
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;
|
dpad->blocked = FALSE;
|
||||||
/* 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));
|
||||||
|
|
|
@ -91,8 +91,8 @@ static gboolean has_all_raw_caps (GstPad * pad, gboolean * all_raw);
|
||||||
static gboolean prepare_output (GstPlayBaseBin * play_base_bin);
|
static gboolean prepare_output (GstPlayBaseBin * play_base_bin);
|
||||||
static void set_active_source (GstPlayBaseBin * play_base_bin,
|
static void set_active_source (GstPlayBaseBin * play_base_bin,
|
||||||
GstStreamType type, gint source_num);
|
GstStreamType type, gint source_num);
|
||||||
static gboolean probe_triggered (GstPad * pad, GstEvent * event,
|
static GstProbeReturn probe_triggered (GstPad * pad, GstProbeType type,
|
||||||
gpointer user_data);
|
gpointer type_data, gpointer user_data);
|
||||||
static void setup_substreams (GstPlayBaseBin * play_base_bin);
|
static void setup_substreams (GstPlayBaseBin * play_base_bin);
|
||||||
|
|
||||||
static GstPipelineClass *parent_class;
|
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));
|
gst_message_new_buffering (GST_OBJECT_CAST (play_base_bin), percent));
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
check_queue_event (GstPad * pad, GstEvent * event, gpointer user_data)
|
check_queue_event (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GstEvent *event = type_data;
|
||||||
GstElement *queue = GST_ELEMENT_CAST (user_data);
|
GstElement *queue = GST_ELEMENT_CAST (user_data);
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
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));
|
GST_DEBUG ("uninteresting event %s", GST_EVENT_TYPE_NAME (event));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
check_queue (GstPad * pad, GstBuffer * data, gpointer user_data)
|
check_queue (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GstElement *queue = GST_ELEMENT_CAST (user_data);
|
GstElement *queue = GST_ELEMENT_CAST (user_data);
|
||||||
GstPlayBaseBin *play_base_bin = g_object_get_data (G_OBJECT (queue), "pbb");
|
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);
|
fill_buffer (play_base_bin, level);
|
||||||
|
|
||||||
/* continue! */
|
/* continue! */
|
||||||
return TRUE;
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a queue overruns and we are buffer in streaming mode (we have a min-time)
|
/* 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);
|
GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
|
||||||
|
|
||||||
g_object_set_data (G_OBJECT (queue), "probe", NULL);
|
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 {
|
} else {
|
||||||
GST_DEBUG_OBJECT (play_base_bin,
|
GST_DEBUG_OBJECT (play_base_bin,
|
||||||
"No buffer probe to remove from %s:%s (%p)",
|
"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;
|
guint id;
|
||||||
|
|
||||||
sinkpad = gst_element_get_static_pad (queue, "sink");
|
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));
|
g_object_set_data (G_OBJECT (queue), "probe", GINT_TO_POINTER (id));
|
||||||
GST_DEBUG_OBJECT (play_base_bin,
|
GST_DEBUG_OBJECT (play_base_bin,
|
||||||
"Re-attaching buffering probe to pad %s:%s %p",
|
"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 */
|
/* give updates on queue size */
|
||||||
sinkpad = gst_element_get_static_pad (preroll, "sink");
|
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_OBJECT (play_base_bin, "Attaching probe to pad %s:%s (%p)",
|
||||||
GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
|
GST_DEBUG_PAD_NAME (sinkpad), sinkpad);
|
||||||
g_object_set_data (G_OBJECT (preroll), "probe", GINT_TO_POINTER (id));
|
g_object_set_data (G_OBJECT (preroll), "probe", GINT_TO_POINTER (id));
|
||||||
|
|
||||||
/* catch eos and flush events so that we can ignore underruns */
|
/* catch eos and flush events so that we can ignore underruns */
|
||||||
id = gst_pad_add_event_probe (sinkpad, G_CALLBACK (check_queue_event),
|
id = gst_pad_add_probe (sinkpad, GST_PROBE_TYPE_EVENT, check_queue_event,
|
||||||
preroll);
|
preroll, NULL);
|
||||||
g_object_set_data (G_OBJECT (preroll), "eos_probe", GINT_TO_POINTER (id));
|
g_object_set_data (G_OBJECT (preroll), "eos_probe", GINT_TO_POINTER (id));
|
||||||
|
|
||||||
gst_object_unref (sinkpad);
|
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. */
|
/* listen for EOS so we can switch groups when one ended. */
|
||||||
preroll_pad = gst_element_get_static_pad (preroll, "src");
|
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);
|
gst_object_unref (preroll_pad);
|
||||||
|
|
||||||
/* add to group list */
|
/* add to group list */
|
||||||
|
@ -1159,27 +1165,29 @@ source_no_more_pads (GstElement * element, GstPlayBaseBin * bin)
|
||||||
no_more_pads_full (element, FALSE, bin);
|
no_more_pads_full (element, FALSE, bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data)
|
probe_triggered (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GstEvent *event = type_data;
|
||||||
GstPlayBaseGroup *group;
|
GstPlayBaseGroup *group;
|
||||||
GstPlayBaseBin *play_base_bin;
|
GstPlayBaseBin *play_base_bin;
|
||||||
GstStreamInfo *info;
|
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));
|
GST_LOG ("probe triggered, (%d) %s", type, gst_event_type_get_name (type));
|
||||||
|
|
||||||
/* we only care about EOS */
|
/* we only care about EOS */
|
||||||
if (type != GST_EVENT_EOS)
|
if (etype != GST_EVENT_EOS)
|
||||||
return TRUE;
|
return GST_PROBE_OK;
|
||||||
|
|
||||||
info = GST_STREAM_INFO (user_data);
|
info = GST_STREAM_INFO (user_data);
|
||||||
group = (GstPlayBaseGroup *) g_object_get_data (G_OBJECT (info), "group");
|
group = (GstPlayBaseGroup *) g_object_get_data (G_OBJECT (info), "group");
|
||||||
play_base_bin = group->bin;
|
play_base_bin = group->bin;
|
||||||
|
|
||||||
if (type == GST_EVENT_EOS) {
|
if (etype == GST_EVENT_EOS) {
|
||||||
gint num_groups = 0;
|
gint num_groups = 0;
|
||||||
gboolean have_left;
|
gboolean have_left;
|
||||||
|
|
||||||
|
@ -1208,7 +1216,7 @@ probe_triggered (GstPad * pad, GstEvent * event, gpointer user_data)
|
||||||
GROUP_UNLOCK (play_base_bin);
|
GROUP_UNLOCK (play_base_bin);
|
||||||
|
|
||||||
/* remove the EOS if we have something left */
|
/* remove the EOS if we have something left */
|
||||||
return !have_left;
|
return (have_left ? GST_PROBE_DROP : GST_PROBE_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_left) {
|
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");
|
g_object_notify (G_OBJECT (play_base_bin), "stream-info");
|
||||||
|
|
||||||
/* get rid of the EOS event */
|
/* get rid of the EOS event */
|
||||||
return FALSE;
|
return GST_PROBE_DROP;
|
||||||
} else {
|
} else {
|
||||||
GROUP_UNLOCK (play_base_bin);
|
GROUP_UNLOCK (play_base_bin);
|
||||||
GST_LOG ("Last group done, EOS");
|
GST_LOG ("Last group done, EOS");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function will be called when the sinkpad of the preroll element
|
/* 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
|
/* Mute stream on first data - for header-is-in-stream-stuff
|
||||||
* (vorbis, ogmtext). */
|
* (vorbis, ogmtext). */
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
mute_stream (GstPad * pad, GstBuffer * buf, gpointer data)
|
mute_stream (GstPad * pad, GstProbeType type, gpointer type_data, gpointer data)
|
||||||
{
|
{
|
||||||
GstStreamInfo *info = GST_STREAM_INFO (data);
|
GstStreamInfo *info = GST_STREAM_INFO (data);
|
||||||
guint id;
|
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"));
|
id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info), "mute_probe"));
|
||||||
g_object_set_data (G_OBJECT (info), "mute_probe", NULL);
|
g_object_set_data (G_OBJECT (info), "mute_probe", NULL);
|
||||||
if (id > 0)
|
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 */
|
/* no data */
|
||||||
return FALSE;
|
return GST_PROBE_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Eat data. */
|
/* Eat data. */
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
silence_stream (GstPad * pad, GstMiniObject * data, gpointer user_data)
|
silence_stream (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GST_DEBUG ("silence stream triggered");
|
GST_DEBUG ("silence stream triggered");
|
||||||
|
|
||||||
/* no data */
|
/* no data */
|
||||||
return FALSE;
|
return GST_PROBE_DROP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called by the signal handlers when a decodebin (main or subtitle) has
|
/* 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,
|
GST_DEBUG ("Adding silence_stream data probe on type %d (npads %d)", type,
|
||||||
group->type[type - 1].npads);
|
group->type[type - 1].npads);
|
||||||
|
|
||||||
id = gst_pad_add_data_probe (GST_PAD_CAST (pad),
|
id = gst_pad_add_probe (GST_PAD_CAST (pad), GST_PROBE_TYPE_DATA,
|
||||||
G_CALLBACK (silence_stream), info);
|
silence_stream, info, NULL);
|
||||||
g_object_set_data (G_OBJECT (pad), "eat_probe", GINT_TO_POINTER (id));
|
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");
|
data = g_object_get_data (G_OBJECT (info->object), "eat_probe");
|
||||||
if (data) {
|
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));
|
GPOINTER_TO_INT (data));
|
||||||
g_object_set_data (G_OBJECT (info->object), "eat_probe", NULL);
|
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"));
|
id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (info), "mute_probe"));
|
||||||
if (id == 0) {
|
if (id == 0) {
|
||||||
id = gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
|
id = gst_pad_add_probe (GST_PAD_CAST (info->object),
|
||||||
G_CALLBACK (mute_stream), info);
|
GST_PROBE_TYPE_BUFFER, mute_stream, info, NULL);
|
||||||
g_object_set_data (G_OBJECT (info), "mute_probe", GINT_TO_POINTER (id));
|
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);
|
GST_LOG_OBJECT (info->object, "Muting source %d of type %d", num, type);
|
||||||
|
|
||||||
id = gst_pad_add_buffer_probe (GST_PAD_CAST (info->object),
|
id = gst_pad_add_probe (GST_PAD_CAST (info->object),
|
||||||
G_CALLBACK (mute_stream), info);
|
GST_PROBE_TYPE_BUFFER, mute_stream, info, NULL);
|
||||||
g_object_set_data (G_OBJECT (info), "mute_probe", GINT_TO_POINTER (id));
|
g_object_set_data (G_OBJECT (info), "mute_probe", GINT_TO_POINTER (id));
|
||||||
}
|
}
|
||||||
num++;
|
num++;
|
||||||
|
|
|
@ -287,6 +287,10 @@ struct _GstPlayBin
|
||||||
|
|
||||||
/* indication if the pipeline is live */
|
/* indication if the pipeline is live */
|
||||||
gboolean is_live;
|
gboolean is_live;
|
||||||
|
|
||||||
|
/* probes */
|
||||||
|
gulong text_id;
|
||||||
|
gulong sub_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstPlayBinClass
|
struct _GstPlayBinClass
|
||||||
|
@ -504,9 +508,9 @@ gst_play_bin_dispose (GObject * object)
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstProbeReturn
|
||||||
gst_play_bin_vis_blocked (GstPad * tee_pad, GstBlockType type,
|
gst_play_bin_vis_blocked (GstPad * tee_pad, GstProbeType type,
|
||||||
gpointer user_data)
|
gpointer type_data, gpointer user_data)
|
||||||
{
|
{
|
||||||
GstPlayBin *play_bin = GST_PLAY_BIN (user_data);
|
GstPlayBin *play_bin = GST_PLAY_BIN (user_data);
|
||||||
GstBin *vis_bin = NULL;
|
GstBin *vis_bin = NULL;
|
||||||
|
@ -607,8 +611,8 @@ beach:
|
||||||
gst_object_unref (vis_bin);
|
gst_object_unref (vis_bin);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unblock the pad */
|
/* unblock the pad and remove the probe */
|
||||||
gst_pad_unblock (tee_pad);
|
return GST_PROBE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -690,7 +694,7 @@ 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_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);
|
gst_play_bin_vis_blocked, play_bin, NULL);
|
||||||
beach:
|
beach:
|
||||||
if (vis_sink_pad) {
|
if (vis_sink_pad) {
|
||||||
|
@ -1650,7 +1654,9 @@ 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_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);
|
origtextsrcpad = gst_object_ref (textsrcpad);
|
||||||
|
|
||||||
ghost = gst_ghost_pad_new ("text_src", textsrcpad);
|
ghost = gst_ghost_pad_new ("text_src", textsrcpad);
|
||||||
|
@ -1694,7 +1700,10 @@ 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_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);
|
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");
|
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_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) {
|
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_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)
|
if (subpic_pad)
|
||||||
gst_object_unref (subpic_pad);
|
gst_object_unref (subpic_pad);
|
||||||
|
|
|
@ -266,6 +266,7 @@ struct _GstSourceSelect
|
||||||
*/
|
*/
|
||||||
GstEvent *sinkpad_delayed_event;
|
GstEvent *sinkpad_delayed_event;
|
||||||
gulong sinkpad_data_probe;
|
gulong sinkpad_data_probe;
|
||||||
|
gulong block_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GST_SOURCE_GROUP_GET_LOCK(group) (((GstSourceGroup*)(group))->lock)
|
#define GST_SOURCE_GROUP_GET_LOCK(group) (((GstSourceGroup*)(group))->lock)
|
||||||
|
@ -324,6 +325,8 @@ struct _GstSourceGroup
|
||||||
gulong sub_no_more_pads_id;
|
gulong sub_no_more_pads_id;
|
||||||
gulong sub_autoplug_continue_id;
|
gulong sub_autoplug_continue_id;
|
||||||
|
|
||||||
|
gulong block_id;
|
||||||
|
|
||||||
GMutex *stream_changed_pending_lock;
|
GMutex *stream_changed_pending_lock;
|
||||||
GList *stream_changed_pending;
|
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,
|
static void pad_removed_cb (GstElement * decodebin, GstPad * pad,
|
||||||
GstSourceGroup * group);
|
GstSourceGroup * group);
|
||||||
|
|
||||||
static void gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
|
static void gst_play_bin_suburidecodebin_block (GstSourceGroup * group,
|
||||||
gboolean block);
|
GstElement * suburidecodebin, gboolean block);
|
||||||
static void gst_play_bin_suburidecodebin_seek_to_start (GstElement *
|
static void gst_play_bin_suburidecodebin_seek_to_start (GstElement *
|
||||||
suburidecodebin);
|
suburidecodebin);
|
||||||
|
|
||||||
|
@ -1131,7 +1134,7 @@ free_group (GstPlayBin * playbin, GstSourceGroup * group)
|
||||||
for (n = 0; n < PLAYBIN_STREAM_LAST; n++) {
|
for (n = 0; n < PLAYBIN_STREAM_LAST; n++) {
|
||||||
GstSourceSelect *select = &group->selector[n];
|
GstSourceSelect *select = &group->selector[n];
|
||||||
if (select->sinkpad && select->sinkpad_data_probe)
|
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)
|
if (select->sinkpad_delayed_event)
|
||||||
gst_event_unref (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
|
static void
|
||||||
gst_play_bin_suburidecodebin_block (GstElement * suburidecodebin,
|
gst_play_bin_suburidecodebin_block (GstSourceGroup * group,
|
||||||
gboolean block)
|
GstElement * suburidecodebin, gboolean block)
|
||||||
{
|
{
|
||||||
GstIterator *it = gst_element_iterate_src_pads (suburidecodebin);
|
GstIterator *it = gst_element_iterate_src_pads (suburidecodebin);
|
||||||
gboolean done = FALSE;
|
gboolean done = FALSE;
|
||||||
|
@ -1630,10 +1633,14 @@ 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);
|
||||||
if (block)
|
if (block) {
|
||||||
gst_pad_block (sinkpad, GST_BLOCK_TYPE_DATA, NULL, NULL, NULL);
|
group->block_id =
|
||||||
else
|
gst_pad_add_probe (sinkpad, GST_PROBE_TYPE_BLOCK, NULL, NULL,
|
||||||
gst_pad_unblock (sinkpad);
|
NULL);
|
||||||
|
} else if (group->block_id) {
|
||||||
|
gst_pad_remove_probe (sinkpad, group->block_id);
|
||||||
|
group->block_id = 0;
|
||||||
|
}
|
||||||
g_value_reset (&item);
|
g_value_reset (&item);
|
||||||
break;
|
break;
|
||||||
case GST_ITERATOR_DONE:
|
case GST_ITERATOR_DONE:
|
||||||
|
@ -1722,7 +1729,8 @@ gst_play_bin_set_current_text_stream (GstPlayBin * playbin, gint stream)
|
||||||
|
|
||||||
/* Block all suburidecodebin sinkpads */
|
/* Block all suburidecodebin sinkpads */
|
||||||
if (need_block)
|
if (need_block)
|
||||||
gst_play_bin_suburidecodebin_block (group->suburidecodebin, TRUE);
|
gst_play_bin_suburidecodebin_block (group, group->suburidecodebin,
|
||||||
|
TRUE);
|
||||||
|
|
||||||
/* activate the selected pad */
|
/* activate the selected pad */
|
||||||
g_object_set (selector, "active-pad", sinkpad, NULL);
|
g_object_set (selector, "active-pad", sinkpad, NULL);
|
||||||
|
@ -1745,7 +1753,8 @@ gst_play_bin_set_current_text_stream (GstPlayBin * playbin, gint stream)
|
||||||
|
|
||||||
/* Unblock pads if necessary */
|
/* Unblock pads if necessary */
|
||||||
if (need_unblock)
|
if (need_unblock)
|
||||||
gst_play_bin_suburidecodebin_block (group->suburidecodebin, FALSE);
|
gst_play_bin_suburidecodebin_block (group, group->suburidecodebin,
|
||||||
|
FALSE);
|
||||||
|
|
||||||
/* seek to the beginning */
|
/* seek to the beginning */
|
||||||
if (need_seek)
|
if (need_seek)
|
||||||
|
@ -2365,14 +2374,15 @@ selector_active_pad_changed (GObject * selector, GParamSpec * pspec,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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 GstProbeReturn
|
||||||
stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
|
stream_changed_data_probe (GstPad * pad, GstProbeType type,
|
||||||
|
GstMiniObject * object, gpointer data)
|
||||||
{
|
{
|
||||||
GstSourceSelect *select = (GstSourceSelect *) data;
|
GstSourceSelect *select = (GstSourceSelect *) data;
|
||||||
GstEvent *e;
|
GstEvent *e;
|
||||||
|
|
||||||
/* we need do this just once, so cleanup first */
|
/* 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;
|
select->sinkpad_data_probe = 0;
|
||||||
e = select->sinkpad_delayed_event;
|
e = select->sinkpad_delayed_event;
|
||||||
select->sinkpad_delayed_event = NULL;
|
select->sinkpad_delayed_event = NULL;
|
||||||
|
@ -2380,7 +2390,7 @@ stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
|
||||||
/* really, this should not happen */
|
/* really, this should not happen */
|
||||||
if (!e) {
|
if (!e) {
|
||||||
GST_WARNING ("Data probed called, but no delayed event");
|
GST_WARNING ("Data probed called, but no delayed event");
|
||||||
return TRUE;
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GST_IS_EVENT (object)
|
if (GST_IS_EVENT (object)
|
||||||
|
@ -2389,11 +2399,11 @@ stream_changed_data_probe (GstPad * pad, GstMiniObject * object, gpointer data)
|
||||||
gst_event_ref (GST_EVENT_CAST (object));
|
gst_event_ref (GST_EVENT_CAST (object));
|
||||||
gst_pad_send_event (pad, GST_EVENT_CAST (object));
|
gst_pad_send_event (pad, GST_EVENT_CAST (object));
|
||||||
gst_pad_send_event (pad, e);
|
gst_pad_send_event (pad, e);
|
||||||
return FALSE;
|
return GST_PROBE_DROP;
|
||||||
} else {
|
} else {
|
||||||
/* send delayed event, then allow the caller to go on */
|
/* send delayed event, then allow the caller to go on */
|
||||||
gst_pad_send_event (pad, e);
|
gst_pad_send_event (pad, e);
|
||||||
return TRUE;
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2536,7 +2546,9 @@ 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_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 */
|
/* get sinkpad for the new stream */
|
||||||
|
@ -2831,8 +2843,7 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
|
||||||
gst_event_unref (select->sinkpad_delayed_event);
|
gst_event_unref (select->sinkpad_delayed_event);
|
||||||
select->sinkpad_delayed_event = event;
|
select->sinkpad_delayed_event = event;
|
||||||
if (select->sinkpad_data_probe)
|
if (select->sinkpad_data_probe)
|
||||||
gst_pad_remove_data_probe (select->sinkpad,
|
gst_pad_remove_probe (select->sinkpad, select->sinkpad_data_probe);
|
||||||
select->sinkpad_data_probe);
|
|
||||||
|
|
||||||
/* we go to the trouble of setting a probe on the pad to send
|
/* we go to the trouble of setting a probe on the pad to send
|
||||||
the playbin2-stream-changed event as sending it here might
|
the playbin2-stream-changed event as sending it here might
|
||||||
|
@ -2840,8 +2851,9 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
|
||||||
pad might not be linked yet. Additionally, sending it here
|
pad might not be linked yet. Additionally, sending it here
|
||||||
apparently would be on the wrong thread */
|
apparently would be on the wrong thread */
|
||||||
select->sinkpad_data_probe =
|
select->sinkpad_data_probe =
|
||||||
gst_pad_add_data_probe (select->sinkpad,
|
gst_pad_add_probe (select->sinkpad, GST_PROBE_TYPE_DATA,
|
||||||
(GCallback) stream_changed_data_probe, (gpointer) select);
|
(GstPadProbeCallback) stream_changed_data_probe, (gpointer) select,
|
||||||
|
NULL);
|
||||||
|
|
||||||
g_mutex_unlock (group->stream_changed_pending_lock);
|
g_mutex_unlock (group->stream_changed_pending_lock);
|
||||||
gst_message_unref (msg);
|
gst_message_unref (msg);
|
||||||
|
@ -2850,7 +2862,10 @@ 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_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_SOURCE_GROUP_UNLOCK (group);
|
||||||
|
@ -2882,7 +2897,10 @@ shutdown:
|
||||||
}
|
}
|
||||||
GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
|
GST_DEBUG_OBJECT (playbin, "unblocking %" GST_PTR_FORMAT,
|
||||||
select->srcpad);
|
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_SOURCE_GROUP_UNLOCK (group);
|
||||||
|
|
|
@ -153,6 +153,7 @@ struct _GstPlaySink
|
||||||
gboolean audio_pad_blocked;
|
gboolean audio_pad_blocked;
|
||||||
GstPad *audio_srcpad_stream_synchronizer;
|
GstPad *audio_srcpad_stream_synchronizer;
|
||||||
GstPad *audio_sinkpad_stream_synchronizer;
|
GstPad *audio_sinkpad_stream_synchronizer;
|
||||||
|
gulong audio_block_id;
|
||||||
/* audio tee */
|
/* audio tee */
|
||||||
GstElement *audio_tee;
|
GstElement *audio_tee;
|
||||||
GstPad *audio_tee_sink;
|
GstPad *audio_tee_sink;
|
||||||
|
@ -164,11 +165,13 @@ struct _GstPlaySink
|
||||||
gboolean video_pad_blocked;
|
gboolean video_pad_blocked;
|
||||||
GstPad *video_srcpad_stream_synchronizer;
|
GstPad *video_srcpad_stream_synchronizer;
|
||||||
GstPad *video_sinkpad_stream_synchronizer;
|
GstPad *video_sinkpad_stream_synchronizer;
|
||||||
|
gulong video_block_id;
|
||||||
/* text */
|
/* text */
|
||||||
GstPad *text_pad;
|
GstPad *text_pad;
|
||||||
gboolean text_pad_blocked;
|
gboolean text_pad_blocked;
|
||||||
GstPad *text_srcpad_stream_synchronizer;
|
GstPad *text_srcpad_stream_synchronizer;
|
||||||
GstPad *text_sinkpad_stream_synchronizer;
|
GstPad *text_sinkpad_stream_synchronizer;
|
||||||
|
gulong text_block_id;
|
||||||
|
|
||||||
/* properties */
|
/* properties */
|
||||||
GstElement *audio_sink;
|
GstElement *audio_sink;
|
||||||
|
@ -661,9 +664,9 @@ gst_play_sink_get_sink (GstPlaySink * playsink, GstPlaySinkType type)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstProbeReturn
|
||||||
gst_play_sink_vis_blocked (GstPad * tee_pad, GstBlockType type,
|
gst_play_sink_vis_blocked (GstPad * tee_pad, GstProbeType type,
|
||||||
gpointer user_data)
|
gpointer type_data, gpointer user_data)
|
||||||
{
|
{
|
||||||
GstPlaySink *playsink;
|
GstPlaySink *playsink;
|
||||||
GstPlayVisChain *chain;
|
GstPlayVisChain *chain;
|
||||||
|
@ -700,9 +703,10 @@ gst_play_sink_vis_blocked (GstPad * tee_pad, GstBlockType type,
|
||||||
chain->vissrcpad);
|
chain->vissrcpad);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
/* Unblock the pad */
|
|
||||||
gst_pad_unblock (tee_pad);
|
|
||||||
GST_PLAY_SINK_UNLOCK (playsink);
|
GST_PLAY_SINK_UNLOCK (playsink);
|
||||||
|
|
||||||
|
/* remove the probe and unblock the pad */
|
||||||
|
return GST_PROBE_REMOVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -739,7 +743,7 @@ 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_block (chain->blockpad, GST_BLOCK_TYPE_DATA,
|
gst_pad_add_probe (chain->blockpad, GST_PROBE_TYPE_BLOCK,
|
||||||
gst_play_sink_vis_blocked, playsink, NULL);
|
gst_play_sink_vis_blocked, playsink, NULL);
|
||||||
done:
|
done:
|
||||||
GST_PLAY_SINK_UNLOCK (playsink);
|
GST_PLAY_SINK_UNLOCK (playsink);
|
||||||
|
@ -2858,8 +2862,9 @@ is_raw_pad (GstPad * pad)
|
||||||
return raw;
|
return raw;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstProbeReturn
|
||||||
sinkpad_blocked_cb (GstPad * blockedpad, GstBlockType type, gpointer user_data)
|
sinkpad_blocked_cb (GstPad * blockedpad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GstPlaySink *playsink = (GstPlaySink *) user_data;
|
GstPlaySink *playsink = (GstPlaySink *) user_data;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
@ -2901,7 +2906,8 @@ sinkpad_blocked_cb (GstPad * blockedpad, GstBlockType type, 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_unblock (opad);
|
gst_pad_remove_probe (opad, playsink->video_block_id);
|
||||||
|
playsink->video_block_id = 0;
|
||||||
gst_object_unref (opad);
|
gst_object_unref (opad);
|
||||||
playsink->video_pad_blocked = FALSE;
|
playsink->video_pad_blocked = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2910,7 +2916,8 @@ sinkpad_blocked_cb (GstPad * blockedpad, GstBlockType type, 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->audio_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);
|
gst_object_unref (opad);
|
||||||
playsink->audio_pad_blocked = FALSE;
|
playsink->audio_pad_blocked = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2919,7 +2926,8 @@ sinkpad_blocked_cb (GstPad * blockedpad, GstBlockType type, 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->text_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);
|
gst_object_unref (opad);
|
||||||
playsink->text_pad_blocked = FALSE;
|
playsink->text_pad_blocked = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2928,6 +2936,8 @@ sinkpad_blocked_cb (GstPad * blockedpad, GstBlockType type, gpointer user_data)
|
||||||
gst_object_unref (pad);
|
gst_object_unref (pad);
|
||||||
|
|
||||||
GST_PLAY_SINK_UNLOCK (playsink);
|
GST_PLAY_SINK_UNLOCK (playsink);
|
||||||
|
|
||||||
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2965,8 +2975,10 @@ 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_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
|
if (playsink->video_block_id == 0)
|
||||||
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
|
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);
|
gst_object_unref (opad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2974,8 +2986,10 @@ 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_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
|
if (playsink->audio_block_id == 0)
|
||||||
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
|
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);
|
gst_object_unref (opad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2983,8 +2997,10 @@ 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_block (opad, GST_BLOCK_TYPE_DATA, sinkpad_blocked_cb,
|
if (playsink->text_block_id == 0)
|
||||||
gst_object_ref (playsink), (GDestroyNotify) gst_object_unref);
|
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_object_unref (opad);
|
||||||
}
|
}
|
||||||
GST_PLAY_SINK_UNLOCK (playsink);
|
GST_PLAY_SINK_UNLOCK (playsink);
|
||||||
|
@ -3007,6 +3023,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
|
||||||
gboolean created = FALSE;
|
gboolean created = FALSE;
|
||||||
gboolean activate = TRUE;
|
gboolean activate = TRUE;
|
||||||
const gchar *pad_name = NULL;
|
const gchar *pad_name = NULL;
|
||||||
|
gulong *block_id = NULL;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (playsink, "request pad type %d", type);
|
GST_DEBUG_OBJECT (playsink, "request pad type %d", type);
|
||||||
|
|
||||||
|
@ -3046,6 +3063,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
|
||||||
}
|
}
|
||||||
playsink->audio_pad_raw = FALSE;
|
playsink->audio_pad_raw = FALSE;
|
||||||
res = playsink->audio_pad;
|
res = playsink->audio_pad;
|
||||||
|
block_id = &playsink->audio_block_id;
|
||||||
break;
|
break;
|
||||||
case GST_PLAY_SINK_TYPE_VIDEO_RAW:
|
case GST_PLAY_SINK_TYPE_VIDEO_RAW:
|
||||||
case GST_PLAY_SINK_TYPE_VIDEO:
|
case GST_PLAY_SINK_TYPE_VIDEO:
|
||||||
|
@ -3060,6 +3078,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
|
||||||
}
|
}
|
||||||
playsink->video_pad_raw = FALSE;
|
playsink->video_pad_raw = FALSE;
|
||||||
res = playsink->video_pad;
|
res = playsink->video_pad;
|
||||||
|
block_id = &playsink->video_block_id;
|
||||||
break;
|
break;
|
||||||
case GST_PLAY_SINK_TYPE_TEXT:
|
case GST_PLAY_SINK_TYPE_TEXT:
|
||||||
GST_LOG_OBJECT (playsink, "ghosting text");
|
GST_LOG_OBJECT (playsink, "ghosting text");
|
||||||
|
@ -3069,6 +3088,7 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
|
||||||
created = TRUE;
|
created = TRUE;
|
||||||
}
|
}
|
||||||
res = playsink->text_pad;
|
res = playsink->text_pad;
|
||||||
|
block_id = &playsink->text_block_id;
|
||||||
break;
|
break;
|
||||||
case GST_PLAY_SINK_TYPE_FLUSHING:
|
case GST_PLAY_SINK_TYPE_FLUSHING:
|
||||||
{
|
{
|
||||||
|
@ -3094,11 +3114,12 @@ gst_play_sink_request_pad (GstPlaySink * playsink, GstPlaySinkType type)
|
||||||
* element is 'running' */
|
* element is 'running' */
|
||||||
gst_pad_set_active (res, TRUE);
|
gst_pad_set_active (res, TRUE);
|
||||||
gst_element_add_pad (GST_ELEMENT_CAST (playsink), res);
|
gst_element_add_pad (GST_ELEMENT_CAST (playsink), res);
|
||||||
if (type != GST_PLAY_SINK_TYPE_FLUSHING) {
|
if (block_id && *block_id == 0) {
|
||||||
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_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_ref (playsink), (GDestroyNotify) gst_object_unref);
|
||||||
gst_object_unref (blockpad);
|
gst_object_unref (blockpad);
|
||||||
}
|
}
|
||||||
|
@ -3350,7 +3371,8 @@ 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)));
|
||||||
gst_pad_unblock (opad);
|
gst_pad_remove_probe (opad, playsink->video_block_id);
|
||||||
|
playsink->video_block_id = 0;
|
||||||
gst_object_unref (opad);
|
gst_object_unref (opad);
|
||||||
playsink->video_pad_blocked = FALSE;
|
playsink->video_pad_blocked = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -3360,7 +3382,8 @@ 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)));
|
||||||
|
|
||||||
gst_pad_unblock (opad);
|
gst_pad_remove_probe (opad, playsink->audio_block_id);
|
||||||
|
playsink->audio_block_id = 0;
|
||||||
gst_object_unref (opad);
|
gst_object_unref (opad);
|
||||||
playsink->audio_pad_blocked = FALSE;
|
playsink->audio_pad_blocked = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -3369,7 +3392,8 @@ 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)));
|
||||||
gst_pad_unblock (opad);
|
gst_pad_remove_probe (opad, playsink->text_block_id);
|
||||||
|
playsink->text_block_id = 0;
|
||||||
gst_object_unref (opad);
|
gst_object_unref (opad);
|
||||||
playsink->text_pad_blocked = FALSE;
|
playsink->text_pad_blocked = FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,15 +72,16 @@ post_missing_element_message (GstPlaySinkAudioConvert * self,
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (self), msg);
|
gst_element_post_message (GST_ELEMENT_CAST (self), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstProbeReturn
|
||||||
pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
|
pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GstPlaySinkAudioConvert *self = user_data;
|
||||||
GstPad *peer;
|
GstPad *peer;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gboolean raw;
|
gboolean raw;
|
||||||
|
|
||||||
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
|
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
|
||||||
self->sink_proxypad_blocked = TRUE;
|
|
||||||
GST_DEBUG_OBJECT (self, "Pad blocked");
|
GST_DEBUG_OBJECT (self, "Pad blocked");
|
||||||
|
|
||||||
/* There must be a peer at this point */
|
/* There must be a peer at this point */
|
||||||
|
@ -204,11 +205,9 @@ pad_blocked_cb (GstPad * pad, gboolean blocked, GstPlaySinkAudioConvert * self)
|
||||||
}
|
}
|
||||||
|
|
||||||
unblock:
|
unblock:
|
||||||
gst_pad_unblock (self->sink_proxypad);
|
|
||||||
self->sink_proxypad_blocked = FALSE;
|
|
||||||
|
|
||||||
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
|
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
|
||||||
return;
|
|
||||||
|
return GST_PROBE_REMOVE;
|
||||||
|
|
||||||
link_failed:
|
link_failed:
|
||||||
{
|
{
|
||||||
|
@ -216,9 +215,29 @@ 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_unblock (self->sink_proxypad);
|
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
|
||||||
self->sink_proxypad_blocked = FALSE;
|
|
||||||
return;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,17 +289,13 @@ 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_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
|
block_proxypad (self);
|
||||||
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
|
|
||||||
(GDestroyNotify) gst_object_unref);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
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 raw to non-raw");
|
GST_DEBUG_OBJECT (self, "Changing caps from raw to non-raw");
|
||||||
reconfigure = TRUE;
|
reconfigure = TRUE;
|
||||||
gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
|
block_proxypad (self);
|
||||||
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
|
|
||||||
(GDestroyNotify) gst_object_unref);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,8 +369,7 @@ gst_play_sink_audio_convert_change_state (GstElement * element,
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
|
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
|
||||||
gst_pad_unblock (self->sink_proxypad);
|
unblock_proxypad (self);
|
||||||
self->sink_proxypad_blocked = FALSE;
|
|
||||||
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
|
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -393,8 +407,7 @@ gst_play_sink_audio_convert_change_state (GstElement * element,
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
|
GST_PLAY_SINK_AUDIO_CONVERT_LOCK (self);
|
||||||
gst_pad_unblock (self->sink_proxypad);
|
unblock_proxypad (self);
|
||||||
self->sink_proxypad_blocked = FALSE;
|
|
||||||
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
|
GST_PLAY_SINK_AUDIO_CONVERT_UNLOCK (self);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct _GstPlaySinkAudioConvert
|
||||||
GMutex *lock;
|
GMutex *lock;
|
||||||
|
|
||||||
GstPad *sinkpad, *sink_proxypad;
|
GstPad *sinkpad, *sink_proxypad;
|
||||||
gboolean sink_proxypad_blocked;
|
gulong sink_proxypad_block_id;
|
||||||
GstSegment segment;
|
GstSegment segment;
|
||||||
|
|
||||||
GstPad *srcpad;
|
GstPad *srcpad;
|
||||||
|
|
|
@ -72,15 +72,16 @@ post_missing_element_message (GstPlaySinkVideoConvert * self,
|
||||||
gst_element_post_message (GST_ELEMENT_CAST (self), msg);
|
gst_element_post_message (GST_ELEMENT_CAST (self), msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstProbeReturn
|
||||||
pad_blocked_cb (GstPad * pad, GstBlockType type, GstPlaySinkVideoConvert * self)
|
pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GstPlaySinkVideoConvert *self = user_data;
|
||||||
GstPad *peer;
|
GstPad *peer;
|
||||||
GstCaps *caps;
|
GstCaps *caps;
|
||||||
gboolean raw;
|
gboolean raw;
|
||||||
|
|
||||||
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
|
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
|
||||||
self->sink_proxypad_blocked = TRUE;
|
|
||||||
GST_DEBUG_OBJECT (self, "Pad blocked");
|
GST_DEBUG_OBJECT (self, "Pad blocked");
|
||||||
|
|
||||||
/* There must be a peer at this point */
|
/* There must be a peer at this point */
|
||||||
|
@ -185,11 +186,9 @@ pad_blocked_cb (GstPad * pad, GstBlockType type, GstPlaySinkVideoConvert * self)
|
||||||
}
|
}
|
||||||
|
|
||||||
unblock:
|
unblock:
|
||||||
gst_pad_unblock (self->sink_proxypad);
|
|
||||||
self->sink_proxypad_blocked = FALSE;
|
|
||||||
|
|
||||||
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
|
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
|
||||||
return;
|
|
||||||
|
return GST_PROBE_REMOVE;
|
||||||
|
|
||||||
link_failed:
|
link_failed:
|
||||||
{
|
{
|
||||||
|
@ -197,9 +196,29 @@ link_failed:
|
||||||
(NULL), ("Failed to configure the video converter."));
|
(NULL), ("Failed to configure the video 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_unblock (self->sink_proxypad);
|
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
|
||||||
self->sink_proxypad_blocked = FALSE;
|
|
||||||
|
return GST_PROBE_REMOVE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
block_proxypad (GstPlaySinkVideoConvert * self)
|
||||||
|
{
|
||||||
|
if (self->sink_proxypad_block_id != 0)
|
||||||
return;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,17 +271,13 @@ gst_play_sink_video_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_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
|
block_proxypad (self);
|
||||||
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
|
|
||||||
(GDestroyNotify) gst_object_unref);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
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 raw to non-raw");
|
GST_DEBUG_OBJECT (self, "Changing caps from raw to non-raw");
|
||||||
reconfigure = TRUE;
|
reconfigure = TRUE;
|
||||||
gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
|
block_proxypad (self);
|
||||||
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
|
|
||||||
(GDestroyNotify) gst_object_unref);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,8 +348,7 @@ gst_play_sink_video_convert_change_state (GstElement * element,
|
||||||
switch (transition) {
|
switch (transition) {
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
|
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
|
||||||
gst_pad_unblock (self->sink_proxypad);
|
unblock_proxypad (self);
|
||||||
self->sink_proxypad_blocked = FALSE;
|
|
||||||
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
|
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -367,9 +381,7 @@ gst_play_sink_video_convert_change_state (GstElement * element,
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
|
GST_PLAY_SINK_VIDEO_CONVERT_LOCK (self);
|
||||||
if (!gst_pad_is_blocked (self->sink_proxypad))
|
if (!gst_pad_is_blocked (self->sink_proxypad))
|
||||||
gst_pad_block (self->sink_proxypad, GST_BLOCK_TYPE_DATA,
|
block_proxypad (self);
|
||||||
(GstPadBlockCallback) pad_blocked_cb, gst_object_ref (self),
|
|
||||||
(GDestroyNotify) gst_object_unref);
|
|
||||||
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
|
GST_PLAY_SINK_VIDEO_CONVERT_UNLOCK (self);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -64,7 +64,7 @@ struct _GstPlaySinkVideoConvert
|
||||||
GMutex *lock;
|
GMutex *lock;
|
||||||
|
|
||||||
GstPad *sinkpad, *sink_proxypad;
|
GstPad *sinkpad, *sink_proxypad;
|
||||||
gboolean sink_proxypad_blocked;
|
gulong sink_proxypad_block_id;
|
||||||
GstSegment segment;
|
GstSegment segment;
|
||||||
|
|
||||||
GstPad *srcpad;
|
GstPad *srcpad;
|
||||||
|
|
|
@ -175,9 +175,11 @@ gst_stream_info_init (GstStreamInfo * stream_info)
|
||||||
stream_info->caps = NULL;
|
stream_info->caps = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
cb_probe (GstPad * pad, GstEvent * e, gpointer user_data)
|
cb_probe (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GstEvent *e = type_data;
|
||||||
GstStreamInfo *info = user_data;
|
GstStreamInfo *info = user_data;
|
||||||
|
|
||||||
if (GST_EVENT_TYPE (e) == GST_EVENT_TAG) {
|
if (GST_EVENT_TYPE (e) == GST_EVENT_TAG) {
|
||||||
|
@ -225,8 +227,8 @@ gst_stream_info_new (GstObject * object,
|
||||||
|
|
||||||
gst_object_ref (object);
|
gst_object_ref (object);
|
||||||
if (GST_IS_PAD (object)) {
|
if (GST_IS_PAD (object)) {
|
||||||
gst_pad_add_event_probe (GST_PAD_CAST (object),
|
gst_pad_add_probe (GST_PAD_CAST (object), GST_PROBE_TYPE_EVENT,
|
||||||
G_CALLBACK (cb_probe), info);
|
cb_probe, info, NULL);
|
||||||
}
|
}
|
||||||
info->object = object;
|
info->object = object;
|
||||||
info->type = type;
|
info->type = type;
|
||||||
|
|
|
@ -82,9 +82,6 @@ enum
|
||||||
#define gst_subtitle_overlay_parent_class parent_class
|
#define gst_subtitle_overlay_parent_class parent_class
|
||||||
G_DEFINE_TYPE (GstSubtitleOverlay, gst_subtitle_overlay, GST_TYPE_BIN);
|
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 GQuark _subtitle_overlay_event_marker_id = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -112,6 +109,58 @@ do_async_done (GstSubtitleOverlay * self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
static void
|
||||||
gst_subtitle_overlay_finalize (GObject * object)
|
gst_subtitle_overlay_finalize (GObject * object)
|
||||||
{
|
{
|
||||||
|
@ -590,13 +639,8 @@ _setup_passthrough (GstSubtitleOverlay * self)
|
||||||
|
|
||||||
out:
|
out:
|
||||||
/* Unblock pads */
|
/* Unblock pads */
|
||||||
gst_pad_unblock (self->video_block_pad);
|
unblock_video (self);
|
||||||
self->video_sink_blocked = FALSE;
|
unblock_subtitle (self);
|
||||||
|
|
||||||
if (self->subtitle_sink_blocked) {
|
|
||||||
gst_pad_unblock (self->subtitle_block_pad);
|
|
||||||
self->subtitle_sink_blocked = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -667,8 +711,9 @@ _has_font_desc_property (GstElement * element)
|
||||||
return (pspec && pspec->value_type == G_TYPE_STRING);
|
return (pspec && pspec->value_type == G_TYPE_STRING);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstProbeReturn
|
||||||
_pad_blocked_cb (GstPad * pad, GstBlockType type, gpointer user_data)
|
_pad_blocked_cb (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY_CAST (user_data);
|
GstSubtitleOverlay *self = GST_SUBTITLE_OVERLAY_CAST (user_data);
|
||||||
GstCaps *subcaps;
|
GstCaps *subcaps;
|
||||||
|
@ -733,13 +778,8 @@ _pad_blocked_cb (GstPad * pad, GstBlockType type, gpointer user_data)
|
||||||
gst_object_unref (target);
|
gst_object_unref (target);
|
||||||
|
|
||||||
/* Unblock pads */
|
/* Unblock pads */
|
||||||
gst_pad_unblock (self->video_block_pad);
|
unblock_video (self);
|
||||||
self->video_sink_blocked = FALSE;
|
unblock_subtitle (self);
|
||||||
|
|
||||||
if (self->subtitle_sink_blocked) {
|
|
||||||
gst_pad_unblock (self->subtitle_block_pad);
|
|
||||||
self->subtitle_sink_blocked = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
} else if (target) {
|
} else if (target) {
|
||||||
|
@ -749,9 +789,7 @@ _pad_blocked_cb (GstPad * pad, GstBlockType type, gpointer user_data)
|
||||||
|
|
||||||
if (self->subtitle_sink_blocked && !self->video_sink_blocked) {
|
if (self->subtitle_sink_blocked && !self->video_sink_blocked) {
|
||||||
GST_DEBUG_OBJECT (self, "Subtitle sink blocked but video not blocked");
|
GST_DEBUG_OBJECT (self, "Subtitle sink blocked but video not blocked");
|
||||||
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
|
block_video (self);
|
||||||
_pad_blocked_cb, gst_object_ref (self),
|
|
||||||
(GDestroyNotify) gst_object_unref);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1198,10 +1236,8 @@ _pad_blocked_cb (GstPad * pad, GstBlockType type, gpointer user_data)
|
||||||
do_async_done (self);
|
do_async_done (self);
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (self, "Everything worked, unblocking pads");
|
GST_DEBUG_OBJECT (self, "Everything worked, unblocking pads");
|
||||||
gst_pad_unblock (self->video_block_pad);
|
unblock_video (self);
|
||||||
self->video_sink_blocked = FALSE;
|
unblock_subtitle (self);
|
||||||
gst_pad_unblock (self->subtitle_block_pad);
|
|
||||||
self->subtitle_sink_blocked = FALSE;
|
|
||||||
do_async_done (self);
|
do_async_done (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1209,6 +1245,8 @@ out:
|
||||||
if (factories)
|
if (factories)
|
||||||
gst_plugin_feature_list_free (factories);
|
gst_plugin_feature_list_free (factories);
|
||||||
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
||||||
|
|
||||||
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
|
@ -1230,12 +1268,8 @@ gst_subtitle_overlay_change_state (GstElement * element,
|
||||||
|
|
||||||
GST_SUBTITLE_OVERLAY_LOCK (self);
|
GST_SUBTITLE_OVERLAY_LOCK (self);
|
||||||
/* Set the internal pads to blocking */
|
/* Set the internal pads to blocking */
|
||||||
gst_pad_block (self->video_block_pad, GST_BLOCK_TYPE_DATA,
|
block_video (self);
|
||||||
_pad_blocked_cb, gst_object_ref (self),
|
block_subtitle (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);
|
|
||||||
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||||
|
@ -1284,9 +1318,7 @@ gst_subtitle_overlay_change_state (GstElement * element,
|
||||||
do_async_done (self);
|
do_async_done (self);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:{
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
GstPad *pad;
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "State change READY->NULL");
|
GST_DEBUG_OBJECT (self, "State change READY->NULL");
|
||||||
|
|
||||||
GST_SUBTITLE_OVERLAY_LOCK (self);
|
GST_SUBTITLE_OVERLAY_LOCK (self);
|
||||||
|
@ -1299,17 +1331,8 @@ gst_subtitle_overlay_change_state (GstElement * element,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Unblock pads */
|
/* Unblock pads */
|
||||||
if (self->video_block_pad) {
|
unblock_video (self);
|
||||||
pad = self->video_block_pad;
|
unblock_subtitle (self);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove elements */
|
/* Remove elements */
|
||||||
self->silent_property = NULL;
|
self->silent_property = NULL;
|
||||||
|
@ -1322,7 +1345,6 @@ gst_subtitle_overlay_change_state (GstElement * element,
|
||||||
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1367,13 +1389,8 @@ gst_subtitle_overlay_handle_message (GstBin * bin, GstMessage * message)
|
||||||
GST_SUBTITLE_OVERLAY_LOCK (self);
|
GST_SUBTITLE_OVERLAY_LOCK (self);
|
||||||
self->subtitle_error = TRUE;
|
self->subtitle_error = TRUE;
|
||||||
|
|
||||||
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
|
block_subtitle (self);
|
||||||
_pad_blocked_cb, gst_object_ref (self),
|
block_video (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);
|
|
||||||
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1428,13 +1445,8 @@ gst_subtitle_overlay_set_property (GObject * object, guint prop_id,
|
||||||
else if (self->renderer)
|
else if (self->renderer)
|
||||||
g_object_set (self->renderer, self->silent_property, silent, NULL);
|
g_object_set (self->renderer, self->silent_property, silent, NULL);
|
||||||
} else {
|
} else {
|
||||||
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
|
block_subtitle (self);
|
||||||
_pad_blocked_cb, gst_object_ref (self),
|
block_video (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);
|
|
||||||
}
|
}
|
||||||
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
||||||
break;
|
break;
|
||||||
|
@ -1665,13 +1677,8 @@ gst_subtitle_overlay_video_sink_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
gst_flow_get_name (ret));
|
gst_flow_get_name (ret));
|
||||||
GST_SUBTITLE_OVERLAY_LOCK (self);
|
GST_SUBTITLE_OVERLAY_LOCK (self);
|
||||||
self->subtitle_error = TRUE;
|
self->subtitle_error = TRUE;
|
||||||
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
|
block_subtitle (self);
|
||||||
_pad_blocked_cb, gst_object_ref (self),
|
block_video (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);
|
|
||||||
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
@ -1696,13 +1703,8 @@ gst_subtitle_overlay_subtitle_sink_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
gst_flow_get_name (ret));
|
gst_flow_get_name (ret));
|
||||||
GST_SUBTITLE_OVERLAY_LOCK (self);
|
GST_SUBTITLE_OVERLAY_LOCK (self);
|
||||||
self->subtitle_error = TRUE;
|
self->subtitle_error = TRUE;
|
||||||
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
|
block_subtitle (self);
|
||||||
_pad_blocked_cb, gst_object_ref (self),
|
block_video (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);
|
|
||||||
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
|
@ -1772,14 +1774,8 @@ gst_subtitle_overlay_subtitle_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
GST_DEBUG_OBJECT (pad, "Target did not accept caps");
|
GST_DEBUG_OBJECT (pad, "Target did not accept caps");
|
||||||
|
|
||||||
self->subtitle_error = FALSE;
|
self->subtitle_error = FALSE;
|
||||||
|
block_subtitle (self);
|
||||||
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
|
block_video (self);
|
||||||
_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);
|
|
||||||
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@ -1814,13 +1810,8 @@ gst_subtitle_overlay_subtitle_sink_link (GstPad * pad, GstPad * peer)
|
||||||
|
|
||||||
self->subtitle_error = FALSE;
|
self->subtitle_error = FALSE;
|
||||||
|
|
||||||
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
|
block_subtitle (self);
|
||||||
_pad_blocked_cb, gst_object_ref (self),
|
block_video (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);
|
|
||||||
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
@ -1849,15 +1840,8 @@ gst_subtitle_overlay_subtitle_sink_unlink (GstPad * pad)
|
||||||
GST_SUBTITLE_OVERLAY_LOCK (self);
|
GST_SUBTITLE_OVERLAY_LOCK (self);
|
||||||
self->subtitle_error = FALSE;
|
self->subtitle_error = FALSE;
|
||||||
|
|
||||||
if (self->subtitle_block_pad)
|
block_subtitle (self);
|
||||||
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
|
block_video (self);
|
||||||
_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);
|
|
||||||
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
||||||
|
|
||||||
gst_object_unref (self);
|
gst_object_unref (self);
|
||||||
|
@ -1875,14 +1859,8 @@ gst_subtitle_overlay_subtitle_sink_event (GstPad * pad, GstEvent * event)
|
||||||
GST_SUBTITLE_OVERLAY_LOCK (self);
|
GST_SUBTITLE_OVERLAY_LOCK (self);
|
||||||
self->subtitle_flush = TRUE;
|
self->subtitle_flush = TRUE;
|
||||||
self->subtitle_error = FALSE;
|
self->subtitle_error = FALSE;
|
||||||
if (self->subtitle_block_pad)
|
block_subtitle (self);
|
||||||
gst_pad_block (self->subtitle_block_pad, GST_BLOCK_TYPE_DATA,
|
block_video (self);
|
||||||
_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);
|
|
||||||
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
GST_SUBTITLE_OVERLAY_UNLOCK (self);
|
||||||
|
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
|
|
|
@ -72,12 +72,14 @@ struct _GstSubtitleOverlay
|
||||||
|
|
||||||
GstPad *video_sinkpad;
|
GstPad *video_sinkpad;
|
||||||
GstPad *video_block_pad;
|
GstPad *video_block_pad;
|
||||||
|
gulong video_block_id;
|
||||||
gboolean video_sink_blocked;
|
gboolean video_sink_blocked;
|
||||||
GstSegment video_segment;
|
GstSegment video_segment;
|
||||||
gint fps_n, fps_d;
|
gint fps_n, fps_d;
|
||||||
|
|
||||||
GstPad *subtitle_sinkpad;
|
GstPad *subtitle_sinkpad;
|
||||||
GstPad *subtitle_block_pad;
|
GstPad *subtitle_block_pad;
|
||||||
|
gulong subtitle_block_id;
|
||||||
gboolean subtitle_sink_blocked;
|
gboolean subtitle_sink_blocked;
|
||||||
GstSegment subtitle_segment;
|
GstSegment subtitle_segment;
|
||||||
gboolean subtitle_flush;
|
gboolean subtitle_flush;
|
||||||
|
|
|
@ -986,10 +986,13 @@ configure_stream_buffering (GstURIDecodeBin * decoder)
|
||||||
gst_object_unref (queue);
|
gst_object_unref (queue);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
decoded_pad_event_probe (GstPad * pad, GstEvent * event,
|
decoded_pad_event_probe (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
GstURIDecodeBin * decoder)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GstEvent *event = type_data;
|
||||||
|
GstURIDecodeBin *decoder = user_data;
|
||||||
|
|
||||||
GST_LOG_OBJECT (pad, "%s, decoder %p", GST_EVENT_TYPE_NAME (event), decoder);
|
GST_LOG_OBJECT (pad, "%s, decoder %p", GST_EVENT_TYPE_NAME (event), decoder);
|
||||||
|
|
||||||
/* look for a bitrate tag */
|
/* look for a bitrate tag */
|
||||||
|
@ -1013,7 +1016,7 @@ decoded_pad_event_probe (GstPad * pad, GstEvent * event,
|
||||||
if (stream) {
|
if (stream) {
|
||||||
stream->bitrate = bitrate;
|
stream->bitrate = bitrate;
|
||||||
/* no longer need this probe now */
|
/* 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 buffer if possible */
|
||||||
configure_stream_buffering (decoder);
|
configure_stream_buffering (decoder);
|
||||||
}
|
}
|
||||||
|
@ -1025,7 +1028,7 @@ decoded_pad_event_probe (GstPad * pad, GstEvent * event,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* never drop */
|
/* never drop */
|
||||||
return TRUE;
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called by the signal handlers when a decodebin has
|
/* Called by the signal handlers when a decodebin has
|
||||||
|
@ -1059,8 +1062,8 @@ new_decoded_pad_cb (GstElement * element, GstPad * pad, gboolean last,
|
||||||
/* add event probe to monitor tags */
|
/* add event probe to monitor tags */
|
||||||
stream = g_slice_alloc0 (sizeof (GstURIDecodeBinStream));
|
stream = g_slice_alloc0 (sizeof (GstURIDecodeBinStream));
|
||||||
stream->probe_id =
|
stream->probe_id =
|
||||||
gst_pad_add_event_probe (pad, G_CALLBACK (decoded_pad_event_probe),
|
gst_pad_add_probe (pad, GST_PROBE_TYPE_EVENT, decoded_pad_event_probe,
|
||||||
decoder);
|
decoder, NULL);
|
||||||
GST_URI_DECODE_BIN_LOCK (decoder);
|
GST_URI_DECODE_BIN_LOCK (decoder);
|
||||||
g_hash_table_insert (decoder->streams, pad, stream);
|
g_hash_table_insert (decoder->streams, pad, stream);
|
||||||
GST_URI_DECODE_BIN_UNLOCK (decoder);
|
GST_URI_DECODE_BIN_UNLOCK (decoder);
|
||||||
|
@ -1069,10 +1072,13 @@ new_decoded_pad_cb (GstElement * element, GstPad * pad, gboolean last,
|
||||||
gst_element_add_pad (GST_ELEMENT_CAST (decoder), newpad);
|
gst_element_add_pad (GST_ELEMENT_CAST (decoder), newpad);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
source_pad_event_probe (GstPad * pad, GstEvent * event,
|
source_pad_event_probe (GstPad * pad, GstProbeType type, gpointer type_data,
|
||||||
GstURIDecodeBin * decoder)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
GstEvent *event = type_data;
|
||||||
|
GstURIDecodeBin *decoder = user_data;
|
||||||
|
|
||||||
GST_LOG_OBJECT (pad, "%s, decoder %p", GST_EVENT_TYPE_NAME (event), decoder);
|
GST_LOG_OBJECT (pad, "%s, decoder %p", GST_EVENT_TYPE_NAME (event), decoder);
|
||||||
|
|
||||||
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
if (GST_EVENT_TYPE (event) == GST_EVENT_EOS) {
|
||||||
|
@ -1082,7 +1088,7 @@ source_pad_event_probe (GstPad * pad, GstEvent * event,
|
||||||
gst_uri_decode_bin_signals[SIGNAL_DRAINED], 0, NULL);
|
gst_uri_decode_bin_signals[SIGNAL_DRAINED], 0, NULL);
|
||||||
}
|
}
|
||||||
/* never drop events */
|
/* 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
|
/* called when we found a raw pad on the source element. We need to set up a
|
||||||
|
@ -1091,7 +1097,8 @@ static void
|
||||||
expose_decoded_pad (GstElement * element, GstPad * pad,
|
expose_decoded_pad (GstElement * element, GstPad * pad,
|
||||||
GstURIDecodeBin * decoder)
|
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);
|
new_decoded_pad_cb (element, pad, FALSE, decoder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,12 +31,16 @@ check_position (GstElement * elem, GstQuery * pos, const gchar * info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static GstProbeReturn
|
||||||
print_buffer_ts (GstPad * pad, GstBuffer * buffer, gpointer user_data)
|
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_DEBUG_OBJECT (pad, " ts: %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
|
||||||
return TRUE;
|
|
||||||
|
return GST_PROBE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
|
@ -119,7 +123,8 @@ main (gint argc, gchar ** argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
src_pad = gst_element_get_static_pad (src, "src");
|
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);
|
gst_object_unref (src_pad);
|
||||||
|
|
||||||
/* add a controller to the source */
|
/* add a controller to the source */
|
||||||
|
|
Loading…
Reference in a new issue