From a27d314863d38821f5122973be3fe5306ed82ef1 Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Thu, 2 Jul 2009 15:51:37 +0200 Subject: Pouring. --- src/3rdparty/phonon/mmf/audiooutput.cpp | 52 +++++++++ src/3rdparty/phonon/mmf/audiooutput.h | 46 ++++++++ src/3rdparty/phonon/mmf/backend.cpp | 101 ++++++++++++++++++ src/3rdparty/phonon/mmf/backend.h | 49 +++++++++ src/3rdparty/phonon/mmf/mediaobject.cpp | 184 ++++++++++++++++++++++++++++++++ src/3rdparty/phonon/mmf/mediaobject.h | 87 +++++++++++++++ src/plugins/phonon/mmf/mmf.pro | 54 +++------- src/plugins/phonon/phonon.pro | 1 + 8 files changed, 532 insertions(+), 42 deletions(-) create mode 100644 src/3rdparty/phonon/mmf/audiooutput.cpp create mode 100644 src/3rdparty/phonon/mmf/audiooutput.h create mode 100644 src/3rdparty/phonon/mmf/backend.cpp create mode 100644 src/3rdparty/phonon/mmf/backend.h create mode 100644 src/3rdparty/phonon/mmf/mediaobject.cpp create mode 100644 src/3rdparty/phonon/mmf/mediaobject.h diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp new file mode 100644 index 0000000..a66e079 --- /dev/null +++ b/src/3rdparty/phonon/mmf/audiooutput.cpp @@ -0,0 +1,52 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#include "audiooutput.h" + +using namespace Phonon; +using namespace Phonon::MMF; + +AudioOutput::AudioOutput(Backend *, QObject *parent) +{ + setParent(parent); +} + +qreal AudioOutput::volume() const +{ + return 0; +} + +void AudioOutput::setVolume(qreal) +{ +} + +int AudioOutput::outputDevice() const +{ + return 0; +} + +bool AudioOutput::setOutputDevice(int) +{ + return true; +} + +bool AudioOutput::setOutputDevice(const Phonon::AudioOutputDevice &) +{ + return true; +} + diff --git a/src/3rdparty/phonon/mmf/audiooutput.h b/src/3rdparty/phonon/mmf/audiooutput.h new file mode 100644 index 0000000..4072756 --- /dev/null +++ b/src/3rdparty/phonon/mmf/audiooutput.h @@ -0,0 +1,46 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#ifndef PHONON_MMF_AUDIOOUTPUT_H +#define PHONON_MMF_AUDIOOUTPUT_H + +#include + +namespace Phonon +{ + namespace MMF + { + class Backend; + + class AudioOutput : public QObject + , public AudioOutputInterface42 + { + Q_OBJECT + public: + AudioOutput(Backend *backend, QObject *parent); + virtual qreal volume() const; + virtual void setVolume(qreal); + + virtual int outputDevice() const; + virtual bool setOutputDevice(int); + virtual bool setOutputDevice(const Phonon::AudioOutputDevice &); + }; + } +} + +#endif diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp new file mode 100644 index 0000000..5b78158 --- /dev/null +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -0,0 +1,101 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#include +#include + +#include "backend.h" +#include "audiooutput.h" +#include "mediaobject.h" + +using namespace Phonon; +using namespace Phonon::MMF; + +Backend::Backend(QObject *parent) +{ + setParent(parent); + + setProperty("identifier", QLatin1String("mmf")); + setProperty("backendName", QLatin1String("MMF")); + setProperty("backendComment", QLatin1String("MMF Backend")); + setProperty("backendVersion", QLatin1String("0.1")); + setProperty("backendWebsite", QLatin1String("http://www.qtsoftware.com/")); +} + +QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList &) +{ + switch(c) + { + case AudioOutputClass: + return new AudioOutput(this, parent); + case MediaObjectClass: + return new MediaObject(parent); + case VolumeFaderEffectClass: + /* Fallthrough. */ + case VisualizationClass: + /* Fallthrough. */ + case VideoDataOutputClass: + /* Fallthrough. */ + case EffectClass: + /* Fallthrough. */ + case VideoWidgetClass: + return 0; + } + + Q_ASSERT_X(false, Q_FUNC_INFO, + "This line should never be reached."); + return 0; +} + +QList Backend::objectDescriptionIndexes(ObjectDescriptionType) const +{ + return QList(); +} + +QHash Backend::objectDescriptionProperties(ObjectDescriptionType, int) const +{ + return QHash(); +} + +bool Backend::startConnectionChange(QSet) +{ + return false; +} + +bool Backend::connectNodes(QObject *, QObject *) +{ + return false; +} + +bool Backend::disconnectNodes(QObject *, QObject *) +{ + return false; +} + +bool Backend::endConnectionChange(QSet) +{ + return false; +} + +QStringList Backend::availableMimeTypes() const +{ + return QStringList(); +} + +Q_EXPORT_PLUGIN2(phonon_mmf, Phonon::MMF::Backend); + diff --git a/src/3rdparty/phonon/mmf/backend.h b/src/3rdparty/phonon/mmf/backend.h new file mode 100644 index 0000000..cb03859 --- /dev/null +++ b/src/3rdparty/phonon/mmf/backend.h @@ -0,0 +1,49 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#ifndef PHONON_MMF_BACKEND_H +#define PHONON_MMF_BACKEND_H + +#include +#include + +namespace Phonon +{ + namespace MMF + { + class Backend : public QObject + , public BackendInterface + { + Q_OBJECT + Q_INTERFACES(Phonon::BackendInterface) + public: + Backend(QObject *parent = 0); + + virtual QObject *createObject(BackendInterface::Class c, QObject *parent, const QList &args); + virtual QList objectDescriptionIndexes(ObjectDescriptionType type) const; + virtual QHash objectDescriptionProperties(ObjectDescriptionType type, int index) const; + virtual bool startConnectionChange(QSet); + virtual bool connectNodes(QObject *, QObject *); + virtual bool disconnectNodes(QObject *, QObject *); + virtual bool endConnectionChange(QSet); + virtual QStringList availableMimeTypes() const; + }; + } +} + +#endif diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp new file mode 100644 index 0000000..2db56d6 --- /dev/null +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -0,0 +1,184 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#include "mediaobject.h" + +using namespace Phonon; +using namespace Phonon::MMF; + +MediaObject::MediaObject(QObject *parent) : m_player(0) + , m_error(NoError) + , m_state(StoppedState) +{ + Q_UNUSED(parent); + m_player = CDrmPlayerUtility::NewL(*this, 0, EMdaPriorityPreferenceNone); +} + +MediaObject::~MediaObject() +{ + delete m_player; +} + +void MediaObject::play() +{ + m_state = PlayingState; + m_player->Play(); +} + +void MediaObject::pause() +{ + m_state = PausedState; + m_player->Pause(); +} + +void MediaObject::stop() +{ + m_state = StoppedState; + m_player->Stop(); +} + +void MediaObject::seek(qint64 milliseconds) +{ + m_player->SetPosition(toMicroSeconds(milliseconds)); +} + +qint32 MediaObject::tickInterval() const +{ + return 0; +} + +void MediaObject::setTickInterval(qint32 interval) +{ + Q_UNUSED(interval); +} + +bool MediaObject::hasVideo() const +{ + return false; +} + +bool MediaObject::isSeekable() const +{ + return false; +} + +qint64 MediaObject::currentTime() const +{ + TTimeIntervalMicroSeconds mss; + const TInt retcode = m_player->GetPosition(mss); + + if(retcode == KErrNone) + return toMilliSeconds(m_player->Duration()); + else { + m_state = ErrorState; + m_error = NormalError; + return -1; + } +} + +Phonon::State MediaObject::state() const +{ + return m_state; +} + +QString MediaObject::errorString() const +{ + return QString(); +} + +Phonon::ErrorType MediaObject::errorType() const +{ + return m_error; +} + +qint64 MediaObject::toMilliSeconds(const TTimeIntervalMicroSeconds &in) +{ + return in.Int64() / 1000; +} + +TTimeIntervalMicroSeconds MediaObject::toMicroSeconds(qint64 ms) +{ + return TTimeIntervalMicroSeconds(TInt64(ms)); +} + +qint64 MediaObject::totalTime() const +{ + return toMilliSeconds(m_player->Duration()); +} + +MediaSource MediaObject::source() const +{ + return MediaSource(); +} + +void MediaObject::setSource(const MediaSource &source) +{ + stop(); + m_state = LoadingState; + + Q_UNUSED(source); + // TODO + + emit totalTimeChanged(); +} + +void MediaObject::setNextSource(const MediaSource &source) +{ + Q_UNUSED(source); +} + +qint32 MediaObject::prefinishMark() const +{ + return 0; +} + +void MediaObject::setPrefinishMark(qint32) +{ +} + +qint32 MediaObject::transitionTime() const +{ + return 0; +} + +void MediaObject::setTransitionTime(qint32) +{ +} + +void MediaObject::MaloLoadingComplete() +{ + m_state = StoppedState; +} + +void MediaObject::MaloLoadingStarted() +{ + m_state = LoadingState; +} + +void MediaObject::MdapcInitComplete(TInt aError, + const TTimeIntervalMicroSeconds &aDuration) +{ + Q_UNUSED(aError); + Q_UNUSED(aDuration); +} + +void MediaObject::MdapcPlayComplete(TInt aError) +{ + Q_UNUSED(aError); +} + diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h new file mode 100644 index 0000000..80a774d --- /dev/null +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -0,0 +1,87 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see . + +*/ + +#ifndef PHONON_MMF_MEDIAOBJECT_H +#define PHONON_MMF_MEDIAOBJECT_H + +#include + +#include +#include + +class CDrmPlayerUtility; +class TTimeIntervalMicroSeconds; + +namespace Phonon +{ + namespace MMF + { + class MediaObject : public QObject + , public MediaObjectInterface + , public MDrmAudioPlayerCallback + { + Q_OBJECT + Q_INTERFACES(Phonon::MediaObjectInterface) + public: + MediaObject(QObject *parent); + virtual ~MediaObject(); + virtual void play(); + virtual void pause(); + virtual void stop(); + virtual void seek(qint64 milliseconds); + virtual qint32 tickInterval() const; + virtual void setTickInterval(qint32 interval); + virtual bool hasVideo() const; + virtual bool isSeekable() const; + virtual qint64 currentTime() const; + virtual Phonon::State state() const; + virtual QString errorString() const; + virtual Phonon::ErrorType errorType() const; + virtual qint64 totalTime() const; + virtual MediaSource source() const; + virtual void setSource(const MediaSource &); + virtual void setNextSource(const MediaSource &source); + virtual qint32 prefinishMark() const; + virtual void setPrefinishMark(qint32); + virtual qint32 transitionTime() const; + virtual void setTransitionTime(qint32); + + // MAudioLoadingObserver + virtual void MaloLoadingComplete(); + virtual void MaloLoadingStarted(); + + // MDrmAudioPlayerCallback + virtual void MdapcInitComplete(TInt aError, + const TTimeIntervalMicroSeconds &aDuration); + virtual void MdapcPlayComplete(TInt aError); + + Q_SIGNALS: + void totalTimeChanged(); + + private: + static inline qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &); + static inline TTimeIntervalMicroSeconds toMicroSeconds(qint64 ms); + + CDrmPlayerUtility * m_player; + mutable ErrorType m_error; + mutable State m_state; + }; + } +} + +#endif diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index 0c4bff7..381f119 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -2,53 +2,23 @@ DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend QT += phonon TARGET = phonon_mmf PHONON_MMF_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/mmf +LIBS += -lDrmAudioPlayUtility.lib -# Input -HEADERS += \ - $$PHONON_MMF_DIR/abstractvideorenderer.h \ - $$PHONON_MMF_DIR/audiooutput.h \ - $$PHONON_MMF_DIR/backend.h \ - $$PHONON_MMF_DIR/backendnode.h \ - $$PHONON_MMF_DIR/effect.h \ - $$PHONON_MMF_DIR/fakesource.h \ - $$PHONON_MMF_DIR/iodevicereader.h \ - $$PHONON_MMF_DIR/mediagraph.h \ - $$PHONON_MMF_DIR/mediaobject.h \ - $$PHONON_MMF_DIR/videowidget.h \ - $$PHONON_MMF_DIR/videorenderer_soft.h \ - $$PHONON_MMF_DIR/videorenderer_vmr9.h \ - $$PHONON_MMF_DIR/volumeeffect.h \ - $$PHONON_MMF_DIR/qbasefilter.h \ - $$PHONON_MMF_DIR/qpin.h \ - $$PHONON_MMF_DIR/qasyncreader.h \ - $$PHONON_MMF_DIR/qaudiocdreader.h \ - $$PHONON_MMF_DIR/qmeminputpin.h \ - $$PHONON_MMF_DIR/compointer.h \ - $$PHONON_MMF_DIR/phononds9_namespace.h +HEADERS += \ + $$PHONON_MMF_DIR/audiooutput.h \ + $$PHONON_MMF_DIR/backend.h \ + $$PHONON_MMF_DIR/mediaobject.h - -SOURCES += \ - $$PHONON_MMF_DIR/abstractvideorenderer.cpp \ +SOURCES += \ $$PHONON_MMF_DIR/audiooutput.cpp \ - $$PHONON_MMF_DIR/backend.cpp \ - $$PHONON_MMF_DIR/backendnode.cpp \ - $$PHONON_MMF_DIR/effect.cpp \ - $$PHONON_MMF_DIR/fakesource.cpp \ - $$PHONON_MMF_DIR/iodevicereader.cpp \ - $$PHONON_MMF_DIR/mediagraph.cpp \ - $$PHONON_MMF_DIR/mediaobject.cpp \ - $$PHONON_MMF_DIR/videowidget.cpp \ - $$PHONON_MMF_DIR/videorenderer_soft.cpp \ - $$PHONON_MMF_DIR/videorenderer_vmr9.cpp \ - $$PHONON_MMF_DIR/volumeeffect.cpp \ - $$PHONON_MMF_DIR/qbasefilter.cpp \ - $$PHONON_MMF_DIR/qpin.cpp \ - $$PHONON_MMF_DIR/qasyncreader.cpp \ - $$PHONON_MMF_DIR/qaudiocdreader.cpp \ - $$PHONON_MMF_DIR/qmeminputpin.cpp - + $$PHONON_MMF_DIR/backend.cpp \ + $$PHONON_MMF_DIR/mediaobject.cpp target.path = $$[QT_INSTALL_PLUGINS]/phonon_backend INSTALLS += target include(../../qpluginbase.pri) + +# In the internal 5th SDK, DrmAudioSamplePlayer.h is placed in this folder, as +# opposed to the public, where it is placed in epoc32/include. +INCLUDEPATH *= /epoc32/include/osextensions diff --git a/src/plugins/phonon/phonon.pro b/src/plugins/phonon/phonon.pro index e43a4c2..814a062 100644 --- a/src/plugins/phonon/phonon.pro +++ b/src/plugins/phonon/phonon.pro @@ -7,3 +7,4 @@ mac:contains(QT_CONFIG, phonon-backend): SUBDIRS *= qt7 win32:!wince*:contains(QT_CONFIG, phonon-backend): SUBDIRS *= ds9 wince*:contains(QT_CONFIG, phonon-backend): SUBDIRS *= waveout wince*:contains(QT_CONFIG, directshow): SUBDIRS *= ds9 +symbian:contains(QT_CONFIG, phonon-backend): SUBDIRS *= mmf -- cgit v0.12