[vlc-commits] commit: demux/asf: make sure we seek to keyframes (Gildas Bazin )
git at videolan.org
git at videolan.org
Sun Jan 9 17:41:34 CET 2011
vlc/vlc-1.1 | branch: master | Gildas Bazin <gbazin at videolan.org> | Thu Jan 6 20:44:33 2011 +0000| [cb1b4e5cb6d4b8d9e788b27d5d4f1f4a6a0e2236] | committer: Jean-Baptiste Kempf
demux/asf: make sure we seek to keyframes
(cherry picked from commit 04ac17066a619084dd40d89b032f6411cfd39b87)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=cb1b4e5cb6d4b8d9e788b27d5d4f1f4a6a0e2236
---
modules/demux/asf/asf.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index e408296..0fd0f19 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -95,7 +95,10 @@ struct demux_sys_t
int64_t i_data_begin;
int64_t i_data_end;
- bool b_index;
+ bool b_index;
+ unsigned int i_seek_track;
+ unsigned int i_wait_keyframe;
+
vlc_meta_t *meta;
};
@@ -228,6 +231,7 @@ static void Close( vlc_object_t * p_this )
static int SeekPercent( demux_t *p_demux, int i_query, va_list args )
{
demux_sys_t *p_sys = p_demux->p_sys;
+ p_sys->i_wait_keyframe = p_sys->i_seek_track ? 50 : 0;
return demux_vaControlHelper( p_demux->s, p_sys->i_data_begin,
p_sys->i_data_end, p_sys->i_bitrate,
p_sys->p_fp->i_min_data_packet_size,
@@ -254,6 +258,8 @@ static int SeekIndex( demux_t *p_demux, mtime_t i_date, float f_pos )
return VLC_EGENERIC;
}
+ p_sys->i_wait_keyframe = p_sys->i_seek_track ? 50 : 0;
+
uint64_t i_offset = (uint64_t)p_index->index_entry[i_entry].i_packet_number *
p_sys->p_fp->i_min_data_packet_size;
return stream_Seek( p_demux->s, p_sys->i_data_begin + i_offset );
@@ -574,6 +580,16 @@ static int DemuxPacket( demux_t *p_demux )
continue; // over payload
}
+ if( p_sys->i_wait_keyframe &&
+ !(i_stream_number == p_sys->i_seek_track && i_packet_keyframe &&
+ !i_media_object_offset) )
+ {
+ i_skip += i_payload_data_length;
+ p_sys->i_wait_keyframe--;
+ continue; // over payload
+ }
+ p_sys->i_wait_keyframe = 0;
+
if( !tk->p_es )
{
i_skip += i_payload_data_length;
@@ -706,6 +722,8 @@ static int DemuxInit( demux_t *p_demux )
p_sys->p_fp = NULL;
p_sys->b_index = 0;
p_sys->i_track = 0;
+ p_sys->i_seek_track = 0;
+ p_sys->i_wait_keyframe = 0;
for( int i = 0; i < 128; i++ )
{
p_sys->track[i] = NULL;
@@ -972,6 +990,10 @@ static int DemuxInit( demux_t *p_demux )
*p = '\0';
}
+ /* Set the track on which we'll do our seeking to the first video track */
+ if(!p_sys->i_seek_track && fmt.i_cat == VIDEO_ES)
+ p_sys->i_seek_track = p_sp->i_stream_number;
+
tk->p_es = es_out_Add( p_demux->out, &fmt );
}
else
More information about the vlc-commits
mailing list