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

List:       kde-commits
Subject:    [phonon-vlc/five] src: Adapt to the changes in the device management API in Phonon
From:       Casian Andrei <skeletk13 () gmail ! com>
Date:       2014-01-18 19:23:40
Message-ID: E1W4bUa-0007Lu-PP () scm ! kde ! org
[Download RAW message or body]

Git commit f8cd8e53d7a827735ece7f4aa14247b176161e24 by Casian Andrei.
Committed on 18/01/2014 at 19:21.
Pushed by casianandrei into branch 'five'.

Adapt to the changes in the device management API in Phonon

M  +2    -2    src/audio/audiooutput.cpp
M  +1    -4    src/audio/audiooutput.h
M  +6    -56   src/backend.cpp
M  +5    -19   src/backend.h
M  +14   -58   src/devicemanager.cpp
M  +3    -21   src/devicemanager.h
M  +1    -1    src/mediaobject.h

http://commits.kde.org/phonon-vlc/f8cd8e53d7a827735ece7f4aa14247b176161e24

diff --git a/src/audio/audiooutput.cpp b/src/audio/audiooutput.cpp
index 63bd11e..d367fba 100644
--- a/src/audio/audiooutput.cpp
+++ b/src/audio/audiooutput.cpp
@@ -69,9 +69,9 @@ void AudioOutput::setVolume(qreal volume)
     }
 }
 
-int AudioOutput::outputDevice() const
+AudioOutputDevice AudioOutput::outputDevice() const
 {
-    return m_device.index();
+    return m_device;
 }
 
 #if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 2, 0))
diff --git a/src/audio/audiooutput.h b/src/audio/audiooutput.h
index c69bb56..04619ef 100644
--- a/src/audio/audiooutput.h
+++ b/src/audio/audiooutput.h
@@ -75,10 +75,7 @@ public:
      */
     void setVolume(qreal volume);
 
-    /**
-     * \return The index of the current audio output device from the list obtained \
                from the backend object.
-     */
-    int outputDevice() const;
+    AudioOutputDevice outputDevice() const;
 
     /**
      * Sets the current output device for this audio output.
diff --git a/src/backend.cpp b/src/backend.cpp
index 39024ca..31ca074 100644
--- a/src/backend.cpp
+++ b/src/backend.cpp
@@ -164,69 +164,19 @@ QObject *Backend::createObject(BackendInterface::Class c, \
QObject *parent, const  return 0;
 }
 
-QList<int> Backend::objectDescriptionIndexes(ObjectDescriptionType type) const
+QList<AudioOutputDevice> Backend::audioOutputDevices() const
 {
-    QList<int> list;
-
-    switch (type) {
-//     case Phonon::AudioChannelType: {
-//         list << GlobalAudioChannels::instance()->globalIndexes();
-//     }
-//     break;
-     case Phonon::AudioOutputDeviceType:
-     case Phonon::AudioCaptureDeviceType:
-     case Phonon::VideoCaptureDeviceType: {
-         return deviceManager()->deviceIds(type);
-     }
-//     break;
-//    case Phonon::EffectType: {
-//        QList<EffectInfo *> effectList = effectManager()->effects();
-//        for (int eff = 0; eff < effectList.size(); ++eff) {
-//            list.append(eff);
-//        }
-//    }
-//     break;
-//     case Phonon::SubtitleType: {
-//         list << GlobalSubtitles::instance()->globalIndexes();
-//     }
-//     break;
-    }
-
-    return list;
+    return m_deviceManager->audioOutputDevices();
 }
 
-QHash<QByteArray, QVariant> \
Backend::objectDescriptionProperties(ObjectDescriptionType type, int index) const \
+QList<AudioCaptureDevice> Backend::audioCaptureDevices() const  {
-    QHash<QByteArray, QVariant> ret;
-
-    switch (type) {
-    case Phonon::AudioOutputDeviceType:
-    case Phonon::AudioCaptureDeviceType:
-    case Phonon::VideoCaptureDeviceType: {
-        // Index should be unique, even for different categories
-        return deviceManager()->deviceProperties(index);
-    }
-    break;
-//    case Phonon::EffectType: {
-//        QList<EffectInfo *> effectList = effectManager()->effects();
-//        if (index >= 0 && index <= effectList.size()) {
-//            const EffectInfo *effect = effectList[ index ];
-//            ret.insert("name", effect->name());
-//            ret.insert("description", effect->description());
-//            ret.insert("author", effect->author());
-//        } else {
-//            Q_ASSERT(1); // Since we use list position as ID, this should not \
                happen
-//        }
-//    }
-//     break;
-    }
-
-    return ret;
+    return m_deviceManager->audioCaptureDevices();
 }
 
-QList<AudioOutputDevice> Backend::audioOutputDevices() const
+QList<VideoCaptureDevice> Backend::videoCaptureDevices() const
 {
-    return m_deviceManager->audioOutputDevies();
+    return m_deviceManager->videoCaptureDevices();
 }
 
 DeviceManager *Backend::deviceManager() const
diff --git a/src/backend.h b/src/backend.h
index 3b392e0..aa943a0 100644
--- a/src/backend.h
+++ b/src/backend.h
@@ -89,28 +89,14 @@ public:
      */
     QObject *createObject(BackendInterface::Class, QObject *parent, const \
QList<QVariant> &args);  
-    /**
-     * Returns a list of indexes for the desired object types. It specifies a list \
                of objects
-     * of a particular category that the backend knows about. These indexes can be \
                used with
-     * objectDescriptionProperties() to get the properties of a particular object.
-     *
-     * \param type The type of objects for the list
-     */
-    QList<int> objectDescriptionIndexes(ObjectDescriptionType type) const;
-
-    /**
-     * Returns a list of properties for a particular object of the desired category.
-     *
-     * \param type The type of object for the index
-     * \param index The index for the object of the desired type
-     * \return The property list. If the object is inexistent, an empty list is \
                returned.
-     */
-    QHash<QByteArray, QVariant> objectDescriptionProperties(ObjectDescriptionType \
                type, int index) const;
