diff options
author | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-05-01 18:36:52 +0200 |
---|---|---|
committer | Stefano Pigozzi <stefano.pigozzi@gmail.com> | 2014-05-10 14:07:45 +0200 |
commit | b46ffaec7cf105e37263d1e32b396c3455e64f06 (patch) | |
tree | e7aeb24e4795721fb83a47f24850e5db9001ae44 /audio/out/ao_coreaudio.c | |
parent | e2f26f01fed17a156653994702a270e01732eb65 (diff) | |
download | mpv-b46ffaec7cf105e37263d1e32b396c3455e64f06.tar.bz2 mpv-b46ffaec7cf105e37263d1e32b396c3455e64f06.tar.xz |
ao_coreaudio: use description-based channel layouts
CoreAudio supports 3 kinds of layouts: bitmap based, tag based, and speaker
description based (using either channel labels or positional data).
Previously we tried to convert everything to bitmap based channel layouts,
but it turns out description based ones are the most generic and there are
built-in CoreAudio APIs to perform the conversion in this direction.
Moreover description based layouts support waveext extensions (like SDL and
SDR), and are easier to map to mp_chmaps.
Diffstat (limited to 'audio/out/ao_coreaudio.c')
-rw-r--r-- | audio/out/ao_coreaudio.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/audio/out/ao_coreaudio.c b/audio/out/ao_coreaudio.c index e8b0179d20..9407d5f562 100644 --- a/audio/out/ao_coreaudio.c +++ b/audio/out/ao_coreaudio.c @@ -303,23 +303,16 @@ static int init(struct ao *ao) &layouts, &n_layouts); CHECK_CA_ERROR("could not get audio device prefered layouts"); - uint32_t *bitmaps; - size_t n_bitmaps; - - ca_bitmaps_from_layouts(ao, layouts, n_layouts, &bitmaps, &n_bitmaps); - talloc_free(layouts); - struct mp_chmap_sel chmap_sel = {0}; - - for (int i=0; i < n_bitmaps; i++) { + for (int i = 0; i < n_layouts; i++) { struct mp_chmap chmap = {0}; - mp_chmap_from_lavc(&chmap, bitmaps[i]); - mp_chmap_sel_add_map(&chmap_sel, &chmap); + if (ca_layout_to_mp_chmap(ao, &layouts[i], &chmap)) + mp_chmap_sel_add_map(&chmap_sel, &chmap); } - talloc_free(bitmaps); + talloc_free(layouts); - if (ao->channels.num < 3 || n_bitmaps < 1) + if (ao->channels.num < 3) // If the input is not surround or we could not get any usable // bitmap from the hardware, default to waveext... mp_chmap_sel_add_waveext(&chmap_sel); |