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_pcm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'audio/out/ao_pcm.c') diff --git a/audio/out/ao_pcm.c b/audio/out/ao_pcm.c index 5b9d61b450..76f0315bef 100644 --- a/audio/out/ao_pcm.c +++ b/audio/out/ao_pcm.c @@ -73,7 +73,7 @@ static void fput32le(uint32_t val, FILE *fp) static void write_wave_header(struct ao *ao, FILE *fp, uint64_t data_length) { uint16_t fmt = ao->format == AF_FORMAT_FLOAT ? WAV_ID_FLOAT_PCM : WAV_ID_PCM; - int bits = af_fmt2bits(ao->format); + int bits = af_fmt_to_bytes(ao->format) * 8; // Master RIFF chunk fput32le(WAV_ID_RIFF, fp); @@ -135,7 +135,7 @@ static int init(struct ao *ao) case AF_FORMAT_FLOAT: break; default: - if (!AF_FORMAT_IS_IEC61937(ao->format)) + if (!af_fmt_is_spdif(ao->format)) ao->format = AF_FORMAT_S16; break; } @@ -146,7 +146,7 @@ static int init(struct ao *ao) if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels)) return -1; - ao->bps = ao->channels.num * ao->samplerate * af_fmt2bps(ao->format); + ao->bps = ao->channels.num * ao->samplerate * af_fmt_to_bytes(ao->format); MP_INFO(ao, "File: %s (%s)\nPCM: Samplerate: %d Hz Channels: %d Format: %s\n", priv->outputfilename, -- cgit v1.2.3