From d6737c5fab489964558b1eed934969c4f151912d Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 26 Jun 2015 23:06:21 +0200 Subject: audio: replace format name table Having a big switch() is simpler. --- audio/out/ao_coreaudio_utils.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'audio/out') diff --git a/audio/out/ao_coreaudio_utils.c b/audio/out/ao_coreaudio_utils.c index 7d504bb04b..96382512e8 100644 --- a/audio/out/ao_coreaudio_utils.c +++ b/audio/out/ao_coreaudio_utils.c @@ -236,12 +236,11 @@ bool ca_asbd_equals(const AudioStreamBasicDescription *a, // Return the AF_FORMAT_* (AF_FORMAT_S16 etc.) corresponding to the asbd. int ca_asbd_to_mp_format(const AudioStreamBasicDescription *asbd) { - for (int n = 0; af_fmtstr_table[n].format; n++) { - int mp_format = af_fmtstr_table[n].format; + for (int fmt = 1; fmt < AF_FORMAT_COUNT; fmt++) { AudioStreamBasicDescription mp_asbd = {0}; - ca_fill_asbd_raw(&mp_asbd, mp_format, 0, asbd->mChannelsPerFrame); + ca_fill_asbd_raw(&mp_asbd, fmt, 0, asbd->mChannelsPerFrame); if (ca_asbd_equals(&mp_asbd, asbd)) - return mp_format; + return fmt; } return 0; } -- cgit v1.2.3