summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/phonon/mmf/mediaobject.cpp
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-07-28 14:05:52 +0100
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-08-02 10:08:13 +0100
commit7b70dd1d7f5f6819b1aa28647826e2137504de54 (patch)
treea7dee33095458600f43092798c4faf3ea6dcbe02 /src/3rdparty/phonon/mmf/mediaobject.cpp
parent2e0a41f304e7505602699c9623a96b6174165150 (diff)
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/phonon/mmf/mediaobject.cpp')
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp
index e16bdf3416..b476535732 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");
}