* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: avi.c,v 1.17 2002/05/13 21:55:30 fenrir Exp $
+ * $Id: avi.c,v 1.18 2002/05/17 15:47:01 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
demux_data_avi_file_t *p_avi_demux =
(demux_data_avi_file_t*)p_input->p_demux_data;
+/* FIXME some work to do :
+ * test in the ile if it's true, if not do a RIFF_Find...
+*/
#define p_info p_avi_demux->pp_info[i_stream]
for( i_stream = 0; i_stream < p_avi_demux->i_streams; i_stream++ )
{
/* create entry on the fly */
/* search for the more advance stream and parse from it for all streams*/
p_info_tmp = p_info;
-
for( i = 0; i < p_avi_demux->i_streams; i++ )
{
#define p_info_i p_avi_demux->pp_info[i]
- if( p_info_i->p_index[p_info_i->i_idxnb - 1].i_pos >
- p_info_tmp->p_index[p_info_tmp->i_idxnb - 1].i_pos )
+ if( ( p_info_i->p_index )
+ && ( p_info_i->p_index[p_info_i->i_idxnb - 1].i_pos >
+ p_info_tmp->p_index[p_info_tmp->i_idxnb - 1].i_pos ) )
{
p_info_tmp = p_info_i;
}
#undef p_info_i
}
+
/* go to last defined entry */
i_idxposc = p_info_tmp->i_idxposc; /* save p_info_tmp->i_idxposc */
p_info_tmp->i_idxposc = p_info_tmp->i_idxnb - 1;
#define p_info_i p_avi_demux->pp_info[i_number]
if( (__AVI_ParseStreamHeader( index.i_id, &i_number, &i_type ) == 0)
&&( i_number < p_avi_demux->i_streams )
+ &&( p_info_i->p_index )
&&( p_info_i->p_index[p_info_i->i_idxnb - 1].i_pos +
p_info_i->p_index[p_info_i->i_idxnb - 1].i_length + 8<=
index.i_pos )
/* get pts while is valid */
i_pts = AVI_GetPTS( p_info );
p_pes_tmp = __AVI_ReadStreamChunkInPES( p_input, p_info );
+
if( !p_pes_tmp )
{
return( p_pes_first );
p_pes = AVI_GetFrameInPES( p_input,
p_info_master,
100000 ); /* 100 ms */
+
AVI_DecodePES( p_input,
p_info_master,
p_pes);