]> git.sesse.net Git - vlc/blobdiff - modules/demux/avi/libavi.c
MKV: Fix seek to 0 with a non null time offset
[vlc] / modules / demux / avi / libavi.c
index 016ec716133d5de8b0c71a5dfcebfde06c779cdd..06a36618892dff81390401f575d95cf11ddca060 100644 (file)
 #endif
 
 #include <vlc_common.h>
-#include <vlc_demux.h>
+#include <vlc_demux.h>                                   /* stream_*, *_ES */
 #include <vlc_codecs.h>                            /* VLC_BITMAPINFOHEADER */
 
 #include "libavi.h"
 
 #ifndef NDEBUG
-#define AVI_DEBUG 1
+# define AVI_DEBUG 1
 #endif
 
 #define __EVEN( x ) (((x) + 1) & ~1)
@@ -113,7 +113,7 @@ static int AVI_ChunkRead_list( stream_t *s, avi_chunk_t *p_container )
     const uint8_t *p_peek;
     bool b_seekable;
 
-    if( p_container->common.i_chunk_size > 0 && p_container->common.i_chunk_size < 8 )
+    if( p_container->common.i_chunk_size > 0 && p_container->common.i_chunk_size < 4 )
     {
         /* empty box */
         msg_Warn( (vlc_object_t*)s, "empty list chunk" );
@@ -416,6 +416,13 @@ static int AVI_ChunkRead_strf( stream_t *s, avi_chunk_t *p_chk )
                      p_chk->strf.vids.p_bih->biBitCount );
 #endif
             break;
+        case AVIFOURCC_iavs:
+        case AVIFOURCC_ivas:
+            p_chk->strf.common.i_cat = UNKNOWN_ES;
+            break;
+        case( AVIFOURCC_txts ):
+            p_chk->strf.common.i_cat = SPU_ES;
+            break;
         default:
             msg_Warn( (vlc_object_t*)s, "unknown stream type: %4.4s",
                     (char*)&p_strh->strh.i_type );
@@ -610,6 +617,21 @@ static int AVI_ChunkRead_vprp( stream_t *s, avi_chunk_t *p_chk )
     AVI_READCHUNK_EXIT( VLC_SUCCESS );
 }
 
+static int AVI_ChunkRead_dmlh( stream_t *s, avi_chunk_t *p_chk )
+{
+    avi_chunk_dmlh_t *p_dmlh = (avi_chunk_dmlh_t*)p_chk;
+
+    AVI_READCHUNK_ENTER;
+
+    AVI_READ4BYTES( p_dmlh->dwTotalFrames );
+
+#ifdef AVI_DEBUG
+    msg_Dbg( (vlc_object_t*)s, "dmlh: dwTotalFrames %d",
+             p_dmlh->dwTotalFrames );
+#endif
+    AVI_READCHUNK_EXIT( VLC_SUCCESS );
+}
+
 static const struct
 {
     vlc_fourcc_t i_fourcc;
@@ -721,6 +743,7 @@ static const struct
     { AVIFOURCC_indx, AVI_ChunkRead_indx, AVI_ChunkFree_indx },
     { AVIFOURCC_vprp, AVI_ChunkRead_vprp, AVI_ChunkFree_nothing },
     { AVIFOURCC_JUNK, AVI_ChunkRead_nothing, AVI_ChunkFree_nothing },
+    { AVIFOURCC_dmlh, AVI_ChunkRead_dmlh, AVI_ChunkFree_nothing },
 
     { AVIFOURCC_IARL, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
     { AVIFOURCC_IART, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
@@ -1022,4 +1045,3 @@ void *_AVI_ChunkFind( avi_chunk_t *p_chk,
     return NULL;
 }
 
-