From 3be4778840a809db12e41406b45976ec71d0c3dc Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 17 Feb 2020 20:09:53 -0800 Subject: [PATCH] mpd: update to 0.21.20 Updated patches to latest patchset and removed upstreamed ones. Ran init script through shellcheck. Restart using SIGHUP. Added logging from stderr as any kind of logging is missing in --no-daemon mode. Signed-off-by: Rosen Penev --- sound/mpd/Makefile | 4 +- sound/mpd/files/mpd.init | 17 +++++--- ...st-lround-when-std-round-is-unavaila.patch | 41 ++++++++++++++++--- .../patches/020-fix-incorrect-rounding.patch | 34 +++++++++++++++ ...mapping-get-rid-of-exp10-workaround.patch} | 10 ++--- sound/mpd/patches/040-fix-aiff-and-amr.patch | 28 ------------- ...de-get-rid-of-C-math-function-usage.patch} | 32 +++++++++++---- .../patches/210-support_raw_pcm_streams.patch | 10 ----- 8 files changed, 112 insertions(+), 64 deletions(-) create mode 100644 sound/mpd/patches/020-fix-incorrect-rounding.patch rename sound/mpd/patches/{020-volume_mapping-get-rid-of-exp10-workaround.patch => 030-volume_mapping-get-rid-of-exp10-workaround.patch} (88%) delete mode 100644 sound/mpd/patches/040-fix-aiff-and-amr.patch rename sound/mpd/patches/{030-treewide-get-rid-of-C-math-function-usage.patch => 040-treewide-get-rid-of-C-math-function-usage.patch} (77%) delete mode 100644 sound/mpd/patches/210-support_raw_pcm_streams.patch diff --git a/sound/mpd/Makefile b/sound/mpd/Makefile index 0cb361439f..edfde7f26f 100644 --- a/sound/mpd/Makefile +++ b/sound/mpd/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mpd -PKG_VERSION:=0.21.19 +PKG_VERSION:=0.21.20 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://www.musicpd.org/download/mpd/0.21/ -PKG_HASH:=d3275e11d85637adde250cadf3b4f5aec2144228f0d8085767493fc46c55b2f9 +PKG_HASH:=422ef0a996d961f3ebc6856395f3a855b45fa0059910e878fb98281007e510e1 PKG_MAINTAINER:=Ted Hess PKG_LICENSE:=GPL-2.0-or-later diff --git a/sound/mpd/files/mpd.init b/sound/mpd/files/mpd.init index ac8f1fce65..9ec164db7e 100644 --- a/sound/mpd/files/mpd.init +++ b/sound/mpd/files/mpd.init @@ -12,19 +12,24 @@ NICEPRIO=-10 #TODO: Add uci config - nice, config start_service() { + local pld lport + #create mpd directories from config - local pld=`grep ^playlist_directory "$CONFIGFILE" | cut -d "\"" -f 2 | sed "s/~/\/root/g"` - if [ ! -d $pld ]; then - mkdir -m 0755 -p $pld - fi + pld=$(grep ^playlist_directory "$CONFIGFILE" | cut -d "\"" -f 2 | sed "s/~/\/root/g") + [ -d "$pld" ] || mkdir -m 0755 -p "$pld" - local lport=`grep ^port "$CONFIGFILE" | cut -d "\"" -f 2` - [ -z $lport ] && lport=6600 + lport=$(grep ^port "$CONFIGFILE" | cut -d "\"" -f 2) + [ -z "$lport" ] && lport=6600 procd_open_instance procd_add_mdns "mpd" "tcp" "$lport" procd_set_param command "$PROG" --no-daemon "$CONFIGFILE" + procd_set_param stderr 1 # Give MPD some real-time priority procd_set_param nice "$NICEPRIO" procd_close_instance } + +reload_service() { + procd_send_signal "$PROG" +} diff --git a/sound/mpd/patches/010-treewide-use-boost-lround-when-std-round-is-unavaila.patch b/sound/mpd/patches/010-treewide-use-boost-lround-when-std-round-is-unavaila.patch index 9c8dcec505..20bda3548e 100644 --- a/sound/mpd/patches/010-treewide-use-boost-lround-when-std-round-is-unavaila.patch +++ b/sound/mpd/patches/010-treewide-use-boost-lround-when-std-round-is-unavaila.patch @@ -1,8 +1,7 @@ -From bffc5cde6d71556f143500a12c53c1835deebe07 Mon Sep 17 00:00:00 2001 +From 769cd0ee9f0cf8ceb026aa751b5d4a390bb5dbdc Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sun, 2 Feb 2020 21:21:57 -0800 -Subject: [PATCH 1/3] treewide: use boost::lround when std::round is - unavailable +Subject: [PATCH] treewide: use boost::lround when std::round is unavailable This is the case with uClibc-ng currently. @@ -13,12 +12,14 @@ Signed-off-by: Rosen Penev src/decoder/plugins/FaadDecoderPlugin.cxx | 3 +- src/mixer/plugins/WinmmMixerPlugin.cxx | 2 +- src/output/plugins/HaikuOutputPlugin.cxx | 3 +- - src/pcm/Mix.cxx | 5 ++- + src/pcm/PcmMix.cxx | 5 ++- src/player/CrossFade.cxx | 5 ++- src/util/Math.hxx | 41 +++++++++++++++++++++++ 8 files changed, 52 insertions(+), 16 deletions(-) create mode 100644 src/util/Math.hxx +diff --git a/src/Stats.cxx b/src/Stats.cxx +index 2208312d7..7467a3a17 100644 --- a/src/Stats.cxx +++ b/src/Stats.cxx @@ -29,9 +29,9 @@ @@ -41,6 +42,8 @@ Signed-off-by: Rosen Penev #ifdef ENABLE_DATABASE const Database *db = partition.instance.GetDatabase(); +diff --git a/src/command/PlayerCommands.cxx b/src/command/PlayerCommands.cxx +index 7f3b4f296..4acb8f2ad 100644 --- a/src/command/PlayerCommands.cxx +++ b/src/command/PlayerCommands.cxx @@ -34,13 +34,12 @@ @@ -67,6 +70,25 @@ Signed-off-by: Rosen Penev if (pc.GetMixRampDelay() > FloatDuration::zero()) r.Format(COMMAND_STATUS_MIXRAMPDELAY ": %f\n", +diff --git a/src/decoder/plugins/FaadDecoderPlugin.cxx b/src/decoder/plugins/FaadDecoderPlugin.cxx +index 983103e0e..e1c9576d3 100644 +--- a/src/decoder/plugins/FaadDecoderPlugin.cxx ++++ b/src/decoder/plugins/FaadDecoderPlugin.cxx +@@ -26,11 +26,11 @@ + #include "util/ScopeExit.hxx" + #include "util/ConstBuffer.hxx" + #include "util/Domain.hxx" ++#include "util/Math.hxx" + #include "Log.hxx" + + #include + +-#include + #include + + #include +diff --git a/src/mixer/plugins/WinmmMixerPlugin.cxx b/src/mixer/plugins/WinmmMixerPlugin.cxx +index 9661d6551..905e650ef 100644 --- a/src/mixer/plugins/WinmmMixerPlugin.cxx +++ b/src/mixer/plugins/WinmmMixerPlugin.cxx @@ -20,13 +20,13 @@ @@ -84,6 +106,8 @@ Signed-off-by: Rosen Penev #include class WinmmMixer final : public Mixer { +diff --git a/src/output/plugins/HaikuOutputPlugin.cxx b/src/output/plugins/HaikuOutputPlugin.cxx +index 952fb0c2f..01240aca9 100644 --- a/src/output/plugins/HaikuOutputPlugin.cxx +++ b/src/output/plugins/HaikuOutputPlugin.cxx @@ -22,6 +22,7 @@ @@ -103,6 +127,8 @@ Signed-off-by: Rosen Penev #include #define UTF8_PLAY "\xE2\x96\xB6" +diff --git a/src/pcm/PcmMix.cxx b/src/pcm/PcmMix.cxx +index 17e34b005..59179f54e 100644 --- a/src/pcm/PcmMix.cxx +++ b/src/pcm/PcmMix.cxx @@ -22,11 +22,10 @@ @@ -127,6 +153,8 @@ Signed-off-by: Rosen Penev vol1 = Clamp(vol1, 0, PCM_VOLUME_1S); return pcm_add_vol(dither, buffer1, buffer2, size, +diff --git a/src/player/CrossFade.cxx b/src/player/CrossFade.cxx +index ce86d3f0a..8a91516f1 100644 --- a/src/player/CrossFade.cxx +++ b/src/player/CrossFade.cxx @@ -23,10 +23,9 @@ @@ -150,11 +178,14 @@ Signed-off-by: Rosen Penev } else { /* Calculate mixramp overlap. */ const auto mixramp_overlap_current = +diff --git a/src/util/Math.hxx b/src/util/Math.hxx +new file mode 100644 +index 000000000..bd856f5a9 --- /dev/null +++ b/src/util/Math.hxx @@ -0,0 +1,41 @@ +/* -+ * Copyright (C) 2020 Rosen Penev ++ * Copyright (C) 2018 Max Kellermann + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions diff --git a/sound/mpd/patches/020-fix-incorrect-rounding.patch b/sound/mpd/patches/020-fix-incorrect-rounding.patch new file mode 100644 index 0000000000..80e7a6c4e0 --- /dev/null +++ b/sound/mpd/patches/020-fix-incorrect-rounding.patch @@ -0,0 +1,34 @@ +From ab5183cbc45818114cc4c226ace299a1fb917ab0 Mon Sep 17 00:00:00 2001 +From: Rosen Penev +Date: Sun, 2 Feb 2020 16:34:09 -0800 +Subject: [PATCH] [clang-tidy] fix incorrect rounding + +Found with bugprone-incorrect-roundings + +Signed-off-by: Rosen Penev +--- + src/decoder/plugins/WavpackDecoderPlugin.cxx | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/decoder/plugins/WavpackDecoderPlugin.cxx b/src/decoder/plugins/WavpackDecoderPlugin.cxx +index 77751167f..97824de75 100644 +--- a/src/decoder/plugins/WavpackDecoderPlugin.cxx ++++ b/src/decoder/plugins/WavpackDecoderPlugin.cxx +@@ -26,6 +26,7 @@ + #include "fs/Path.hxx" + #include "util/Macros.hxx" + #include "util/Alloc.hxx" ++#include "util/Math.hxx" + #include "util/ScopeExit.hxx" + #include "util/RuntimeError.hxx" + +@@ -265,8 +266,7 @@ wavpack_decode(DecoderClient &client, WavpackContext *wpc, bool can_seek) + if (samples_got == 0) + break; + +- int bitrate = (int)(WavpackGetInstantBitrate(wpc) / 1000 + +- 0.5); ++ int bitrate = lround(WavpackGetInstantBitrate(wpc) / 1000); + format_samples(chunk, samples_got * audio_format.channels); + + cmd = client.SubmitData(nullptr, chunk, diff --git a/sound/mpd/patches/020-volume_mapping-get-rid-of-exp10-workaround.patch b/sound/mpd/patches/030-volume_mapping-get-rid-of-exp10-workaround.patch similarity index 88% rename from sound/mpd/patches/020-volume_mapping-get-rid-of-exp10-workaround.patch rename to sound/mpd/patches/030-volume_mapping-get-rid-of-exp10-workaround.patch index 86ab2e7047..efa245efbd 100644 --- a/sound/mpd/patches/020-volume_mapping-get-rid-of-exp10-workaround.patch +++ b/sound/mpd/patches/030-volume_mapping-get-rid-of-exp10-workaround.patch @@ -1,7 +1,10 @@ -From b8ed7496963aafdb6ec3415c4efd1ff98a7e8a1d Mon Sep 17 00:00:00 2001 +From 6b3250a3fb4a854d19980868ed187ca21f0e5ed8 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 3 Feb 2020 15:26:50 -0800 -Subject: [PATCH 2/3] volume_mapping: get rid of exp10 workaround +Subject: [PATCH] volume_mapping: get rid of exp10 workaround + +exp10 is a GNU function, is not part of C++, and is not available +everywhere. pow(10,x) is an alternative that works just as well. @@ -47,6 +50,3 @@ index 61a7138af..beecce640 100644 volume = volume * (1 - min_norm) + min_norm; } value = lrint_dir(6000.0 * log10(volume), dir) + max; --- -2.24.1 - diff --git a/sound/mpd/patches/040-fix-aiff-and-amr.patch b/sound/mpd/patches/040-fix-aiff-and-amr.patch deleted file mode 100644 index 4ed3dddd20..0000000000 --- a/sound/mpd/patches/040-fix-aiff-and-amr.patch +++ /dev/null @@ -1,28 +0,0 @@ -From d5341ccfe1a29f8d88c279d246ddd4e0b53fbecc Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Sun, 2 Feb 2020 16:08:36 -0800 -Subject: [PATCH] [clang-tidy] add missing comma - -Found with bugprone-suspicious-missing-comma - -Signed-off-by: Rosen Penev ---- - src/decoder/plugins/FfmpegDecoderPlugin.cxx | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx -index 6be0448b9..2bc1fb4ae 100644 ---- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx -+++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx -@@ -762,7 +762,7 @@ static const char *const ffmpeg_mime_types[] = { - "audio/aac", - "audio/aacp", - "audio/ac3", -- "audio/aiff" -+ "audio/aiff", - "audio/amr", - "audio/basic", - "audio/flac", --- -2.24.1 - diff --git a/sound/mpd/patches/030-treewide-get-rid-of-C-math-function-usage.patch b/sound/mpd/patches/040-treewide-get-rid-of-C-math-function-usage.patch similarity index 77% rename from sound/mpd/patches/030-treewide-get-rid-of-C-math-function-usage.patch rename to sound/mpd/patches/040-treewide-get-rid-of-C-math-function-usage.patch index d59ebd3f35..27cbaa379a 100644 --- a/sound/mpd/patches/030-treewide-get-rid-of-C-math-function-usage.patch +++ b/sound/mpd/patches/040-treewide-get-rid-of-C-math-function-usage.patch @@ -1,7 +1,7 @@ -From 506b806e253af7cc37e269b79cc3e099d02cf81a Mon Sep 17 00:00:00 2001 +From 2a8e7c50743ec6a20c7bd9c8e84ccd36d59e69ad Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 3 Feb 2020 15:50:46 -0800 -Subject: [PATCH 3/3] treewide: get rid of C math function usage +Subject: [PATCH] treewide: get rid of C math function usage Boost does not seem to offer an overload for lrint. @@ -16,13 +16,16 @@ Signed-off-by: Rosen Penev src/util/Math.hxx | 6 ++++++ 7 files changed, 16 insertions(+), 11 deletions(-) +diff --git a/src/ReplayGainGlobal.cxx b/src/ReplayGainGlobal.cxx +index 741381dcb..01ba8769d 100644 --- a/src/ReplayGainGlobal.cxx +++ b/src/ReplayGainGlobal.cxx -@@ -22,10 +22,10 @@ +@@ -21,11 +21,11 @@ + #include "ReplayGainConfig.hxx" #include "config/Param.hxx" #include "config/Data.hxx" - #include "util/RuntimeError.hxx" +#include "util/Math.hxx" + #include "util/RuntimeError.hxx" #include #include @@ -30,6 +33,8 @@ Signed-off-by: Rosen Penev static float ParsePreamp(const char *s) +diff --git a/src/ReplayGainInfo.cxx b/src/ReplayGainInfo.cxx +index a0685507a..76713aded 100644 --- a/src/ReplayGainInfo.cxx +++ b/src/ReplayGainInfo.cxx @@ -19,8 +19,7 @@ @@ -42,21 +47,24 @@ Signed-off-by: Rosen Penev float ReplayGainTuple::CalculateScale(const ReplayGainConfig &config) const noexcept +diff --git a/src/decoder/Bridge.cxx b/src/decoder/Bridge.cxx +index 27d1a577a..7f9ffe02d 100644 --- a/src/decoder/Bridge.cxx +++ b/src/decoder/Bridge.cxx -@@ -33,9 +33,10 @@ +@@ -31,11 +31,11 @@ + #include "Log.hxx" + #include "input/InputStream.hxx" #include "util/ConstBuffer.hxx" ++#include "util/Math.hxx" #include "util/StringBuffer.hxx" -+#include -+ #include #include -#include DecoderBridge::~DecoderBridge() { -@@ -591,7 +592,7 @@ DecoderBridge::SubmitReplayGain(const ReplayGainInfo *new_replay_gain_info) +@@ -591,7 +592,7 @@ DecoderBridge::SubmitReplayGain(const ReplayGainInfo *new_replay_gain_info) noex const auto &tuple = new_replay_gain_info->Get(rgm); const auto scale = tuple.CalculateScale(dc.replay_gain_config); @@ -65,6 +73,8 @@ Signed-off-by: Rosen Penev } replay_gain_info = *new_replay_gain_info; +diff --git a/src/decoder/plugins/MpcdecDecoderPlugin.cxx b/src/decoder/plugins/MpcdecDecoderPlugin.cxx +index c19aee75c..4e9ef798e 100644 --- a/src/decoder/plugins/MpcdecDecoderPlugin.cxx +++ b/src/decoder/plugins/MpcdecDecoderPlugin.cxx @@ -26,6 +26,7 @@ @@ -84,6 +94,8 @@ Signed-off-by: Rosen Penev struct mpc_decoder_data { InputStream &is; DecoderClient *client; +diff --git a/src/mixer/plugins/AlsaMixerPlugin.cxx b/src/mixer/plugins/AlsaMixerPlugin.cxx +index e3d774194..4b916319b 100644 --- a/src/mixer/plugins/AlsaMixerPlugin.cxx +++ b/src/mixer/plugins/AlsaMixerPlugin.cxx @@ -26,6 +26,7 @@ @@ -103,6 +115,8 @@ Signed-off-by: Rosen Penev #define VOLUME_MIXER_ALSA_DEFAULT "default" #define VOLUME_MIXER_ALSA_CONTROL_DEFAULT "PCM" static constexpr unsigned VOLUME_MIXER_ALSA_INDEX_DEFAULT = 0; +diff --git a/src/mixer/plugins/SoftwareMixerPlugin.cxx b/src/mixer/plugins/SoftwareMixerPlugin.cxx +index c394a9628..9c48279f9 100644 --- a/src/mixer/plugins/SoftwareMixerPlugin.cxx +++ b/src/mixer/plugins/SoftwareMixerPlugin.cxx @@ -22,8 +22,9 @@ @@ -125,6 +139,8 @@ Signed-off-by: Rosen Penev (54.5981500331F - 1)); else return 0; +diff --git a/src/util/Math.hxx b/src/util/Math.hxx +index bd856f5a9..2206b045f 100644 --- a/src/util/Math.hxx +++ b/src/util/Math.hxx @@ -31,10 +31,16 @@ diff --git a/sound/mpd/patches/210-support_raw_pcm_streams.patch b/sound/mpd/patches/210-support_raw_pcm_streams.patch deleted file mode 100644 index b04ed9f0fe..0000000000 --- a/sound/mpd/patches/210-support_raw_pcm_streams.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx -+++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx -@@ -775,6 +775,7 @@ static const char *const ffmpeg_mime_typ - "audio/qcelp", - "audio/vorbis", - "audio/vorbis+ogg", -+ "audio/wav", - "audio/x-8svx", - "audio/x-16sv", - "audio/x-aac", -- 2.30.2