Adding hasAudio and hasVideo properties to QML MediaPlayer
Adding hasAudio and hasVideo to MediaPlayer QML object to allow users to determine whether the current media has audio and/or video streams. Also adding notifies for when these properties change. Change-Id: Ife7606e148f0c0ad558b4019c68c70973c199c08 Reviewed-by: Sergey Dubitskiy Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
b094a91c9d
commit
c13a13c486
@@ -260,6 +260,28 @@ QDeclarativeAudio::Status QDeclarativeAudio::status() const
|
||||
This property holds whether the audio output is muted.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\qmlproperty bool Audio::hasAudio
|
||||
|
||||
This property holds whether the media contains audio.
|
||||
*/
|
||||
|
||||
bool QDeclarativeAudio::hasAudio() const
|
||||
{
|
||||
return !m_complete ? false : m_playerControl->isAudioAvailable();
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlproperty bool Audio::hasVideo
|
||||
|
||||
This property holds whether the media contains video.
|
||||
*/
|
||||
|
||||
bool QDeclarativeAudio::hasVideo() const
|
||||
{
|
||||
return !m_complete ? false : m_playerControl->isVideoAvailable();
|
||||
}
|
||||
|
||||
/*!
|
||||
\qmlproperty real Audio::bufferProgress
|
||||
|
||||
@@ -305,6 +327,14 @@ QDeclarativeAudio::Error QDeclarativeAudio::error() const
|
||||
void QDeclarativeAudio::classBegin()
|
||||
{
|
||||
setObject(this);
|
||||
|
||||
if (m_mediaService) {
|
||||
connect(m_playerControl, SIGNAL(audioAvailableChanged(bool)),
|
||||
this, SIGNAL(hasAudioChanged()));
|
||||
connect(m_playerControl, SIGNAL(videoAvailableChanged(bool)),
|
||||
this, SIGNAL(hasVideoChanged()));
|
||||
}
|
||||
|
||||
emit mediaObjectChanged();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user