From 33b57f55573e658b3af6c6e8ff3188c8f959e82e Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 8 Nov 2014 16:09:42 +0100 Subject: player: improve audio time display This commit fixes a "cosmetic" user interface issue. Instead of displaying the interpolated seek time on OSD, show the actual audio time. This is rather silly: when seeking in audio-only mode, it takes some iterations until audio is "ready", but on the other hand, the audio state machine is rather fickle, and fixing this cosmetic issue would be intrusive. So just add a hack that paints over the ugly behavior as perceived by the user. Probably the lesser evil. It doesn't happen if video is enabled, because that mode sets the current time immediately to video PTS. (Audio has to be synced to video, so the code is a bit more complex.) Fixes #1233. --- player/audio.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'player') diff --git a/player/audio.c b/player/audio.c index 8274399f67..75989bfe20 100644 --- a/player/audio.c +++ b/player/audio.c @@ -429,7 +429,7 @@ static bool get_sync_samples(struct MPContext *mpctx, int *skip) return true; } -void fill_audio_out_buffers(struct MPContext *mpctx, double endpts) +static void do_fill_audio_out_buffers(struct MPContext *mpctx, double endpts) { struct MPOpts *opts = mpctx->opts; struct dec_audio *d_audio = mpctx->d_audio; @@ -589,6 +589,15 @@ void fill_audio_out_buffers(struct MPContext *mpctx, double endpts) } } +void fill_audio_out_buffers(struct MPContext *mpctx, double endpts) +{ + do_fill_audio_out_buffers(mpctx, endpts); + // Run audio playback state machine again to display the actual audio PTS + // as current time on OSD in audio-only mode in most situations. + if (mpctx->audio_status == STATUS_SYNCING) + do_fill_audio_out_buffers(mpctx, endpts); +} + // Drop data queued for output, or which the AO is currently outputting. void clear_audio_output_buffers(struct MPContext *mpctx) { -- cgit v1.2.3