Commit c3bc32b4 authored by Laurent Aimar's avatar Laurent Aimar

* avi: fixed playback of others brokens stream.

 Remember: each time something could be wrong then, with avi, it will be.
 I hate avi.
parent be6f7650
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc * avi.c : AVI file Stream input module for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.55 2003/08/18 00:17:44 fenrir Exp $ * $Id: avi.c,v 1.56 2003/08/20 01:10:54 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr> * Authors: Laurent Aimar <fenrir@via.ecp.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -459,6 +459,7 @@ static int AVI_IndexLoad_idx1( input_thread_t *p_input ) ...@@ -459,6 +459,7 @@ static int AVI_IndexLoad_idx1( input_thread_t *p_input )
unsigned int i_stream; unsigned int i_stream;
unsigned int i_index; unsigned int i_index;
off_t i_offset; off_t i_offset;
unsigned int i;
p_riff = (avi_chunk_list_t*)AVI_ChunkFind( &p_avi->ck_root, p_riff = (avi_chunk_list_t*)AVI_ChunkFind( &p_avi->ck_root,
AVIFOURCC_RIFF, 0); AVIFOURCC_RIFF, 0);
...@@ -473,14 +474,16 @@ static int AVI_IndexLoad_idx1( input_thread_t *p_input ) ...@@ -473,14 +474,16 @@ static int AVI_IndexLoad_idx1( input_thread_t *p_input )
} }
/* *** calculate offset *** */ /* *** calculate offset *** */
if( p_idx1->i_entry_count > 0 && /* Well, avi is __SHIT__ so test more than one entry
p_idx1->entry[0].i_pos < p_movi->i_chunk_pos ) * (needed for some avi files) */
i_offset = 0;
for( i = 0; i < __MIN( p_idx1->i_entry_count, 10 ); i++ )
{
if( p_idx1->entry[i].i_pos < p_movi->i_chunk_pos )
{ {
i_offset = p_movi->i_chunk_pos + 8; i_offset = p_movi->i_chunk_pos + 8;
break;
} }
else
{
i_offset = 0;
} }
for( i_index = 0; i_index < p_idx1->i_entry_count; i_index++ ) for( i_index = 0; i_index < p_idx1->i_entry_count; i_index++ )
...@@ -590,6 +593,7 @@ static void AVI_IndexLoad_indx( input_thread_t *p_input ) ...@@ -590,6 +593,7 @@ static void AVI_IndexLoad_indx( input_thread_t *p_input )
{ {
break; break;
} }
__Parse_indx( p_input, i_stream, &ck_sub );
} }
} }
else else
...@@ -631,6 +635,16 @@ static void AVI_IndexLoad( input_thread_t *p_input ) ...@@ -631,6 +635,16 @@ static void AVI_IndexLoad( input_thread_t *p_input )
"stream[%d] created %d index entries", "stream[%d] created %d index entries",
i_stream, i_stream,
p_avi->pp_info[i_stream]->i_idxnb ); p_avi->pp_info[i_stream]->i_idxnb );
#if 0
for( i = 0; i < p_avi->pp_info[i_stream]->i_idxnb; i++ )
{
msg_Dbg( p_input, "stream[%d] idx[%d] pos=%lld size=%d",
i_stream,
i,
p_avi->pp_info[i_stream]->p_index[i].i_pos,
p_avi->pp_info[i_stream]->p_index[i].i_length );
}
#endif
} }
} }
...@@ -1228,7 +1242,7 @@ static int AVIInit( vlc_object_t * p_this ) ...@@ -1228,7 +1242,7 @@ static int AVIInit( vlc_object_t * p_this )
p_es->i_fourcc = p_info->i_fourcc; p_es->i_fourcc = p_info->i_fourcc;
if( p_es->i_cat == AUDIO_ES ) if( p_es->i_cat == AUDIO_ES )
{ {
if( i_init_size < sizeof( WAVEFORMATEX ) ) if( i_init_size < (int)sizeof( WAVEFORMATEX ) )
{ {
i_init_size = sizeof( WAVEFORMATEX ); i_init_size = sizeof( WAVEFORMATEX );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment