diff options
Diffstat (limited to 'src/pcm_resample.c')
-rw-r--r-- | src/pcm_resample.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/pcm_resample.c b/src/pcm_resample.c index a1e4ee149..ce75325a8 100644 --- a/src/pcm_resample.c +++ b/src/pcm_resample.c @@ -27,14 +27,35 @@ #include <string.h> #ifdef HAVE_LIBSAMPLERATE +static bool lsr_enabled; +#endif + +#ifdef HAVE_LIBSAMPLERATE static bool pcm_resample_lsr_enabled(void) { - return strcmp(config_get_string(CONF_SAMPLERATE_CONVERTER, ""), - "internal") != 0; + return lsr_enabled; } #endif +bool +pcm_resample_global_init(GError **error_r) +{ +#ifdef HAVE_LIBSAMPLERATE + const char *converter = + config_get_string(CONF_SAMPLERATE_CONVERTER, ""); + + lsr_enabled = strcmp(converter, "internal") != 0; + if (lsr_enabled) + return pcm_resample_lsr_global_init(converter, error_r); + else + return true; +#else + (void)error_r; + return true; +#endif +} + void pcm_resample_init(struct pcm_resample_state *state) { memset(state, 0, sizeof(*state)); |