mpd: update to 0.21.20 11371/head
authorRosen Penev <rosenp@gmail.com>
Tue, 18 Feb 2020 04:09:53 +0000 (20:09 -0800)
committerRosen Penev <rosenp@gmail.com>
Tue, 18 Feb 2020 05:16:26 +0000 (21:16 -0800)
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 <rosenp@gmail.com>
sound/mpd/Makefile
sound/mpd/files/mpd.init
sound/mpd/patches/010-treewide-use-boost-lround-when-std-round-is-unavaila.patch
sound/mpd/patches/020-fix-incorrect-rounding.patch [new file with mode: 0644]
sound/mpd/patches/020-volume_mapping-get-rid-of-exp10-workaround.patch [deleted file]
sound/mpd/patches/030-treewide-get-rid-of-C-math-function-usage.patch [deleted file]
sound/mpd/patches/030-volume_mapping-get-rid-of-exp10-workaround.patch [new file with mode: 0644]
sound/mpd/patches/040-fix-aiff-and-amr.patch [deleted file]
sound/mpd/patches/040-treewide-get-rid-of-C-math-function-usage.patch [new file with mode: 0644]
sound/mpd/patches/210-support_raw_pcm_streams.patch [deleted file]

index 0cb361439f15ffc8a0d543c16732e722fcc76027..edfde7f26f88412ffebbb5e615991095b867c40a 100644 (file)
@@ -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 <thess@kitschensync.net>
 PKG_LICENSE:=GPL-2.0-or-later
index ac8f1fce65a3556c9b4b7b599fa89912e2841d3b..9ec164db7e4a0a57c7505959f5f73ba381df07f2 100644 (file)
@@ -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"
+}
index 9c8dcec505673697e751e06a7354280121ee6a97..20bda3548e4ff65c6831e6050da3bb68b7bde71c 100644 (file)
@@ -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 <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.
 
@@ -13,12 +12,14 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
  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 <rosenp@gmail.com>
  
  #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 <rosenp@gmail.com>
  
        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 @@
@@ -84,6 +106,8 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
  #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 @@
@@ -103,6 +127,8 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
  #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 @@
@@ -127,6 +153,8 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
        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 @@
@@ -150,11 +178,14 @@ Signed-off-by: Rosen Penev <rosenp@gmail.com>
        } 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
