lib/alsa: require alsa-lib 1.1 or later
This commit is contained in:
parent
43b26ee612
commit
1410bcbce9
1
NEWS
1
NEWS
|
@ -27,6 +27,7 @@ ver 0.24 (not yet released)
|
||||||
* tags
|
* tags
|
||||||
- new tags "TitleSort", "Mood"
|
- new tags "TitleSort", "Mood"
|
||||||
* output
|
* output
|
||||||
|
- alsa: require alsa-lib 1.1 or later
|
||||||
- pipewire: fix corruption bug due to missing lock
|
- pipewire: fix corruption bug due to missing lock
|
||||||
- pipewire: map tags "Date" and "Comment"
|
- pipewire: map tags "Date" and "Comment"
|
||||||
* switch to C++20
|
* switch to C++20
|
||||||
|
|
|
@ -1,27 +1,15 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
// Copyright The Music Player Daemon Project
|
// Copyright The Music Player Daemon Project
|
||||||
|
|
||||||
#ifndef MPD_ALSA_FORMAT_HXX
|
#pragma once
|
||||||
#define MPD_ALSA_FORMAT_HXX
|
|
||||||
|
|
||||||
#include "pcm/SampleFormat.hxx"
|
#include "pcm/SampleFormat.hxx"
|
||||||
#include "util/Compiler.h"
|
#include "util/Compiler.h"
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <alsa/asoundlib.h>
|
#include <alsa/asoundlib.h>
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#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
|
* Convert MPD's #SampleFormat enum to libasound's snd_pcm_format_t
|
||||||
* enum. Returns SND_PCM_FORMAT_UNKNOWN if there is no according ALSA
|
* 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;
|
return SND_PCM_FORMAT_UNKNOWN;
|
||||||
|
|
||||||
case SampleFormat::DSD:
|
case SampleFormat::DSD:
|
||||||
#ifdef HAVE_ALSA_DSD
|
|
||||||
return SND_PCM_FORMAT_DSD_U8;
|
return SND_PCM_FORMAT_DSD_U8;
|
||||||
#else
|
|
||||||
return SND_PCM_FORMAT_UNKNOWN;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
case SampleFormat::S8:
|
case SampleFormat::S8:
|
||||||
return SND_PCM_FORMAT_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;
|
case SND_PCM_FORMAT_S32_BE: return SND_PCM_FORMAT_S32_LE;
|
||||||
|
|
||||||
#ifdef HAVE_ALSA_DSD_U32
|
|
||||||
case SND_PCM_FORMAT_DSD_U16_LE:
|
case SND_PCM_FORMAT_DSD_U16_LE:
|
||||||
return SND_PCM_FORMAT_DSD_U16_BE;
|
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:
|
case SND_PCM_FORMAT_DSD_U32_BE:
|
||||||
return SND_PCM_FORMAT_DSD_U32_LE;
|
return SND_PCM_FORMAT_DSD_U32_LE;
|
||||||
#endif
|
|
||||||
|
|
||||||
default: return SND_PCM_FORMAT_UNKNOWN;
|
default: return SND_PCM_FORMAT_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
@ -121,5 +103,3 @@ PackAlsaPcmFormat(snd_pcm_format_t fmt) noexcept
|
||||||
return SND_PCM_FORMAT_UNKNOWN;
|
return SND_PCM_FORMAT_UNKNOWN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ TryFormatDsd(snd_pcm_t *pcm, snd_pcm_hw_params_t *hwparams,
|
||||||
{
|
{
|
||||||
int err = TryFormatOrByteSwap(pcm, hwparams, fmt, params);
|
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) {
|
if (err == -EINVAL && fmt == SND_PCM_FORMAT_DSD_U8) {
|
||||||
/* attempt to switch to DSD_U32 */
|
/* attempt to switch to DSD_U32 */
|
||||||
fmt = IsLittleEndian()
|
fmt = IsLittleEndian()
|
||||||
|
|
|
@ -3,7 +3,7 @@ if not is_linux
|
||||||
subdir_done()
|
subdir_done()
|
||||||
endif
|
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()
|
if not libasound_dep.found()
|
||||||
alsa_dep = dependency('', required: false)
|
alsa_dep = dependency('', required: false)
|
||||||
subdir_done()
|
subdir_done()
|
||||||
|
|
Loading…
Reference in New Issue