From 851fcf482314556ae22f6b39d4aac290948c806f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 9 Mar 2023 18:09:54 +0100 Subject: [PATCH] decoder/gme: require GME 0.6 or later This allows dropping a few compile-time version checks and we can use pkg-config to detect the library. --- NEWS | 1 + src/decoder/plugins/GmeDecoderPlugin.cxx | 7 +------ src/decoder/plugins/meson.build | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index ac0a68887..5a09d4720 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ ver 0.24 (not yet released) - curl: fix busy loop after connection failed * decoder - ffmpeg: require FFmpeg 4.0 or later + - gme: require GME 0.6 or later - hybrid_dsd: remove - opus: implement bitrate calculation - wavpack: require libwavpack version 5 diff --git a/src/decoder/plugins/GmeDecoderPlugin.cxx b/src/decoder/plugins/GmeDecoderPlugin.cxx index 6986517a1..4b7c26bc5 100644 --- a/src/decoder/plugins/GmeDecoderPlugin.cxx +++ b/src/decoder/plugins/GmeDecoderPlugin.cxx @@ -41,20 +41,17 @@ struct GmeContainerPath { unsigned track; }; -#if GME_VERSION >= 0x000600 static int gme_accuracy; -#endif static unsigned gme_default_fade; static bool gme_plugin_init([[maybe_unused]] const ConfigBlock &block) { -#if GME_VERSION >= 0x000600 auto accuracy = block.GetBlockParam("accuracy"); gme_accuracy = accuracy != nullptr ? (int)accuracy->GetBoolValue() : -1; -#endif + auto fade = block.GetBlockParam("default_fade"); gme_default_fade = fade != nullptr ? fade->GetUnsignedValue() * 1000 @@ -148,10 +145,8 @@ gme_file_decode(DecoderClient &client, Path path_fs) FmtDebug(gme_domain, "emulator type '{}'", gme_type_system(gme_type(emu))); -#if GME_VERSION >= 0x000600 if (gme_accuracy >= 0) gme_enable_accuracy(emu, gme_accuracy); -#endif gme_info_t *ti; const char *gme_err = gme_track_info(emu, &ti, container.track); diff --git a/src/decoder/plugins/meson.build b/src/decoder/plugins/meson.build index 1fcef72ae..06aa166e2 100644 --- a/src/decoder/plugins/meson.build +++ b/src/decoder/plugins/meson.build @@ -80,7 +80,7 @@ if libfaad_dep.found() decoder_plugins_sources += 'FaadDecoderPlugin.cxx' endif -libgme_dep = c_compiler.find_library('gme', required: get_option('gme')) +libgme_dep = dependency('libgme', version: '>= 0.6', required: get_option('gme')) decoder_features.set('ENABLE_GME', libgme_dep.found()) if libgme_dep.found() decoder_plugins_sources += 'GmeDecoderPlugin.cxx'