From 8b6212777016404ce265631136bc4cccc9bc842c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 29 Aug 2014 23:03:29 +0200 Subject: [PATCH 1/7] decoder/gme: fix song duration The unit of gme_info_t::length is milliseconds, not centiseconds. --- NEWS | 1 + src/decoder/GmeDecoderPlugin.cxx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 5d48d9126..22eda0f14 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,7 @@ ver 0.18.13 (not yet released) * decoder - dsdiff, dsf: fix endless loop on malformed file - ffmpeg: support ffmpeg/libav version 11 + - gme: fix song duration * fix state file saver * fix build failure on Darwin diff --git a/src/decoder/GmeDecoderPlugin.cxx b/src/decoder/GmeDecoderPlugin.cxx index d67ee4b42..9c9b19478 100644 --- a/src/decoder/GmeDecoderPlugin.cxx +++ b/src/decoder/GmeDecoderPlugin.cxx @@ -235,7 +235,7 @@ gme_scan_file(const char *path_fs, if (ti->length > 0) tag_handler_invoke_duration(handler, handler_ctx, - ti->length / 100); + ti->length / 1000); if (ti->song != nullptr) { if (gme_track_count(emu) > 1) { From 4efa96df218cb5cf4bec885d9246c15ecb2f07e0 Mon Sep 17 00:00:00 2001 From: Joachim Fasting Date: Sun, 31 Aug 2014 12:34:48 +0200 Subject: [PATCH 2/7] doc/protocol: fix description of "stats" response Fix incorrect description of the "songs" field and add missing "albums" field. Signed-off-by: Joachim Fasting --- doc/protocol.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/protocol.xml b/doc/protocol.xml index abc74e4e6..5aa9c9114 100644 --- a/doc/protocol.xml +++ b/doc/protocol.xml @@ -576,7 +576,12 @@ - songs: number of albums + albums: number of albums + + + + + songs: number of songs From af260b5a64b038c61d987d9ca7e3a3e96c656cde Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 31 Aug 2014 14:00:09 +0200 Subject: [PATCH 3/7] output/{alsa,oss}: add assertions --- src/output/AlsaOutputPlugin.cxx | 2 ++ src/output/OssOutputPlugin.cxx | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/output/AlsaOutputPlugin.cxx b/src/output/AlsaOutputPlugin.cxx index 6668c920f..76eea5bd6 100644 --- a/src/output/AlsaOutputPlugin.cxx +++ b/src/output/AlsaOutputPlugin.cxx @@ -802,6 +802,7 @@ alsa_play(struct audio_output *ao, const void *chunk, size_t size, { AlsaOutput *ad = (AlsaOutput *)ao; + assert(size > 0); assert(size % ad->in_frame_size == 0); if (ad->must_prepare) { @@ -819,6 +820,7 @@ alsa_play(struct audio_output *ao, const void *chunk, size_t size, assert(size % ad->out_frame_size == 0); size /= ad->out_frame_size; + assert(size > 0); while (true) { snd_pcm_sframes_t ret = ad->writei(ad->pcm, chunk, size); diff --git a/src/output/OssOutputPlugin.cxx b/src/output/OssOutputPlugin.cxx index 68f2a38aa..cdde6d562 100644 --- a/src/output/OssOutputPlugin.cxx +++ b/src/output/OssOutputPlugin.cxx @@ -727,6 +727,8 @@ oss_output_play(struct audio_output *ao, const void *chunk, size_t size, OssOutput *od = (OssOutput *)ao; ssize_t ret; + assert(size > 0); + /* reopen the device since it was closed by dropBufferedAudio */ if (od->fd < 0 && !oss_reopen(od, error)) return 0; @@ -735,6 +737,8 @@ oss_output_play(struct audio_output *ao, const void *chunk, size_t size, chunk = od->pcm_export->Export(chunk, size, size); #endif + assert(size > 0); + while (true) { ret = write(od->fd, chunk, size); if (ret > 0) { From 2406152576b512c6fedb4eb3b6d3849448d84e6b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 31 Aug 2014 13:58:04 +0200 Subject: [PATCH 4/7] output/alsa: fix endless loop at end of file in dsd_usb mode --- NEWS | 2 ++ src/output/AlsaOutputPlugin.cxx | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/NEWS b/NEWS index 22eda0f14..2736762a4 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ ver 0.18.13 (not yet released) - dsdiff, dsf: fix endless loop on malformed file - ffmpeg: support ffmpeg/libav version 11 - gme: fix song duration +* output + - alsa: fix endless loop at end of file in dsd_usb mode * fix state file saver * fix build failure on Darwin diff --git a/src/output/AlsaOutputPlugin.cxx b/src/output/AlsaOutputPlugin.cxx index 76eea5bd6..f8aae13a1 100644 --- a/src/output/AlsaOutputPlugin.cxx +++ b/src/output/AlsaOutputPlugin.cxx @@ -815,7 +815,16 @@ alsa_play(struct audio_output *ao, const void *chunk, size_t size, } } + const size_t original_size = size; chunk = ad->pcm_export->Export(chunk, size, size); + if (size == 0) + /* the DoP (DSD over PCM) filter converts two frames + at a time and ignores the last odd frame; if there + was only one frame (e.g. the last frame in the + file), the result is empty; to avoid an endless + loop, bail out here, and pretend the one frame has + been played */ + return original_size; assert(size % ad->out_frame_size == 0); From 704be54c3a96c7a6bebdaa67711f7debe410a13f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 31 Aug 2014 14:23:06 +0200 Subject: [PATCH 5/7] PlaylistControl: move code to new method SeekSongOrder() --- src/Playlist.hxx | 4 ++++ src/PlaylistControl.cxx | 22 +++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/Playlist.hxx b/src/Playlist.hxx index b660ecb40..582b3648a 100644 --- a/src/Playlist.hxx +++ b/src/Playlist.hxx @@ -234,6 +234,10 @@ public: void PlayPrevious(PlayerControl &pc); + PlaylistResult SeekSongOrder(PlayerControl &pc, + unsigned song_order, + float seek_time); + PlaylistResult SeekSongPosition(PlayerControl &pc, unsigned song_position, float seek_time); diff --git a/src/PlaylistControl.cxx b/src/PlaylistControl.cxx index 58971a4b4..df0496e7c 100644 --- a/src/PlaylistControl.cxx +++ b/src/PlaylistControl.cxx @@ -190,17 +190,12 @@ playlist::PlayPrevious(PlayerControl &pc) } PlaylistResult -playlist::SeekSongPosition(PlayerControl &pc, unsigned song, float seek_time) +playlist::SeekSongOrder(PlayerControl &pc, unsigned i, float seek_time) { - if (!queue.IsValidPosition(song)) - return PlaylistResult::BAD_RANGE; + assert(queue.IsValidOrder(i)); const Song *queued_song = GetQueuedSong(); - unsigned i = queue.random - ? queue.PositionToOrder(song) - : song; - pc.ClearError(); stop_on_error = true; error_count = 0; @@ -228,6 +223,19 @@ playlist::SeekSongPosition(PlayerControl &pc, unsigned song, float seek_time) return PlaylistResult::SUCCESS; } +PlaylistResult +playlist::SeekSongPosition(PlayerControl &pc, unsigned song, float seek_time) +{ + if (!queue.IsValidPosition(song)) + return PlaylistResult::BAD_RANGE; + + unsigned i = queue.random + ? queue.PositionToOrder(song) + : song; + + return SeekSongOrder(pc, i, seek_time); +} + PlaylistResult playlist::SeekSongId(PlayerControl &pc, unsigned id, float seek_time) { From a26ead035a4574bf2cae6b7fad661a1354ee8641 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 31 Aug 2014 14:44:20 +0200 Subject: [PATCH 6/7] PlaylistControl: use SeekSongOrder(current) to keep current song The "current" attribute is a "song order", not a "song position". This is usually the same - except in random mode. Fixes Mantis ticket 0004073. --- NEWS | 2 ++ src/PlaylistControl.cxx | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 2736762a4..32df3bfeb 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.18.13 (not yet released) +* protocol + - don't change song on "seekcur" in random mode * decoder - dsdiff, dsf: fix endless loop on malformed file - ffmpeg: support ffmpeg/libav version 11 diff --git a/src/PlaylistControl.cxx b/src/PlaylistControl.cxx index df0496e7c..b0ff03a7e 100644 --- a/src/PlaylistControl.cxx +++ b/src/PlaylistControl.cxx @@ -265,5 +265,5 @@ playlist::SeekCurrent(PlayerControl &pc, float seek_time, bool relative) if (seek_time < 0) seek_time = 0; - return SeekSongPosition(pc, current, seek_time); + return SeekSongOrder(pc, current, seek_time); } From 86e8b3b4bd213f6013a0a2e8e0a9dd6d279494c1 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 31 Aug 2014 14:50:23 +0200 Subject: [PATCH 7/7] release v0.18.13 --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 32df3bfeb..59c568741 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -ver 0.18.13 (not yet released) +ver 0.18.13 (2014/08/31) * protocol - don't change song on "seekcur" in random mode * decoder