Mercurial > mplayer.hg
changeset 22449:08774fd8fd17
Implement percent-based seeking
author | reimar |
---|---|
date | Mon, 05 Mar 2007 13:27:42 +0000 |
parents | 81d9984fa1eb |
children | e466ca5fb2c1 |
files | libmpdemux/demux_avs.c |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/demux_avs.c Mon Mar 05 13:17:16 2007 +0000 +++ b/libmpdemux/demux_avs.c Mon Mar 05 13:27:42 2007 +0000 @@ -417,11 +417,16 @@ double video_pos = sh_video ? (double)AVS->frameno / sh_video->fps : (double)AVS->sampleno / sh_audio->samplerate; + double duration = sh_video ? + (double)AVS->video_info->num_frames / sh_video->fps : + (double)AVS->video_info->num_audio_samples / sh_audio->samplerate; //mp_msg(MSGT_DEMUX, MSGL_V, "AVS: seek rel_seek_secs = %f - flags = %x\n", rel_seek_secs, flags); // seek absolute if (flags&1) video_pos=0; + // seek precent + if (flags&2) rel_seek_secs *= duration; video_pos += rel_seek_secs; if (video_pos < 0) video_pos = 0;