summaryrefslogtreecommitdiffstats
path: root/src/plugins/gstreamer
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-10 19:26:21 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-10 19:26:21 +0200
commit08e13bfcdb23eabfbc47bca7499b0b8aadce0ac7 (patch)
tree406ffa7e3ae0a346a14175ccccb8ac7e596d8f8f /src/plugins/gstreamer
parentfa9fe9ff8c3aba25fbae4f8f32588dd6477d6df8 (diff)
parentf0e0d5d901d4e28fff9f29caf86ada84906b3db4 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/plugins/winrt/qwinrtcameracontrol.cpp Change-Id: I45d3042adf19577a72794610fa1c310cb22e26c4
Diffstat (limited to 'src/plugins/gstreamer')
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinlocks.cpp21
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp3
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.h2
3 files changed, 19 insertions, 7 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp b/src/plugins/gstreamer/camerabin/camerabinlocks.cpp
index 9aac3ef5a..2ccc1b0bc 100644
--- a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinlocks.cpp
@@ -71,9 +71,12 @@ QCamera::LockTypes CameraBinLocks::supportedLocks() const
if (GstPhotography *photography = m_session->photography()) {
if (gst_photography_get_capabilities(photography) & GST_PHOTOGRAPHY_CAPS_WB_MODE)
locks |= QCamera::LockWhiteBalance;
- if (g_object_class_find_property(
- G_OBJECT_GET_CLASS(m_session->cameraSource()), "exposure-mode")) {
- locks |= QCamera::LockExposure;
+
+ if (GstElement *source = m_session->cameraSource()) {
+ if (g_object_class_find_property(
+ G_OBJECT_GET_CLASS(source), "exposure-mode")) {
+ locks |= QCamera::LockExposure;
+ }
}
}
#endif
@@ -201,9 +204,13 @@ bool CameraBinLocks::isExposureLocked() const
void CameraBinLocks::lockExposure(QCamera::LockChangeReason reason)
{
+ GstElement *source = m_session->cameraSource();
+ if (!source)
+ return;
+
m_pendingLocks &= ~QCamera::LockExposure;
g_object_set(
- G_OBJECT(m_session->cameraSource()),
+ G_OBJECT(source),
"exposure-mode",
GST_PHOTOGRAPHY_EXPOSURE_MODE_MANUAL,
NULL);
@@ -212,8 +219,12 @@ void CameraBinLocks::lockExposure(QCamera::LockChangeReason reason)
void CameraBinLocks::unlockExposure(QCamera::LockStatus status, QCamera::LockChangeReason reason)
{
+ GstElement *source = m_session->cameraSource();
+ if (!source)
+ return;
+
g_object_set(
- G_OBJECT(m_session->cameraSource()),
+ G_OBJECT(source),
"exposure-mode",
GST_PHOTOGRAPHY_EXPOSURE_MODE_AUTO,
NULL);
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
index 3e5182ff2..3cb4c6161 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
@@ -520,7 +520,8 @@ GstElement *CameraBinSession::buildCameraSource()
if (!m_videoSrc)
m_videoSrc = gst_element_factory_make("v4l2src", "camera_source");
- g_object_set(G_OBJECT(m_cameraSrc), "video-source", m_videoSrc, NULL);
+ if (m_videoSrc)
+ g_object_set(G_OBJECT(m_cameraSrc), "video-source", m_videoSrc, NULL);
}
if (m_videoSrc)
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.h b/src/plugins/gstreamer/camerabin/camerabinsession.h
index e8f41f4db..44faaf701 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.h
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.h
@@ -97,7 +97,7 @@ public:
GstPhotography *photography();
#endif
GstElement *cameraBin() { return m_camerabin; }
- GstElement *cameraSource() { return m_videoSrc; }
+ GstElement *cameraSource() { return m_cameraSrc; }
QGstreamerBusHelper *bus() { return m_busHelper; }
QList< QPair<int,int> > supportedFrameRates(const QSize &frameSize, bool *continuous) const;