alsa: only expose DSD format when DSD_U32_BE is supported

This commit is contained in:
Wim Taymans 2021-09-17 18:00:31 +02:00
parent 43b27002eb
commit 25d39a5ea1

View file

@ -718,6 +718,7 @@ static int enum_dsd_formats(struct state *state, uint32_t index, uint32_t *next,
int res, err; int res, err;
snd_pcm_t *hndl; snd_pcm_t *hndl;
snd_pcm_hw_params_t *params; snd_pcm_hw_params_t *params;
snd_pcm_format_mask_t *fmask;
struct spa_pod_frame f[2]; struct spa_pod_frame f[2];
if ((index & 0xffff) > 0) if ((index & 0xffff) > 0)
@ -727,6 +728,12 @@ static int enum_dsd_formats(struct state *state, uint32_t index, uint32_t *next,
snd_pcm_hw_params_alloca(&params); snd_pcm_hw_params_alloca(&params);
CHECK(snd_pcm_hw_params_any(hndl, params), "Broken configuration: no configurations available"); CHECK(snd_pcm_hw_params_any(hndl, params), "Broken configuration: no configurations available");
snd_pcm_format_mask_alloca(&fmask);
snd_pcm_hw_params_get_format_mask(params, fmask);
if (!snd_pcm_format_mask_test(fmask, SND_PCM_FORMAT_DSD_U32_BE))
return 0;
CHECK(snd_pcm_hw_params_set_rate_resample(hndl, params, 0), "set_rate_resample"); CHECK(snd_pcm_hw_params_set_rate_resample(hndl, params, 0), "set_rate_resample");
spa_pod_builder_push_object(b, &f[0], SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat); spa_pod_builder_push_object(b, &f[0], SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat);