diff --git a/spa/include/spa/param/audio/dsd.h b/spa/include/spa/param/audio/dsd.h index 0570e2e24..3f25875a2 100644 --- a/spa/include/spa/param/audio/dsd.h +++ b/spa/include/spa/param/audio/dsd.h @@ -63,7 +63,7 @@ struct spa_audio_info_dsd { enum spa_param_bitorder bitorder; /*< the order of the bits */ uint32_t flags; /*< extra flags */ int32_t interleave; /*< interleave bytes */ - uint32_t rate; /*< sample rate (in bits per second) */ + uint32_t rate; /*< sample rate (in bytes per second) */ uint32_t channels; /*< channels */ uint32_t position[SPA_AUDIO_MAX_CHANNELS]; /*< channel position from enum spa_audio_channel */ }; diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index 9d47204ba..4f487a980 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -374,7 +374,7 @@ static void sanitize_map(snd_pcm_chmap_t* map) } } -static int add_rate(struct state *state, uint32_t index, uint32_t *next, +static int add_rate(struct state *state, uint32_t scale, uint32_t index, uint32_t *next, snd_pcm_hw_params_t *params, struct spa_pod_builder *b) { struct spa_pod_frame f[1]; @@ -400,10 +400,10 @@ static int add_rate(struct state *state, uint32_t index, uint32_t *next, rate = state->position ? state->position->clock.rate.denom : DEFAULT_RATE; - spa_pod_builder_int(b, SPA_CLAMP(rate, min, max)); + spa_pod_builder_int(b, SPA_CLAMP(rate, min, max) * scale); if (min != max) { - spa_pod_builder_int(b, min); - spa_pod_builder_int(b, max); + spa_pod_builder_int(b, min * scale); + spa_pod_builder_int(b, max * scale); choice->body.type = SPA_CHOICE_Range; } spa_pod_builder_pop(b, &f[0]); @@ -611,7 +611,7 @@ static int enum_pcm_formats(struct state *state, uint32_t index, uint32_t *next, choice->body.type = SPA_CHOICE_Enum; spa_pod_builder_pop(b, &f[1]); - if ((res = add_rate(state, index & 0xffff, next, params, b)) != 1) + if ((res = add_rate(state, 1, index & 0xffff, next, params, b)) != 1) return res; if ((res = add_channels(state, index & 0xffff, next, params, b)) != 1) @@ -704,7 +704,7 @@ static int enum_iec958_formats(struct state *state, uint32_t index, uint32_t *ne } spa_pod_builder_pop(b, &f[1]); - if ((res = add_rate(state, index & 0xffff, next, params, b)) != 1) + if ((res = add_rate(state, 1, index & 0xffff, next, params, b)) != 1) return res; (*next)++; @@ -759,7 +759,7 @@ static int enum_dsd_formats(struct state *state, uint32_t index, uint32_t *next, spa_pod_builder_prop(b, SPA_FORMAT_AUDIO_interleave, 0); spa_pod_builder_int(b, interleave); - if ((res = add_rate(state, index & 0xffff, next, params, b)) != 1) + if ((res = add_rate(state, SPA_ABS(interleave), index & 0xffff, next, params, b)) != 1) return res; if ((res = add_channels(state, index & 0xffff, next, params, b)) != 1) diff --git a/src/tools/pw-dsdplay.c b/src/tools/pw-dsdplay.c index 6e5d2a58e..c2d9be070 100644 --- a/src/tools/pw-dsdplay.c +++ b/src/tools/pw-dsdplay.c @@ -69,7 +69,7 @@ static void on_process(void *userdata) if ((d = buf->datas[0].data) == NULL) return; - stride = data->info.channels * data->layout.interleave; + stride = data->info.channels * SPA_ABS(data->layout.interleave); samples = dsf_file_read(data->f, d, buf->datas[0].maxsize / stride, &data->layout); @@ -127,7 +127,6 @@ struct layout_info { uint32_t type; struct spa_audio_layout_info info; }; - static const struct layout_info layouts[] = { { 1, { SPA_AUDIO_LAYOUT_Mono, }, }, { 2, { SPA_AUDIO_LAYOUT_Stereo, }, },