[vlc-commits] aout: add Mono in "stereo-mode" option

Thomas Guillem git at videolan.org
Mon Jan 22 10:07:40 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jan 22 09:19:15 2018 +0100| [33f1935c1c71751ff6d5e30d6152cfb33c9bc478] | committer: Jean-Baptiste Kempf

aout: add Mono in "stereo-mode" option

Can be used to remix all input channels into one.

Close #8341 #18559

(cherry picked from commit 77e46ee5e95bd41ac0cb51140b1134e5c35cdba1)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=33f1935c1c71751ff6d5e30d6152cfb33c9bc478
---

 include/vlc_aout.h        |  1 +
 src/audio_output/output.c | 12 ++++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index 5e5690fb1d..62338bae4f 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -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
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index ff4eda24c4..0549de044d 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -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)



More information about the vlc-commits mailing list