diff options
author | wm4 <wm4@nowhere> | 2015-08-10 18:43:25 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-08-10 18:48:45 +0200 |
commit | 031555fbe6cfdf6d0db3b0a5a316dd55efd75846 (patch) | |
tree | 478cf20c66af2f1a465dd9657b6131afa548a877 /options | |
parent | fedaad8250b9c9e262da3cda2114ccf5b62703a3 (diff) |
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 'options')
-rw-r--r-- | options/options.c | 14 | ||||
-rw-r--r-- | options/options.h | 3 |
2 files changed, 17 insertions, 0 deletions
diff --git a/options/options.c b/options/options.c index 963751f896..28466ed0ea 100644 --- a/options/options.c +++ b/options/options.c @@ -518,6 +518,18 @@ const m_option_t mp_opts[] = { OPT_CHOICE("pts-association-mode", user_pts_assoc_mode, 0, ({"auto", 0}, {"decoder", 1}, {"sort", 2})), OPT_FLAG("initial-audio-sync", initial_audio_sync, 0), + OPT_CHOICE("video-sync", video_sync, 0, + ({"audio", VS_DEFAULT}, + {"display-resample", VS_DISP_RESAMPLE}, + {"display-resample-vdrop", VS_DISP_RESAMPLE_VDROP}, + {"display-resample-desync", VS_DISP_RESAMPLE_NONE}, + {"display-vdrop", VS_DISP_VDROP}, + {"display-desync", VS_DISP_NONE}, + {"desync", VS_NONE})), + OPT_DOUBLE("video-sync-max-video-change", sync_max_video_change, + M_OPT_MIN, .min = 0), + OPT_DOUBLE("video-sync-max-audio-change", sync_max_audio_change, + M_OPT_MIN | M_OPT_MAX, .min = 0, .max = 1), OPT_CHOICE("hr-seek", hr_seek, 0, ({"no", -1}, {"absolute", 0}, {"yes", 1}, {"always", 1})), OPT_FLOAT("hr-seek-demuxer-offset", hr_seek_demuxer_offset, 0), @@ -710,6 +722,8 @@ const struct MPOpts mp_default_opts = { .chapter_merge_threshold = 100, .chapter_seek_threshold = 5.0, .hr_seek_framedrop = 1, + .sync_max_video_change = 1, + .sync_max_audio_change = 0.125, .load_config = 1, .position_resume = 1, .stream_cache = { diff --git a/options/options.h b/options/options.h index 4382831883..1b65b4af4d 100644 --- a/options/options.h +++ b/options/options.h @@ -144,6 +144,9 @@ typedef struct MPOpts { int correct_pts; int user_pts_assoc_mode; int initial_audio_sync; + int video_sync; + double sync_max_video_change; + double sync_max_audio_change; int hr_seek; float hr_seek_demuxer_offset; int hr_seek_framedrop; |