From 16ed0150800958b4ca544fd380bda92f21393555 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Mon, 12 Sep 2011 21:37:17 +0200 Subject: [PATCH 04/24] asf hacks --- libavformat/asfdec.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index a62bab3..7db3bd8 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -1277,9 +1277,20 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int ASFContext *asf = s->priv_data; AVStream *st = s->streams[stream_index]; + if (pts == 0) { + // this is a hack since av_gen_search searches the entire file in this case + av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", s->data_offset); + if (avio_seek(s->pb, s->data_offset, SEEK_SET) < 0) + return -1; + return 0; + } + if (s->packet_size <= 0) return AVERROR(ENOSYS); + if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO) + return -1; + /* Try using the protocol's read_seek if available */ if(s->pb) { int ret = avio_seek_time(s->pb, stream_index, pts, flags); -- 1.7.9.4