[vlc-commits] Revert "qt: fix wrong audio settings with automatic device"

Thomas Guillem git at videolan.org
Fri Mar 23 16:31:29 CET 2018


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Mar 23 16:31:27 2018 +0100| [fb7e2d81e269bd03718b9b43b20f23a333fde367] | committer: Thomas Guillem

Revert "qt: fix wrong audio settings with automatic device"

This reverts commit a32e93567b6d5d284a0f2d326f9f446f5b1c5cae.

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

 modules/gui/qt/components/simple_preferences.cpp | 36 ++++++++----------------
 modules/gui/qt/components/simple_preferences.hpp |  1 -
 2 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/modules/gui/qt/components/simple_preferences.cpp b/modules/gui/qt/components/simple_preferences.cpp
index cd65b5b2fe..da2fea5ee8 100644
--- a/modules/gui/qt/components/simple_preferences.cpp
+++ b/modules/gui/qt/components/simple_preferences.cpp
@@ -29,7 +29,6 @@
 
 #include "components/simple_preferences.hpp"
 #include "components/preferences_widgets.hpp"
-#include "input_manager.hpp"
 
 #include <vlc_config_cat.h>
 #include <vlc_configuration.h>
@@ -129,7 +128,15 @@ static struct {
 static int getDefaultAudioVolume(const char *aout)
 {
     if (!strcmp(aout, "") || !strcmp(aout, "any"))
+#ifdef _WIN32
+        /* All Windows aouts, that can be selected automatically, handle volume
+         * saving. In case of automatic mode, we'll save the last volume for
+         * every modules. Therefore, all volumes variable we be the same and we
+         * can use the first one (mmdevice). */
+        return config_GetFloat("mmdevice-volume") * 100.f + .5f;
+#else
         return -1;
+#endif
     else
     /* Note: For hysterical raisins, this is sorted by decreasing priority
      * order (then alphabetical order). */
@@ -957,36 +964,15 @@ void SPrefsPanel::updateVideoOptions( int number )
 #endif
 }
 
-char *SPrefsPanel::getAoutModuleName()
-{
-    audio_output_t *p_aout = THEMIM->getAout();
-    if (p_aout == NULL)
-        return NULL;
-
-    char *module = var_GetString(p_aout, "module-name");
-    vlc_object_release(p_aout);
-    return module;
-}
 
 void SPrefsPanel::updateAudioOptions( int number)
 {
     QString value = qobject_cast<QComboBox *>(optionWidgets["audioOutCoB"])
                                             ->itemData( number ).toString();
-
-    if (value == "any" || value == "")
-    {
-        char *module = getAoutModuleName();
-        if (module != NULL)
-        {
-            value = qfu(module);
-            free(module);
-        }
-    }
-
 #ifdef _WIN32
     /* Since MMDevice is most likely to be used by default, we show MMDevice
      * options by default */
-    const bool mmDeviceEnabled = value == "mmdevice";
+    const bool mmDeviceEnabled = value == "mmdevice" || value == "any";
     optionWidgets["mmdevicePassthroughL"]->setVisible( mmDeviceEnabled );
     optionWidgets["mmdevicePassthroughB"]->setVisible( mmDeviceEnabled );
     optionWidgets["mmdeviceW"]->setVisible( mmDeviceEnabled );
@@ -1127,12 +1113,12 @@ void SPrefsPanel::apply()
             qobject_cast<QSlider *>(optionWidgets["defaultVolume"])->value();
         bool b_reset_volume =
             qobject_cast<QCheckBox *>(optionWidgets["resetVolumeCheckbox"])->isChecked();
-        char *psz_aout = getAoutModuleName();
+        char *psz_aout = config_GetPsz( "aout" );
 
         float f_gain = powf( i_volume / 100.f, 3 );
 
 #define save_vol_aout( name ) \
-            module_exists( name ) && ( !psz_aout || !strcmp( psz_aout, name ) )
+            module_exists( name ) && ( !psz_aout || !strcmp( psz_aout, name ) || !strcmp( psz_aout, "any" ) )
 
         //FIXME this is moot
 #if defined( _WIN32 )
diff --git a/modules/gui/qt/components/simple_preferences.hpp b/modules/gui/qt/components/simple_preferences.hpp
index 6f72836972..856b88ba97 100644
--- a/modules/gui/qt/components/simple_preferences.hpp
+++ b/modules/gui/qt/components/simple_preferences.hpp
@@ -113,7 +113,6 @@ private:
     bool addType( const char * psz_ext, QTreeWidgetItem*, QTreeWidgetItem*, QVLCRegistry* );
     void saveLang();
 #endif
-    char *getAoutModuleName();
 
 /* Display only the options for the selected audio output */
 private slots:



More information about the vlc-commits mailing list