rpms/kdemultimedia/F-13 .cvsignore, 1.80, 1.81 kdemultimedia.spec, 1.177, 1.178 kmix-pulse.patch, 1.1, 1.2 sources, 1.80, 1.81

Rex Dieter rdieter at fedoraproject.org
Sat Apr 3 15:37:22 UTC 2010


Author: rdieter

Update of /cvs/pkgs/rpms/kdemultimedia/F-13
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv15430/F-13

Modified Files:
	.cvsignore kdemultimedia.spec kmix-pulse.patch sources 
Log Message:
sync w/devel branch



Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/kdemultimedia/F-13/.cvsignore,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -p -r1.80 -r1.81
--- .cvsignore	2 Mar 2010 14:18:18 -0000	1.80
+++ .cvsignore	3 Apr 2010 15:37:21 -0000	1.81
@@ -1 +1 @@
-kdemultimedia-4.4.1.tar.bz2
+kdemultimedia-4.4.2.tar.bz2


Index: kdemultimedia.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdemultimedia/F-13/kdemultimedia.spec,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -p -r1.177 -r1.178
--- kdemultimedia.spec	12 Mar 2010 17:47:08 -0000	1.177
+++ kdemultimedia.spec	3 Apr 2010 15:37:21 -0000	1.178
@@ -1,7 +1,7 @@
 
 Name:    kdemultimedia
 Epoch:   6
-Version: 4.4.1
+Version: 4.4.2
 Release: 2%{?dist}
 Summary: KDE Multimedia applications
 
@@ -13,6 +13,7 @@ Source0: ftp://ftp.kde.org/pub/kde/stabl
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 Patch1: kdemultimedia-4.3.75-nomplayerthumbs.patch
+# FIXME
 Patch2: kdemultimedia-4.3.75-kscd_doc.patch
 # git clone git://colin.guthr.ie/kdemultimedia
 # git checkout -t origin/pulse
@@ -37,8 +38,9 @@ BuildRequires: taglib-devel
 %if 0%{?fedora}
 BuildRequires: xine-lib-devel libxcb-devel
 # needed to build Kscd, keep
+%define kscd 1
 BuildRequires: libtunepimp-devel libmusicbrainz-devel
-%global mplayerthumbs 1
+%define mplayerthumbs 1
 %endif
 
 Requires: %{name}-libs%{?isa} = %{?epoch:%{epoch}:}%{version}-%{release}
@@ -57,7 +59,7 @@ The %{name} package contains multimedia 
 * dragonplayer (a simple video player)
 * juk (a music manager and player)
 * kmix (an audio mixer)
-%if 0%{?fedora}
+%if 0%{?kscd}
 * kscd (an Audio-CD player)
 %endif
 
@@ -88,7 +90,9 @@ Requires: kdelibs4-devel
 %if ! 0%{?mplayerthumbs}
 %patch1 -p1 -b .nomplayerthumbs
 %endif
+%if ! 0%{?kscd}
 %patch2 -p1 -b .kscd_doc
+%endif
 %patch3 -p1 -b .kmix-pulse
 
 
@@ -144,12 +148,12 @@ fi
 %{_kde4_appsdir}/kmix/
 %{_kde4_appsdir}/kconf_update/*
 %{_kde4_appsdir}/konqsidebartng/
-%if 0%{?fedora}
+%if 0%{?kscd}
 %{_kde4_appsdir}/profiles/
 %{_kde4_appsdir}/kscd/
 %{_kde4_appsdir}/solid/actions/kscd-play-audiocd.desktop
 %{_kde4_appsdir}/solid/actions/solid_audiocd.desktop
-%{_kde4_docdir}/HTML/en/kscd/
+%{_kde4_docdir}/HTML/en/kcontrol/cddbretrieval/
 %{_kde4_iconsdir}/oxygen/*/actions/kscd-dock.*
 %endif
 %{_kde4_appsdir}/solid/actions/dragonplayer-opendvd.desktop
@@ -185,6 +189,13 @@ fi
 
 
 %changelog
+* Sat Apr 03 2010 Rex Dieter <rdieter at fedoraproject.org> - 6:4.4.2-2
+- sync kmix-pulse.patch : connect without a QEventLoop which can cause
+  some strange issues
+
+* Mon Mar 29 2010 Lukas Tinkl <ltinkl at redhat.com> - 6:4.4.2-1
+- 4.4.2
+
 * Fri Mar 12 2010 Rex Dieter <rdieter at fedoraproject.org> - 6:4.4.1-2
 - sync kmix-pulse.patch from mdv
 

kmix-pulse.patch:
 CMakeLists.txt              |    1 
 KMixApp.cpp                 |   14 
 dialogviewconfiguration.cpp |    4 
 kmix-platforms.cpp          |    8 
 kmix.cpp                    |   53 +
 kmix.h                      |    1 
 kmixerwidget.cpp            |    2 
 kmixerwidget.h              |    1 
 kmixprefdlg.h               |    2 
 main.cpp                    |    1 
 mdwmoveaction.cpp           |   48 +
 mdwmoveaction.h             |   46 +
 mdwslider.cpp               |  158 ++---
 mdwslider.h                 |   14 
 mixdevice.cpp               |  105 ++-
 mixdevice.h                 |   15 
 mixdevicewidget.cpp         |    1 
 mixdevicewidget.h           |    2 
 mixer.cpp                   |   27 
 mixer.h                     |    9 
 mixer_alsa9.cpp             |    4 
 mixer_backend.cpp           |   17 
 mixer_backend.h             |    6 
 mixer_pulse.cpp             | 1337 +++++++++++++++++++++++++++++++++++++-------
 mixer_pulse.h               |   63 +-
 mixertoolbox.cpp            |  147 ++--
 mixertoolbox.h              |    3 
 verticaltext.cpp            |    7 
 verticaltext.h              |    1 
 viewbase.cpp                |   72 ++
 viewbase.h                  |    7 
 viewdockareapopup.cpp       |   51 +
 viewdockareapopup.h         |    3 
 viewsliders.cpp             |   18 
 viewsliders.h               |    4 
 35 files changed, 1842 insertions(+), 410 deletions(-)

Index: kmix-pulse.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kdemultimedia/F-13/kmix-pulse.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- kmix-pulse.patch	12 Mar 2010 17:47:08 -0000	1.1
+++ kmix-pulse.patch	3 Apr 2010 15:37:21 -0000	1.2
@@ -1,12 +1,12 @@
 diff --git a/kmix/CMakeLists.txt b/kmix/CMakeLists.txt
-index 4880470..d7929da 100644
+index 4880470..6578b3a 100644
 --- a/kmix/CMakeLists.txt
 +++ b/kmix/CMakeLists.txt
 @@ -18,6 +18,7 @@ set(kmix_KDEINIT_SRCS ${kmix_adaptor_SRCS}
     viewdockareapopup.cpp 
     viewsliders.cpp 
     mixdevicewidget.cpp 
-+   mdwmoveaction.cpp 
++   mdwmoveaction.cpp
     mdwslider.cpp 
     mdwenum.cpp 
     kmixerwidget.cpp 
@@ -93,7 +93,7 @@ index f7b8c9a..5f61989 100644
  };
  
 diff --git a/kmix/kmix.cpp b/kmix/kmix.cpp
-index 5973338..88b40b0 100644
+index 30cc5d4..37a9066 100644
 --- a/kmix/kmix.cpp
 +++ b/kmix/kmix.cpp
 @@ -49,6 +49,7 @@
@@ -104,7 +104,7 @@ index 5973338..88b40b0 100644
  #include "mixertoolbox.h"
  #include "kmix.h"
  #include "kmixdevicemanager.h"
