From f44011519c8c93af9e07e90130cf01f7f6b9fa2b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 18 Jun 2019 15:35:38 +0200 Subject: [PATCH 1/8] meson.build: increase protocol version to 0.21.11 Commit 1eae9339f207e6e14126c1ce227b7225ec732a4a added support for multiple "groups" in the "list" command, and this change allows clients to detect that this behavior, which had been documented for several years, is now implemented properly. --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 9577c7375..b11e91cb8 100644 --- a/meson.build +++ b/meson.build @@ -20,7 +20,7 @@ conf.set_quoted('PACKAGE', meson.project_name()) conf.set_quoted('PACKAGE_NAME', meson.project_name()) conf.set_quoted('PACKAGE_VERSION', meson.project_version()) conf.set_quoted('VERSION', meson.project_version()) -conf.set_quoted('PROTOCOL_VERSION', '0.21.6') +conf.set_quoted('PROTOCOL_VERSION', '0.21.11') conf.set_quoted('SYSTEM_CONFIG_FILE_LOCATION', join_paths(get_option('prefix'), get_option('sysconfdir'), 'mpd.conf')) common_cppflags = [ From 85e82e3d4d7c8fa9947768c1819eeb4aa963c1bd Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Jun 2019 22:01:45 +0200 Subject: [PATCH 2/8] decoder/List: annotate exceptions thrown by DecoderPlugin::Init() --- src/decoder/DecoderList.cxx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/decoder/DecoderList.cxx b/src/decoder/DecoderList.cxx index 286136826..510a45e20 100644 --- a/src/decoder/DecoderList.cxx +++ b/src/decoder/DecoderList.cxx @@ -45,6 +45,7 @@ #include "plugins/FluidsynthDecoderPlugin.hxx" #include "plugins/SidplayDecoderPlugin.hxx" #include "util/Macros.hxx" +#include "util/RuntimeError.hxx" #include @@ -147,8 +148,13 @@ decoder_plugin_init_all(const ConfigData &config) if (param != nullptr) param->SetUsed(); - if (plugin.Init(*param)) - decoder_plugins_enabled[i] = true; + try { + if (plugin.Init(*param)) + decoder_plugins_enabled[i] = true; + } catch (...) { + std::throw_with_nested(FormatRuntimeError("Failed to initialize decoder plugin '%s'", + plugin.name)); + } } } From c4d3efe71dbe96c12fb5623ed2213ed7cd998da9 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Jun 2019 22:02:20 +0200 Subject: [PATCH 3/8] decoder/List: handle exception PluginUnavailable --- src/decoder/DecoderList.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/decoder/DecoderList.cxx b/src/decoder/DecoderList.cxx index 510a45e20..654f5e8f6 100644 --- a/src/decoder/DecoderList.cxx +++ b/src/decoder/DecoderList.cxx @@ -20,6 +20,8 @@ #include "config.h" #include "DecoderList.hxx" #include "DecoderPlugin.hxx" +#include "PluginUnavailable.hxx" +#include "Log.hxx" #include "config/Data.hxx" #include "config/Block.hxx" #include "plugins/AudiofileDecoderPlugin.hxx" @@ -151,6 +153,10 @@ decoder_plugin_init_all(const ConfigData &config) try { if (plugin.Init(*param)) decoder_plugins_enabled[i] = true; + } catch (const PluginUnavailable &e) { + FormatError(e, + "Decoder plugin '%s' is unavailable", + plugin.name); } catch (...) { std::throw_with_nested(FormatRuntimeError("Failed to initialize decoder plugin '%s'", plugin.name)); From 0abaa3ecc5d17f3578b8d1b34a63fdcca5d85a00 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Jun 2019 22:38:40 +0200 Subject: [PATCH 4/8] decoder/wildmidi: throw PluginUnavailable if config file does not exist This makes the configuration error more visible, possibly addressing one part of https://github.com/MusicPlayerDaemon/MPD/issues/589 --- src/decoder/plugins/WildmidiDecoderPlugin.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/decoder/plugins/WildmidiDecoderPlugin.cxx b/src/decoder/plugins/WildmidiDecoderPlugin.cxx index 68a72a30a..37bb026e2 100644 --- a/src/decoder/plugins/WildmidiDecoderPlugin.cxx +++ b/src/decoder/plugins/WildmidiDecoderPlugin.cxx @@ -21,10 +21,12 @@ #include "../DecoderAPI.hxx" #include "tag/Handler.hxx" #include "util/Domain.hxx" +#include "util/StringFormat.hxx" #include "fs/AllocatedPath.hxx" #include "fs/FileSystem.hxx" #include "fs/Path.hxx" #include "Log.hxx" +#include "PluginUnavailable.hxx" extern "C" { #include @@ -43,10 +45,8 @@ wildmidi_init(const ConfigBlock &block) if (!FileExists(path)) { const auto utf8 = path.ToUTF8(); - FormatDebug(wildmidi_domain, - "configuration file does not exist: %s", - utf8.c_str()); - return false; + throw PluginUnavailable(StringFormat<1024>("configuration file does not exist: %s", + utf8.c_str())); } return WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate, From ea639269d8b0ae3db06c46d546d54896a8d8c89e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Jun 2019 22:24:05 +0200 Subject: [PATCH 5/8] decoder/wildmidi: throw PluginUnavailable on WildMidi_Init() error Closes https://github.com/MusicPlayerDaemon/MPD/issues/589 --- NEWS | 2 ++ src/decoder/plugins/WildmidiDecoderPlugin.cxx | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 2d206e325..2cb980345 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.21.11 (not yet released) +* decoder + - wildmidi: log error if library initialization fails * output - alsa, osx: fix distortions with DSD_U32 and DoP on 32 bit CPUs * protocol diff --git a/src/decoder/plugins/WildmidiDecoderPlugin.cxx b/src/decoder/plugins/WildmidiDecoderPlugin.cxx index 37bb026e2..a1dbee4f2 100644 --- a/src/decoder/plugins/WildmidiDecoderPlugin.cxx +++ b/src/decoder/plugins/WildmidiDecoderPlugin.cxx @@ -21,6 +21,7 @@ #include "../DecoderAPI.hxx" #include "tag/Handler.hxx" #include "util/Domain.hxx" +#include "util/ScopeExit.hxx" #include "util/StringFormat.hxx" #include "fs/AllocatedPath.hxx" #include "fs/FileSystem.hxx" @@ -49,8 +50,14 @@ wildmidi_init(const ConfigBlock &block) utf8.c_str())); } - return WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate, - 0) == 0; + WildMidi_ClearError(); + AtScopeExit() { WildMidi_ClearError(); }; + + if (WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate, + 0) != 0) + throw PluginUnavailable(WildMidi_GetError()); + + return true; } static void From 39b40ac1fd0916ef7d860186976fd61eb7ba5b3f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Jun 2019 23:10:13 +0200 Subject: [PATCH 6/8] decoder/wildmidi: remove unused variable wildmidi_domain --- src/decoder/plugins/WildmidiDecoderPlugin.cxx | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/decoder/plugins/WildmidiDecoderPlugin.cxx b/src/decoder/plugins/WildmidiDecoderPlugin.cxx index a1dbee4f2..7613344c4 100644 --- a/src/decoder/plugins/WildmidiDecoderPlugin.cxx +++ b/src/decoder/plugins/WildmidiDecoderPlugin.cxx @@ -20,7 +20,6 @@ #include "WildmidiDecoderPlugin.hxx" #include "../DecoderAPI.hxx" #include "tag/Handler.hxx" -#include "util/Domain.hxx" #include "util/ScopeExit.hxx" #include "util/StringFormat.hxx" #include "fs/AllocatedPath.hxx" @@ -33,8 +32,6 @@ extern "C" { #include } -static constexpr Domain wildmidi_domain("wildmidi"); - static constexpr AudioFormat wildmidi_audio_format{48000, SampleFormat::S16, 2}; static bool From f07f8f7d882757e77cf1e0829daf425dbcc15d58 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Jun 2019 23:13:12 +0200 Subject: [PATCH 7/8] decoder/wildmidi: add fallbacks for libwildmidi<0.4 Fix build breakage from commit ea639269d8b0ae3db06c46d546d54896a8d8c89e --- src/decoder/plugins/WildmidiDecoderPlugin.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/decoder/plugins/WildmidiDecoderPlugin.cxx b/src/decoder/plugins/WildmidiDecoderPlugin.cxx index 7613344c4..bafccdf13 100644 --- a/src/decoder/plugins/WildmidiDecoderPlugin.cxx +++ b/src/decoder/plugins/WildmidiDecoderPlugin.cxx @@ -47,12 +47,21 @@ wildmidi_init(const ConfigBlock &block) utf8.c_str())); } +#ifdef LIBWILDMIDI_VERSION + /* WildMidi_ClearError() requires libwildmidi 0.4 */ WildMidi_ClearError(); AtScopeExit() { WildMidi_ClearError(); }; +#endif if (WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate, - 0) != 0) + 0) != 0) { +#ifdef LIBWILDMIDI_VERSION + /* WildMidi_GetError() requires libwildmidi 0.4 */ throw PluginUnavailable(WildMidi_GetError()); +#else + throw PluginUnavailable("WildMidi_Init() failed"); +#endif + } return true; } From 8bf3f9b87437e2969b50a8d1bcb380678a5ad58c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Jun 2019 23:09:12 +0200 Subject: [PATCH 8/8] input/tidal: deprecated because Tidal has changed the protocol See https://github.com/MusicPlayerDaemon/MPD/issues/545 --- NEWS | 2 ++ doc/plugins.rst | 5 +++++ src/input/plugins/TidalInputPlugin.cxx | 2 ++ 3 files changed, 9 insertions(+) diff --git a/NEWS b/NEWS index 2cb980345..b0657d4a9 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.21.11 (not yet released) +* input + - tidal: deprecated because Tidal has changed the protocol * decoder - wildmidi: log error if library initialization fails * output diff --git a/doc/plugins.rst b/doc/plugins.rst index 71485c8c1..6feb00438 100644 --- a/doc/plugins.rst +++ b/doc/plugins.rst @@ -245,6 +245,11 @@ tidal Play songs from the commercial streaming service `Tidal `_. It plays URLs in the form tidal://track/ID, e.g.: +.. warning:: + + This plugin is currently defunct because Tidal has changed the + protocol and decided not to share documentation. + .. code-block:: none mpc add tidal://track/59727857 diff --git a/src/input/plugins/TidalInputPlugin.cxx b/src/input/plugins/TidalInputPlugin.cxx index 95025954b..3592262b2 100644 --- a/src/input/plugins/TidalInputPlugin.cxx +++ b/src/input/plugins/TidalInputPlugin.cxx @@ -180,6 +180,8 @@ InitTidalInput(EventLoop &event_loop, const ConfigBlock &block) if (password == nullptr) throw PluginUnavailable("No Tidal password configured"); + FormatWarning(tidal_domain, "The Tidal input plugin is deprecated because Tidal has changed the protocol and doesn't share documentation"); + tidal_audioquality = block.GetBlockValue("audioquality", "HIGH"); tidal_session = new TidalSessionManager(event_loop, base_url, token,