Hacks for On2 AVI files (close #1318)
authorLaurent Aimar <fenrir@videolan.org>
Sun, 30 Sep 2007 17:25:55 +0000 (17:25 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 30 Sep 2007 17:25:55 +0000 (17:25 +0000)
modules/demux/avi/avi.c
modules/demux/avi/libavi.c
modules/demux/avi/libavi.h

index ff4092b..72b2d79 100644 (file)
@@ -232,8 +232,10 @@ static int Open( vlc_object_t * p_this )
 
     for( i_peeker = 0; i_peeker < 188; i_peeker++ )
     {
-        if( !strncmp( (char *)&p_peek[0], "RIFF", 4 ) &&
-            !strncmp( (char *)&p_peek[8], "AVI ", 4 ) ) break;
+        if( !strncmp( (char *)&p_peek[0], "RIFF", 4 ) && !strncmp( (char *)&p_peek[8], "AVI ", 4 ) )
+            break;
+        if( !strncmp( (char *)&p_peek[0], "ON2 ", 4 ) && !strncmp( (char *)&p_peek[8], "ON2f", 4 ) )
+            break;
         p_peek++;
     }
     if( i_peeker == 188 )
index 8ef4115..19e6eaf 100644 (file)
@@ -130,6 +130,13 @@ static int AVI_ChunkRead_list( stream_t *s, avi_chunk_t *p_container )
 
     p_container->list.i_type = GetFOURCC( p_peek + 8 );
 
+    /* XXX fixed for on2 hack */
+    if( p_container->common.i_chunk_fourcc == AVIFOURCC_ON2 && p_container->list.i_type == AVIFOURCC_ON2f )
+    {
+        p_container->common.i_chunk_fourcc = AVIFOURCC_RIFF;
+        p_container->list.i_type = AVIFOURCC_AVI;
+    }
+
     if( p_container->common.i_chunk_fourcc == AVIFOURCC_LIST &&
         p_container->list.i_type == AVIFOURCC_movi )
     {
@@ -246,6 +253,7 @@ static int AVI_ChunkRead_avih( stream_t *s, avi_chunk_t *p_chk )
 {
     AVI_READCHUNK_ENTER;
 
+    p_chk->common.i_chunk_fourcc = AVIFOURCC_avih;
     AVI_READ4BYTES( p_chk->avih.i_microsecperframe);
     AVI_READ4BYTES( p_chk->avih.i_maxbytespersec );
     AVI_READ4BYTES( p_chk->avih.i_reserved1 );
@@ -650,8 +658,10 @@ static struct
 } AVI_Chunk_Function [] =
 {
     { AVIFOURCC_RIFF, AVI_ChunkRead_list, AVI_ChunkFree_nothing },
+    { AVIFOURCC_ON2,  AVI_ChunkRead_list, AVI_ChunkFree_nothing },
     { AVIFOURCC_LIST, AVI_ChunkRead_list, AVI_ChunkFree_nothing },
     { AVIFOURCC_avih, AVI_ChunkRead_avih, AVI_ChunkFree_nothing },
+    { AVIFOURCC_ON2h, AVI_ChunkRead_avih, AVI_ChunkFree_nothing },
     { AVIFOURCC_strh, AVI_ChunkRead_strh, AVI_ChunkFree_nothing },
     { AVIFOURCC_strf, AVI_ChunkRead_strf, AVI_ChunkFree_strf },
     { AVIFOURCC_strd, AVI_ChunkRead_strd, AVI_ChunkFree_strd },
@@ -792,7 +802,8 @@ static void AVI_ChunkDumpDebug_level( vlc_object_t *p_obj,
     {
         str[i * 5] = '|';
     }
-    if( p_chk->common.i_chunk_fourcc == AVIFOURCC_RIFF||
+    if( p_chk->common.i_chunk_fourcc == AVIFOURCC_RIFF ||
+        p_chk->common.i_chunk_fourcc == AVIFOURCC_ON2  ||
         p_chk->common.i_chunk_fourcc == AVIFOURCC_LIST )
     {
         sprintf( str + i_level * 5,
index 9f01ca6..b23eada 100644 (file)
@@ -234,14 +234,17 @@ void    AVI_ChunkFreeRoot( stream_t *, avi_chunk_t  *p_chk );
     /* *** avi stuff *** */
 
 #define AVIFOURCC_RIFF         VLC_FOURCC('R','I','F','F')
+#define AVIFOURCC_ON2          VLC_FOURCC('O','N','2',' ')
 #define AVIFOURCC_LIST         VLC_FOURCC('L','I','S','T')
 #define AVIFOURCC_JUNK         VLC_FOURCC('J','U','N','K')
 #define AVIFOURCC_AVI          VLC_FOURCC('A','V','I',' ')
 #define AVIFOURCC_AVIX         VLC_FOURCC('A','V','I','X')
+#define AVIFOURCC_ON2f         VLC_FOURCC('O','N','2','f')
 #define AVIFOURCC_WAVE         VLC_FOURCC('W','A','V','E')
 #define AVIFOURCC_INFO         VLC_FOURCC('I','N','F','O')
 
 #define AVIFOURCC_avih         VLC_FOURCC('a','v','i','h')
+#define AVIFOURCC_ON2h         VLC_FOURCC('O','N','2','h')
 #define AVIFOURCC_hdrl         VLC_FOURCC('h','d','r','l')
 #define AVIFOURCC_movi         VLC_FOURCC('m','o','v','i')
 #define AVIFOURCC_idx1         VLC_FOURCC('i','d','x','1')