aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-12 01:21:35 +0200
committerMax Kellermann <max@duempel.org>2008-10-12 01:21:35 +0200
commit08210af23a5d33cb08efcfd5710e65887ab8e398 (patch)
treea91acb5a9d9b6c4ad0bbfe20752811d46d72ddc5 /src
parent80a2c937c42a0d0309fcfc961988b77012deb7ea (diff)
downloadmpd-08210af23a5d33cb08efcfd5710e65887ab8e398.tar.gz
mpd-08210af23a5d33cb08efcfd5710e65887ab8e398.tar.xz
mpd-08210af23a5d33cb08efcfd5710e65887ab8e398.zip
player: replaced buffered_before_play with buffering flag
buffered_before_play was copied to struct player because it was used to disable buffering when seeking. Instead of mainaining a copy of this number, move just the flag to the player struct.
Diffstat (limited to '')
-rw-r--r--src/player_thread.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/player_thread.c b/src/player_thread.c
index 10b9a8769..b55fba338 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -35,10 +35,9 @@ enum xfade_state {
struct player {
/**
- * number of chunks which have to be decoded before playing
- * starts
+ * are we waiting for buffered_before_play?
*/
- unsigned int buffered_before_play;
+ bool buffering;
/**
* true if the decoder is starting and did not provide data
@@ -178,7 +177,10 @@ static void processDecodeInput(struct player *player)
dropBufferedAudio();
if (decodeSeek(player) == 0) {
player->xfade = XFADE_UNKNOWN;
- player->buffered_before_play = 0;
+
+ /* abort buffering when the user has requested
+ a seek */
+ player->buffering = false;
}
break;
@@ -225,14 +227,13 @@ static int playChunk(ob_chunk * chunk,
static void do_play(void)
{
struct player player = {
- .buffered_before_play = pc.buffered_before_play,
+ .buffering = true,
.decoder_starting = false,
.paused = false,
.queued = false,
.xfade = XFADE_UNKNOWN,
.next_song_chunk = -1,
};
- int buffering = 1;
unsigned int crossFadeChunks = 0;
/** the position of the next cross-faded chunk in the next
song */
@@ -262,14 +263,14 @@ static void do_play(void)
break;
}
- if (buffering) {
- if (ob_available() < player.buffered_before_play) {
+ if (player.buffering) {
+ if (ob_available() < pc.buffered_before_play) {
/* not enough decoded buffer space yet */
notify_wait(&pc.notify);
continue;
} else {
/* buffering is complete */
- buffering = 0;
+ player.buffering = false;
ob_set_lazy(true);
}
}