summaryrefslogtreecommitdiffstats
path: root/player/audio.c
diff options
context:
space:
mode:
authorChristoph Heinrich <christoph.heinrich@student.tugraz.at>2022-08-03 23:47:07 +0200
committerDudemanguy <random342@airmail.cc>2023-01-09 15:17:09 +0000
commitc4ec47a65e5840643024ba056ba4db20a4300ed2 (patch)
tree290cb471e55301f374a0607c30b4725c459c5966 /player/audio.c
parent67321b14402838eade127fa1d788a41906129b70 (diff)
downloadmpv-c4ec47a65e5840643024ba056ba4db20a4300ed2.tar.bz2
mpv-c4ec47a65e5840643024ba056ba4db20a4300ed2.tar.xz
player: add video-sync=display-tempo
So far there was no way to sync video to display and have audio sync to video without changes in pitch. With this option the audio does not get resampled (pitch change) and instead the corrected audio speed is applied to audio filters.
Diffstat (limited to 'player/audio.c')
-rw-r--r--player/audio.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/player/audio.c b/player/audio.c
index 9e1bb708d5..40a6a3a32a 100644
--- a/player/audio.c
+++ b/player/audio.c
@@ -64,9 +64,17 @@ static void update_speed_filters(struct MPContext *mpctx)
speed = 1.0;
}
- if (mpctx->display_sync_active && mpctx->video_out->opts->video_sync == VS_DISP_ADROP) {
- drop *= speed * resample;
- resample = speed = 1.0;
+ if (mpctx->display_sync_active) {
+ switch (mpctx->video_out->opts->video_sync) {
+ case VS_DISP_ADROP:
+ drop *= speed * resample;
+ resample = speed = 1.0;
+ break;
+ case VS_DISP_TEMPO:
+ speed = mpctx->audio_speed;
+ resample = 1.0;
+ break;
+ }
}
mp_output_chain_set_audio_speed(ao_c->filter, speed, resample, drop);