gst/playback/: Some more work on making sure seeking pauses the pipeline and that changing the uri actually does some...

Original commit message from CVS:
* gst/playback/gstplaybasebin.c: (queue_overrun), (no_more_pads),
(setup_source), (gst_play_base_bin_set_property),
(gst_play_base_bin_add_element):
* gst/playback/gstplaybin.c: (gst_play_bin_send_event):
Some more work on making sure seeking pauses the pipeline and
that changing the uri actually does something.
This commit is contained in:
Wim Taymans 2004-09-14 16:54:14 +00:00
parent 761b17e400
commit 87eb159d81
3 changed files with 38 additions and 2 deletions

View file

@ -1,3 +1,12 @@
2004-09-17 Wim Taymans <wim@fluendo.com>
* gst/playback/gstplaybasebin.c: (queue_overrun), (no_more_pads),
(setup_source), (gst_play_base_bin_set_property),
(gst_play_base_bin_add_element):
* gst/playback/gstplaybin.c: (gst_play_bin_send_event):
Some more work on making sure seeking pauses the pipeline and
that changing the uri actually does something.
2004-09-17 Wim Taymans <wim@fluendo.com> 2004-09-17 Wim Taymans <wim@fluendo.com>
* gst/tcp/gstfdset.c: (gst_fdset_wait): * gst/tcp/gstfdset.c: (gst_fdset_wait):

View file

@ -196,8 +196,11 @@ gst_play_base_bin_dispose (GObject * object)
static void static void
queue_overrun (GstElement * element, GstPlayBaseBin * play_base_bin) queue_overrun (GstElement * element, GstPlayBaseBin * play_base_bin)
{ {
GST_DEBUG ("queue %s overrun", gst_element_get_name (element));
g_mutex_lock (play_base_bin->preroll_lock); g_mutex_lock (play_base_bin->preroll_lock);
GST_DEBUG ("signal preroll done");
g_cond_signal (play_base_bin->preroll_cond); g_cond_signal (play_base_bin->preroll_cond);
GST_DEBUG ("signaled preroll done");
g_mutex_unlock (play_base_bin->preroll_lock); g_mutex_unlock (play_base_bin->preroll_lock);
} }
@ -259,7 +262,9 @@ no_more_pads (GstElement * element, GstPlayBaseBin * play_base_bin)
{ {
GST_DEBUG ("no more pads"); GST_DEBUG ("no more pads");
g_mutex_lock (play_base_bin->preroll_lock); g_mutex_lock (play_base_bin->preroll_lock);
GST_DEBUG ("signal preroll done");
g_cond_signal (play_base_bin->preroll_cond); g_cond_signal (play_base_bin->preroll_cond);
GST_DEBUG ("signaled preroll done");
g_mutex_unlock (play_base_bin->preroll_lock); g_mutex_unlock (play_base_bin->preroll_lock);
} }
@ -384,7 +389,9 @@ setup_source (GstPlayBaseBin * play_base_bin)
*/ */
g_mutex_lock (play_base_bin->preroll_lock); g_mutex_lock (play_base_bin->preroll_lock);
gst_element_set_state (play_base_bin->thread, GST_STATE_PLAYING); gst_element_set_state (play_base_bin->thread, GST_STATE_PLAYING);
GST_DEBUG ("waiting for preroll...");
g_cond_wait (play_base_bin->preroll_cond, play_base_bin->preroll_lock); g_cond_wait (play_base_bin->preroll_cond, play_base_bin->preroll_lock);
GST_DEBUG ("preroll done !");
g_mutex_unlock (play_base_bin->preroll_lock); g_mutex_unlock (play_base_bin->preroll_lock);
g_signal_handler_disconnect (G_OBJECT (play_base_bin->decoder), sig3); g_signal_handler_disconnect (G_OBJECT (play_base_bin->decoder), sig3);
@ -416,10 +423,14 @@ gst_play_base_bin_set_property (GObject * object, guint prop_id,
g_warning ("cannot set NULL uri"); g_warning ("cannot set NULL uri");
return; return;
} }
if (!play_base_bin->uri || strcmp (play_base_bin->uri, uri) != 0) { /* if we have no previous uri, or the new uri is different from the
* old one, replug */
if (play_base_bin->uri == NULL || strcmp (play_base_bin->uri, uri) != 0) {
g_free (play_base_bin->uri); g_free (play_base_bin->uri);
play_base_bin->uri = g_strdup (uri); play_base_bin->uri = g_strdup (uri);
GST_DEBUG ("setting new uri to %s", uri);
play_base_bin->need_rebuild = TRUE; play_base_bin->need_rebuild = TRUE;
} }
break; break;
@ -562,11 +573,15 @@ gst_play_base_bin_add_element (GstBin * bin, GstElement * element)
} }
gst_bin_add (GST_BIN (play_base_bin->thread), element); gst_bin_add (GST_BIN (play_base_bin->thread), element);
/* hack */
sched = gst_element_get_scheduler (GST_ELEMENT (play_base_bin->thread)); sched = gst_element_get_scheduler (GST_ELEMENT (play_base_bin->thread));
clock = gst_scheduler_get_clock (sched); clock = gst_scheduler_get_clock (sched);
gst_scheduler_set_clock (sched, clock); gst_scheduler_set_clock (sched, clock);
//gst_element_sync_state_with_parent (element); /* FIXME set element to READY so that negotiation can happen. This
* currently fails because of weird negotiation problems. */
/* gst_element_set_state (element, GST_STATE_READY); */
} else { } else {
g_warning ("adding elements is not allowed in NULL"); g_warning ("adding elements is not allowed in NULL");
} }

View file

@ -458,9 +458,17 @@ gst_play_bin_send_event (GstElement * element, GstEvent * event)
gboolean res = FALSE; gboolean res = FALSE;
GList *s; GList *s;
GstPlayBin *play_bin; GstPlayBin *play_bin;
GstElementState state;
gboolean need_pause = FALSE;
play_bin = GST_PLAY_BIN (element); play_bin = GST_PLAY_BIN (element);
state = gst_element_get_state (element);
if (state == GST_STATE_PLAYING) {
need_pause = TRUE;
gst_element_set_state (element, GST_STATE_PAUSED);
}
s = play_bin->seekables; s = play_bin->seekables;
for (s = play_bin->seekables; s; s = g_list_next (s)) { for (s = play_bin->seekables; s; s = g_list_next (s)) {
@ -472,6 +480,10 @@ gst_play_bin_send_event (GstElement * element, GstEvent * event)
res |= ok; res |= ok;
} }
gst_event_unref (event); gst_event_unref (event);
if (need_pause)
gst_element_set_state (element, GST_STATE_PLAYING);
return res; return res;
} }