diff options
author | Max Kellermann <max@duempel.org> | 2015-11-11 16:56:24 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-11-11 16:56:24 +0100 |
commit | bedd5f00f86830b07d8a0649a66112840e6edf35 (patch) | |
tree | 48bcce65ab87b4bcf2ecb3b262529892c2347269 /src | |
parent | 36239895bd822d5fd3087218fbb10986430b8c9b (diff) | |
download | mpd-bedd5f00f86830b07d8a0649a66112840e6edf35.tar.gz mpd-bedd5f00f86830b07d8a0649a66112840e6edf35.tar.xz mpd-bedd5f00f86830b07d8a0649a66112840e6edf35.zip |
player/Control: move code to SeekLocked()
Diffstat (limited to 'src')
-rw-r--r-- | src/player/Control.cxx | 17 | ||||
-rw-r--r-- | src/player/Control.hxx | 2 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/player/Control.cxx b/src/player/Control.cxx index 2e90f7eef..830dd146d 100644 --- a/src/player/Control.cxx +++ b/src/player/Control.cxx @@ -220,13 +220,11 @@ PlayerControl::LockEnqueueSong(DetachedSong *song) Unlock(); } -bool -PlayerControl::LockSeek(DetachedSong *song, SongTime t) +void +PlayerControl::SeekLocked(DetachedSong *song, SongTime t) { assert(song != nullptr); - Lock(); - if (next_song != nullptr) SynchronousCommand(PlayerCommand::CANCEL); @@ -235,9 +233,18 @@ PlayerControl::LockSeek(DetachedSong *song, SongTime t) next_song = song; seek_time = t; SynchronousCommand(PlayerCommand::SEEK); - Unlock(); assert(next_song == nullptr); +} + +bool +PlayerControl::LockSeek(DetachedSong *song, SongTime t) +{ + assert(song != nullptr); + + Lock(); + SeekLocked(song, t); + Unlock(); idle_add(IDLE_PLAYER); diff --git a/src/player/Control.hxx b/src/player/Control.hxx index 021f6ddd9..812f4d621 100644 --- a/src/player/Control.hxx +++ b/src/player/Control.hxx @@ -427,6 +427,8 @@ private: SynchronousCommand(PlayerCommand::QUEUE); } + void SeekLocked(DetachedSong *song, SongTime t); + public: /** * @param song the song to be queued; the given instance will be owned |