From 728c66e7e3e235ee88eaaf856a00b318823abff1 Mon Sep 17 00:00:00 2001 From: Avuton Olrich Date: Sun, 17 Jan 2010 17:28:39 -0800 Subject: [PATCH 1/8] Modify version string to post-release version 0.15.9~git --- NEWS | 3 +++ configure.ac | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 5668d08ab..e6e444d11 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +ver 0.15.9 (2009/??/??) + + ver 0.15.8 (2010/01/17) * input: - curl: allow rewinding with Icy-Metadata diff --git a/configure.ac b/configure.ac index 25a23064d..a9e26df93 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.60) -AC_INIT(mpd, 0.15.8, musicpd-dev-team@lists.sourceforge.net) +AC_INIT(mpd, 0.15.9~git, musicpd-dev-team@lists.sourceforge.net) AC_CONFIG_SRCDIR([src/main.c]) AM_INIT_AUTOMAKE([foreign 1.9 dist-bzip2]) AM_CONFIG_HEADER(config.h) From 35c5a371ea3530796e88bcdd556e488816dff20f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 27 Feb 2010 18:35:31 +0100 Subject: [PATCH 2/8] decoder/mad: fix crash when seeking at end of song Removed the decoder_command_finished() call at the end of mp3_decode(). This is invalid, because decoder_command_finished() has already been called in mp3_read(). --- NEWS | 2 ++ src/decoder/mad_plugin.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index e6e444d11..476553ff5 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.15.9 (2009/??/??) +* decoders: + - mad: fix crash when seeking at end of song ver 0.15.8 (2010/01/17) diff --git a/src/decoder/mad_plugin.c b/src/decoder/mad_plugin.c index 1ef7183fa..7cc78a0d2 100644 --- a/src/decoder/mad_plugin.c +++ b/src/decoder/mad_plugin.c @@ -1207,10 +1207,6 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream) if (replay_gain_info) replay_gain_info_free(replay_gain_info); - if (decoder_get_command(decoder) == DECODE_COMMAND_SEEK && - data.mute_frame == MUTEFRAME_SEEK) - decoder_command_finished(decoder); - mp3_data_finish(&data); } From 9134169e3792488d6525150e41b8427a3faeda33 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 7 Mar 2010 18:58:44 +0100 Subject: [PATCH 3/8] playlist: fix single+repeat in random mode With single+repeat enabled, it is expected that MPD repeats the current song over andd over. With random mode also enabled, this didn't work, because the song order was shuffled internally. This patch adds a special check for this case. --- NEWS | 1 + src/playlist.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 476553ff5..7723350ff 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ver 0.15.9 (2009/??/??) * decoders: - mad: fix crash when seeking at end of song +* playlist: fix single+repeat in random mode ver 0.15.8 (2010/01/17) diff --git a/src/playlist.c b/src/playlist.c index 35c09329a..660dd6a83 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -140,7 +140,8 @@ playlist_update_queued_song(struct playlist *playlist, const struct song *prev) ? queue_next_order(&playlist->queue, playlist->current) : 0; - if (next_order == 0 && playlist->queue.random) { + if (next_order == 0 && playlist->queue.random && + !playlist->queue.single) { /* shuffle the song order again, so we get a different order each time the playlist is played completely */ From 96033e4b4e9ed599d8663a4d2d5a9dd586957bab Mon Sep 17 00:00:00 2001 From: Piotr Gozdur Date: Wed, 17 Mar 2010 17:54:21 +0100 Subject: [PATCH 4/8] decoder/mpcdec: fix negative shift on fixed-point samples "There is a bug in fixed-point musepack (musepack_src_r435) playback. In floating-point audio is OK but in fixed audio is distorted. I have made a patch for this" --- NEWS | 1 + src/decoder/mpcdec_plugin.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7723350ff..04fa38936 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ver 0.15.9 (2009/??/??) * decoders: - mad: fix crash when seeking at end of song + - mpcdec: fix negative shift on fixed-point samples * playlist: fix single+repeat in random mode diff --git a/src/decoder/mpcdec_plugin.c b/src/decoder/mpcdec_plugin.c index 26349f93a..b3582c689 100644 --- a/src/decoder/mpcdec_plugin.c +++ b/src/decoder/mpcdec_plugin.c @@ -103,7 +103,7 @@ mpc_to_mpd_sample(MPC_SAMPLE_FORMAT sample) const int shift = bits - MPC_FIXED_POINT_SCALE_SHIFT; if (shift < 0) - val = sample << -shift; + val = sample >> -shift; else val = sample << shift; #else From 2e72a9b262ac71a8a7e8ed9b00efa80597d5f17d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 17 Mar 2010 23:12:21 +0100 Subject: [PATCH 5/8] tag: added function tag_merge_replace() Like tag_merge(), but can deal with NULL parameters, and frees both tag objects. --- src/cue/cue_tag.c | 22 +--------------------- src/tag.c | 16 ++++++++++++++++ src/tag.h | 9 +++++++++ 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/cue/cue_tag.c b/src/cue/cue_tag.c index ce8202a81..6251b03e2 100644 --- a/src/cue/cue_tag.c +++ b/src/cue/cue_tag.c @@ -173,7 +173,6 @@ cue_tag_file( FILE* fp, { struct tag* cd_tag = NULL; struct tag* track_tag = NULL; - struct tag* merge_tag = NULL; struct Cd* cd = NULL; if (tnum > 256) @@ -199,26 +198,7 @@ cue_tag_file( FILE* fp, cd_delete(cd); } - if ((cd_tag != NULL) && (track_tag != NULL)) - { - merge_tag = tag_merge(cd_tag, track_tag); - tag_free(cd_tag); - tag_free(track_tag); - return merge_tag; - } - - else if (cd_tag != NULL) - { - return cd_tag; - } - - else if (track_tag != NULL) - { - return track_tag; - } - - else - return NULL; + return tag_merge_replace(cd_tag, track_tag); } struct tag* diff --git a/src/tag.c b/src/tag.c index 34205d20d..c34256b78 100644 --- a/src/tag.c +++ b/src/tag.c @@ -247,6 +247,22 @@ tag_merge(const struct tag *base, const struct tag *add) return ret; } +struct tag * +tag_merge_replace(struct tag *base, struct tag *add) +{ + if (add == NULL) + return base; + + if (base == NULL) + return add; + + struct tag *tag = tag_merge(base, add); + tag_free(base); + tag_free(add); + + return tag; +} + const char * tag_get_value(const struct tag *tag, enum tag_type type) { diff --git a/src/tag.h b/src/tag.h index 4b72dd187..75a86b387 100644 --- a/src/tag.h +++ b/src/tag.h @@ -165,6 +165,15 @@ struct tag *tag_dup(const struct tag *tag); struct tag * tag_merge(const struct tag *base, const struct tag *add); +/** + * Merges the data from two tags. Any of the two may be NULL. Both + * are freed by this function. + * + * @return a newly allocated tag, which must be freed with tag_free() + */ +struct tag * +tag_merge_replace(struct tag *base, struct tag *add); + /** * Returns true if the tag contains no items. This ignores the "time" * attribute. From cbfaa4a2662c55d7ad6339d70b3665d066bf491a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 17 Mar 2010 21:57:35 +0100 Subject: [PATCH 6/8] player_thread: postpone song tags during cross-fade Previously, tags of the new song being cross-faded in were sent immediately. That can cause wrong information being displayed, because the "previous" song might send its tag at the end again, overriding the "next" song's tag. This patch saves & merges the tag of the next song, and sends it when cross-fading is finished, and the next song really starts. --- NEWS | 1 + src/player_thread.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/NEWS b/NEWS index 04fa38936..c2c9817ee 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ ver 0.15.9 (2009/??/??) - mad: fix crash when seeking at end of song - mpcdec: fix negative shift on fixed-point samples * playlist: fix single+repeat in random mode +* player: postpone song tags during cross-fade ver 0.15.8 (2010/01/17) diff --git a/src/player_thread.c b/src/player_thread.c index 7fc55d3d1..e2c9b6f93 100644 --- a/src/player_thread.c +++ b/src/player_thread.c @@ -89,6 +89,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. */ @@ -518,6 +525,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; + cross_fade_apply(chunk, other_chunk, &dc.out_audio_format, cross_fade_position, @@ -544,6 +559,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, @@ -608,6 +631,7 @@ static void do_play(void) .xfade = XFADE_UNKNOWN, .cross_fading = false, .cross_fade_chunks = 0, + .cross_fade_tag = NULL, .size_to_time = 0.0, }; @@ -754,6 +778,9 @@ static void do_play(void) music_pipe_clear(player.pipe, player_buffer); music_pipe_free(player.pipe); + if (player.cross_fade_tag != NULL) + tag_free(player.cross_fade_tag); + pc.state = PLAYER_STATE_STOP; event_pipe_emit(PIPE_EVENT_PLAYLIST); } From 73ba4ea3da0a066f6241e661ca145f3aa0d64d09 Mon Sep 17 00:00:00 2001 From: Aleksei Kaveshnikov <4nykey@gmail.com> Date: Fri, 12 Mar 2010 18:04:46 +0100 Subject: [PATCH 7/8] decoder/mpcdec: fix replay gain formula with v8 "When playing musepack files with mpd v0.15.8, rg seems to have no effect. Using sample file below, mpd says 'computing ReplayGain album scale with gain 122.879997, peak 0.549150'. One thing though, if I build mpd against old libmpcdec-1.2.6, rg works as expected: 'computing ReplayGain album scale with gain 16.820000, peak 0.099765'" --- NEWS | 1 + src/decoder/mpcdec_plugin.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/NEWS b/NEWS index c2c9817ee..7e2ea95f8 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ ver 0.15.9 (2009/??/??) * decoders: - mad: fix crash when seeking at end of song - mpcdec: fix negative shift on fixed-point samples + - mpcdec: fix replay gain formula with v8 * playlist: fix single+repeat in random mode * player: postpone song tags during cross-fade diff --git a/src/decoder/mpcdec_plugin.c b/src/decoder/mpcdec_plugin.c index b3582c689..72a516f22 100644 --- a/src/decoder/mpcdec_plugin.c +++ b/src/decoder/mpcdec_plugin.c @@ -24,6 +24,7 @@ #include #else #include +#include #endif #include @@ -209,10 +210,17 @@ mpcdec_decode(struct decoder *mpd_decoder, struct input_stream *is) } replay_gain_info = replay_gain_info_new(); +#ifdef MPC_IS_OLD_API replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain = info.gain_album * 0.01; replay_gain_info->tuples[REPLAY_GAIN_ALBUM].peak = info.peak_album / 32767.0; replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain = info.gain_title * 0.01; replay_gain_info->tuples[REPLAY_GAIN_TRACK].peak = info.peak_title / 32767.0; +#else + replay_gain_info->tuples[REPLAY_GAIN_ALBUM].gain = MPC_OLD_GAIN_REF - (info.gain_album / 256.); + replay_gain_info->tuples[REPLAY_GAIN_ALBUM].peak = pow(10, info.peak_album / 256. / 20) / 32767; + replay_gain_info->tuples[REPLAY_GAIN_TRACK].gain = MPC_OLD_GAIN_REF - (info.gain_title / 256.); + replay_gain_info->tuples[REPLAY_GAIN_TRACK].peak = pow(10, info.peak_title / 256. / 20) / 32767; +#endif decoder_initialized(mpd_decoder, &audio_format, is->seekable, From d612e5e0ab27b93fcfdcf25eb3014ea4e17cd41c Mon Sep 17 00:00:00 2001 From: Avuton Olrich Date: Sun, 21 Mar 2010 17:25:18 -0700 Subject: [PATCH 8/8] mpd version 0.15.9 --- NEWS | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 7e2ea95f8..96b6709c6 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -ver 0.15.9 (2009/??/??) +ver 0.15.9 (2010/03/21) * decoders: - mad: fix crash when seeking at end of song - mpcdec: fix negative shift on fixed-point samples diff --git a/configure.ac b/configure.ac index a9e26df93..4bbed4549 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.60) -AC_INIT(mpd, 0.15.9~git, musicpd-dev-team@lists.sourceforge.net) +AC_INIT(mpd, 0.15.9, musicpd-dev-team@lists.sourceforge.net) AC_CONFIG_SRCDIR([src/main.c]) AM_INIT_AUTOMAKE([foreign 1.9 dist-bzip2]) AM_CONFIG_HEADER(config.h)