mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2026-04-26 01:04:45 +08:00
avformat/yuv4mpegdec: fix seeking backwards
Signed-off-by: Paul B Mahol <onemda@gmail.com>
This commit is contained in:
@@ -314,7 +314,16 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
static int yuv4_read_seek(AVFormatContext *s, int stream_index,
|
||||
int64_t pts, int flags)
|
||||
{
|
||||
if (avio_seek(s->pb, pts * s->packet_size + s->internal->data_offset, SEEK_SET) < 0)
|
||||
AVStream *st = s->streams[0];
|
||||
int64_t pos;
|
||||
|
||||
pos = av_rescale_rnd(pts * s->packet_size,
|
||||
st->time_base.num,
|
||||
st->time_base.den * s->packet_size,
|
||||
(flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP);
|
||||
pos *= s->packet_size;
|
||||
|
||||
if (avio_seek(s->pb, pos + s->internal->data_offset, SEEK_SET) < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user