[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [phonon-vlc/five] src: Remove the DeviceManager class which is not useful for Phonon5
From:       Casian Andrei <skeletk13 () gmail ! com>
Date:       2014-07-25 8:40:59
Message-ID: E1XAb3j-0003u2-Gi () scm ! kde ! org
[Download RAW message or body]

Git commit 1949d7c236eee6bd7e7a74f71e1b228d84e4cbab by Casian Andrei.
Committed on 25/07/2014 at 08:17.
Pushed by casianandrei into branch 'five'.

Remove the DeviceManager class which is not useful for Phonon5

M  +0    -1    src/CMakeLists.txt
M  +0    -3    src/backend.cpp
M  +0    -5    src/backend.h
D  +0    -261  src/devicemanager.cpp
D  +0    -137  src/devicemanager.h

http://commits.kde.org/phonon-vlc/1949d7c236eee6bd7e7a74f71e1b228d84e4cbab

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2259a61..bc08da2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -23,7 +23,6 @@ set(phonon_vlc_SRCS
 #    audio/audiodataoutput.cpp
 #    audio/volumefadereffect.cpp
     backend.cpp
-    devicemanager.cpp
     connector.cpp
 #    effect.cpp
 #    effectmanager.cpp
diff --git a/src/backend.cpp b/src/backend.cpp
index 4806883..80798ff 100644
--- a/src/backend.cpp
+++ b/src/backend.cpp
@@ -33,7 +33,6 @@
 //#include "audio/audiodataoutput.h"
 //#include "audio/volumefadereffect.h"
 #include "connector.h"
-#include "devicemanager.h"
 //#include "effect.h"
 //#include "effectmanager.h"
 #include "player.h"
@@ -51,7 +50,6 @@ Backend *Backend::self;
 
 Backend::Backend(QObject *parent, const QVariantList &)
     : QObject(parent)
-    , m_deviceManager(0)
 //    , m_effectManager(0)
 {
     self = this;
@@ -105,7 +103,6 @@ Backend::Backend(QObject *parent, const QVariantList &)
         pFatal("Phonon::VLC::vlcInit: Failed to initialize VLC");
     }
 
-    m_deviceManager = new DeviceManager(this);
 //    m_effectManager = new EffectManager(this);
 }
 
diff --git a/src/backend.h b/src/backend.h
index 2a9442e..b4f2996 100644
--- a/src/backend.h
+++ b/src/backend.h
@@ -31,7 +31,6 @@ class LibVLC;
 namespace Phonon {
 namespace VLC {
 
-class DeviceManager;
 class EffectManager;
 
 /** \brief Backend class for Phonon-VLC.
@@ -69,9 +68,6 @@ public:
     Backend(QObject *parent = 0, const QVariantList & = QVariantList());
     ~Backend();
 
-    /** \return The device manager that is associated with this backend object. */
-    DeviceManager *deviceManager() const;
-
     /** \return The effect manager that is associated with this backend object. */
     EffectManager *effectManager() const;
 
@@ -86,7 +82,6 @@ public:
     QObject *createObject(BackendInterface::Class, QObject *parent, const QList<QVariant> &args);
 
 private:
-    DeviceManager *m_deviceManager;
     EffectManager *m_effectManager;
 };
 
diff --git a/src/devicemanager.cpp b/src/devicemanager.cpp
deleted file mode 100644
index 4de7d83..0000000
--- a/src/devicemanager.cpp
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
-    Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com>
-    Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com>
-    Copyright (C) 2009 Fathi Boudra <fabo@kde.org>
-    Copyright (C) 2009-2010 vlc-phonon AUTHORS <kde-multimedia@kde.org>
-    Copyright (C) 2011 Harald Sitter <sitter@kde.org>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "devicemanager.h"
-
-#include <vlc/vlc.h>
-
-#include "backend.h"
-#include "utils/debug.h"
-#include "utils/libvlc.h"
-#include "utils/vstring.h"
-
-namespace Phonon {
-namespace VLC {
-
-/*
- * Device Info
- */
-
-DeviceInfo::DeviceInfo(const QString &name, bool isAdvanced)
-{
-    // Get an id
-    static int counter = 0;
-    m_id = counter++;
-
-    // Get name and description for the device
-    m_name = name;
-    m_isAdvanced = isAdvanced;
-    m_capabilities = None;
-
-    // A default device should never be advanced
-    if (name.startsWith(QLatin1String("default"), Qt::CaseInsensitive))
-        m_isAdvanced = false;
-}
-
-int DeviceInfo::id() const
-{
-    return m_id;
-}
-
-const QString& DeviceInfo::name() const
-{
-    return m_name;
-}
-
-const QString& DeviceInfo::description() const
-{
-    return m_description;
-}
-
-bool DeviceInfo::isAdvanced() const
-{
-    return m_isAdvanced;
-}
-
-void DeviceInfo::setAdvanced(bool advanced)
-{
-    m_isAdvanced = advanced;
-}
-
-DeviceInfo::SoundSystem DeviceInfo::soundSystem() const
-{
-    return m_soundSystem;
-}
-
-QByteArray DeviceInfo::deviceName() const
-{
-    return m_deviceName;
-}
-
-void DeviceInfo::setAccessInfo(SoundSystem soundSystem, const QByteArray &deviceName)
-{
-    m_soundSystem = soundSystem;
-    m_deviceName = deviceName;
-}
-
-quint16 DeviceInfo::capabilities() const
-{
-    return m_capabilities;
-}
-
-void DeviceInfo::setCapabilities(quint16 cap)
-{
-    m_capabilities = cap;
-}
-
-
-/*
- * Device Manager
- */
-
-DeviceManager::DeviceManager(Backend *parent)
-    : QObject(parent)
-    , m_backend(parent)
-{
-    DEBUG_BLOCK;
-    Q_ASSERT(parent);
-
-    m_knownSoundSystems.insert(DeviceInfo::Pulse, QByteArray("pulse"));
-    m_knownSoundSystems.insert(DeviceInfo::Alsa, QByteArray("alsa"));
-    m_knownSoundSystems.insert(DeviceInfo::Oss, QByteArray("oss"));
-    m_knownSoundSystems.insert(DeviceInfo::Jack, QByteArray("jack"));
-    m_knownSoundSystems.insert(DeviceInfo::Aout_DirectX, QByteArray("aout_directx"));
-    m_knownSoundSystems.insert(DeviceInfo::DirectSound, QByteArray("directsound"));
-    m_knownSoundSystems.insert(DeviceInfo::Auhal, QByteArray("auhal"));
-
-    updateDeviceList();
-}
-
-DeviceManager::~DeviceManager()
-{
-}
-
-const DeviceInfo *DeviceManager::device(int id) const
-{
-    for (int i = 0; i < m_devices.size(); i ++) {
-        if (m_devices[i].id() == id)
-            return &m_devices[i];
-    }
-
-    return NULL;
-}
-
-static QList<QByteArray> vlcAudioOutBackends()
-{
-    QList<QByteArray> ret;
-
-    VLC_FOREACH_LIST(audio_output, aout) {
-        QByteArray name(aout->psz_name);
-        if (!ret.contains(name))
-            ret.append(name);
-    }
-
-    return ret;
-}
-
-void DeviceManager::updateDeviceList()
-{
-    DEBUG_BLOCK;
-    QList<DeviceInfo> newDeviceList;
-
-    if (!LibVLC::self || !libvlc)
-        return;
-
-    QList<QByteArray> audioOutBackends = vlcAudioOutBackends();
-
-    // If we have pulse, screw the rest.
-    if (audioOutBackends.contains("pulse")) {
-        DeviceInfo defaultAudioOutputDevice(tr("Default"), false);
-        defaultAudioOutputDevice.setCapabilities(DeviceInfo::AudioOutput);
-        defaultAudioOutputDevice.setAccessInfo(DeviceInfo::Pulse, "default");
-        newDeviceList.append(defaultAudioOutputDevice);
-        return;
-    }
-
-    // NOTE: if listing was not intercepted by the PA code above we also need
-    //       to try injecting the pulse aout as otherwise the user would have to
-    //       use the fake PA device in ALSA to output through PA (kind of silly).
-
-    foreach (const QByteArray &soundSystemName, m_knownSoundSystems.values()) {
-        if (!audioOutBackends.contains(soundSystemName)) {
-            pDebug() << "Sound system" << soundSystemName << "not supported by libvlc";
-            continue;
-        }
-
-        const int deviceCount = libvlc_audio_output_device_count(libvlc, soundSystemName);
-
-        for (int i = 0; i < deviceCount; i++) {
-            VString idName(libvlc_audio_output_device_id(libvlc, soundSystemName, i));
-            VString longName(libvlc_audio_output_device_longname(libvlc, soundSystemName, i));
-
-            pDebug() << "found device" << soundSystemName << idName << longName;
-
-            DeviceInfo device(longName, true);
-            device.setAccessInfo(soundSystemFromName(soundSystemName), idName.const_data());
-            device.setCapabilities(DeviceInfo::AudioOutput);
-            newDeviceList.append(device);
-        }
-
-        // libVLC gives no devices for some sound systems, like OSS
-        if (deviceCount == 0) {
-            pDebug() << "manually injecting sound system" << soundSystemName;
-            // NOTE: Do not mark manually injected devices as advanced.
-            //       libphonon filters advanced devices from the default
-            //       selection which on systems such as OSX or Windows can
-            //       lead to an empty device list as the injected device is
-            //       the only available one.
-            DeviceInfo device(QString::fromUtf8(soundSystemName), false);
-            device.setAccessInfo(soundSystemFromName(soundSystemName), "");
-            device.setCapabilities(DeviceInfo::AudioOutput);
-            newDeviceList.append(device);
-        }
-    }
-
-    /*
-     * Compares the list with the devices available at the moment with the last list. If
-     * a new device is seen, a signal is emitted. If a device disappeared, another signal
-     * is emitted.
-     */
-
-    // Search for added devices
-    for (int i = 0; i < newDeviceList.count(); ++i) {
-        int id = newDeviceList[i].id();
-        if (!listContainsDevice(m_devices, id)) {
-            // This is a new device, add it
-            m_devices.append(newDeviceList[i]);
-            emit deviceAdded(id);
-
-            pDebug() << "Added backend device" << newDeviceList[i].name();
-        }
-    }
-
-    // Search for removed devices
-    for (int i = m_devices.count() - 1; i >= 0; --i) {
-        int id = m_devices[i].id();
-        if (!listContainsDevice(newDeviceList, id)) {
-            emit deviceRemoved(id);
-            m_devices.removeAt(i);
-        }
-    }
-}
-
-bool DeviceManager::listContainsDevice(const QList<DeviceInfo> &list, int id)
-{
-    foreach (const DeviceInfo &d, list) {
-        if (d.id() == id)
-            return true;
-    }
-    return false;
-}
-
-DeviceInfo::SoundSystem DeviceManager::soundSystemFromName(const QByteArray &name)
-{
-    foreach (DeviceInfo::SoundSystem soundSystem, m_knownSoundSystems.keys()) {
-        if (m_knownSoundSystems.value(soundSystem) == name)
-            return soundSystem;
-    }
-
-    return DeviceInfo::UnknownSoundSystem;
-}
-
-}
-}
diff --git a/src/devicemanager.h b/src/devicemanager.h
deleted file mode 100644
index 0ae0e87..0000000
--- a/src/devicemanager.h
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-    Copyright (C) 2009-2010 vlc-phonon AUTHORS <kde-multimedia@kde.org>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library.  If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef Phonon_VLC_DEVICEMANAGER_H
-#define Phonon_VLC_DEVICEMANAGER_H
-
-#include <QtCore/QMap>
-#include <QtCore/QObject>
-
-namespace Phonon {
-namespace VLC {
-
-class Backend;
-
-/** \brief Container for information about devices supported by libVLC
- *
- * It includes a (hopefully unique) device identifier, a name identifier, a
- * description, a hardware identifier (may be a platform dependent device name),
- * and other relevant info.
- */
-class DeviceInfo
-{
-public:
-    enum Capability {
-        None            = 0x0000,
-        AudioOutput     = 0x0001,
-        AudioCapture    = 0x0002,
-        VideoCapture    = 0x0004
-    };
-    enum SoundSystem {
-        UnknownSoundSystem = 0,
-        Pulse,
-        Alsa,
-        Oss,
-        Jack,
-        Aout_DirectX,
-        DirectSound,
-        Auhal
-    };
-public:
-    /**
-     * Constructs a device info object and sets it's device identifiers.
-     */
-    explicit DeviceInfo(const QString &name, bool isAdvanced = true);
-
-    int id() const;
-    const QString& name() const;
-    const QString& description() const;
-    bool isAdvanced() const;
-    void setAdvanced(bool advanced);
-    SoundSystem soundSystem() const;
-    QByteArray deviceName() const;
-    void setAccessInfo(SoundSystem soundSystem, const QByteArray &deviceName);
-    quint16 capabilities() const;
-    void setCapabilities(quint16 cap);
-
-private:
-    int m_id;
-    QString m_name;
-    QString m_description;
-    bool m_isAdvanced;
-    SoundSystem m_soundSystem;
-    QByteArray m_deviceName;
-    quint16 m_capabilities;
-};
-
-/** \brief Keeps track of audio/video devices that libVLC supports
- *
- * This class maintains a device list. Types of devices:
- * \li audio output devices
- * \li audio capture devices
- * \li video capture devices
- *
- * Methods are provided to retrieve information about these devices.
- *
- * \see EffectManager
- */
-class DeviceManager : public QObject
-{
-    Q_OBJECT
-
-public:
-    /**
-     * Constructs a device manager and immediately updates the devices.
-     */
-    explicit DeviceManager(Backend *parent);
-
-    /**
-     * Clears all the devices before destroying.
-     */
-    virtual ~DeviceManager();
-
-    /**
-     * \param id The identifier for the device
-     * \return Pointer to DeviceInfo, or NULL if the id is invalid
-     */
-    const DeviceInfo *device(int id) const;
-
-signals:
-    void deviceAdded(int);
-    void deviceRemoved(int);
-
-public slots:
-    /**
-     * Update the current list of active devices. It probes for audio output devices,
-     * audio capture devices, video capture devices. The methods depend on the
-     * device types.
-     */
-    void updateDeviceList();
-
-private:
-    static bool listContainsDevice(const QList<DeviceInfo> &list, int id);
-    DeviceInfo::SoundSystem soundSystemFromName(const QByteArray &name);
-
-private:
-    Backend *m_backend;
-    QList<DeviceInfo> m_devices;
-    QMap<DeviceInfo::SoundSystem, QByteArray> m_knownSoundSystems;
-};
-}
-} // namespace Phonon::VLC
-
-#endif // Phonon_VLC_DEVICEMANAGER_H
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic