gst/playback/gstdecodebin.c: Don't post STATE_DIRTY anymore.

Original commit message from CVS:
* gst/playback/gstdecodebin.c: (remove_fakesink):
Don't post STATE_DIRTY anymore.
* gst/playback/gstplaybin.c: (add_sink), (gst_play_bin_send_event),
(gst_play_bin_change_state):
Remove stream_time reset in seek handling, core does that now.
Disable clocking for live pipelines by forcing a NULL clock to the
complete pipeline, core is too smart now for our previous hack.
We can always autoplug in PAUSED now.
This commit is contained in:
Wim Taymans 2007-03-19 10:52:50 +00:00
parent 819e097960
commit d24780a03b
3 changed files with 24 additions and 59 deletions

View file

@ -1,3 +1,15 @@
2007-03-19 Wim Taymans <wim@fluendo.com>
* gst/playback/gstdecodebin.c: (remove_fakesink):
Don't post STATE_DIRTY anymore.
* gst/playback/gstplaybin.c: (add_sink), (gst_play_bin_send_event),
(gst_play_bin_change_state):
Remove stream_time reset in seek handling, core does that now.
Disable clocking for live pipelines by forcing a NULL clock to the
complete pipeline, core is too smart now for our previous hack.
We can always autoplug in PAUSED now.
2007-03-17 David Schleef <ds@schleef.org> 2007-03-17 David Schleef <ds@schleef.org>
* REQUIREMENTS: Update this file, change the formatting to make * REQUIREMENTS: Update this file, change the formatting to make

View file

@ -622,9 +622,6 @@ remove_fakesink (GstDecodeBin * decode_bin)
if (removed_fakesink) { if (removed_fakesink) {
free_pad_probes (decode_bin); free_pad_probes (decode_bin);
gst_element_post_message (GST_ELEMENT_CAST (decode_bin),
gst_message_new_state_dirty (GST_OBJECT_CAST (decode_bin)));
} }
} }

View file

@ -1137,8 +1137,8 @@ link_failed:
* visualisation ouput. The idea is to split the audio using tee, then * visualisation ouput. The idea is to split the audio using tee, then
* sending the output to the regular audio bin and the other output to * sending the output to the regular audio bin and the other output to
* the vis plugin that transforms it into a video that is rendered with the * the vis plugin that transforms it into a video that is rendered with the
* normal video bin. The video bin is run in a thread to make sure it does * normal video bin. The video and audio bins are run in threads to make sure
* not block the audio playback pipeline. * they don't block eachother.
* *
* +-----------------------------------------------------------------------+ * +-----------------------------------------------------------------------+
* | visbin | * | visbin |
@ -1154,7 +1154,7 @@ link_failed:
* | | | | | * | | | | |
* | | +------+ | * | | +------+ |
* sink-+ | * sink-+ |
+------------------------------------------------------------------------+ * +-----------------------------------------------------------------------+
*/ */
static GstElement * static GstElement *
gen_vis_element (GstPlayBin * play_bin) gen_vis_element (GstPlayBin * play_bin)
@ -1407,12 +1407,7 @@ add_sink (GstPlayBin * play_bin, GstElement * sink, GstPad * srcpad,
g_return_val_if_fail (sink != NULL, FALSE); g_return_val_if_fail (sink != NULL, FALSE);
/* For live pipelines we need to add the bin in the same state as the state = GST_STATE_PAUSED;
* parent so that it starts as soon as it is prerolled. */
if (play_bin->is_live)
state = GST_STATE_PLAYING;
else
state = GST_STATE_PAUSED;
/* this is only for debugging */ /* this is only for debugging */
parent = gst_pad_get_parent_element (srcpad); parent = gst_pad_get_parent_element (srcpad);
@ -1425,10 +1420,12 @@ add_sink (GstPlayBin * play_bin, GstElement * sink, GstPad * srcpad,
/* for live pipelines, disable the sync in the sinks until core handles this /* for live pipelines, disable the sync in the sinks until core handles this
* correctly. */ * correctly. */
if (play_bin->is_live) if (play_bin->is_live) {
gst_pipeline_use_clock (GST_PIPELINE (play_bin), NULL);
gst_element_set_clock (sink, NULL); gst_element_set_clock (sink, NULL);
}
/* bring it to the PAUSED state so we can link to the peer without /* bring it to the required state so we can link to the peer without
* breaking the flow */ * breaking the flow */
stateret = gst_element_set_state (sink, state); stateret = gst_element_set_state (sink, state);
if (stateret == GST_STATE_CHANGE_FAILURE) if (stateret == GST_STATE_CHANGE_FAILURE)
@ -1677,48 +1674,6 @@ gst_play_bin_send_event_to_sink (GstPlayBin * play_bin, GstEvent * event)
return res; return res;
} }
static gboolean
do_playbin_seek (GstElement * element, GstEvent * event)
{
gdouble rate;
GstSeekFlags flags;
gboolean flush;
gboolean was_playing = FALSE;
gboolean res;
gst_event_parse_seek (event, &rate, NULL, &flags, NULL, NULL, NULL, NULL);
flush = flags & GST_SEEK_FLAG_FLUSH;
if (flush) {
GstState state;
/* need to call _get_state() since a bin state is only updated
* with this call. */
gst_element_get_state (element, &state, NULL, 0);
was_playing = state == GST_STATE_PLAYING;
if (was_playing) {
gst_element_set_state (element, GST_STATE_PAUSED);
gst_element_get_state (element, NULL, NULL, 50 * GST_MSECOND);
}
}
GST_DEBUG_OBJECT (element, "Sending seek event to a sink");
res = gst_play_bin_send_event_to_sink (GST_PLAY_BIN (element), event);
if (flush) {
/* need to reset the stream time to 0 after a flushing seek */
if (res)
gst_pipeline_set_new_stream_time (GST_PIPELINE (element), 0);
if (was_playing)
/* and continue playing */
gst_element_set_state (element, GST_STATE_PLAYING);
}
return res;
}
/* We only want to send the event to a single sink (overriding GstBin's /* We only want to send the event to a single sink (overriding GstBin's
* behaviour), but we want to keep GstPipeline's behaviour - wrapping seek * behaviour), but we want to keep GstPipeline's behaviour - wrapping seek
* events appropriately. So, this is a messy duplication of code. */ * events appropriately. So, this is a messy duplication of code. */
@ -1728,13 +1683,13 @@ gst_play_bin_send_event (GstElement * element, GstEvent * event)
gboolean res = FALSE; gboolean res = FALSE;
GstEventType event_type = GST_EVENT_TYPE (event); GstEventType event_type = GST_EVENT_TYPE (event);
switch (event_type) { switch (event_type) {
case GST_EVENT_SEEK: case GST_EVENT_SEEK:
res = do_playbin_seek (element, event); GST_DEBUG_OBJECT (element, "Sending seek event to a sink");
res = gst_play_bin_send_event_to_sink (GST_PLAY_BIN (element), event);
break; break;
default: default:
res = gst_play_bin_send_event_to_sink (GST_PLAY_BIN (element), event); res = parent_class->send_event (element, event);
break; break;
} }
@ -1886,6 +1841,7 @@ gst_play_bin_change_state (GstElement * element, GstStateChange transition)
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED: case GST_STATE_CHANGE_READY_TO_PAUSED:
gst_pipeline_auto_clock (GST_PIPELINE (play_bin));
/* this really is the easiest way to make the state change return /* this really is the easiest way to make the state change return
* ASYNC until we added the sinks */ * ASYNC until we added the sinks */
if (!play_bin->fakesink) { if (!play_bin->fakesink) {