From bedd5f00f86830b07d8a0649a66112840e6edf35 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 11 Nov 2015 16:56:24 +0100 Subject: player/Control: move code to SeekLocked() --- src/player/Control.cxx | 17 ++++++++++++----- src/player/Control.hxx | 2 ++ 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src/player') 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 -- cgit v1.2.3