[vlc-devel] [PATCH 2/3] aout: select headphones stereo-mode if aout is using headphones

Thomas Guillem thomas at gllm.fr
Thu Jul 20 14:59:29 CEST 2017


Select it only if it's needed (ambisonics or channels count higher than 2) and
if the user didn't forced it.
---
 src/audio_output/output.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 23c9aa6bfc..a2fe2b39c0 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -449,6 +449,15 @@ static void aout_PrepareStereoMode (audio_output_t *aout,
         val.i_int = AOUT_VAR_CHAN_HEADPHONES;
         txt.psz_string = _("Headphones");
         var_Change (aout, "stereo-mode", VLC_VAR_ADDCHOICE, &val, &txt);
+
+        if (i_forced_stereo_mode == AOUT_VAR_CHAN_UNSET
+         && aout->current_sink_info.headphones)
+        {
+            i_forced_stereo_mode = AOUT_VAR_CHAN_HEADPHONES;
+            default_val.i_int = val.i_int;
+            var_Change (aout, "stereo-mode", VLC_VAR_SETVALUE, &default_val,
+                        NULL);
+        }
     }
 
     /* The user may have selected a different channels configuration. */
-- 
2.11.0



More information about the vlc-devel mailing list