Mercurial > libavformat.hg
diff raw.c @ 558:89bd76208427 libavformat
100l (forgoten seeking functions)
author | michael |
---|---|
date | Mon, 11 Oct 2004 23:53:53 +0000 |
parents | 558a093b04db |
children | 23b915bb10f5 |
line wrap: on
line diff
--- a/raw.c Mon Oct 11 19:42:18 2004 +0000 +++ b/raw.c Mon Oct 11 23:53:53 2004 +0000 @@ -126,7 +126,7 @@ } int pcm_read_seek(AVFormatContext *s, - int stream_index, int64_t timestamp) + int stream_index, int64_t timestamp, int flags) { AVStream *st; int block_align, byte_rate; @@ -158,8 +158,11 @@ return -1; /* compute the position by aligning it to block_align */ - pos = av_rescale(timestamp * byte_rate, st->time_base.num, st->time_base.den); - pos = (pos / block_align) * block_align; + pos = av_rescale_rnd(timestamp * byte_rate, + st->time_base.num, + st->time_base.den * (int64_t)block_align, + (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP); + pos *= block_align; /* recompute exact position */ st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num);