pw-cat: improve DSD file reading

Support reading non-multiples of the blocksize.
Stop reading at the end of the file.
This commit is contained in:
Wim Taymans 2022-03-03 16:05:03 +01:00
parent ce2f1b3737
commit a6304b47f6
2 changed files with 29 additions and 21 deletions

View file

@ -915,7 +915,7 @@ on_param_changed(void *userdata, uint32_t id, const struct spa_pod *param)
data->dsf.layout.channels = info.info.dsd.channels;
data->dsf.layout.lsb = info.info.dsd.bitorder == SPA_PARAM_BITORDER_lsb;
data->stride = data->dsf.info.channels * SPA_ABS(data->dsf.layout.interleave);
data->stride = data->dsf.layout.channels * SPA_ABS(data->dsf.layout.interleave);
if (data->verbose) {
printf("DSD out: channels:%d bitorder:%s interleave:%d\n",
@ -1268,9 +1268,10 @@ static int setup_dsffile(struct data *data)
}
if (data->verbose)
printf("opened file \"%s\" channels:%d rate:%d bitorder:%s\n",
printf("opened file \"%s\" channels:%d rate:%d samples:%"PRIu64" bitorder:%s\n",
data->filename,
data->dsf.info.channels, data->dsf.info.rate,
data->dsf.info.samples,
data->dsf.info.lsb ? "lsb" : "msb");
data->fill = dsf_play;