diff options
author | Justin McPherson <justin.mcpherson@nokia.com> | 2009-11-11 03:54:41 (GMT) |
---|---|---|
committer | Justin McPherson <justin.mcpherson@nokia.com> | 2009-11-11 03:54:41 (GMT) |
commit | 3340b124d5f2202d9d8cf79d2e70e76dbff003f7 (patch) | |
tree | fbaa416f0008f606724819b2c3306be0330481ec | |
parent | 7719e7fb7cc0724ac0792b8c122c7c20b379bc05 (diff) | |
download | Qt-3340b124d5f2202d9d8cf79d2e70e76dbff003f7.zip Qt-3340b124d5f2202d9d8cf79d2e70e76dbff003f7.tar.gz Qt-3340b124d5f2202d9d8cf79d2e70e76dbff003f7.tar.bz2 |
Gstreamer: Do not assume that the list index is the same as the device id.
Integrated KDE change 1027568 by cguthrie.
This commit fixes a bug that was highlighted when devices had been added/removed or the backend was reloaded.
The AudioDevice used to use a static counter to allocate itself a device id that was propigated through the Phonon API.
Code in the Backend invalidly assumed that the index in the list was the same as this id.
-rw-r--r-- | src/3rdparty/phonon/gstreamer/backend.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/3rdparty/phonon/gstreamer/backend.cpp b/src/3rdparty/phonon/gstreamer/backend.cpp index 7a06378..dab6f35 100644 --- a/src/3rdparty/phonon/gstreamer/backend.cpp +++ b/src/3rdparty/phonon/gstreamer/backend.cpp @@ -294,10 +294,13 @@ QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(ObjectDescripti switch (type) { case Phonon::AudioOutputDeviceType: { QList<AudioDevice> audioDevices = deviceManager()->audioOutputDevices(); - if (index >= 0 && index < audioDevices.size()) { - ret.insert("name", audioDevices[index].gstId); - ret.insert("description", audioDevices[index].description); - ret.insert("icon", QLatin1String("audio-card")); + foreach(const AudioDevice &device, audioDevices) { + if (device.id == index) { + ret.insert("name", device.gstId); + ret.insert("description", device.description); + ret.insert("icon", QLatin1String("audio-card")); + break; + } } } break; |