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 <redacted>
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 <thess@kitschensync.net>
PKG_LICENSE:=GPL-2.0-or-later
#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"
+}
-From bffc5cde6d71556f143500a12c53c1835deebe07 Mon Sep 17 00:00:00 2001
+From 769cd0ee9f0cf8ceb026aa751b5d4a390bb5dbdc Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
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.
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 @@
#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 @@
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 <neaacdec.h>
+
+-#include <cmath>
+ #include <exception>
+
+ #include <assert.h>
+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 @@
#include <windows.h>
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 @@
#include <string.h>
#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 @@
vol1 = Clamp<int>(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 @@
} 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 <rosenp@gmail.com>
++ * Copyright (C) 2018 Max Kellermann <max.kellermann@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
--- /dev/null
+From ab5183cbc45818114cc4c226ace299a1fb917ab0 Mon Sep 17 00:00:00 2001
+From: Rosen Penev <rosenp@gmail.com>
+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 <rosenp@gmail.com>
+---
+ 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,
-From b8ed7496963aafdb6ec3415c4efd1ff98a7e8a1d Mon Sep 17 00:00:00 2001
+From 6b3250a3fb4a854d19980868ed187ca21f0e5ed8 Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
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.
volume = volume * (1 - min_norm) + min_norm;
}
value = lrint_dir(6000.0 * log10(volume), dir) + max;
---
-2.24.1
-
+++ /dev/null
-From d5341ccfe1a29f8d88c279d246ddd4e0b53fbecc Mon Sep 17 00:00:00 2001
-From: Rosen Penev <rosenp@gmail.com>
-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 <rosenp@gmail.com>
----
- 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
-
-From 506b806e253af7cc37e269b79cc3e099d02cf81a Mon Sep 17 00:00:00 2001
+From 2a8e7c50743ec6a20c7bd9c8e84ccd36d59e69ad Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
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.
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 <assert.h>
#include <stdlib.h>
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 @@
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 <cmath>
-+
#include <assert.h>
#include <string.h>
-#include <math.h>
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);
}
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 @@
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 @@
#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 @@
(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 @@
+++ /dev/null
---- 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",