summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-09 00:49:39 +0100
committerwm4 <wm4@nowhere>2014-03-09 01:27:41 +0100
commite16c91d07ab2acfb83fdeaa6dcfcd25c97666504 (patch)
tree5e5e33af457c4d573a32e15aec95205f4987f9bb /player/loadfile.c
parent2f03dc259960c9cb282e8f371d9f68266afea49c (diff)
downloadmpv-e16c91d07ab2acfb83fdeaa6dcfcd25c97666504.tar.bz2
mpv-e16c91d07ab2acfb83fdeaa6dcfcd25c97666504.tar.xz
audio/out: make draining a separate operation
Until now, this was always conflated with uninit. This was ugly, and also many AOs emulated this manually (or just ignored it). Make draining an explicit operation, so AOs which support it can provide it, and for all others generic code will emulate it. For ao_wasapi, we keep it simple and basically disable the internal draining implementation (maybe it should be restored later). Tested on Linux only.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index 657c950f32..89f893cc25 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -173,10 +173,8 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask)
struct ao *ao = mpctx->ao;
mpctx->initialized_flags &= ~INITIALIZED_AO;
if (ao) {
- bool drain = false;
// Note: with gapless_audio, stop_play is not correctly set
if (opts->gapless_audio || mpctx->stop_play == AT_END_OF_FILE) {
- drain = true;
struct mp_audio data;
mp_audio_buffer_peek(mpctx->ao_buffer, &data);
int samples = mpctx->ao_buffer_playable_samples;
@@ -187,8 +185,9 @@ void uninit_player(struct MPContext *mpctx, unsigned int mask)
if (played < samples)
MP_WARN(mpctx, "Audio output truncated at end.\n");
}
+ ao_drain(ao);
}
- ao_uninit(ao, drain);
+ ao_uninit(ao);
}
mpctx->ao = NULL;
}