From 2c732a46ba37182692748acd2b72310d21c451f8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 7 Jul 2013 18:37:55 +0200 Subject: ao_jack: allow more control about channel layouts --- audio/chmap_sel.c | 1 + audio/out/ao_jack.c | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'audio') diff --git a/audio/chmap_sel.c b/audio/chmap_sel.c index 8e5be5c86e..215ba5add8 100644 --- a/audio/chmap_sel.c +++ b/audio/chmap_sel.c @@ -70,6 +70,7 @@ void mp_chmap_sel_add_waveext(struct mp_chmap_sel *s) s->allow_waveext = true; } +// Classic ALSA-based MPlayer layouts. void mp_chmap_sel_add_alsa_def(struct mp_chmap_sel *s) { for (int n = 0; n < MP_NUM_CHANNELS; n++) { diff --git a/audio/out/ao_jack.c b/audio/out/ao_jack.c index 9c38dcde97..964eb5bce6 100644 --- a/audio/out/ao_jack.c +++ b/audio/out/ao_jack.c @@ -188,6 +188,7 @@ static int init(struct ao *ao, char *params) const char **matching_ports = NULL; char *port_name = NULL; char *client_name = NULL; + char *stdlayout = NULL; int autostart = 0; int connect = 1; struct priv *p = talloc_zero(ao, struct priv); @@ -197,6 +198,7 @@ static int init(struct ao *ao, char *params) {"estimate", OPT_ARG_BOOL, &p->estimate, NULL}, {"autostart", OPT_ARG_BOOL, &autostart, NULL}, {"connect", OPT_ARG_BOOL, &connect, NULL}, + {"std-channel-layout", OPT_ARG_MSTRZ, &stdlayout, NULL}, {NULL} }; jack_options_t open_options = JackUseExactName; @@ -210,7 +212,23 @@ static int init(struct ao *ao, char *params) } struct mp_chmap_sel sel = {0}; - mp_chmap_sel_add_waveext(&sel); + + if (stdlayout) { + if (strcmp(stdlayout, "waveext") == 0) { + mp_chmap_sel_add_waveext(&sel); + } else if (strcmp(stdlayout, "alsa") == 0) { + mp_chmap_sel_add_alsa_def(&sel); + } else if (strcmp(stdlayout, "any") == 0) { + mp_chmap_sel_add_any(&sel); + } else { + mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] std-channel-layout suboption " + "expects 'alsa' or 'waveext' as value.\n"); + goto err_out; + } + } else { + mp_chmap_sel_add_waveext(&sel); + } + if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels)) goto err_out; @@ -286,12 +304,14 @@ static int init(struct ao *ao, char *params) free(matching_ports); free(port_name); free(client_name); + free(stdlayout); return 0; err_out: free(matching_ports); free(port_name); free(client_name); + free(stdlayout); if (p->client) jack_client_close(p->client); return -1; -- cgit v1.2.3