-@@ -407,11 +408,30 @@ void KMixWindow::recreateGUIwithoutSavingView()
+@@ -399,11 +400,30 @@ void KMixWindow::recreateGUIwithoutSavingView()
   */
  void KMixWindow::recreateGUI(bool saveConfig)
  {
@@ -135,7 +135,7 @@ index 5973338..88b40b0 100644
           addMixerWidget(mixer->id());
        }
        bool dockingSucceded = updateDocking();
-@@ -423,6 +443,39 @@ void KMixWindow::recreateGUI(bool saveConfig)
+@@ -415,6 +435,39 @@ void KMixWindow::recreateGUI(bool saveConfig)
         updateDocking();  // -<- removes the DockIcon
         hide();
     }
@@ -176,10 +176,10 @@ index 5973338..88b40b0 100644
  
  
 diff --git a/kmix/kmix.h b/kmix/kmix.h
-index 2083803..96c4cd2 100644
+index 7fca083..81774ea 100644
 --- a/kmix/kmix.h
 +++ b/kmix/kmix.h
-@@ -88,6 +88,7 @@ KMixWindow : public KXmlGuiWindow
+@@ -87,6 +87,7 @@ KMixWindow : public KXmlGuiWindow
     virtual void applyPrefs( KMixPrefDlg *prefDlg );
     void recreateGUI(bool saveView);
     void recreateGUIwithoutSavingView();
@@ -1074,7 +1074,7 @@ index 22d3792..00e2999 100644
  {
    QString l_s_errText;
 diff --git a/kmix/mixer_backend.h b/kmix/mixer_backend.h
-index 26e9557..cd17b2f 100644
+index 26e9557..bc147b2 100644
 --- a/kmix/mixer_backend.h
 +++ b/kmix/mixer_backend.h
 @@ -81,6 +81,8 @@ protected:
@@ -1092,26 +1092,27 @@ index 26e9557..cd17b2f 100644
    void controlChanged( void );
 +  void controlsReconfigured( const QString& mixer_ID );
 +
-+public slots:  
++public slots:
 +  virtual void reinit() {};
  
  protected slots:
    virtual void readSetFromHW();
 diff --git a/kmix/mixer_pulse.cpp b/kmix/mixer_pulse.cpp
-index 694b9a9..0950a73 100644
+index 694b9a9..5a68738 100644
 --- a/kmix/mixer_pulse.cpp
 +++ b/kmix/mixer_pulse.cpp
-@@ -20,12 +20,812 @@
+@@ -20,12 +20,779 @@
   */
  
  #include <cstdlib>
-+#include <QEventLoop>
++#include <QtCore/QAbstractEventDispatcher>
 +#include <QTimer>
  
  #include "mixer_pulse.h"
  #include "mixer.h"
  
 -static pa_context *context = NULL;
+-static pa_glib_mainloop *mainloop = NULL;
 +#include <pulse/glib-mainloop.h>
 +#include <pulse/ext-stream-restore.h>
 +
@@ -1123,13 +1124,12 @@ index 694b9a9..0950a73 100644
 +#define KMIXPA_WIDGET_MAX KMIXPA_APP_CAPTURE
 +
 +static unsigned int refcount = 0;
- static pa_glib_mainloop *mainloop = NULL;
-+static pa_context *context = NULL;
-+static QEventLoop *s_connectionEventloop = NULL;
++static pa_glib_mainloop *s_mainloop = NULL;
++static pa_context *s_context = NULL;
 +static enum { UNKNOWN, ACTIVE, INACTIVE } s_pulseActive = UNKNOWN;
-+static int s_OutstandingRequests = 0;
++static int s_outstandingRequests = 0;
 +
-+QMap<int,Mixer_PULSE*> s_Mixers;
++QMap<int,Mixer_PULSE*> s_mixers;
 +
 +typedef QMap<int,devinfo> devmap;
 +static devmap outputDevices;
@@ -1147,25 +1147,19 @@ index 694b9a9..0950a73 100644
 +} restoreRule;
 +static QMap<QString,restoreRule> s_RestoreRules;
 +
