[FFmpeg-devel] [PATCH 1/2] lavf/mp3dec: pass Xing gapless metadata to AVCodecParameters

Jon Toohill jtoohill at google.com
Thu Jun 2 02:58:35 CEST 2016


Based on my understanding of [1], these values in the Info tag specify only
the encoder delay/padding, which matches the documentation for these
fields. It looks like other formats are using the fields that way as well.

I think the extra 528 + 1 samples are the decoder delay [2]. It looks like
libmp3lame adds the 528 + 1 only to have mp3dec subtract it, so I'm not
sure why that's done. IIUC start_skip_samples is the mechanism that
actually accounts for the extra delay when decoding.

[1]: http://gabriel.mp3-tech.org/mp3infotag.html#delays
[2]: http://lame.sourceforge.net/tech-FAQ.txt



Jon Toohill |  Google Play Music |  jtoohill at google.com |  (650) 215-0770

On Thu, May 26, 2016 at 7:51 PM, Michael Niedermayer <michael at niedermayer.cc
> wrote:

> On Wed, May 25, 2016 at 09:56:59AM -0700, Jon Toohill wrote:
> > ---
> >  libavformat/mp3dec.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
> > index 3725d67..192f5ef 100644
> > --- a/libavformat/mp3dec.c
> > +++ b/libavformat/mp3dec.c
> > @@ -234,6 +234,8 @@ static void mp3_parse_info_tag(AVFormatContext *s,
> AVStream *st,
> >
> >          mp3->start_pad = v>>12;
> >          mp3->  end_pad = v&4095;
> > +        st->codecpar->initial_padding = mp3->start_pad;
> > +        st->codecpar->trailing_padding = mp3->end_pad;
> >          st->start_skip_samples = mp3->start_pad + 528 + 1;
> >          if (mp3->frames) {
> >              st->first_discard_sample = -mp3->end_pad + 528 + 1 +
> mp3->frames * (int64_t)spf;
>
> is the 528 + 1 difference intended to
> start_skip_samples/first_discard_sample
> ?
> mp3enc stores par->initial_padding - 528 - 1
>
> [...]
>
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> If you drop bombs on a foreign country and kill a hundred thousand
> innocent people, expect your government to call the consequence
> "unprovoked inhuman terrorist attacks" and use it to justify dropping
> more bombs and killing more people. The technology changed, the idea is
> old.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>


More information about the ffmpeg-devel mailing list