From 03b9bd3a9e51b5ea36099d79ae69edc9cab6c6f6 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Tue, 26 May 2020 18:54:55 +0200
Subject: [PATCH 01/15] python/build/libs.py: update FFmpeg to 4.2.3

---
 python/build/libs.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/python/build/libs.py b/python/build/libs.py
index 0063e220c..0af17b303 100644
--- a/python/build/libs.py
+++ b/python/build/libs.py
@@ -112,8 +112,8 @@ liblame = AutotoolsProject(
 )
 
 ffmpeg = FfmpegProject(
-    'http://ffmpeg.org/releases/ffmpeg-4.2.2.tar.xz',
-    'cb754255ab0ee2ea5f66f8850e1bd6ad5cac1cd855d0a2f4990fb8c668b0d29c',
+    'http://ffmpeg.org/releases/ffmpeg-4.2.3.tar.xz',
+    '9df6c90aed1337634c1fb026fb01c154c29c82a64ea71291ff2da9aacb9aad31',
     'lib/libavcodec.a',
     [
         '--disable-shared', '--enable-static',

From f7b6431b6f02e9d479427dd2054cb97273e414e7 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Tue, 26 May 2020 20:50:16 +0200
Subject: [PATCH 02/15] meson.build: work around Meson bug detecting strndup()
 on Windows

Work around Meson bug https://github.com/mesonbuild/meson/issues/3672
---
 NEWS        | 1 +
 meson.build | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 35b762de3..44252f4e6 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ ver 0.21.24 (not yet released)
   - simple: fix crash when mounting twice
 * fix unit test failure
 * fix build failure with Android NDK r21
+* work around Meson bug breaking the Windows build with GCC 10
 
 ver 0.21.23 (2020/04/23)
 * protocol
diff --git a/meson.build b/meson.build
index 7c5dcac9f..ab28340a6 100644
--- a/meson.build
+++ b/meson.build
@@ -142,7 +142,13 @@ conf.set('HAVE_GETPWNAM_R', compiler.has_function('getpwnam_r'))
 conf.set('HAVE_GETPWUID_R', compiler.has_function('getpwuid_r'))
 conf.set('HAVE_INITGROUPS', compiler.has_function('initgroups'))
 conf.set('HAVE_FNMATCH', compiler.has_function('fnmatch'))
-conf.set('HAVE_STRNDUP', compiler.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))
+
+# Explicitly exclude Windows in this check because
+# https://github.com/mesonbuild/meson/issues/3672 (reported in 2018,
+# still not fixed in 2020) causes Meson to believe it exists, because
+# __builtin_strndup() exists (but strndup() still cannot be used).
+conf.set('HAVE_STRNDUP', not is_windows and compiler.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))
+
 conf.set('HAVE_STRCASESTR', compiler.has_function('strcasestr'))
 
 conf.set('HAVE_PRCTL', is_linux)

From d2d4a0251ee55b88d9c2526d1674e8541b4beabe Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Tue, 26 May 2020 21:07:52 +0200
Subject: [PATCH 03/15] .gitignore: add emacs lsp-mode files

---
 .gitignore | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.gitignore b/.gitignore
index c2fc6512f..cf00b5c57 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,6 @@
 /output/
 
 __pycache__/
+
+/.clangd/
+/compile_commands.json

From 9adda30c38f96bc313a4db1343884b7bb98b23de Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 27 May 2020 14:33:18 +0200
Subject: [PATCH 04/15] NEWS: move two lines below Windows/Android

---
 NEWS | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 44252f4e6..b4ea4bcf0 100644
--- a/NEWS
+++ b/NEWS
@@ -3,9 +3,11 @@ ver 0.21.24 (not yet released)
   - "tagtypes" requires no permissions
 * database
   - simple: fix crash when mounting twice
+* Android
+  - fix build failure with Android NDK r21
+* Windows
+  - work around Meson bug breaking the Windows build with GCC 10
 * fix unit test failure
-* fix build failure with Android NDK r21
-* work around Meson bug breaking the Windows build with GCC 10
 
 ver 0.21.23 (2020/04/23)
 * protocol

