From bced83df38693948bb815cbfad1a8dc1a9c66baa Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Tue, 9 Feb 2010 15:56:36 +1000 Subject: Added errors reporting to gst playback backend. --- .../gstreamer/mediaplayer/qgstreamerplayercontrol.cpp | 2 ++ .../gstreamer/mediaplayer/qgstreamerplayersession.cpp | 13 +++++++++++++ .../gstreamer/mediaplayer/qgstreamerplayersession.h | 1 + 3 files changed, 16 insertions(+) diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp index f008e81..d417266 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp @@ -86,6 +86,8 @@ QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *sessio this, SIGNAL(videoAvailableChanged(bool))); connect(m_session, SIGNAL(seekableChanged(bool)), this, SIGNAL(seekableChanged(bool))); + connect(m_session, SIGNAL(error(int,QString)), + this, SIGNAL(error(int,QString))); } QGstreamerPlayerControl::~QGstreamerPlayerControl() diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp index 016909a..355df2f 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -266,6 +266,8 @@ void QGstreamerPlayerSession::play() emit stateChanged(m_state); emit mediaStatusChanged(m_mediaStatus); + + emit error(int(QMediaPlayer::ResourceError), tr("Unable to play %1").arg(m_url.path())); } } } @@ -525,7 +527,18 @@ void QGstreamerPlayerSession::busMessage(const QGstreamerMessage &message) case GST_MESSAGE_TAG: case GST_MESSAGE_STREAM_STATUS: case GST_MESSAGE_UNKNOWN: + break; case GST_MESSAGE_ERROR: + { + GError *err; + gchar *debug; + gst_message_parse_error (gm, &err, &debug); + emit error(int(QMediaPlayer::ResourceError), QString::fromUtf8(err->message)); + qWarning() << "Error:" << QString::fromUtf8(err->message); + g_error_free (err); + g_free (debug); + } + break; case GST_MESSAGE_WARNING: case GST_MESSAGE_INFO: break; diff --git a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h index d33ffd2..e277ba9 100644 --- a/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h +++ b/src/plugins/mediaservices/gstreamer/mediaplayer/qgstreamerplayersession.h @@ -129,6 +129,7 @@ signals: void tagsChanged(); void streamsChanged(); void seekableChanged(bool); + void error(int error, const QString &errorString); private slots: void busMessage(const QGstreamerMessage &message); -- cgit v0.12