-
     QList<AudioOutputDevice> audioOutputDevices() const Q_DECL_OVERRIDE \
Q_DECL_FINAL; +    QList<AudioCaptureDevice> audioCaptureDevices() const \
Q_DECL_OVERRIDE Q_DECL_FINAL; +    QList<VideoCaptureDevice> videoCaptureDevices() \
const Q_DECL_OVERRIDE Q_DECL_FINAL;  
 Q_SIGNALS:
-    void objectDescriptionChanged(ObjectDescriptionType);
+    void audioOutputDevicesChanged();
+    void audioCaptureDevicesChanged();
+    void videoCaptureDevicesChanged();
 
 private:
     DeviceManager *m_deviceManager;
diff --git a/src/devicemanager.cpp b/src/devicemanager.cpp
index aa5a5b4..785c73b 100644
--- a/src/devicemanager.cpp
+++ b/src/devicemanager.cpp
@@ -131,75 +131,31 @@ DeviceManager::~DeviceManager()
 {
 }
 
-QList<int> DeviceManager::deviceIds(ObjectDescriptionType type)
+QList<AudioOutputDevice> DeviceManager::audioOutputDevices()
 {
-    DeviceInfo::Capability capability = DeviceInfo::None;
-    switch (type) {
-    case Phonon::AudioOutputDeviceType:
-        capability = DeviceInfo::AudioOutput;
-        break;
-    case Phonon::AudioCaptureDeviceType:
-        capability = DeviceInfo::AudioCapture;
-        break;
-    case Phonon::VideoCaptureDeviceType:
-        capability = DeviceInfo::VideoCapture;
-        break;
-    default: ;
-    }
+    QList<AudioOutputDevice> devices;
 
-    QList<int> ids;
+    qDebug() << Q_FUNC_INFO << "Audio output device count:" << m_devices.count();
     foreach (const DeviceInfo &device, m_devices) {
-        if (device.capabilities() & capability)
-            ids.append(device.id());
+        if (device.capabilities() & DeviceInfo::AudioOutput)
+#warning not all properties of DeviceInfo are implemented in AOD
+#warning availability not in ctor
+            devices.append(AudioOutputDevice(device.name(), device.description()));
     }
 
-    return ids;
+    return devices;
 }
 