From 69f09648a402c6ce63db631026feb5ee757b037e Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 27 May 2020 15:01:54 +0200
Subject: [PATCH 05/15] meson.build: attempt to detect WildMidi using
 pkg-config

The WildMidi project added the pkg-config file in version 0.3.3, but
unfortunately, Debian still doesn't ship it 4 years later:

 https://bugs.debian.org/916631

However, for cross-compiling, the pkg-config file is very helpful.
---
 NEWS                            | 2 ++
 src/decoder/plugins/meson.build | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index b4ea4bcf0..64df932ec 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ ver 0.21.24 (not yet released)
   - "tagtypes" requires no permissions
 * database
   - simple: fix crash when mounting twice
+* decoder
+  - wildmidi: attempt to detect WildMidi using pkg-config
 * Android
   - fix build failure with Android NDK r21
 * Windows
diff --git a/src/decoder/plugins/meson.build b/src/decoder/plugins/meson.build
index 50845e4df..ca90cc07d 100644
--- a/src/decoder/plugins/meson.build
+++ b/src/decoder/plugins/meson.build
@@ -129,7 +129,12 @@ if wavpack_dep.found()
   decoder_plugins_sources += 'WavpackDecoderPlugin.cxx'
 endif
 
-wildmidi_dep = c_compiler.find_library('WildMidi', required: get_option('wildmidi'))
+if not get_option('wildmidi').disabled()
+  wildmidi_dep = dependency('wildmidi', required: get_option('wildmidi'))
+endif
+if not wildmidi_dep.found()
+  wildmidi_dep = c_compiler.find_library('WildMidi', required: get_option('wildmidi'))
+endif
 conf.set('ENABLE_WILDMIDI', wildmidi_dep.found())
 if wildmidi_dep.found()
   decoder_plugins_sources += 'WildmidiDecoderPlugin.cxx'

From ebcb5e9368a3002df53a797da8c6fb74dd1fae77 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 27 May 2020 14:06:22 +0200
Subject: [PATCH 06/15] decoder/wildmidi: use NarrowPath, fixing the Windows
 build

---
 NEWS                                          | 1 +
 src/decoder/plugins/WildmidiDecoderPlugin.cxx | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 64df932ec..276c07b9d 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ ver 0.21.24 (not yet released)
   - simple: fix crash when mounting twice
 * decoder
   - wildmidi: attempt to detect WildMidi using pkg-config
+  - wildmidi: fix Windows build failure
 * Android
   - fix build failure with Android NDK r21
 * Windows
diff --git a/src/decoder/plugins/WildmidiDecoderPlugin.cxx b/src/decoder/plugins/WildmidiDecoderPlugin.cxx
index bafccdf13..a5d8aa5c6 100644
--- a/src/decoder/plugins/WildmidiDecoderPlugin.cxx
+++ b/src/decoder/plugins/WildmidiDecoderPlugin.cxx
@@ -25,6 +25,7 @@
 #include "fs/AllocatedPath.hxx"
 #include "fs/FileSystem.hxx"
 #include "fs/Path.hxx"
+#include "fs/NarrowPath.hxx"
 #include "Log.hxx"
 #include "PluginUnavailable.hxx"
 
@@ -53,7 +54,8 @@ wildmidi_init(const ConfigBlock &block)
 	AtScopeExit() { WildMidi_ClearError(); };
 #endif
 
