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

Michael Niedermayer michael at niedermayer.cc
Fri May 27 04:05:19 CEST 2016


On Wed, May 25, 2016 at 02:18:38PM -0400, Ronald S. Bultje wrote:
> Hi,
> 
> On Wed, May 25, 2016 at 1:24 PM, James Almer <jamrial at gmail.com> wrote:
> 
> > On 5/25/2016 1:56 PM, 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;
> >
> > Every other format so far is using the AV_PKT_DATA_SKIP_SAMPLES side data
> > to
> > discard samples from the last packet/frame. See matroska and ogg demuxers,
> > currently used for Opus only.
> >
> > The trailing_padding AVCodecParameters element was added after the above
> > was
> > designed. To be honest i can't say if we should replace one with the other
> > or find a way to keep both, and seeing how AVCodecParameters hasn't made it
> > to a release yet, we're still on time to choose.
> 
> 
> I agree having 1 is better than having 2. I can't technically comment on
> which one is better/easier/*.

mp3 supports AV_PKT_DATA_SKIP_SAMPLES since FFmpeg 2.5
ogg opus sets codecpar->initial_padding like this patch would
so does dtshddec and matroskadec

AV_PKT_DATA_SKIP_SAMPLES is not a substitute for setting
trailing_padding because with AV_PKT_DATA_SKIP_SAMPLES the
trailing_padding only becomes available at the end of the stream

also theres nothing wrong with AV_PKT_DATA_SKIP_SAMPLES, its local
information for the current packet and there may indeed be cases
like with concatenated streams where there are packets in the middle
with discarding. So the 2 AVCodecParameters fields are not a substitute
for AV_PKT_DATA_SKIP_SAMPLES

also for encoding AV_PKT_DATA_SKIP_SAMPLES does not work with some
formats the trailing_padding is needed to be known when writing the
header

the patch does look like a reasonable step to me but i might be
missing something

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160527/ccc242e6/attachment.sig>


More information about the ffmpeg-devel mailing list