diff options
author | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2014-10-17 16:51:23 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@theqtcompany.com> | 2014-10-30 12:57:15 +0100 |
commit | deb13f102a0773ef87310346f1755b16215e62f4 (patch) | |
tree | c71afe3b00f5e353f50d56f5bd896f9dcba72795 /src/plugins | |
parent | f51ca0b97c90d479bac16bc549e8555bbbf5bb73 (diff) |
Add QT_GSTREAMER_CAMERABIN_VIDEOSRC environment variable.
It can be used to set which video source element should be used by
the camerabin.
Change-Id: I8d1cd8c4ba6fe5a89817699f645b0997e713aaca
Reviewed-by: Samuli Piippo <samuli.piippo@digia.com>
Reviewed-by: Christian Stromme <christian.stromme@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinsession.cpp | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp index 019783971..a4038c589 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -412,9 +412,41 @@ GstElement *CameraBinSession::buildCameraSource() if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSrc), "video-source")) { GstElement *src = 0; - if (m_videoInputFactory) + /* QT_GSTREAMER_CAMERABIN_VIDEOSRC can be used to set the video source element. + + --- Usage + + QT_GSTREAMER_CAMERABIN_VIDEOSRC=[drivername=elementname[,drivername2=elementname2 ...],][elementname] + + --- Examples + + Always use 'somevideosrc': + QT_GSTREAMER_CAMERABIN_VIDEOSRC="somevideosrc" + + Use 'somevideosrc' when the device driver is 'somedriver', otherwise use default: + QT_GSTREAMER_CAMERABIN_VIDEOSRC="somedriver=somevideosrc" + + Use 'somevideosrc' when the device driver is 'somedriver', otherwise use 'somevideosrc2' + QT_GSTREAMER_CAMERABIN_VIDEOSRC="somedriver=somevideosrc,somevideosrc2" + */ + const QByteArray envVideoSource = qgetenv("QT_GSTREAMER_CAMERABIN_VIDEOSRC"); + if (!envVideoSource.isEmpty()) { + QList<QByteArray> sources = envVideoSource.split(','); + foreach (const QByteArray &source, sources) { + QList<QByteArray> keyValue = source.split('='); + if (keyValue.count() == 1) { + src = gst_element_factory_make(keyValue.at(0), "camera_source"); + break; + } else if (keyValue.at(0) == QGstUtils::cameraDriver(m_inputDevice, m_sourceFactory)) { + src = gst_element_factory_make(keyValue.at(1), "camera_source"); + break; + } + } + } else if (m_videoInputFactory) { src = m_videoInputFactory->buildElement(); - else + } + + if (!src) src = gst_element_factory_make("v4l2src", "camera_source"); if (src) { |