From e108568082dcb8cf71ee576dcdf5f94947d4a8a5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 19 May 2021 07:42:19 +0200 Subject: [PATCH] db/proxy: require libmpdclient 2.11 or later Remove lots of #ifdefs. --- NEWS | 1 + src/db/plugins/ProxyDatabasePlugin.cxx | 27 -------------------------- src/db/plugins/meson.build | 2 +- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/NEWS b/NEWS index cff70595b..810d2e9ea 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,7 @@ ver 0.23 (not yet released) - show the audio format in "playlistinfo" * database - proxy: require MPD 0.20 or later + - proxy: require libmpdclient 2.11 or later * output - pipewire: new plugin - snapcast: new plugin diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx index 2ac00b299..3eb1976f6 100644 --- a/src/db/plugins/ProxyDatabasePlugin.cxx +++ b/src/db/plugins/ProxyDatabasePlugin.cxx @@ -178,14 +178,10 @@ static constexpr struct { { TAG_MUSICBRAINZ_ALBUMARTISTID, MPD_TAG_MUSICBRAINZ_ALBUMARTISTID }, { TAG_MUSICBRAINZ_TRACKID, MPD_TAG_MUSICBRAINZ_TRACKID }, -#if LIBMPDCLIENT_CHECK_VERSION(2,10,0) { TAG_MUSICBRAINZ_RELEASETRACKID, MPD_TAG_MUSICBRAINZ_RELEASETRACKID }, -#endif -#if LIBMPDCLIENT_CHECK_VERSION(2,11,0) { TAG_ARTIST_SORT, MPD_TAG_ARTIST_SORT }, { TAG_ALBUM_ARTIST_SORT, MPD_TAG_ALBUM_ARTIST_SORT }, -#endif #if LIBMPDCLIENT_CHECK_VERSION(2,12,0) { TAG_ALBUM_SORT, MPD_TAG_ALBUM_SORT }, #endif @@ -388,7 +384,6 @@ SendConstraints(mpd_connection *connection, const DatabaseSelection &selection) !SendConstraints(connection, *selection.filter)) return false; -#if LIBMPDCLIENT_CHECK_VERSION(2, 11, 0) if (selection.sort != TAG_NUM_OF_ITEM_TYPES && mpd_connection_cmp_server_version(connection, 0, 21, 0) >= 0) { #if LIBMPDCLIENT_CHECK_VERSION(2, 15, 0) @@ -410,14 +405,11 @@ SendConstraints(mpd_connection *connection, const DatabaseSelection &selection) } #endif } -#endif -#if LIBMPDCLIENT_CHECK_VERSION(2, 10, 0) if (selection.window != RangeArg::All() && !mpd_search_add_window(connection, selection.window.start, selection.window.end)) return false; -#endif return true; } @@ -527,12 +519,7 @@ ProxyDatabase::Connect() host.c_str())); } -#if LIBMPDCLIENT_CHECK_VERSION(2, 10, 0) mpd_connection_set_keepalive(connection, keepalive); -#else - // suppress -Wunused-private-field - (void)keepalive; -#endif idle_received = ~0U; is_idle = false; @@ -865,8 +852,6 @@ try { throw; } -#if LIBMPDCLIENT_CHECK_VERSION(2, 10, 0) - gcc_pure static bool IsFilterSupported(const ISongFilter &f) noexcept @@ -920,10 +905,6 @@ IsFilterFullySupported(const SongFilter *filter, IsFilterFullySupported(*filter, connection); } -#endif - -#if LIBMPDCLIENT_CHECK_VERSION(2, 11, 0) - gcc_pure static bool IsSortSupported(TagType tag_type, @@ -946,8 +927,6 @@ IsSortSupported(TagType tag_type, return Convert(tag_type) != MPD_TAG_COUNT; } -#endif - gcc_pure static DatabaseSelection CheckSelection(DatabaseSelection selection, @@ -956,23 +935,17 @@ CheckSelection(DatabaseSelection selection, selection.uri.clear(); selection.filter = nullptr; -#if LIBMPDCLIENT_CHECK_VERSION(2, 11, 0) if (selection.sort != TAG_NUM_OF_ITEM_TYPES && IsSortSupported(selection.sort, connection)) /* we can forward the "sort" parameter to the other MPD */ selection.sort = TAG_NUM_OF_ITEM_TYPES; -#endif -#if LIBMPDCLIENT_CHECK_VERSION(2, 10, 0) if (selection.window != RangeArg::All() && IsFilterFullySupported(selection.filter, connection)) /* we can forward the "window" parameter to the other MPD */ selection.window = RangeArg::All(); -#else - (void)connection; -#endif return selection; } diff --git a/src/db/plugins/meson.build b/src/db/plugins/meson.build index 287af75be..fdfd3d501 100644 --- a/src/db/plugins/meson.build +++ b/src/db/plugins/meson.build @@ -23,7 +23,7 @@ if upnp_dep.found() ] endif -libmpdclient_dep = dependency('libmpdclient', version: '>= 2.9', required: get_option('libmpdclient')) +libmpdclient_dep = dependency('libmpdclient', version: '>= 2.11', required: get_option('libmpdclient')) conf.set('ENABLE_LIBMPDCLIENT', libmpdclient_dep.found()) if libmpdclient_dep.found() db_plugins_sources += 'ProxyDatabasePlugin.cxx'