diff options
author | Frans Englich <frans.englich@nokia.com> | 2009-08-17 15:24:34 (GMT) |
---|---|---|
committer | Frans Englich <frans.englich@nokia.com> | 2009-08-17 15:24:34 (GMT) |
commit | 257984d8b8cf31394c4f20070ea045f5ae7fa170 (patch) | |
tree | 274a54cf0ab767db12070ad8319deb66bc1e2f97 /src/3rdparty | |
parent | a7b1ad0b2ecdedd5f2a9d52fe09c4497078bc669 (diff) | |
download | Qt-257984d8b8cf31394c4f20070ea045f5ae7fa170.zip Qt-257984d8b8cf31394c4f20070ea045f5ae7fa170.tar.gz Qt-257984d8b8cf31394c4f20070ea045f5ae7fa170.tar.bz2 |
More delegation, basic plumbing.
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/phonon/mmf/abstractplayer.h | 4 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/audioplayer.cpp | 16 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/audioplayer.h | 2 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/mediaobject.cpp | 19 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/mediaobject.h | 6 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/mmf_videoplayer.cpp | 14 | ||||
-rw-r--r-- | src/3rdparty/phonon/mmf/mmf_videoplayer.h | 2 |
7 files changed, 41 insertions, 22 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index 0188068..613831a 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -37,7 +37,7 @@ namespace Phonon virtual void stop() = 0; virtual void seek(qint64 milliseconds) = 0; virtual qint32 tickInterval() const = 0; - virtual void setTickInterval() const = 0; + virtual void setTickInterval(qint32) = 0; virtual bool hasVideo() const = 0; virtual bool isSeekable() const = 0; virtual qint64 currentTime() const = 0; @@ -53,10 +53,8 @@ namespace Phonon virtual qint32 transitionTime() const = 0; virtual qint32 prefinishMark() const = 0; virtual void setPrefinishMark(qint32) = 0; - virtual bool setVolume(qreal) = 0; virtual qreal volume() const = 0; - virtual void setAudioOutput(AudioOutput *) = 0; }; } diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index 4dd2eb8..106b71b 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -39,14 +39,14 @@ const int NullMaxVolume = -1; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::AudioPlayer::AudioPlayer(QObject *parent) : m_player(NULL) - , m_audioOutput(NULL) - , m_error(NoError) - , m_state(GroundState) - , m_tickInterval(DefaultTickInterval) - , m_tickTimer(NULL) - , m_volume(0.0) - , m_maxVolume(NullMaxVolume) +MMF::AudioPlayer::AudioPlayer() : m_player(NULL) + , m_audioOutput(NULL) + , m_error(NoError) + , m_state(GroundState) + , m_tickInterval(DefaultTickInterval) + , m_tickTimer(NULL) + , m_volume(0.0) + , m_maxVolume(NullMaxVolume) { TRACE_CONTEXT(AudioPlayer::AudioPlayer, EAudioApi); TRACE_ENTRY_0(); diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h index d9a64e1..338c6fa 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.h +++ b/src/3rdparty/phonon/mmf/audioplayer.h @@ -56,7 +56,7 @@ namespace Phonon Q_OBJECT public: - AudioPlayer(QObject *parent); + AudioPlayer(); virtual ~AudioPlayer(); // AbstractPlayer diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index 4769249..e9e4b5b 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -17,6 +17,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. */ #include "abstractplayer.h" +#include "audioplayer.h" +#include "mmf_videoplayer.h" #include "mediaobject.h" using namespace Phonon; @@ -65,7 +67,7 @@ qint32 MMF::MediaObject::tickInterval() const void MMF::MediaObject::setTickInterval(qint32 interval) { - m_player->setTransitionTime(interval); + m_player->setTickInterval(interval); } bool MMF::MediaObject::hasVideo() const @@ -110,9 +112,24 @@ MediaSource MMF::MediaObject::source() const void MMF::MediaObject::setSource(const MediaSource &source) { + loadPlayer(source); + return m_player->setSource(source); } +void MMF::MediaObject::loadPlayer(const MediaSource &source) +{ + disconnect(m_player.data(), 0, this, 0); + + // TODO determine media type + m_player.reset(new AudioPlayer()); + + connect(m_player.data(), SIGNAL(totalTimeChanged()), SIGNAL(totalTimeChanged())); + connect(m_player.data(), SIGNAL(stateChanged(Phonon::State, Phonon::State)), SIGNAL(stateChanged(Phonon::State, Phonon::State))); + connect(m_player.data(), SIGNAL(finished()), SIGNAL(finished())); + connect(m_player.data(), SIGNAL(tick(qint64)), SIGNAL(tick(qint64))); +} + void MMF::MediaObject::setNextSource(const MediaSource &source) { return m_player->setNextSource(source); diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index 9b1e914..a55b6e6 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -21,6 +21,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <Phonon/MediaSource> #include <Phonon/MediaObjectInterface> +#include <QScopedPointer> namespace Phonon { @@ -76,7 +77,10 @@ namespace Phonon void tick(qint64 time); private: - AbstractPlayer *m_player; + void loadPlayer(const MediaSource &source); + + QScopedPointer<AbstractPlayer> m_player; + }; } } diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index 3a51070..c226835 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -39,13 +39,13 @@ const int NullMaxVolume = -1; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::VideoPlayer::VideoPlayer(QObject *parent) : m_audioOutput(NULL) - , m_error(NoError) - , m_state(GroundState) - , m_tickInterval(DefaultTickInterval) - , m_tickTimer(NULL) - , m_volume(0.0) - , m_maxVolume(NullMaxVolume) +MMF::VideoPlayer::VideoPlayer() : m_audioOutput(NULL) + , m_error(NoError) + , m_state(GroundState) + , m_tickInterval(DefaultTickInterval) + , m_tickTimer(NULL) + , m_volume(0.0) + , m_maxVolume(NullMaxVolume) { #if 0 TRACE_CONTEXT(VideoPlayer::VideoPlayer, EAudioApi); diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h index 3b0cd98..3ea9c1a 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h @@ -46,7 +46,7 @@ namespace Phonon { Q_OBJECT public: - VideoPlayer(QObject *parent); + VideoPlayer(); virtual ~VideoPlayer(); // AbstractPlayer |