1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
From: ihy123 <aladinandreyy@gmail.com>
Date: Mon, 25 Aug 2025 11:17:06 +0300
Subject: ip/ffmpeg: change sample format conversions
---
ip/ffmpeg.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/ip/ffmpeg.c b/ip/ffmpeg.c
index 2cb0767..2d3c610 100644
--- a/ip/ffmpeg.c
+++ b/ip/ffmpeg.c
@@ -157,13 +157,11 @@ static void ffmpeg_set_sf_and_swr_opts(SwrContext *swr, AVCodecContext *cc,
av_opt_set_int(swr, "in_sample_rate", cc->sample_rate, 0);
av_opt_set_int(swr, "out_sample_rate", out_sample_rate, 0);
- *out_sample_fmt = cc->sample_fmt;
- switch (*out_sample_fmt) {
- case AV_SAMPLE_FMT_U8:
- sf |= sf_bits(8) | sf_signed(0);
- break;
- case AV_SAMPLE_FMT_S32:
+ switch (cc->sample_fmt) {
+ case AV_SAMPLE_FMT_FLT: case AV_SAMPLE_FMT_FLTP:
+ case AV_SAMPLE_FMT_S32: case AV_SAMPLE_FMT_S32P:
sf |= sf_bits(32) | sf_signed(1);
+ *out_sample_fmt = AV_SAMPLE_FMT_S32;
break;
default:
sf |= sf_bits(16) | sf_signed(1);
|