-	if (WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate,
+	if (WildMidi_Init(NarrowPath(path),
+			  wildmidi_audio_format.sample_rate,
 			  0) != 0) {
 #ifdef LIBWILDMIDI_VERSION
 		/* WildMidi_GetError() requires libwildmidi 0.4 */
@@ -96,7 +98,7 @@ wildmidi_file_decode(DecoderClient &client, Path path_fs)
 	midi *wm;
 	const struct _WM_Info *info;
 
-	wm = WildMidi_Open(path_fs.c_str());
+	wm = WildMidi_Open(NarrowPath(path_fs));
 	if (wm == nullptr)
 		return;
 
@@ -136,7 +138,7 @@ wildmidi_file_decode(DecoderClient &client, Path path_fs)
 static bool
 wildmidi_scan_file(Path path_fs, TagHandler &handler) noexcept
 {
-	midi *wm = WildMidi_Open(path_fs.c_str());
+	midi *wm = WildMidi_Open(NarrowPath(path_fs));
 	if (wm == nullptr)
 		return false;
 

From d276d8eda2857e2a6b985b7252f20e1e409709a2 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 27 May 2020 14:26:37 +0200
Subject: [PATCH 07/15] decoder/wildmidi: assume WildMidi is built as static
 library on Windows

---
 src/decoder/plugins/WildmidiDecoderPlugin.cxx | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/decoder/plugins/WildmidiDecoderPlugin.cxx b/src/decoder/plugins/WildmidiDecoderPlugin.cxx
index a5d8aa5c6..c06d2da03 100644
--- a/src/decoder/plugins/WildmidiDecoderPlugin.cxx
+++ b/src/decoder/plugins/WildmidiDecoderPlugin.cxx
@@ -29,6 +29,12 @@
 #include "Log.hxx"
 #include "PluginUnavailable.hxx"
 
+#ifdef _WIN32
+/* assume WildMidi is built as static library on Windows; without
+   this, linking to the static library would fail */
+#define WILDMIDI_STATIC
+#endif
+
 extern "C" {
 #include <wildmidi_lib.h>
 }

From 4e5d6e560bde09ee1fe0d28ad0d046a3b65669b5 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 27 May 2020 14:29:24 +0200
Subject: [PATCH 08/15] decoder/modplug: assume ModPlug is built as static
 library on Windows

---
 NEWS                                         | 1 +
 src/decoder/plugins/ModplugDecoderPlugin.cxx | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 276c07b9d..30dd81a83 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ ver 0.21.24 (not yet released)
 * database
   - simple: fix crash when mounting twice
 * decoder
+  - modplug: fix Windows build failure
   - wildmidi: attempt to detect WildMidi using pkg-config
   - wildmidi: fix Windows build failure
 * Android
diff --git a/src/decoder/plugins/ModplugDecoderPlugin.cxx b/src/decoder/plugins/ModplugDecoderPlugin.cxx
index d3d91efe1..2ba2de4e5 100644
--- a/src/decoder/plugins/ModplugDecoderPlugin.cxx
+++ b/src/decoder/plugins/ModplugDecoderPlugin.cxx
@@ -26,8 +26,13 @@
 #include "util/RuntimeError.hxx"
 #include "Log.hxx"
 
-#include <libmodplug/modplug.h>
+#ifdef _WIN32
+/* assume ModPlug is built as static library on Windows; without
+   this, linking to the static library would fail */
+#define MODPLUG_STATIC
+#endif
 
+#include <libmodplug/modplug.h>
 
 #include <assert.h>
 

From 257a77fa355c3ffe708a4ef6f314206c48023a5a Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Tue, 26 May 2020 21:08:29 +0200
Subject: [PATCH 09/15] {android,win32}/build.py: build libmodplug and WildMidi

Closes https://github.com/MusicPlayerDaemon/MPD/issues/866
---
 NEWS                  |  2 ++
 android/build.py      |  2 ++
 python/build/cmake.py | 45 +++++++++++++++++++++++++++++++++++++++++++
 python/build/libs.py  | 24 +++++++++++++++++++++++
 win32/build.py        |  2 ++
 5 files changed, 75 insertions(+)
 create mode 100644 python/build/cmake.py

diff --git a/NEWS b/NEWS
index 30dd81a83..34057bbc2 100644
--- a/NEWS
+++ b/NEWS
@@ -8,8 +8,10 @@ ver 0.21.24 (not yet released)
   - wildmidi: attempt to detect WildMidi using pkg-config
   - wildmidi: fix Windows build failure
 * Android
+  - enable the decoder plugins ModPlug and WildMidi
   - fix build failure with Android NDK r21
 * Windows
+  - enable the decoder plugins ModPlug and WildMidi
   - work around Meson bug breaking the Windows build with GCC 10
 * fix unit test failure
 
diff --git a/android/build.py b/android/build.py
index 91e292683..8716fc1a9 100755
--- a/android/build.py
+++ b/android/build.py
@@ -168,6 +168,8 @@ thirdparty_libs = [
     opus,
     flac,
     libid3tag,
+    libmodplug,
+    wildmidi,
     ffmpeg,
     curl,
     libexpat,
diff --git a/python/build/cmake.py b/python/build/cmake.py
new file mode 100644
index 000000000..76f217715
--- /dev/null
+++ b/python/build/cmake.py
@@ -0,0 +1,45 @@
+import subprocess
+
+from build.project import Project
+
+def configure(toolchain, src, build, args=()):
+    cross_args = []
+
+    if toolchain.is_windows:
+        cross_args.append('-DCMAKE_SYSTEM_NAME=Windows')
+        cross_args.append('-DCMAKE_RC_COMPILER=' + toolchain.windres)
+
+    configure = [
+        'cmake',
+        src,
+
+        '-DCMAKE_INSTALL_PREFIX=' + toolchain.install_prefix,
+        '-DCMAKE_BUILD_TYPE=release',
+
+        '-DCMAKE_C_COMPILER=' + toolchain.cc,
+        '-DCMAKE_CXX_COMPILER=' + toolchain.cxx,
+
+        '-DCMAKE_C_FLAGS=' + toolchain.cflags + ' ' + toolchain.cppflags,
+        '-DCMAKE_CXX_FLAGS=' + toolchain.cxxflags + ' ' + toolchain.cppflags,
+
+        '-GNinja',
+    ] + cross_args + args
+
+    subprocess.check_call(configure, env=toolchain.env, cwd=build)
+
+class CmakeProject(Project):
+    def __init__(self, url, md5, installed, configure_args=[],
+                 **kwargs):
+        Project.__init__(self, url, md5, installed, **kwargs)
+        self.configure_args = configure_args
+
+    def configure(self, toolchain):
+        src = self.unpack(toolchain)
+        build = self.make_build_path(toolchain)
+        configure(toolchain, src, build, self.configure_args)
+        return build
+
+    def build(self, toolchain):
+        build = self.configure(toolchain)
+        subprocess.check_call(['ninja', 'install'],
+                              cwd=build, env=toolchain.env)
diff --git a/python/build/libs.py b/python/build/libs.py
index 0af17b303..c7b2250cd 100644
--- a/python/build/libs.py
+++ b/python/build/libs.py
@@ -4,6 +4,7 @@ from os.path import abspath
 from build.project import Project
 from build.zlib import ZlibProject
 from build.meson import MesonProject
+from build.cmake import CmakeProject
 from build.autotools import AutotoolsProject
 from build.ffmpeg import FfmpegProject
 from build.boost import BoostProject
@@ -111,6 +112,29 @@ liblame = AutotoolsProject(
     ],
 )
 
+libmodplug = AutotoolsProject(
+    'https://downloads.sourceforge.net/modplug-xmms/libmodplug/0.8.9.0/libmodplug-0.8.9.0.tar.gz',
+    '457ca5a6c179656d66c01505c0d95fafaead4329b9dbaa0f997d00a3508ad9de',
+    'lib/libmodplug.a',
+    [
+        '--disable-shared', '--enable-static',
+    ],
+)
+
+wildmidi = CmakeProject(
+    'https://codeload.github.com/Mindwerks/wildmidi/tar.gz/wildmidi-0.4.3',
+    '498e5a96455bb4b91b37188ad6dcb070824e92c44f5ed452b90adbaec8eef3c5',
+    'lib/libWildMidi.a',
+    [
+        '-DBUILD_SHARED_LIBS=OFF',
+        '-DWANT_PLAYER=OFF',
+        '-DWANT_STATIC=ON',
+    ],
+    base='wildmidi-wildmidi-0.4.3',
+    name='wildmidi',
+    version='0.4.3',
+)
+
 ffmpeg = FfmpegProject(
     'http://ffmpeg.org/releases/ffmpeg-4.2.3.tar.xz',
     '9df6c90aed1337634c1fb026fb01c154c29c82a64ea71291ff2da9aacb9aad31',
diff --git a/win32/build.py b/win32/build.py
index 0e09003fe..9e1b6e9e4 100755
--- a/win32/build.py
+++ b/win32/build.py
@@ -96,6 +96,8 @@ thirdparty_libs = [
     zlib,
     libid3tag,
     liblame,
+    libmodplug,
+    wildmidi,
     ffmpeg,
     curl,
     libexpat,

From c065950ced57a0316997ddb6ff5758dadb788bd4 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 27 May 2020 15:31:12 +0200
Subject: [PATCH 10/15] .travis.yml: disable zzip on OS X to fix Travis-CI
 build failure

---
 .travis.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index d546e6500..733ea45dd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -135,7 +135,8 @@ jobs:
             - chromaprint
             - libsamplerate
             - libsoxr
-            - libzzip
+            # libzzip appears to be broken on Homebrew: "ld: library not found for -lzzip"
+            #- libzzip
             - flac
             - opus
             - libvorbis

From 8925040262f2acc4812843a0ae145ba31e3806ab Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Mon, 16 Mar 2020 13:37:13 -0700
Subject: [PATCH 11/15] remove some more extra semicolons

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 src/lib/dbus/Values.hxx     | 6 +++---
 src/lib/pulse/LockGuard.hxx | 2 +-
 src/lib/upnp/ixmlwrap.hxx   | 2 +-
 src/thread/Util.cxx         | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/lib/dbus/Values.hxx b/src/lib/dbus/Values.hxx
index cc81093d8..45223cc22 100644
--- a/src/lib/dbus/Values.hxx
+++ b/src/lib/dbus/Values.hxx
@@ -86,7 +86,7 @@ struct WrapVariant : BasicValue<T> {
 template<typename T>
 static WrapVariant<T> Variant(const T &_value) noexcept {
 	return WrapVariant<T>(_value);
-};
+}
 
 template<typename T>
 struct WrapFixedArray {
@@ -103,7 +103,7 @@ template<typename T>
 static WrapFixedArray<T> FixedArray(const T *_data,
 				    size_t _size) noexcept {
 	return WrapFixedArray<T>(_data, _size);
-};
+}
 
 template<typename... T>
 struct WrapStruct {
@@ -118,7 +118,7 @@ struct WrapStruct {
 template<typename... T>
 static WrapStruct<T...> Struct(const T&... values) noexcept {
 	return WrapStruct<T...>(values...);
-};
+}
 
 } /* namespace ODBus */
 
diff --git a/src/lib/pulse/LockGuard.hxx b/src/lib/pulse/LockGuard.hxx
index d0630c0f1..0a612d1d0 100644
--- a/src/lib/pulse/LockGuard.hxx
+++ b/src/lib/pulse/LockGuard.hxx
@@ -41,6 +41,6 @@ public:
 	LockGuard &operator=(const LockGuard &) = delete;
 };
 
-};
+}
 
 #endif
diff --git a/src/lib/upnp/ixmlwrap.hxx b/src/lib/upnp/ixmlwrap.hxx
index 73a0ce83f..6713d59bd 100644
--- a/src/lib/upnp/ixmlwrap.hxx
+++ b/src/lib/upnp/ixmlwrap.hxx
@@ -30,6 +30,6 @@ namespace ixmlwrap {
 	const char *getFirstElementValue(IXML_Document *doc,
 					 const char *name) noexcept;
 
-};
+}
 
 #endif /* _IXMLWRAP_H_INCLUDED_ */
diff --git a/src/thread/Util.cxx b/src/thread/Util.cxx
index 5b61b62be..e1e564918 100644
--- a/src/thread/Util.cxx
+++ b/src/thread/Util.cxx
@@ -94,7 +94,7 @@ SetThreadIdlePriority() noexcept
 #elif defined(_WIN32)
 	SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_IDLE);
 #endif
