summaryrefslogtreecommitdiffstats
path: root/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@digia.com>2014-09-30 16:41:25 +0200
committerYoann Lopes <yoann.lopes@digia.com>2014-10-01 16:23:33 +0200
commitf02d9e934322fbf9af8a5503c1bda37552988b2b (patch)
treeb65217b207a091d03f62bf06b33295db72c90ced /src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm
parent7f1f5edf4daf86d4e4860fb256f3b03987d8c663 (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>
Diffstat (limited to 'src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm')
-rw-r--r--src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm21
1 files changed, 4 insertions, 17 deletions
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);
- }
-
-}