* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: avi.c,v 1.28 2003/01/23 13:44:21 fenrir Exp $
+ * $Id: avi.c,v 1.36 2003/02/27 13:19:43 gbazin Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
static int AVIDemux_UnSeekable( input_thread_t *p_input );
#define AVIEnd(a) __AVIEnd(VLC_OBJECT(a))
-
+#define FREE( p ) if( p ) { free( p ); (p) = NULL; }
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin();
- add_category_hint( "demuxer", NULL );
+ add_category_hint( N_("avi-demuxer"), NULL, VLC_TRUE );
add_bool( "avi-interleaved", 0, NULL,
- "force interleaved method",
- "force interleaved method" );
+ _("force interleaved method"),
+ _("force interleaved method"), VLC_TRUE );
add_bool( "avi-index", 0, NULL,
- "force index creation",
- "force index creation" );
+ _("force index creation"),
+ _("force index creation"), VLC_TRUE );
- set_description( "avi demuxer" );
+ set_description( _("avi demuxer") );
set_capability( "demux", 212 );
set_callbacks( AVIInit, __AVIEnd );
vlc_module_end();
p_pes->i_pes_size, 2048 ) );
if( i_read <= 0 )
{
- return p_pes->i_pes_size;
+ /* should occur only with EOF and max allocation reached
+ * it safer to return an error */
+ /* free pes */
+ input_DeletePES( p_input->p_method_data, p_pes );
+ return -1;
}
if( !p_pes->p_first )
static int AVI_StreamStopFinishedStreams( input_thread_t *p_input,
demux_sys_t *p_avi )
{
- int unsigned i_stream;
+ unsigned int i_stream;
int b_end;
for( i_stream = 0,b_end = VLC_TRUE;
}
#endif
AVI_ChunkFreeRoot( p_input, &p_avi->ck_root );
+
+ FREE( p_input->p_demux_data );
}
/*****************************************************************************
p_avih->i_flags&AVIF_ISINTERLEAVED?" IS_INTERLEAVED":"",
p_avih->i_flags&AVIF_TRUSTCKTYPE?" TRUST_CKTYPE":"" );
}
-
+
/* now read info on each stream and create ES */
p_avi->pp_info = calloc( p_avi->i_streams,
sizeof( avi_stream_t* ) );
demux_sys_t *p_avi = p_input->p_demux_data;
+
/* detect new selected/unselected streams */
for( i_stream = 0,i_stream_count= 0, b_video = VLC_FALSE;
i_stream < p_avi->i_streams; i_stream++ )
mtime_t i_date;
int i_percent;
/* first wait for empty buffer, arbitrary time FIXME */
-// msleep( DEFAULT_PTS_DELAY );
+ //msleep( DEFAULT_PTS_DELAY );
i_date = (mtime_t)1000000 *
(mtime_t)p_avi->i_length *
/* read thoses data */
if( p_stream->i_samplesize )
{
- int i_toread;
+ unsigned int i_toread;
if( ( i_toread = toread[i_stream].i_toread ) <= 0 )
{
if( input_ReadInPES( p_input, &p_pes, __EVEN( i_size ) ) < 0 )
{
msg_Warn( p_input, "failled reading data" );
+ AVI_StreamStop( p_input, p_avi, i_stream );
toread[i_stream].b_ok = VLC_FALSE;
continue;
}