From 31a10f7c38887294af758d21a19596b7772f328a Mon Sep 17 00:00:00 2001 From: Marcoen Hirschberg Date: Tue, 27 May 2014 08:21:18 +0200 Subject: af_fmt2bits: change to af_fmt2bps (bytes/sample) where appropriate In most places where af_fmt2bits is called to get the bits/sample, the result is immediately converted to bytes/sample. Avoid this by getting bytes/sample directly by introducing af_fmt2bps. --- audio/out/ao_dsound.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'audio/out/ao_dsound.c') diff --git a/audio/out/ao_dsound.c b/audio/out/ao_dsound.c index da0c14cdc2..e8d37e48f7 100644 --- a/audio/out/ao_dsound.c +++ b/audio/out/ao_dsound.c @@ -402,7 +402,7 @@ static int init(struct ao *ao) //set our audio parameters ao->samplerate = rate; ao->format = format; - ao->bps = ao->channels.num * rate * (af_fmt2bits(format) >> 3); + ao->bps = ao->channels.num * rate * af_fmt2bps(format); int buffersize = ao->bps; // space for 1 sec MP_VERBOSE(ao, "Samplerate:%iHz Channels:%i Format:%s\n", rate, ao->channels.num, af_fmt_to_str(format)); @@ -422,9 +422,9 @@ static int init(struct ao *ao) } else { wformat.Format.wFormatTag = (ao->channels.num > 2) ? WAVE_FORMAT_EXTENSIBLE : WAVE_FORMAT_PCM; - wformat.Format.wBitsPerSample = af_fmt2bits(format); - wformat.Format.nBlockAlign = wformat.Format.nChannels * - (wformat.Format.wBitsPerSample >> 3); + int bps = af_fmt2bps(format); + wformat.Format.wBitsPerSample = bps * 8; + wformat.Format.nBlockAlign = wformat.Format.nChannels * bps; } // fill in primary sound buffer descriptor -- cgit v1.2.3