diff options
author | Yoann Lopes <yoann.lopes@digia.com> | 2014-09-30 16:41:25 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@digia.com> | 2014-10-01 16:23:33 +0200 |
commit | f02d9e934322fbf9af8a5503c1bda37552988b2b (patch) | |
tree | b65217b207a091d03f62bf06b33295db72c90ced | |
parent | 7f1f5edf4daf86d4e4860fb256f3b03987d8c663 (diff) |
AVFoundation: fix media player video rendering in QML.
The AVPlayerLayer was set on the QVideoRendererControl before its
geometry was updated, causing the renderer control to display frames
with an invalid size.
Change-Id: I90e18dce69d4b48a3d7932d44a7eab4fd443f1fb
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
-rw-r--r-- | src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h | 2 | ||||
-rw-r--r-- | src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm | 21 |
2 files changed, 4 insertions, 19 deletions
diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h index c850f45de..5157a8571 100644 --- a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h +++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.h @@ -97,8 +97,6 @@ public Q_SLOTS: void processPositionChange(); void processMediaLoadError(); - void processCurrentItemChanged(); - Q_SIGNALS: void positionChanged(qint64 position); void durationChanged(qint64 duration); diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm index d6f0607af..73e9d764e 100644 --- a/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm +++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm @@ -340,9 +340,6 @@ static void *AVFMediaPlayerSessionObserverCurrentItemObservationContext = &AVFMe AVPlayerItem *newPlayerItem = [change objectForKey:NSKeyValueChangeNewKey]; if (m_playerItem != newPlayerItem) m_playerItem = newPlayerItem; - - if (self.session) - QMetaObject::invokeMethod(m_session, "processCurrentItemChanged", Qt::AutoConnection); } else { @@ -806,6 +803,10 @@ void AVFMediaPlayerSession::processLoadStateChange() playerLayer.bounds = CGRectMake(0.0f, 0.0f, videoTrack.naturalSize.width, videoTrack.naturalSize.height); + + if (m_videoOutput && m_state != QMediaPlayer::StoppedState) { + m_videoOutput->setLayer(playerLayer); + } } } @@ -836,17 +837,3 @@ void AVFMediaPlayerSession::processMediaLoadError() Q_EMIT mediaStatusChanged(m_mediaStatus = QMediaPlayer::InvalidMedia); Q_EMIT stateChanged(m_state = QMediaPlayer::StoppedState); } - -void AVFMediaPlayerSession::processCurrentItemChanged() -{ -#ifdef QT_DEBUG_AVF - qDebug() << Q_FUNC_INFO; -#endif - - AVPlayerLayer *playerLayer = [(AVFMediaPlayerSessionObserver*)m_observer playerLayer]; - - if (m_videoOutput && m_state != QMediaPlayer::StoppedState) { - m_videoOutput->setLayer(playerLayer); - } - -} |