[FFmpeg-soc] [soc]: r4569 - seek_api/mpeg.c

spyfeng subversion at mplayerhq.hu
Thu Jul 2 19:00:34 CEST 2009


Author: spyfeng
Date: Thu Jul  2 19:00:34 2009
New Revision: 4569

Log:
because we have already built the index entries,
so when index is not -1, we just seek there.

Modified:
   seek_api/mpeg.c

Modified: seek_api/mpeg.c
==============================================================================
--- seek_api/mpeg.c	Thu Jul  2 18:56:27 2009	(r4568)
+++ seek_api/mpeg.c	Thu Jul  2 19:00:34 2009	(r4569)
@@ -669,10 +669,6 @@ static int mpegps_read_seek(struct AVFor
         pos = e->pos;
         pts = e->timestamp;
         av_log(s, AV_LOG_DEBUG, "the seek pos = %"PRId64", pts  = %"PRId64", targe timestamp = %"PRId64"\n", pos, pts, ts);
-        if (ts == pts) {
-            url_fseek(s->pb, pos, SEEK_SET);
-            goto success;
-        }
 
         if (flags & AVSEEK_FLAG_ANY) {
             while(pts > ts) { // find the index timestamp smaller than target timestamp
@@ -680,13 +676,16 @@ static int mpegps_read_seek(struct AVFor
                 pts = st->index_entries[index].timestamp;
                 pos = st->index_entries[index].pos;
             }
-        }
 
         if (find_keyframe(s, stream_index, &pos, &pts, ts, flags) == 0) {
             goto success;
         } else {
             return -1;
         }
+        } else {
+            url_fseek(s->pb, pos, SEEK_SET);
+            goto success;
+        }
     }
 
     // search the scr use binary search


More information about the FFmpeg-soc mailing list