diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-10-07 12:10:26 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-10-07 12:28:36 (GMT) |
commit | 16e21cb0beb0e5f5189048b95d1cb74ae0c0702a (patch) | |
tree | dc673cd19fa536fab55f45ff369e0d92b94c4d0e /src | |
parent | d17a315a082a8cb5d7f3f5ae47dabbe721982e2c (diff) | |
download | Qt-16e21cb0beb0e5f5189048b95d1cb74ae0c0702a.zip Qt-16e21cb0beb0e5f5189048b95d1cb74ae0c0702a.tar.gz Qt-16e21cb0beb0e5f5189048b95d1cb74ae0c0702a.tar.bz2 |
mediaplayer: crash in settings dialog.
The MediaPlayer requires that an output device is available.
Task-number: QTBUG-4755
Reviewed-by: Gareth Stockwell
Diffstat (limited to 'src')
-rw-r--r-- | src/3rdparty/phonon/mmf/audiooutput.cpp | 26 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/audiooutput.h | 13 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/backend.cpp | 18 |
3 files changed, 42 insertions, 15 deletions
diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp index 58e2f5e..5a00f60 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.cpp +++ b/src/3rdparty/phonon/mmf/audiooutput.cpp @@ -18,6 +18,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <e32debug.h> +#include <QCoreApplication> + #include "audiooutput.h" #include "defs.h" #include "mediaobject.h" @@ -74,16 +76,13 @@ void MMF::AudioOutput::setVolume(qreal volume) int MMF::AudioOutput::outputDevice() const { - return 0; -} - -bool MMF::AudioOutput::setOutputDevice(int) -{ - return true; + return AudioOutputDeviceID; } -bool MMF::AudioOutput::setOutputDevice(const Phonon::AudioOutputDevice &) +bool MMF::AudioOutput::setOutputDevice(int index) { + Q_ASSERT_X(index == AudioOutputDeviceID, Q_FUNC_INFO, + "We only support one output device, with id 0"); return true; } @@ -101,4 +100,17 @@ bool MMF::AudioOutput::activateOnMediaObject(MediaObject *mo) return true; } +QHash<QByteArray, QVariant> MMF::AudioOutput::audioOutputDescription(int index) +{ + if (index == AudioOutputDeviceID) { + QHash<QByteArray, QVariant> retval; + + retval.insert("name", QCoreApplication::translate("Phonon::MMF", "Audio Output")); + retval.insert("description", QCoreApplication::translate("Phonon::MMF", "The audio output device")); + retval.insert("available", true); + + return retval; + } +} + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/audiooutput.h b/src/3rdparty/phonon/mmf/audiooutput.h index 0a962a9..d0ba086 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.h +++ b/src/3rdparty/phonon/mmf/audiooutput.h @@ -19,6 +19,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #ifndef PHONON_MMF_AUDIOOUTPUT_H #define PHONON_MMF_AUDIOOUTPUT_H +#include <QHash> + #include "mmf_medianode.h" #include <phonon/audiooutputinterface.h> @@ -65,10 +67,12 @@ public: */ virtual bool setOutputDevice(int); - /** - * Has no effect. - */ - virtual bool setOutputDevice(const Phonon::AudioOutputDevice &); + static QHash<QByteArray, QVariant> audioOutputDescription(int index); + + enum Constants + { + AudioOutputDeviceID = 0 + }; protected: virtual bool activateOnMediaObject(MediaObject *mo); @@ -78,6 +82,7 @@ Q_SIGNALS: void audioDeviceFailed(); private: + void setVolumeObserver(VolumeObserver* observer); qreal m_volume; diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp index be43f46..f542ec9 100644 --- a/src/3rdparty/phonon/mmf/backend.cpp +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -107,6 +107,12 @@ QList<int> Backend::objectDescriptionIndexes(ObjectDescriptionType type) const { case EffectType: retval.append(EffectFactory::effectIndexes()); + break; + case AudioOutputDeviceType: + // We only have one possible output device, but we need at least + // one. + retval.append(AudioOutput::AudioOutputDeviceID); + break; default: ; } @@ -119,10 +125,14 @@ QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(ObjectDescripti { TRACE_CONTEXT(Backend::connectNodes, EBackend); - if (type == EffectType) - return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index)); - else - return QHash<QByteArray, QVariant>(); + switch (type) { + case EffectType: + return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index)); + case AudioOutputDeviceType: + return AudioOutput::audioOutputDescription(index); + default: + return QHash<QByteArray, QVariant>(); + } } bool Backend::startConnectionChange(QSet<QObject *>) |