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.
This commit is contained in:
wm4 2014-11-08 16:09:42 +01:00
parent 68ecbdf920
commit 33b57f5557
1 changed files with 10 additions and 1 deletions

View File

@ -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)
{