[FFmpeg-devel] [PATCH] au: add duration info

Stefano Sabatini stefano.sabatini-lala at poste.it
Wed Jul 13 23:39:48 CEST 2011


On date Wednesday 2011-07-13 22:33:21 +0200, Michael Niedermayer encoded:
> On Wed, Jul 13, 2011 at 12:23:35PM +0200, ami_stuff wrote:
> [...]
> > @@ -159,6 +164,10 @@ static int au_read_header(AVFormatContext *s,
> >      st->codec->codec_id = codec;
> >      st->codec->channels = channels;
> >      st->codec->sample_rate = rate;
> > +
> > +    if (data_size)
> > +        st->duration = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));
>                                      ^^^
> can overflow
> otherwise LGTM

Alternatively:
    if (data_size)
        st->duration = data_size / (st->codec->channels * (uint64_t)(av_get_bits_per_sample(st->codec->codec_id)>>3));



More information about the ffmpeg-devel mailing list