aboutsummaryrefslogtreecommitdiffstats
path: root/src/player_thread.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-11-02 16:55:53 +0100
committerMax Kellermann <max@duempel.org>2008-11-02 16:55:53 +0100
commitd430b1dc542c4a8954eaaaf1c165c40216e32f26 (patch)
treec2621ae49ba14d2ff7dbaa4af0adb182da30a7c2 /src/player_thread.c
parent260a0cc33c335a96a6326c6fe24435f55f59b44e (diff)
downloadmpd-d430b1dc542c4a8954eaaaf1c165c40216e32f26.tar.gz
mpd-d430b1dc542c4a8954eaaaf1c165c40216e32f26.tar.xz
mpd-d430b1dc542c4a8954eaaaf1c165c40216e32f26.zip
music_pipe: more wrapper functions
Replace all direct music_pipe struct accesses with wrapper functions. The compiled machine code is the same, but this way, we can change struct internals more easily.
Diffstat (limited to 'src/player_thread.c')
-rw-r--r--src/player_thread.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/player_thread.c b/src/player_thread.c
index e1f11652e..3a378b069 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -330,7 +330,7 @@ static void do_play(void)
assert(pc.next_song != NULL);
player.queued = false;
- player.next_song_chunk = ob.end;
+ player.next_song_chunk = music_pipe_tail_index();
dc_start_async(pc.next_song);
}
if (player.next_song_chunk >= 0 &&
@@ -342,7 +342,7 @@ static void do_play(void)
crossFadeChunks =
cross_fade_calc(pc.crossFade, dc.totalTime,
&dc.out_audio_format,
- ob.size -
+ music_pipe_size() -
pc.buffered_before_play);
if (crossFadeChunks > 0) {
player.xfade = XFADE_ENABLED;
@@ -356,9 +356,8 @@ static void do_play(void)
if (player.paused)
notify_wait(&pc.notify);
else if (!music_pipe_is_empty() &&
- (int)ob.begin != player.next_song_chunk) {
- struct music_chunk *beginChunk =
- music_pipe_get_chunk(ob.begin);
+ !music_pipe_head_is(player.next_song_chunk)) {
+ struct music_chunk *beginChunk = music_pipe_peek();
unsigned int fadePosition;
if (player.xfade == XFADE_ENABLED &&
player.next_song_chunk >= 0 &&
@@ -409,10 +408,9 @@ static void do_play(void)
decoder gets woken up with each chunk; it
is more efficient to make it decode a
larger block at a time */
- if (music_pipe_available() <= (pc.buffered_before_play + ob.size * 3) / 4)
+ if (music_pipe_available() <= (pc.buffered_before_play + music_pipe_size() * 3) / 4)
notify_signal(&dc.notify);
- } else if (!music_pipe_is_empty() &&
- (int)ob.begin == player.next_song_chunk) {
+ } else if (music_pipe_head_is(player.next_song_chunk)) {
/* at the beginning of a new song */
if (player.xfade == XFADE_ENABLED && nextChunk >= 0) {