[FFmpeg-devel] [PATCH 1/3] mp3enc: fix Xing sample rate selection.
Michael Niedermayer
michaelni at gmx.at
Tue Mar 20 19:22:58 CET 2012
On Tue, Mar 20, 2012 at 04:38:12PM +0100, Clément Bœsch wrote:
> 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;
is the srate_idx correct for all cases ?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120320/1aa8725c/attachment.asc>
More information about the ffmpeg-devel
mailing list