]> git.sesse.net Git - vlc/blobdiff - bindings/phonon/vlc/devicemanager.cpp
phonon: Add specific support for PulseAudio.
[vlc] / bindings / phonon / vlc / devicemanager.cpp
index 3bea98c7098e2f306a17d4f7c2e7c712f17b6b54..18db2f7292c4f3c4be46847dc0aecc65c6a4e5fa 100644 (file)
 //#include "widgetrenderer.h"
 #include "vlcloader.h"
 
+#ifdef PHONON_PULSESUPPORT
+#  include <phonon/pulsesupport.h>
+#endif
+
 /**
  * This class manages the list of currently active output devices.
  */
@@ -102,13 +106,30 @@ void DeviceManager::updateDeviceList()
     vlcExceptionRaised();
     libvlc_audio_output_t *p_start = p_ao_list;
 
+    bool checkpulse = false;
+#ifdef PHONON_PULSESUPPORT
+    PulseSupport *pulse = PulseSupport::getInstance();
+    checkpulse = pulse->isActive();
+#endif
+    bool haspulse = false;
     while (p_ao_list) {
+        if (checkpulse && 0 == strcmp(p_ao_list->psz_name, "pulse")) {
+            haspulse = true;
+            break;
+        }
         list.append(p_ao_list->psz_name);
         list_hw.append("");
         p_ao_list = p_ao_list->p_next;
     }
     libvlc_audio_output_list_release(p_start);
 
+
+#ifdef PHONON_PULSESUPPORT
+    if (haspulse)
+        return;
+    pulse->enable(false);
+#endif
+
     for (int i = 0 ; i < list.size() ; ++i) {
         QByteArray nameId = list.at(i);
         QByteArray hwId = list_hw.at(i);