mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-19 22:05:58 +00:00
libs/gst/base/gstbasesrc.c: Handle element seek correctly when we are streaming.
Original commit message from CVS: Inspired by a patch of: Lutz Mueller <lutz at topfrose dot de> * libs/gst/base/gstbasesrc.c: (gst_base_src_finalize), (gst_base_src_send_event), (gst_base_src_change_state): Handle element seek correctly when we are streaming. Fixes #326998.
This commit is contained in:
parent
d5aa0e9723
commit
6b3b2678bb
3 changed files with 56 additions and 11 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2006-03-27 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
Inspired by a patch of: Lutz Mueller <lutz at topfrose dot de>
|
||||||
|
|
||||||
|
* libs/gst/base/gstbasesrc.c: (gst_base_src_finalize),
|
||||||
|
(gst_base_src_send_event), (gst_base_src_change_state):
|
||||||
|
Handle element seek correctly when we are streaming.
|
||||||
|
Fixes #326998.
|
||||||
|
|
||||||
2006-03-24 Michael Smith <msmith@fluendo.com>
|
2006-03-24 Michael Smith <msmith@fluendo.com>
|
||||||
|
|
||||||
* docs/faq/gst-uninstalled:
|
* docs/faq/gst-uninstalled:
|
||||||
|
|
2
common
2
common
|
@ -1 +1 @@
|
||||||
Subproject commit 252846b570144570a0aee25b5adefbfac3f5d4eb
|
Subproject commit 45cc64e522d61410eb8d1a3e7ef67569851cd77a
|
|
@ -388,6 +388,7 @@ gst_base_src_finalize (GObject * object)
|
||||||
|
|
||||||
g_mutex_free (basesrc->live_lock);
|
g_mutex_free (basesrc->live_lock);
|
||||||
g_cond_free (basesrc->live_cond);
|
g_cond_free (basesrc->live_cond);
|
||||||
|
gst_event_replace (&basesrc->data.ABI.pending_seek, NULL);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
@ -877,30 +878,64 @@ static gboolean
|
||||||
gst_base_src_send_event (GstElement * element, GstEvent * event)
|
gst_base_src_send_event (GstElement * element, GstEvent * event)
|
||||||
{
|
{
|
||||||
GstBaseSrc *src;
|
GstBaseSrc *src;
|
||||||
gboolean result;
|
gboolean result = FALSE;
|
||||||
|
|
||||||
src = GST_BASE_SRC (element);
|
src = GST_BASE_SRC (element);
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
|
case GST_EVENT_FLUSH_START:
|
||||||
|
case GST_EVENT_FLUSH_STOP:
|
||||||
|
break;
|
||||||
|
case GST_EVENT_EOS:
|
||||||
|
case GST_EVENT_NEWSEGMENT:
|
||||||
|
case GST_EVENT_TAG:
|
||||||
|
case GST_EVENT_BUFFERSIZE:
|
||||||
|
break;
|
||||||
|
case GST_EVENT_QOS:
|
||||||
|
break;
|
||||||
case GST_EVENT_SEEK:
|
case GST_EVENT_SEEK:
|
||||||
{
|
{
|
||||||
|
gboolean started;
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (src->srcpad);
|
||||||
|
if (GST_PAD_ACTIVATE_MODE (src->srcpad) == GST_ACTIVATE_PULL)
|
||||||
|
goto wrong_mode;
|
||||||
|
started = GST_PAD_ACTIVATE_MODE (src->srcpad) == GST_ACTIVATE_PUSH;
|
||||||
|
GST_OBJECT_UNLOCK (src->srcpad);
|
||||||
|
|
||||||
|
if (started) {
|
||||||
|
/* when we are running in push mode, we can execute the
|
||||||
|
* seek right now, we need to unlock. */
|
||||||
|
result = gst_base_src_perform_seek (src, event, TRUE);
|
||||||
|
} else {
|
||||||
|
/* else we store the event and execute the seek when we
|
||||||
|
* get activated */
|
||||||
GST_OBJECT_LOCK (src);
|
GST_OBJECT_LOCK (src);
|
||||||
/* gst_event_replace? */
|
gst_event_replace (&src->data.ABI.pending_seek, event);
|
||||||
if (src->data.ABI.pending_seek)
|
|
||||||
gst_event_unref (src->data.ABI.pending_seek);
|
|
||||||
gst_event_ref (event);
|
|
||||||
src->data.ABI.pending_seek = event;
|
|
||||||
GST_OBJECT_UNLOCK (src);
|
GST_OBJECT_UNLOCK (src);
|
||||||
|
/* assume the seek will work */
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_EVENT_NAVIGATION:
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
result = FALSE;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
done:
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
/* ERRORS */
|
||||||
|
wrong_mode:
|
||||||
|
{
|
||||||
|
GST_DEBUG_OBJECT (src, "cannot perform seek when operating in pull mode");
|
||||||
|
GST_OBJECT_UNLOCK (src->srcpad);
|
||||||
|
result = FALSE;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -1833,6 +1868,7 @@ gst_base_src_change_state (GstElement * element, GstStateChange transition)
|
||||||
gst_pad_push_event (basesrc->srcpad, gst_event_new_eos ());
|
gst_pad_push_event (basesrc->srcpad, gst_event_new_eos ());
|
||||||
basesrc->priv->last_sent_eos = TRUE;
|
basesrc->priv->last_sent_eos = TRUE;
|
||||||
}
|
}
|
||||||
|
gst_event_replace (&basesrc->data.ABI.pending_seek, NULL);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue