diff options
author | Christian Pointner <equinox@spreadspace.org> | 2016-01-31 21:20:57 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2016-01-31 21:20:57 (GMT) |
commit | c95d43448cd3fe81a548f693afd0949b25c97556 (patch) | |
tree | 4c05e2ea89e054496846fa86674294cbfb128a53 /player | |
parent | 8e200e84c3359178e0e4250b9fe51f9e0520cac4 (diff) |
use syntactic sugor for switch
Diffstat (limited to 'player')
-rw-r--r-- | player/player.go | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/player/player.go b/player/player.go index b3dc761..337d358 100644 --- a/player/player.go +++ b/player/player.go @@ -198,9 +198,7 @@ func (p *Player) onMessage(bus *gst.Bus, msg *gst.Message) { p.updateChan <- updateData{duration: p.duration} err, _ := msg.ParseError() p.stdlog.Printf("GStreamer Pipeline Error: %s", err) - case gst.MESSAGE_DURATION_CHANGED: - fallthrough - case gst.MESSAGE_ASYNC_DONE: + case gst.MESSAGE_DURATION_CHANGED, gst.MESSAGE_ASYNC_DONE: duration, ok := p.pipe.QueryDuration(gst.FORMAT_TIME) if ok { p.duration = time.Duration(duration) @@ -292,9 +290,7 @@ func (p *Player) pause() (resp pauseResult) { func (p *Player) playPause() (resp playPauseResult) { switch p.state { - case IDLE: - fallthrough - case PAUSED: + case IDLE, PAUSED: p.pipe.SetState(gst.STATE_PLAYING) p.changeState(PLAYING) case PLAYING: @@ -309,9 +305,7 @@ func (p *Player) stop() (resp stopResult) { case IDLE: p.pipe.SetState(gst.STATE_NULL) p.changeState(IDLE) - case PLAYING: - fallthrough - case PAUSED: + case PLAYING, PAUSED: p.pipe.SetState(gst.STATE_NULL) p.pipe.SetState(gst.STATE_PAUSED) p.changeState(PAUSED) @@ -322,9 +316,7 @@ func (p *Player) stop() (resp stopResult) { func (p *Player) seek(pos float64) (resp seekResult) { postime := int64(float64(p.duration) * pos) switch p.state { - case PLAYING: - fallthrough - case PAUSED: + case PLAYING, PAUSED: p.pipe.SeekSimple(gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH|gst.SEEK_FLAG_KEY_UNIT, postime) } return |