diff --git a/sound/mpd/patches/020-fix-incorrect-rounding.patch b/sound/mpd/patches/020-fix-incorrect-rounding.patch
new file mode 100644 (file)
index 0000000..80e7a6c
--- /dev/null
@@ -0,0 +1,34 @@
+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,
diff --git a/sound/mpd/patches/020-volume_mapping-get-rid-of-exp10-workaround.patch b/sound/mpd/patches/020-volume_mapping-get-rid-of-exp10-workaround.patch
deleted file mode 100644 (file)
index 86ab2e7..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-From b8ed7496963aafdb6ec3415c4efd1ff98a7e8a1d 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
-
-pow(10,x) is an alternative that works just as well.
-
-Signed-off-by: Rosen Penev <rosenp@gmail.com>
----
- src/mixer/plugins/volume_mapping.c | 11 +++--------
- 1 file changed, 3 insertions(+), 8 deletions(-)
-
-diff --git a/src/mixer/plugins/volume_mapping.c b/src/mixer/plugins/volume_mapping.c
-index 61a7138af..beecce640 100644
---- a/src/mixer/plugins/volume_mapping.c
-+++ b/src/mixer/plugins/volume_mapping.c
-@@ -34,11 +34,6 @@
- #include <stdbool.h>
- #include "volume_mapping.h"
--#ifdef __UCLIBC__
--/* 10^x = 10^(log e^x) = (e^x)^log10 = e^(x * log 10) */
--#define exp10(x) (exp((x) * log(10)))
--#endif /* __UCLIBC__ */
--
- #define MAX_LINEAR_DB_SCALE   24
- static inline bool use_linear_dB_scale(long dBmin, long dBmax)
-@@ -111,9 +106,9 @@ static double get_normalized_volume(snd_mixer_elem_t *elem,
-       if (use_linear_dB_scale(min, max))
-               return (value - min) / (double)(max - min);
--      normalized = exp10((value - max) / 6000.0);
-+      normalized = pow(10, (value - max) / 6000.0);
-       if (min != SND_CTL_TLV_DB_GAIN_MUTE) {
--              min_norm = exp10((min - max) / 6000.0);
-+              min_norm = pow(10, (min - max) / 6000.0);
-               normalized = (normalized - min_norm) / (1 - min_norm);
-       }
-@@ -159,7 +154,7 @@ static int set_normalized_volume(snd_mixer_elem_t *elem,
-       }
-       if (min != SND_CTL_TLV_DB_GAIN_MUTE) {
--              min_norm = exp10((min - max) / 6000.0);
-+              min_norm = pow(10, (min - max) / 6000.0);
-               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/030-treewide-get-rid-of-C-math-function-usage.patch b/sound/mpd/patches/030-treewide-get-rid-of-C-math-function-usage.patch
deleted file mode 100644 (file)
index d59ebd3..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-From 506b806e253af7cc37e269b79cc3e099d02cf81a 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
-
-Boost does not seem to offer an overload for lrint.
-
-Signed-off-by: Rosen Penev <rosenp@gmail.com>
----
- src/ReplayGainGlobal.cxx                    | 2 +-
- src/ReplayGainInfo.cxx                      | 3 +--
- src/decoder/Bridge.cxx                      | 5 +++--
- src/decoder/plugins/MpcdecDecoderPlugin.cxx | 3 +--
- src/mixer/plugins/AlsaMixerPlugin.cxx       | 3 +--
- src/mixer/plugins/SoftwareMixerPlugin.cxx   | 5 +++--
- src/util/Math.hxx                           | 6 ++++++
- 7 files changed, 16 insertions(+), 11 deletions(-)
-
---- a/src/ReplayGainGlobal.cxx
-+++ b/src/ReplayGainGlobal.cxx
-@@ -22,10 +22,10 @@
- #include "config/Param.hxx"
- #include "config/Data.hxx"
- #include "util/RuntimeError.hxx"
-+#include "util/Math.hxx"
- #include <assert.h>
- #include <stdlib.h>
--#include <math.h>
- static float
- ParsePreamp(const char *s)
---- a/src/ReplayGainInfo.cxx
-+++ b/src/ReplayGainInfo.cxx
-@@ -19,8 +19,7 @@
- #include "ReplayGainInfo.hxx"
- #include "ReplayGainConfig.hxx"
--
--#include <math.h>
-+#include "util/Math.hxx"
- float
- ReplayGainTuple::CalculateScale(const ReplayGainConfig &config) const noexcept
---- a/src/decoder/Bridge.cxx
-+++ b/src/decoder/Bridge.cxx
-@@ -33,9 +33,10 @@
- #include "util/ConstBuffer.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)
-                       const auto &tuple = new_replay_gain_info->Get(rgm);
-                       const auto scale =
-                               tuple.CalculateScale(dc.replay_gain_config);
--                      dc.replay_gain_db = 20.0 * log10f(scale);
-+                      dc.replay_gain_db = 20.0 * std::log10(scale);
-               }
-               replay_gain_info = *new_replay_gain_info;
---- a/src/decoder/plugins/MpcdecDecoderPlugin.cxx
-+++ b/src/decoder/plugins/MpcdecDecoderPlugin.cxx
-@@ -26,6 +26,7 @@
- #include "util/Domain.hxx"
- #include "util/Macros.hxx"
- #include "util/Clamp.hxx"
-+#include "util/Math.hxx"
- #include "util/ScopeExit.hxx"
- #include "Log.hxx"
-@@ -33,8 +34,6 @@
- #include <exception>
--#include <math.h>
--
- struct mpc_decoder_data {
-       InputStream &is;
-       DecoderClient *client;
---- a/src/mixer/plugins/AlsaMixerPlugin.cxx
-+++ b/src/mixer/plugins/AlsaMixerPlugin.cxx
-@@ -26,6 +26,7 @@
- #include "event/Call.hxx"
- #include "util/ASCII.hxx"
- #include "util/Domain.hxx"
-+#include "util/Math.hxx"
- #include "util/RuntimeError.hxx"
- #include "Log.hxx"
-@@ -35,8 +36,6 @@ extern "C" {
- #include <alsa/asoundlib.h>
--#include <math.h>
--
- #define VOLUME_MIXER_ALSA_DEFAULT             "default"
- #define VOLUME_MIXER_ALSA_CONTROL_DEFAULT     "PCM"
- static constexpr unsigned VOLUME_MIXER_ALSA_INDEX_DEFAULT = 0;
---- a/src/mixer/plugins/SoftwareMixerPlugin.cxx
-+++ b/src/mixer/plugins/SoftwareMixerPlugin.cxx
-@@ -22,8 +22,9 @@
- #include "filter/plugins/VolumeFilterPlugin.hxx"
- #include "pcm/Volume.hxx"
-+#include <cmath>
-+
- #include <assert.h>
--#include <math.h>
- class SoftwareMixer final : public Mixer {
-       Filter *filter = nullptr;
-@@ -73,7 +74,7 @@ PercentVolumeToSoftwareVolume(unsigned volume) noexcept
-       if (volume >= 100)
-               return PCM_VOLUME_1;
-       else if (volume > 0)
--              return pcm_float_to_volume((exp(volume / 25.0) - 1) /
-+              return pcm_float_to_volume((std::exp(volume / 25.0) - 1) /
-                                          (54.5981500331F - 1));
-       else
-               return 0;
---- a/src/util/Math.hxx
-+++ b/src/util/Math.hxx
-@@ -31,10 +31,16 @@
- #define MATH_HXX
- #ifdef __UCLIBC__
-+#include <boost/math/special_functions/pow.hpp>
- #include <boost/math/special_functions/round.hpp>
-+using boost::math::iround;
-+using boost::math::pow;
- using boost::math::lround;
-+#define lrint iround
- #else
- #include <cmath>
-+using std::pow;
-+using std::lrint;
- using std::lround;
- #endif
diff --git a/sound/mpd/patches/030-volume_mapping-get-rid-of-exp10-workaround.patch b/sound/mpd/patches/030-volume_mapping-get-rid-of-exp10-workaround.patch
new file mode 100644 (file)
index 0000000..efa245e
--- /dev/null
@@ -0,0 +1,52 @@
+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] 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.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ src/mixer/plugins/volume_mapping.c | 11 +++--------
+ 1 file changed, 3 insertions(+), 8 deletions(-)
+
+diff --git a/src/mixer/plugins/volume_mapping.c b/src/mixer/plugins/volume_mapping.c
+index 61a7138af..beecce640 100644
+--- a/src/mixer/plugins/volume_mapping.c
++++ b/src/mixer/plugins/volume_mapping.c
+@@ -34,11 +34,6 @@
+ #include <stdbool.h>
+ #include "volume_mapping.h"
+-#ifdef __UCLIBC__
+-/* 10^x = 10^(log e^x) = (e^x)^log10 = e^(x * log 10) */
+-#define exp10(x) (exp((x) * log(10)))
+-#endif /* __UCLIBC__ */
+-
+ #define MAX_LINEAR_DB_SCALE   24
+ static inline bool use_linear_dB_scale(long dBmin, long dBmax)
+@@ -111,9 +106,9 @@ static double get_normalized_volume(snd_mixer_elem_t *elem,
+       if (use_linear_dB_scale(min, max))
+               return (value - min) / (double)(max - min);
+-      normalized = exp10((value - max) / 6000.0);
++      normalized = pow(10, (value - max) / 6000.0);
+       if (min != SND_CTL_TLV_DB_GAIN_MUTE) {
+-              min_norm = exp10((min - max) / 6000.0);
++              min_norm = pow(10, (min - max) / 6000.0);
+               normalized = (normalized - min_norm) / (1 - min_norm);
+       }
+@@ -159,7 +154,7 @@ static int set_normalized_volume(snd_mixer_elem_t *elem,
+       }
+       if (min != SND_CTL_TLV_DB_GAIN_MUTE) {
+-              min_norm = exp10((min - max) / 6000.0);
++              min_norm = pow(10, (min - max) / 6000.0);
+               volume = volume * (1 - min_norm) + min_norm;
+       }
+       value = lrint_dir(6000.0 * log10(volume), dir) + max;
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 (file)
index 4ed3ddd..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-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
-
diff --git a/sound/mpd/patches/040-treewide-get-rid-of-C-math-function-usage.patch b/sound/mpd/patches/040-treewide-get-rid-of-C-math-function-usage.patch
new file mode 100644 (file)
index 0000000..27cbaa3
--- /dev/null
@@ -0,0 +1,162 @@
+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] treewide: get rid of C math function usage
+
+Boost does not seem to offer an overload for lrint.
+
+Signed-off-by: Rosen Penev <rosenp@gmail.com>
+---
+ src/ReplayGainGlobal.cxx                    | 2 +-
+ src/ReplayGainInfo.cxx                      | 3 +--
+ src/decoder/Bridge.cxx                      | 5 +++--
+ src/decoder/plugins/MpcdecDecoderPlugin.cxx | 3 +--
+ src/mixer/plugins/AlsaMixerPlugin.cxx       | 3 +--
+ src/mixer/plugins/SoftwareMixerPlugin.cxx   | 5 +++--
+ 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
+@@ -21,11 +21,11 @@
+ #include "ReplayGainConfig.hxx"
+ #include "config/Param.hxx"
+ #include "config/Data.hxx"
++#include "util/Math.hxx"
+ #include "util/RuntimeError.hxx"
+ #include <assert.h>
+ #include <stdlib.h>
+-#include <math.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 @@
+ #include "ReplayGainInfo.hxx"
+ #include "ReplayGainConfig.hxx"
+-
+-#include <math.h>
++#include "util/Math.hxx"
+ 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
+@@ -31,11 +31,11 @@
+ #include "Log.hxx"
+ #include "input/InputStream.hxx"
+ #include "util/ConstBuffer.hxx"
++#include "util/Math.hxx"
+ #include "util/StringBuffer.hxx"
+ #include <assert.h>
+ #include <string.h>
+-#include <math.h>
+ DecoderBridge::~DecoderBridge()
+ {
+@@ -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);
+-                      dc.replay_gain_db = 20.0 * log10f(scale);
++                      dc.replay_gain_db = 20.0 * std::log10(scale);
+               }
+               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 @@
+ #include "util/Domain.hxx"
+ #include "util/Macros.hxx"
+ #include "util/Clamp.hxx"
++#include "util/Math.hxx"
+ #include "util/ScopeExit.hxx"
+ #include "Log.hxx"
+@@ -33,8 +34,6 @@
+ #include <exception>
+-#include <math.h>
+-
+ 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 @@
+ #include "event/Call.hxx"
+ #include "util/ASCII.hxx"
+ #include "util/Domain.hxx"
++#include "util/Math.hxx"
+ #include "util/RuntimeError.hxx"
+ #include "Log.hxx"
+@@ -35,8 +36,6 @@ extern "C" {
+ #include <alsa/asoundlib.h>
+-#include <math.h>
+-
+ #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 @@
+ #include "filter/plugins/VolumeFilterPlugin.hxx"
+ #include "pcm/Volume.hxx"
++#include <cmath>
++
+ #include <assert.h>
+-#include <math.h>
+ class SoftwareMixer final : public Mixer {
+       Filter *filter = nullptr;
+@@ -73,7 +74,7 @@ PercentVolumeToSoftwareVolume(unsigned volume) noexcept
+       if (volume >= 100)
+               return PCM_VOLUME_1;
+       else if (volume > 0)
+-              return pcm_float_to_volume((exp(volume / 25.0) - 1) /
++              return pcm_float_to_volume((std::exp(volume / 25.0) - 1) /
+                                          (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 @@
+ #define MATH_HXX
+ #ifdef __UCLIBC__
++#include <boost/math/special_functions/pow.hpp>
+ #include <boost/math/special_functions/round.hpp>
++using boost::math::iround;
++using boost::math::pow;
+ using boost::math::lround;
++#define lrint iround
+ #else
+ #include <cmath>
++using std::pow;
++using std::lrint;
+ using std::lround;
+ #endif
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 (file)
index b04ed9f..0000000
+++ /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",