diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-03-05 13:17:16 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-03-05 13:17:16 +0000 |
commit | 1221718d508f271bd19e55f1224a8c492f50430a (patch) | |
tree | fb7bfa82e543b0b9164867267e46591f190fc13a /libmpdemux | |
parent | e18c2bd2d6e77eb968372fad37c95a3bcdd9ebeb (diff) |
Fix seeking for avisynth audio.
Based on patch by Alexander Ponyatikh (ranma at 274 ru).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22466 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_avs.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libmpdemux/demux_avs.c b/libmpdemux/demux_avs.c index c2e177c01f..4f0be23f57 100644 --- a/libmpdemux/demux_avs.c +++ b/libmpdemux/demux_avs.c @@ -412,21 +412,29 @@ static void demux_close_avs(demuxer_t* demuxer) static void demux_seek_avs(demuxer_t *demuxer, float rel_seek_secs, float audio_delay, int flags) { sh_video_t *sh_video=demuxer->video->sh; + sh_audio_t *sh_audio=demuxer->audio->sh; AVS_T *AVS = demuxer->priv; - int video_pos=AVS->frameno; + double video_pos = sh_video ? + (double)AVS->frameno / sh_video->fps : + (double)AVS->sampleno / 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; - video_pos += (rel_seek_secs * sh_video->fps); + video_pos += rel_seek_secs; if (video_pos < 0) video_pos = 0; - if (video_pos > AVS->video_info->num_frames) video_pos = AVS->video_info->num_frames; - AVS->frameno = video_pos; - sh_video->num_frames_decoded = video_pos; - sh_video->num_frames = video_pos; + if (sh_video) { + AVS->frameno = FFMIN(video_pos * sh_video->fps, + AVS->video_info->num_frames); + sh_video->num_frames_decoded = AVS->frameno; + sh_video->num_frames = AVS->frameno; + } + if (sh_audio) + AVS->sampleno = FFMIN(video_pos * sh_audio->samplerate, + AVS->video_info->num_audio_samples); } static int avs_check_file(demuxer_t *demuxer) |