summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/phonon
diff options
context:
space:
mode:
authorGareth Stockwell <gareth.stockwell@sosco.com>2009-08-21 10:39:36 (GMT)
committerGareth Stockwell <gareth.stockwell@sosco.com>2009-08-21 10:39:36 (GMT)
commit3f39d630d3dcc161c4a85127129274ca7ea857a2 (patch)
treeba726756cfdd87883fd546ff2f0e5c2b20e64eac /src/3rdparty/phonon
parent932c48658656fa328507b16e39c3a6cc820ef15e (diff)
downloadQt-3f39d630d3dcc161c4a85127129274ca7ea857a2.zip
Qt-3f39d630d3dcc161c4a85127129274ca7ea857a2.tar.gz
Qt-3f39d630d3dcc161c4a85127129274ca7ea857a2.tar.bz2
Further tidied up volume handling
Diffstat (limited to 'src/3rdparty/phonon')
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.cpp75
-rw-r--r--src/3rdparty/phonon/mmf/abstractmediaplayer.h13
-rw-r--r--src/3rdparty/phonon/mmf/abstractplayer.cpp34
-rw-r--r--src/3rdparty/phonon/mmf/abstractplayer.h18
-rw-r--r--src/3rdparty/phonon/mmf/audiooutput.cpp36
-rw-r--r--src/3rdparty/phonon/mmf/audiooutput.h16
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.cpp4
-rw-r--r--src/3rdparty/phonon/mmf/audioplayer.h2
-rw-r--r--src/3rdparty/phonon/mmf/backend.cpp13
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.cpp14
-rw-r--r--src/3rdparty/phonon/mmf/dummyplayer.h4
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.cpp12
-rw-r--r--src/3rdparty/phonon/mmf/mediaobject.h24
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.cpp45
-rw-r--r--src/3rdparty/phonon/mmf/videooutput.h42
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.cpp8
-rw-r--r--src/3rdparty/phonon/mmf/videoplayer.h6
-rw-r--r--src/3rdparty/phonon/mmf/videowidget.cpp5
-rw-r--r--src/3rdparty/phonon/mmf/videowidget.h5
-rw-r--r--src/3rdparty/phonon/mmf/volumeobserver.h (renamed from src/3rdparty/phonon/mmf/volumecontrolinterface.h)18
20 files changed, 231 insertions, 163 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
index be34fef..6342f37 100644
--- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp
@@ -17,6 +17,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "abstractmediaplayer.h"
+#include "defs.h"
#include "utils.h"
using namespace Phonon;
@@ -36,7 +37,9 @@ const int NullMaxVolume = -1;
MMF::AbstractMediaPlayer::AbstractMediaPlayer() :
m_state(GroundState)
, m_error(NoError)
+ , m_playPending(false)
, m_tickTimer(new QTimer(this))
+ , m_volume(InitialVolume)
, m_mmfMaxVolume(NullMaxVolume)
{
connect(m_tickTimer.data(), SIGNAL(timeout()), this, SLOT(tick()));
@@ -46,7 +49,9 @@ MMF::AbstractMediaPlayer::AbstractMediaPlayer(const AbstractPlayer& player) :
AbstractPlayer(player)
, m_state(GroundState)
, m_error(NoError)
+ , m_playPending(false)
, m_tickTimer(new QTimer(this))
+ , m_volume(InitialVolume)
, m_mmfMaxVolume(NullMaxVolume)
{
connect(m_tickTimer.data(), SIGNAL(timeout()), this, SLOT(tick()));
@@ -292,47 +297,51 @@ void MMF::AbstractMediaPlayer::setNextSource(const MediaSource &source)
//-----------------------------------------------------------------------------
-// VolumeControlInterface
+// VolumeObserver
//-----------------------------------------------------------------------------
-bool MMF::AbstractMediaPlayer::doSetVolume(qreal volume)
+void MMF::AbstractMediaPlayer::volumeChanged(qreal volume)
{
- TRACE_CONTEXT(AbstractMediaPlayer::doSetVolume, EAudioInternal);
+ TRACE_CONTEXT(AbstractMediaPlayer::volumeChanged, EAudioInternal);
TRACE_ENTRY("state %d", m_state);
-
- bool result = true;
- switch(m_state)
- {
- case GroundState:
- case LoadingState:
- case ErrorState:
+ m_volume = volume;
+ doVolumeChanged();
+
+ TRACE_EXIT_0();
+}
+
+
+void MMF::AbstractMediaPlayer::doVolumeChanged()
+{
+ switch(m_state)
+ {
+ case GroundState:
+ case LoadingState:
+ case ErrorState:
// Do nothing
- break;
+ break;
- case StoppedState:
- case PausedState:
- case PlayingState:
- case BufferingState:
- {
- const int err = doSetMmfVolume(volume * m_mmfMaxVolume);
-
- if(KErrNone != err)
- {
+ case StoppedState:
+ case PausedState:
+ case PlayingState:
+ case BufferingState:
+ {
+ const int err = setDeviceVolume(m_volume * m_mmfMaxVolume);
+
+ if(KErrNone != err)
+ {
m_error = NormalError;
changeState(ErrorState);
- result = false;
- }
- break;
- }
+ }
+ break;
+ }
- // Protection against adding new states and forgetting to update this
- // switch
- default:
- TRACE_PANIC(InvalidStatePanic);
- }
-
- TRACE_RETURN("%d", result);
+ // Protection against adding new states and forgetting to update this
+ // switch
+ default:
+ Utils::panic(InvalidStatePanic);
+ }
}
@@ -350,10 +359,10 @@ void MMF::AbstractMediaPlayer::stopTickTimer()
m_tickTimer->stop();
}
-void MMF::AbstractMediaPlayer::initVolume(int mmfMaxVolume)
+void MMF::AbstractMediaPlayer::maxVolumeChanged(int mmfMaxVolume)
{
m_mmfMaxVolume = mmfMaxVolume;
- doSetVolume(volume() * m_mmfMaxVolume);
+ doVolumeChanged();
}
Phonon::State MMF::AbstractMediaPlayer::phononState() const
diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
index 9e0d3c8..58aca84 100644
--- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h
@@ -57,24 +57,26 @@ namespace Phonon
virtual MediaSource source() const;
virtual void setFileSource(const Phonon::MediaSource&, RFile&);
virtual void setNextSource(const MediaSource &source);
+
+ // VolumeObserver
+ virtual void volumeChanged(qreal volume);
protected:
// AbstractPlayer
virtual void doSetTickInterval(qint32 interval);
- virtual bool doSetVolume(qreal volume);
protected:
virtual void doPlay() = 0;
virtual void doPause() = 0;
virtual void doStop() = 0;
- virtual int doSetMmfVolume(int mmfVolume) = 0;
+ virtual int setDeviceVolume(int mmfVolume) = 0;
virtual int openFile(RFile& file) = 0;
virtual void close() = 0;
protected:
void startTickTimer();
void stopTickTimer();
- void initVolume(int maxVolume);
+ void maxVolumeChanged(int maxVolume);
/**
* Defined private state enumeration in order to add GroundState
@@ -111,6 +113,9 @@ namespace Phonon
void setError(Phonon::ErrorType error);
static qint64 toMilliSeconds(const TTimeIntervalMicroSeconds &);
+
+ private:
+ void doVolumeChanged();
Q_SIGNALS:
void tick(qint64 time);
@@ -135,6 +140,8 @@ namespace Phonon
bool m_playPending;
QScopedPointer<QTimer> m_tickTimer;
+
+ qreal m_volume;
int m_mmfMaxVolume;
MediaSource m_source;
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp
index 7786d8b..870b50f 100644
--- a/src/3rdparty/phonon/mmf/abstractplayer.cpp
+++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp
@@ -27,18 +27,16 @@ using namespace Phonon::MMF;
// Constructor / destructor
//-----------------------------------------------------------------------------
-MMF::AbstractPlayer::AbstractPlayer() :
- m_tickInterval(DefaultTickInterval)
- , m_volume(InitialVolume)
+MMF::AbstractPlayer::AbstractPlayer()
+ : m_tickInterval(DefaultTickInterval)
, m_transitionTime(0)
, m_prefinishMark(0)
{
}
-MMF::AbstractPlayer::AbstractPlayer(const AbstractPlayer& player) :
- m_tickInterval(player.tickInterval())
- , m_volume(player.volume())
+MMF::AbstractPlayer::AbstractPlayer(const AbstractPlayer& player)
+ : m_tickInterval(player.tickInterval())
, m_transitionTime(player.transitionTime())
, m_prefinishMark(player.prefinishMark())
{
@@ -81,27 +79,3 @@ void MMF::AbstractPlayer::setTransitionTime(qint32 time)
}
-//-----------------------------------------------------------------------------
-// VolumeControlInterface
-//-----------------------------------------------------------------------------
-
-qreal MMF::AbstractPlayer::volume() const
-{
- return m_volume;
-}
-
-bool MMF::AbstractPlayer::setVolume(qreal volume)
-{
- bool result = false;
- if(volume != m_volume)
- {
- result = doSetVolume(volume);
- if(result)
- {
- m_volume = volume;
- }
- }
- return result;
-}
-
-
diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h
index 546d929..4b899d2 100644
--- a/src/3rdparty/phonon/mmf/abstractplayer.h
+++ b/src/3rdparty/phonon/mmf/abstractplayer.h
@@ -23,7 +23,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <Phonon/phononnamespace.h>
#include <Phonon/MediaSource.h>
-#include "volumecontrolinterface.h"
+#include "volumeobserver.h"
class RFile;
@@ -44,7 +44,7 @@ namespace Phonon
* - Video, in which case the implementation is VideoPlayer
*/
class AbstractPlayer : public QObject
- , public VolumeControlInterface
+ , public VolumeObserver
{
// Required although this class has no signals or slots
// Without this, qobject_cast will fail
@@ -81,19 +81,13 @@ namespace Phonon
virtual void setFileSource(const Phonon::MediaSource&, RFile&) = 0;
virtual void setNextSource(const Phonon::MediaSource &) = 0;
- // VolumeControlInterface
- qreal volume() const;
- bool setVolume(qreal volume);
-
private:
virtual void doSetTickInterval(qint32 interval) = 0;
- virtual bool doSetVolume(qreal volume) = 0;
- private:
- qint32 m_tickInterval;
- qreal m_volume;
- qint32 m_transitionTime;
- qint32 m_prefinishMark;
+ private:
+ qint32 m_tickInterval;
+ qint32 m_transitionTime;
+ qint32 m_prefinishMark;
};
}
diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp
index 2e5cbc6..13b953d 100644
--- a/src/3rdparty/phonon/mmf/audiooutput.cpp
+++ b/src/3rdparty/phonon/mmf/audiooutput.cpp
@@ -21,7 +21,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "audiooutput.h"
#include "defs.h"
#include "utils.h"
-#include "volumecontrolinterface.h"
+#include "volumeobserver.h"
using namespace Phonon;
using namespace Phonon::MMF;
@@ -33,7 +33,7 @@ using namespace Phonon::MMF;
MMF::AudioOutput::AudioOutput(Backend *, QObject *parent) : QObject(parent)
, m_volume(InitialVolume)
- , m_volumeControl(NULL)
+ , m_observer(NULL)
{
}
@@ -45,32 +45,26 @@ MMF::AudioOutput::AudioOutput(Backend *, QObject *parent) : QObject(parent)
qreal MMF::AudioOutput::volume() const
{
- TRACE_CONTEXT(AudioOutput::volume, EAudioApi);
- TRACE_ENTRY("control 0x%08x ", m_volumeControl);
-
- const qreal result = m_volumeControl ? m_volumeControl->volume() : m_volume;
-
- TRACE_RETURN("%f", result);
+ return m_volume;
}
void MMF::AudioOutput::setVolume(qreal volume)
{
TRACE_CONTEXT(AudioOutput::setVolume, EAudioApi);
- TRACE_ENTRY("control 0x%08x volume %f", m_volumeControl, volume);
+ TRACE_ENTRY("observer 0x%08x volume %f", m_observer, volume);
- if(m_volumeControl)
+ if(volume != m_volume)
{
- if(m_volumeControl->setVolume(volume))
+ if(m_observer)
{
- TRACE("emit volumeChanged(%f)", volume)
- emit volumeChanged(volume);
+ m_observer->volumeChanged(volume);
}
- }
- else
- {
+
m_volume = volume;
+ TRACE("emit volumeChanged(%f)", volume)
+ emit volumeChanged(volume);
}
-
+
TRACE_EXIT_0();
}
@@ -89,10 +83,10 @@ bool MMF::AudioOutput::setOutputDevice(const Phonon::AudioOutputDevice &)
return true;
}
-void MMF::AudioOutput::setVolumeControl(VolumeControlInterface *volumeControl)
+void MMF::AudioOutput::setVolumeObserver(VolumeObserver& observer)
{
- Q_ASSERT(!m_volumeControl);
- m_volumeControl = volumeControl;
- m_volumeControl->setVolume(m_volume);
+ Q_ASSERT(!m_observer);
+ m_observer = &observer;
+ m_observer->volumeChanged(m_volume);
}
diff --git a/src/3rdparty/phonon/mmf/audiooutput.h b/src/3rdparty/phonon/mmf/audiooutput.h
index ad39626..38623a8 100644
--- a/src/3rdparty/phonon/mmf/audiooutput.h
+++ b/src/3rdparty/phonon/mmf/audiooutput.h
@@ -19,19 +19,19 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#ifndef PHONON_MMF_AUDIOOUTPUT_H
#define PHONON_MMF_AUDIOOUTPUT_H
-#include <Phonon/audiooutputinterface.h>
+#include <phonon/audiooutputinterface.h>
namespace Phonon
{
namespace MMF
{
class Backend;
- class VolumeControlInterface;
+ class VolumeObserver;
/**
* @short AudioOutputInterface implementation for MMF.
*
- * Forwards volume commands to the VolumeControlInterface instance,
+ * Forwards volume commands to the VolumeObserver instance,
* which is provided by the backend when MediaNode objects are
* connected.
*
@@ -70,19 +70,17 @@ namespace Phonon
/**
* Called by backend when nodes are connected.
*/
- void setVolumeControl(VolumeControlInterface *volumeControl);
+ void setVolumeObserver(VolumeObserver& observer);
Q_SIGNALS:
void volumeChanged(qreal volume);
void audioDeviceFailed();
private:
- /**
- * This value is used when m_volumeControl is NULL.
- */
- qreal m_volume;
+ qreal m_volume;
- VolumeControlInterface * m_volumeControl;
+ // Not owned
+ VolumeObserver* m_observer;
};
}
}
diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp
index e812af5..67ed7a5 100644
--- a/src/3rdparty/phonon/mmf/audioplayer.cpp
+++ b/src/3rdparty/phonon/mmf/audioplayer.cpp
@@ -84,7 +84,7 @@ void MMF::AudioPlayer::doStop()
m_player->Stop();
}
-int MMF::AudioPlayer::doSetMmfVolume(int mmfVolume)
+int MMF::AudioPlayer::setDeviceVolume(int mmfVolume)
{
return m_player->SetVolume(mmfVolume);
}
@@ -177,7 +177,7 @@ void MMF::AudioPlayer::MapcInitComplete(TInt aError,
if(KErrNone == aError)
{
- initVolume(m_player->MaxVolume());
+ maxVolumeChanged(m_player->MaxVolume());
emit totalTimeChanged();
changeState(StoppedState);
diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h
index b73ea44..29ed12e 100644
--- a/src/3rdparty/phonon/mmf/audioplayer.h
+++ b/src/3rdparty/phonon/mmf/audioplayer.h
@@ -58,7 +58,7 @@ namespace Phonon
virtual void doPlay();
virtual void doPause();
virtual void doStop();
- virtual int doSetMmfVolume(int mmfVolume);
+ virtual int setDeviceVolume(int mmfVolume);
virtual int openFile(RFile& file);
virtual void close();
diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp
index f610b60..ad60046 100644
--- a/src/3rdparty/phonon/mmf/backend.cpp
+++ b/src/3rdparty/phonon/mmf/backend.cpp
@@ -98,17 +98,24 @@ bool Backend::connectNodes(QObject *source, QObject *target)
MediaObject *const mediaObject = qobject_cast<MediaObject *>(source);
AudioOutput *const audioOutput = qobject_cast<AudioOutput *>(target);
-
+ VideoWidget *const videoWidget = qobject_cast<VideoWidget *>(target);
+
bool result = false;
if(mediaObject and audioOutput)
{
TRACE("mediaObject 0x%08x -> audioOutput 0x%08x", mediaObject, audioOutput);
-
- audioOutput->setVolumeControl(mediaObject);
+ audioOutput->setVolumeObserver(*mediaObject);
result = true;
}
+ if(mediaObject and videoWidget)
+ {
+ TRACE("mediaObject 0x%08x -> videoWidget 0x%08x", mediaObject, videoWidget);
+ // TODO: the actual connection :)
+ result = true;
+ }
+
TRACE_RETURN("%d", result);
}
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.cpp b/src/3rdparty/phonon/mmf/dummyplayer.cpp
index 737af78..9154984 100644
--- a/src/3rdparty/phonon/mmf/dummyplayer.cpp
+++ b/src/3rdparty/phonon/mmf/dummyplayer.cpp
@@ -113,19 +113,25 @@ void MMF::DummyPlayer::setNextSource(const MediaSource &)
//-----------------------------------------------------------------------------
-// AbstractPlayer
+// VolumeObserver
//-----------------------------------------------------------------------------
-void MMF::DummyPlayer::doSetTickInterval(qint32)
+void MMF::DummyPlayer::volumeChanged(qreal)
{
}
-bool MMF::DummyPlayer::doSetVolume(qreal)
+
+//-----------------------------------------------------------------------------
+// AbstractPlayer
+//-----------------------------------------------------------------------------
+
+void MMF::DummyPlayer::doSetTickInterval(qint32)
{
- return true;
+
}
+
diff --git a/src/3rdparty/phonon/mmf/dummyplayer.h b/src/3rdparty/phonon/mmf/dummyplayer.h
index 6a2ad73..5846d88 100644
--- a/src/3rdparty/phonon/mmf/dummyplayer.h
+++ b/src/3rdparty/phonon/mmf/dummyplayer.h
@@ -60,9 +60,11 @@ namespace Phonon
virtual void setFileSource(const Phonon::MediaSource&, RFile&);
virtual void setNextSource(const MediaSource &source);
+ // VolumeObserver
+ virtual void volumeChanged(qreal volume);
+
// AbstractPlayer
virtual void doSetTickInterval(qint32 interval);
- virtual bool doSetVolume(qreal volume);
};
}
diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp
index 4b5c4f0..bf0356e 100644
--- a/src/3rdparty/phonon/mmf/mediaobject.cpp
+++ b/src/3rdparty/phonon/mmf/mediaobject.cpp
@@ -366,18 +366,14 @@ void MMF::MediaObject::setTransitionTime(qint32 time)
m_player->setTransitionTime(time);
}
+
//-----------------------------------------------------------------------------
-// VolumeControlInterface
+// VolumeObserver
//-----------------------------------------------------------------------------
-qreal MMF::MediaObject::volume() const
-{
- return m_player->volume();
-}
-
-bool MMF::MediaObject::setVolume(qreal volume)
+void MMF::MediaObject::volumeChanged(qreal volume)
{
- return m_player->setVolume(volume);
+ m_player->volumeChanged(volume);
}
diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h
index a6d932d..2e12b72 100644
--- a/src/3rdparty/phonon/mmf/mediaobject.h
+++ b/src/3rdparty/phonon/mmf/mediaobject.h
@@ -27,7 +27,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
// For recognizer
#include <apgcli.h>
-#include "volumecontrolinterface.h"
+#include "volumeobserver.h"
namespace Phonon
{
@@ -35,13 +35,13 @@ namespace Phonon
{
class AbstractPlayer;
class AudioOutput;
-
+
/**
* @short Facade class which wraps MMF client utility instance
*/
class MediaObject : public QObject
, public MediaObjectInterface
- , public VolumeControlInterface
+ , public VolumeObserver
{
Q_OBJECT
Q_INTERFACES(Phonon::MediaObjectInterface)
@@ -71,10 +71,9 @@ namespace Phonon
virtual void setPrefinishMark(qint32);
virtual qint32 transitionTime() const;
virtual void setTransitionTime(qint32);
-
- // VolumeControlInterface
- qreal volume() const;
- bool setVolume(qreal volume);
+
+ // VolumeObserver
+ void volumeChanged(qreal volume);
Q_SIGNALS:
void totalTimeChanged();
@@ -97,15 +96,16 @@ namespace Phonon
private:
// Audio / video media type recognition
- bool m_recognizerOpened;
- RApaLsSession m_recognizer;
- RFs m_fileServer;
+ bool m_recognizerOpened;
+ RApaLsSession m_recognizer;
+ RFs m_fileServer;
// Storing the file handle here to work around KErrInUse error
// from MMF player utility OpenFileL functions
- RFile m_file;
+ RFile m_file;
- QScopedPointer<AbstractPlayer> m_player;
+ QScopedPointer<AbstractPlayer> m_player;
+
};
}
}
diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp
new file mode 100644
index 0000000..5e32b28
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/videooutput.cpp
@@ -0,0 +1,45 @@
+/* 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 <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "utils.h"
+#include "videooutput.h"
+
+using namespace Phonon;
+using namespace Phonon::MMF;
+
+
+//-----------------------------------------------------------------------------
+// Constructor / destructor
+//-----------------------------------------------------------------------------
+
+MMF::VideoOutput::VideoOutput(QWidget* parent)
+ : QWidget(parent)
+{
+
+}
+
+MMF::VideoOutput::~VideoOutput()
+{
+
+}
+
+
+//-----------------------------------------------------------------------------
+// Public API
+//-----------------------------------------------------------------------------
+
diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h
new file mode 100644
index 0000000..8b08402
--- /dev/null
+++ b/src/3rdparty/phonon/mmf/videooutput.h
@@ -0,0 +1,42 @@
+/* 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 <http://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PHONON_MMF_VIDEOOUTPUT_H
+#define PHONON_MMF_VIDEOOUTPUT_H
+
+#include <QtGui/QWidget>
+
+namespace Phonon
+{
+ namespace MMF
+ {
+ class VideoOutput : public QWidget
+ {
+ Q_OBJECT
+
+ public:
+ VideoOutput(QWidget* parent);
+ ~VideoOutput();
+
+ private:
+
+ };
+ }
+}
+
+#endif
diff --git a/src/3rdparty/phonon/mmf/videoplayer.cpp b/src/3rdparty/phonon/mmf/videoplayer.cpp
index 45d4f65..3868672 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/videoplayer.cpp
@@ -33,14 +33,14 @@ using namespace Phonon::MMF;
// Constructor / destructor
//-----------------------------------------------------------------------------
-MMF::VideoPlayer::VideoPlayer() : m_widget(new QWidget())
+MMF::VideoPlayer::VideoPlayer() : m_widget(new VideoOutput(NULL))
{
construct();
}
MMF::VideoPlayer::VideoPlayer(const AbstractPlayer& player)
: AbstractMediaPlayer(player)
- , m_widget(new QWidget())
+ , m_widget(new VideoOutput(NULL)) // TODO: copy??
{
construct();
}
@@ -117,7 +117,7 @@ void MMF::VideoPlayer::doStop()
m_player->Stop();
}
-int MMF::VideoPlayer::doSetMmfVolume(int mmfVolume)
+int MMF::VideoPlayer::setDeviceVolume(int mmfVolume)
{
TRAPD(err, m_player->SetVolumeL(mmfVolume));
return err;
@@ -233,7 +233,7 @@ void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError)
if(KErrNone == aError)
{
- initVolume(m_player->MaxVolume());
+ maxVolumeChanged(m_player->MaxVolume());
emit totalTimeChanged();
changeState(StoppedState);
diff --git a/src/3rdparty/phonon/mmf/videoplayer.h b/src/3rdparty/phonon/mmf/videoplayer.h
index b4cfa69..ce3b3ac 100644
--- a/src/3rdparty/phonon/mmf/videoplayer.h
+++ b/src/3rdparty/phonon/mmf/videoplayer.h
@@ -22,9 +22,9 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <include/videoplayer.h>
#include "abstractmediaplayer.h"
+#include "videooutput.h"
class CVideoPlayerUtility;
-class QSymbianControl;
namespace Phonon
{
@@ -51,7 +51,7 @@ namespace Phonon
virtual void doPlay();
virtual void doPause();
virtual void doStop();
- virtual int doSetMmfVolume(int mmfVolume);
+ virtual int setDeviceVolume(int mmfVolume);
virtual int openFile(RFile& file);
virtual void close();
@@ -79,7 +79,7 @@ namespace Phonon
private:
CVideoPlayerUtility* m_player;
- QScopedPointer<QWidget> m_widget;
+ QScopedPointer<VideoOutput> m_widget;
};
}
diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp
index 194c885..e08fcea 100644
--- a/src/3rdparty/phonon/mmf/videowidget.cpp
+++ b/src/3rdparty/phonon/mmf/videowidget.cpp
@@ -41,7 +41,7 @@ static const qreal DefaultSaturation = 1.0;
//-----------------------------------------------------------------------------
MMF::VideoWidget::VideoWidget(QWidget* parent)
- : QWidget(parent)
+ : m_widget(new VideoOutput(parent))
, m_aspectRatio(DefaultAspectRatio)
, m_brightness(DefaultBrightness)
, m_scaleMode(DefaultScaleMode)
@@ -149,7 +149,6 @@ void MMF::VideoWidget::setSaturation(qreal saturation)
QWidget* MMF::VideoWidget::widget()
{
- return this;
+ return m_widget.data();
}
-
diff --git a/src/3rdparty/phonon/mmf/videowidget.h b/src/3rdparty/phonon/mmf/videowidget.h
index 3c33a56..6967f7e 100644
--- a/src/3rdparty/phonon/mmf/videowidget.h
+++ b/src/3rdparty/phonon/mmf/videowidget.h
@@ -22,12 +22,13 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <QtGui/QWidget>
#include <phonon/videowidget.h>
#include <phonon/videowidgetinterface.h>
+#include "videooutput.h"
namespace Phonon
{
namespace MMF
{
- class VideoWidget : public QWidget
+ class VideoWidget : public QObject
, public Phonon::VideoWidgetInterface
{
Q_OBJECT
@@ -53,6 +54,8 @@ namespace Phonon
virtual QWidget *widget();
private:
+ QScopedPointer<VideoOutput> m_widget;
+
Phonon::VideoWidget::AspectRatio m_aspectRatio;
qreal m_brightness;
Phonon::VideoWidget::ScaleMode m_scaleMode;
diff --git a/src/3rdparty/phonon/mmf/volumecontrolinterface.h b/src/3rdparty/phonon/mmf/volumeobserver.h
index 7965dd4..11ee960 100644
--- a/src/3rdparty/phonon/mmf/volumecontrolinterface.h
+++ b/src/3rdparty/phonon/mmf/volumeobserver.h
@@ -16,8 +16,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef PHONON_MMF_VOLUMECONTROLINTERFACE_H
-#define PHONON_MMF_VOLUMECONTROLINTERFACE_H
+#ifndef PHONON_MMF_VOLUMEOBSERVER_H
+#define PHONON_MMF_VOLUMEOBSERVER_H
#include <QtGlobal>
@@ -29,18 +29,10 @@ namespace Phonon
* Interface used by AudioOutput to pass volume control commands
* back along the audio path to the MediaObject.
*/
- class VolumeControlInterface
+ class VolumeObserver
{
- public:
- virtual qreal volume() const = 0;
-
- /**
- * Returns true if the volume of the underlying audio stack is
- * changed as a result of this call. The return value is used
- * by the AudioDevice to determine whether to emit a
- * volumeChanged signal.
- */
- virtual bool setVolume(qreal volume) = 0;
+ public:
+ virtual void volumeChanged(qreal volume) = 0;
};
}
}