summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-09-28 10:05:41 (GMT)
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-10-08 08:55:58 (GMT)
commitbb994a5e2a260911ed3c5603d3414c63a28faab4 (patch)
tree22aa565bad63878c48a1bef49df36120adea266d /src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
parentfcf4b598a169b336344393958f67320f5f9652ce (diff)
downloadQt-bb994a5e2a260911ed3c5603d3414c63a28faab4.zip
Qt-bb994a5e2a260911ed3c5603d3414c63a28faab4.tar.gz
Qt-bb994a5e2a260911ed3c5603d3414c63a28faab4.tar.bz2
Progressive download in Phonon MMF backend: integrated with player
This commit integrates the Download class with the media playback classes in the backend, to implement Progressive Download. Note that this PDL implementation has one drawback: when video playback is paused due to shortage of data (i.e. due to the download being temporarily stalled), the display goes black. This is because, when the end of the currently-downloaded data is reached, the playback session is closed. When more data becomes available, the clip is re-opened, a seek is done to reach the previous playback position, and playback is re-started. Closing the playback session closes the video stack's connection to the display, thereby causing the video widget to go black while more data is buffered. This is a consequence of the level in the native video stack at which the Phonon integration is done: managing a network stall without requiring the playback session to be closed would require integration below the MMF client API, specifically at the MMF controller level. Task-number: QTBUG-10769 Reviewed-by: Derick Hawcroft
Diffstat (limited to 'src/3rdparty/phonon/mmf/abstractvideoplayer.cpp')
-rw-r--r--src/3rdparty/phonon/mmf/abstractvideoplayer.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
index fb20bea..1ab5bae 100644
--- a/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
+++ b/src/3rdparty/phonon/mmf/abstractvideoplayer.cpp
@@ -16,6 +16,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <QDir>
#include <QUrl>
#include <QTimer>
#include <QWidget>
@@ -132,6 +133,13 @@ int MMF::AbstractVideoPlayer::setDeviceVolume(int mmfVolume)
return err;
}
+int MMF::AbstractVideoPlayer::openFile(const QString &fileName)
+{
+ const QHBufC nativeFileName(QDir::toNativeSeparators(fileName));
+ TRAPD(err, m_player->OpenFileL(*nativeFileName));
+ return err;
+}
+
int MMF::AbstractVideoPlayer::openFile(RFile &file)
{
TRAPD(err, m_player->OpenFileL(file));
@@ -157,7 +165,7 @@ int MMF::AbstractVideoPlayer::bufferStatus() const
return result;
}
-void MMF::AbstractVideoPlayer::close()
+void MMF::AbstractVideoPlayer::doClose()
{
m_player->Close();
}
@@ -167,9 +175,9 @@ bool MMF::AbstractVideoPlayer::hasVideo() const
return true;
}
-qint64 MMF::AbstractVideoPlayer::currentTime() const
+qint64 MMF::AbstractVideoPlayer::getCurrentTime() const
{
- TRACE_CONTEXT(AbstractVideoPlayer::currentTime, EVideoApi);
+ TRACE_CONTEXT(AbstractVideoPlayer::getCurrentTime, EVideoApi);
TTimeIntervalMicroSeconds us;
TRAPD(err, us = m_player->PositionL())
@@ -246,7 +254,9 @@ void MMF::AbstractVideoPlayer::MvpuoOpenComplete(TInt aError)
TRACE_CONTEXT(AbstractVideoPlayer::MvpuoOpenComplete, EVideoApi);
TRACE_ENTRY("state %d error %d", state(), aError);
- __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic));
+ __ASSERT_ALWAYS(LoadingState == state() ||
+ progressiveDownloadStalled() && BufferingState == state(),
+ Utils::panic(InvalidStatePanic));
if (KErrNone == aError)
m_player->Prepare();
@@ -261,7 +271,9 @@ void MMF::AbstractVideoPlayer::MvpuoPrepareComplete(TInt aError)
TRACE_CONTEXT(AbstractVideoPlayer::MvpuoPrepareComplete, EVideoApi);
TRACE_ENTRY("state %d error %d", state(), aError);
- __ASSERT_ALWAYS(LoadingState == state(), Utils::panic(InvalidStatePanic));
+ __ASSERT_ALWAYS(LoadingState == state() ||
+ progressiveDownloadStalled() && BufferingState == state(),
+ Utils::panic(InvalidStatePanic));
TRAPD(err, getVideoClipParametersL(aError));
@@ -470,7 +482,7 @@ void MMF::AbstractVideoPlayer::updateScaleFactors(const QSize &windowSize, bool
void MMF::AbstractVideoPlayer::parametersChanged(VideoParameters parameters)
{
- if (state() == LoadingState)
+ if (state() == LoadingState || progressiveDownloadStalled() && BufferingState == state())
m_pendingChanges |= parameters;
else
handleParametersChanged(parameters);