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_lavc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'audio/out/ao_lavc.c') diff --git a/audio/out/ao_lavc.c b/audio/out/ao_lavc.c index afb021f7a0..073ff8ebdb 100644 --- a/audio/out/ao_lavc.c +++ b/audio/out/ao_lavc.c @@ -181,7 +181,7 @@ fail: // close audio device static int encode(struct ao *ao, double apts, void **data); -static void uninit(struct ao *ao, bool cut_audio) +static void uninit(struct ao *ao) { struct priv *ac = ao->priv; struct encode_lavc_context *ectx = ao->encode_lavc_ctx; @@ -462,6 +462,11 @@ static int play(struct ao *ao, void **data, int samples, int flags) return bufpos; } +static void drain(struct ao *ao) +{ + // pretend we support it, so generic code doesn't force a wait +} + const struct ao_driver audio_out_lavc = { .encode = true, .description = "audio encoding using libavcodec", @@ -470,4 +475,5 @@ const struct ao_driver audio_out_lavc = { .uninit = uninit, .get_space = get_space, .play = play, + .drain = drain, }; -- cgit v1.2.3