mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
dsdfile: support DSD128/256/512 as well
We need to scale the number of samples to read from the file depending on the bitrate. Fixes #2508
This commit is contained in:
parent
76350cebef
commit
a4f6598f47
1 changed files with 3 additions and 1 deletions
|
|
@ -216,13 +216,15 @@ dsf_file_read(struct dsf_file *f, void *data, size_t samples, const struct dsf_l
|
|||
uint8_t *d = data;
|
||||
int step = SPA_ABS(layout->interleave);
|
||||
bool rev = layout->lsb != f->info.lsb;
|
||||
size_t total, block, offset, pos;
|
||||
size_t total, block, offset, pos, scale;
|
||||
|
||||
block = f->offset / f->info.blocksize;
|
||||
offset = block * f->info.blocksize * f->info.channels;
|
||||
pos = f->offset % f->info.blocksize;
|
||||
scale = SPA_CLAMP(f->info.rate / (44100u * 64u), 1u, 4u);
|
||||
|
||||
samples *= step;
|
||||
samples *= scale;
|
||||
|
||||
for (total = 0; total < samples && offset + pos < f->info.length; total++) {
|
||||
const uint8_t *s = f->p + offset + pos;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue