[vlc-devel] commit: Finished avi correction about disabled tracks. (Laurent Aimar )
git version control
git at videolan.org
Tue Jun 9 21:13:19 CEST 2009
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Jun 9 21:11:07 2009 +0200| [1a033fe048f781670b6579d80c7d46fe226d87ee] | committer: Laurent Aimar
Finished avi correction about disabled tracks.
It is about [a0d2358734e81e5928a5edb4e0ff47e38d7ed28f].
Without this patch, with files that have a shorter track, the demuxer
would try seeking the track every time the Demux() function was called.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1a033fe048f781670b6579d80c7d46fe226d87ee
---
modules/demux/avi/avi.c | 25 ++++++++++++++-----------
1 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 25d653b..8874d4c 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -112,7 +112,8 @@ typedef struct
typedef struct
{
- bool b_activated;
+ bool b_activated;
+ bool b_eof;
unsigned int i_cat; /* AUDIO_ES, VIDEO_ES */
vlc_fourcc_t i_codec;
@@ -361,7 +362,9 @@ static int Open( vlc_object_t * p_this )
avi_chunk_strf_vids_t *p_vids = NULL;
es_format_t fmt;
- memset( tk, 0, sizeof( avi_track_t ) );
+ memset( tk, 0, sizeof(*tk) );
+ tk->b_eof = false;
+ tk->b_activated = true;
p_vids = (avi_chunk_strf_vids_t*)AVI_ChunkFind( p_strl, AVIFOURCC_strf, 0 );
p_auds = (avi_chunk_strf_auds_t*)AVI_ChunkFind( p_strl, AVIFOURCC_strf, 0 );
@@ -876,7 +879,7 @@ static int Demux_Seekable( demux_t *p_demux )
avi_track_t *tk = p_sys->track[i_track];
mtime_t i_dpts;
- toread[i_track].b_ok = tk->b_activated;
+ toread[i_track].b_ok = tk->b_activated && !tk->b_eof;
if( tk->i_idxposc < tk->i_idxnb )
{
toread[i_track].i_posf = tk->p_index[tk->i_idxposc].i_pos;
@@ -1081,7 +1084,7 @@ static int Demux_Seekable( demux_t *p_demux )
if( ( p_frame = stream_Block( p_demux->s, __EVEN( i_size ) ) )==NULL )
{
msg_Warn( p_demux, "failed reading data" );
- tk->b_activated = false;
+ tk->b_eof = false;
toread[i_track].b_ok = false;
continue;
}
@@ -1339,15 +1342,15 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
/* try to find chunk that is at i_percent or the file */
i_pos = __MAX( i_percent * stream_Size( p_demux->s ) / 100,
p_sys->i_movi_begin );
- /* search first selected stream */
+ /* search first selected stream (and prefer non eof ones) */
for( i_stream = 0, p_stream = NULL;
i_stream < p_sys->i_track; i_stream++ )
{
- p_stream = p_sys->track[i_stream];
- if( p_stream->b_activated )
- {
+ if( !p_stream || p_stream->b_eof )
+ p_stream = p_sys->track[i_stream];
+
+ if( p_stream->b_activated && !p_stream->b_eof )
break;
- }
}
if( !p_stream || !p_stream->b_activated )
{
@@ -1387,7 +1390,7 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
if( !p_stream->b_activated )
continue;
- AVI_TrackSeek( p_demux, i_stream, i_date );
+ p_stream->b_eof = AVI_TrackSeek( p_demux, i_stream, i_date ) != 0;
}
es_out_Control( p_demux->out, ES_OUT_SET_NEXT_DISPLAY_TIME, i_date );
p_sys->i_time = i_date;
@@ -2460,7 +2463,7 @@ static int AVI_TrackStopFinishedStreams( demux_t *p_demux )
avi_track_t *tk = p_sys->track[i];
if( tk->i_idxposc >= tk->i_idxnb )
{
- tk->b_activated = false;
+ tk->b_eof = true;
}
else
{
More information about the vlc-devel
mailing list