[vlc-commits] demux: avi: fix non seekable streams
Francois Cartegnie
git at videolan.org
Mon Jan 11 21:17:28 CET 2016
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Jan 11 15:57:20 2016 +0100| [cb66960231e99041518c118873abe6ff1ff869f5] | committer: Francois Cartegnie
demux: avi: fix non seekable streams
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cb66960231e99041518c118873abe6ff1ff869f5
---
modules/demux/avi/avi.c | 23 +++++++++++++++--------
modules/demux/avi/libavi.c | 7 +++----
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 9368e9d..9044986 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -705,13 +705,16 @@ aviindex:
{
AVI_IndexCreate( p_demux );
}
+ else if( p_sys->b_seekable )
+ {
+ AVI_IndexLoad( p_demux );
+ }
else
{
msg_Warn( p_demux, "cannot create index (unseekable stream)" );
- AVI_IndexLoad( p_demux );
}
}
- else
+ else if( p_sys->b_seekable )
{
AVI_IndexLoad( p_demux );
}
@@ -877,11 +880,8 @@ block_t * ReadFrame( demux_t *p_demux, const avi_track_t *tk,
}
/* skip header */
- if( tk->i_idxposb == 0 )
- {
- p_frame->p_buffer += i_header;
- p_frame->i_buffer -= i_header;
- }
+ p_frame->p_buffer += i_header;
+ p_frame->i_buffer -= i_header;
if ( !tk->i_width_bytes )
return p_frame;
@@ -1181,7 +1181,14 @@ static int Demux_Seekable( demux_t *p_demux )
}
else
{
- stream_Seek( p_demux->s, i_pos );
+ if( !p_sys->b_fastseekable && (i_pos > stream_Tell( p_demux->s )) )
+ {
+ stream_Read( p_demux->s, NULL, i_pos - stream_Tell( p_demux->s ) );
+ }
+ else
+ {
+ stream_Seek( p_demux->s, i_pos );
+ }
}
/* Set the track to use */
diff --git a/modules/demux/avi/libavi.c b/modules/demux/avi/libavi.c
index d12ed9f..8deb2b6 100644
--- a/modules/demux/avi/libavi.c
+++ b/modules/demux/avi/libavi.c
@@ -152,11 +152,10 @@ static int AVI_ChunkRead_list( stream_t *s, avi_chunk_t *p_container )
if( p_container->common.i_chunk_fourcc == AVIFOURCC_LIST &&
p_container->list.i_type == AVIFOURCC_movi )
{
+ if( !b_seekable )
+ return VLC_SUCCESS;
msg_Dbg( (vlc_object_t*)s, "skipping movi chunk" );
- if( b_seekable )
- return AVI_NextChunk( s, p_container );
- else
- return VLC_EGENERIC; /* point at begining of LIST-movi */
+ return AVI_NextChunk( s, p_container ); /* points at begining of LIST-movi if not seekable */
}
if( stream_Read( s, NULL, 12 ) != 12 )
More information about the vlc-commits
mailing list