Merge tag 'v0.18.13'

This commit is contained in:
Max Kellermann
2014-08-31 15:01:12 +02:00
6 changed files with 52 additions and 11 deletions

View File

@@ -190,18 +190,12 @@ playlist::PlayPrevious(PlayerControl &pc)
}
PlaylistResult
playlist::SeekSongPosition(PlayerControl &pc,
unsigned song, SongTime seek_time)
playlist::SeekSongOrder(PlayerControl &pc, unsigned i, SongTime seek_time)
{
if (!queue.IsValidPosition(song))
return PlaylistResult::BAD_RANGE;
assert(queue.IsValidOrder(i));
const DetachedSong *queued_song = GetQueuedSong();
unsigned i = queue.random
? queue.PositionToOrder(song)
: song;
pc.ClearError();
stop_on_error = true;
error_count = 0;
@@ -228,6 +222,20 @@ playlist::SeekSongPosition(PlayerControl &pc,
return PlaylistResult::SUCCESS;
}
PlaylistResult
playlist::SeekSongPosition(PlayerControl &pc, unsigned song,
SongTime seek_time)
{
if (!queue.IsValidPosition(song))
return PlaylistResult::BAD_RANGE;
unsigned i = queue.random
? queue.PositionToOrder(song)
: song;
return SeekSongOrder(pc, i, seek_time);
}
PlaylistResult
playlist::SeekSongId(PlayerControl &pc, unsigned id, SongTime seek_time)
{
@@ -257,5 +265,8 @@ playlist::SeekCurrent(PlayerControl &pc,
seek_time = SignedSongTime::zero();
}
return SeekSongPosition(pc, current, SongTime(seek_time));
if (seek_time.IsNegative())
seek_time = SignedSongTime::zero();
return SeekSongOrder(pc, current, SongTime(seek_time));
}