Commit 89475796 authored by Laurent Aimar's avatar Laurent Aimar

* avi: clean up. Some standard file (ie with 1 RIFF chunk ) has OpenDML

index, so use it when normal index (idx1 chunk) isn't found.
parent d3b03289
...@@ -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.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> * 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
...@@ -478,7 +478,7 @@ static void AVI_IndexAddEntry( demux_sys_t *p_avi, ...@@ -478,7 +478,7 @@ static void AVI_IndexAddEntry( demux_sys_t *p_avi,
} }
} }
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; demux_sys_t *p_avi = p_input->p_demux_data;
...@@ -499,7 +499,7 @@ static void AVI_IndexLoad_idx1( input_thread_t *p_input ) ...@@ -499,7 +499,7 @@ static void AVI_IndexLoad_idx1( input_thread_t *p_input )
if( !p_idx1 ) if( !p_idx1 )
{ {
msg_Warn( p_input, "cannot find idx1 chunk, no index defined" ); msg_Warn( p_input, "cannot find idx1 chunk, no index defined" );
return; return VLC_EGENERIC;
} }
/* *** calculate offset *** */ /* *** calculate offset *** */
...@@ -532,6 +532,7 @@ static void AVI_IndexLoad_idx1( input_thread_t *p_input ) ...@@ -532,6 +532,7 @@ static void AVI_IndexLoad_idx1( input_thread_t *p_input )
AVI_IndexAddEntry( p_avi, i_stream, &index ); AVI_IndexAddEntry( p_avi, i_stream, &index );
} }
} }
return VLC_SUCCESS;
} }
static void __Parse_indx( input_thread_t *p_input, static void __Parse_indx( input_thread_t *p_input,
...@@ -610,11 +611,14 @@ static void AVI_IndexLoad_indx( input_thread_t *p_input ) ...@@ -610,11 +611,14 @@ static void AVI_IndexLoad_indx( input_thread_t *p_input )
avi_chunk_indx_t ck_sub; avi_chunk_indx_t ck_sub;
for( i = 0; i < p_indx->i_entriesinuse; i++ ) 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;
} }
} }
} }
...@@ -643,7 +647,11 @@ static void AVI_IndexLoad( input_thread_t *p_input ) ...@@ -643,7 +647,11 @@ static void AVI_IndexLoad( input_thread_t *p_input )
} }
else 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 );
}
} }
...@@ -2161,19 +2169,11 @@ static int AVIDemux_Seekable( input_thread_t *p_input ) ...@@ -2161,19 +2169,11 @@ static int AVIDemux_Seekable( input_thread_t *p_input )
if( avi_pk.i_stream >= p_avi->i_streams || if( avi_pk.i_stream >= p_avi->i_streams ||
( avi_pk.i_cat != AUDIO_ES && avi_pk.i_cat != VIDEO_ES ) ) ( 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: msg_Warn( p_input,
AVI_SkipBytes( p_input, 12 ); "cannot skip packet, track disabled" );
break; return( AVI_StreamStopFinishedStreams( p_input, p_avi ) ? 0 : 1 );
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;
} }
continue; continue;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libavi.c : * libavi.c :
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * 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
...@@ -182,7 +182,7 @@ int AVI_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size ) ...@@ -182,7 +182,7 @@ int AVI_ReadData( input_thread_t *p_input, uint8_t *p_buff, int i_size )
return i_read; 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 */ /* broken with new use of i_tell */
#if 0 #if 0
...@@ -804,6 +804,7 @@ static struct ...@@ -804,6 +804,7 @@ static struct
{ AVIFOURCC_ITCH, "technician" }, { AVIFOURCC_ITCH, "technician" },
{ AVIFOURCC_ISMP, "time code" }, { AVIFOURCC_ISMP, "time code" },
{ AVIFOURCC_IDIT, "digitalization time" }, { AVIFOURCC_IDIT, "digitalization time" },
{ AVIFOURCC_strn, "stream name" },
{ 0, "???" } { 0, "???" }
}; };
static int AVI_ChunkRead_strz( input_thread_t *p_input, static int AVI_ChunkRead_strz( input_thread_t *p_input,
...@@ -903,6 +904,7 @@ static struct ...@@ -903,6 +904,7 @@ static struct
{ AVIFOURCC_ITCH, AVI_ChunkRead_strz, AVI_ChunkFree_strz }, { AVIFOURCC_ITCH, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
{ AVIFOURCC_ISMP, AVI_ChunkRead_strz, AVI_ChunkFree_strz }, { AVIFOURCC_ISMP, AVI_ChunkRead_strz, AVI_ChunkFree_strz },
{ AVIFOURCC_IDIT, 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 } { 0, NULL, NULL }
}; };
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* libavi.h : LibAVI library * libavi.h : LibAVI library
****************************************************************************** ******************************************************************************
* Copyright (C) 2001 VideoLAN * 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> * 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
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#define AVIFOURCC_strh VLC_FOURCC('s','t','r','h') #define AVIFOURCC_strh VLC_FOURCC('s','t','r','h')
#define AVIFOURCC_strf VLC_FOURCC('s','t','r','f') #define AVIFOURCC_strf VLC_FOURCC('s','t','r','f')
#define AVIFOURCC_strd VLC_FOURCC('s','t','r','d') #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_indx VLC_FOURCC('i','n','d','x')
#define AVIFOURCC_rec VLC_FOURCC('r','e','c',' ') #define AVIFOURCC_rec VLC_FOURCC('r','e','c',' ')
...@@ -351,7 +352,7 @@ int AVI_TestFile( input_thread_t *p_input ); ...@@ -351,7 +352,7 @@ int AVI_TestFile( input_thread_t *p_input );
off_t AVI_TellAbsolute( input_thread_t *p_input ); off_t AVI_TellAbsolute( input_thread_t *p_input );
int AVI_SeekAbsolute( input_thread_t *p_input, off_t i_pos); 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_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, int _AVI_ChunkRead( input_thread_t *p_input,
avi_chunk_t *p_chk, avi_chunk_t *p_chk,
......
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