Commit dbc3f265 authored by Laurent Aimar's avatar Laurent Aimar

*** empty log message ***

parent 0a65df88
......@@ -2,7 +2,7 @@
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: avi.c,v 1.10 2002/05/02 10:54:34 fenrir Exp $
* $Id: avi.c,v 1.11 2002/05/04 16:51:05 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -112,14 +112,11 @@ static void __AVIFreeDemuxData( input_thread_t *p_input )
{
if( p_avi_demux->pp_info[i] != NULL )
{
#define p_info p_avi_demux->pp_info[i]
if( p_info->p_index != NULL )
if( p_avi_demux->pp_info[i]->p_index != NULL )
{
free( p_info->p_index );
free( p_avi_demux->pp_info[i]->p_index );
}
free( p_info );
#undef p_info
free( p_avi_demux->pp_info[i] );
}
}
free( p_avi_demux->pp_info );
......@@ -306,14 +303,15 @@ static void __AVI_GetIndex( input_thread_t *p_input )
index.i_offset = __GetDoubleWordLittleEndianFromBuff( p_peek+8);
index.i_length = __GetDoubleWordLittleEndianFromBuff(p_peek+12);
if( (__AVI_ParseStreamHeader( index.i_id, &i_number, &i_type ) != 0)
||(i_number > p_avi_demux->i_streams))
if( (__AVI_ParseStreamHeader( index.i_id, &i_number, &i_type ) == 0)
&&(i_number < p_avi_demux->i_streams )
&&(p_avi_demux->pp_info[i_number]->i_cat ==
__AVIGetESTypeFromTwoCC( i_type )))
{
continue;
}
__AVI_AddEntryIndex( p_avi_demux->pp_info[i_number],
&index );
}
}
__RIFF_SkipBytes( p_input, 16 * i_read );
}
......@@ -684,14 +682,13 @@ static int AVIInit( input_thread_t *p_input )
#define p_info p_avi_demux->pp_info[i]
if( p_info->p_index == NULL )
{
intf_WarnMsg( 3, "input init: add index entry for stream %d", i );
RIFF_GoToChunk( p_input, p_avi_demux->p_movi );
if( RIFF_DescendChunk(p_input) != 0 ) { continue; }
p_chunk = NULL;
p_info->i_idxoffset = 0; /* ref: begining of file */
switch( p_info->i_cat )
{
case( AUDIO_ES ):
p_info->i_idxoffset = 0; /* ref: begining of file */
if( RIFF_FindChunk( p_input,
MAKEFOURCC('0'+i/10, '0'+i%10,'w','b' ),
p_movi ) == 0)
......@@ -701,7 +698,6 @@ static int AVIInit( input_thread_t *p_input )
break;
case( VIDEO_ES ):
p_info->i_idxoffset = 0;
if( (RIFF_FindChunk( p_input,
MAKEFOURCC('0'+i/10, '0'+i%10,'d','c' ),
p_movi ) == 0) )
......@@ -728,6 +724,10 @@ static int AVIInit( input_thread_t *p_input )
index.i_offset = p_chunk->i_pos;
index.i_length = p_chunk->i_size;
__AVI_AddEntryIndex( p_info, &index );
intf_WarnMsg( 3, "input init: add index entry (%4.4s) (%d)",
(char*)&p_chunk->i_id,
i);
}
}
#undef p_info
......@@ -917,14 +917,7 @@ static int __AVI_NextIndexEntry( input_thread_t *p_input,
u16 i_type;
if( (p_chunk = RIFF_ReadChunk( p_input )) == NULL )
{
if( b_inc )
{
return( 0 );
}
else
{
return( -1 );
}
return( b_inc == 1 ? 0 : -1 );
}
index.i_id = p_chunk->i_id;
......@@ -950,14 +943,7 @@ static int __AVI_NextIndexEntry( input_thread_t *p_input,
#undef p_info_i
if( RIFF_NextChunk( p_input, p_avi_demux->p_movi ) != 0 )
{
if( b_inc )
{
return( 0 );
}
else
{
return( -1 );
}
return( b_inc == 1 ? 0 : -1 );
}
}
return( 0 );
......@@ -1267,7 +1253,7 @@ static int __AVI_ReAlign( input_thread_t *p_input )
}
while( i_pos >= p_info->p_index[p_info->i_idxposc].i_offset +
p_info->p_index[p_info->i_idxposc].i_length )
p_info->p_index[p_info->i_idxposc].i_length + 8 )
{
/* search after i_idxposc */
if( __AVI_NextIndexEntry( p_input, p_info ) != 0 )
......@@ -1297,8 +1283,8 @@ static int __AVI_ReAlign( input_thread_t *p_input )
p_info->i_idxposc--;
}
}
__AVI_GoToStreamChunk( p_input, p_info, p_info->i_idxposc );
}
__AVI_GoToStreamChunk( p_input, p_info, p_info->i_idxposc );
return( 0 );
}
......@@ -1372,10 +1358,10 @@ static pes_packet_t *__AVI_GetFrameInPES( input_thread_t *p_input,
{
return( NULL ) ;
}
/* if i_pts is too small use 100 ms */
if( i_dpts <= 100000)
/* if i_pts is too small use 50 ms */
if( i_dpts <= 50000)
{
i_dpts = 100000; /* 100 ms by default */
i_dpts = 50000; /* 50 ms by default */
}
if( !p_info->header.i_samplesize )
......@@ -1506,6 +1492,7 @@ static int AVIDemux( input_thread_t *p_input )
}
}
}
/* for now, we need at least one video stream */
if( !p_avi_demux->p_info_video )
{
......@@ -1524,7 +1511,8 @@ static int AVIDemux( input_thread_t *p_input )
if( p_input->stream.p_selected_program->i_synchro_state == SYNCHRO_REINIT )
{
msleep( 200000 ); /* 200ms delay to have empty audio and video buffer*/
/* wait until buffer is empty */
msleep( 2*DEFAULT_PTS_DELAY );
/*realign audio and video stream to the good pts*/
if( __AVI_ReAlign( p_input ) != 0 )
{
......@@ -1535,11 +1523,10 @@ static int AVIDemux( input_thread_t *p_input )
p_avi_demux->i_rate = DEFAULT_RATE;
}
vlc_mutex_lock( &p_input->stream.stream_lock );
if( p_input->stream.control.i_rate != p_avi_demux->i_rate )
{
msleep( 200000 );
msleep( 2*DEFAULT_PTS_DELAY );
p_avi_demux->i_rate = p_input->stream.control.i_rate;
p_avi_demux->i_date = mdate() + DEFAULT_PTS_DELAY
- __AVI_GetPTS( p_avi_demux->p_info_video ) *
......@@ -1567,6 +1554,7 @@ static int AVIDemux( input_thread_t *p_input )
__AVI_SynchroReInit( p_input ); /* resynchro, and make pts audio
and video egual */
}
/* get audio and video frame */
if( p_avi_demux->p_info_video != NULL )
{
......@@ -1592,6 +1580,7 @@ static int AVIDemux( input_thread_t *p_input )
p_avi_demux->p_info_audio,
100000 ); /* 100 ms */
}
/* send them to decoder */
__AVI_DecodePES( p_avi_demux->p_info_audio, p_pes_audio,
p_avi_demux->i_date, p_avi_demux->i_rate );
......
......@@ -2,7 +2,7 @@
* libioRIFF.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libioRIFF.c,v 1.3 2002/05/02 10:54:34 fenrir Exp $
* $Id: libioRIFF.c,v 1.4 2002/05/04 16:51:05 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -25,13 +25,12 @@ typedef struct riffchunk_s
u32 i_id;
u32 i_size;
u32 i_type;
u32 i_pos; /* peut etre a changer */
data_packet_t *p_data; /* pas forcement utilise */
u32 i_pos;
data_packet_t *p_data;
struct riffchunk_s *p_next;
struct riffchunk_s *p_subchunk;
} riffchunk_t;
/* ttes ces fonctions permettent un acces lineaire sans avoir besoin de revenrir en arriere */
static riffchunk_t * RIFF_ReadChunk(input_thread_t * p_input);
static int RIFF_NextChunk(input_thread_t * p_input,riffchunk_t *p_rifffather);
static int RIFF_DescendChunk(input_thread_t * p_input);
......@@ -58,7 +57,7 @@ static char * RIFF_IToStr(u32 i);
********************************************/
static int __RIFF_TellPos( input_thread_t *p_input, u32 *pos )
{ /* pas sur que ca marche */
{
u32 i;
vlc_mutex_lock( &p_input->stream.stream_lock );
......@@ -99,6 +98,7 @@ static int __RIFF_SkipBytes(input_thread_t * p_input,int nb)
if ( i < 0 ) { return ( -1 ); }
i_rest-=i;
input_DeletePacket( p_input->p_method_data, p_pack);
if( ( i == 0 )&&( i_rest != 0 )) { return( -1 ); }
}
}
return ( 0 );
......
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