diff options
author | Justin McPherson <justin.mcpherson@nokia.com> | 2010-01-28 07:28:36 (GMT) |
---|---|---|
committer | Justin McPherson <justin.mcpherson@nokia.com> | 2010-01-28 07:28:36 (GMT) |
commit | b220901d125b6c440426577b10d5c7463bf49964 (patch) | |
tree | 18544fc56ac59c7021ddd3a9dff8f9301d8eba63 /src/plugins/mediaservices/qt7/mediaplayer | |
parent | 1e7dc2be019a5cb278d5ca72702dfbac846bf3e7 (diff) | |
download | Qt-b220901d125b6c440426577b10d5c7463bf49964.zip Qt-b220901d125b6c440426577b10d5c7463bf49964.tar.gz Qt-b220901d125b6c440426577b10d5c7463bf49964.tar.bz2 |
Add an audioAvailable property to QMediaPlayer.
from: Andrew den Exter committed 00373999 to qtmobility/qtm-multimedia
Diffstat (limited to 'src/plugins/mediaservices/qt7/mediaplayer')
4 files changed, 18 insertions, 1 deletions
diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playercontrol.h b/src/plugins/mediaservices/qt7/mediaplayer/qt7playercontrol.h index da86949..907d13d 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playercontrol.h +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playercontrol.h @@ -82,13 +82,13 @@ public: int volume() const; bool isMuted() const; + bool isAudioAvailable() const; bool isVideoAvailable() const; bool isSeekable() const; QMediaTimeRange availablePlaybackRanges() const; - qreal playbackRate() const; void setPlaybackRate(qreal rate); diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playercontrol.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playercontrol.mm index b74f434..0f4ac41 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playercontrol.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playercontrol.mm @@ -71,6 +71,7 @@ void QT7PlayerControl::setSession(QT7PlayerSession *session) this, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))); connect(m_session, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int))); connect(m_session, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool))); + connect(m_session, SIGNAL(audioAvailableChanged(bool)), this, SIGNAL(audioAvailableChanged(bool))); connect(m_session, SIGNAL(videoAvailableChanged(bool)), this, SIGNAL(videoAvailableChanged(bool))); connect(m_session, SIGNAL(error(int,QString)), this, SIGNAL(error(int,QString))); } @@ -177,6 +178,10 @@ void QT7PlayerControl::setMedia(const QMediaContent &content, QIODevice *stream) emit mediaChanged(content); } +bool QT7PlayerControl::isAudioAvailable() const +{ + return m_session->isAudioAvailable(); +} bool QT7PlayerControl::isVideoAvailable() const { diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h index 55505ee..2a6bab7 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.h @@ -87,6 +87,7 @@ public: int volume() const; bool isMuted() const; + bool isAudioAvailable() const; bool isVideoAvailable() const; bool isSeekable() const; @@ -112,6 +113,7 @@ signals: void mediaStatusChanged(QMediaPlayer::MediaStatus status); void volumeChanged(int volume); void mutedChanged(bool muted); + void audioAvailableChanged(bool audioAvailable); void videoAvailableChanged(bool videoAvailable); void error(int error, const QString &errorString); diff --git a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm index 3131a90..d9bb646 100644 --- a/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm +++ b/src/plugins/mediaservices/qt7/mediaplayer/qt7playersession.mm @@ -373,6 +373,7 @@ void QT7PlayerSession::setMedia(const QMediaContent &content, QIODevice *stream) } emit durationChanged(duration()); + emit audioAvailableChanged(isAudioAvailable()); emit videoAvailableChanged(isVideoAvailable()); [(QTMovie*)m_QTMovie setMuted:m_muted]; @@ -380,6 +381,15 @@ void QT7PlayerSession::setMedia(const QMediaContent &content, QIODevice *stream) } } +bool QT7PlayerSession::isAudioAvailable() const +{ + if (!m_QTMovie) + return false; + + AutoReleasePool pool; + return [[(QTMovie*)m_QTMovie attributeForKey:@"QTMovieHasAudioAttribute"] boolValue] == YES; +} + bool QT7PlayerSession::isVideoAvailable() const { if (!m_QTMovie) |