From 85f9863e0abcc96d55ea661e74a1be9ab3d18343 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Apr 2022 20:05:20 +0200 Subject: [PATCH] meson.build: always enable Wave encoder for Snapcast Even if the "wave_encoder" option is disabled (and no other encoder plugins are enabled), forcefully enable the Wave encoder (if Snapcast is enabled). Closes https://github.com/MusicPlayerDaemon/MPD/issues/1500 --- src/encoder/meson.build | 16 ++++++++++++++++ src/encoder/plugins/meson.build | 2 +- src/output/plugins/meson.build | 5 ++--- test/meson.build | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/encoder/meson.build b/src/encoder/meson.build index 1140e2a52..0274dc128 100644 --- a/src/encoder/meson.build +++ b/src/encoder/meson.build @@ -3,6 +3,22 @@ encoder_features = configuration_data() encoder_features.set('ENABLE_ENCODER', need_encoder) if not need_encoder + if need_wave_encoder + # Special case for the Snapcast output plugin which only needs the + # PCM wave encoder encoder plugin + encoder_glue = static_library( + 'encoder_glue', + 'plugins/WaveEncoderPlugin.cxx', + include_directories: inc, + ) + + encoder_glue_dep = declare_dependency( + link_with: encoder_glue, + ) + + subdir_done() + endif + encoder_glue_dep = dependency('', required: false) configure_file(output: 'Features.h', configuration: encoder_features) subdir_done() diff --git a/src/encoder/plugins/meson.build b/src/encoder/plugins/meson.build index 991a1e2cc..854c736bb 100644 --- a/src/encoder/plugins/meson.build +++ b/src/encoder/plugins/meson.build @@ -35,7 +35,7 @@ if libshine_dep.found() endif encoder_features.set('ENABLE_WAVE_ENCODER', get_option('wave_encoder')) -if get_option('wave_encoder') +if get_option('wave_encoder') or need_wave_encoder encoder_plugins_sources += 'WaveEncoderPlugin.cxx' endif diff --git a/src/output/plugins/meson.build b/src/output/plugins/meson.build index caac2c949..f6fce21c3 100644 --- a/src/output/plugins/meson.build +++ b/src/output/plugins/meson.build @@ -10,6 +10,7 @@ output_plugins_deps = [ ] need_encoder = false +need_wave_encoder = false if alsa_dep.found() output_plugins_sources += 'AlsaOutputPlugin.cxx' @@ -127,9 +128,7 @@ if get_option('snapcast') output_features.set('HAVE_YAJL', yajl_dep.found()) - # TODO: the Snapcast plugin needs just the "wave" encoder, but this - # enables all available encoders - need_encoder = true + need_wave_encoder = true endif enable_solaris_output = get_option('solaris_output') diff --git a/test/meson.build b/test/meson.build index 9da7dd691..fd42e43b0 100644 --- a/test/meson.build +++ b/test/meson.build @@ -572,7 +572,7 @@ executable( # Encoder # -if encoder_glue_dep.found() +if need_encoder executable( 'run_encoder', 'run_encoder.cxx',