mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
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:
parent
cc1a869a2c
commit
39f59ea456
1 changed files with 12 additions and 10 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue