From 4d3a2c7e0dac38546f5fc2c7737a6ec1f09e30f6 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 16 Jun 2013 19:15:32 +0200 Subject: audio/out: remove ao->outburst/buffersize fields The core didn't use these fields, and use of them was inconsistent accross AOs. Some didn't use them at all. Some only set them; the values were completely unused by the core. Some made full use of them. Remove these fields. In places where they are still needed, make them private AO state. Remove the --abs option. It set the buffer size for ao_oss and ao_dsound (being ignored by all other AOs), and was already marked as obsolete. If it turns out that it's still needed for ao_oss or ao_dsound, their default buffer sizes could be adjusted, and if even that doesn't help, AO suboptions could be added in these cases. --- audio/out/ao_null.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'audio/out/ao_null.c') diff --git a/audio/out/ao_null.c b/audio/out/ao_null.c index f3c60913b5..dde2102daa 100644 --- a/audio/out/ao_null.c +++ b/audio/out/ao_null.c @@ -31,6 +31,8 @@ struct priv { double last_time; float buffered_bytes; + int buffersize; + int outburst; }; static void drain(struct ao *ao) @@ -55,9 +57,9 @@ static int init(struct ao *ao, char *params) return -1; int samplesize = af_fmt2bits(ao->format) / 8; - ao->outburst = 256 * ao->channels.num * samplesize; + priv->outburst = 256 * ao->channels.num * samplesize; // A "buffer" for about 0.2 seconds of audio - ao->buffersize = (int)(ao->samplerate * 0.2 / 256 + 1) * ao->outburst; + priv->buffersize = (int)(ao->samplerate * 0.2 / 256 + 1) * priv->outburst; priv->last_time = mp_time_sec(); return 0; @@ -92,18 +94,18 @@ static int get_space(struct ao *ao) struct priv *priv = ao->priv; drain(ao); - return ao->buffersize - priv->buffered_bytes; + return priv->buffersize - priv->buffered_bytes; } static int play(struct ao *ao, void *data, int len, int flags) { struct priv *priv = ao->priv; - int maxbursts = (ao->buffersize - priv->buffered_bytes) / ao->outburst; - int playbursts = len / ao->outburst; + int maxbursts = (priv->buffersize - priv->buffered_bytes) / priv->outburst; + int playbursts = len / priv->outburst; int bursts = playbursts > maxbursts ? maxbursts : playbursts; - priv->buffered_bytes += bursts * ao->outburst; - return bursts * ao->outburst; + priv->buffered_bytes += bursts * priv->outburst; + return bursts * priv->outburst; } static float get_delay(struct ao *ao) -- cgit v1.2.3