typedef struct
{
- bool b_activated;
+ bool b_activated;
+ bool b_eof;
unsigned int i_cat; /* AUDIO_ES, VIDEO_ES */
vlc_fourcc_t i_codec;
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 );
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;
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;
}
/* 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 )
{
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;
avi_track_t *tk = p_sys->track[i];
if( tk->i_idxposc >= tk->i_idxnb )
{
- tk->b_activated = false;
+ tk->b_eof = true;
}
else
{