changeset 1266:5b9729f5145c libavformat

fix fallback if theres no index fix index less seeking
author michael
date Wed, 23 Aug 2006 20:24:58 +0000
parents 613fdf995af0
children 47ade5d414f9
files asf.c asf.h
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/asf.c	Wed Aug 23 17:07:01 2006 +0000
+++ b/asf.c	Wed Aug 23 20:24:58 2006 +0000
@@ -823,7 +823,7 @@
             assert((asf_st->packet_pos - s->data_offset) % asf->packet_size == 0);
             pos= asf_st->packet_pos;
 
-            av_add_index_entry(s->streams[i], pos, pkt->size, pts, pos - start_pos[i] + 1, AVINDEX_KEYFRAME);
+            av_add_index_entry(s->streams[i], pos, pts, pkt->size, pos - start_pos[i] + 1, AVINDEX_KEYFRAME);
             start_pos[i]= asf_st->packet_pos + 1;
 
             if(pkt->stream_index == stream_index)
@@ -868,6 +868,7 @@
 
             av_add_index_entry(s->streams[stream_index], pos, index_pts, asf->packet_size, 0, AVINDEX_KEYFRAME);
         }
+        asf->index_read= 1;
     }
     url_fseek(&s->pb, current_pos, SEEK_SET);
 }
@@ -882,10 +883,10 @@
     if (asf->packet_size <= 0)
         return -1;
 
-    if (!st->index_entries)
+    if (!asf->index_read)
         asf_build_simple_index(s, stream_index);
 
-    if(!st->index_entries){
+    if(!(asf->index_read && st->index_entries)){
         if(av_seek_frame_binary(s, stream_index, pts, flags)<0)
             return -1;
     }else{
--- a/asf.h	Wed Aug 23 17:07:01 2006 +0000
+++ b/asf.h	Wed Aug 23 20:24:58 2006 +0000
@@ -100,6 +100,7 @@
     uint64_t data_offset; /* begining of the first data packet */
     uint64_t data_object_offset; /* data object offset (excl. GUID & size)*/
     uint64_t data_object_size;   /* size of the data object */
+    int index_read;
 
     ASFMainHeader hdr;