diff options
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinlocks.cpp | 21 | ||||
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinsession.cpp | 3 | ||||
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinsession.h | 2 |
3 files changed, 19 insertions, 7 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp b/src/plugins/gstreamer/camerabin/camerabinlocks.cpp index e6fe9a309..2f44ec057 100644 --- a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinlocks.cpp @@ -65,9 +65,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 @@ -195,9 +198,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); @@ -206,8 +213,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 3dd200c54..96b31e1b3 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -514,7 +514,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 dda900a8b..ade8916ba 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.h +++ b/src/plugins/gstreamer/camerabin/camerabinsession.h @@ -91,7 +91,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; |