diff options
author | wm4 <wm4@nowhere> | 2013-11-10 23:24:21 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-12 23:27:51 +0100 |
commit | 380fc765e4ad4e3ff828c9b0bd4a565ea2ba79ed (patch) | |
tree | 6cc32f550b219c903a932692f477c8b8b4f8cfc2 /audio/out/ao_sndio.c | |
parent | d115fb3b0eed9145817a20bc0070590f7428bddd (diff) | |
download | mpv-380fc765e4ad4e3ff828c9b0bd4a565ea2ba79ed.tar.bz2 mpv-380fc765e4ad4e3ff828c9b0bd4a565ea2ba79ed.tar.xz |
audio/out: prepare for non-interleaved audio
This comes with two internal AO API changes:
1. ao_driver.play now can take non-interleaved audio. For this purpose,
the data pointer is changed to void **data, where data[0] corresponds to
the pointer in the old API. Also, the len argument as well as the return
value are now in samples, not bytes. "Sample" in this context means the
unit of the smallest possible audio frame, i.e. sample_size * channels.
2. ao_driver.get_space now returns samples instead of bytes. (Similar to
the play function.)
Change all AOs to use the new API.
The AO API as exposed to the rest of the player still uses the old API.
It's emulated in ao.c. This is purely to split the commits changing all
AOs and the commits adding actual support for outputting N-I audio.
Diffstat (limited to 'audio/out/ao_sndio.c')
-rw-r--r-- | audio/out/ao_sndio.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/audio/out/ao_sndio.c b/audio/out/ao_sndio.c index 1786c0158d..cfe0616943 100644 --- a/audio/out/ao_sndio.c +++ b/audio/out/ao_sndio.c @@ -242,16 +242,16 @@ static void reset(struct ao *ao) /* * play given number of bytes until sio_write() blocks */ -static int play(struct ao *ao, void *data, int len, int flags) +static int play(struct ao *ao, void **data, int samples, int flags) { struct priv *p = ao->priv; int n; - n = sio_write(p->hdl, data, len); + n = sio_write(p->hdl, data[0], samples * ao->sstride); p->delay += n; if (flags & AOPLAY_FINAL_CHUNK) reset(ao); - return n; + return n / ao->sstride; } /* @@ -271,7 +271,7 @@ static int get_space(struct ao *ao) ; /* nothing */ sio_revents(p->hdl, p->pfd); - return p->par.bufsz * p->par.pchan * p->par.bps - p->delay; + return (p->par.bufsz * p->par.pchan * p->par.bps - p->delay) / ao->sstride; } /* |