fixing some seek failure issues
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 10 Jan 2004 22:36:35 +0000 (22:36 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 10 Jan 2004 22:36:35 +0000 (22:36 +0000)
Originally committed as revision 2688 to svn://svn.ffmpeg.org/ffmpeg/trunk

ffplay.c
libavformat/avidec.c

index c5c2ca1..6fbb91e 100644 (file)
--- a/ffplay.c
+++ b/ffplay.c
@@ -1406,15 +1406,16 @@ static int decode_thread(void *arg)
 #endif
         if (is->seek_req) {
             /* XXX: must lock decoder threads */
-            if (is->audio_stream >= 0) {
-                packet_queue_flush(&is->audioq);
-            }
-            if (is->video_stream >= 0) {
-                packet_queue_flush(&is->videoq);
-            }
             ret = av_seek_frame(is->ic, -1, is->seek_pos);
             if (ret < 0) {
                 fprintf(stderr, "%s: error while seeking\n", is->ic->filename);
+            }else{
+                if (is->audio_stream >= 0) {
+                    packet_queue_flush(&is->audioq);
+                }
+                if (is->video_stream >= 0) {
+                    packet_queue_flush(&is->videoq);
+                }
             }
             is->seek_req = 0;
         }
index 551e906..361a52f 100644 (file)
@@ -496,7 +496,8 @@ static int avi_load_index(AVFormatContext *s)
     AVIContext *avi = s->priv_data;
     ByteIOContext *pb = &s->pb;
     uint32_t tag, size;
-
+    offset_t pos= url_ftell(pb);
+    
     url_fseek(pb, avi->movi_end, SEEK_SET);
 #ifdef DEBUG_SEEK
     printf("movi_end=0x%llx\n", avi->movi_end);
@@ -529,6 +530,7 @@ static int avi_load_index(AVFormatContext *s)
         }
     }
  the_end:
+    url_fseek(pb, pos, SEEK_SET);
     return 0;
 }