From 748684b3572eaed3f3818eb112fb2cb071dde475 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Tue, 20 Nov 2012 12:48:09 +0100 Subject: AVFoundation: Fix broken requestControl logic AVFMediaPlayerService::requestControl was returning the video output control after the video output was created, and this could result in unexpected behavior, as well as prematurely calling releaseControl on the video output. This should fix the "player" example on OS X. Change-Id: Ie23b1176272a1f9daa5edeec856141ac52a450c7 Reviewed-by: Yoann Lopes --- .../avfoundation/mediaplayer/avfmediaplayerservice.mm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm b/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm index 2ea84758b..3b780e3d5 100644 --- a/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm +++ b/src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm @@ -84,18 +84,22 @@ QMediaControl *AVFMediaPlayerService::requestControl(const char *name) if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) return m_playerMetaDataControl; - if (!m_videoOutput) { - if (qstrcmp(name, QVideoRendererControl_iid) == 0) + if (qstrcmp(name, QVideoRendererControl_iid) == 0) { + if (!m_videoOutput) m_videoOutput = new AVFVideoRendererControl(this); + + m_session->setVideoOutput(qobject_cast(m_videoOutput)); + return m_videoOutput; + } #ifndef QT_NO_WIDGETS - if (qstrcmp(name, QVideoWidgetControl_iid) == 0) + if (qstrcmp(name, QVideoWidgetControl_iid) == 0) { + if (!m_videoOutput) m_videoOutput = new AVFVideoWidgetControl(this); -#endif - } - if (m_videoOutput) { + m_session->setVideoOutput(qobject_cast(m_videoOutput)); return m_videoOutput; } +#endif return 0; } -- cgit v1.2.3