[FFmpeg-cvslog] avidec: simplify avi_read_idx1()

Michael Niedermayer git at videolan.org
Wed May 23 19:52:43 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed May 23 18:46:01 2012 +0200| [d0f78e77e1cde44532d613525a4f521e8effe3ed] | committer: Michael Niedermayer

avidec: simplify avi_read_idx1()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d0f78e77e1cde44532d613525a4f521e8effe3ed
---

 libavformat/avidec.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 49f8420..7057a91 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1245,7 +1245,7 @@ static int avi_read_idx1(AVFormatContext *s, int size)
     AVIStream *ast;
     unsigned int index, tag, flags, pos, len, first_packet = 1;
     unsigned last_pos= -1;
-    unsigned last_len= 0;
+    unsigned last_idx= -1;
     int64_t idx1_pos, first_packet_pos = 0, data_offset = 0;
 
     nb_index_entries = size / 16;
@@ -1292,12 +1292,12 @@ static int avi_read_idx1(AVFormatContext *s, int size)
         // switch to non-interleaved to get correct timestamps
         if(last_pos == pos)
             avi->non_interleaved= 1;
-        if((last_pos != pos || !last_len) && len) {
+        if(last_idx != pos && len) {
             av_add_index_entry(st, pos, ast->cum_len, len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0);
+            last_idx= pos;
         }
         ast->cum_len += get_duration(ast, len);
         last_pos= pos;
-        last_len= len;
     }
     return 0;
 }



More information about the ffmpeg-cvslog mailing list