diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-10-11 23:53:53 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-10-11 23:53:53 +0000 |
commit | 7b3c1382bf46615e3faea72b62b6dab83e4142a7 (patch) | |
tree | 0a31847fbc7101c59d4cf309abed68b3fda59d2b /libavformat/raw.c | |
parent | b1d041c15c6b45cde682f4dfd12d15a0709da399 (diff) | |
download | ffmpeg-7b3c1382bf46615e3faea72b62b6dab83e4142a7.tar.gz |
100l (forgoten seeking functions)
Originally committed as revision 3585 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/raw.c')
-rw-r--r-- | libavformat/raw.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/raw.c b/libavformat/raw.c index dadc495766..23ba5006be 100644 --- a/libavformat/raw.c +++ b/libavformat/raw.c @@ -126,7 +126,7 @@ static int raw_read_close(AVFormatContext *s) } 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 @@ int pcm_read_seek(AVFormatContext *s, 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); |