player/Control: move code to SeekLocked()

This commit is contained in:
Max Kellermann 2015-11-11 16:56:24 +01:00
parent 36239895bd
commit bedd5f00f8
2 changed files with 14 additions and 5 deletions

View File

@ -220,13 +220,11 @@ PlayerControl::LockEnqueueSong(DetachedSong *song)
Unlock(); Unlock();
} }
bool void
PlayerControl::LockSeek(DetachedSong *song, SongTime t) PlayerControl::SeekLocked(DetachedSong *song, SongTime t)
{ {
assert(song != nullptr); assert(song != nullptr);
Lock();
if (next_song != nullptr) if (next_song != nullptr)
SynchronousCommand(PlayerCommand::CANCEL); SynchronousCommand(PlayerCommand::CANCEL);
@ -235,9 +233,18 @@ PlayerControl::LockSeek(DetachedSong *song, SongTime t)
next_song = song; next_song = song;
seek_time = t; seek_time = t;
SynchronousCommand(PlayerCommand::SEEK); SynchronousCommand(PlayerCommand::SEEK);
Unlock();
assert(next_song == nullptr); assert(next_song == nullptr);
}
bool
PlayerControl::LockSeek(DetachedSong *song, SongTime t)
{
assert(song != nullptr);
Lock();
SeekLocked(song, t);
Unlock();
idle_add(IDLE_PLAYER); idle_add(IDLE_PLAYER);

View File

@ -427,6 +427,8 @@ private:
SynchronousCommand(PlayerCommand::QUEUE); SynchronousCommand(PlayerCommand::QUEUE);
} }
void SeekLocked(DetachedSong *song, SongTime t);
public: public:
/** /**
* @param song the song to be queued; the given instance will be owned * @param song the song to be queued; the given instance will be owned