diff options
author | wm4 <wm4@nowhere> | 2013-07-07 18:37:55 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-07 18:37:55 +0200 |
commit | 2c732a46ba37182692748acd2b72310d21c451f8 (patch) | |
tree | 382eb3fd8d9b41e4ed4c11ff4f7de9777c3f928e /audio | |
parent | 886d982aa3677370ae280745872a90d0ebb2f769 (diff) | |
download | mpv-2c732a46ba37182692748acd2b72310d21c451f8.tar.bz2 mpv-2c732a46ba37182692748acd2b72310d21c451f8.tar.xz |
ao_jack: allow more control about channel layouts
Diffstat (limited to 'audio')
-rw-r--r-- | audio/chmap_sel.c | 1 | ||||
-rw-r--r-- | audio/out/ao_jack.c | 22 |
2 files changed, 22 insertions, 1 deletions
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; |