diff options
author | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-02-19 06:28:56 (GMT) |
---|---|---|
committer | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2010-02-19 06:28:56 (GMT) |
commit | 90b9d45d77b25769834d4b879baff13a3327f4ce (patch) | |
tree | c760ebc60dac10aac9ee0a015042491f6735b1af /src/plugins/mediaservices/qt7/mediaplayer | |
parent | 881164993418b15697faefc6989b7d3d217dba0a (diff) | |
download | Qt-90b9d45d77b25769834d4b879baff13a3327f4ce.zip Qt-90b9d45d77b25769834d4b879baff13a3327f4ce.tar.gz Qt-90b9d45d77b25769834d4b879baff13a3327f4ce.tar.bz2 |
QuickTime playback backend: listen for natural size changes and update
video outputs.
Diffstat (limited to 'src/plugins/mediaservices/qt7/mediaplayer')
-rw-r--r-- | src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h | 1 | ||||
-rw-r--r-- | src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm | 26 |
2 files changed, 21 insertions, 6 deletions
diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h index 8187f72..4742e2e 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h @@ -109,6 +109,7 @@ public slots: void processEOS(); void processStateChange(); void processVolumeChange(); + void processNaturalSizeChange(); signals: void positionChanged(qint64 position); diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm index 9ea33e4..d1381fe 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm @@ -104,6 +104,9 @@ QT_BEGIN_NAMESPACE [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(processVolumeChange:) name: QTMovieVolumeDidChangeNotification object: m_movie]; + [[NSNotificationCenter defaultCenter] addObserver: self selector: + @selector(processNaturalSizeChange:) name: QTMovieNaturalSizeDidChangeNotification object: m_movie]; + [movie retain]; } } @@ -126,6 +129,11 @@ QT_BEGIN_NAMESPACE m_session->processVolumeChange(); } +- (void) processNaturalSizeChange :(NSNotification *)notification +{ + Q_UNUSED(notification); + m_session->processNaturalSizeChange(); +} @end @@ -353,6 +361,8 @@ void QT7PlayerSession::setMedia(const QMediaContent &content, QIODevice *stream) else return; + qDebug() << "Open media" << url; + NSError *err = 0; NSString *urlString = (NSString *)qString2CFStringRef(url.toString()); @@ -415,7 +425,7 @@ void QT7PlayerSession::processStateChange() { signed long state = [[(QTMovie*)m_QTMovie attributeForKey:QTMovieLoadStateAttribute] longValue]; - //qDebug() << "new State:" << state; + qDebug() << "Moview load state changed:" << state; #ifndef QUICKTIME_C_API_AVAILABLE enum { @@ -457,11 +467,6 @@ void QT7PlayerSession::processStateChange() emit durationChanged(duration()); emit audioAvailableChanged(isAudioAvailable()); emit videoAvailableChanged(isVideoAvailable()); - - //give output a change to re-read movie properties - if (m_videoOutput) - m_videoOutput->setMovie(m_QTMovie); - break; case QMediaPlayer::InvalidMedia: emit stateChanged(m_state = QMediaPlayer::StoppedState); @@ -485,6 +490,15 @@ void QT7PlayerSession::processVolumeChange() } } +void QT7PlayerSession::processNaturalSizeChange() +{ + if (m_videoOutput) { + NSSize size = [[(QTMovie*)m_QTMovie attributeForKey:@"QTMovieNaturalSizeAttribute"] sizeValue]; + qDebug() << "Native size changed:" << QSize(size.width, size.height); + m_videoOutput->updateNaturalSize(QSize(size.width, size.height)); + } +} + #include "moc_qt7playersession.cpp" QT_END_NAMESPACE |