summaryrefslogtreecommitdiffstats
path: root/video/out/vo.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-08-10 18:43:25 +0200
committerwm4 <wm4@nowhere>2015-08-10 18:48:45 +0200
commit031555fbe6cfdf6d0db3b0a5a316dd55efd75846 (patch)
tree478cf20c66af2f1a465dd9657b6131afa548a877 /video/out/vo.h
parentfedaad8250b9c9e262da3cda2114ccf5b62703a3 (diff)
downloadmpv-031555fbe6cfdf6d0db3b0a5a316dd55efd75846.tar.bz2
mpv-031555fbe6cfdf6d0db3b0a5a316dd55efd75846.tar.xz
player: add display sync mode
If this mode is enabled, the player tries to strictly synchronize video to display refresh. It will adjust playback speed to match the display, so if you play 23.976 fps video on a 24 Hz screen, playback speed is increased by approximately 1/1000. Audio wll be resampled to keep up with playback. This is different from the default sync mode, which will sync video to audio, with the consequence that video might skip or repeat a frame once in a while to make video keep up with audio. This is still unpolished. There are some major problems as well; in particular, mkv VFR files won't work well. The reason is that Matroska is terrible and rounds timestamps to milliseconds. This makes it rather hard to guess the framerate of a section of video that is playing. We could probably fix this by just accepting jittery timestamps (instead of explicitly disabling the sync code in this case), but I'm not ready to accept such a solution yet. Another issue is that we are extremely reliant on OS video and audio APIs working in an expected manner, which of course is not too often the case. Consequently, the new sync mode is a bit fragile.
Diffstat (limited to 'video/out/vo.h')
-rw-r--r--video/out/vo.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/video/out/vo.h b/video/out/vo.h
index 06a923bf41..4404500e67 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -165,6 +165,8 @@ struct vo_frame {
int64_t prev_vsync;
// "ideal" display time within the vsync
int64_t vsync_offset;
+ // how often the frame will be repeated (does not include OSD redraws)
+ int num_vsyncs;
// Set if the current frame is repeated from the previous. It's guaranteed
// that the current is the same as the previous one, even if the image
// pointer is different.
@@ -173,6 +175,8 @@ struct vo_frame {
bool redraw, repeat;
// The frame is not in movement - e.g. redrawing while paused.
bool still;
+ // Frames are output as fast as possible, with implied vsync blocking.
+ bool display_synced;
// The current frame to be drawn.
// Warning: When OSD should be redrawn in --force-window --idle mode, this
// can be NULL. The VO should draw a black background, OSD on top.
@@ -333,6 +337,7 @@ void vo_destroy(struct vo *vo);
void vo_set_paused(struct vo *vo, bool paused);
int64_t vo_get_drop_count(struct vo *vo);
void vo_increment_drop_count(struct vo *vo, int64_t n);
+int64_t vo_get_missed_count(struct vo *vo);
void vo_query_formats(struct vo *vo, uint8_t *list);
void vo_event(struct vo *vo, int event);
int vo_query_and_reset_events(struct vo *vo, int events);
@@ -342,6 +347,7 @@ void vo_set_queue_params(struct vo *vo, int64_t offset_us, bool vsync_timed,
int vo_get_num_req_frames(struct vo *vo);
int64_t vo_get_vsync_interval(struct vo *vo);
double vo_get_display_fps(struct vo *vo);
+int64_t vo_get_next_frame_start_time(struct vo *vo);
void vo_wakeup(struct vo *vo);