diff options
author | wm4 <wm4@nowhere> | 2013-11-10 23:38:18 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-12 23:29:53 +0100 |
commit | 347a86198b214b5e79b45d198c5cd2cc3c3a759a (patch) | |
tree | a8adf255ac2cedfa4bb29384e02243550c7a6647 /audio/out/ao.c | |
parent | d1ee9ea261798f94fe958578d9748a69864c3058 (diff) | |
download | mpv-347a86198b214b5e79b45d198c5cd2cc3c3a759a.tar.bz2 mpv-347a86198b214b5e79b45d198c5cd2cc3c3a759a.tar.xz |
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.
Diffstat (limited to 'audio/out/ao.c')
-rw-r--r-- | audio/out/ao.c | 12 |
1 files changed, 7 insertions, 5 deletions
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; } |