summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demux_avi.c
diff options
context:
space:
mode:
authorcorey <corey@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-02-07 20:22:44 +0000
committercorey <corey@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-02-07 20:22:44 +0000
commit15debd85d2181b75d1e2a1e0e0ffeed4b98f821f (patch)
treef7322d7d1585a290d33f0d83194e502a374b3061 /libmpdemux/demux_avi.c
parent5d1bccd70c0c9fd25c9d60fea303234ce2b609c9 (diff)
downloadmpv-15debd85d2181b75d1e2a1e0e0ffeed4b98f821f.tar.bz2
mpv-15debd85d2181b75d1e2a1e0e0ffeed4b98f821f.tar.xz
1. Include audio_delay as an argument to demux_seek.
2. Modify demux_seek_avi to adjust the audio/video stream positions so that mplayer/mencoder will instantly be in sync even when -delay is specified. Other demuxers could be modified similarly in the future. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17554 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux/demux_avi.c')
-rw-r--r--libmpdemux/demux_avi.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libmpdemux/demux_avi.c b/libmpdemux/demux_avi.c
index 6febdd160c..21ab48dc6c 100644
--- a/libmpdemux/demux_avi.c
+++ b/libmpdemux/demux_avi.c
@@ -618,7 +618,7 @@ static demuxer_t* demux_open_avi(demuxer_t* demuxer){
//extern float initial_pts_delay;
-void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,int flags){
+void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,float audio_delay,int flags){
avi_priv_t *priv=demuxer->priv;
demux_stream_t *d_audio=demuxer->audio;
demux_stream_t *d_video=demuxer->video;
@@ -706,8 +706,8 @@ void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,int flags){
curr_audio_pos/=align;
curr_audio_pos*=align;
#else
- curr_audio_pos=(priv->avi_video_pts)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale;
- curr_audio_pos-=sh_audio->audio.dwStart;
+ /* immediate seeking to audio position, including when streams are delayed */
+ curr_audio_pos=(priv->avi_video_pts + audio_delay)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale;
curr_audio_pos*=sh_audio->audio.dwSampleSize;
#endif
@@ -733,7 +733,8 @@ void demux_seek_avi(demuxer_t *demuxer,float rel_seek_secs,int flags){
} else {
// VBR audio
- int chunks=(priv->avi_video_pts)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale;
+ /* immediate seeking to audio position, including when streams are delayed */
+ int chunks=(priv->avi_video_pts + audio_delay)*(float)sh_audio->audio.dwRate/(float)sh_audio->audio.dwScale;
audio_chunk_pos=0;
// find audio chunk pos: