diff options
author | wm4 <wm4@nowhere> | 2016-08-04 20:49:20 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-08-04 20:49:20 +0200 |
commit | 0b144eac39bbae51c3f2b7683f6982eb91b66393 (patch) | |
tree | 63f0585f4dece4195da5745a4969159d9b5d8122 /audio/filter | |
parent | c30aa2340132e50994cdf168aaba011ecb4f6b0c (diff) |
audio: use --audio-channels=auto behavior, except on ALSA
This commit adds an --audio-channel=auto-safe mode, and makes it the
default. This mode behaves like "auto" with most AOs, except with
ao_alsa. The intention is to allow multichannel output by default on
sane APIs. ALSA is not sane as in it's so low level that it will e.g.
configure any layout over HDMI, even if the connected A/V receiver does
not support it. The HDMI fuckup is of course not ALSA's fault, but other
audio APIs normally isolate applications from dealing with this and
require the user to globally configure the correct output layout.
This will help with other AOs too. ao_lavc (encoding) is changed to the
new semantics as well, because it used to force stereo (perhaps because
encoding mode is supposed to produce safe files for crap devices?).
Exclusive mode output on Windows might need to be adjusted accordingly,
as it grants the same kind of low level access as ALSA (requires more
research).
In addition to the things mentioned above, the --audio-channels option
is extended to accept a set of channel layouts. This is supposed to be
the correct way to configure mpv ALSA multichannel output. You need to
put a list of channel layouts that your A/V receiver supports.
Diffstat (limited to 'audio/filter')
-rw-r--r-- | audio/filter/af_format.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/audio/filter/af_format.c b/audio/filter/af_format.c index c0fe354a39..748c5cbd52 100644 --- a/audio/filter/af_format.c +++ b/audio/filter/af_format.c @@ -29,10 +29,10 @@ struct priv { int in_format; int in_srate; - struct mp_chmap in_channels; + struct m_channels in_channels; int out_format; int out_srate; - struct mp_chmap out_channels; + struct m_channels out_channels; int fail; }; @@ -44,8 +44,8 @@ static void force_in_params(struct af_instance *af, struct mp_audio *in) if (priv->in_format != AF_FORMAT_UNKNOWN) mp_audio_set_format(in, priv->in_format); - if (priv->in_channels.num) - mp_audio_set_channels(in, &priv->in_channels); + if (priv->in_channels.num_chmaps > 0) + mp_audio_set_channels(in, &priv->in_channels.chmaps[0]); if (priv->in_srate) in->rate = priv->in_srate; @@ -58,8 +58,8 @@ static void force_out_params(struct af_instance *af, struct mp_audio *out) if (priv->out_format != AF_FORMAT_UNKNOWN) mp_audio_set_format(out, priv->out_format); - if (priv->out_channels.num) - mp_audio_set_channels(out, &priv->out_channels); + if (priv->out_channels.num_chmaps > 0) + mp_audio_set_channels(out, &priv->out_channels.chmaps[0]); if (priv->out_srate) out->rate = priv->out_srate; @@ -124,10 +124,10 @@ const struct af_info af_info_format = { .options = (const struct m_option[]) { OPT_AUDIOFORMAT("format", in_format, 0), OPT_INTRANGE("srate", in_srate, 0, 1000, 8*48000), - OPT_CHMAP("channels", in_channels, CONF_MIN, .min = 0), + OPT_CHANNELS("channels", in_channels, 0, .min = 1), OPT_AUDIOFORMAT("out-format", out_format, 0), OPT_INTRANGE("out-srate", out_srate, 0, 1000, 8*48000), - OPT_CHMAP("out-channels", out_channels, CONF_MIN, .min = 0), + OPT_CHANNELS("out-channels", out_channels, 0, .min = 1), OPT_FLAG("fail", fail, 0), {0} }, |