From e16c91d07ab2acfb83fdeaa6dcfcd25c97666504 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 9 Mar 2014 00:49:39 +0100 Subject: 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. --- audio/out/ao_null.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'audio/out/ao_null.c') diff --git a/audio/out/ao_null.c b/audio/out/ao_null.c index a6b40fdb76..6fff65dcd9 100644 --- a/audio/out/ao_null.c +++ b/audio/out/ao_null.c @@ -98,10 +98,15 @@ static int init(struct ao *ao) } // close audio device -static void uninit(struct ao *ao, bool cut_audio) +static void uninit(struct ao *ao) +{ +} + +static void wait_drain(struct ao *ao) { struct priv *priv = ao->priv; - if (!cut_audio && !priv->paused) + drain(ao); + if (!priv->paused) mp_sleep_us(1000000.0 * priv->buffered / ao->samplerate / priv->speed); } @@ -185,6 +190,7 @@ const struct ao_driver audio_out_null = { .get_delay = get_delay, .pause = pause, .resume = resume, + .drain = wait_drain, .priv_size = sizeof(struct priv), .priv_defaults = &(const struct priv) { .bufferlen = 0.2, -- cgit v1.2.3