pulsesink: clean up the state change function

Make the state change function a bit more readable and only pause after the
parent had a change to pause first.
This commit is contained in:
Wim Taymans 2009-03-23 11:22:08 +01:00
parent cc1a869a2c
commit 39f59ea456

View file

@ -1243,23 +1243,25 @@ unlock:
static GstStateChangeReturn static GstStateChangeReturn
gst_pulsesink_change_state (GstElement * element, GstStateChange transition) gst_pulsesink_change_state (GstElement * element, GstStateChange transition)
{ {
GstStateChangeReturn res;
GstPulseSink *this = GST_PULSESINK (element); GstPulseSink *this = GST_PULSESINK (element);
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_PLAYING: case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
case GST_STATE_CHANGE_PLAYING_TO_PAUSED: gst_pulsesink_pause (this, FALSE);
gst_pulsesink_pause (this,
GST_STATE_TRANSITION_NEXT (transition) == GST_STATE_PAUSED);
break; break;
default: default:
; break;
} }
if (GST_ELEMENT_CLASS (parent_class)->change_state) res = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return GST_STATE_CHANGE_SUCCESS; switch (transition) {
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
gst_pulsesink_pause (this, TRUE);
break;
default:
break;
}
return res;
} }