From 6147bcce359358855ad02d8d5cbd6575d39b0449 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 26 Jun 2015 23:06:37 +0200 Subject: audio: fix format function consistency issues Replace all the check macros with function calls. Give them all the same case and naming schema. Drop af_fmt2bits(). Only af_fmt2bps() survives as af_fmt_to_bytes(). Introduce af_fmt_is_pcm(), and use it in situations that used !AF_FORMAT_IS_SPECIAL. Nobody really knew what a "special" format was. It simply meant "not PCM". --- audio/out/ao_dsound.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'audio/out/ao_dsound.c') diff --git a/audio/out/ao_dsound.c b/audio/out/ao_dsound.c index 8b1e10a10b..c581bf512e 100644 --- a/audio/out/ao_dsound.c +++ b/audio/out/ao_dsound.c @@ -444,7 +444,7 @@ static int init(struct ao *ao) int format = af_fmt_from_planar(ao->format); int rate = ao->samplerate; - if (!AF_FORMAT_IS_IEC61937(format)) { + if (!af_fmt_is_spdif(format)) { struct mp_chmap_sel sel = {0}; mp_chmap_sel_add_waveext(&sel); if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels)) @@ -456,7 +456,7 @@ static int init(struct ao *ao) case AF_FORMAT_U8: break; default: - if (AF_FORMAT_IS_IEC61937(format)) + if (af_fmt_is_spdif(format)) break; MP_VERBOSE(ao, "format %s not supported defaulting to Signed 16-bit Little-Endian\n", af_fmt_to_str(format)); @@ -465,7 +465,7 @@ static int init(struct ao *ao) //set our audio parameters ao->samplerate = rate; ao->format = format; - ao->bps = ao->channels.num * rate * af_fmt2bps(format); + ao->bps = ao->channels.num * rate * af_fmt_to_bytes(format); int buffersize = ao->bps * p->cfg_buffersize / 1000; MP_VERBOSE(ao, "Samplerate:%iHz Channels:%i Format:%s\n", rate, ao->channels.num, af_fmt_to_str(format)); @@ -478,7 +478,7 @@ static int init(struct ao *ao) ? sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX) : 0; wformat.Format.nChannels = ao->channels.num; wformat.Format.nSamplesPerSec = rate; - if (AF_FORMAT_IS_IEC61937(format)) { + if (af_fmt_is_spdif(format)) { // Whether it also works with e.g. DTS is unknown, but probably does. wformat.Format.wFormatTag = WAVE_FORMAT_DOLBY_AC3_SPDIF; wformat.Format.wBitsPerSample = 16; @@ -486,7 +486,7 @@ static int init(struct ao *ao) } else { wformat.Format.wFormatTag = (ao->channels.num > 2) ? WAVE_FORMAT_EXTENSIBLE : WAVE_FORMAT_PCM; - int bps = af_fmt2bps(format); + int bps = af_fmt_to_bytes(format); wformat.Format.wBitsPerSample = bps * 8; wformat.Format.nBlockAlign = wformat.Format.nChannels * bps; } -- cgit v1.2.3