pipewire/src/tools/dsffile.h
Wim Taymans 19198d2982 pw-cat: fix DSD file reading
Now that the server asks for the right amount of samples for DSD, just
give it the right amount of samples without doing some weird scaling.

Make a method to calculate the size (stride) of one sample, which
depends on the interleave and channels of the stream.

See !2540
2025-09-25 13:56:51 +02:00

33 lines
719 B
C

/* PipeWire */
/* SPDX-FileCopyrightText: Copyright © 2021 Wim Taymans */
/* SPDX-License-Identifier: MIT */
#include <stdio.h>
#include <spa/utils/defs.h>
struct dsf_file;
struct dsf_file_info {
uint32_t channel_type;
uint32_t channels;
uint32_t rate;
bool lsb;
uint64_t samples;
uint64_t length;
uint32_t blocksize;
};
struct dsf_layout {
int32_t interleave;
uint32_t channels;
bool lsb;
};
uint32_t dsf_layout_stride(const struct dsf_layout *layout);
struct dsf_file * dsf_file_open(const char *filename, const char *mode, struct dsf_file_info *info);
ssize_t dsf_file_read(struct dsf_file *f, void *data, size_t samples, const struct dsf_layout *layout);
int dsf_file_close(struct dsf_file *f);