[FFmpeg-devel] [PATCH 2/3] Round the duration calculation in the aiff demuxer
Ronald S. Bultje
rsbultje
Mon Mar 7 17:27:26 CET 2011
Hi,
On Wed, Mar 2, 2011 at 12:28 PM, Benjamin Larsson <benjamin at southpole.se> wrote:
> ---
> ?libavformat/aiffdec.c | ? ?6 ++++--
> ?1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
> index 7b3d1e7..942fb08 100644
> --- a/libavformat/aiffdec.c
> +++ b/libavformat/aiffdec.c
> @@ -174,7 +174,7 @@ static int aiff_read_header(AVFormatContext *s,
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? AVFormatParameters *ap)
> ?{
> ? ? int size, filesize;
> - ? ?int64_t offset = 0;
> + ? ?int64_t offset = 0, rduration;
> ? ? uint32_t tag;
> ? ? unsigned version = AIFF_C_VERSION1;
> ? ? AVIOContext *pb = s->pb;
> @@ -272,8 +272,10 @@ got_sound:
>
> ? ? av_set_pts_info(st, 64, 1, st->codec->sample_rate);
> ? ? st->start_time = 0;
> - ? ?st->duration = st->codec->frame_size ?
> + ? ?rduration = st->codec->frame_size ?
> ? ? ? ? st->nb_frames * st->codec->frame_size : st->nb_frames;
> + ? ?st->duration = av_rescale_rnd(rduration, 1000, st->codec->sample_rate,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?AV_ROUND_UP) * st->codec->sample_rate/1000;
>
> ? ? /* Position the stream at the first block */
> ? ? url_fseek(pb, offset, SEEK_SET);
> --
> 1.7.1
What bug does this fix?
Ronald
More information about the ffmpeg-devel
mailing list