GStreamer: print a warning when the camerabin plugin is missing

Don't create the camera service when the camerabin plugin is not
available on the system and print a warning.

Task-number: QTBUG-50775
Change-Id: I56c7e6297bebe4b90596cb3c0323f1d38231bceb
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
This commit is contained in:
Yoann Lopes
2016-09-21 12:01:23 +03:00
parent 4bae769725
commit 6b94b3ca91

View File

@@ -60,8 +60,19 @@ QMediaService* CameraBinServicePlugin::create(const QString &key)
{
QGstUtils::initializeGst();
if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
if (key == QLatin1String(Q_MEDIASERVICE_CAMERA)) {
if (!CameraBinService::isCameraBinAvailable()) {
guint major, minor, micro, nano;
gst_version(&major, &minor, &micro, &nano);
qWarning("Error: cannot create camera service, the 'camerabin' plugin is missing for "
"GStreamer %u.%u."
"\nPlease install the 'bad' GStreamer plugin package.",
major, minor);
return Q_NULLPTR;
}
return new CameraBinService(sourceFactory());
}
qWarning() << "Gstreamer camerabin service plugin: unsupported key:" << key;
return 0;