Fixed: Streams information is not updated properly for RTSP streams.

Changes to QGstreamerPlayerSession:
Handle video-changed, audio-changed, and text-changed signals.
Call getStreamsInfo() to update streams information.

Change-Id: I8bfead3268771245635424b5f1debff624bbe038
Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
Reviewed-by: Ling Hu <ling.hu@nokia.com>
Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
This commit is contained in:
Lev Zelenskiy
2012-03-28 15:12:04 +10:00
committed by Qt by Nokia
parent ff3595f07f
commit d8b688f8af
2 changed files with 21 additions and 1 deletions

View File

@@ -189,6 +189,10 @@ QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
g_signal_connect(G_OBJECT(m_playbin), "notify::volume", G_CALLBACK(handleVolumeChange), this); g_signal_connect(G_OBJECT(m_playbin), "notify::volume", G_CALLBACK(handleVolumeChange), this);
if (m_usePlaybin2) if (m_usePlaybin2)
g_signal_connect(G_OBJECT(m_playbin), "notify::mute", G_CALLBACK(handleMutedChange), this); g_signal_connect(G_OBJECT(m_playbin), "notify::mute", G_CALLBACK(handleMutedChange), this);
g_signal_connect(G_OBJECT(m_playbin), "video-changed", G_CALLBACK(handleStreamsChange), this);
g_signal_connect(G_OBJECT(m_playbin), "audio-changed", G_CALLBACK(handleStreamsChange), this);
g_signal_connect(G_OBJECT(m_playbin), "text-changed", G_CALLBACK(handleStreamsChange), this);
} }
} }
@@ -1248,11 +1252,16 @@ bool QGstreamerPlayerSession::processBusMessage(const QGstreamerMessage &message
void QGstreamerPlayerSession::getStreamsInfo() void QGstreamerPlayerSession::getStreamsInfo()
{ {
QList< QMap<QString,QVariant> > oldProperties = m_streamProperties;
QList<QMediaStreamsControl::StreamType> oldTypes = m_streamTypes;
QMap<QMediaStreamsControl::StreamType, int> oldOffset = m_playbin2StreamOffset;
//check if video is available: //check if video is available:
bool haveAudio = false; bool haveAudio = false;
bool haveVideo = false; bool haveVideo = false;
m_streamProperties.clear(); m_streamProperties.clear();
m_streamTypes.clear(); m_streamTypes.clear();
m_playbin2StreamOffset.clear();
if (m_usePlaybin2) { if (m_usePlaybin2) {
gint audioStreamsCount = 0; gint audioStreamsCount = 0;
@@ -1383,7 +1392,8 @@ void QGstreamerPlayerSession::getStreamsInfo()
emit videoAvailableChanged(m_videoAvailable); emit videoAvailableChanged(m_videoAvailable);
} }
emit streamsChanged(); if (oldProperties != m_streamProperties || oldTypes != m_streamTypes || oldOffset != m_playbin2StreamOffset)
emit streamsChanged();
} }
void QGstreamerPlayerSession::updateVideoResolutionTag() void QGstreamerPlayerSession::updateVideoResolutionTag()
@@ -1656,6 +1666,14 @@ void QGstreamerPlayerSession::handleElementAdded(GstBin *bin, GstElement *elemen
g_free(elementName); g_free(elementName);
} }
void QGstreamerPlayerSession::handleStreamsChange(GstBin *bin, gpointer user_data)
{
Q_UNUSED(bin);
QGstreamerPlayerSession* session = reinterpret_cast<QGstreamerPlayerSession*>(user_data);
QMetaObject::invokeMethod(session, "getStreamsInfo", Qt::QueuedConnection);
}
//doing proper operations when detecting an invalidMedia: change media status before signal the erorr //doing proper operations when detecting an invalidMedia: change media status before signal the erorr
void QGstreamerPlayerSession::processInvalidMedia(QMediaPlayer::Error errorCode, const QString& errorString) void QGstreamerPlayerSession::processInvalidMedia(QMediaPlayer::Error errorCode, const QString& errorString)
{ {

View File

@@ -179,6 +179,8 @@ private:
static void handleMutedChange(GObject *o, GParamSpec *p, gpointer d); static void handleMutedChange(GObject *o, GParamSpec *p, gpointer d);
static void insertColorSpaceElement(GstElement *element, gpointer data); static void insertColorSpaceElement(GstElement *element, gpointer data);
static void handleElementAdded(GstBin *bin, GstElement *element, QGstreamerPlayerSession *session); static void handleElementAdded(GstBin *bin, GstElement *element, QGstreamerPlayerSession *session);
static void handleStreamsChange(GstBin *bin, gpointer user_data);
void processInvalidMedia(QMediaPlayer::Error errorCode, const QString& errorString); void processInvalidMedia(QMediaPlayer::Error errorCode, const QString& errorString);
void removeVideoBufferProbe(); void removeVideoBufferProbe();