-+static void dec_outstanding() {
-+    if (s_OutstandingRequests <= 0)
++static void dec_outstanding(pa_context *c) {
++    if (s_outstandingRequests <= 0)
 +        return;
 +
-+    if (--s_OutstandingRequests == 0)
++    if (--s_outstandingRequests == 0)
 +    {
 +        s_pulseActive = ACTIVE;
-+        if (s_connectionEventloop) {
-+            s_connectionEventloop->exit(0);
-+            s_connectionEventloop = NULL;
-+
-+            // If we have no devices then we consider PA to be 'INACTIVE'
-+            if (outputDevices.isEmpty() && captureDevices.isEmpty())
-+                s_pulseActive = INACTIVE;
-+            else {
-+                s_pulseActive = ACTIVE;
-+                kDebug(67100) <<  "PulseAudio status: [Re]connected \\o/";
-+            }
-+        }
++
++        // If this is our probe phase, exit our context immediately
++        if (s_context != c) {
++            pa_context_disconnect(c);
++        } else
++          kDebug(67100) <<  "Reconnected to PulseAudio";
 +    }
 +}
 +
@@ -1265,8 +1259,6 @@ index 694b9a9..0950a73 100644
 +
 +static void sink_cb(pa_context *c, const pa_sink_info *i, int eol, void *) {
 +
-+    Q_ASSERT(c == context);
-+
 +    if (eol < 0) {
 +        if (pa_context_errno(c) == PA_ERR_NOENTITY)
 +            return;
@@ -1276,9 +1268,9 @@ index 694b9a9..0950a73 100644
 +    }
 +
 +    if (eol > 0) {
-+        dec_outstanding();
-+        if (s_Mixers.contains(KMIXPA_PLAYBACK))
-+            s_Mixers[KMIXPA_PLAYBACK]->triggerUpdate();
++        dec_outstanding(c);
++        if (s_mixers.contains(KMIXPA_PLAYBACK))
++            s_mixers[KMIXPA_PLAYBACK]->triggerUpdate();
 +        return;
 +    }
 +
@@ -1298,13 +1290,13 @@ index 694b9a9..0950a73 100644
 +    outputDevices[s.index] = s;
 +    kDebug(67100) << "Got some info about sink: " << s.description;
 +
-+    if (s_Mixers.contains(KMIXPA_PLAYBACK)) {
++    if (s_mixers.contains(KMIXPA_PLAYBACK)) {
 +        if (is_new)
-+            s_Mixers[KMIXPA_PLAYBACK]->addWidget(s.index);
++            s_mixers[KMIXPA_PLAYBACK]->addWidget(s.index);
 +        else {
-+            int mid = s_Mixers[KMIXPA_PLAYBACK]->id2num(s.name);
++            int mid = s_mixers[KMIXPA_PLAYBACK]->id2num(s.name);
 +            if (mid >= 0) {
-+                MixSet *ms = s_Mixers[KMIXPA_PLAYBACK]->getMixSet();
++                MixSet *ms = s_mixers[KMIXPA_PLAYBACK]->getMixSet();
 +                (*ms)[mid]->setReadableName(s.description);
 +            }
 +        }
@@ -1313,8 +1305,6 @@ index 694b9a9..0950a73 100644
 +
 +static void source_cb(pa_context *c, const pa_source_info *i, int eol, void *) {
 +
-+    Q_ASSERT(c == context);
-+
 +    if (eol < 0) {
 +        if (pa_context_errno(c) == PA_ERR_NOENTITY)
 +            return;
@@ -1324,9 +1314,9 @@ index 694b9a9..0950a73 100644
 +    }
 +
 +    if (eol > 0) {
-+        dec_outstanding();
-+        if (s_Mixers.contains(KMIXPA_CAPTURE))
-+            s_Mixers[KMIXPA_CAPTURE]->triggerUpdate();
++        dec_outstanding(c);
++        if (s_mixers.contains(KMIXPA_CAPTURE))
++            s_mixers[KMIXPA_CAPTURE]->triggerUpdate();
 +        return;
 +    }
 +
@@ -1353,13 +1343,13 @@ index 694b9a9..0950a73 100644
 +    captureDevices[s.index] = s;
 +    kDebug(67100) << "Got some info about source: " << s.description;
 +
-+    if (s_Mixers.contains(KMIXPA_CAPTURE)) {
++    if (s_mixers.contains(KMIXPA_CAPTURE)) {
 +        if (is_new)
-+            s_Mixers[KMIXPA_CAPTURE]->addWidget(s.index);
++            s_mixers[KMIXPA_CAPTURE]->addWidget(s.index);
 +        else {
-+            int mid = s_Mixers[KMIXPA_CAPTURE]->id2num(s.name);
++            int mid = s_mixers[KMIXPA_CAPTURE]->id2num(s.name);
 +            if (mid >= 0) {
-+                MixSet *ms = s_Mixers[KMIXPA_CAPTURE]->getMixSet();
++                MixSet *ms = s_mixers[KMIXPA_CAPTURE]->getMixSet();
 +                (*ms)[mid]->setReadableName(s.description);
 +            }
 +        }
@@ -1368,8 +1358,6 @@ index 694b9a9..0950a73 100644
 +
 +static void client_cb(pa_context *c, const pa_client_info *i, int eol, void *) {
 +
-+    Q_ASSERT(c == context);
-+
 +    if (eol < 0) {
 +        if (pa_context_errno(c) == PA_ERR_NOENTITY)
 +            return;
@@ -1379,7 +1367,7 @@ index 694b9a9..0950a73 100644
 +    }
 +
 +    if (eol > 0) {
-+        dec_outstanding();
++        dec_outstanding(c);
 +        return;
 +    }
 +
@@ -1389,8 +1377,6 @@ index 694b9a9..0950a73 100644
 +
 +static void sink_input_cb(pa_context *c, const pa_sink_input_info *i, int eol, void *) {
 +
-+    Q_ASSERT(c == context);
-+
 +    if (eol < 0) {
 +        if (pa_context_errno(c) == PA_ERR_NOENTITY)
 +            return;
@@ -1400,9 +1386,9 @@ index 694b9a9..0950a73 100644
 +    }
 +
 +    if (eol > 0) {
-+        dec_outstanding();
-+        if (s_Mixers.contains(KMIXPA_APP_PLAYBACK))
-+            s_Mixers[KMIXPA_APP_PLAYBACK]->triggerUpdate();
++        dec_outstanding(c);
++        if (s_mixers.contains(KMIXPA_APP_PLAYBACK))
++            s_mixers[KMIXPA_APP_PLAYBACK]->triggerUpdate();
 +        return;
 +    }
 +
@@ -1435,13 +1421,13 @@ index 694b9a9..0950a73 100644
 +    outputStreams[s.index] = s;
 +    kDebug(67100) << "Got some info about sink input (playback stream): " << s.description;
 +
-+    if (s_Mixers.contains(KMIXPA_APP_PLAYBACK)) {
++    if (s_mixers.contains(KMIXPA_APP_PLAYBACK)) {
 +        if (is_new)
-+            s_Mixers[KMIXPA_APP_PLAYBACK]->addWidget(s.index);
++            s_mixers[KMIXPA_APP_PLAYBACK]->addWidget(s.index);
 +        else {
-+            int mid = s_Mixers[KMIXPA_APP_PLAYBACK]->id2num(s.name);
++            int mid = s_mixers[KMIXPA_APP_PLAYBACK]->id2num(s.name);
 +            if (mid >= 0) {
-+                MixSet *ms = s_Mixers[KMIXPA_APP_PLAYBACK]->getMixSet();
++                MixSet *ms = s_mixers[KMIXPA_APP_PLAYBACK]->getMixSet();
 +                (*ms)[mid]->setReadableName(s.description);
 +            }
 +        }
@@ -1450,8 +1436,6 @@ index 694b9a9..0950a73 100644
 +
 +static void source_output_cb(pa_context *c, const pa_source_output_info *i, int eol, void *) {
 +
-+    Q_ASSERT(c == context);
-+
 +    if (eol < 0) {
 +        if (pa_context_errno(c) == PA_ERR_NOENTITY)
 +            return;
@@ -1461,9 +1445,9 @@ index 694b9a9..0950a73 100644
 +    }
 +
 +    if (eol > 0) {
-+        dec_outstanding();
-+        if (s_Mixers.contains(KMIXPA_APP_CAPTURE))
-+            s_Mixers[KMIXPA_APP_CAPTURE]->triggerUpdate();
++        dec_outstanding(c);
++        if (s_mixers.contains(KMIXPA_APP_CAPTURE))
++            s_mixers[KMIXPA_APP_CAPTURE]->triggerUpdate();
 +        return;
 +    }
 +
@@ -1496,13 +1480,13 @@ index 694b9a9..0950a73 100644
 +    captureStreams[s.index] = s;
 +    kDebug(67100) << "Got some info about source output (capture stream): " << s.description;
 +
-+    if (s_Mixers.contains(KMIXPA_APP_CAPTURE)) {
++    if (s_mixers.contains(KMIXPA_APP_CAPTURE)) {
 +        if (is_new)
-+            s_Mixers[KMIXPA_APP_CAPTURE]->addWidget(s.index);
++            s_mixers[KMIXPA_APP_CAPTURE]->addWidget(s.index);
 +        else {
-+            int mid = s_Mixers[KMIXPA_APP_CAPTURE]->id2num(s.name);
++            int mid = s_mixers[KMIXPA_APP_CAPTURE]->id2num(s.name);
 +            if (mid >= 0) {
-+                MixSet *ms = s_Mixers[KMIXPA_APP_CAPTURE]->getMixSet();
++                MixSet *ms = s_mixers[KMIXPA_APP_CAPTURE]->getMixSet();
 +                (*ms)[mid]->setReadableName(s.description);
 +            }
 +        }
@@ -1531,16 +1515,14 @@ index 694b9a9..0950a73 100644
 +
 +void ext_stream_restore_read_cb(pa_context *c, const pa_ext_stream_restore_info *i, int eol, void *) {
 +
-+    Q_ASSERT(c == context);
-+
 +    if (eol < 0) {
-+        dec_outstanding();
-+        kWarning(67100) << "Failed to initialize stream_restore extension: " << pa_strerror(pa_context_errno(context));
++        dec_outstanding(c);
++        kWarning(67100) << "Failed to initialize stream_restore extension: " << pa_strerror(pa_context_errno(s_context));
 +        return;
 +    }
 +
 +    if (eol > 0) {
-+        dec_outstanding();
++        dec_outstanding(c);
 +        // Special case: ensure that our media events exists.
 +        // On first login by a new users, this wont be in our database so we should create it.
 +        if (!outputRoles.contains(PA_INVALID_INDEX)) {
@@ -1558,12 +1540,12 @@ index 694b9a9..0950a73 100644
 +            outputRoles[s.index] = s;
 +            kDebug(67100) << "Initialising restore rule for new user: " << s.description;
 +
-+            if (s_Mixers.contains(KMIXPA_APP_PLAYBACK))
-+                s_Mixers[KMIXPA_APP_PLAYBACK]->addWidget(s.index);
++            if (s_mixers.contains(KMIXPA_APP_PLAYBACK))
++                s_mixers[KMIXPA_APP_PLAYBACK]->addWidget(s.index);
 +        }
 +
-+        if (s_Mixers.contains(KMIXPA_APP_PLAYBACK))
-+            s_Mixers[KMIXPA_APP_PLAYBACK]->triggerUpdate();
++        if (s_mixers.contains(KMIXPA_APP_PLAYBACK))
++            s_mixers[KMIXPA_APP_PLAYBACK]->triggerUpdate();
 +        return;
 +    }
 +
@@ -1581,14 +1563,14 @@ index 694b9a9..0950a73 100644
 +        bool is_new = !outputRoles.contains(s.index);
 +        outputRoles[s.index] = s;
 +
-+        if (is_new && s_Mixers.contains(KMIXPA_APP_PLAYBACK))
-+            s_Mixers[KMIXPA_APP_PLAYBACK]->addWidget(s.index);
++        if (is_new && s_mixers.contains(KMIXPA_APP_PLAYBACK))
++            s_mixers[KMIXPA_APP_PLAYBACK]->addWidget(s.index);
 +    }
 +}
 +
 +static void ext_stream_restore_subscribe_cb(pa_context *c, void *) {
 +
-+    Q_ASSERT(c == context);
++    Q_ASSERT(c == s_context);
 +
 +    pa_operation *o;
 +    if (!(o = pa_ext_stream_restore_read(c, ext_stream_restore_read_cb, NULL))) {
@@ -1602,13 +1584,13 @@ index 694b9a9..0950a73 100644
 +
 +static void subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t index, void *) {
 +
-+    Q_ASSERT(c == context);
++    Q_ASSERT(c == s_context);
 +
 +    switch (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) {
 +        case PA_SUBSCRIPTION_EVENT_SINK:
 +            if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
-+                if (s_Mixers.contains(KMIXPA_PLAYBACK))
-+                    s_Mixers[KMIXPA_PLAYBACK]->removeWidget(index);
++                if (s_mixers.contains(KMIXPA_PLAYBACK))
++                    s_mixers[KMIXPA_PLAYBACK]->removeWidget(index);
 +            } else {
 +                pa_operation *o;
 +                if (!(o = pa_context_get_sink_info_by_index(c, index, sink_cb, NULL))) {
@@ -1621,8 +1603,8 @@ index 694b9a9..0950a73 100644
 +
 +        case PA_SUBSCRIPTION_EVENT_SOURCE:
 +            if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
-+                if (s_Mixers.contains(KMIXPA_CAPTURE))
-+                    s_Mixers[KMIXPA_CAPTURE]->removeWidget(index);
++                if (s_mixers.contains(KMIXPA_CAPTURE))
++                    s_mixers[KMIXPA_CAPTURE]->removeWidget(index);
 +            } else {
 +                pa_operation *o;
 +                if (!(o = pa_context_get_source_info_by_index(c, index, source_cb, NULL))) {
@@ -1635,8 +1617,8 @@ index 694b9a9..0950a73 100644
 +
 +        case PA_SUBSCRIPTION_EVENT_SINK_INPUT:
 +            if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
-+                if (s_Mixers.contains(KMIXPA_APP_PLAYBACK))
-+                    s_Mixers[KMIXPA_APP_PLAYBACK]->removeWidget(index);
++                if (s_mixers.contains(KMIXPA_APP_PLAYBACK))
++                    s_mixers[KMIXPA_APP_PLAYBACK]->removeWidget(index);
 +            } else {
 +                pa_operation *o;
 +                if (!(o = pa_context_get_sink_input_info(c, index, sink_input_cb, NULL))) {
@@ -1649,8 +1631,8 @@ index 694b9a9..0950a73 100644
 +
 +        case PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT:
 +            if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
-+                if (s_Mixers.contains(KMIXPA_APP_CAPTURE))
-+                    s_Mixers[KMIXPA_APP_CAPTURE]->removeWidget(index);
++                if (s_mixers.contains(KMIXPA_APP_CAPTURE))
++                    s_mixers[KMIXPA_APP_CAPTURE]->removeWidget(index);
 +            } else {
 +                pa_operation *o;
 +                if (!(o = pa_context_get_source_output_info(c, index, source_output_cb, NULL))) {
@@ -1680,19 +1662,13 @@ index 694b9a9..0950a73 100644
 +
 +static void context_state_callback(pa_context *c, void *)
 +{
-+    Q_ASSERT(c == context);
-+
-+    switch (pa_context_get_state(c)) {
-+        case PA_CONTEXT_UNCONNECTED:
-+        case PA_CONTEXT_CONNECTING:
-+        case PA_CONTEXT_AUTHORIZING:
-+        case PA_CONTEXT_SETTING_NAME:
-+            break;
-+
-+        case PA_CONTEXT_READY:
-+            // Attempt to load things up
-+            pa_operation *o;
++    pa_context_state_t state = pa_context_get_state(c);
++    if (state == PA_CONTEXT_READY) {
++        // Attempt to load things up
++        pa_operation *o;
 +
++        // 1. Register for the stream changes (except during probe)
++        if (s_context == c) {
 +            pa_context_set_subscribe_callback(c, subscribe_cb, NULL);
 +
 +            if (!(o = pa_context_subscribe(c, (pa_subscription_mask_t)
@@ -1705,88 +1681,80 @@ index 694b9a9..0950a73 100644
 +                return;
 +            }
 +            pa_operation_unref(o);
++        }
 +
-+            if (!(o = pa_context_get_sink_info_list(c, sink_cb, NULL))) {
-+                kWarning(67100) << "pa_context_get_sink_info_list() failed";
-+                return;
-+            }
-+            pa_operation_unref(o);
-+            s_OutstandingRequests++;
-+
-+            if (!(o = pa_context_get_source_info_list(c, source_cb, NULL))) {
-+                kWarning(67100) << "pa_context_get_source_info_list() failed";
-+                return;
-+            }
-+            pa_operation_unref(o);
-+            s_OutstandingRequests++;
-+
-+
-+            if (!(o = pa_context_get_client_info_list(c, client_cb, NULL))) {
-+                kWarning(67100) << "pa_context_client_info_list() failed";
-+                return;
-+            }
-+            pa_operation_unref(o);
-+            s_OutstandingRequests++;
++        if (!(o = pa_context_get_sink_info_list(c, sink_cb, NULL))) {
++            kWarning(67100) << "pa_context_get_sink_info_list() failed";
++            return;
++        }
++        pa_operation_unref(o);
++        s_outstandingRequests++;
 +
-+            if (!(o = pa_context_get_sink_input_info_list(c, sink_input_cb, NULL))) {
-+                kWarning(67100) << "pa_context_get_sink_input_info_list() failed";
-+                return;
-+            }
-+            pa_operation_unref(o);
-+            s_OutstandingRequests++;
++        if (!(o = pa_context_get_source_info_list(c, source_cb, NULL))) {
++            kWarning(67100) << "pa_context_get_source_info_list() failed";
++            return;
++        }
++        pa_operation_unref(o);
++        s_outstandingRequests++;
 +
-+            if (!(o = pa_context_get_source_output_info_list(c, source_output_cb, NULL))) {
-+                kWarning(67100) << "pa_context_get_source_output_info_list() failed";
-+                return;
-+            }
-+            pa_operation_unref(o);
-+            s_OutstandingRequests++;
 +
-+            /* These calls are not always supported */
-+            if ((o = pa_ext_stream_restore_read(c, ext_stream_restore_read_cb, NULL))) {
-+                pa_operation_unref(o);
-+                s_OutstandingRequests++;
++        if (!(o = pa_context_get_client_info_list(c, client_cb, NULL))) {
++            kWarning(67100) << "pa_context_client_info_list() failed";
++            return;
++        }
++        pa_operation_unref(o);
++        s_outstandingRequests++;
 +
-+                pa_ext_stream_restore_set_subscribe_cb(c, ext_stream_restore_subscribe_cb, NULL);
++        if (!(o = pa_context_get_sink_input_info_list(c, sink_input_cb, NULL))) {
++            kWarning(67100) << "pa_context_get_sink_input_info_list() failed";
++            return;
++        }
++        pa_operation_unref(o);
++        s_outstandingRequests++;
 +
-+                if ((o = pa_ext_stream_restore_subscribe(c, 1, NULL, NULL)))
-+                    pa_operation_unref(o);
-+            } else
-+                kWarning(67100) << "Failed to initialize stream_restore extension: " << pa_strerror(pa_context_errno(context));
++        if (!(o = pa_context_get_source_output_info_list(c, source_output_cb, NULL))) {
++            kWarning(67100) << "pa_context_get_source_output_info_list() failed";
++            return;
++        }
++        pa_operation_unref(o);
++        s_outstandingRequests++;
 +
-+            break;
++        /* These calls are not always supported */
++        if ((o = pa_ext_stream_restore_read(c, ext_stream_restore_read_cb, NULL))) {
++            pa_operation_unref(o);
++            s_outstandingRequests++;
 +
-+        case PA_CONTEXT_FAILED:
-+        case PA_CONTEXT_TERMINATED: {
++            pa_ext_stream_restore_set_subscribe_cb(c, ext_stream_restore_subscribe_cb, NULL);
 +
-+            int paerrno = pa_context_errno(context);
-+            pa_context_unref(context);
-+            context = NULL;
++            if ((o = pa_ext_stream_restore_subscribe(c, 1, NULL, NULL)))
++                pa_operation_unref(o);
++        } else {
++            kWarning(67100) << "Failed to initialize stream_restore extension: " << pa_strerror(pa_context_errno(s_context));
++        }
++    } else if (!PA_CONTEXT_IS_GOOD(state)) {
++        // If this is our probe phase, exit our context immediately
++        if (s_context != c) {
++            pa_context_disconnect(c);
++        } else {
++            // If we're not probing, it means we've been disconnected from our
++            // glib context
++            pa_context_unref(s_context);
++            s_context = NULL;
 +
 +            // Remove all GUI elements
 +            QMap<int,Mixer_PULSE*>::iterator it;
-+            for (it = s_Mixers.begin(); it != s_Mixers.end(); ++it) {
++            for (it = s_mixers.begin(); it != s_mixers.end(); ++it) {
 +                (*it)->removeAllWidgets();
 +            }
 +            // This one is not handled above.
 +            clients.clear();
 +
-+            if (ACTIVE == s_pulseActive && PA_ERR_CONNECTIONTERMINATED == paerrno && s_Mixers.contains(KMIXPA_PLAYBACK)) {
++            if (s_mixers.contains(KMIXPA_PLAYBACK)) {
 +                kWarning(67100) << "Connection to PulseAudio daemon closed. Attempting reconnection.";
 +                s_pulseActive = UNKNOWN;
-+                QTimer::singleShot(50, s_Mixers[KMIXPA_PLAYBACK], SLOT(reinit()));
-+                break;
-+            }
-+
-+            s_pulseActive = INACTIVE;
-+            if (s_connectionEventloop) {
-+                s_connectionEventloop->exit(0);
-+                s_connectionEventloop = NULL;
++                QTimer::singleShot(50, s_mixers[KMIXPA_PLAYBACK], SLOT(reinit()));
 +            }
 +        }
-+        default:
-+            s_pulseActive = INACTIVE;
-+            break;
 +    }
 +}
 +
@@ -1899,10 +1867,10 @@ index 694b9a9..0950a73 100644
 +{
 +    if (dev.chanMask != Volume::MNONE) {
 +        MixSet *ms = 0;
-+        if (m_devnum == KMIXPA_APP_PLAYBACK && s_Mixers.contains(KMIXPA_PLAYBACK))
-+            ms = s_Mixers[KMIXPA_PLAYBACK]->getMixSet();
-+        else if (m_devnum == KMIXPA_APP_CAPTURE && s_Mixers.contains(KMIXPA_CAPTURE))
-+            ms = s_Mixers[KMIXPA_CAPTURE]->getMixSet();
++        if (m_devnum == KMIXPA_APP_PLAYBACK && s_mixers.contains(KMIXPA_PLAYBACK))
++            ms = s_mixers[KMIXPA_PLAYBACK]->getMixSet();
++        else if (m_devnum == KMIXPA_APP_CAPTURE && s_mixers.contains(KMIXPA_CAPTURE))
++            ms = s_mixers[KMIXPA_CAPTURE]->getMixSet();
 +
 +        Volume v(dev.chanMask, PA_VOLUME_NORM, PA_VOLUME_MUTED, true, false);
 +        setVolumeFromPulse(v, dev);
@@ -1915,84 +1883,131 @@ index 694b9a9..0950a73 100644
  
  Mixer_Backend* PULSE_getMixer( Mixer *mixer, int devnum )
  {
-@@ -34,208 +834,378 @@ Mixer_Backend* PULSE_getMixer( Mixer *mixer, int devnum )
+@@ -34,208 +801,423 @@ Mixer_Backend* PULSE_getMixer( Mixer *mixer, int devnum )
     return l_mixer;
  }
  
-+bool Mixer_PULSE::connectToDaemon(bool nofail)
++bool Mixer_PULSE::connectToDaemon()
 +{
-+    Q_ASSERT(NULL == context);
++    Q_ASSERT(NULL == s_context);
 +
 +    kDebug(67100) <<  "Attempting connection to PulseAudio sound daemon";
-+    pa_mainloop_api *api = pa_glib_mainloop_get_api(mainloop);
-+    g_assert(api);
++    pa_mainloop_api *api = pa_glib_mainloop_get_api(s_mainloop);
++    Q_ASSERT(api);
 +
-+    context = pa_context_new(api, "KMix KDE 4");
-+    g_assert(context);
++    s_context = pa_context_new(api, "KMix KDE 4");
++    Q_ASSERT(s_context);
 +
-+    // (cg) Convert to PA_CONTEXT_NOFLAGS when PulseAudio 0.9.19 is required
-+    pa_context_flags_t flags = static_cast<pa_context_flags_t>(0);
-+    if (nofail) flags = PA_CONTEXT_NOFAIL;
-+
-+    if (pa_context_connect(context, NULL, flags, 0) < 0) {
-+        pa_context_unref(context);
-+        context = NULL;
++    if (pa_context_connect(s_context, NULL, PA_CONTEXT_NOFAIL, 0) < 0) {
++        pa_context_unref(s_context);
++        s_context = NULL;
 +        return false;
 +    }
-+    pa_context_set_state_callback(context, &context_state_callback, NULL);
++    pa_context_set_state_callback(s_context, &context_state_callback, NULL);
 +    return true;
 +}
 +
  
  Mixer_PULSE::Mixer_PULSE(Mixer *mixer, int devnum) : Mixer_Backend(mixer, devnum)
  {
-    if ( devnum == -1 )
-       m_devnum = 0;
+-   if ( devnum == -1 )
+-      m_devnum = 0;
++    if ( devnum == -1 )
++        m_devnum = 0;
 +
-+   QString pulseenv = qgetenv("KMIX_PULSEAUDIO_DISABLE");
-+   if (pulseenv.toInt())
-+       s_pulseActive = INACTIVE;
-+
-+   ++refcount;
-+   if (INACTIVE != s_pulseActive && 1 == refcount)
-+   {
-+       mainloop = pa_glib_mainloop_new(g_main_context_default());
-+       g_assert(mainloop);
-+
-+
-+       if (connectToDaemon(false)) {
-+           // We create a simple event loop to allow the glib loop
-+           // to iterate until we've connected or not to the server.
-+           s_connectionEventloop = new QEventLoop;
-+
-+           // Now we block until we connect or otherwise...
-+           s_connectionEventloop->exec();
-+       }
++    QString pulseenv = qgetenv("KMIX_PULSEAUDIO_DISABLE");
++    if (pulseenv.toInt())
++        s_pulseActive = INACTIVE;
 +
-+       kDebug(67100) <<  "PulseAudio status: " << (s_pulseActive==UNKNOWN ? "Unknown (bug)" : (s_pulseActive==ACTIVE ? "Active" : "Inactive"));
-+   }
++    // We require a glib event loop
++    if (QLatin1String(QAbstractEventDispatcher::instance()->metaObject()->className())
++            != "QGuiEventDispatcherGlib") {
++        kDebug(67100) << "Disabling PulseAudio integration for lack of GLib event loop.";
++        s_pulseActive = INACTIVE;
++    }
++
++
++    ++refcount;
++    if (INACTIVE != s_pulseActive && 1 == refcount)
++    {
++        // First of all conenct to PA via simple/blocking means and if that succeeds,
++        // use a fully async integrated mainloop method to connect and get proper support.
++        pa_mainloop *p_test_mainloop;
++        if (!(p_test_mainloop = pa_mainloop_new())) {
++            kDebug(67100) << "PulseAudio support disabled: Unable to create mainloop";
++            s_pulseActive = INACTIVE;
++            goto endconstruct;
++        }
++
++        pa_context *p_test_context;
++        if (!(p_test_context = pa_context_new(pa_mainloop_get_api(p_test_mainloop), "kmix-probe"))) {
++            kDebug(67100) << "PulseAudio support disabled: Unable to create context";
++            pa_mainloop_free(p_test_mainloop);
++            s_pulseActive = INACTIVE;
++            goto endconstruct;
++        }
++
++        kDebug(67100) << "Probing for PulseAudio...";
++        // (cg) Convert to PA_CONTEXT_NOFLAGS when PulseAudio 0.9.19 is required
++        if (pa_context_connect(p_test_context, NULL, static_cast<pa_context_flags_t>(0), NULL) < 0) {
++            kDebug(67100) << QString("PulseAudio support disabled: %1").arg(pa_strerror(pa_context_errno(p_test_context)));
++            pa_context_disconnect(p_test_context);
++            pa_context_unref(p_test_context);
++            pa_mainloop_free(p_test_mainloop);
++            s_pulseActive = INACTIVE;
++            goto endconstruct;
++        }
++
++        // Assume we are inactive, it will be set to active if appropriate
++        s_pulseActive = INACTIVE;
++        pa_context_set_state_callback(p_test_context, &context_state_callback, NULL);
++        for (;;) {
++          pa_mainloop_iterate(p_test_mainloop, 1, NULL);
++
++          if (!PA_CONTEXT_IS_GOOD(pa_context_get_state(p_test_context))) {
++            kDebug(67100) << "PulseAudio probe complete.";
++            break;
++          }
++        }
++        pa_context_disconnect(p_test_context);
++        pa_context_unref(p_test_context);
++        pa_mainloop_free(p_test_mainloop);
++
++
++        if (INACTIVE != s_pulseActive)
++        {
++            // Reconnect via integrated mainloop
++            s_mainloop = pa_glib_mainloop_new(NULL);
++            Q_ASSERT(s_mainloop);
++
++            connectToDaemon();
++        }
++
++        kDebug(67100) <<  "PulseAudio status: " << (s_pulseActive==UNKNOWN ? "Unknown (bug)" : (s_pulseActive==ACTIVE ? "Active" : "Inactive"));
++    }
 +
-+   s_Mixers[m_devnum] = this;
++endconstruct:
++    s_mixers[m_devnum] = this;
  }
  
  Mixer_PULSE::~Mixer_PULSE()
  {
 -   close();
-+    s_Mixers.remove(m_devnum);
++    s_mixers.remove(m_devnum);
 +
 +    if (refcount > 0)
 +    {
 +        --refcount;
 +        if (0 == refcount)
 +        {
-+            if (context) {
-+                pa_context_unref(context);
-+                context = NULL;
++            if (s_context) {
++                pa_context_unref(s_context);
++                s_context = NULL;
 +            }
 +
-+            if (mainloop) {
-+                pa_glib_mainloop_free(mainloop);
-+                mainloop = NULL;
++            if (s_mainloop) {
++                pa_glib_mainloop_free(s_mainloop);
++                s_mainloop = NULL;
 +            }
 +        }
 +    }
@@ -2005,16 +2020,37 @@ index 694b9a9..0950a73 100644
 -    g_assert(mainloop);
 -    pa_mainloop_api *api = pa_glib_mainloop_get_api(mainloop);
 -    g_assert(api);
-+    //kDebug(67100) <<  "Trying Pulse sink";
- 
+-
 -    context = pa_context_new(api, "KMix KDE 4");
 -    g_assert(context);
 -      //return Mixer::ERR_OPEN;
+- 
+-/* 
+-      //
+-      // Mixer is open. Now define all of the mix devices.
+-      //
+-
+-         for ( int idx = 0; idx < numDevs; idx++ )
+-         {
+-            Volume vol( 2, AUDIO_MAX_GAIN );
+-            QString id;
+-            id.setNum(idx);
+-            MixDevice* md = new MixDevice( _mixer, id,
+-               QString(MixerDevNames[idx]), MixerChannelTypes[idx]);
+-            md->addPlaybackVolume(vol);
+-            md->setRecSource( isRecsrcHW( idx ) );
+-            m_mixDevices.append( md );
+-         }
+-*/
++    //kDebug(67100) <<  "Trying Pulse sink";
+ 
+-    m_mixerName = "PULSE Audio Mixer";
 +    if (ACTIVE == s_pulseActive && m_devnum <= KMIXPA_APP_CAPTURE)
 +    {
 +        // Make sure the GUI layers know we are dynamic so as to always paint us
 +        _mixer->setDynamic();
-+
+ 
+-    m_isOpen = true;
 +        devmap::iterator iter;
 +        if (KMIXPA_PLAYBACK == m_devnum)
 +        {
@@ -2042,37 +2078,29 @@ index 694b9a9..0950a73 100644
 +            for (iter = captureStreams.begin(); iter != captureStreams.end(); ++iter)
 +                addDevice(*iter);
 +        }
-+
+ 
 +        kDebug(67100) <<  "Using PulseAudio for mixer: " << m_mixerName;
 +        m_isOpen = true;
 +    }
-  
--/* 
--      //
--      // Mixer is open. Now define all of the mix devices.
--      //
--
--         for ( int idx = 0; idx < numDevs; idx++ )
--         {
--            Volume vol( 2, AUDIO_MAX_GAIN );
--            QString id;
--            id.setNum(idx);
--            MixDevice* md = new MixDevice( _mixer, id,
--               QString(MixerDevNames[idx]), MixerChannelTypes[idx]);
--            md->addPlaybackVolume(vol);
--            md->setRecSource( isRecsrcHW( idx ) );
--            m_mixDevices.append( md );
--         }
--*/
-+    return 0;
-+}
-+
-+int Mixer_PULSE::close()
-+{
-+    return 1;
-+}
++ 
+     return 0;
+ }
+ 
+ int Mixer_PULSE::close()
+ {
+-    if (context)
+-    {
+-        pa_context_unref(context);
+-        context = NULL;
+-    }
+-    if (mainloop)
+-    {
+-        pa_glib_mainloop_free(mainloop);
+-        mainloop = NULL;
+-    }
+     return 1;
+ }
  
--    m_mixerName = "PULSE Audio Mixer";
 +int Mixer_PULSE::id2num(const QString& id) {
 +    //kDebug(67100) << "id2num() id=" << id;
 +    int num = -1;
@@ -2087,12 +2115,39 @@ index 694b9a9..0950a73 100644
 +    //kDebug(67100) << "id2num() num=" << num;
 +    return num;
 +}
- 
--    m_isOpen = true;
-+int Mixer_PULSE::readVolumeFromHW( const QString& id, MixDevice *md )
-+{
++
+ int Mixer_PULSE::readVolumeFromHW( const QString& id, MixDevice *md )
+ {
+-/*   audio_info_t audioinfo;
+-   uint_t devMask = MixerSunPortMasks[devnum];
+-
+-   Volume& volume = md->playbackVolume();
+-   int devnum = id2num(id);
+-   //
+-   // Read the current audio information from the driver
+-   //
+-   if ( ioctl( fd, AUDIO_GETINFO, &audioinfo ) < 0 )
+-   {
+-      return( Mixer::ERR_READ );
+-   }
+-   else
+-   {
+-      //
+-      // Extract the appropriate fields based on the requested device
+-      //
+-      switch ( devnum )
+-      {
+-         case MIXERDEV_MASTER_VOLUME :
+-            volume.setSwitchActivated( audioinfo.output_muted );
+-            GainBalanceToVolume( audioinfo.play.gain,
+-                                 audioinfo.play.balance,
+-                                 volume );
+-            break;
 +    devmap *map = get_widget_map(m_devnum, id);
-+ 
+ 
+-         case MIXERDEV_RECORD_MONITOR :
+-            md->setMuted(false);
+-            volume.setAllVolumes( audioinfo.monitor_gain );
 +    devmap::iterator iter;
 +    for (iter = map->begin(); iter != map->end(); ++iter)
 +    {
@@ -2100,22 +2155,26 @@ index 694b9a9..0950a73 100644
 +        {
 +            setVolumeFromPulse(md->playbackVolume(), *iter);
 +            md->setMuted(iter->mute);
-+            break;
+             break;
 +        }
 +    }
  
-     return 0;
- }
- 
--int Mixer_PULSE::close()
+-         case MIXERDEV_INTERNAL_SPEAKER :
+-         case MIXERDEV_HEADPHONE :
+-         case MIXERDEV_LINE_OUT :
+-            md->setMuted( (audioinfo.play.port & devMask) ? false : true );
+-            GainBalanceToVolume( audioinfo.play.gain,
+-                                 audioinfo.play.balance,
+-                                 volume );
+-            break;
++    return 0;
++}
++
 +int Mixer_PULSE::writeVolumeToHW( const QString& id, MixDevice *md )
- {
--    if (context)
++{
 +    devmap::iterator iter;
 +    if (KMIXPA_PLAYBACK == m_devnum)
-     {
--        pa_context_unref(context);
--        context = NULL;
++    {
 +        for (iter = outputDevices.begin(); iter != outputDevices.end(); ++iter)
 +        {
 +            if (iter->name == id)
@@ -2123,13 +2182,20 @@ index 694b9a9..0950a73 100644
 +                pa_operation *o;
 +
 +                pa_cvolume volume = genVolumeForPulse(*iter, md->playbackVolume());
-+                if (!(o = pa_context_set_sink_volume_by_index(context, iter->index, &volume, NULL, NULL))) {
++                if (!(o = pa_context_set_sink_volume_by_index(s_context, iter->index, &volume, NULL, NULL))) {
 +                    kWarning(67100) <<  "pa_context_set_sink_volume_by_index() failed";
 +                    return Mixer::ERR_READ;
 +                }
 +                pa_operation_unref(o);
-+
-+                if (!(o = pa_context_set_sink_mute_by_index(context, iter->index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
+ 
+-         case MIXERDEV_MICROPHONE :
+-         case MIXERDEV_LINE_IN :
+-         case MIXERDEV_CD :
+-            md->setMuted( (audioinfo.record.port & devMask) ? false : true );
+-            GainBalanceToVolume( audioinfo.record.gain,
+-                                 audioinfo.record.balance,
+-                                 volume );
++                if (!(o = pa_context_set_sink_mute_by_index(s_context, iter->index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
 +                    kWarning(67100) <<  "pa_context_set_sink_mute_by_index() failed";
 +                    return Mixer::ERR_READ;
 +                }
@@ -2138,12 +2204,9 @@ index 694b9a9..0950a73 100644
 +                return 0;
 +            }
 +        }
-     }
--    if (mainloop)
++    }
 +    else if (KMIXPA_CAPTURE == m_devnum)
-     {
--        pa_glib_mainloop_free(mainloop);
--        mainloop = NULL;
++    {
 +        for (iter = captureDevices.begin(); iter != captureDevices.end(); ++iter)
 +        {
 +            if (iter->name == id)
@@ -2151,13 +2214,13 @@ index 694b9a9..0950a73 100644
 +                pa_operation *o;
 +
 +                pa_cvolume volume = genVolumeForPulse(*iter, md->playbackVolume());
-+                if (!(o = pa_context_set_source_volume_by_index(context, iter->index, &volume, NULL, NULL))) {
++                if (!(o = pa_context_set_source_volume_by_index(s_context, iter->index, &volume, NULL, NULL))) {
 +                    kWarning(67100) <<  "pa_context_set_source_volume_by_index() failed";
 +                    return Mixer::ERR_READ;
 +                }
 +                pa_operation_unref(o);
 +
-+                if (!(o = pa_context_set_source_mute_by_index(context, iter->index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
++                if (!(o = pa_context_set_source_mute_by_index(s_context, iter->index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
 +                    kWarning(67100) <<  "pa_context_set_source_mute_by_index() failed";
 +                    return Mixer::ERR_READ;
 +                }
@@ -2166,8 +2229,7 @@ index 694b9a9..0950a73 100644
 +                return 0;
 +            }
 +        }
-     }
--    return 1;
++    }
 +    else if (KMIXPA_APP_PLAYBACK == m_devnum)
 +    {
 +        if (id.startsWith("stream:"))
@@ -2179,13 +2241,13 @@ index 694b9a9..0950a73 100644
 +                    pa_operation *o;
 +
 +                    pa_cvolume volume = genVolumeForPulse(*iter, md->playbackVolume());
-+                    if (!(o = pa_context_set_sink_input_volume(context, iter->index, &volume, NULL, NULL))) {
++                    if (!(o = pa_context_set_sink_input_volume(s_context, iter->index, &volume, NULL, NULL))) {
 +                        kWarning(67100) <<  "pa_context_set_sink_input_volume() failed";
 +                        return Mixer::ERR_READ;
 +                    }
 +                    pa_operation_unref(o);
 +
-+                    if (!(o = pa_context_set_sink_input_mute(context, iter->index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
++                    if (!(o = pa_context_set_sink_input_mute(s_context, iter->index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
 +                        kWarning(67100) <<  "pa_context_set_sink_input_mute() failed";
 +                        return Mixer::ERR_READ;
 +                    }
@@ -2210,7 +2272,7 @@ index 694b9a9..0950a73 100644
 +                    info.mute = (md->isMuted() ? 1 : 0);
 +
 +                    pa_operation* o;
-+                    if (!(o = pa_ext_stream_restore_write(context, PA_UPDATE_REPLACE, &info, 1, TRUE, NULL, NULL))) {
++                    if (!(o = pa_ext_stream_restore_write(s_context, PA_UPDATE_REPLACE, &info, 1, TRUE, NULL, NULL))) {
 +                        kWarning(67100) <<  "pa_ext_stream_restore_write() failed" << info.channel_map.channels << info.volume.channels << info.name;
 +                        return Mixer::ERR_READ;
 +                    }
@@ -2231,13 +2293,13 @@ index 694b9a9..0950a73 100644
 +
 +                // NB Note that this is different from APP_PLAYBACK in that we set the volume on the source itself.
 +                pa_cvolume volume = genVolumeForPulse(*iter, md->playbackVolume());
-+                if (!(o = pa_context_set_source_volume_by_index(context, iter->device_index, &volume, NULL, NULL))) {
++                if (!(o = pa_context_set_source_volume_by_index(s_context, iter->device_index, &volume, NULL, NULL))) {
 +                    kWarning(67100) <<  "pa_context_set_source_volume_by_index() failed";
 +                    return Mixer::ERR_READ;
 +                }
 +                pa_operation_unref(o);
 +
-+                if (!(o = pa_context_set_source_mute_by_index(context, iter->device_index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
++                if (!(o = pa_context_set_source_mute_by_index(s_context, iter->device_index, (md->isMuted() ? 1 : 0), NULL, NULL))) {
 +                    kWarning(67100) <<  "pa_context_set_source_mute_by_index() failed";
 +                    return Mixer::ERR_READ;
 +                }
@@ -2249,54 +2311,16 @@ index 694b9a9..0950a73 100644
 +    }
 +
 +    return 0;
- }
- 
--int Mixer_PULSE::readVolumeFromHW( const QString& id, MixDevice *md )
--{
--/*   audio_info_t audioinfo;
--   uint_t devMask = MixerSunPortMasks[devnum];
--
--   Volume& volume = md->playbackVolume();
--   int devnum = id2num(id);
--   //
--   // Read the current audio information from the driver
--   //
--   if ( ioctl( fd, AUDIO_GETINFO, &audioinfo ) < 0 )
--   {
--      return( Mixer::ERR_READ );
--   }
--   else
--   {
--      //
--      // Extract the appropriate fields based on the requested device
--      //
--      switch ( devnum )
--      {
--         case MIXERDEV_MASTER_VOLUME :
--            volume.setSwitchActivated( audioinfo.output_muted );
--            GainBalanceToVolume( audioinfo.play.gain,
--                                 audioinfo.play.balance,
--                                 volume );
--            break;
++}
++
 +/**
 +* Move the stream to a new destination
 +*/
 +bool Mixer_PULSE::moveStream( const QString& id, const QString& destId ) {
 +    Q_ASSERT(KMIXPA_APP_PLAYBACK == m_devnum || KMIXPA_APP_CAPTURE == m_devnum);
- 
--         case MIXERDEV_RECORD_MONITOR :
--            md->setMuted(false);
--            volume.setAllVolumes( audioinfo.monitor_gain );
--            break;
++
 +    kDebug(67100) <<  "Mixer_PULSE::moveStream(): Move Stream Requested - Stream: " << id << ", Destination: " << destId;
- 
--         case MIXERDEV_INTERNAL_SPEAKER :
--         case MIXERDEV_HEADPHONE :
--         case MIXERDEV_LINE_OUT :
--            md->setMuted( (audioinfo.play.port & devMask) ? false : true );
--            GainBalanceToVolume( audioinfo.play.gain,
--                                 audioinfo.play.balance,
--                                 volume );
++
 +    // Lookup the stream index.
 +    uint32_t stream_index = PA_INVALID_INDEX;
 +    const char* stream_restore_rule = NULL;
@@ -2310,25 +2334,17 @@ index 694b9a9..0950a73 100644
 +        }
 +    }
  
--         case MIXERDEV_MICROPHONE :
--         case MIXERDEV_LINE_IN :
--         case MIXERDEV_CD :
--            md->setMuted( (audioinfo.record.port & devMask) ? false : true );
--            GainBalanceToVolume( audioinfo.record.gain,
--                                 audioinfo.record.balance,
--                                 volume );
--            break;
-+    if (PA_INVALID_INDEX == stream_index) {
-+        kError(67100) <<  "Mixer_PULSE::moveStream(): Cannot find stream index";
-+        return false;
-+    }
- 
 -         default :
 -            return Mixer::ERR_READ;
 -      }
 -      return 0;
 -   }*/
 -   return 0;
++    if (PA_INVALID_INDEX == stream_index) {
++        kError(67100) <<  "Mixer_PULSE::moveStream(): Cannot find stream index";
++        return false;
++    }
++
 +    if (destId.isEmpty()) {
 +        // We want to remove any specific device in the stream restore rule.
 +        if (!stream_restore_rule || !s_RestoreRules.contains(stream_restore_rule)) {
@@ -2343,7 +2359,7 @@ index 694b9a9..0950a73 100644
 +            info.mute = rule.mute ? 1 : 0;
 +
 +            pa_operation* o;
-+            if (!(o = pa_ext_stream_restore_write(context, PA_UPDATE_REPLACE, &info, 1, TRUE, NULL, NULL))) {
++            if (!(o = pa_ext_stream_restore_write(s_context, PA_UPDATE_REPLACE, &info, 1, TRUE, NULL, NULL))) {
 +                kWarning(67100) <<  "pa_ext_stream_restore_write() failed" << info.channel_map.channels << info.volume.channels << info.name;
 +                return Mixer::ERR_READ;
 +            }
@@ -2352,12 +2368,12 @@ index 694b9a9..0950a73 100644
 +    } else {
 +        pa_operation* o;
 +        if (KMIXPA_APP_PLAYBACK == m_devnum) {
-+            if (!(o = pa_context_move_sink_input_by_name(context, stream_index, destId.toAscii().constData(), NULL, NULL))) {
++            if (!(o = pa_context_move_sink_input_by_name(s_context, stream_index, destId.toAscii().constData(), NULL, NULL))) {
 +                kWarning(67100) <<  "pa_context_move_sink_input_by_name() failed";
 +                return false;
 +            }
 +        } else {
-+            if (!(o = pa_context_move_source_output_by_name(context, stream_index, destId.toAscii().constData(), NULL, NULL))) {
++            if (!(o = pa_context_move_source_output_by_name(s_context, stream_index, destId.toAscii().constData(), NULL, NULL))) {
 +                kWarning(67100) <<  "pa_context_move_source_output_by_name() failed";
 +                return false;
 +            }
@@ -2370,6 +2386,13 @@ index 694b9a9..0950a73 100644
  
 -int Mixer_PULSE::writeVolumeToHW( const QString& id, MixDevice *md )
 +void Mixer_PULSE::reinit()
++{
++    // We only support reinit on our primary mixer.
++    Q_ASSERT(KMIXPA_PLAYBACK == m_devnum);
++    connectToDaemon();
++}
++
++void Mixer_PULSE::triggerUpdate()
  {
 -/*   uint_t gain;
 -   uchar_t balance;
@@ -2435,11 +2458,7 @@ index 694b9a9..0950a73 100644
 -      default :
 -         return Mixer::ERR_READ;
 -   }
-+    // We only support reinit on our primary mixer.
-+    Q_ASSERT(KMIXPA_PLAYBACK == m_devnum);
-+    connectToDaemon(true);
-+}
- 
+-
 -   //
 -   // Now that we've updated the audioinfo struct, write it back to the hardware
 -   //
@@ -2452,14 +2471,12 @@ index 694b9a9..0950a73 100644
 -      return 0;
 -   }*/
 -   return 0;
-+void Mixer_PULSE::triggerUpdate()
-+{
 +    readSetFromHWforceUpdate();
 +    readSetFromHW();
  }
  
  void Mixer_PULSE::setRecsrcHW( const QString& /*id*/, bool /* on */ )
-@@ -243,19 +1213,8 @@ void Mixer_PULSE::setRecsrcHW( const QString& /*id*/, bool /* on */ )
+@@ -243,19 +1225,8 @@ void Mixer_PULSE::setRecsrcHW( const QString& /*id*/, bool /* on */ )
     return;
  }
  
@@ -2481,7 +2498,7 @@ index 694b9a9..0950a73 100644
  }
  
 diff --git a/kmix/mixer_pulse.h b/kmix/mixer_pulse.h
-index 6dcd68b..eeac02a 100644
+index 6dcd68b..6c43b0c 100644
 --- a/kmix/mixer_pulse.h
 +++ b/kmix/mixer_pulse.h
 @@ -24,30 +24,61 @@
@@ -2549,7 +2566,7 @@ index 6dcd68b..eeac02a 100644
 -  virtual QString getDriverName();
 +    private:
 +        void addDevice(devinfo& dev);
-+        bool connectToDaemon(bool nofail);
++        bool connectToDaemon();
  
 -protected:
 -  virtual int open();


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/kdemultimedia/F-13/sources,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -p -r1.80 -r1.81
--- sources	2 Mar 2010 14:18:18 -0000	1.80
+++ sources	3 Apr 2010 15:37:22 -0000	1.81
@@ -1 +1 @@
-757a70465395512f245fac6f9e3b7c59  kdemultimedia-4.4.1.tar.bz2
+8b9ca4c67093e7b213270f65bbeb3cab  kdemultimedia-4.4.2.tar.bz2



More information about the scm-commits mailing list