diff options
author | Andy Nichols <andy.nichols@digia.com> | 2012-11-20 12:48:09 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-20 19:29:27 +0100 |
commit | 748684b3572eaed3f3818eb112fb2cb071dde475 (patch) | |
tree | f75f8dbf43dc0f9dbc4816737fb37d4d928af9ab | |
parent | 78ce69d3dd26ed54f2aa3d86a8d5575d29711fd5 (diff) | |
download | qtmultimedia-748684b3572eaed3f3818eb112fb2cb071dde475.tar.gz |
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 <yoann.lopes@digia.com>
-rw-r--r-- | src/plugins/avfoundation/mediaplayer/avfmediaplayerservice.mm | 16 |
1 files 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<AVFVideoOutput*>(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<AVFVideoOutput*>(m_videoOutput)); return m_videoOutput; } +#endif return 0; } |