From 347a86198b214b5e79b45d198c5cd2cc3c3a759a Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 10 Nov 2013 23:38:18 +0100 Subject: audio: switch output to mp_audio_buffer Replace the code that used a single buffer with mp_audio_buffer. This also enables non-interleaved output operation, although it's still disabled, and no AO supports it yet. --- audio/out/ao.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'audio/out/ao.c') diff --git a/audio/out/ao.c b/audio/out/ao.c index fd20270160..50c95830c3 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -209,10 +209,9 @@ void ao_uninit(struct ao *ao, bool cut_audio) talloc_free(ao); } -int ao_play(struct ao *ao, void *data, int len, int flags) +int ao_play(struct ao *ao, void **data, int samples, int flags) { - int r = ao->driver->play(ao, &data, len / ao->sstride, flags); - return r < 0 ? r : r * ao->sstride; + return ao->driver->play(ao, data, samples, flags); } int ao_control(struct ao *ao, enum aocontrol cmd, void *arg) @@ -233,7 +232,7 @@ double ao_get_delay(struct ao *ao) int ao_get_space(struct ao *ao) { - return ao->driver->get_space(ao) * ao->sstride; + return ao->driver->get_space(ao); } void ao_reset(struct ao *ao) @@ -260,7 +259,10 @@ int ao_play_silence(struct ao *ao, int samples) return 0; char *p = talloc_size(NULL, samples * ao->sstride); af_fill_silence(p, samples * ao->sstride, ao->format); - int r = ao_play(ao, p, samples * ao->sstride, 0); + void *tmp[MP_NUM_CHANNELS]; + for (int n = 0; n < MP_NUM_CHANNELS; n++) + tmp[n] = p; + int r = ao_play(ao, tmp, samples, 0); talloc_free(p); return r; } -- cgit v1.2.3