diff options
author | Andrew den Exter <andrew.den.exter@jollamobile.com> | 2014-07-08 15:56:05 +1000 |
---|---|---|
committer | Andrew den Exter <andrew.den.exter@qinetic.com.au> | 2014-07-12 02:46:10 +0200 |
commit | cddbe8736d995b4bfdfbbf1abfc3d6aeae3eb214 (patch) | |
tree | 8d775c9ee17902ae39aebae0d825ee3a93455135 /src/plugins/gstreamer/camerabin/camerabinsession.cpp | |
parent | 074bd6ab37bbbb4dbba188921783fd98be872555 (diff) | |
download | qtmultimedia-cddbe8736d995b4bfdfbbf1abfc3d6aeae3eb214.tar.gz |
Provide face and orientation info from gstreamer camera backend.
Cleans up duplicate device enumeration code so the devices listed by
the QMediaServiceProviderPlugin are the same as those in the
QVideoInputDeviceControl and includes face and orientation information
if available.
Change-Id: Iaa4c303c973bcf3e0f7c8c2fd7a7de629bccec86
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/plugins/gstreamer/camerabin/camerabinsession.cpp')
-rw-r--r-- | src/plugins/gstreamer/camerabin/camerabinsession.cpp | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp index a835b1ce5..b18e9c93c 100644 --- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp +++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp @@ -119,7 +119,7 @@ QT_BEGIN_NAMESPACE -CameraBinSession::CameraBinSession(QObject *parent) +CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *parent) :QObject(parent), m_recordingActive(false), m_state(QCamera::UnloadedState), @@ -133,6 +133,7 @@ CameraBinSession::CameraBinSession(QObject *parent) m_viewfinderInterface(0), m_videoSrc(0), m_viewfinderElement(0), + m_sourceFactory(sourceFactory), m_viewfinderHasChanged(true), m_videoInputHasChanged(true), m_audioSrc(0), @@ -142,6 +143,9 @@ CameraBinSession::CameraBinSession(QObject *parent) m_audioEncoder(0), m_muxer(0) { + if (m_sourceFactory) + gst_object_ref(GST_OBJECT(m_sourceFactory)); + m_camerabin = gst_element_factory_make("camerabin2", "camerabin2"); g_signal_connect(G_OBJECT(m_camerabin), "notify::idle", G_CALLBACK(updateBusyStatus), this); qt_gst_object_ref_sink(m_camerabin); @@ -195,6 +199,9 @@ CameraBinSession::~CameraBinSession() } if (m_viewfinderElement) gst_object_unref(GST_OBJECT(m_viewfinderElement)); + + if (m_sourceFactory) + gst_object_unref(GST_OBJECT(m_sourceFactory)); } #ifdef HAVE_GST_PHOTOGRAPHY @@ -383,32 +390,17 @@ GstElement *CameraBinSession::buildCameraSource() m_videoInputHasChanged = false; GstElement *videoSrc = 0; + + if (!videoSrc) g_object_get(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, &videoSrc, NULL); - // If the QT_GSTREAMER_CAMERABIN_SRC environment variable has been set use the source - // it recommends. - const QByteArray envCandidate = qgetenv("QT_GSTREAMER_CAMERABIN_SRC"); - if (!m_videoSrc && !envCandidate.isEmpty()) { - m_videoSrc = gst_element_factory_make(envCandidate.constData(), "camera_source"); - } + if (m_sourceFactory) + m_videoSrc = gst_element_factory_create(m_sourceFactory, "camera_source"); // If gstreamer has set a default source use it. if (!m_videoSrc) m_videoSrc = videoSrc; - // If there's no better guidance try the names of some known camera source elements. - if (!m_videoSrc) { - const QList<QByteArray> candidates = QList<QByteArray>() - << "subdevsrc" - << "wrappercamerabinsrc"; - - foreach (const QByteArray &sourceElementName, candidates) { - m_videoSrc = gst_element_factory_make(sourceElementName.constData(), "camera_source"); - if (m_videoSrc) - break; - } - } - if (m_videoSrc && !m_inputDevice.isEmpty()) { #if CAMERABIN_DEBUG qDebug() << "set camera device" << m_inputDevice; |