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

Thomas Guillem git at videolan.org
Wed Jul 19 18:57:32 CEST 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Jul 18 10:09:21 2017 +0200| [a85ca0ed58e185ff52050ed2bb441e53e0fdd2e0] | committer: Thomas Guillem

aout: add headphones option in stereo-mode

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

 include/vlc_aout.h        |  1 +
 src/audio_output/output.c | 10 ++++++++++
 src/libvlc-module.c       |  6 ++++--
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index 983936e7c9..c352634120 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -95,6 +95,7 @@
 #define AOUT_VAR_CHAN_LEFT          3
 #define AOUT_VAR_CHAN_RIGHT         4
 #define AOUT_VAR_CHAN_DOLBYS        5
+#define AOUT_VAR_CHAN_HEADPHONES    6
 
 /*****************************************************************************
  * Main audio output structures
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 7c30ed0ece..34f5bc8cc3 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -453,6 +453,13 @@ int aout_OutputNew (audio_output_t *aout, audio_sample_format_t *restrict fmt,
     txt.psz_string = _("Reverse stereo");
     var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
 
+    if (fmt->i_channels >= 2)
+    {
+        val.i_int = AOUT_VAR_CHAN_HEADPHONES;
+        txt.psz_string = _("Headphones");
+        var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
+    }
+
     /* The user may have selected a different channels configuration. */
     switch (i_forced_stereo_mode)
     {
@@ -471,6 +478,9 @@ int aout_OutputNew (audio_output_t *aout, audio_sample_format_t *restrict fmt,
         case AOUT_VAR_CHAN_DOLBYS:
             fmt->i_chan_mode = AOUT_CHANMODE_DOLBYSTEREO;
             break;
+        case AOUT_VAR_CHAN_HEADPHONES:
+            filters_cfg->headphones = true;
+            break;
         default:
             if (b_stereo_original && fmt->i_chan_mode & AOUT_CHANMODE_DUALMONO)
             {   /* Go directly to the left channel. */
diff --git a/src/libvlc-module.c b/src/libvlc-module.c
index d3a446e832..cc25c94c26 100644
--- a/src/libvlc-module.c
+++ b/src/libvlc-module.c
@@ -187,11 +187,13 @@ static const char *const ppsz_force_dolby_descriptions[] = {
 #define STEREO_MODE_TEXT N_("Stereo audio output mode")
 static const int pi_stereo_mode_values[] = { AOUT_VAR_CHAN_UNSET,
     AOUT_VAR_CHAN_STEREO, AOUT_VAR_CHAN_RSTEREO,
-    AOUT_VAR_CHAN_LEFT, AOUT_VAR_CHAN_RIGHT, AOUT_VAR_CHAN_DOLBYS
+    AOUT_VAR_CHAN_LEFT, AOUT_VAR_CHAN_RIGHT, AOUT_VAR_CHAN_DOLBYS,
+    AOUT_VAR_CHAN_HEADPHONES,
 };
 static const char *const ppsz_stereo_mode_texts[] = { N_("Unset"),
     N_("Stereo"), N_("Reverse stereo"),
-    N_("Left"), N_("Right"), N_("Dolby Surround")
+    N_("Left"), N_("Right"), N_("Dolby Surround"),
+    N_("Headphones"),
 };
 
 #define AUDIO_FILTER_TEXT N_("Audio filters")



More information about the vlc-commits mailing list