changeset 4665:80256840ff29

ehh. forgot to commit this one... - workaround for files with bad index (first chunk absolute, other relative offsets) -> fixes many 'no video stream found' bugreports
author arpi
date Tue, 12 Feb 2002 08:27:49 +0000
parents 40e8b4b8b250
children a093bb34b723
files libmpdemux/demux_avi.c
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_avi.c	Tue Feb 12 01:20:59 2002 +0000
+++ b/libmpdemux/demux_avi.c	Tue Feb 12 08:27:49 2002 +0000
@@ -417,13 +417,24 @@
   priv->idx_pos=0;
   priv->idx_pos_a=0;
   priv->idx_pos_v=0;
-  if(priv->idx_size>0){
+  if(priv->idx_size>1){
     // decide index format:
+#if 1
+    if(((AVIINDEXENTRY *)priv->idx)[0].dwChunkOffset<demuxer->movi_start ||
+       ((AVIINDEXENTRY *)priv->idx)[1].dwChunkOffset<demuxer->movi_start)
+      priv->idx_offset=demuxer->movi_start-4;
+    else
+      priv->idx_offset=0;
+#else
     if(((AVIINDEXENTRY *)priv->idx)[0].dwChunkOffset<demuxer->movi_start)
       priv->idx_offset=demuxer->movi_start-4;
     else
       priv->idx_offset=0;
-    mp_msg(MSGT_DEMUX,MSGL_V,"AVI index offset: %d\n",priv->idx_offset);
+#endif
+    mp_msg(MSGT_DEMUX,MSGL_V,"AVI index offset: 0x%X (movi=0x%X idx0=0x%X idx1=0x%X)\n",
+	    (int)priv->idx_offset,(int)demuxer->movi_start,
+	    (int)((AVIINDEXENTRY *)priv->idx)[0].dwChunkOffset,
+	    (int)((AVIINDEXENTRY *)priv->idx)[1].dwChunkOffset);
   }
 //  demuxer->endpos=avi_header.movi_end;