[FFmpeg-devel] [PATCH 1/3] mp3enc: fix Xing sample rate selection.
Clément Bœsch
ubitux at gmail.com
Tue Mar 20 16:38:12 CET 2012
From: Clément Bœsch <clement.boesch at smartjog.com>
This at least avoid raising an unsupported sample rate warning when
sample rate is different than the sampling rate allowed in MPEG-1.
ex: ffmpeg -f lavfi -i aevalsrc=0 -ar 22050 -y /tmp/out.mp3
---
libavformat/mp3enc.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index b2c1b42..d28e95c 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -126,7 +126,9 @@ static int mp3_write_xing(AVFormatContext *s)
return 0;
for (i = 0; i < FF_ARRAY_ELEMS(avpriv_mpa_freq_tab); i++)
- if (avpriv_mpa_freq_tab[i] == codec->sample_rate) {
+ if (codec->sample_rate == avpriv_mpa_freq_tab[i] || // MPEG 1
+ codec->sample_rate == avpriv_mpa_freq_tab[i] >> 1 || // MPEG 2 (LSF)
+ codec->sample_rate == avpriv_mpa_freq_tab[i] >> 2) { // MPEG 2.5 (LSF)
srate_idx = i;
break;
}
--
1.7.9.1
More information about the ffmpeg-devel
mailing list