decoder/openmpt: check libopenmpt version at compile time, not at configure time

This commit is contained in:
Max Kellermann 2023-04-21 17:28:19 +02:00
parent ad8117e7c8
commit 90c3fe22f5
2 changed files with 3 additions and 5 deletions

View File

@ -2,7 +2,6 @@
// Copyright The Music Player Daemon Project
#include "OpenmptDecoderPlugin.hxx"
#include "decoder/Features.h"
#include "ModCommon.hxx"
#include "../DecoderAPI.hxx"
#include "input/InputStream.hxx"
@ -28,7 +27,7 @@ static int openmpt_volume_ramping;
static bool openmpt_sync_samples;
static std::string_view openmpt_at_end;
static bool openmpt_emulate_amiga;
#ifdef HAVE_LIBOPENMPT_VERSION_0_5
#if OPENMPT_API_VERSION_AT_LEAST(0,5,0)
static std::string_view openmpt_emulate_amiga_type;
#endif
@ -43,7 +42,7 @@ openmpt_decoder_init(const ConfigBlock &block)
openmpt_sync_samples = block.GetBlockValue("sync_samples", true);
openmpt_at_end = block.GetBlockValue("at_end", "fadeout");
openmpt_emulate_amiga = block.GetBlockValue("emulate_amiga", true);
#ifdef HAVE_LIBOPENMPT_VERSION_0_5
#if OPENMPT_API_VERSION_AT_LEAST(0,5,0)
openmpt_emulate_amiga_type = block.GetBlockValue("emulate_amiga_type", "auto");
#endif
@ -74,7 +73,7 @@ mod_decode(DecoderClient &client, InputStream &is)
mod.set_render_param(mod.RENDER_INTERPOLATIONFILTER_LENGTH, 0);
}
mod.set_render_param(mod.RENDER_VOLUMERAMPING_STRENGTH, openmpt_volume_ramping);
#ifdef HAVE_LIBOPENMPT_VERSION_0_5
#if OPENMPT_API_VERSION_AT_LEAST(0,5,0)
mod.ctl_set_boolean("seek.sync_samples", openmpt_sync_samples);
mod.ctl_set_boolean("render.resampler.emulate_amiga", openmpt_emulate_amiga);
mod.ctl_set_text("render.resampler.emulate_amiga_type", openmpt_emulate_amiga_type);

View File

@ -109,7 +109,6 @@ endif
libopenmpt_dep = dependency('libopenmpt', required: get_option('openmpt'))
decoder_features.set('ENABLE_OPENMPT', libopenmpt_dep.found())
decoder_features.set('HAVE_LIBOPENMPT_VERSION_0_5', libopenmpt_dep.version().version_compare('>= 0.5'))
if libopenmpt_dep.found()
decoder_plugins_sources += [
'OpenmptDecoderPlugin.cxx',