changeset 1517:51b29c17bd1f libavformat

skip non keyframes after seeking between syncpoint and the first keyframe
author michael
date Thu, 16 Nov 2006 10:20:29 +0000
parents 21dcee17917a
children 10be48ec6b57
files nutdec.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/nutdec.c	Thu Nov 16 09:59:46 2006 +0000
+++ b/nutdec.c	Thu Nov 16 10:20:29 2006 +0000
@@ -704,11 +704,15 @@
     if(size < 0)
         return -1;
 
+    if (flags & FLAG_KEY)
+        nut->stream[stream_id].skip_until_key_frame=0;
+
     discard= s->streams[ stream_id ]->discard;
     last_IP_pts= s->streams[ stream_id ]->last_IP_pts;
     if(  (discard >= AVDISCARD_NONKEY && !(flags & FLAG_KEY))
        ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)
-       || discard >= AVDISCARD_ALL){
+       || discard >= AVDISCARD_ALL
+       || nut->stream[stream_id].skip_until_key_frame){
         url_fskip(bc, size);
         return 1;
     }
@@ -813,6 +817,7 @@
     syncpoint_t nopts_sp= {.ts= AV_NOPTS_VALUE, .back_ptr= AV_NOPTS_VALUE};
     syncpoint_t *sp, *next_node[2]= {&nopts_sp, &nopts_sp};
     int64_t pos, pos2, ts;
+    int i;
 
     if(st->index_entries){
         int index= av_index_search_timestamp(st, pts, flags);
@@ -851,6 +856,9 @@
     if(pos2 > pos || pos2 + 15 < pos){
         av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n");
     }
+    for(i=0; i<s->nb_streams; i++)
+        nut->stream[i].skip_until_key_frame=1;
+
     return 0;
 }