diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-07-28 13:05:52 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-08-02 09:08:13 (GMT) |
commit | 7b70dd1d7f5f6819b1aa28647826e2137504de54 (patch) | |
tree | a7dee33095458600f43092798c4faf3ea6dcbe02 /src/3rdparty | |
parent | 2e0a41f304e7505602699c9623a96b6174165150 (diff) | |
download | Qt-7b70dd1d7f5f6819b1aa28647826e2137504de54.zip Qt-7b70dd1d7f5f6819b1aa28647826e2137504de54.tar.gz Qt-7b70dd1d7f5f6819b1aa28647826e2137504de54.tar.bz2 |
Added support to Phonon MMF backend for playback of Qt resource files
The backend accesses the resource file path via MediaSource::url().
A small patch to Phonon was required to enable this, because by
default, Phonon passes a QIODevice, rather than the resource file
path, to the backend.
The backend uses this path to create a QResource object, through which
the memory buffer into which the resource file has been read can be
accessed. This buffer is wrapped in a Symbian 8-bit descriptor and
passed to the OpenDesL() function of the appropriate MMF client
utility API.
Playback only works for certain file formats, as the Symbian MIME type
recognizer does not always work. For example, playback of an audio
WAV resource file works, while playback of an MP3 resource file does
not.
Task-number: QTBUG-6562
Reviewed-by: Justin McPherson
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractmediaplayer.cpp | 4 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/mediaobject.cpp | 10 | ||||
-rw-r--r-- | src/3rdparty/phonon/phonon/mediasource.cpp | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index bca0891..3702560 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -258,13 +258,13 @@ void MMF::AbstractMediaPlayer::open() case MediaSource::Stream: { QResource *const resource = m_parent->resource(); - if (resource && resource->isValid()) { + if (resource) { m_buffer.Set(resource->data(), resource->size()); symbianErr = openDescriptor(m_buffer); if (KErrNone != symbianErr) errorMessage = tr("Error opening resource"); } else { - errorMessage = tr("Error opening source: resource not valid"); + errorMessage = tr("Error opening source: resource not opened"); } break; } diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index e16bdf3..b476535 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -315,10 +315,14 @@ void MMF::MediaObject::createPlayer(const MediaSource &source) if (fileName.startsWith(QLatin1String(":/")) || fileName.startsWith(QLatin1String("qrc://"))) { Q_ASSERT(!m_resource); m_resource = new QResource(fileName); - if (m_resource->isValid()) - mediaType = bufferMediaType(m_resource->data(), m_resource->size()); - else + if (m_resource->isValid()) { + if (m_resource->isCompressed()) + errorMessage = tr("Error opening source: resource is compressed"); + else + mediaType = bufferMediaType(m_resource->data(), m_resource->size()); + } else { errorMessage = tr("Error opening source: resource not valid"); + } } else { errorMessage = tr("Error opening source: type not supported"); } diff --git a/src/3rdparty/phonon/phonon/mediasource.cpp b/src/3rdparty/phonon/phonon/mediasource.cpp index 925ff32..8bde565 100644 --- a/src/3rdparty/phonon/phonon/mediasource.cpp +++ b/src/3rdparty/phonon/phonon/mediasource.cpp @@ -58,11 +58,7 @@ MediaSource::MediaSource(const QString &filename) d->type = Stream; d->ioDevice = new QFile(filename); d->setStream(new IODeviceStream(d->ioDevice, d->ioDevice)); -#ifdef Q_OS_SYMBIAN - // On Symbian, we need to access the resource buffer directly, rather than - // via QFile indirection d->url = QUrl::fromLocalFile(fileInfo.absoluteFilePath()); -#endif #else d->type = Invalid; #endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM |