aboutsummaryrefslogtreecommitdiff
path: root/lib/ffmpeg/patches/0004-asf-hacks.patch
blob: 70c2d28f3abf7f667c5a62bb69a8fe61677c7035 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From 16ed0150800958b4ca544fd380bda92f21393555 Mon Sep 17 00:00:00 2001
From: Joakim Plate <elupus@ecce.se>
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