diff options
author | wm4 <wm4@nowhere> | 2013-05-09 18:06:26 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-05-12 21:24:57 +0200 |
commit | ecc6e379b24dd5e37b864ae599a154880a2bd2d0 (patch) | |
tree | f439d10380a5f234b660cabb236470cabb1d4d0d /audio/out/ao_pulse.c | |
parent | ab8f28a672fbd8d21a98c265976068e80be082a7 (diff) | |
download | mpv-ecc6e379b24dd5e37b864ae599a154880a2bd2d0.tar.bz2 mpv-ecc6e379b24dd5e37b864ae599a154880a2bd2d0.tar.xz |
audio/out: channel map selection
Make all AOs use what has been introduced in the previous commit.
Note that even AOs which can handle all possible layouts (like ao_null)
use the new functions. This might be important if in the future
ao_select_champ() possibly honors global user options about downmixing
and so on.
Diffstat (limited to 'audio/out/ao_pulse.c')
-rw-r--r-- | audio/out/ao_pulse.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/audio/out/ao_pulse.c b/audio/out/ao_pulse.c index 9422fa319d..15a2b8b0a1 100644 --- a/audio/out/ao_pulse.c +++ b/audio/out/ao_pulse.c @@ -187,6 +187,15 @@ static bool chmap_pa_from_mp(pa_channel_map *dst, struct mp_chmap *src) return true; } +static bool select_chmap(struct ao *ao, pa_channel_map *dst) +{ + struct mp_chmap_sel sel = {0}; + for (int n = 0; speaker_map[n][1] != -1; n++) + mp_chmap_sel_add_speaker(&sel, speaker_map[n][1]); + return ao_chmap_sel_adjust(ao, &sel, &ao->channels) && + chmap_pa_from_mp(dst, &ao->channels); +} + static void uninit(struct ao *ao, bool cut_audio) { struct priv *priv = ao->priv; @@ -301,16 +310,8 @@ static int init(struct ao *ao, char *params) goto fail; } - if (!chmap_pa_from_mp(&map, &ao->channels)) { - char *name = mp_chmap_to_str(&ao->channels); - mp_msg(MSGT_AO, MSGL_ERR, "AO: [pulse] Can't map %s channel layout\n", - name); - talloc_free(name); - // Not a really good fallback, since this doesn't trigger if the - // channel map is valid, but unsupported by the output device. - ao->channels = (struct mp_chmap) MP_CHMAP_INIT_STEREO; - pa_channel_map_init_stereo(&map); - } + if (!select_chmap(ao, &map)) + goto fail; ao->bps = pa_bytes_per_second(&ss); |