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

James Almer jamrial at gmail.com
Wed May 25 19:24:57 CEST 2016


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.

>          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;
> 



More information about the ffmpeg-devel mailing list