From e1e93e5a88119f49ac5364d2cc023dbe42c18240 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 27 Jan 2020 15:47:13 +0100 Subject: [PATCH] pw-cat: fix s24 formats Treat s24 format as s32 and let sndfile convert for us. This is needed because using the raw read bypasses decoding in some cases. This makes 24 bits flac work. --- src/tools/pw-cat.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/tools/pw-cat.c b/src/tools/pw-cat.c index 1e90f9e11..8ec8590e5 100644 --- a/src/tools/pw-cat.c +++ b/src/tools/pw-cat.c @@ -223,11 +223,7 @@ sf_format_to_pw(int format) return endianess == 1 ? SPA_AUDIO_FORMAT_S16_LE : endianess == 2 ? SPA_AUDIO_FORMAT_S16_BE : SPA_AUDIO_FORMAT_S16; - case SF_FORMAT_PCM_24: - return endianess == 1 ? SPA_AUDIO_FORMAT_S24_LE : - endianess == 2 ? SPA_AUDIO_FORMAT_S24_BE : - SPA_AUDIO_FORMAT_S24; case SF_FORMAT_PCM_32: return endianess == 1 ? SPA_AUDIO_FORMAT_S32_LE : endianess == 2 ? SPA_AUDIO_FORMAT_S32_BE : @@ -258,7 +254,6 @@ sf_format_samplesize(int format) case SF_FORMAT_PCM_16: return 2; case SF_FORMAT_PCM_24: - return 3; case SF_FORMAT_PCM_32: return 4; case SF_FORMAT_FLOAT: @@ -288,13 +283,6 @@ static int sf_playback_fill_s16(struct data *d, void *dest, unsigned int n_frame return (int)rn; } -static int sf_playback_fill_s24(struct data *d, void *dest, unsigned int n_frames) -{ - sf_count_t rn; - rn = sf_read_raw(d->file, dest, (sf_count_t) n_frames * d->stride); - return (int)rn / d->stride; -} - static int sf_playback_fill_s32(struct data *d, void *dest, unsigned int n_frames) { sf_count_t rn; @@ -336,8 +324,6 @@ sf_fmt_playback_fill_fn(int format) if (sizeof(int16_t) != sizeof(short)) return NULL; return sf_playback_fill_s16; - case SPA_AUDIO_FORMAT_S24: - return sf_playback_fill_s24; case SPA_AUDIO_FORMAT_S32_LE: case SPA_AUDIO_FORMAT_S32_BE: /* sndfile check */