From fbd0b8b0239d3786b941adc89322b8e49e4c768e Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Mon, 12 Sep 2011 21:37:17 +0200 Subject: [PATCH 02/13] asf hacks Patch part of the XBMC patch set for ffmpeg, downloaded from https://github.com/xbmc/FFmpeg/. Signed-off-by: Bernd Kuhls Signed-off-by: Thomas Petazzoni --- libavformat/asfdec.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 7f7bb4d..8911987 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -1549,9 +1549,20 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, AVStream *st = s->streams[stream_index]; int ret = 0; + 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 -1; + 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); -- 2.1.0