aout: add Mono in "stereo-mode" option

Can be used to remix all input channels into one.

Close #8341 #18559

(cherry picked from commit 77e46ee5e9)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
This commit is contained in:
Thomas Guillem 2018-01-22 09:19:15 +01:00 committed by Jean-Baptiste Kempf
parent 8719301547
commit 33f1935c1c
2 changed files with 13 additions and 0 deletions

View File

@ -96,6 +96,7 @@
#define AOUT_VAR_CHAN_RIGHT 4
#define AOUT_VAR_CHAN_DOLBYS 5
#define AOUT_VAR_CHAN_HEADPHONES 6
#define AOUT_VAR_CHAN_MONO 7
/*****************************************************************************
* Main audio output structures

View File

@ -415,6 +415,13 @@ static void aout_PrepareStereoMode (audio_output_t *aout,
if (!AOUT_FMT_LINEAR(fmt))
return;
if (i_nb_input_channels > 1)
{
val.i_int = AOUT_VAR_CHAN_MONO;
txt.psz_string = _("Mono");
var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
}
if (i_nb_input_channels != 2)
{
val.i_int = AOUT_VAR_CHAN_UNSET;
@ -487,6 +494,11 @@ static void aout_PrepareStereoMode (audio_output_t *aout,
case AOUT_VAR_CHAN_HEADPHONES:
filters_cfg->headphones = true;
break;
case AOUT_VAR_CHAN_MONO:
/* Remix all channels into one */
for (size_t i = 0; i < AOUT_CHANIDX_MAX; ++ i)
filters_cfg->remap[i] = AOUT_CHANIDX_LEFT;
break;
default:
if (i_nb_input_channels == 2
&& fmt->i_chan_mode & AOUT_CHANMODE_DUALMONO)