summaryrefslogtreecommitdiffstats
path: root/mplayer.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-11-16 04:18:13 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-11-16 04:18:13 +0200
commit507f4fe6c7811558b1367e4b64855ae7f9bc8da8 (patch)
tree416b70358bf4b13871cda60fd8e8f64c5e9a2392 /mplayer.c
parent8bbb79c03a594e452fb9109dd6fda781d390a798 (diff)
parentb8861ce8e28080b151467827f65bdc3707a74511 (diff)
downloadmpv-507f4fe6c7811558b1367e4b64855ae7f9bc8da8.tar.bz2
mpv-507f4fe6c7811558b1367e4b64855ae7f9bc8da8.tar.xz
Merge branch 'vdpau'
Diffstat (limited to 'mplayer.c')
-rw-r--r--mplayer.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/mplayer.c b/mplayer.c
index 41aeff634c..fb9c00470a 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -1181,6 +1181,8 @@ static void print_status(struct MPContext *mpctx, double a_pos, bool at_frame)
a_pos = playing_audio_pts(mpctx);
if (mpctx->sh_audio && sh_video && at_frame) {
mpctx->last_av_difference = a_pos - sh_video->pts - audio_delay;
+ if (mpctx->time_frame > 0)
+ mpctx->last_av_difference += mpctx->time_frame * opts->playback_speed;
if (mpctx->last_av_difference > 0.5 && drop_frame_cnt > 50
&& !mpctx->drop_message_shown) {
mp_tmsg(MSGT_AVSYNC,MSGL_WARN,SystemTooSlow);
@@ -2105,9 +2107,13 @@ static int sleep_until_update(struct MPContext *mpctx, float *time_frame,
//============================== SLEEP: ===================================
+ if (mpctx->video_out->driver->flip_page_timed)
+ *time_frame -= 0.05;
// flag 256 means: libvo driver does its timing (dvb card)
if (*time_frame > 0.001 && !(mpctx->sh_video->output_flags&256))
*time_frame = timing_sleep(mpctx, *time_frame);
+ if (mpctx->video_out->driver->flip_page_timed)
+ *time_frame += 0.05;
return frame_time_remaining;
}
@@ -4046,11 +4052,31 @@ if(!mpctx->sh_video) {
current_module="flip_page";
if (!frame_time_remaining && blit_frame) {
unsigned int t2=GetTimer();
-
- vo_flip_page(mpctx->video_out);
+ unsigned int pts_us = mpctx->last_time + mpctx->time_frame * 1e6;
+ int duration = -1;
+ double pts2 = mpctx->video_out->next_pts2;
+ if (pts2 != MP_NOPTS_VALUE && opts->correct_pts) {
+ // expected A/V sync correction is ignored
+ double diff = (pts2 - mpctx->sh_video->pts);
+ diff /= opts->playback_speed;
+ if (mpctx->time_frame < 0)
+ diff += mpctx->time_frame;
+ if (diff < 0)
+ diff = 0;
+ if (diff > 10)
+ diff = 10;
+ duration = diff * 1e6;
+ }
+ vo_flip_page(mpctx->video_out, pts_us|1, duration);
mpctx->last_vo_flip_duration = (GetTimer() - t2) * 0.000001;
vout_time_usage += mpctx->last_vo_flip_duration;
+ if (mpctx->video_out->driver->flip_page_timed) {
+ // No need to adjust sync based on flip speed
+ mpctx->last_vo_flip_duration = 0;
+ // For print_status - VO call finishing early is OK for sync
+ mpctx->time_frame -= get_relative_time(mpctx);
+ }
print_status(mpctx, MP_NOPTS_VALUE, true);
}
else