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)
+ int64_t pos;
+
+ if (flags & AVSEEK_FLAG_BACKWARD)
+ pts = FFMAX(0, pts - 1);
+ pos = pts * s->packet_size;
+
+ if (avio_seek(s->pb, pos + s->internal->data_offset, SEEK_SET) < 0)
return -1;
return 0;
}