aboutsummaryrefslogtreecommitdiffstats
path: root/src/player_thread.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-03-28 19:31:47 +0200
committerMax Kellermann <max@duempel.org>2010-03-28 19:31:47 +0200
commite9beea072d17ec01a124c189c42df1a1350a4106 (patch)
tree7334654ded3a281e53546671f9fcb8e4b1857545 /src/player_thread.c
parente69bb3b337c8f805302a4ba9e46c7bc36d8df80c (diff)
parentd612e5e0ab27b93fcfdcf25eb3014ea4e17cd41c (diff)
downloadmpd-e9beea072d17ec01a124c189c42df1a1350a4106.tar.gz
mpd-e9beea072d17ec01a124c189c42df1a1350a4106.tar.xz
mpd-e9beea072d17ec01a124c189c42df1a1350a4106.zip
Merge release 0.15.9 from branch 'v0.15.x'
Conflicts: NEWS configure.ac src/cue/cue_tag.c src/decoder/mpcdec_decoder_plugin.c src/player_thread.c
Diffstat (limited to 'src/player_thread.c')
-rw-r--r--src/player_thread.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/player_thread.c b/src/player_thread.c
index d3f5d7ccb..8fa089c1f 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -93,6 +93,13 @@ struct player {
unsigned cross_fade_chunks;
/**
+ * The tag of the "next" song during cross-fade. It is
+ * postponed, and sent to the output thread when the new song
+ * really begins.
+ */
+ struct tag *cross_fade_tag;
+
+ /**
* The current audio format for the audio outputs.
*/
struct audio_format play_audio_format;
@@ -649,6 +656,14 @@ play_next_chunk(struct player *player)
chunk = music_pipe_shift(player->pipe);
assert(chunk != NULL);
+ /* don't send the tags of the new song (which
+ is being faded in) yet; postpone it until
+ the current song is faded out */
+ player->cross_fade_tag =
+ tag_merge_replace(player->cross_fade_tag,
+ other_chunk->tag);
+ other_chunk->tag = NULL;
+
if (isnan(pc.mixramp_delay_seconds)) {
mix_ratio = ((float)cross_fade_position)
/ player->cross_fade_chunks;
@@ -687,6 +702,14 @@ play_next_chunk(struct player *player)
assert(chunk != NULL);
+ /* insert the postponed tag if cross-fading is finished */
+
+ if (player->xfade != XFADE_ENABLED && player->cross_fade_tag != NULL) {
+ chunk->tag = tag_merge_replace(chunk->tag,
+ player->cross_fade_tag);
+ player->cross_fade_tag = NULL;
+ }
+
/* play the current chunk */
success = play_chunk(player->song, chunk, &player->play_audio_format);
@@ -769,6 +792,7 @@ static void do_play(struct decoder_control *dc)
.xfade = XFADE_UNKNOWN,
.cross_fading = false,
.cross_fade_chunks = 0,
+ .cross_fade_tag = NULL,
.elapsed_time = 0.0,
};
@@ -939,6 +963,9 @@ static void do_play(struct decoder_control *dc)
music_pipe_clear(player.pipe, player_buffer);
music_pipe_free(player.pipe);
+ if (player.cross_fade_tag != NULL)
+ tag_free(player.cross_fade_tag);
+
player_lock();
if (player.queued) {