diff options
author | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-03-11 04:03:57 (GMT) |
---|---|---|
committer | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-03-11 04:03:57 (GMT) |
commit | 751a45bc22aa1f27a5dab3ce18e83c0f699ee05f (patch) | |
tree | 6b6c2417195a24d4bf2edf2dee610c9f4c2f423b | |
parent | 4e8b2039ecbbda87b5c23cc0a574b7accfc2ad33 (diff) | |
download | Qt-751a45bc22aa1f27a5dab3ce18e83c0f699ee05f.zip Qt-751a45bc22aa1f27a5dab3ce18e83c0f699ee05f.tar.gz Qt-751a45bc22aa1f27a5dab3ce18e83c0f699ee05f.tar.bz2 |
QuickTime MovieViewOutput: remove view from layout and reset source
movie when MovieViewOutput output is disabled.
Reviewed-by: Justin McPherson
-rw-r--r-- | src/plugins/mediaservices/qt7/qt7movieviewoutput.h | 1 | ||||
-rw-r--r-- | src/plugins/mediaservices/qt7/qt7movieviewoutput.mm | 32 |
2 files changed, 29 insertions, 4 deletions
diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h index 30eefa7..3ac409e 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.h +++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.h @@ -100,6 +100,7 @@ private: void *m_movie; void *m_movieView; + bool m_layouted; WId m_winId; QRect m_displayRect; diff --git a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm index 254af46..d5f4f95 100644 --- a/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm +++ b/src/plugins/mediaservices/qt7/qt7movieviewoutput.mm @@ -154,6 +154,7 @@ QT7MovieViewOutput::QT7MovieViewOutput(QObject *parent) :QT7VideoWindowControl(parent), m_movie(0), m_movieView(0), + m_layouted(false), m_winId(0), m_fullscreen(false), m_aspectRatioMode(QVideoWidget::KeepAspectRatio), @@ -166,6 +167,8 @@ QT7MovieViewOutput::QT7MovieViewOutput(QObject *parent) QT7MovieViewOutput::~QT7MovieViewOutput() { + [(QTMovieView*)m_movieView release]; + [(QTMovie*)m_movie release]; } void QT7MovieViewOutput::setupVideoOutput() @@ -186,6 +189,7 @@ void QT7MovieViewOutput::setupVideoOutput() [(QTMovieView*)m_movieView setMovie:(QTMovie*)m_movie]; [(NSView *)m_winId addSubview:(QTMovieView*)m_movieView]; + m_layouted = true; setDisplayRect(m_displayRect); } @@ -196,8 +200,21 @@ void QT7MovieViewOutput::setEnabled(bool) void QT7MovieViewOutput::setMovie(void *movie) { - m_movie = movie; - setupVideoOutput(); + if (m_movie != movie) { + if (m_movie) { + if (m_movieView) + [(QTMovieView*)m_movieView setMovie:nil]; + + [(QTMovie*)m_movie release]; + } + + m_movie = movie; + + if (m_movie) + [(QTMovie*)m_movie retain]; + + setupVideoOutput(); + } } void QT7MovieViewOutput::updateNaturalSize(const QSize &newSize) @@ -215,8 +232,15 @@ WId QT7MovieViewOutput::winId() const void QT7MovieViewOutput::setWinId(WId id) { - m_winId = id; - setupVideoOutput(); + if (m_winId != id) { + if (m_movieView && m_layouted) { + [(QTMovieView*)m_movieView removeFromSuperview]; + m_layouted = false; + } + + m_winId = id; + setupVideoOutput(); + } } QRect QT7MovieViewOutput::displayRect() const |