summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.cpp28
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.h6
-rw-r--r--src/3rdparty/phonon/mmf/abstractplayer.h4
-rw-r--r--src/3rdparty/phonon/mmf/abstractvideoplayer.cpp6
-rw-r--r--src/3rdparty/phonon/mmf/abstractvideoplayer.h1
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.cpp6
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.h1
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.cpp2
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.h2
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.cpp75
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.h11
-rw-r--r--src/3rdparty/phonon/phonon/mediasource.cpp1
-rw-r--r--src/s60installs/s60installs.pro4
13 files changed, 125 insertions, 22 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
index be2a568..3702560 100644
--- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
@@ -16,6 +16,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <QResource>
#include <QUrl>
#include "abstractmediaplayer.h"
@@ -216,9 +217,10 @@ void MMF::AbstractMediaPlayer::doSetTickInterval(qint32 interval)
TRACE_EXIT_0();
}
-void MMF::AbstractMediaPlayer::open(const MediaSource &source, RFile& file)
+void MMF::AbstractMediaPlayer::open()
{
- TRACE_CONTEXT(AbstractMediaPlayer::setFileSource, EAudioApi);
+ TRACE_CONTEXT(AbstractMediaPlayer::open, EAudioApi);
+ const MediaSource source = m_parent->source();
TRACE_ENTRY("state %d source.type %d", privateState(), source.type());
close();
@@ -229,7 +231,9 @@ void MMF::AbstractMediaPlayer::open(const MediaSource &source, RFile& file)
switch (source.type()) {
case MediaSource::LocalFile: {
- symbianErr = openFile(file);
+ RFile *const file = m_parent->file();
+ Q_ASSERT(file);
+ symbianErr = openFile(*file);
if (KErrNone != symbianErr)
errorMessage = tr("Error opening file");
break;
@@ -237,9 +241,10 @@ void MMF::AbstractMediaPlayer::open(const MediaSource &source, RFile& file)
case MediaSource::Url: {
const QUrl url(source.url());
-
if (url.scheme() == QLatin1String("file")) {
- symbianErr = openFile(file);
+ RFile *const file = m_parent->file();
+ Q_ASSERT(file);
+ symbianErr = openFile(*file);
if (KErrNone != symbianErr)
errorMessage = tr("Error opening file");
} else {
@@ -251,6 +256,19 @@ void MMF::AbstractMediaPlayer::open(const MediaSource &source, RFile& file)
break;
}
+ case MediaSource::Stream: {
+ QResource *const resource = m_parent->resource();
+ 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 opened");
+ }
+ break;
+ }
+
// Other source types are handled in MediaObject::createPlayer
// Protection against adding new media types and forgetting to update this switch
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
index 7d28caf..e795ecb 100644
--- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
@@ -47,7 +47,7 @@ protected:
AbstractMediaPlayer(MediaObject *parent, const AbstractPlayer *player);
public:
- virtual void open(const Phonon::MediaSource&, RFile&);
+ virtual void open();
// MediaObjectInterface
virtual void play();
@@ -70,6 +70,7 @@ protected:
virtual int setDeviceVolume(int mmfVolume) = 0;
virtual int openFile(RFile& file) = 0;
virtual int openUrl(const QString& url) = 0;
+ virtual int openDescriptor(const TDesC8 &des) = 0;
virtual int bufferStatus() const = 0;
void updateMetaData();
@@ -123,6 +124,9 @@ private:
bool m_prefinishMarkSent;
bool m_aboutToFinishSent;
+ // Used for playback of resource files
+ TPtrC8 m_buffer;
+
QMultiMap<QString, QString> m_metaData;
};
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h
index 30d5243..dd98c7c 100644
--- a/src/3rdparty/phonon/mmf/abstractplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractplayer.h
@@ -26,8 +26,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "abstractvideooutput.h"
-class RFile;
-
QT_BEGIN_NAMESPACE
namespace Phonon
@@ -54,7 +52,7 @@ class AbstractPlayer : public QObject
public:
AbstractPlayer(const AbstractPlayer *player);
- virtual void open(const Phonon::MediaSource&, RFile&) = 0;
+ virtual void open() = 0;
virtual void close() = 0;
// MediaObjectInterface (implemented)
diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
index 9ea4d18..fb20bea 100644
--- a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
@@ -144,6 +144,12 @@ int MMF::AbstractVideoPlayer::openUrl(const QString &url)
return err;
}
+int MMF::AbstractVideoPlayer::openDescriptor(const TDesC8 &des)
+{
+ TRAPD(err, m_player->OpenDesL(des));
+ return err;
+}
+
int MMF::AbstractVideoPlayer::bufferStatus() const
{
int result = 0;
diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.h b/src/3rdparty/phonon/mmf/abstractvideoplayer.h
index d854793..3ff3c75 100644
--- a/src/3rdparty/phonon/mmf/abstractvideoplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.h
@@ -66,6 +66,7 @@ public:
virtual int setDeviceVolume(int mmfVolume);
virtual int openFile(RFile &file);
virtual int openUrl(const QString &url);
+ virtual int openDescriptor(const TDesC8 &des);
virtual int bufferStatus() const;
virtual void close();
diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp
index f49e898..7c8b9bd 100644
--- a/src/3rdparty/phonon/mmf/audioplayer.cpp
+++ b/src/3rdparty/phonon/mmf/audioplayer.cpp
@@ -137,6 +137,12 @@ int MMF::AudioPlayer::openUrl(const QString& /*url*/)
return 0;
}
+int MMF::AudioPlayer::openDescriptor(const TDesC8 &des)
+{
+ TRAPD(err, m_player->OpenDesL(des));
+ return err;
+}
+
int MMF::AudioPlayer::bufferStatus() const
{
int result = 0;
diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h
index 0eb8bb7..e43cadd 100644
--- a/src/3rdparty/phonon/mmf/audioplayer.h
+++ b/src/3rdparty/phonon/mmf/audioplayer.h
@@ -67,6 +67,7 @@ typedef CMdaAudioPlayerUtility NativePlayer;
virtual int setDeviceVolume(int mmfVolume);
virtual int openFile(RFile& file);
virtual int openUrl(const QString& url);
+ virtual int openDescriptor(const TDesC8 &des);
virtual int bufferStatus() const;
virtual void close();
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.cpp b/src/3rdparty/phonon/mmf/dummyplayer.cpp
index d39ef76..ba75b02 100644
--- a/src/3rdparty/phonon/mmf/dummyplayer.cpp
+++ b/src/3rdparty/phonon/mmf/dummyplayer.cpp
@@ -92,7 +92,7 @@ qint64 MMF::DummyPlayer::totalTime() const
return 0;
}
-void MMF::DummyPlayer::open(const Phonon::MediaSource &, RFile &)
+void MMF::DummyPlayer::open()
{
}
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.h b/src/3rdparty/phonon/mmf/dummyplayer.h
index 9d45696..5b00411 100644
--- a/src/3rdparty/phonon/mmf/dummyplayer.h
+++ b/src/3rdparty/phonon/mmf/dummyplayer.h
@@ -57,7 +57,7 @@ public:
virtual qint64 totalTime() const;
// AbstractPlayer
- virtual void open(const Phonon::MediaSource&, RFile&);
+ virtual void open();
virtual void close();
virtual void doSetTickInterval(qint32 interval);
};
diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp
index d264377..98326b8 100644
--- a/src/3rdparty/phonon/mmf/mediaobject.cpp
+++ b/src/3rdparty/phonon/mmf/mediaobject.cpp
@@ -34,6 +34,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "mediaobject.h"
#include <QDir>
+#include <QResource>
#include <QUrl>
QT_BEGIN_NAMESPACE
@@ -52,6 +53,8 @@ using namespace Phonon::MMF;
MMF::MediaObject::MediaObject(QObject *parent) : MMF::MediaNode::MediaNode(parent)
, m_recognizerOpened(false)
, m_nextSourceSet(false)
+ , m_file(0)
+ , m_resource(0)
{
m_player.reset(new DummyPlayer());
@@ -68,7 +71,12 @@ MMF::MediaObject::~MediaObject()
TRACE_CONTEXT(MediaObject::~MediaObject, EAudioApi);
TRACE_ENTRY_0();
- m_file.Close();
+ delete m_resource;
+
+ if (m_file)
+ m_file->Close();
+ delete m_file;
+
m_fileServer.Close();
m_recognizer.Close();
@@ -122,12 +130,13 @@ MMF::MediaType MMF::MediaObject::fileMediaType
const QHBufC fileNameSymbian(QDir::toNativeSeparators(fileName));
- m_file.Close();
- TInt err = m_file.Open(m_fileServer, *fileNameSymbian, EFileRead | EFileShareReadersOnly);
+ Q_ASSERT(!m_file);
+ m_file = new RFile;
+ TInt err = m_file->Open(m_fileServer, *fileNameSymbian, EFileRead | EFileShareReadersOnly);
if (KErrNone == err) {
TDataRecognitionResult recognizerResult;
- err = m_recognizer.RecognizeData(m_file, recognizerResult);
+ err = m_recognizer.RecognizeData(*m_file, recognizerResult);
if (KErrNone == err) {
const TPtrC mimeType = recognizerResult.iDataType.Des();
result = Utils::mimeTypeToMediaType(mimeType);
@@ -142,6 +151,23 @@ MMF::MediaType MMF::MediaObject::fileMediaType
return result;
}
+MMF::MediaType MMF::MediaObject::bufferMediaType(const uchar *data, qint64 size)
+{
+ TRACE_CONTEXT(MediaObject::bufferMediaType, EAudioInternal);
+ MediaType result = MediaTypeUnknown;
+ if (openRecognizer()) {
+ TDataRecognitionResult recognizerResult;
+ const TPtrC8 des(data, size);
+ const TInt err = m_recognizer.RecognizeData(KNullDesC, des, recognizerResult);
+ if (KErrNone == err) {
+ const TPtrC mimeType = recognizerResult.iDataType.Des();
+ result = Utils::mimeTypeToMediaType(mimeType);
+ } else {
+ TRACE("RApaLsSession::RecognizeData error %d", err);
+ }
+ }
+ return result;
+}
//-----------------------------------------------------------------------------
// MediaObjectInterface
@@ -228,9 +254,17 @@ void MMF::MediaObject::setSource(const MediaSource &source)
void MMF::MediaObject::switchToSource(const MediaSource &source)
{
+ if (m_file)
+ m_file->Close();
+ delete m_file;
+ m_file = 0;
+
+ delete m_resource;
+ m_resource = 0;
+
createPlayer(source);
m_source = source;
- m_player->open(m_source, m_file);
+ m_player->open();
emit currentSourceChanged(m_source);
}
@@ -272,10 +306,29 @@ void MMF::MediaObject::createPlayer(const MediaSource &source)
case MediaSource::Invalid:
case MediaSource::Disc:
- case MediaSource::Stream:
errorMessage = tr("Error opening source: type not supported");
break;
+ case MediaSource::Stream:
+ {
+ const QString fileName = source.url().toLocalFile();
+ if (fileName.startsWith(QLatin1String(":/")) || fileName.startsWith(QLatin1String("qrc://"))) {
+ Q_ASSERT(!m_resource);
+ m_resource = new QResource(fileName);
+ 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");
+ }
+ }
+ break;
+
case MediaSource::Empty:
TRACE_0("Empty media source");
break;
@@ -374,6 +427,16 @@ void MMF::MediaObject::volumeChanged(qreal volume)
m_player->volumeChanged(volume);
}
+RFile* MMF::MediaObject::file() const
+{
+ return m_file;
+}
+
+QResource* MMF::MediaObject::resource() const
+{
+ return m_resource;
+}
+
//-----------------------------------------------------------------------------
// MediaNode
//-----------------------------------------------------------------------------
diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h
index f15eb21..5399e27 100644
--- a/src/3rdparty/phonon/mmf/mediaobject.h
+++ b/src/3rdparty/phonon/mmf/mediaobject.h
@@ -33,6 +33,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
QT_BEGIN_NAMESPACE
+class QResource;
+
namespace Phonon
{
namespace MMF
@@ -87,6 +89,9 @@ public:
void setVideoOutput(AbstractVideoOutput* videoOutput);
+ RFile* file() const;
+ QResource* resource() const;
+
public Q_SLOTS:
void volumeChanged(qreal volume);
void switchToNextSource();
@@ -117,6 +122,7 @@ private:
// Audio / video media type recognition
MediaType fileMediaType(const QString& fileName);
+ MediaType bufferMediaType(const uchar *data, qint64 size);
// TODO: urlMediaType function
static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &);
@@ -132,9 +138,8 @@ private:
MediaSource m_nextSource;
bool m_nextSourceSet;
- // Storing the file handle here to work around KErrInUse error
- // from MMF player utility OpenFileL functions
- RFile m_file;
+ RFile* m_file;
+ QResource* m_resource;
QScopedPointer<AbstractPlayer> m_player;
diff --git a/src/3rdparty/phonon/phonon/mediasource.cpp b/src/3rdparty/phonon/phonon/mediasource.cpp
index 11d2428..d70b38b 100644
--- a/src/3rdparty/phonon/phonon/mediasource.cpp
+++ b/src/3rdparty/phonon/phonon/mediasource.cpp
@@ -58,6 +58,7 @@ MediaSource::MediaSource(const QString &filename)
d->type = Stream;
d->ioDevice = new QFile(filename);
d->setStream(new IODeviceStream(d->ioDevice, d->ioDevice));
+ d->url = QUrl::fromLocalFile(fileInfo.absoluteFilePath());
#else
d->type = Invalid;
#endif //QT_NO_PHONON_ABSTRACTMEDIASTREAM
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index 4addb84..8a8167b 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -57,8 +57,8 @@ symbian: {
bearerPluginLocation = $${EPOCROOT}epoc32/release/$(PLATFORM)/$(TARGET)
bearerStubZ = $${EPOCROOT}$${HW_ZDIR}$${QT_PLUGINS_BASE_DIR}/bearer/qsymbianbearer$${QT_LIBINFIX}.qtplugin
BLD_INF_RULES.prj_exports += \
- "qsymbianbearer.qtplugin $$bearerStubZ" \
- "qsymbianbearer.qtplugin $${EPOCROOT}epoc32/winscw/c$${QT_PLUGINS_BASE_DIR}/bearer/qsymbianbearer$${QT_LIBINFIX}.qtplugin"
+ "qsymbianbearer.qtplugin /$${HW_ZDIR}$${QT_PLUGINS_BASE_DIR}/bearer/qsymbianbearer$${QT_LIBINFIX}.qtplugin" \
+ "qsymbianbearer.qtplugin /epoc32/winscw/c$${QT_PLUGINS_BASE_DIR}/bearer/qsymbianbearer$${QT_LIBINFIX}.qtplugin"
} else {
pluginLocations = $$QT_BUILD_TREE/plugins/s60
bearerPluginLocation = $$QT_BUILD_TREE/plugins/bearer