-};
+}
 
 void
 SetThreadRealtime()
@@ -111,4 +111,4 @@ SetThreadRealtime()
 	if (linux_sched_setscheduler(0, policy, &sched_param) < 0)
 		throw MakeErrno("sched_setscheduler failed");
 #endif	// __linux__
-};
+}

From bdc861f0582a7ca5c20b1eaf1ebae685fa0b85a2 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 27 May 2020 15:46:53 +0200
Subject: [PATCH 12/15] util/TemplateString: remove extra semicolon

---
 src/util/TemplateString.hxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/util/TemplateString.hxx b/src/util/TemplateString.hxx
index 0d1329273..5e2e5f494 100644
--- a/src/util/TemplateString.hxx
+++ b/src/util/TemplateString.hxx
@@ -121,6 +121,6 @@ namespace TemplateString {
 
 	template<>
 	struct Concat<> : Empty {};
-};
+}
 
 #endif

From 8e4ca2372763929841c45acefc50c4c7356b9228 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 27 May 2020 15:54:23 +0200
Subject: [PATCH 13/15] lib/ffmpeg/Time: replace C99 compound literal with C++
 initializer list

---
 src/lib/ffmpeg/Time.hxx | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lib/ffmpeg/Time.hxx b/src/lib/ffmpeg/Time.hxx
