diff --git a/NEWS b/NEWS index 1706bf265..e23118fb8 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,7 @@ ver 0.24 (not yet released) * tags - new tags "TitleSort", "Mood" * output + - alsa: require alsa-lib 1.1 or later - pipewire: fix corruption bug due to missing lock - pipewire: map tags "Date" and "Comment" * switch to C++20 diff --git a/src/lib/alsa/Format.hxx b/src/lib/alsa/Format.hxx index 2c987eca3..d91e8b1c1 100644 --- a/src/lib/alsa/Format.hxx +++ b/src/lib/alsa/Format.hxx @@ -1,27 +1,15 @@ // SPDX-License-Identifier: GPL-2.0-or-later // Copyright The Music Player Daemon Project -#ifndef MPD_ALSA_FORMAT_HXX -#define MPD_ALSA_FORMAT_HXX +#pragma once #include "pcm/SampleFormat.hxx" #include "util/Compiler.h" -#include "config.h" #include #include -#if SND_LIB_VERSION >= 0x1001c -/* alsa-lib supports DSD since version 1.0.27.1 */ -#define HAVE_ALSA_DSD -#endif - -#if SND_LIB_VERSION >= 0x1001d -/* alsa-lib supports DSD_U32 since version 1.0.29 */ -#define HAVE_ALSA_DSD_U32 -#endif - /** * Convert MPD's #SampleFormat enum to libasound's snd_pcm_format_t * enum. Returns SND_PCM_FORMAT_UNKNOWN if there is no according ALSA @@ -36,11 +24,7 @@ ToAlsaPcmFormat(SampleFormat sample_format) noexcept return SND_PCM_FORMAT_UNKNOWN; case SampleFormat::DSD: -#ifdef HAVE_ALSA_DSD return SND_PCM_FORMAT_DSD_U8; -#else - return SND_PCM_FORMAT_UNKNOWN; -#endif case SampleFormat::S8: return SND_PCM_FORMAT_S8; @@ -85,7 +69,6 @@ ByteSwapAlsaPcmFormat(snd_pcm_format_t fmt) noexcept case SND_PCM_FORMAT_S32_BE: return SND_PCM_FORMAT_S32_LE; -#ifdef HAVE_ALSA_DSD_U32 case SND_PCM_FORMAT_DSD_U16_LE: return SND_PCM_FORMAT_DSD_U16_BE; @@ -97,7 +80,6 @@ ByteSwapAlsaPcmFormat(snd_pcm_format_t fmt) noexcept case SND_PCM_FORMAT_DSD_U32_BE: return SND_PCM_FORMAT_DSD_U32_LE; -#endif default: return SND_PCM_FORMAT_UNKNOWN; } @@ -121,5 +103,3 @@ PackAlsaPcmFormat(snd_pcm_format_t fmt) noexcept return SND_PCM_FORMAT_UNKNOWN; } } - -#endif diff --git a/src/lib/alsa/HwSetup.cxx b/src/lib/alsa/HwSetup.cxx index e1488522c..6b478ccf7 100644 --- a/src/lib/alsa/HwSetup.cxx +++ b/src/lib/alsa/HwSetup.cxx @@ -80,7 +80,7 @@ TryFormatDsd(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams, { int err = TryFormatOrByteSwap(pcm, hwparams, fmt, params); -#if defined(ENABLE_DSD) && defined(HAVE_ALSA_DSD_U32) +#ifdef ENABLE_DSD if (err == -EINVAL && fmt == SND_PCM_FORMAT_DSD_U8) { /* attempt to switch to DSD_U32 */ fmt = IsLittleEndian() diff --git a/src/lib/alsa/meson.build b/src/lib/alsa/meson.build index 7e854c77a..58a77091c 100644 --- a/src/lib/alsa/meson.build +++ b/src/lib/alsa/meson.build @@ -3,7 +3,7 @@ if not is_linux subdir_done() endif -libasound_dep = dependency('alsa', version: '>= 0.9.0', required: get_option('alsa')) +libasound_dep = dependency('alsa', version: '>= 1.1', required: get_option('alsa')) if not libasound_dep.found() alsa_dep = dependency('', required: false) subdir_done()