summaryrefslogtreecommitdiffstats
path: root/src/gsttools
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den.exter@jollamobile.com>2013-12-10 13:11:07 +1000
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-13 06:05:05 +0100
commit4d3f740795ece7fb46760d384f21913e02b296d7 (patch)
tree5369e849eb3b79ca004424c17a87e398fc2df5a8 /src/gsttools
parent817c548df4b3693495323b163c584945077bbdaa (diff)
Allow the camerabin source selection to be overridden.
Prefer the default camera-source element if there is one or an element identified by an environment variable to a static list of possible elements which may not be appropriate for the target environment. Change-Id: I53816c949307953780f9046eb11e09effe059be0 Reviewed-by: John Brooks <john.brooks@dereferenced.net> Reviewed-by: Andy Nichols <andy.nichols@digia.com> Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/gsttools')
-rw-r--r--src/gsttools/qgstreamervideoinputdevicecontrol.cpp27
1 files changed, 21 insertions, 6 deletions
diff --git a/src/gsttools/qgstreamervideoinputdevicecontrol.cpp b/src/gsttools/qgstreamervideoinputdevicecontrol.cpp
index 960853bba..ad61aefad 100644
--- a/src/gsttools/qgstreamervideoinputdevicecontrol.cpp
+++ b/src/gsttools/qgstreamervideoinputdevicecontrol.cpp
@@ -57,13 +57,24 @@
#include <linux/videodev2.h>
QGstreamerVideoInputDeviceControl::QGstreamerVideoInputDeviceControl(QObject *parent)
- :QVideoDeviceSelectorControl(parent), m_selectedDevice(0)
+ :QVideoDeviceSelectorControl(parent), m_source(0), m_selectedDevice(0)
{
update();
}
+QGstreamerVideoInputDeviceControl::QGstreamerVideoInputDeviceControl(GstElement *source, QObject *parent)
+ :QVideoDeviceSelectorControl(parent), m_source(source), m_selectedDevice(0)
+{
+ if (m_source)
+ gst_object_ref(GST_OBJECT(m_source));
+
+ update();
+}
+
QGstreamerVideoInputDeviceControl::~QGstreamerVideoInputDeviceControl()
{
+ if (m_source)
+ gst_object_unref(GST_OBJECT(m_source));
}
int QGstreamerVideoInputDeviceControl::deviceCount() const
@@ -107,10 +118,15 @@ void QGstreamerVideoInputDeviceControl::update()
m_names.clear();
m_descriptions.clear();
-#ifdef Q_WS_MAEMO_6
- m_names << QLatin1String("primary") << QLatin1String("secondary");
- m_descriptions << tr("Main camera") << tr("Front camera");
-#else
+ // subdevsrc and the like have a camera-device property that takes an enumeration
+ // identifying a primary or secondary camera, so return identifiers that map to those
+ // instead of a list of actual devices.
+ if (m_source && g_object_class_find_property(G_OBJECT_GET_CLASS(m_source), "camera-device")) {
+ m_names << QLatin1String("primary") << QLatin1String("secondary");
+ m_descriptions << tr("Main camera") << tr("Front camera");
+ return;
+ }
+
QDir devDir("/dev");
devDir.setFilter(QDir::System);
@@ -151,5 +167,4 @@ void QGstreamerVideoInputDeviceControl::update()
}
::close(fd);
}
-#endif
}