[FFmpeg-devel] [PATCH 1/3] mp3enc: fix Xing sample rate selection.
Clément Bœsch
ubitux at gmail.com
Mon Mar 26 22:49:33 CEST 2012
On Tue, Mar 20, 2012 at 07:22:58PM +0100, Michael Niedermayer wrote:
> 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 ?
>
Mmh indeed I might need to update the rest of the header as well. I'll fix
that.
--
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120326/fe375605/attachment.asc>
More information about the ffmpeg-devel
mailing list