0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

audio: make --channels option always force the output layout

Use the --channels value directly on the AO, instead of doing it only in
the --channels=stereo (default) case and if the decoder output is not
stereo.
This commit is contained in:
wm4 2014-03-10 02:09:18 +01:00
parent 378a15564c
commit 249789c256
4 changed files with 17 additions and 18 deletions

View File

@ -179,6 +179,7 @@ Command Line Switches
``-panscanrange`` ``--video-zoom``, ``--video-pan-x/y``
``-pp ...`` ``'--vf=pp=[...]'``
``-pphelp`` ``--vf=pp:help``
``-channels`` ``--channels`` (changed semantics)
``dvdnav://`` ``dvdnav://menu``
=========================== ========================================

View File

@ -455,12 +455,10 @@ OPTIONS
Specify the CD-ROM device (default: ``/dev/cdrom``).
``--channels=<number|layout>``
Request the number of playback channels (default: 2). mpv asks the
decoder to decode the audio into as many channels as specified. Then it is
up to the decoder to fulfill the requirement. This is usually only
important when playing videos with AC-3, AAC or DTS audio. In that case
libavcodec downmixes the audio into the requested number of channels if
possible.
Request a channel layout for audio output (default: stereo). This will ask
the AO to open a device with the given channel layout. It's up to the AO
to accept this layout, or to pick a fallback or to error out if the
requested layout is not supported.
The ``--channels`` option either takes a channel number or an explicit
channel layout. Channel numbers refer to default layouts, e.g. 2 channels
@ -470,12 +468,17 @@ OPTIONS
lists speaker names, which can be used to express arbitrary channel
layouts (e.g. ``fl-fr-lfe`` is 2.1).
.. note::
You can use ``--channels=empty`` to disable this. In this case, the AO
use the channel layout as the audio filter chain indicates.
Currently, this option is not very useful. The main effect of this
option is that automatic stereo downmixing is disabled. It depends
mainly on the selected audio output and the associated audio subsystem
how playback of files with surround audio will behave.
This will also request the channel layout from the decoder. If the decoder
does not support the layout, it will fall back to its native channel layout.
(You can use ``--ad-lavc-downmix=no`` to make the decoder always output
its native layout.) Note that only some decoders support remixing audio.
Some that do include AC-3, AAC or DTS audio.
If the channel layout of the media file (i.e. the decoder) and the AO's
channel layout don't match, mpv will attempt to insert a conversion filter.
``--chapter=<start[-end]>``
Specify which chapter to start playing at. Optionally specify which

View File

@ -359,7 +359,7 @@ const m_option_t mp_opts[] = {
// force video/audio rate:
OPT_DOUBLE("fps", force_fps, CONF_MIN | M_OPT_FIXED),
OPT_INTRANGE("srate", force_srate, 0, 1000, 8*48000),
OPT_CHMAP("channels", audio_output_channels, CONF_MIN, .min = 1),
OPT_CHMAP("channels", audio_output_channels, CONF_MIN, .min = 0),
OPT_AUDIOFORMAT("format", audio_output_format, 0),
OPT_DOUBLE("speed", playback_speed, M_OPT_RANGE | M_OPT_FIXED,
.min = 0.01, .max = 100.0),

View File

@ -143,12 +143,7 @@ void reinit_audio_chain(struct MPContext *mpctx)
ao_format = out_format.format;
ao_channels = out_format.channels;
} else {
// Automatic downmix
if (mp_chmap_is_stereo(&opts->audio_output_channels) &&
!mp_chmap_is_stereo(&in_format.channels))
{
mp_chmap_from_channels(&ao_channels, 2);
}
ao_channels = opts->audio_output_channels; // automatic downmix
}
// Determine what the filter chain outputs. build_afilter_chain() also