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/multimedia/playback | |
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/multimedia/playback')
-rw-r--r-- | src/multimedia/playback/qmediaplayer.cpp | 26 | ||||
-rw-r--r-- | src/multimedia/playback/qmediaplayer.h | 3 | ||||
-rw-r--r-- | src/multimedia/playback/qmediaplayercontrol.cpp | 16 | ||||
-rw-r--r-- | src/multimedia/playback/qmediaplayercontrol.h | 2 |
4 files changed, 47 insertions, 0 deletions
diff --git a/src/multimedia/playback/qmediaplayer.cpp b/src/multimedia/playback/qmediaplayer.cpp index 878af0a..0853597 100644 --- a/src/multimedia/playback/qmediaplayer.cpp +++ b/src/multimedia/playback/qmediaplayer.cpp @@ -282,6 +282,7 @@ QMediaPlayer::QMediaPlayer(QObject *parent, QMediaPlayer::Flags flags, QMediaSer connect(d->control, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64))); connect(d->control, SIGNAL(positionChanged(qint64)), SIGNAL(positionChanged(qint64))); + connect(d->control, SIGNAL(audioAvailableChanged(bool)), SIGNAL(audioAvailableChanged(bool))); connect(d->control, SIGNAL(videoAvailableChanged(bool)), SIGNAL(videoAvailableChanged(bool))); connect(d->control, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged(int))); connect(d->control, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool))); @@ -402,6 +403,16 @@ int QMediaPlayer::bufferStatus() const return 0; } +bool QMediaPlayer::isAudioAvailable() const +{ + Q_D(const QMediaPlayer); + + if (d->control != 0) + return d->control->isAudioAvailable(); + + return false; +} + bool QMediaPlayer::isVideoAvailable() const { Q_D(const QMediaPlayer); @@ -841,6 +852,15 @@ QStringList QMediaPlayer::supportedMimeTypes(Flags flags) */ /*! + \property QMediaPlayer::audioAvailable + \brief the audio availabilty status for the current media. + + As the life time of QMediaPlayer can be longer than the playback of one + QMediaContent, this property may change over time, the + audioAvailableChanged signal can be used to monitor it's status. +*/ + +/*! \property QMediaPlayer::videoAvailable \brief the video availability status for the current media. @@ -902,6 +922,12 @@ QStringList QMediaPlayer::supportedMimeTypes(Flags flags) */ /*! + \fn void QMediaPlayer::audioAvailableChanged(bool available) + + Signals the availability of audio content has changed to \a available. +*/ + +/*! \fn void QMediaPlayer::videoAvailableChanged(bool videoAvailable) Signal the availability of visual content has changed to \a videoAvailable. diff --git a/src/multimedia/playback/qmediaplayer.h b/src/multimedia/playback/qmediaplayer.h index 4de2b5e..dc9d4f0 100644 --- a/src/multimedia/playback/qmediaplayer.h +++ b/src/multimedia/playback/qmediaplayer.h @@ -66,6 +66,7 @@ class Q_MULTIMEDIA_EXPORT QMediaPlayer : public QMediaObject Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged) Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged) Q_PROPERTY(int bufferStatus READ bufferStatus NOTIFY bufferStatusChanged) + Q_PROPERTY(bool audioAvailable READ isAudioAvailable NOTIFY audioAvailableChanged) Q_PROPERTY(bool videoAvailable READ isVideoAvailable NOTIFY videoAvailableChanged) Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged) Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged) @@ -131,6 +132,7 @@ public: int volume() const; bool isMuted() const; + bool isAudioAvailable() const; bool isVideoAvailable() const; int bufferStatus() const; @@ -165,6 +167,7 @@ Q_SIGNALS: void volumeChanged(int volume); void mutedChanged(bool muted); + void audioAvailableChanged(bool audioAvailable); void videoAvailableChanged(bool videoAvailable); void bufferStatusChanged(int percentFilled); diff --git a/src/multimedia/playback/qmediaplayercontrol.cpp b/src/multimedia/playback/qmediaplayercontrol.cpp index 90e3a8c..95ffade 100644 --- a/src/multimedia/playback/qmediaplayercontrol.cpp +++ b/src/multimedia/playback/qmediaplayercontrol.cpp @@ -220,6 +220,22 @@ QMediaPlayerControl::QMediaPlayerControl(QObject *parent): */ /*! + \fn QMediaPlayerControl::isAudioAvailable() const + + Identifies if there is audio output available for the current media. + + Returns true if audio output is available and false otherwise. +*/ + +/*! + \fn QMediaPlayerControl::audioAvailableChanged(bool audio) + + Signals that there has been a change in the availability of \a audio output. + + \sa isAudioAvailable() +*/ + +/*! \fn QMediaPlayerControl::isVideoAvailable() const Identifies if there is video output available for the current media. diff --git a/src/multimedia/playback/qmediaplayercontrol.h b/src/multimedia/playback/qmediaplayercontrol.h index ac3fc45..a7e418b 100644 --- a/src/multimedia/playback/qmediaplayercontrol.h +++ b/src/multimedia/playback/qmediaplayercontrol.h @@ -82,6 +82,7 @@ public: virtual int bufferStatus() const = 0; + virtual bool isAudioAvailable() const = 0; virtual bool isVideoAvailable() const = 0; virtual bool isSeekable() const = 0; @@ -107,6 +108,7 @@ Q_SIGNALS: void mediaStatusChanged(QMediaPlayer::MediaStatus status); void volumeChanged(int volume); void mutedChanged(bool muted); + void audioAvailableChanged(bool audioAvailable); void videoAvailableChanged(bool videoAvailable); void bufferStatusChanged(int percentFilled); void seekableChanged(bool); |