codecs: Report missing codecs to applications.

[playback] Emit missing-plugin codec descriptions as QMediaPlayer::FormatErrors. JB#47099

Remove the old vague message on playback failure, as it's no longer needed. And a duplicated include.

Change-Id: I0c515bd8e4de6d2e2c5966aa776219f5200353a9
This commit is contained in:
Andrew Branson
2019-12-13 10:57:14 +01:00
parent 93ec8cd223
commit 5a7951ad80

View File

@@ -46,6 +46,7 @@
#include <gst/gstvalue.h> #include <gst/gstvalue.h>
#include <gst/base/gstbasesrc.h> #include <gst/base/gstbasesrc.h>
#include <gst/pbutils/missing-plugins.h>
#include <QtMultimedia/qmediametadata.h> #include <QtMultimedia/qmediametadata.h>
#include <QtCore/qdatetime.h> #include <QtCore/qdatetime.h>
@@ -1309,13 +1310,15 @@ bool QGstreamerPlayerSession::processBusMessage(const QGstreamerMessage &message
handlePlaybin2 = true; handlePlaybin2 = true;
} }
if (gst_is_missing_plugin_message(gm)) {
emit error(int(QMediaPlayer::FormatError), gst_missing_plugin_message_get_description(gm));
}
if (handlePlaybin2) { if (handlePlaybin2) {
if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_WARNING) { if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_WARNING) {
GError *err; GError *err;
gchar *debug; gchar *debug;
gst_message_parse_warning(gm, &err, &debug); gst_message_parse_warning(gm, &err, &debug);
if (err->domain == GST_STREAM_ERROR && err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND)
emit error(int(QMediaPlayer::FormatError), tr("Cannot play stream of type: <unknown>"));
// GStreamer shows warning for HTTP playlists // GStreamer shows warning for HTTP playlists
if (!m_isPlaylist) if (!m_isPlaylist)
qWarning() << "Warning:" << QString::fromUtf8(err->message); qWarning() << "Warning:" << QString::fromUtf8(err->message);