]> git.sesse.net Git - vlc/commitdiff
* avi: clean up. Some standard file (ie with 1 RIFF chunk ) has OpenDML
authorLaurent Aimar <fenrir@videolan.org>
Sun, 27 Apr 2003 13:55:51 +0000 (13:55 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 27 Apr 2003 13:55:51 +0000 (13:55 +0000)
index, so use it when normal index (idx1 chunk) isn't found.

modules/demux/avi/avi.c
modules/demux/avi/libavi.c
modules/demux/avi/libavi.h

index 99ce734ae7f457a767893b7d76e1aa968d9b13e6..d303545082fd64500a3d91c39c8f773dc0bc2fd4 100644 (file)
@@ -2,7 +2,7 @@
  * avi.c : AVI file Stream input module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: avi.c,v 1.43 2003/04/27 11:55:03 fenrir Exp $
+ * $Id: avi.c,v 1.44 2003/04/27 13:55:51 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -478,7 +478,7 @@ static void AVI_IndexAddEntry( demux_sys_t *p_avi,
     }
 }
 
-static void AVI_IndexLoad_idx1( input_thread_t *p_input )
+static int AVI_IndexLoad_idx1( input_thread_t *p_input )
 {
     demux_sys_t *p_avi = p_input->p_demux_data;
 
@@ -499,7 +499,7 @@ static void AVI_IndexLoad_idx1( input_thread_t *p_input )
     if( !p_idx1 )
     {
         msg_Warn( p_input, "cannot find idx1 chunk, no index defined" );
-        return;
+        return VLC_EGENERIC;
     }
 
     /* *** calculate offset *** */
@@ -532,6 +532,7 @@ static void AVI_IndexLoad_idx1( input_thread_t *p_input )
             AVI_IndexAddEntry( p_avi, i_stream, &index );
         }
     }
+    return VLC_SUCCESS;
 }
 
 static void __Parse_indx( input_thread_t    *p_input,
@@ -610,11 +611,14 @@ static void AVI_IndexLoad_indx( input_thread_t *p_input )
             avi_chunk_indx_t    ck_sub;
             for( i = 0; i < p_indx->i_entriesinuse; i++ )
             {
-                AVI_SeekAbsolute( p_input, p_indx->idx.super[i].i_offset );
+                if( AVI_SeekAbsolute( p_input, p_indx->idx.super[i].i_offset ) )
+                {
+                    break;
+                }
 
-                if( !AVI_ChunkRead( p_input, &ck_sub, NULL, p_avi->b_seekable ) )
+                if( AVI_ChunkRead( p_input, &ck_sub, NULL, p_avi->b_seekable ) )
                 {
-                    __Parse_indx( p_input, i_stream, &ck_sub );
+                    break;
                 }
             }
         }
@@ -643,7 +647,11 @@ static void AVI_IndexLoad( input_thread_t *p_input )
     }
     else
     {
-        AVI_IndexLoad_idx1( p_input );
+        if( AVI_IndexLoad_idx1( p_input ) )
+        {
+            /* try indx if idx1 failed as some "normal" file have indx too */
+            AVI_IndexLoad_indx( p_input );
+        }
     }
 
 
@@ -2161,19 +2169,11 @@ static int AVIDemux_Seekable( input_thread_t *p_input )
                 if( avi_pk.i_stream >= p_avi->i_streams ||
                     ( avi_pk.i_cat != AUDIO_ES && avi_pk.i_cat != VIDEO_ES ) )
                 {
-                    switch( avi_pk.i_fourcc )
+                    if( AVI_PacketNext( p_input ) )
                     {
-                        case AVIFOURCC_LIST:
-                            AVI_SkipBytes( p_input, 12 );
-                            break;
-                        default:
-                            if( AVI_PacketNext( p_input ) )
-                            {
-                                msg_Warn( p_input,
-                                          "cannot skip packet, track disabled" );
-                                return( AVI_StreamStopFinishedStreams( p_input, p_avi ) ? 0 : 1 );
-                            }
-                            break;
+                        msg_Warn( p_input,
+                                  "cannot skip packet, track disabled" );
+                        return( AVI_StreamStopFinishedStreams( p_input, p_avi ) ? 0 : 1 );
                     }
                     continue;
                 }
index c1a8541f3596a657b03b5e19e2e01211fe535885..b822f069bf93e598a0718111214cafee9c54ea67 100644 (file)
@@ -2,7 +2,7 @@
  * libavi.c :
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: libavi.c,v 1.18 2003/04/27 11:55:03 fenrir Exp $
+ * $Id: libavi.c,v 1.19 2003/04/27 13:55:51 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -182,7 +182,7 @@ int AVI_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size )
     return i_read;
 }
 
-int  AVI_SkipBytes( input_thread_t *p_input, int i_count )
+int  AVI_SkipBytes( input_thread_t *p_input, int64_t i_count )
 {
     /* broken with new use of i_tell */
 #if 0
@@ -804,6 +804,7 @@ static struct
     { AVIFOURCC_ITCH, "technician" },
     { AVIFOURCC_ISMP, "time code" },
     { AVIFOURCC_IDIT, "digitalization time" },
+    { AVIFOURCC_strn, "stream name" },
     { 0,              "???" }
 };
 static int AVI_ChunkRead_strz( input_thread_t *p_input,
@@ -903,6 +904,7 @@ static struct
     { AVIFOURCC_ITCH, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
     { AVIFOURCC_ISMP, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
     { AVIFOURCC_IDIT, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
+    { AVIFOURCC_strn, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
     { 0,           NULL,               NULL }
 };
 
index e77819bdab1835778f6e02bb17e9a476ca5238dd..f6d3f60bc286f5032ec3fe97fd2678a1a0747936 100644 (file)
@@ -2,7 +2,7 @@
  * libavi.h : LibAVI library 
  ******************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: libavi.h,v 1.9 2003/04/27 11:55:03 fenrir Exp $
+ * $Id: libavi.h,v 1.10 2003/04/27 13:55:51 fenrir Exp $
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  * 
  * This program is free software; you can redistribute it and/or modify
@@ -59,6 +59,7 @@
 #define AVIFOURCC_strh         VLC_FOURCC('s','t','r','h')
 #define AVIFOURCC_strf         VLC_FOURCC('s','t','r','f')
 #define AVIFOURCC_strd         VLC_FOURCC('s','t','r','d')
+#define AVIFOURCC_strn         VLC_FOURCC('s','t','r','n')
 #define AVIFOURCC_indx         VLC_FOURCC('i','n','d','x')
 
 #define AVIFOURCC_rec          VLC_FOURCC('r','e','c',' ')
@@ -351,7 +352,7 @@ int     AVI_TestFile( input_thread_t *p_input );
 off_t   AVI_TellAbsolute( input_thread_t *p_input );
 int     AVI_SeekAbsolute( input_thread_t *p_input, off_t i_pos);
 int     AVI_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size );
-int     AVI_SkipBytes( input_thread_t *p_input, int i_count );
+int     AVI_SkipBytes( input_thread_t *p_input, int64_t i_count );
 
 int     _AVI_ChunkRead( input_thread_t *p_input,
                         avi_chunk_t *p_chk,