diff options
author | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-03-29 03:21:32 (GMT) |
---|---|---|
committer | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-03-29 03:21:32 (GMT) |
commit | c90402f06dbd84a372209fc643f0e3463c41e48a (patch) | |
tree | bba8bc374d5ff54490918b56d6ad671d768984e4 /src/plugins/mediaservices/qt7 | |
parent | d2a394ea9d433070ea0e8817b27debd9cfc8e7cd (diff) | |
download | Qt-c90402f06dbd84a372209fc643f0e3463c41e48a.zip Qt-c90402f06dbd84a372209fc643f0e3463c41e48a.tar.gz Qt-c90402f06dbd84a372209fc643f0e3463c41e48a.tar.bz2 |
QuickTime backend: disable video outputs in stopped state.
To keep backend behaviour consistent with other platforms.
Also dropped QT7VideoOutput::setEnabled(), currentry the video output
is disabled with passing null movie, this allows to ensure the movie
is not retained more than necessary.
Reviewed-by: Justin McPherson
Diffstat (limited to 'src/plugins/mediaservices/qt7')
10 files changed, 19 insertions, 33 deletions
diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm index d83c0e3..f35a9fa 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm @@ -193,17 +193,13 @@ void QT7PlayerSession::setVideoOutput(QT7VideoOutput *output) if (m_videoOutput == output) return; - if (m_videoOutput) { - m_videoOutput->setEnabled(false); + if (m_videoOutput) m_videoOutput->setMovie(0); - } m_videoOutput = output; - if (m_videoOutput) { - m_videoOutput->setEnabled(m_QTMovie != 0); + if (m_videoOutput && m_state != QMediaPlayer::StoppedState) m_videoOutput->setMovie(m_QTMovie); - } } @@ -297,6 +293,9 @@ void QT7PlayerSession::setPosition(qint64 pos) void QT7PlayerSession::play() { + if (m_videoOutput) + m_videoOutput->setMovie(m_QTMovie); + float preferredRate = [[(QTMovie*)m_QTMovie attributeForKey:@"QTMoviePreferredRateAttribute"] floatValue]; [(QTMovie*)m_QTMovie setRate:preferredRate*m_rate]; @@ -306,6 +305,9 @@ void QT7PlayerSession::play() void QT7PlayerSession::pause() { + if (m_videoOutput) + m_videoOutput->setMovie(m_QTMovie); + m_state = QMediaPlayer::PausedState; [(QTMovie*)m_QTMovie setRate:0]; @@ -320,6 +322,9 @@ void QT7PlayerSession::stop() [(QTMovie*)m_QTMovie setRate:0]; setPosition(0); + if (m_videoOutput) + m_videoOutput->setMovie(0); + if (m_state == QMediaPlayer::StoppedState) emit stateChanged(m_state); } @@ -361,10 +366,8 @@ void QT7PlayerSession::setMedia(const QMediaContent &content, QIODevice *stream) if (m_QTMovie) { [(QTMovieObserver*)m_movieObserver setMovie:nil]; - if (m_videoOutput) { - m_videoOutput->setEnabled(false); + if (m_videoOutput) m_videoOutput->setMovie(0); - } [(QTMovie*)m_QTMovie release]; m_QTMovie = 0; @@ -425,10 +428,9 @@ void QT7PlayerSession::setMedia(const QMediaContent &content, QIODevice *stream) } else { [(QTMovieObserver*)m_movieObserver setMovie:(QTMovie*)m_QTMovie]; - if (m_videoOutput) { + if (m_videoOutput && m_state != QMediaPlayer::StoppedState) m_videoOutput->setMovie(m_QTMovie); - m_videoOutput->setEnabled(true); - } + processLoadStateChange(); [(QTMovie*)m_QTMovie setMuted:m_muted]; @@ -457,6 +459,8 @@ bool QT7PlayerSession::isVideoAvailable() const void QT7PlayerSession::processEOS() { m_mediaStatus = QMediaPlayer::EndOfMedia; + if (m_videoOutput) + m_videoOutput->setMovie(0); emit stateChanged(m_state = QMediaPlayer::StoppedState); emit mediaStatusChanged(m_mediaStatus); } @@ -493,6 +497,9 @@ void QT7PlayerSession::processLoadStateChange() if (state == kMovieLoadStateError) { newStatus = QMediaPlayer::InvalidMedia; + if (m_videoOutput) + m_videoOutput->setMovie(0); + emit error(QMediaPlayer::FormatError, tr("Failed to load media")); emit stateChanged(m_state = QMediaPlayer::StoppedState); } diff --git a/src/plugins/mediaservices/qt7/qt7movierenderer.h b/src/plugins/mediaservices/qt7/qt7movierenderer.h index a547329..c2dd177 100644 --- a/src/plugins/mediaservices/qt7/qt7movierenderer.h +++ b/src/plugins/mediaservices/qt7/qt7movierenderer.h @@ -74,7 +74,6 @@ public: QT7MovieRenderer(QObject *parent = 0); virtual ~QT7MovieRenderer(); - void setEnabled(bool); void setMovie(void *movie); void updateNaturalSize(const QSize &newSize); diff --git a/src/plugins/mediaservices/qt7/qt7movierenderer.mm b/src/plugins/mediaservices/qt7/qt7movierenderer.mm index a6d9d8d..95f5d4c 100644 --- a/src/plugins/mediaservices/qt7/qt7movierenderer.mm +++ b/src/plugins/mediaservices/qt7/qt7movierenderer.mm @@ -368,10 +368,6 @@ void QT7MovieRenderer::setupVideoOutput() } -void QT7MovieRenderer::setEnabled(bool) -{ -} - void QT7MovieRenderer::setMovie(void *movie) { // qDebug() << "QT7MovieRenderer::setMovie" << movie; diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.h b/src/plugins/mediaservices/qt7/qt7movievideowidget.h index 7908efd..831a18d 100644 --- a/src/plugins/mediaservices/qt7/qt7movievideowidget.h +++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.h @@ -72,7 +72,6 @@ public: QT7MovieVideoWidget(QObject *parent = 0); virtual ~QT7MovieVideoWidget(); - void setEnabled(bool); void setMovie(void *movie); void updateNaturalSize(const QSize &newSize); diff --git a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm index 197c26e..c58d0a0 100644 --- a/src/plugins/mediaservices/qt7/qt7movievideowidget.mm +++ b/src/plugins/mediaservices/qt7/qt7movievideowidget.mm @@ -279,10 +279,6 @@ void QT7MovieVideoWidget::setupVideoOutput() m_displayLink->start(); } -void QT7MovieVideoWidget::setEnabled(bool) -{ -} - void QT7MovieVideoWidget::setMovie(void *movie) { if (m_movie == movie) diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h index 49049ad..0fee41c 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h +++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h @@ -63,7 +63,6 @@ public: QT7MovieViewOutput(QObject *parent = 0); ~QT7MovieViewOutput(); - void setEnabled(bool); void setMovie(void *movie); void updateNaturalSize(const QSize &newSize); diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm index 8e4dd9b..20f1a02 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm +++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm @@ -194,10 +194,6 @@ void QT7MovieViewOutput::setupVideoOutput() setDisplayRect(m_displayRect); } -void QT7MovieViewOutput::setEnabled(bool) -{ -} - void QT7MovieViewOutput::setMovie(void *movie) { if (m_movie != movie) { diff --git a/src/plugins/mediaservices/qt7/qt7movieviewrenderer.h b/src/plugins/mediaservices/qt7/qt7movieviewrenderer.h index 0126360..0b515ae 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewrenderer.h +++ b/src/plugins/mediaservices/qt7/qt7movieviewrenderer.h @@ -67,7 +67,6 @@ public: QT7MovieViewRenderer(QObject *parent = 0); ~QT7MovieViewRenderer(); - void setEnabled(bool); void setMovie(void *movie); void updateNaturalSize(const QSize &newSize); diff --git a/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm b/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm index 5f11479..33a6970 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm +++ b/src/plugins/mediaservices/qt7/qt7movieviewrenderer.mm @@ -299,10 +299,6 @@ void QT7MovieViewRenderer::setupVideoOutput() } } -void QT7MovieViewRenderer::setEnabled(bool) -{ -} - void QT7MovieViewRenderer::setMovie(void *movie) { if (movie == m_movie) diff --git a/src/plugins/mediaservices/qt7/qt7videooutputcontrol.h b/src/plugins/mediaservices/qt7/qt7videooutputcontrol.h index 2c60919..3c74cb8 100644 --- a/src/plugins/mediaservices/qt7/qt7videooutputcontrol.h +++ b/src/plugins/mediaservices/qt7/qt7videooutputcontrol.h @@ -67,7 +67,6 @@ class QT7PlayerService; class QT7VideoOutput { public: virtual ~QT7VideoOutput() {} - virtual void setEnabled(bool enabled) = 0; virtual void setMovie(void *movie) = 0; virtual void updateNaturalSize(const QSize &newSize) = 0; }; |