Hello community,

here is the log from the commit of package phonon for openSUSE:Factory checked 
in at 2013-10-01 08:20:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/phonon (Old)
 and      /work/SRC/openSUSE:Factory/.phonon.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "phonon"

Changes:
--------
--- /work/SRC/openSUSE:Factory/phonon/phonon.changes    2013-09-26 
11:49:31.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.phonon.new/phonon.changes       2013-10-01 
08:20:53.000000000 +0200
@@ -1,0 +2,9 @@
+Mon Sep 30 18:42:23 UTC 2013 - hrvoje.sen...@gmail.com
+
+- Update to 4.6.80~git20130930
+  * Add preference system ontop of Qt5 backend loading
+  * Unbreak documentation of AO47
+  * Don't crash when trying to create the singleton out of a
+    qapp parented AO (kde#293004)
+
+-------------------------------------------------------------------

Old:
----
  phonon-4.6.80~git20130915.tar.xz

New:
----
  phonon-4.6.80~git20130930.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ phonon.spec ++++++
--- /var/tmp/diff_new_pack.3ODYBz/_old  2013-10-01 08:20:53.000000000 +0200
+++ /var/tmp/diff_new_pack.3ODYBz/_new  2013-10-01 08:20:53.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           phonon
-Version:        4.6.80~git20130915
+Version:        4.6.80~git20130930
 Release:        0
 Summary:        Multimedia Platform Abstraction
 License:        LGPL-2.0+

++++++ phonon-4.6.80~git20130915.tar.xz -> phonon-4.6.80~git20130930.tar.xz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/phonon-4.6.80~git20130915/phonon/audiooutputinterface.h 
new/phonon-4.6.80~git20130930/phonon/audiooutputinterface.h
--- old/phonon-4.6.80~git20130915/phonon/audiooutputinterface.h 2013-09-09 
18:37:42.000000000 +0200
+++ new/phonon-4.6.80~git20130930/phonon/audiooutputinterface.h 2013-09-30 
16:43:58.000000000 +0200
@@ -135,7 +135,7 @@
 {
 public:
     /**
-     * This function is meant to be used in conjuction with \class PulseSupport
+     * This function is meant to be used in conjuction with PulseSupport
      * to either get the property set for the associated PulseAudio straem or
      * to automatically apply them to the envrionment.
      *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/phonon-4.6.80~git20130915/phonon/factory.cpp 
new/phonon-4.6.80~git20130930/phonon/factory.cpp
--- old/phonon-4.6.80~git20130915/phonon/factory.cpp    2013-09-09 
18:37:42.000000000 +0200
+++ new/phonon-4.6.80~git20130930/phonon/factory.cpp    2013-09-30 
16:43:58.000000000 +0200
@@ -54,6 +54,9 @@
     public:
         FactoryPrivate();
         ~FactoryPrivate();
+        bool tryCreateBackend(const QString &path);
+        // Implementation depends on Qt version.
+        bool createSuitableBackend(const QString &libPath, const 
QList<QString> &plugins);
         bool createBackend();
 #ifndef QT_NO_PHONON_PLATFORMPLUGIN
         PlatformPlugin *platformPlugin();
@@ -101,15 +104,131 @@
     globalFactory->m_backendObject = b;
 }
 
-/*void Factory::createBackend(const QString &library, const QString &version)
+bool FactoryPrivate::tryCreateBackend(const QString &path)
 {
-    Q_ASSERT(globalFactory->m_backendObject == 0);
-    PlatformPlugin *f = globalFactory->platformPlugin();
-    if (f) {
-        globalFactory->m_backendObject = f->createBackend(library, version);
+    QPluginLoader pluginLoader(path);
+
+    pDebug() << "attempting to load" << path;
+    if (!pluginLoader.load()) {
+        pDebug() << Q_FUNC_INFO << "  load failed:" << 
pluginLoader.errorString();
+        return false;
     }
-}*/
+    pDebug() << pluginLoader.instance();
+    m_backendObject = pluginLoader.instance();
+    if (m_backendObject) {
+        return true;
+    }
+
+    // no backend found, don't leave an unused plugin in memory
+    pluginLoader.unload();
+    return false;
+}
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+struct BackendDescriptor {
+    explicit BackendDescriptor(const QString &path)
+        : isValid(false)
+    {
+        QPluginLoader loader(path);
+
+        iid = loader.metaData().value(QLatin1String("IID")).toString();
+
+        const QJsonObject metaData = 
loader.metaData().value(QLatin1String("MetaData")).toObject();
+        name = metaData.value(QLatin1String("Name")).toString();
+        icon = metaData.value(QLatin1String("Icon")).toString();
+        version = metaData.value(QLatin1String("Version")).toString();
+        website = metaData.value(QLatin1String("Website")).toString();
+        preference = 
metaData.value(QLatin1String("InitialPreference")).toDouble();
+
+        pluginPath = path;
+
+        if (name.isEmpty())
+            name = QFileInfo(path).baseName();
+
+        if (iid.isEmpty())
+            return; // Not valid.
 
+        isValid = true;
+    }
+
+    bool isValid;
+
+    QString iid;
+
+    QString name;
+    QString icon;
+    QString version;
+    QString website;
+    int preference;
+
+    QString pluginPath;
+
+    /** Implemented for qSort(QList) */
+    bool operator <(const BackendDescriptor &rhs) const
+    {
+        return this->preference < rhs.preference;
+    }
+};
+
+bool FactoryPrivate::createSuitableBackend(const QString &libPath, const 
QList<QString> &plugins)
+{
+    // User configured preference.
+    QList<QString> iidPreference;
+    QSettings settings("kde.org", "libphonon");
+    const int size = settings.beginReadArray("Backends");
+    for (int i = 0; i < size; ++i) {
+        settings.setArrayIndex(i);
+        iidPreference.append(settings.value("iid").toString());
+    }
+    settings.endArray();
+
+    // Find physical backend plugins.
+    QList<BackendDescriptor> foundBackends;
+    foreach (const QString &plugin, plugins) {
+        BackendDescriptor descriptor(libPath + plugin);
+        if (!descriptor.isValid)
+            continue;
+        foundBackends.append(descriptor);
+    }
+    qSort(foundBackends);
+
+    // Try to pick a preferred backend.
+    foreach (const QString &iid, iidPreference) {
+        // This is slightly inefficient but we only have 2 backends :P
+        // Also using a list requires less overall code than QMap<iid,desc>.
+        QList<BackendDescriptor>::iterator it;
+        for (it = foundBackends.begin(); it != foundBackends.end(); ++it) {
+            const BackendDescriptor &descriptor = *it;
+            if (descriptor.iid != iid)
+                continue;
+            if (tryCreateBackend(descriptor.pluginPath))
+                return true;
+            else // Drop backends that failed to construct.
+                foundBackends.erase(it);
+        }
+    }
+
+    // No Preferred backend could be constructed. Try all remaining backends
+    // in order of initial preference.
+    // Note that unconstructable backends have been dropped previously.
+    foreach (const BackendDescriptor &descriptor, foundBackends) {
+        if (tryCreateBackend(descriptor.pluginPath))
+            return true;
+    }
+    return false;
+}
+#else // Qt 4
+bool FactoryPrivate::createSuitableBackend(const QString &libPath, const 
QList<QString> &plugins)
+{
+    foreach (const QString &plugin, plugins) {
+        if (tryCreateBackend(libPath + plugin))
+            return true;
+    }
+    return false;
+}
+#endif
+
+// This entire function is so terrible to read I hope it implodes some day.
 bool FactoryPrivate::createBackend()
 {
     pDebug() << Q_FUNC_INFO << "Phonon" << PHONON_VERSION_STR << "trying to 
create backend...";
@@ -166,22 +285,11 @@
                     plugins.move(backendIndex, 0);
             }
 
-            foreach (const QString &plugin, plugins) {
-                QPluginLoader pluginLoader(libPath + plugin);
-                if (!pluginLoader.load()) {
-                    pDebug() << Q_FUNC_INFO << "  load failed:"
-                             << pluginLoader.errorString();
-                    continue;
-                }
-                pDebug() << pluginLoader.instance();
-                m_backendObject = pluginLoader.instance();
-                if (m_backendObject) {
-                    break;
-                }
-
-                // no backend found, don't leave an unused plugin in memory
-                pluginLoader.unload();
-            }
+            // This function implements a very simple trial-and-error loader 
for
+            // Qt 4 and on top of that a preference system for Qt 5. Therefore
+            // in Qt 5 we have backend preference independent of a platform
+            // plugin.
+            createSuitableBackend(libPath, plugins);
 
             if (m_backendObject) {
                 break;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/phonon-4.6.80~git20130915/phonon/pulsesupport.cpp 
new/phonon-4.6.80~git20130930/phonon/pulsesupport.cpp
--- old/phonon-4.6.80~git20130915/phonon/pulsesupport.cpp       2013-09-09 
18:37:42.000000000 +0200
+++ new/phonon-4.6.80~git20130930/phonon/pulsesupport.cpp       2013-09-30 
16:43:58.000000000 +0200
@@ -820,6 +820,12 @@
         return;
     }
 
+    if (!QAbstractEventDispatcher::instance() || 
!QAbstractEventDispatcher::instance()->metaObject()) {
+        qWarning("WARNING: Cannot construct PulseSupport because there is no 
Eventloop."
+                 " May be because of application shutdown.");
+        return;
+    }
+
     // We require a glib event loop
     if 
(!QByteArray(QAbstractEventDispatcher::instance()->metaObject()->className()).contains("EventDispatcherGlib"))
 {
         qWarning("WARNING: Disabling PulseAudio integration for lack of GLib 
event loop.");

-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to