From 8f2e9f1d613f686a834446c73465f0ca41156db3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 30 Jul 2014 23:01:55 +0200 Subject: player: split seek_reset() This also reduces some code duplication with other parts of the code. The changfe is mostly cosmetic, although there are also some subtle changes in behavior. At least one change is that the big desync message is now printed after every seek. --- player/audio.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'player/audio.c') diff --git a/player/audio.c b/player/audio.c index 5fcc2cbd22..2491051a54 100644 --- a/player/audio.c +++ b/player/audio.c @@ -92,6 +92,13 @@ int reinit_audio_filters(struct MPContext *mpctx) return 1; } +void reset_audio_state(struct MPContext *mpctx) +{ + if (mpctx->d_audio) + audio_reset_decoding(mpctx->d_audio); + mpctx->audio_status = mpctx->d_audio ? STATUS_SYNCING : STATUS_EOF; +} + void reinit_audio_chain(struct MPContext *mpctx) { struct MPOpts *opts = mpctx->opts; @@ -117,6 +124,7 @@ void reinit_audio_chain(struct MPContext *mpctx) mpctx->d_audio->replaygain_data = sh->audio->replaygain_data; if (!audio_init_best_codec(mpctx->d_audio, opts->audio_decoders)) goto init_error; + reset_audio_state(mpctx); } assert(mpctx->d_audio); -- cgit v1.2.3