diff options
author | Max Kellermann <max@duempel.org> | 2012-08-25 08:44:31 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2012-08-25 09:38:41 +0200 |
commit | f351550534939478d7ddc791dc76aafd5f2a3503 (patch) | |
tree | 3672f6b43ee97f00ba7812cdfce92dda2c901437 /src/player_thread.c | |
parent | 66ecf39efe703185b1d54775e052d1c6a3f76903 (diff) | |
download | mpd-f351550534939478d7ddc791dc76aafd5f2a3503.tar.gz mpd-f351550534939478d7ddc791dc76aafd5f2a3503.tar.xz mpd-f351550534939478d7ddc791dc76aafd5f2a3503.zip |
player_thread: disable cross-fading in "single" mode
This commit reimplements the core of the "single" mode. Instead of
doing the detection in the playlist code from the outside, it is moved
to the player thread, which gets a new option called "border_pause".
It will now pause playback exactly at the beginning of the new song,
making the feature more reliable.
Now that the player thread knows what will happen, it can suppress
cross-fading.
Fixes mantis tickets 0003055 and 0003166.
Diffstat (limited to 'src/player_thread.c')
-rw-r--r-- | src/player_thread.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/player_thread.c b/src/player_thread.c index eaf6df303..707fb27ae 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -842,6 +842,16 @@ player_song_border(struct player *player) if (!player_wait_for_decoder(player)) return false; + struct player_control *const pc = player->pc; + player_lock(pc); + + if (pc->border_pause) { + player->paused = true; + pc->state = PLAYER_STATE_PAUSE; + } + + player_unlock(pc); + return true; } @@ -957,7 +967,10 @@ static void do_play(struct player_control *pc, struct decoder_control *dc) player_dc_start(&player, music_pipe_new()); } - if (player_dc_at_next_song(&player) && + if (/* no cross-fading if MPD is going to pause at the + end of the current song */ + !pc->border_pause && + player_dc_at_next_song(&player) && player.xfade == XFADE_UNKNOWN && !decoder_lock_is_starting(dc)) { /* enable cross fading in this song? if yes, |