summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVaL Doroshchuk <valentyn.doroshchuk@qt.io>2018-06-11 08:48:43 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2018-06-20 09:54:40 +0000
commit2f7b546540c11a4697ee7bc363c7ac7cc5b053b4 (patch)
tree63f857c499ac93a5252854b18bd2d6beb30b36f3
parentad3817f3b1b7534485faf6d153b7505803187094 (diff)
downloadqtmultimedia-2f7b546540c11a4697ee7bc363c7ac7cc5b053b4.tar.gz
Gstreamer: Use gst_parse_launch in QT_GSTREAMER_CAMERABIN_VIDEOSRC
QT_GSTREAMER_CAMERABIN_VIDEOSRC can contain pipeline description and not just one video source element. QT_GSTREAMER_CAMERABIN_VIDEOSRC="nvcamerasrc ! nvvidconv" ./app Task-number: QTBUG-60884 Change-Id: Iebf052a6669fd17139b78949ed0bb314f1faef65 Reviewed-by: VaL Doroshchuk <valentyn.doroshchuk@qt.io>
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
index d7a96d333..e87e1b3f0 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
@@ -518,11 +518,19 @@ GstElement *CameraBinSession::buildCameraSource()
const QList<QByteArray> sources = envVideoSource.split(',');
for (const QByteArray &source : sources) {
QList<QByteArray> keyValue = source.split('=');
- if (keyValue.count() == 1) {
- m_videoSrc = gst_element_factory_make(keyValue.at(0), "camera_source");
- break;
- } else if (keyValue.at(0) == QGstUtils::cameraDriver(m_inputDevice, m_sourceFactory)) {
- m_videoSrc = gst_element_factory_make(keyValue.at(1), "camera_source");
+ QByteArray name = keyValue.at(0);
+ if (keyValue.count() > 1 && keyValue.at(0) == QGstUtils::cameraDriver(m_inputDevice, m_sourceFactory))
+ name = keyValue.at(1);
+
+ GError *error = NULL;
+ GstElement *element = gst_parse_launch(name, &error);
+
+ if (error) {
+ g_printerr("ERROR: %s: %s\n", name.constData(), GST_STR_NULL(error->message));
+ g_clear_error(&error);
+ }
+ if (element) {
+ m_videoSrc = element;
break;
}
}