summaryrefslogtreecommitdiffstats
path: root/src/plugins/mediaservices/gstreamer
diff options
context:
space:
mode:
authorJustin McPherson <justin.mcpherson@nokia.com>2010-01-28 07:28:36 (GMT)
committerJustin McPherson <justin.mcpherson@nokia.com>2010-01-28 07:28:36 (GMT)
commitb220901d125b6c440426577b10d5c7463bf49964 (patch)
tree18544fc56ac59c7021ddd3a9dff8f9301d8eba63 /src/plugins/mediaservices/gstreamer
parent1e7dc2be019a5cb278d5ca72702dfbac846bf3e7 (diff)
downloadQt-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/gstreamer')
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp7
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h1
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp16
-rw-r--r--src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h3
4 files changed, 27 insertions, 0 deletions
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
index 7dd8375..f008e81 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
@@ -80,6 +80,8 @@ QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *sessio
this, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
connect(m_session,SIGNAL(bufferingProgressChanged(int)),
this, SIGNAL(bufferStatusChanged(int)));
+ connect(m_session, SIGNAL(audioAvailableChanged(bool)),
+ this, SIGNAL(audioAvailableChanged(bool)));
connect(m_session, SIGNAL(videoAvailableChanged(bool)),
this, SIGNAL(videoAvailableChanged(bool)));
connect(m_session, SIGNAL(seekableChanged(bool)),
@@ -236,6 +238,11 @@ void QGstreamerPlayerControl::setVideoOutput(QObject *output)
m_session->setVideoRenderer(output);
}
+bool QGstreamerPlayerControl::isAudioAvailable() const
+{
+ return m_session->isAudioAvailable();
+}
+
bool QGstreamerPlayerControl::isVideoAvailable() const
{
return m_session->isVideoAvailable();
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h
index 7fb2349..ae0f8b6 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.h
@@ -79,6 +79,7 @@ public:
int volume() const;
bool isMuted() const;
+ bool isAudioAvailable() const;
bool isVideoAvailable() const;
void setVideoOutput(QObject *output);
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
index 93d97cf..93151e1 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp
@@ -63,6 +63,7 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
m_volume(100),
m_playbackRate(1.0),
m_muted(false),
+ m_audioAvailable(false),
m_videoAvailable(false),
m_seekable(false),
m_lastPosition(0),
@@ -231,6 +232,11 @@ bool QGstreamerPlayerSession::isMuted() const
return m_muted;
}
+bool QGstreamerPlayerSession::isAudioAvailable() const
+{
+ return m_audioAvailable;
+}
+
void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput)
{
m_renderer = qobject_cast<QGstreamerVideoRendererInterface*>(videoOutput);
@@ -565,6 +571,7 @@ void QGstreamerPlayerSession::getStreamsInfo()
}
//check if video is available:
+ bool haveAudio = false;
bool haveVideo = false;
// m_streamProperties.clear();
// m_streamTypes.clear();
@@ -578,6 +585,9 @@ void QGstreamerPlayerSession::getStreamsInfo()
g_object_get(G_OBJECT(m_playbin), "n-video", &videoStreamsCount, NULL);
g_object_get(G_OBJECT(m_playbin), "n-text", &textStreamsCount, NULL);
+ haveAudio = audioStreamsCount > 0;
+ haveVideo = videoStreamsCount > 0;
+
m_playbin2StreamOffset[QMediaStreamsControl::AudioStream] = 0;
m_playbin2StreamOffset[QMediaStreamsControl::VideoStream] = audioStreamsCount;
m_playbin2StreamOffset[QMediaStreamsControl::SubPictureStream] = audioStreamsCount+videoStreamsCount;
@@ -648,6 +658,8 @@ void QGstreamerPlayerSession::getStreamsInfo()
if (type == GST_STREAM_TYPE_VIDEO)
haveVideo = true;
+ else if (type == GST_STREAM_TYPE_AUDIO)
+ hasAudio = true;
// QMediaStreamsControl::StreamType streamType = QMediaStreamsControl::UnknownStream;
//
@@ -674,6 +686,10 @@ void QGstreamerPlayerSession::getStreamsInfo()
}
#endif
+ if (haveAudio != m_audioAvailable) {
+ m_audioAvailable = haveAudio;
+ emit audioAvailableChanged(m_audioAvailable);
+ }
if (haveVideo != m_videoAvailable) {
m_videoAvailable = haveVideo;
emit videoAvailableChanged(m_videoAvailable);
diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h
index f855727..0da5f8f 100644
--- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h
+++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h
@@ -84,6 +84,7 @@ public:
bool isMuted() const;
void setVideoRenderer(QObject *renderer);
+ bool isAudioAvailable() const;
bool isVideoAvailable() const;
bool isSeekable() const;
@@ -120,6 +121,7 @@ signals:
void mediaStatusChanged(QMediaPlayer::MediaStatus mediaStatus);
void volumeChanged(int volume);
void mutedStateChanged(bool muted);
+ void audioAvailalbeChanged(bool audioAvailable);
void videoAvailableChanged(bool videoAvailable);
void bufferingChanged(bool buffering);
void bufferingProgressChanged(int percentFilled);
@@ -154,6 +156,7 @@ private:
int m_volume;
qreal m_playbackRate;
bool m_muted;
+ bool m_audioAvailable;
bool m_videoAvailable;
bool m_seekable;