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_dsound.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'audio/out/ao_dsound.c') diff --git a/audio/out/ao_dsound.c b/audio/out/ao_dsound.c index 5b49a67d16..bb410183eb 100644 --- a/audio/out/ao_dsound.c +++ b/audio/out/ao_dsound.c @@ -94,6 +94,8 @@ struct priv { int audio_volume; int device_index; + + int outburst; ///play in multiple of chunks of this size }; static float get_delay(struct ao *ao); @@ -438,13 +440,12 @@ static int init(struct ao *ao, char *params) ao->samplerate = rate; ao->format = format; ao->bps = ao->channels.num * rate * (af_fmt2bits(format) >> 3); - if (ao->buffersize == -1) - ao->buffersize = ao->bps; // space for 1 sec + int buffersize = ao->bps; // space for 1 sec mp_msg(MSGT_AO, MSGL_V, "ao_dsound: Samplerate:%iHz Channels:%i Format:%s\n", rate, ao->channels.num, af_fmt2str_short(format)); mp_msg(MSGT_AO, MSGL_V, "ao_dsound: Buffersize:%d bytes (%d msec)\n", - ao->buffersize, ao->buffersize / ao->bps * 1000); + buffersize, buffersize / ao->bps * 1000); //fill waveformatex ZeroMemory(&wformat, sizeof(WAVEFORMATEXTENSIBLE)); @@ -488,12 +489,12 @@ static int init(struct ao *ao, char *params) wformat.Format.nAvgBytesPerSec = wformat.Format.nSamplesPerSec * wformat.Format.nBlockAlign; - dsbdesc.dwBufferBytes = ao->buffersize; + dsbdesc.dwBufferBytes = buffersize; dsbdesc.lpwfxFormat = (WAVEFORMATEX *)&wformat; p->buffer_size = dsbdesc.dwBufferBytes; p->write_offset = 0; p->min_free_space = wformat.Format.nBlockAlign; - ao->outburst = wformat.Format.nBlockAlign * 512; + p->outburst = wformat.Format.nBlockAlign * 512; // create primary buffer and set its format @@ -633,7 +634,6 @@ static int get_space(struct ao *ao) \brief play 'len' bytes of 'data' \param data pointer to the data to play \param len size in bytes of the data buffer, gets rounded down to outburst*n - NOTE: outburst stuff might be outdated/deprecated \param flags currently unused \return number of played bytes */ @@ -644,7 +644,7 @@ static int play(struct ao *ao, void *data, int len, int flags) len = space; if (!(flags & AOPLAY_FINAL_CHUNK)) - len = (len / ao->outburst) * ao->outburst; + len = (len / p->outburst) * p->outburst; return write_buffer(ao, data, len); } -- cgit v1.2.3