[vlc-devel] [PATCH 2/6] aout: move out stereo-mode update from current_sink_info

Thomas Guillem thomas at gllm.fr
Thu Jul 16 14:25:31 CEST 2020


current_sink_info can only be known when the aout is started.
---
 src/audio_output/output.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index ee3e37678a2..24af7225fb6 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -451,9 +451,6 @@ static int aout_PrepareStereoMode(audio_output_t *aout,
         val.i_int = AOUT_VAR_CHAN_HEADPHONES;
         var_Change(aout, "stereo-mode", VLC_VAR_ADDCHOICE, val,
                    _("Headphones"));
-
-        if (aout->current_sink_info.headphones)
-            i_default_mode = AOUT_VAR_CHAN_HEADPHONES;
     }
 
     return i_default_mode;
@@ -626,6 +623,13 @@ int aout_OutputNew (audio_output_t *aout)
         int stereo_mode = aout_HasStereoMode(aout, owner->requested_stereo_mode) ?
                           owner->requested_stereo_mode : default_stereo_mode;
 
+        /* Autoselect the headphones mode if available and if the user didn't
+         * request any mode */
+        if (aout->current_sink_info.headphones
+         && owner->requested_stereo_mode == AOUT_VAR_CHAN_UNSET
+         && aout_HasStereoMode(aout, AOUT_VAR_CHAN_HEADPHONES))
+            stereo_mode = AOUT_VAR_CHAN_HEADPHONES;
+
         aout_UpdateStereoMode(aout, stereo_mode, fmt, filters_cfg);
     }
 
-- 
2.20.1



More information about the vlc-devel mailing list