diff options
author | Wim Taymans <wtaymans@redhat.com> | 2022-10-21 12:30:34 +0200 |
---|---|---|
committer | Wim Taymans <wtaymans@redhat.com> | 2022-11-10 17:13:58 +0100 |
commit | 3349e1c471f16f46251a51acfc1740cdf012a098 (patch) | |
tree | 1212f1756946f90442fc80da0dee55aeca5b1ba2 | |
parent | 3f9455411c90d2b2d1043c47ee24185fabb8e401 (diff) | |
download | pulseaudio-3349e1c471f16f46251a51acfc1740cdf012a098.tar.gz |
sndfile: handle sndfiles with s24 format
Samples with s24 format should be read with the readf_int read
function instead of the raw function.
This fixes playback of flac/wav with s24 sample format.
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/750>
-rw-r--r-- | src/pulsecore/sndfile-util.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pulsecore/sndfile-util.c b/src/pulsecore/sndfile-util.c index b6cc65ecd..e978d622c 100644 --- a/src/pulsecore/sndfile-util.c +++ b/src/pulsecore/sndfile-util.c @@ -51,11 +51,11 @@ int pa_sndfile_read_sample_spec(SNDFILE *sf, pa_sample_spec *ss) { ss->format = PA_SAMPLE_S16NE; break; - case SF_FORMAT_PCM_24: - ss->format = PA_SAMPLE_S24NE; - break; - case SF_FORMAT_PCM_32: + case SF_FORMAT_PCM_24: + /* note that libsndfile will convert 24 bits samples to 32 bits + * when using the sf_readf_int function, which will be selected + * by setting the format to s32. */ ss->format = PA_SAMPLE_S32NE; break; |