index e172126aa..3e02fc1b6 100644
--- a/src/lib/ffmpeg/Time.hxx
+++ b/src/lib/ffmpeg/Time.hxx
@@ -45,7 +45,7 @@ FfmpegTimeToDouble(int64_t t, const AVRational time_base) noexcept
 {
 	assert(t != (int64_t)AV_NOPTS_VALUE);
 
-	return FloatDuration(av_rescale_q(t, time_base, (AVRational){1, 1024}))
+	return FloatDuration(av_rescale_q(t, time_base, {1, 1024}))
 		/ 1024;
 }
 
@@ -69,7 +69,7 @@ FromFfmpegTime(int64_t t, const AVRational time_base) noexcept
 	assert(t != (int64_t)AV_NOPTS_VALUE);
 
 	return SongTime::FromMS(av_rescale_q(t, time_base,
-					     (AVRational){1, 1000}));
+					     {1, 1000}));
 }
 
 /**

From 5cb0080052856d988aa63922398f242ce6873a69 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 27 May 2020 15:36:49 +0200
Subject: [PATCH 14/15] meson.build: default to warning_level=2

This branch isn't yet ready for level 3 (`-Wpedantic`) due to several
C++ violations (e.g. variable length arrays).  These are already
cleaned up in the master branch (0.22).
---
 meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index ab28340a6..fae9c488a 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,8 @@ project(
   meson_version: '>= 0.49.0',
   default_options: [
     'c_std=c99',
-    'cpp_std=c++14'
+    'cpp_std=c++14',
+    'warning_level=2',
   ],
   license: 'GPLv2+',
 )

From 30d97fe8a040a9d89f3be2dd443c1991cc73405f Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@musicpd.org>
Date: Wed, 27 May 2020 16:05:39 +0200
Subject: [PATCH 15/15] meson.build: fix the WildMidi check when the feature is
 disabled

Fixes regression from commit 69f09648a402
---
 src/decoder/plugins/meson.build | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/decoder/plugins/meson.build b/src/decoder/plugins/meson.build
index ca90cc07d..21a75c6a4 100644
--- a/src/decoder/plugins/meson.build
+++ b/src/decoder/plugins/meson.build
@@ -129,9 +129,13 @@ if wavpack_dep.found()
   decoder_plugins_sources += 'WavpackDecoderPlugin.cxx'
 endif
 
-if not get_option('wildmidi').disabled()
-  wildmidi_dep = dependency('wildmidi', required: get_option('wildmidi'))
+wildmidi_required = get_option('wildmidi')
+if wildmidi_required.enabled()
+  # if the user has force-enabled WildMidi, allow the pkg-config test
+  # to fail; after that, the find_library() check must succeed
+  wildmidi_required = false
 endif
+wildmidi_dep = dependency('wildmidi', required: wildmidi_required)
 if not wildmidi_dep.found()
   wildmidi_dep = c_compiler.find_library('WildMidi', required: get_option('wildmidi'))
 endif