diff options
author | wm4 <wm4@nowhere> | 2015-03-28 23:53:49 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-03-28 23:53:49 +0100 |
commit | b561ec99ff76d677182b71062e24a3cf40c35901 (patch) | |
tree | 91fbf18f9997f9513cd038d2c7636548613a131c | |
parent | 36d1b2884955452676d9a01c0744f9ee1aeca6a1 (diff) | |
download | mpv-b561ec99ff76d677182b71062e24a3cf40c35901.tar.bz2 mpv-b561ec99ff76d677182b71062e24a3cf40c35901.tar.xz |
ao_alsa: add an option to ignore ALSA channel map negotiation
This was requested, more or less.
-rw-r--r-- | DOCS/man/ao.rst | 8 | ||||
-rw-r--r-- | audio/out/ao_alsa.c | 8 |
2 files changed, 14 insertions, 2 deletions
diff --git a/DOCS/man/ao.rst b/DOCS/man/ao.rst index fdbefbb167..60ba6348b1 100644 --- a/DOCS/man/ao.rst +++ b/DOCS/man/ao.rst @@ -55,6 +55,14 @@ Available audio output drivers are: Allow output of non-interleaved formats (if the audio decoder uses this format). Currently disabled by default, because some popular ALSA plugins are utterly broken with non-interleaved formats. + ``ingore-chmap`` + Don't read or set the channel map of the ALSA device - only request the + required number of channels, and then pass the audio as-is to it. This + option most likely should not be used. It can be useful for debugging, + or for static setups with a specially engineered ALSA configuration (in + this case you should always force the same layout with ``--audio-channels``, + or it will work only for files which use the layout implicit to your + ALSA device). .. note:: diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c index dba6b19514..1ee662ac77 100644 --- a/audio/out/ao_alsa.c +++ b/audio/out/ao_alsa.c @@ -64,6 +64,7 @@ struct priv { int cfg_mixer_index; int cfg_resample; int cfg_ni; + int cfg_ignore_chmap; }; #define BUFFER_TIME 250000 // 250ms @@ -478,7 +479,7 @@ static int init_device(struct ao *ao) CHECK_ALSA_ERROR("Unable to set access type"); struct mp_chmap dev_chmap = ao->channels; - if (AF_FORMAT_IS_IEC61937(ao->format)) { + if (AF_FORMAT_IS_IEC61937(ao->format) || p->cfg_ignore_chmap) { dev_chmap.num = 0; // disable chmap API } else if (query_chmaps(ao, &dev_chmap)) { ao->channels = dev_chmap; @@ -571,7 +572,9 @@ static int init_device(struct ao *ao) MP_VERBOSE(ao, "which we understand as: %s\n", mp_chmap_to_str(&chmap)); - if (AF_FORMAT_IS_IEC61937(ao->format)) { + if (p->cfg_ignore_chmap) { + MP_VERBOSE(ao, "user set ignore-chmap; ignoring the channel map.\n"); + } else if (AF_FORMAT_IS_IEC61937(ao->format)) { MP_VERBOSE(ao, "using spdif passthrough; ignoring the channel map.\n"); } else if (mp_chmap_is_valid(&chmap)) { if (mp_chmap_equals(&chmap, &ao->channels)) { @@ -934,6 +937,7 @@ const struct ao_driver audio_out_alsa = { OPT_STRING("mixer-name", cfg_mixer_name, 0), OPT_INTRANGE("mixer-index", cfg_mixer_index, 0, 0, 99), OPT_FLAG("non-interleaved", cfg_ni, 0), + OPT_FLAG("ignore-chmap", cfg_ignore_chmap, 0), {0} }, }; |