-QHash<QByteArray, QVariant> DeviceManager::deviceProperties(int id)
+QList<AudioCaptureDevice> DeviceManager::audioCaptureDevices()
 {
-    QHash<QByteArray, QVariant> properties;
-
-    foreach (const DeviceInfo &device, m_devices) {
-        if (device.id() == id) {
-            properties.insert("name", device.name());
-            properties.insert("description", device.description());
-            properties.insert("isAdvanced", device.isAdvanced());
-            properties.insert("discovererIcon", "vlc");
-
-            if (device.capabilities() & DeviceInfo::AudioOutput) {
-                properties.insert("icon", QLatin1String("audio-card"));
-            }
-
-            if (device.capabilities() & DeviceInfo::AudioCapture) {
-                properties.insert("hasaudio", true);
-                properties.insert("icon", QLatin1String("audio-input-microphone"));
-            }
-
-            if (device.capabilities() & DeviceInfo::VideoCapture) {
-                properties.insert("hasvideo", true);
-                properties.insert("icon", QLatin1String("camera-web"));
-            }
-            break;
-        }
-    }
-
-    return properties;
+    // TODO
+    return QList<AudioCaptureDevice>();
 }
 
-QList<AudioOutputDevice> DeviceManager::audioOutputDevies()
+QList<VideoCaptureDevice> DeviceManager::videoCaptureDevices()
 {
-    QList<AudioOutputDevice> devices;
-
-    qDebug() << "DEVICES!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << m_devices.count();
-    foreach (const DeviceInfo &device, m_devices) {
-        if (device.capabilities() & DeviceInfo::AudioOutput)
-#warning not all properties of DeviceInfo are implemented in AOD
-#warning availability not in ctor
-            devices.append(AudioOutputDevice(device.id(), device.name(), \
                device.description()));
-    }
-
-    return devices;
+    // TODO
+    return QList<VideoCaptureDevice>();
 }
 
 const DeviceInfo *DeviceManager::device(int id) const
diff --git a/src/devicemanager.h b/src/devicemanager.h
index 6575f6d..e6cb551 100644
--- a/src/devicemanager.h
+++ b/src/devicemanager.h
@@ -107,27 +107,9 @@ public:
      */
     virtual ~DeviceManager();
 
-    /**
-     * \param type Only devices with a capability of this type are returned
-     * The following are supported:
-     * \li AudioOutputDeviceType
-     * \li AudioCaptureDeviceType
-     * \li VideoCaptureDeviceType
-     *
-     * \return A list of device identifiers that have capabilities that
-     * match the desired type
-     *
-     * \note The capture devices are temporarily not implemented / removed
-     */
-    QList<int> deviceIds(ObjectDescriptionType type);
-
-    /**
-     * \param id The identifier for the device
-     * \return Object description properties for a device
-     */
-    QHash<QByteArray, QVariant> deviceProperties(int id);
-
-    QList<AudioOutputDevice> audioOutputDevies();
+    QList<AudioOutputDevice> audioOutputDevices();
+    QList<AudioCaptureDevice> audioCaptureDevices();
+    QList<VideoCaptureDevice> videoCaptureDevices();
 
     /**
      * \param id The identifier for the device
diff --git a/src/mediaobject.h b/src/mediaobject.h
index 5e47e19..61c55dd 100644
--- a/src/mediaobject.h
+++ b/src/mediaobject.h
@@ -28,7 +28,7 @@
 
 #include <phonon/playerinterface.h>
 #warning included for MetaData maybe move to inteface instead
-#include <phonon/phononnamespace.h>
+#include <phonon/phononglobal.h>
 
 #include "mediaplayer.h"
 


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

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