index, so use it when normal index (idx1 chunk) isn't found.
* avi.c : AVI file Stream input module for vlc
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: avi.c,v 1.43 2003/04/27 11:55:03 fenrir Exp $
+ * $Id: avi.c,v 1.44 2003/04/27 13:55:51 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
}
}
-static void AVI_IndexLoad_idx1( input_thread_t *p_input )
+static int AVI_IndexLoad_idx1( input_thread_t *p_input )
{
demux_sys_t *p_avi = p_input->p_demux_data;
if( !p_idx1 )
{
msg_Warn( p_input, "cannot find idx1 chunk, no index defined" );
- return;
+ return VLC_EGENERIC;
}
/* *** calculate offset *** */
AVI_IndexAddEntry( p_avi, i_stream, &index );
}
}
+ return VLC_SUCCESS;
}
static void __Parse_indx( input_thread_t *p_input,
avi_chunk_indx_t ck_sub;
for( i = 0; i < p_indx->i_entriesinuse; i++ )
{
- AVI_SeekAbsolute( p_input, p_indx->idx.super[i].i_offset );
+ if( AVI_SeekAbsolute( p_input, p_indx->idx.super[i].i_offset ) )
+ {
+ break;
+ }
- if( !AVI_ChunkRead( p_input, &ck_sub, NULL, p_avi->b_seekable ) )
+ if( AVI_ChunkRead( p_input, &ck_sub, NULL, p_avi->b_seekable ) )
{
- __Parse_indx( p_input, i_stream, &ck_sub );
+ break;
}
}
}
}
else
{
- AVI_IndexLoad_idx1( p_input );
+ if( AVI_IndexLoad_idx1( p_input ) )
+ {
+ /* try indx if idx1 failed as some "normal" file have indx too */
+ AVI_IndexLoad_indx( p_input );
+ }
}
if( avi_pk.i_stream >= p_avi->i_streams ||
( avi_pk.i_cat != AUDIO_ES && avi_pk.i_cat != VIDEO_ES ) )
{
- switch( avi_pk.i_fourcc )
+ if( AVI_PacketNext( p_input ) )
{
- case AVIFOURCC_LIST:
- AVI_SkipBytes( p_input, 12 );
- break;
- default:
- if( AVI_PacketNext( p_input ) )
- {
- msg_Warn( p_input,
- "cannot skip packet, track disabled" );
- return( AVI_StreamStopFinishedStreams( p_input, p_avi ) ? 0 : 1 );
- }
- break;
+ msg_Warn( p_input,
+ "cannot skip packet, track disabled" );
+ return( AVI_StreamStopFinishedStreams( p_input, p_avi ) ? 0 : 1 );
}
continue;
}
* libavi.c :
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: libavi.c,v 1.18 2003/04/27 11:55:03 fenrir Exp $
+ * $Id: libavi.c,v 1.19 2003/04/27 13:55:51 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
return i_read;
}
-int AVI_SkipBytes( input_thread_t *p_input, int i_count )
+int AVI_SkipBytes( input_thread_t *p_input, int64_t i_count )
{
/* broken with new use of i_tell */
#if 0
{ AVIFOURCC_ITCH, "technician" },
{ AVIFOURCC_ISMP, "time code" },
{ AVIFOURCC_IDIT, "digitalization time" },
+ { AVIFOURCC_strn, "stream name" },
{ 0, "???" }
};
static int AVI_ChunkRead_strz( input_thread_t *p_input,
{ AVIFOURCC_ITCH, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
{ AVIFOURCC_ISMP, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
{ AVIFOURCC_IDIT, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
+ { AVIFOURCC_strn, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
{ 0, NULL, NULL }
};
* libavi.h : LibAVI library
******************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: libavi.h,v 1.9 2003/04/27 11:55:03 fenrir Exp $
+ * $Id: libavi.h,v 1.10 2003/04/27 13:55:51 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
#define AVIFOURCC_strh VLC_FOURCC('s','t','r','h')
#define AVIFOURCC_strf VLC_FOURCC('s','t','r','f')
#define AVIFOURCC_strd VLC_FOURCC('s','t','r','d')
+#define AVIFOURCC_strn VLC_FOURCC('s','t','r','n')
#define AVIFOURCC_indx VLC_FOURCC('i','n','d','x')
#define AVIFOURCC_rec VLC_FOURCC('r','e','c',' ')
off_t AVI_TellAbsolute( input_thread_t *p_input );
int AVI_SeekAbsolute( input_thread_t *p_input, off_t i_pos);
int AVI_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size );
-int AVI_SkipBytes( input_thread_t *p_input, int i_count );
+int AVI_SkipBytes( input_thread_t *p_input, int64_t i_count );
int _AVI_ChunkRead( input_thread_t *p_input,
avi_chunk_t *p_chk,