From 52a445a41d2136666bc4689ba24b2e8cbcb70b70 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 23 Jun 2005 17:11:49 +0000 Subject: [PATCH] gst/gstelement.c: When the state did not change, also report NO_PREROLL when it matters. Original commit message from CVS: * gst/gstelement.c: (gst_element_get_state_func), (gst_element_set_state), (gst_element_change_state): When the state did not change, also report NO_PREROLL when it matters. --- ChangeLog | 7 +++++++ gst/gstelement.c | 16 ++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5bcdff6..4483d35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2005-06-23 Wim Taymans + * gst/gstelement.c: (gst_element_get_state_func), + (gst_element_set_state), (gst_element_change_state): + When the state did not change, also report NO_PREROLL + when it matters. + +2005-06-23 Wim Taymans + * gst/gstpad.c: (gst_pad_event_default): * gst/gstqueue.c: (gst_queue_loop): No unsafe task pausing please. diff --git a/gst/gstelement.c b/gst/gstelement.c index cec15fb..7fd24dc 100644 --- a/gst/gstelement.c +++ b/gst/gstelement.c @@ -1690,11 +1690,6 @@ gst_element_set_state (GstElement * element, GstElementState state) gst_element_commit_state (element); } - /* clear the error flag */ - GST_STATE_ERROR (element) = FALSE; - /* clear the no_preroll flag */ - GST_STATE_NO_PREROLL (element) = FALSE; - /* start with the current state */ current = GST_STATE (element); @@ -1732,6 +1727,12 @@ gst_element_set_state (GstElement * element, GstElementState state) else return_val = GST_STATE_FAILURE; + /* clear the error and preroll flag, we need to do that after + * calling the virtual change_state function so that it can use the + * old previous value. */ + GST_STATE_ERROR (element) = FALSE; + GST_STATE_NO_PREROLL (element) = FALSE; + switch (return_val) { case GST_STATE_FAILURE: GST_CAT_INFO_OBJECT (GST_CAT_STATES, element, @@ -1900,7 +1901,10 @@ gst_element_change_state (GstElement * element) GST_CAT_DEBUG_OBJECT (GST_CAT_STATES, element, "element is already in the %s state", gst_element_state_get_name (old_state)); - return GST_STATE_SUCCESS; + if (GST_STATE_NO_PREROLL (element)) + return GST_STATE_NO_PREROLL; + else + return GST_STATE_SUCCESS; } GST_CAT_LOG_OBJECT (GST_CAT_STATES, element, -- 2.7.4