summaryrefslogtreecommitdiffstats
path: root/src/plugins/gstreamer/camerabin
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/gstreamer/camerabin')
-rw-r--r--src/plugins/gstreamer/camerabin/camerabin.pro12
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinaudioencoder.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturedestination.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontainer.cpp16
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontainer.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontrol.cpp82
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontrol.h18
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinexposure.cpp103
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinexposure.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinflash.cpp22
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinflash.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinfocus.cpp272
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinfocus.h50
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp164
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimagecapture.h64
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp15
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageencoder.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp149
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageprocessing.h29
-rw-r--r--src/plugins/gstreamer/camerabin/camerabininfocontrol.cpp12
-rw-r--r--src/plugins/gstreamer/camerabin/camerabininfocontrol.h12
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinlocks.cpp178
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinlocks.h33
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinmetadata.cpp19
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinmetadata.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinrecorder.cpp31
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinrecorder.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinservice.cpp39
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinservice.h19
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinserviceplugin.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp939
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.h81
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinvideoencoder.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp65
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h27
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp67
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h61
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinzoom.cpp16
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinzoom.h14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp14
-rw-r--r--src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.h14
49 files changed, 1875 insertions, 1014 deletions
diff --git a/src/plugins/gstreamer/camerabin/camerabin.pro b/src/plugins/gstreamer/camerabin/camerabin.pro
index bba797f5e..111dbccf0 100644
--- a/src/plugins/gstreamer/camerabin/camerabin.pro
+++ b/src/plugins/gstreamer/camerabin/camerabin.pro
@@ -24,6 +24,7 @@ HEADERS += \
$$PWD/camerabinrecorder.h \
$$PWD/camerabincontainer.h \
$$PWD/camerabinimagecapture.h \
+ $$PWD/camerabinzoom.h \
$$PWD/camerabinimageprocessing.h \
$$PWD/camerabinmetadata.h \
$$PWD/camerabinvideoencoder.h \
@@ -31,6 +32,7 @@ HEADERS += \
$$PWD/camerabincapturedestination.h \
$$PWD/camerabincapturebufferformat.h \
$$PWD/camerabinviewfindersettings.h \
+ $$PWD/camerabinviewfindersettings2.h \
$$PWD/camerabininfocontrol.h
SOURCES += \
@@ -42,6 +44,7 @@ SOURCES += \
$$PWD/camerabincontainer.cpp \
$$PWD/camerabinimagecapture.cpp \
$$PWD/camerabinimageencoder.cpp \
+ $$PWD/camerabinzoom.cpp \
$$PWD/camerabinimageprocessing.cpp \
$$PWD/camerabinmetadata.cpp \
$$PWD/camerabinrecorder.cpp \
@@ -49,6 +52,7 @@ SOURCES += \
$$PWD/camerabinresourcepolicy.cpp \
$$PWD/camerabincapturedestination.cpp \
$$PWD/camerabinviewfindersettings.cpp \
+ $$PWD/camerabinviewfindersettings2.cpp \
$$PWD/camerabincapturebufferformat.cpp \
$$PWD/camerabininfocontrol.cpp
@@ -69,17 +73,15 @@ config_gstreamer_photography {
$$PWD/camerabinfocus.h \
$$PWD/camerabinexposure.h \
$$PWD/camerabinflash.h \
- $$PWD/camerabinlocks.h \
- $$PWD/camerabinzoom.h
+ $$PWD/camerabinlocks.h
SOURCES += \
$$PWD/camerabinexposure.cpp \
$$PWD/camerabinflash.cpp \
$$PWD/camerabinfocus.cpp \
- $$PWD/camerabinlocks.cpp \
- $$PWD/camerabinzoom.cpp
+ $$PWD/camerabinlocks.cpp
- LIBS += -lgstphotography-0.10
+ LIBS += -lgstphotography-$$GST_VERSION
DEFINES += GST_USE_UNSTABLE_API #prevents warnings because of unstable photography API
}
diff --git a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp
index 865a764a8..3a921ece0 100644
--- a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h
index f71436552..caa4b7523 100644
--- a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h
+++ b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp
index dd08ac2e2..116a93e11 100644
--- a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
index a303a8435..1e3ff761b 100644
--- a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
+++ b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp b/src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp
index e8304b721..924ba0a65 100644
--- a/src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturedestination.h b/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
index 90c5bfd9e..30972b525 100644
--- a/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
+++ b/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp b/src/plugins/gstreamer/camerabin/camerabincontainer.cpp
index ebb914b60..8c31d20cd 100644
--- a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabincontainer.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -96,7 +96,7 @@ GstEncodingContainerProfile *CameraBinContainer::createProfile()
GstCaps *caps;
if (m_actualFormat.isEmpty()) {
- caps = gst_caps_new_any();
+ return 0;
} else {
QString format = m_actualFormat;
QStringList supportedFormats = m_supportedContainers.supportedCodecs();
diff --git a/src/plugins/gstreamer/camerabin/camerabincontainer.h b/src/plugins/gstreamer/camerabin/camerabincontainer.h
index ba0fce5d6..2f5173388 100644
--- a/src/plugins/gstreamer/camerabin/camerabincontainer.h
+++ b/src/plugins/gstreamer/camerabin/camerabincontainer.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp b/src/plugins/gstreamer/camerabin/camerabincontrol.cpp
index 3ec992791..bc60d3a58 100644
--- a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabincontrol.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -51,11 +51,10 @@ CameraBinControl::CameraBinControl(CameraBinSession *session)
:QCameraControl(session),
m_session(session),
m_state(QCamera::UnloadedState),
- m_status(QCamera::UnloadedStatus),
m_reloadPending(false)
{
- connect(m_session, SIGNAL(stateChanged(QCamera::State)),
- this, SLOT(updateStatus()));
+ connect(m_session, SIGNAL(statusChanged(QCamera::Status)),
+ this, SIGNAL(statusChanged(QCamera::Status)));
connect(m_session, SIGNAL(viewfinderChanged()),
SLOT(reloadLater()));
@@ -95,11 +94,6 @@ void CameraBinControl::setCaptureMode(QCamera::CaptureModes mode)
captureMode() == QCamera::CaptureStillImage ?
CamerabinResourcePolicy::ImageCaptureResources :
CamerabinResourcePolicy::VideoCaptureResources);
-#if (GST_VERSION_MAJOR == 0) && ((GST_VERSION_MINOR < 10) || (GST_VERSION_MICRO < 23))
- //due to bug in v4l2src, it's necessary to reload camera on video caps changes
- //https://bugzilla.gnome.org/show_bug.cgi?id=649832
- reloadLater();
-#endif
}
emit captureModeChanged(mode);
}
@@ -121,7 +115,7 @@ void CameraBinControl::setState(QCamera::State state)
//special case for stopping the camera while it's busy,
//it should be delayed until the camera is idle
if (state == QCamera::LoadedState &&
- m_session->state() == QCamera::ActiveState &&
+ m_session->status() == QCamera::ActiveStatus &&
m_session->isBusy()) {
#ifdef CAMEABIN_DEBUG
qDebug() << Q_FUNC_INFO << "Camera is busy, QCamera::stop() is delayed";
@@ -170,52 +164,9 @@ QCamera::State CameraBinControl::state() const
return m_state;
}
-void CameraBinControl::updateStatus()
+QCamera::Status CameraBinControl::status() const
{
- QCamera::State sessionState = m_session->state();
- QCamera::Status oldStatus = m_status;
-
- switch (m_state) {
- case QCamera::UnloadedState:
- m_status = QCamera::UnloadedStatus;
- break;
- case QCamera::LoadedState:
- switch (sessionState) {
- case QCamera::UnloadedState:
- m_status = m_resourcePolicy->isResourcesGranted()
- ? QCamera::LoadingStatus
- : QCamera::UnavailableStatus;
- break;
- case QCamera::LoadedState:
- m_status = QCamera::LoadedStatus;
- break;
- case QCamera::ActiveState:
- m_status = QCamera::ActiveStatus;
- break;
- }
- break;
- case QCamera::ActiveState:
- switch (sessionState) {
- case QCamera::UnloadedState:
- m_status = m_resourcePolicy->isResourcesGranted()
- ? QCamera::LoadingStatus
- : QCamera::UnavailableStatus;
- break;
- case QCamera::LoadedState:
- m_status = QCamera::StartingStatus;
- break;
- case QCamera::ActiveState:
- m_status = QCamera::ActiveStatus;
- break;
- }
- }
-
- if (m_status != oldStatus) {
-#ifdef CAMEABIN_DEBUG
- qDebug() << "Camera status changed" << ENUM_NAME(QCamera, "Status", m_status);
-#endif
- emit statusChanged(m_status);
- }
+ return m_session->status();
}
void CameraBinControl::reloadLater()
@@ -259,7 +210,7 @@ void CameraBinControl::handleResourcesGranted()
void CameraBinControl::handleBusyChanged(bool busy)
{
- if (!busy && m_session->state() == QCamera::ActiveState) {
+ if (!busy && m_session->status() == QCamera::ActiveStatus) {
if (m_state == QCamera::LoadedState) {
//handle delayed stop() because of busy camera
m_resourcePolicy->setResourceSet(CamerabinResourcePolicy::LoadedResources);
@@ -298,13 +249,14 @@ bool CameraBinControl::canChangeProperty(PropertyChangeType changeType, QCamera:
Q_UNUSED(status);
switch (changeType) {
+ case QCameraControl::Viewfinder:
+ return true;
case QCameraControl::CaptureMode:
case QCameraControl::ImageEncodingSettings:
case QCameraControl::VideoEncodingSettings:
- case QCameraControl::Viewfinder:
- return true;
+ case QCameraControl::ViewfinderSettings:
default:
- return false;
+ return status != QCamera::ActiveStatus;
}
}
diff --git a/src/plugins/gstreamer/camerabin/camerabincontrol.h b/src/plugins/gstreamer/camerabin/camerabincontrol.h
index 57f3131c1..6a6b47d50 100644
--- a/src/plugins/gstreamer/camerabin/camerabincontrol.h
+++ b/src/plugins/gstreamer/camerabin/camerabincontrol.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -56,7 +56,7 @@ public:
QCamera::State state() const;
void setState(QCamera::State state);
- QCamera::Status status() const { return m_status; }
+ QCamera::Status status() const;
QCamera::CaptureModes captureMode() const;
void setCaptureMode(QCamera::CaptureModes mode);
@@ -72,7 +72,6 @@ public slots:
void setViewfinderColorSpaceConversion(bool enabled);
private slots:
- void updateStatus();
void delayedReload();
void handleResourcesGranted();
@@ -86,7 +85,6 @@ private:
CameraBinSession *m_session;
QCamera::State m_state;
- QCamera::Status m_status;
CamerabinResourcePolicy *m_resourcePolicy;
bool m_reloadPending;
diff --git a/src/plugins/gstreamer/camerabin/camerabinexposure.cpp b/src/plugins/gstreamer/camerabin/camerabinexposure.cpp
index a235de2f2..22b9a8ae8 100644
--- a/src/plugins/gstreamer/camerabin/camerabinexposure.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinexposure.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,6 +37,10 @@
#include <QDebug>
+#if !GST_CHECK_VERSION(1,0,0)
+typedef GstSceneMode GstPhotographySceneMode;
+#endif
+
QT_BEGIN_NAMESPACE
CameraBinExposure::CameraBinExposure(CameraBinSession *session)
@@ -119,25 +123,49 @@ QVariant CameraBinExposure::actualValue(ExposureParameter parameter) const
}
case QCameraExposureControl::ExposureMode:
{
- GstSceneMode sceneMode;
+ GstPhotographySceneMode sceneMode;
gst_photography_get_scene_mode(m_session->photography(), &sceneMode);
switch (sceneMode) {
case GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT:
- return QCameraExposure::ExposurePortrait;
+ return QVariant::fromValue(QCameraExposure::ExposurePortrait);
case GST_PHOTOGRAPHY_SCENE_MODE_SPORT:
- return QCameraExposure::ExposureSports;
+ return QVariant::fromValue(QCameraExposure::ExposureSports);
case GST_PHOTOGRAPHY_SCENE_MODE_NIGHT:
- return QCameraExposure::ExposureNight;
+ return QVariant::fromValue(QCameraExposure::ExposureNight);
case GST_PHOTOGRAPHY_SCENE_MODE_MANUAL:
- return QCameraExposure::ExposureManual;
- case GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP:
- //no direct mapping available so mapping to auto mode
+ return QVariant::fromValue(QCameraExposure::ExposureManual);
case GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE:
- //no direct mapping available so mapping to auto mode
+ return QVariant::fromValue(QCameraExposure::ExposureLandscape);
+#if GST_CHECK_VERSION(1, 2, 0)
+ case GST_PHOTOGRAPHY_SCENE_MODE_SNOW:
+ return QVariant::fromValue(QCameraExposure::ExposureSnow);
+ case GST_PHOTOGRAPHY_SCENE_MODE_BEACH:
+ return QVariant::fromValue(QCameraExposure::ExposureBeach);
+ case GST_PHOTOGRAPHY_SCENE_MODE_ACTION:
+ return QVariant::fromValue(QCameraExposure::ExposureAction);
+ case GST_PHOTOGRAPHY_SCENE_MODE_NIGHT_PORTRAIT:
+ return QVariant::fromValue(QCameraExposure::ExposureNightPortrait);
+ case GST_PHOTOGRAPHY_SCENE_MODE_THEATRE:
+ return QVariant::fromValue(QCameraExposure::ExposureTheatre);
+ case GST_PHOTOGRAPHY_SCENE_MODE_SUNSET:
+ return QVariant::fromValue(QCameraExposure::ExposureSunset);
+ case GST_PHOTOGRAPHY_SCENE_MODE_STEADY_PHOTO:
+ return QVariant::fromValue(QCameraExposure::ExposureSteadyPhoto);
+ case GST_PHOTOGRAPHY_SCENE_MODE_FIREWORKS:
+ return QVariant::fromValue(QCameraExposure::ExposureFireworks);
+ case GST_PHOTOGRAPHY_SCENE_MODE_PARTY:
+ return QVariant::fromValue(QCameraExposure::ExposureParty);
+ case GST_PHOTOGRAPHY_SCENE_MODE_CANDLELIGHT:
+ return QVariant::fromValue(QCameraExposure::ExposureCandlelight);
+ case GST_PHOTOGRAPHY_SCENE_MODE_BARCODE:
+ return QVariant::fromValue(QCameraExposure::ExposureBarcode);
+#endif
+ //no direct mapping available so mapping to auto mode
+ case GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP:
case GST_PHOTOGRAPHY_SCENE_MODE_AUTO:
default:
- return QCameraExposure::ExposureAuto;
+ return QVariant::fromValue(QCameraExposure::ExposureAuto);
}
}
case QCameraExposureControl::MeteringMode:
@@ -166,8 +194,9 @@ bool CameraBinExposure::setValue(ExposureParameter parameter, const QVariant& va
break;
case QCameraExposureControl::ExposureMode:
{
- QCameraExposure::ExposureMode mode = QCameraExposure::ExposureMode(value.toInt());
- GstSceneMode sceneMode;
+ QCameraExposure::ExposureMode mode = value.value<QCameraExposure::ExposureMode>();
+ GstPhotographySceneMode sceneMode;
+
gst_photography_get_scene_mode(m_session->photography(), &sceneMode);
switch (mode) {
@@ -186,6 +215,44 @@ bool CameraBinExposure::setValue(ExposureParameter parameter, const QVariant& va
case QCameraExposure::ExposureAuto:
sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_AUTO;
break;
+ case QCameraExposure::ExposureLandscape:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE;
+ break;
+#if GST_CHECK_VERSION(1, 2, 0)
+ case QCameraExposure::ExposureSnow:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SNOW;
+ break;
+ case QCameraExposure::ExposureBeach:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_BEACH;
+ break;
+ case QCameraExposure::ExposureAction:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_ACTION;
+ break;
+ case QCameraExposure::ExposureNightPortrait:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_NIGHT_PORTRAIT;
+ break;
+ case QCameraExposure::ExposureTheatre:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_THEATRE;
+ break;
+ case QCameraExposure::ExposureSunset:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SUNSET;
+ break;
+ case QCameraExposure::ExposureSteadyPhoto:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_STEADY_PHOTO;
+ break;
+ case QCameraExposure::ExposureFireworks:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_FIREWORKS;
+ break;
+ case QCameraExposure::ExposureParty:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_PARTY;
+ break;
+ case QCameraExposure::ExposureCandlelight:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_CANDLELIGHT;
+ break;
+ case QCameraExposure::ExposureBarcode:
+ sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_BARCODE;
+ break;
+#endif
default:
break;
}
diff --git a/src/plugins/gstreamer/camerabin/camerabinexposure.h b/src/plugins/gstreamer/camerabin/camerabinexposure.h
index dcdc76a8e..1e3170174 100644
--- a/src/plugins/gstreamer/camerabin/camerabinexposure.h
+++ b/src/plugins/gstreamer/camerabin/camerabinexposure.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinflash.cpp b/src/plugins/gstreamer/camerabin/camerabinflash.cpp
index 2140f6684..bb91e55c6 100644
--- a/src/plugins/gstreamer/camerabin/camerabinflash.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinflash.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,6 +37,10 @@
#include <QDebug>
+#if !GST_CHECK_VERSION(1,0,0)
+typedef GstFlashMode GstPhotographyFlashMode;
+#endif
+
QT_BEGIN_NAMESPACE
CameraBinFlash::CameraBinFlash(CameraBinSession *session)
@@ -51,7 +55,7 @@ CameraBinFlash::~CameraBinFlash()
QCameraExposure::FlashModes CameraBinFlash::flashMode() const
{
- GstFlashMode flashMode;
+ GstPhotographyFlashMode flashMode;
gst_photography_get_flash_mode(m_session->photography(), &flashMode);
QCameraExposure::FlashModes modes;
@@ -70,7 +74,7 @@ QCameraExposure::FlashModes CameraBinFlash::flashMode() const
void CameraBinFlash::setFlashMode(QCameraExposure::FlashModes mode)
{
- GstFlashMode flashMode;
+ GstPhotographyFlashMode flashMode;
gst_photography_get_flash_mode(m_session->photography(), &flashMode);
if (mode.testFlag(QCameraExposure::FlashAuto)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_AUTO;
diff --git a/src/plugins/gstreamer/camerabin/camerabinflash.h b/src/plugins/gstreamer/camerabin/camerabinflash.h
index e29f7b2fc..c29df6505 100644
--- a/src/plugins/gstreamer/camerabin/camerabinflash.h
+++ b/src/plugins/gstreamer/camerabin/camerabinflash.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinfocus.cpp b/src/plugins/gstreamer/camerabin/camerabinfocus.cpp
index 665e20443..32b8d9454 100644
--- a/src/plugins/gstreamer/camerabin/camerabinfocus.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinfocus.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,16 +37,26 @@
#include <gst/interfaces/photography.h>
#include <QDebug>
+#include <QtCore/qcoreevent.h>
#include <QtCore/qmetaobject.h>
+#include <private/qgstutils_p.h>
+
+#if !GST_CHECK_VERSION(1,0,0)
+typedef GstFocusMode GstPhotographyFocusMode;
+#endif
+
//#define CAMERABIN_DEBUG 1
QT_BEGIN_NAMESPACE
CameraBinFocus::CameraBinFocus(CameraBinSession *session)
:QCameraFocusControl(session),
+#if GST_CHECK_VERSION(1,0,0)
+ QGstreamerBufferProbe(ProbeBuffers),
+#endif
m_session(session),
- m_cameraState(QCamera::UnloadedState),
+ m_cameraStatus(QCamera::UnloadedStatus),
m_focusMode(QCameraFocus::AutoFocus),
m_focusPointMode(QCameraFocus::FocusPointAuto),
m_focusStatus(QCamera::Unlocked),
@@ -58,8 +68,8 @@ CameraBinFocus::CameraBinFocus(CameraBinSession *session)
gst_photography_set_focus_mode(m_session->photography(), GST_PHOTOGRAPHY_FOCUS_MODE_AUTO);
- connect(m_session, SIGNAL(stateChanged(QCamera::State)),
- this, SLOT(_q_handleCameraStateChange(QCamera::State)));
+ connect(m_session, SIGNAL(statusChanged(QCamera::Status)),
+ this, SLOT(_q_handleCameraStatusChange(QCamera::Status)));
}
CameraBinFocus::~CameraBinFocus()
@@ -73,7 +83,7 @@ QCameraFocus::FocusModes CameraBinFocus::focusMode() const
void CameraBinFocus::setFocusMode(QCameraFocus::FocusModes mode)
{
- GstFocusMode photographyMode;
+ GstPhotographyFocusMode photographyMode;
switch (mode) {
case QCameraFocus::AutoFocus:
@@ -125,22 +135,72 @@ QCameraFocus::FocusPointMode CameraBinFocus::focusPointMode() const
void CameraBinFocus::setFocusPointMode(QCameraFocus::FocusPointMode mode)
{
- Q_UNUSED(mode);
- if (m_focusPointMode != mode
- && (mode == QCameraFocus::FocusPointAuto || mode == QCameraFocus::FocusPointCustom)) {
- m_focusPointMode = mode;
+ GstElement *source = m_session->cameraSource();
+
+ if (m_focusPointMode == mode || !source)
+ return;
- if (m_focusPointMode == QCameraFocus::FocusPointAuto)
- resetFocusPoint();
+#if GST_CHECK_VERSION(1,0,0)
+ if (m_focusPointMode == QCameraFocus::FocusPointFaceDetection) {
+ g_object_set (G_OBJECT(source), "detect-faces", FALSE, NULL);
+
+ if (GstPad *pad = gst_element_get_static_pad(source, "vfsrc")) {
+ removeProbeFromPad(pad);
+ gst_object_unref(GST_OBJECT(pad));
+ }
+
+ m_faceResetTimer.stop();
+ m_faceFocusRects.clear();
+
+ QMutexLocker locker(&m_mutex);
+ m_faces.clear();
+ }
+#endif
- emit focusPointModeChanged(m_focusPointMode);
+ if (m_focusPointMode != QCameraFocus::FocusPointAuto)
+ resetFocusPoint();
+ switch (mode) {
+ case QCameraFocus::FocusPointAuto:
+ case QCameraFocus::FocusPointCustom:
+ break;
+#if GST_CHECK_VERSION(1,0,0)
+ case QCameraFocus::FocusPointFaceDetection:
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "detect-faces")) {
+ if (GstPad *pad = gst_element_get_static_pad(source, "vfsrc")) {
+ addProbeToPad(pad);
+ g_object_set (G_OBJECT(source), "detect-faces", TRUE, NULL);
+ break;
+ }
+ }
+ return;
+#endif
+ default:
+ return;
}
+
+ m_focusPointMode = mode;
+ emit focusPointModeChanged(m_focusPointMode);
+ emit focusZonesChanged();
}
bool CameraBinFocus::isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const
{
return mode == QCameraFocus::FocusPointAuto || mode == QCameraFocus::FocusPointCustom;
+
+ switch (mode) {
+ case QCameraFocus::FocusPointAuto:
+ case QCameraFocus::FocusPointCustom:
+ return true;
+#if GST_CHECK_VERSION(1,0,0)
+ case QCameraFocus::FocusPointFaceDetection:
+ if (GstElement *source = m_session->cameraSource())
+ return g_object_class_find_property(G_OBJECT_GET_CLASS(source), "detect-faces");
+ return false;
+#endif
+ default:
+ return false;
+ }
}
QPointF CameraBinFocus::customFocusPoint() const
@@ -161,7 +221,7 @@ void CameraBinFocus::setCustomFocusPoint(const QPointF &point)
const QRectF focusRect = m_focusRect;
m_focusRect.moveCenter(m_focusPoint);
- updateRegionOfInterest(m_focusRect, 1);
+ updateRegionOfInterest(m_focusRect);
if (focusRect != m_focusRect) {
emit focusZonesChanged();
@@ -174,16 +234,30 @@ void CameraBinFocus::setCustomFocusPoint(const QPointF &point)
QCameraFocusZoneList CameraBinFocus::focusZones() const
{
- return QCameraFocusZoneList() << QCameraFocusZone(m_focusRect, m_focusZoneStatus);
+ QCameraFocusZoneList zones;
+
+ if (m_focusPointMode != QCameraFocus::FocusPointFaceDetection) {
+ zones.append(QCameraFocusZone(m_focusRect, m_focusZoneStatus));
+#if GST_CHECK_VERSION(1,0,0)
+ } else foreach (const QRect &face, m_faceFocusRects) {
+ const QRectF normalizedRect(
+ face.x() / qreal(m_viewfinderResolution.width()),
+ face.y() / qreal(m_viewfinderResolution.height()),
+ face.width() / qreal(m_viewfinderResolution.width()),
+ face.height() / qreal(m_viewfinderResolution.height()));
+ zones.append(QCameraFocusZone(normalizedRect, m_focusZoneStatus));
+#endif
+ }
+ return zones;
}
-
void CameraBinFocus::handleFocusMessage(GstMessage *gm)
{
//it's a sync message, so it's called from non main thread
- if (gst_structure_has_name(gm->structure, GST_PHOTOGRAPHY_AUTOFOCUS_DONE)) {
+ const GstStructure *structure = gst_message_get_structure(gm);
+ if (gst_structure_has_name(structure, GST_PHOTOGRAPHY_AUTOFOCUS_DONE)) {
gint status = GST_PHOTOGRAPHY_FOCUS_STATUS_NONE;
- gst_structure_get_int (gm->structure, "status", &status);
+ gst_structure_get_int (structure, "status", &status);
QCamera::LockStatus focusStatus = m_focusStatus;
QCamera::LockChangeReason reason = QCamera::UserRequest;
@@ -234,16 +308,23 @@ void CameraBinFocus::_q_setFocusStatus(QCamera::LockStatus status, QCamera::Lock
emit focusZonesChanged();
}
+#if GST_CHECK_VERSION(1,0,0)
+ if (m_focusPointMode == QCameraFocus::FocusPointFaceDetection
+ && m_focusStatus == QCamera::Unlocked) {
+ _q_updateFaces();
+ }
+#endif
+
emit _q_focusStatusChanged(m_focusStatus, reason);
}
}
-void CameraBinFocus::_q_handleCameraStateChange(QCamera::State state)
+void CameraBinFocus::_q_handleCameraStatusChange(QCamera::Status status)
{
- m_cameraState = state;
- if (state == QCamera::ActiveState) {
+ m_cameraStatus = status;
+ if (status == QCamera::ActiveStatus) {
if (GstPad *pad = gst_element_get_static_pad(m_session->cameraSource(), "vfsrc")) {
- if (GstCaps *caps = gst_pad_get_negotiated_caps(pad)) {
+ if (GstCaps *caps = qt_gst_pad_get_current_caps(pad)) {
if (GstStructure *structure = gst_caps_get_structure(caps, 0)) {
int width = 0;
int height = 0;
@@ -256,7 +337,7 @@ void CameraBinFocus::_q_handleCameraStateChange(QCamera::State state)
gst_object_unref(GST_OBJECT(pad));
}
if (m_focusPointMode == QCameraFocus::FocusPointCustom) {
- updateRegionOfInterest(m_focusRect, 1);
+ updateRegionOfInterest(m_focusRect);
}
} else {
_q_setFocusStatus(QCamera::Unlocked, QCamera::LockLost);
@@ -295,7 +376,7 @@ void CameraBinFocus::resetFocusPoint()
m_focusPoint = QPointF(0.5, 0.5);
m_focusRect.moveCenter(m_focusPoint);
- updateRegionOfInterest(QRectF(0, 0, 0, 0), 0);
+ updateRegionOfInterest(QVector<QRect>());
if (focusRect != m_focusRect) {
emit customFocusPointChanged(m_focusPoint);
@@ -303,21 +384,14 @@ void CameraBinFocus::resetFocusPoint()
}
}
-void CameraBinFocus::updateRegionOfInterest(const QRectF &focusRect, int priority)
+static void appendRegion(GValue *regions, int priority, const QRect &rectangle)
{
- if (m_cameraState != QCamera::ActiveState)
- return;
-
- GstElement * const cameraSource = m_session->cameraSource();
- if (!cameraSource)
- return;
-
GstStructure *region = gst_structure_new(
"region",
- "region-x" , G_TYPE_UINT , uint(m_viewfinderResolution.width() * focusRect.x()),
- "region-y" , G_TYPE_UINT, uint(m_viewfinderResolution.height() * focusRect.y()),
- "region-w" , G_TYPE_UINT , uint(m_viewfinderResolution.width() * focusRect.width()),
- "region-h" , G_TYPE_UINT, uint(m_viewfinderResolution.height() * focusRect.height()),
+ "region-x" , G_TYPE_UINT , rectangle.x(),
+ "region-y" , G_TYPE_UINT, rectangle.y(),
+ "region-w" , G_TYPE_UINT , rectangle.width(),
+ "region-h" , G_TYPE_UINT, rectangle.height(),
"region-priority" , G_TYPE_UINT, priority,
NULL);
@@ -326,10 +400,51 @@ void CameraBinFocus::updateRegionOfInterest(const QRectF &focusRect, int priorit
gst_value_set_structure(&regionValue, region);
gst_structure_free(region);
+ gst_value_list_append_value(regions, &regionValue);
+ g_value_unset(&regionValue);
+}
+
+void CameraBinFocus::updateRegionOfInterest(const QRectF &rectangle)
+{
+ updateRegionOfInterest(QVector<QRect>() << QRect(
+ rectangle.x() * m_viewfinderResolution.width(),
+ rectangle.y() * m_viewfinderResolution.height(),
+ rectangle.width() * m_viewfinderResolution.width(),
+ rectangle.height() * m_viewfinderResolution.height()));
+}
+
+void CameraBinFocus::updateRegionOfInterest(const QVector<QRect> &rectangles)
+{
+ if (m_cameraStatus != QCamera::ActiveStatus)
+ return;
+
+ GstElement * const cameraSource = m_session->cameraSource();
+ if (!cameraSource)
+ return;
+
GValue regions = G_VALUE_INIT;
g_value_init(&regions, GST_TYPE_LIST);
- gst_value_list_append_value(&regions, &regionValue);
- g_value_unset(&regionValue);
+
+ if (rectangles.isEmpty()) {
+ appendRegion(&regions, 0, QRect(0, 0, 0, 0));
+ } else {
+ // Add padding around small face rectangles so the auto focus has a reasonable amount
+ // of image to work with.
+ const int minimumDimension = qMin(
+ m_viewfinderResolution.width(), m_viewfinderResolution.height()) * 0.3;
+ const QRect viewfinderRectangle(QPoint(0, 0), m_viewfinderResolution);
+
+ foreach (const QRect &rectangle, rectangles) {
+ QRect paddedRectangle(
+ 0,
+ 0,
+ qMax(rectangle.width(), minimumDimension),
+ qMax(rectangle.height(), minimumDimension));
+ paddedRectangle.moveCenter(rectangle.center());
+
+ appendRegion(&regions, 1, viewfinderRectangle.intersected(paddedRectangle));
+ }
+ }
GstStructure *regionsOfInterest = gst_structure_new(
"regions-of-interest",
@@ -343,4 +458,75 @@ void CameraBinFocus::updateRegionOfInterest(const QRectF &focusRect, int priorit
gst_element_send_event(cameraSource, event);
}
+#if GST_CHECK_VERSION(1,0,0)
+
+void CameraBinFocus::_q_updateFaces()
+{
+ if (m_focusPointMode != QCameraFocus::FocusPointFaceDetection
+ || m_focusStatus != QCamera::Unlocked) {
+ return;
+ }
+
+ QVector<QRect> faces;
+
+ {
+ QMutexLocker locker(&m_mutex);
+ faces = m_faces;
+ }
+
+ if (!faces.isEmpty()) {
+ m_faceResetTimer.stop();
+ m_faceFocusRects = faces;
+ updateRegionOfInterest(m_faceFocusRects);
+ emit focusZonesChanged();
+ } else {
+ m_faceResetTimer.start(500, this);
+ }
+}
+
+void CameraBinFocus::timerEvent(QTimerEvent *event)
+{
+ if (event->timerId() == m_faceResetTimer.timerId()) {
+ m_faceResetTimer.stop();
+
+ if (m_focusStatus == QCamera::Unlocked) {
+ m_faceFocusRects.clear();
+ updateRegionOfInterest(m_faceFocusRects);
+ emit focusZonesChanged();
+ }
+ } else {
+ QCameraFocusControl::timerEvent(event);
+ }
+}
+
+bool CameraBinFocus::probeBuffer(GstBuffer *buffer)
+{
+ QVector<QRect> faces;
+
+ gpointer state = NULL;
+ const GstMetaInfo *info = GST_VIDEO_REGION_OF_INTEREST_META_INFO;
+
+ while (GstMeta *meta = gst_buffer_iterate_meta(buffer, &state)) {
+ if (meta->info->api != info->api)
+ continue;
+
+ GstVideoRegionOfInterestMeta *region = reinterpret_cast<GstVideoRegionOfInterestMeta *>(meta);
+
+ faces.append(QRect(region->x, region->y, region->w, region->h));
+ }
+
+ QMutexLocker locker(&m_mutex);
+
+ if (m_faces != faces) {
+ m_faces = faces;
+
+ static const int signalIndex = metaObject()->indexOfSlot("_q_updateFaces()");
+ metaObject()->method(signalIndex).invoke(this, Qt::QueuedConnection);
+ }
+
+ return true;
+}
+
+#endif
+
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinfocus.h b/src/plugins/gstreamer/camerabin/camerabinfocus.h
index 1ac013789..667e6b679 100644
--- a/src/plugins/gstreamer/camerabin/camerabinfocus.h
+++ b/src/plugins/gstreamer/camerabin/camerabinfocus.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,6 +37,12 @@
#include <qcamera.h>
#include <qcamerafocuscontrol.h>
+#include <private/qgstreamerbufferprobe_p.h>
+
+#include <qbasictimer.h>
+#include <qmutex.h>
+#include <qvector.h>
+
#include <gst/gst.h>
#include <glib.h>
@@ -44,7 +50,11 @@ QT_BEGIN_NAMESPACE
class CameraBinSession;
-class CameraBinFocus : public QCameraFocusControl
+class CameraBinFocus
+ : public QCameraFocusControl
+#if GST_CHECK_VERSION(1,0,0)
+ , QGstreamerBufferProbe
+#endif
{
Q_OBJECT
@@ -76,16 +86,30 @@ public Q_SLOTS:
void setViewfinderResolution(const QSize &resolution);
+#if GST_CHECK_VERSION(1,0,0)
+protected:
+ void timerEvent(QTimerEvent *event);
+#endif
+
private Q_SLOTS:
void _q_setFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason);
- void _q_handleCameraStateChange(QCamera::State state);
+ void _q_handleCameraStatusChange(QCamera::Status status);
+
+#if GST_CHECK_VERSION(1,0,0)
+ void _q_updateFaces();
+#endif
private:
void resetFocusPoint();
- void updateRegionOfInterest(const QRectF &focusRect, int priority);
+ void updateRegionOfInterest(const QRectF &rectangle);
+ void updateRegionOfInterest(const QVector<QRect> &rectangles);
+
+#if GST_CHECK_VERSION(1,0,0)
+ bool probeBuffer(GstBuffer *buffer);
+#endif
CameraBinSession *m_session;
- QCamera::State m_cameraState;
+ QCamera::Status m_cameraStatus;
QCameraFocus::FocusModes m_focusMode;
QCameraFocus::FocusPointMode m_focusPointMode;
QCamera::LockStatus m_focusStatus;
@@ -93,6 +117,10 @@ private:
QPointF m_focusPoint;
QRectF m_focusRect;
QSize m_viewfinderResolution;
+ QVector<QRect> m_faces;
+ QVector<QRect> m_faceFocusRects;
+ QBasicTimer m_faceResetTimer;
+ mutable QMutex m_mutex;
};
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp b/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp
index 695215592..2cf14ea3f 100644
--- a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -53,13 +53,15 @@ QT_BEGIN_NAMESPACE
CameraBinImageCapture::CameraBinImageCapture(CameraBinSession *session)
:QCameraImageCaptureControl(session)
+ , m_encoderProbe(this)
+ , m_muxerProbe(this)
, m_session(session)
- , m_ready(false)
- , m_requestId(0)
, m_jpegEncoderElement(0)
, m_metadataMuxerElement(0)
+ , m_requestId(0)
+ , m_ready(false)
{
- connect(m_session, SIGNAL(stateChanged(QCamera::State)), SLOT(updateState()));
+ connect(m_session, SIGNAL(statusChanged(QCamera::Status)), SLOT(updateState()));
connect(m_session, SIGNAL(imageExposed(int)), this, SIGNAL(imageExposed(int)));
connect(m_session, SIGNAL(imageCaptured(int,QImage)), this, SIGNAL(imageCaptured(int,QImage)));
connect(m_session->cameraControl()->resourcePolicy(), SIGNAL(canCaptureChanged()), this, SLOT(updateState()));
@@ -98,7 +100,7 @@ void CameraBinImageCapture::cancelCapture()
void CameraBinImageCapture::updateState()
{
- bool ready = m_session->state() == QCamera::ActiveState
+ bool ready = m_session->status() == QCamera::ActiveStatus
&& m_session->cameraControl()->resourcePolicy()->canCapture();
if (m_ready != ready) {
#ifdef DEBUG_CAPTURE
@@ -108,11 +110,18 @@ void CameraBinImageCapture::updateState()
}
}
-gboolean CameraBinImageCapture::metadataEventProbe(GstPad *pad, GstEvent *event, CameraBinImageCapture *self)
+#if GST_CHECK_VERSION(1,0,0)
+GstPadProbeReturn CameraBinImageCapture::encoderEventProbe(
+ GstPad *, GstPadProbeInfo *info, gpointer user_data)
{
- Q_UNUSED(pad);
-
- if (GST_EVENT_TYPE(event) == GST_EVENT_TAG) {
+ GstEvent * const event = gst_pad_probe_info_get_event(info);
+#else
+gboolean CameraBinImageCapture::encoderEventProbe(
+ GstElement *, GstEvent *event, gpointer user_data)
+{
+#endif
+ CameraBinImageCapture * const self = static_cast<CameraBinImageCapture *>(user_data);
+ if (event && GST_EVENT_TYPE(event) == GST_EVENT_TAG) {
GstTagList *gstTags;
gst_event_parse_tag(event, &gstTags);
QMap<QByteArray, QVariant> extendedTags = QGstUtils::gstTagListToMap(gstTags);
@@ -146,17 +155,31 @@ gboolean CameraBinImageCapture::metadataEventProbe(GstPad *pad, GstEvent *event,
}
}
}
+#if GST_CHECK_VERSION(1,0,0)
+ return GST_PAD_PROBE_OK;
+#else
+ return TRUE;
+#endif
+}
- return true;
+void CameraBinImageCapture::EncoderProbe::probeCaps(GstCaps *caps)
+{
+#if GST_CHECK_VERSION(1,0,0)
+ capture->m_bufferFormat = QGstUtils::formatForCaps(caps, &capture->m_videoInfo);
+#else
+ int bytesPerLine = 0;
+ QVideoSurfaceFormat format = QGstUtils::formatForCaps(caps, &bytesPerLine);
+ capture->m_bytesPerLine = bytesPerLine;
+ capture->m_bufferFormat = format;
+#endif
}
-gboolean CameraBinImageCapture::uncompressedBufferProbe(GstPad *pad, GstBuffer *buffer, CameraBinImageCapture *self)
+bool CameraBinImageCapture::EncoderProbe::probeBuffer(GstBuffer *buffer)
{
- Q_UNUSED(pad);
- CameraBinSession *session = self->m_session;
+ CameraBinSession * const session = capture->m_session;
#ifdef DEBUG_CAPTURE
- qDebug() << "Uncompressed buffer probe" << gst_caps_to_string(GST_BUFFER_CAPS(buffer));
+ qDebug() << "Uncompressed buffer probe";
#endif
QCameraImageCapture::CaptureDestinations destination =
@@ -165,21 +188,23 @@ gboolean CameraBinImageCapture::uncompressedBufferProbe(GstPad *pad, GstBuffer *
if (destination & QCameraImageCapture::CaptureToBuffer) {
if (format != QVideoFrame::Format_Jpeg) {
- GstCaps *caps = GST_BUFFER_CAPS(buffer);
- int bytesPerLine = -1;
- QVideoSurfaceFormat format = QVideoSurfaceGstSink::formatForCaps(caps, &bytesPerLine);
#ifdef DEBUG_CAPTURE
qDebug() << "imageAvailable(uncompressed):" << format;
#endif
- QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, bytesPerLine);
+#if GST_CHECK_VERSION(1,0,0)
+ QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, capture->m_videoInfo);
+#else
+ QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, capture->m_bytesPerLine);
+#endif
- QVideoFrame frame(videoBuffer,
- format.frameSize(),
- format.pixelFormat());
+ QVideoFrame frame(
+ videoBuffer,
+ capture->m_bufferFormat.frameSize(),
+ capture->m_bufferFormat.pixelFormat());
- QMetaObject::invokeMethod(self, "imageAvailable",
+ QMetaObject::invokeMethod(capture, "imageAvailable",
Qt::QueuedConnection,
- Q_ARG(int, self->m_requestId),
+ Q_ARG(int, capture->m_requestId),
Q_ARG(QVideoFrame, frame));
}
}
@@ -192,25 +217,40 @@ gboolean CameraBinImageCapture::uncompressedBufferProbe(GstPad *pad, GstBuffer *
return keepBuffer;
}
-gboolean CameraBinImageCapture::jpegBufferProbe(GstPad *pad, GstBuffer *buffer, CameraBinImageCapture *self)
+void CameraBinImageCapture::MuxerProbe::probeCaps(GstCaps *caps)
{
- Q_UNUSED(pad);
- CameraBinSession *session = self->m_session;
+ capture->m_jpegResolution = QGstUtils::capsCorrectedResolution(caps);
+}
-#ifdef DEBUG_CAPTURE
- qDebug() << "Jpeg buffer probe" << gst_caps_to_string(GST_BUFFER_CAPS(buffer));
-#endif
+bool CameraBinImageCapture::MuxerProbe::probeBuffer(GstBuffer *buffer)
+{
+ CameraBinSession * const session = capture->m_session;
QCameraImageCapture::CaptureDestinations destination =
session->captureDestinationControl()->captureDestination();
if ((destination & QCameraImageCapture::CaptureToBuffer) &&
session->captureBufferFormatControl()->bufferFormat() == QVideoFrame::Format_Jpeg) {
- QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer,
- -1); //bytesPerLine is not available for jpegs
- QSize resolution = QGstUtils::capsCorrectedResolution(GST_BUFFER_CAPS(buffer));
+ QSize resolution = capture->m_jpegResolution;
//if resolution is not presented in caps, try to find it from encoded jpeg data:
+#if GST_CHECK_VERSION(1,0,0)
+ GstMapInfo mapInfo;
+ if (resolution.isEmpty() && gst_buffer_map(buffer, &mapInfo, GST_MAP_READ)) {
+ QBuffer data;
+ data.setData(reinterpret_cast<const char*>(mapInfo.data), mapInfo.size);
+
+ QImageReader reader(&data, "JPEG");
+ resolution = reader.size();
+
+ gst_buffer_unmap(buffer, &mapInfo);
+ }
+
+ GstVideoInfo info;
+ gst_video_info_set_format(
+ &info, GST_VIDEO_FORMAT_ENCODED, resolution.width(), resolution.height());
+ QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, info);
+#else
if (resolution.isEmpty()) {
QBuffer data;
data.setData(reinterpret_cast<const char*>(GST_BUFFER_DATA(buffer)), GST_BUFFER_SIZE(buffer));
@@ -218,20 +258,28 @@ gboolean CameraBinImageCapture::jpegBufferProbe(GstPad *pad, GstBuffer *buffer,
resolution = reader.size();
}
+ QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer,
+ -1); //bytesPerLine is not available for jpegs
+#endif
+
+
QVideoFrame frame(videoBuffer,
resolution,
QVideoFrame::Format_Jpeg);
-
- QMetaObject::invokeMethod(self, "imageAvailable",
+ QMetaObject::invokeMethod(capture, "imageAvailable",
Qt::QueuedConnection,
- Q_ARG(int, self->m_requestId),
+ Q_ARG(int, capture->m_requestId),
Q_ARG(QVideoFrame, frame));
}
- //drop the buffer if capture to file was disabled
- return destination & QCameraImageCapture::CaptureToFile;
+
+ // Theoretically we could drop the buffer here when don't want to capture to file but that
+ // prevents camerabin from recognizing that capture has been completed and returning
+ // to its idle state.
+ return true;
}
+
bool CameraBinImageCapture::processBusMessage(const QGstreamerMessage &message)
{
//Install metadata event and buffer probes
@@ -252,9 +300,10 @@ bool CameraBinImageCapture::processBusMessage(const QGstreamerMessage &message)
return false;
QString elementName = QString::fromLatin1(gst_element_get_name(element));
+#if !GST_CHECK_VERSION(1,0,0)
GstElementClass *elementClass = GST_ELEMENT_GET_CLASS(element);
QString elementLongName = elementClass->details.longname;
-
+#endif
if (elementName.contains("jpegenc") && element != m_jpegEncoderElement) {
m_jpegEncoderElement = element;
GstPad *sinkpad = gst_element_get_static_pad(element, "sink");
@@ -264,21 +313,23 @@ bool CameraBinImageCapture::processBusMessage(const QGstreamerMessage &message)
#ifdef DEBUG_CAPTURE
qDebug() << "install metadata probe";
#endif
- gst_pad_add_event_probe(sinkpad,
- G_CALLBACK(CameraBinImageCapture::metadataEventProbe),
- this);
-
+#if GST_CHECK_VERSION(1,0,0)
+ gst_pad_add_probe(
+ sinkpad, GST_PAD_PROBE_TYPE_EVENT_DOWNSTREAM, encoderEventProbe, this, NULL);
+#else
+ gst_pad_add_event_probe(sinkpad, G_CALLBACK(encoderEventProbe), this);
+#endif
#ifdef DEBUG_CAPTURE
qDebug() << "install uncompressed buffer probe";
#endif
- gst_pad_add_buffer_probe(sinkpad,
- G_CALLBACK(CameraBinImageCapture::uncompressedBufferProbe),
- this);
+ m_encoderProbe.addProbeToPad(sinkpad, true);
gst_object_unref(sinkpad);
- } else if ((elementName.contains("jifmux") ||
- elementName.startsWith("metadatamux") ||
- elementLongName == QLatin1String("JPEG stream muxer"))
+ } else if ((elementName.contains("jifmux")
+#if !GST_CHECK_VERSION(1,0,0)
+ || elementLongName == QLatin1String("JPEG stream muxer")
+#endif
+ || elementName.startsWith("metadatamux"))
&& element != m_metadataMuxerElement) {
//Jpeg encoded buffer probe is added after jifmux/metadatamux
//element to ensure the resulting jpeg buffer contains capture metadata
@@ -288,9 +339,8 @@ bool CameraBinImageCapture::processBusMessage(const QGstreamerMessage &message)
#ifdef DEBUG_CAPTURE
qDebug() << "install jpeg buffer probe";
#endif
- gst_pad_add_buffer_probe(srcpad,
- G_CALLBACK(CameraBinImageCapture::jpegBufferProbe),
- this);
+ m_muxerProbe.addProbeToPad(srcpad);
+
gst_object_unref(srcpad);
}
}
diff --git a/src/plugins/gstreamer/camerabin/camerabinimagecapture.h b/src/plugins/gstreamer/camerabin/camerabinimagecapture.h
index c2e26f51c..12d9d4ced 100644
--- a/src/plugins/gstreamer/camerabin/camerabinimagecapture.h
+++ b/src/plugins/gstreamer/camerabin/camerabinimagecapture.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -38,6 +38,14 @@
#include <qcameraimagecapturecontrol.h>
#include "camerabinsession.h"
+#include <qvideosurfaceformat.h>
+
+#include <private/qgstreamerbufferprobe_p.h>
+
+#if GST_CHECK_VERSION(1,0,0)
+#include <gst/video/video.h>
+#endif
+
QT_BEGIN_NAMESPACE
class CameraBinImageCapture : public QCameraImageCaptureControl, public QGstreamerBusMessageFilter
@@ -61,15 +69,47 @@ private slots:
void updateState();
private:
- static gboolean metadataEventProbe(GstPad *pad, GstEvent *event, CameraBinImageCapture *);
- static gboolean uncompressedBufferProbe(GstPad *pad, GstBuffer *buffer, CameraBinImageCapture *);
- static gboolean jpegBufferProbe(GstPad *pad, GstBuffer *buffer, CameraBinImageCapture *);
+#if GST_CHECK_VERSION(1,0,0)
+ static GstPadProbeReturn encoderEventProbe(GstPad *, GstPadProbeInfo *info, gpointer user_data);
+#else
+ static gboolean encoderEventProbe(GstElement *, GstEvent *event, gpointer user_data);
+#endif
+
+ class EncoderProbe : public QGstreamerBufferProbe
+ {
+ public:
+ EncoderProbe(CameraBinImageCapture *capture) : capture(capture) {}
+ void probeCaps(GstCaps *caps);
+ bool probeBuffer(GstBuffer *buffer);
+
+ private:
+ CameraBinImageCapture * const capture;
+ } m_encoderProbe;
+
+ class MuxerProbe : public QGstreamerBufferProbe
+ {
+ public:
+ MuxerProbe(CameraBinImageCapture *capture) : capture(capture) {}
+ void probeCaps(GstCaps *caps);
+ bool probeBuffer(GstBuffer *buffer);
+ private:
+ CameraBinImageCapture * const capture;
+
+ } m_muxerProbe;
+
+ QVideoSurfaceFormat m_bufferFormat;
+ QSize m_jpegResolution;
CameraBinSession *m_session;
- bool m_ready;
- int m_requestId;
GstElement *m_jpegEncoderElement;
GstElement *m_metadataMuxerElement;
+#if GST_CHECK_VERSION(1,0,0)
+ GstVideoInfo m_videoInfo;
+#else
+ int m_bytesPerLine;
+#endif
+ int m_requestId;
+ bool m_ready;
};
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp
index 824f9964f..20c5b3da2 100644
--- a/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -49,7 +49,6 @@ CameraBinImageEncoder::~CameraBinImageEncoder()
QList<QSize> CameraBinImageEncoder::supportedResolutions(const QImageEncoderSettings &, bool *continuous) const
{
- qDebug() << "CameraBinImageEncoder::supportedResolutions()";
if (continuous)
*continuous = false;
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageencoder.h b/src/plugins/gstreamer/camerabin/camerabinimageencoder.h
index d8b68fa42..19d856bbc 100644
--- a/src/plugins/gstreamer/camerabin/camerabinimageencoder.h
+++ b/src/plugins/gstreamer/camerabin/camerabinimageencoder.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
index ebfb08741..74f34655f 100644
--- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,21 +34,51 @@
#include "camerabinimageprocessing.h"
#include "camerabinsession.h"
-#include <gst/interfaces/colorbalance.h>
+#if GST_CHECK_VERSION(1,0,0)
+# include <gst/video/colorbalance.h>
+#else
+# include <gst/interfaces/colorbalance.h>
+#endif
QT_BEGIN_NAMESPACE
CameraBinImageProcessing::CameraBinImageProcessing(CameraBinSession *session)
:QCameraImageProcessingControl(session),
- m_session(session)
+ m_session(session),
+ m_whiteBalanceMode(QCameraImageProcessing::WhiteBalanceAuto)
{
#ifdef HAVE_GST_PHOTOGRAPHY
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_AUTO] = QCameraImageProcessing::WhiteBalanceAuto;
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT] = QCameraImageProcessing::WhiteBalanceSunlight;
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_CLOUDY] = QCameraImageProcessing::WhiteBalanceCloudy;
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_SUNSET] = QCameraImageProcessing::WhiteBalanceSunset;
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN] = QCameraImageProcessing::WhiteBalanceTungsten;
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT] = QCameraImageProcessing::WhiteBalanceFluorescent;
+ m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_AUTO] = QCameraImageProcessing::WhiteBalanceAuto;
+ m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT] = QCameraImageProcessing::WhiteBalanceSunlight;
+ m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_CLOUDY] = QCameraImageProcessing::WhiteBalanceCloudy;
+ m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_SUNSET] = QCameraImageProcessing::WhiteBalanceSunset;
+ m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN] = QCameraImageProcessing::WhiteBalanceTungsten;
+ m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT] = QCameraImageProcessing::WhiteBalanceFluorescent;
+ unlockWhiteBalance();
+
+#if GST_CHECK_VERSION(1, 0, 0)
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterNone, GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL);
+ if (m_session->photography()) {
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterSepia, GST_PHOTOGRAPHY_COLOR_TONE_MODE_SEPIA);
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterGrayscale, GST_PHOTOGRAPHY_COLOR_TONE_MODE_GRAYSCALE);
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterNegative, GST_PHOTOGRAPHY_COLOR_TONE_MODE_NEGATIVE);
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterSolarize, GST_PHOTOGRAPHY_COLOR_TONE_MODE_SOLARIZE);
+#if GST_CHECK_VERSION(1, 2, 0)
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterPosterize, GST_PHOTOGRAPHY_COLOR_TONE_MODE_POSTERIZE);
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterWhiteboard, GST_PHOTOGRAPHY_COLOR_TONE_MODE_WHITEBOARD);
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterBlackboard, GST_PHOTOGRAPHY_COLOR_TONE_MODE_BLACKBOARD);
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterAqua, GST_PHOTOGRAPHY_COLOR_TONE_MODE_AQUA);
+#endif
+ }
+#else
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterNone, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL);
+ if (m_session->photography()) {
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterSepia, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SEPIA);
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterGrayscale, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_GRAYSCALE);
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterNegative, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NEGATIVE);
+ m_filterMap.insert(QCameraImageProcessing::ColorFilterSolarize, GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SOLARIZE);
+ }
+#endif
#endif
updateColorBalanceValues();
@@ -125,20 +155,23 @@ bool CameraBinImageProcessing::setColorBalanceValue(const QString& channel, qrea
QCameraImageProcessing::WhiteBalanceMode CameraBinImageProcessing::whiteBalanceMode() const
{
-#ifdef HAVE_GST_PHOTOGRAPHY
- GstWhiteBalanceMode wbMode;
- gst_photography_get_white_balance_mode(m_session->photography(), &wbMode);
- return m_mappedWbValues[wbMode];
-#else
- return QCameraImageProcessing::WhiteBalanceAuto;
-#endif
+ return m_whiteBalanceMode;
}
void CameraBinImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode)
{
#ifdef HAVE_GST_PHOTOGRAPHY
- if (isWhiteBalanceModeSupported(mode))
- gst_photography_set_white_balance_mode(m_session->photography(), m_mappedWbValues.key(mode));
+ if (isWhiteBalanceModeSupported(mode)) {
+ m_whiteBalanceMode = mode;
+#if GST_CHECK_VERSION(1, 2, 0)
+ GstPhotographyWhiteBalanceMode currentMode;
+ if (gst_photography_get_white_balance_mode(m_session->photography(), &currentMode)
+ && currentMode != GST_PHOTOGRAPHY_WB_MODE_MANUAL)
+#endif
+ {
+ unlockWhiteBalance();
+ }
+ }
#else
Q_UNUSED(mode);
#endif
@@ -170,6 +203,14 @@ bool CameraBinImageProcessing::isParameterValueSupported(QCameraImageProcessingC
return qAbs(value.toReal()) <= 1.0;
case WhiteBalancePreset:
return isWhiteBalanceModeSupported(value.value<QCameraImageProcessing::WhiteBalanceMode>());
+ case ColorFilter: {
+ const QCameraImageProcessing::ColorFilter filter = value.value<QCameraImageProcessing::ColorFilter>();
+#ifdef HAVE_GST_PHOTOGRAPHY
+ return m_filterMap.contains(filter);
+#else
+ return filter == QCameraImageProcessing::ColorFilterNone;
+#endif
+ }
default:
break;
}
@@ -180,12 +221,28 @@ bool CameraBinImageProcessing::isParameterValueSupported(QCameraImageProcessingC
QVariant CameraBinImageProcessing::parameter(
QCameraImageProcessingControl::ProcessingParameter parameter) const
{
- if (parameter == QCameraImageProcessingControl::WhiteBalancePreset)
+ switch (parameter) {
+ case QCameraImageProcessingControl::WhiteBalancePreset:
return QVariant::fromValue<QCameraImageProcessing::WhiteBalanceMode>(whiteBalanceMode());
- else if (m_values.contains(parameter))
- return m_values.value(parameter);
- else
- return QVariant();
+ case QCameraImageProcessingControl::ColorFilter:
+#ifdef HAVE_GST_PHOTOGRAPHY
+ if (GstPhotography *photography = m_session->photography()) {
+#if GST_CHECK_VERSION(1, 0, 0)
+ GstPhotographyColorToneMode mode = GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL;
+ gst_photography_get_color_tone_mode(photography, &mode);
+#else
+ GstColourToneMode mode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL;
+ gst_photography_get_colour_tone_mode(photography, &mode);
+#endif
+ return QVariant::fromValue(m_filterMap.key(mode, QCameraImageProcessing::ColorFilterNone));
+ }
+#endif
+ return QVariant::fromValue(QCameraImageProcessing::ColorFilterNone);
+ default:
+ return m_values.contains(parameter)
+ ? QVariant(m_values.value(parameter))
+ : QVariant();
+ }
}
void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::ProcessingParameter parameter,
@@ -204,6 +261,21 @@ void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::Proce
case WhiteBalancePreset:
setWhiteBalanceMode(value.value<QCameraImageProcessing::WhiteBalanceMode>());
break;
+ case QCameraImageProcessingControl::ColorFilter:
+#ifdef HAVE_GST_PHOTOGRAPHY
+ if (GstPhotography *photography = m_session->photography()) {
+#if GST_CHECK_VERSION(1, 0, 0)
+ gst_photography_set_color_tone_mode(photography, m_filterMap.value(
+ value.value<QCameraImageProcessing::ColorFilter>(),
+ GST_PHOTOGRAPHY_COLOR_TONE_MODE_NORMAL));
+#else
+ gst_photography_set_colour_tone_mode(photography, m_filterMap.value(
+ value.value<QCameraImageProcessing::ColorFilter>(),
+ GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL));
+#endif
+ }
+#endif
+ break;
default:
break;
}
@@ -211,4 +283,23 @@ void CameraBinImageProcessing::setParameter(QCameraImageProcessingControl::Proce
updateColorBalanceValues();
}
+#ifdef HAVE_GST_PHOTOGRAPHY
+void CameraBinImageProcessing::lockWhiteBalance()
+{
+#if GST_CHECK_VERSION(1, 2, 0)
+ if (GstPhotography *photography = m_session->photography()) {
+ gst_photography_set_white_balance_mode(photography, GST_PHOTOGRAPHY_WB_MODE_MANUAL);
+ }
+#endif
+}
+
+void CameraBinImageProcessing::unlockWhiteBalance()
+{
+ if (GstPhotography *photography = m_session->photography()) {
+ gst_photography_set_white_balance_mode(
+ photography, m_mappedWbValues.key(m_whiteBalanceMode));
+ }
+}
+#endif
+
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h
index dcefcd048..9f280c485 100644
--- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h
+++ b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -41,7 +41,11 @@
#include <glib.h>
#ifdef HAVE_GST_PHOTOGRAPHY
-#include <gst/interfaces/photography.h>
+# include <gst/interfaces/photography.h>
+# if !GST_CHECK_VERSION(1,0,0)
+typedef GstWhiteBalanceMode GstPhotographyWhiteBalanceMode;
+typedef GstColourToneMode GstPhotographyColorToneMode;
+# endif
#endif
QT_BEGIN_NAMESPACE
@@ -65,6 +69,11 @@ public:
QVariant parameter(ProcessingParameter parameter) const;
void setParameter(ProcessingParameter parameter, const QVariant &value);
+#ifdef HAVE_GST_PHOTOGRAPHY
+ void lockWhiteBalance();
+ void unlockWhiteBalance();
+#endif
+
private:
bool setColorBalanceValue(const QString& channel, qreal value);
void updateColorBalanceValues();
@@ -73,8 +82,10 @@ private:
CameraBinSession *m_session;
QMap<QCameraImageProcessingControl::ProcessingParameter, int> m_values;
#ifdef HAVE_GST_PHOTOGRAPHY
- QMap<GstWhiteBalanceMode, QCameraImageProcessing::WhiteBalanceMode> m_mappedWbValues;
+ QMap<GstPhotographyWhiteBalanceMode, QCameraImageProcessing::WhiteBalanceMode> m_mappedWbValues;
+ QMap<QCameraImageProcessing::ColorFilter, GstPhotographyColorToneMode> m_filterMap;
#endif
+ QCameraImageProcessing::WhiteBalanceMode m_whiteBalanceMode;
};
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabininfocontrol.cpp b/src/plugins/gstreamer/camerabin/camerabininfocontrol.cpp
index d445dc2c6..9b8b094f3 100644
--- a/src/plugins/gstreamer/camerabin/camerabininfocontrol.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabininfocontrol.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabininfocontrol.h b/src/plugins/gstreamer/camerabin/camerabininfocontrol.h
index 4d82d4c33..d54ca7632 100644
--- a/src/plugins/gstreamer/camerabin/camerabininfocontrol.h
+++ b/src/plugins/gstreamer/camerabin/camerabininfocontrol.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
-** Contact: http://www.qt-project.org/legal
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp b/src/plugins/gstreamer/camerabin/camerabinlocks.cpp
index 7e779b511..e6fe9a309 100644
--- a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinlocks.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,6 +34,9 @@
#include "camerabinlocks.h"
#include "camerabinsession.h"
#include "camerabinfocus.h"
+#include "camerabinimageprocessing.h"
+
+#include <QtCore/qcoreevent.h>
#include <gst/interfaces/photography.h>
@@ -56,29 +59,186 @@ CameraBinLocks::~CameraBinLocks()
QCamera::LockTypes CameraBinLocks::supportedLocks() const
{
- return QCamera::LockFocus;
+ QCamera::LockTypes locks = QCamera::LockFocus;
+
+#if GST_CHECK_VERSION(1, 2, 0)
+ 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;
+ }
+ }
+#endif
+
+ return locks;
}
QCamera::LockStatus CameraBinLocks::lockStatus(QCamera::LockType lock) const
{
+ switch (lock) {
+ case QCamera::LockFocus:
+ return m_focus->focusStatus();
+#if GST_CHECK_VERSION(1, 2, 0)
+ case QCamera::LockExposure:
+ if (m_pendingLocks & QCamera::LockExposure)
+ return QCamera::Searching;
+ return isExposureLocked() ? QCamera::Locked : QCamera::Unlocked;
+ case QCamera::LockWhiteBalance:
+ if (m_pendingLocks & QCamera::LockWhiteBalance)
+ return QCamera::Searching;
+ return isWhiteBalanceLocked() ? QCamera::Locked : QCamera::Unlocked;
+#endif
+ default:
+ return QCamera::Unlocked;
+ }
+
return lock == QCamera::LockFocus ? m_focus->focusStatus() : QCamera::Unlocked;
}
void CameraBinLocks::searchAndLock(QCamera::LockTypes locks)
{
- if (locks & QCamera::LockFocus)
+ m_pendingLocks &= ~locks;
+
+ if (locks & QCamera::LockFocus) {
+ m_pendingLocks |= QCamera::LockFocus;
m_focus->_q_startFocusing();
+ }
+#if GST_CHECK_VERSION(1, 2, 0)
+ if (!m_pendingLocks)
+ m_lockTimer.stop();
+
+ if (locks & QCamera::LockExposure) {
+ if (isExposureLocked()) {
+ unlockExposure(QCamera::Searching, QCamera::UserRequest);
+ m_pendingLocks |= QCamera::LockExposure;
+ m_lockTimer.start(1000, this);
+ } else {
+ lockExposure(QCamera::UserRequest);
+ }
+ }
+ if (locks & QCamera::LockWhiteBalance) {
+ if (isWhiteBalanceLocked()) {
+ unlockWhiteBalance(QCamera::Searching, QCamera::UserRequest);
+ m_pendingLocks |= QCamera::LockWhiteBalance;
+ m_lockTimer.start(1000, this);
+ } else {
+ lockWhiteBalance(QCamera::UserRequest);
+ }
+ }
+#endif
+
}
void CameraBinLocks::unlock(QCamera::LockTypes locks)
{
+ m_pendingLocks &= ~locks;
+
if (locks & QCamera::LockFocus)
m_focus->_q_stopFocusing();
+
+#if GST_CHECK_VERSION(1, 2, 0)
+ if (!m_pendingLocks)
+ m_lockTimer.stop();
+
+ if (locks & QCamera::LockExposure)
+ unlockExposure(QCamera::Unlocked, QCamera::UserRequest);
+ if (locks & QCamera::LockWhiteBalance)
+ unlockWhiteBalance(QCamera::Unlocked, QCamera::UserRequest);
+#endif
}
void CameraBinLocks::updateFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason)
{
+ if (status != QCamera::Searching)
+ m_pendingLocks &= ~QCamera::LockFocus;
+
+#if GST_CHECK_VERSION(1, 2, 0)
+ if (status == QCamera::Locked && !m_lockTimer.isActive()) {
+ if (m_pendingLocks & QCamera::LockExposure)
+ lockExposure(QCamera::LockAcquired);
+ if (m_pendingLocks & QCamera::LockWhiteBalance)
+ lockWhiteBalance(QCamera::LockAcquired);
+ }
+#endif
emit lockStatusChanged(QCamera::LockFocus, status, reason);
}
+#if GST_CHECK_VERSION(1, 2, 0)
+
+void CameraBinLocks::timerEvent(QTimerEvent *event)
+{
+ if (event->timerId() != m_lockTimer.timerId())
+ return QCameraLocksControl::timerEvent(event);
+
+ m_lockTimer.stop();
+
+ if (!(m_pendingLocks & QCamera::LockFocus)) {
+ if (m_pendingLocks & QCamera::LockExposure)
+ lockExposure(QCamera::LockAcquired);
+ if (m_pendingLocks & QCamera::LockWhiteBalance)
+ lockWhiteBalance(QCamera::LockAcquired);
+ }
+}
+
+bool CameraBinLocks::isExposureLocked() const
+{
+ if (GstElement *source = m_session->cameraSource()) {
+ GstPhotographyExposureMode exposureMode = GST_PHOTOGRAPHY_EXPOSURE_MODE_AUTO;
+ g_object_get (G_OBJECT(source), "exposure-mode", &exposureMode, NULL);
+ return exposureMode == GST_PHOTOGRAPHY_EXPOSURE_MODE_MANUAL;
+ } else {
+ return false;
+ }
+}
+
+void CameraBinLocks::lockExposure(QCamera::LockChangeReason reason)
+{
+ m_pendingLocks &= ~QCamera::LockExposure;
+ g_object_set(
+ G_OBJECT(m_session->cameraSource()),
+ "exposure-mode",
+ GST_PHOTOGRAPHY_EXPOSURE_MODE_MANUAL,
+ NULL);
+ emit lockStatusChanged(QCamera::LockExposure, QCamera::Locked, reason);
+}
+
+void CameraBinLocks::unlockExposure(QCamera::LockStatus status, QCamera::LockChangeReason reason)
+{
+ g_object_set(
+ G_OBJECT(m_session->cameraSource()),
+ "exposure-mode",
+ GST_PHOTOGRAPHY_EXPOSURE_MODE_AUTO,
+ NULL);
+ emit lockStatusChanged(QCamera::LockExposure, status, reason);
+}
+
+bool CameraBinLocks::isWhiteBalanceLocked() const
+{
+ if (GstPhotography *photography = m_session->photography()) {
+ GstPhotographyWhiteBalanceMode whiteBalanceMode;
+ return gst_photography_get_white_balance_mode(photography, &whiteBalanceMode)
+ && whiteBalanceMode == GST_PHOTOGRAPHY_WB_MODE_MANUAL;
+ } else {
+ return false;
+ }
+}
+
+void CameraBinLocks::lockWhiteBalance(QCamera::LockChangeReason reason)
+{
+ m_pendingLocks &= ~QCamera::LockWhiteBalance;
+ m_session->imageProcessingControl()->lockWhiteBalance();
+ emit lockStatusChanged(QCamera::LockWhiteBalance, QCamera::Locked, reason);
+}
+
+void CameraBinLocks::unlockWhiteBalance(
+ QCamera::LockStatus status, QCamera::LockChangeReason reason)
+{
+ m_session->imageProcessingControl()->lockWhiteBalance();
+ emit lockStatusChanged(QCamera::LockWhiteBalance, status, reason);
+}
+
+#endif
+
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinlocks.h b/src/plugins/gstreamer/camerabin/camerabinlocks.h
index 80044d11d..60882356e 100644
--- a/src/plugins/gstreamer/camerabin/camerabinlocks.h
+++ b/src/plugins/gstreamer/camerabin/camerabinlocks.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -37,6 +37,8 @@
#include <qcamera.h>
#include <qcameralockscontrol.h>
+#include <QtCore/qbasictimer.h>
+
#include <gst/gst.h>
#include <glib.h>
@@ -60,12 +62,29 @@ public:
void searchAndLock(QCamera::LockTypes locks);
void unlock(QCamera::LockTypes locks);
+protected:
+#if GST_CHECK_VERSION(1, 2, 0)
+ void timerEvent(QTimerEvent *event);
+#endif
+
private slots:
void updateFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason);
private:
+#if GST_CHECK_VERSION(1, 2, 0)
+ bool isExposureLocked() const;
+ void lockExposure(QCamera::LockChangeReason reason);
+ void unlockExposure(QCamera::LockStatus status, QCamera::LockChangeReason reason);
+
+ bool isWhiteBalanceLocked() const;
+ void lockWhiteBalance(QCamera::LockChangeReason reason);
+ void unlockWhiteBalance(QCamera::LockStatus status, QCamera::LockChangeReason reason);
+#endif
+
CameraBinSession *m_session;
CameraBinFocus *m_focus;
+ QBasicTimer m_lockTimer;
+ QCamera::LockTypes m_pendingLocks;
};
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp b/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp
index 514813539..14b6c1297 100644
--- a/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -126,7 +126,7 @@ static const QGStreamerMetaDataKeys *qt_gstreamerMetaDataKeys()
metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::AlbumTitle, GST_TAG_ALBUM, QVariant::String));
metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::AlbumArtist, GST_TAG_ARTIST, QVariant::String));
metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::ContributingArtist, GST_TAG_PERFORMER, QVariant::String));
-#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 19)
+#if GST_CHECK_VERSION(0,10,19)
metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Composer, GST_TAG_COMPOSER, QVariant::String));
#endif
//metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Conductor, 0, QVariant::String));
@@ -153,8 +153,7 @@ static const QGStreamerMetaDataKeys *qt_gstreamerMetaDataKeys()
//metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Director, 0, QVariant::String));
metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::LeadPerformer, GST_TAG_PERFORMER, QVariant::String));
//metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::Writer, 0, QVariant::String));
-
-#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 30)
+#if GST_CHECK_VERSION(0,10,30)
// Photos
metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::CameraManufacturer, GST_TAG_DEVICE_MANUFACTURER, QVariant::String));
metadataKeys->append(QGStreamerMetaDataKey(QMediaMetaData::CameraModel, GST_TAG_DEVICE_MODEL, QVariant::String));
diff --git a/src/plugins/gstreamer/camerabin/camerabinmetadata.h b/src/plugins/gstreamer/camerabin/camerabinmetadata.h
index 12462e3b7..5e5eed6a5 100644
--- a/src/plugins/gstreamer/camerabin/camerabinmetadata.h
+++ b/src/plugins/gstreamer/camerabin/camerabinmetadata.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp b/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp
index 3a04c2f47..4154e1d65 100644
--- a/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -49,7 +49,7 @@ CameraBinRecorder::CameraBinRecorder(CameraBinSession *session)
m_state(QMediaRecorder::StoppedState),
m_status(QMediaRecorder::UnloadedStatus)
{
- connect(m_session, SIGNAL(stateChanged(QCamera::State)), SLOT(updateStatus()));
+ connect(m_session, SIGNAL(statusChanged(QCamera::Status)), SLOT(updateStatus()));
connect(m_session, SIGNAL(pendingStateChanged(QCamera::State)), SLOT(updateStatus()));
connect(m_session, SIGNAL(busyChanged(bool)), SLOT(updateStatus()));
@@ -86,12 +86,12 @@ QMediaRecorder::Status CameraBinRecorder::status() const
void CameraBinRecorder::updateStatus()
{
- QCamera::State sessionState = m_session->state();
+ QCamera::Status sessionStatus = m_session->status();
QMediaRecorder::State oldState = m_state;
QMediaRecorder::Status oldStatus = m_status;
- if (sessionState == QCamera::ActiveState &&
+ if (sessionStatus == QCamera::ActiveStatus &&
m_session->captureMode().testFlag(QCamera::CaptureVideo)) {
if (!m_session->cameraControl()->resourcePolicy()->canCapture()) {
@@ -110,9 +110,10 @@ void CameraBinRecorder::updateStatus()
m_state = QMediaRecorder::StoppedState;
m_session->stopVideoRecording();
}
- m_status = m_session->pendingState() == QCamera::ActiveState ?
- QMediaRecorder::LoadingStatus :
- QMediaRecorder::UnloadedStatus;
+ m_status = m_session->pendingState() == QCamera::ActiveState
+ && m_session->captureMode().testFlag(QCamera::CaptureVideo)
+ ? QMediaRecorder::LoadingStatus
+ : QMediaRecorder::UnloadedStatus;
}
if (m_state != oldState)
@@ -161,8 +162,6 @@ void CameraBinRecorder::applySettings()
QVideoEncoderSettings videoSettings = videoEncoderControl->videoSettings();
videoSettings.setCodec(candidate[1]);
- if (videoSettings.resolution().isEmpty())
- videoSettings.setResolution(640, 480);
videoEncoderControl->setActualVideoSettings(videoSettings);
QAudioEncoderSettings audioSettings = audioEncoderControl->audioSettings();
@@ -215,7 +214,7 @@ void CameraBinRecorder::setState(QMediaRecorder::State state)
break;
case QMediaRecorder::RecordingState:
- if (m_session->state() != QCamera::ActiveState) {
+ if (m_session->status() != QCamera::ActiveStatus) {
emit error(QMediaRecorder::ResourceError, tr("Service has not been started"));
} else if (!m_session->cameraControl()->resourcePolicy()->canCapture()) {
emit error(QMediaRecorder::ResourceError, tr("Recording permissions are not available"));
diff --git a/src/plugins/gstreamer/camerabin/camerabinrecorder.h b/src/plugins/gstreamer/camerabin/camerabinrecorder.h
index 4453aa610..959155520 100644
--- a/src/plugins/gstreamer/camerabin/camerabinrecorder.h
+++ b/src/plugins/gstreamer/camerabin/camerabinrecorder.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp
index 27caeab38..745536e87 100644
--- a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h
index 50293a908..c8e0a2a2b 100644
--- a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h
+++ b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.cpp b/src/plugins/gstreamer/camerabin/camerabinservice.cpp
index e4aa594d5..25fd44817 100644
--- a/src/plugins/gstreamer/camerabin/camerabinservice.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinservice.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -55,12 +55,13 @@
#include "camerabincapturebufferformat.h"
#include "camerabincapturedestination.h"
#include "camerabinviewfindersettings.h"
+#include "camerabinviewfindersettings2.h"
#include <private/qgstreamerbushelper_p.h>
+#include <private/qgstutils_p.h>
#include <private/qgstreameraudioinputselector_p.h>
#include <private/qgstreamervideoinputdevicecontrol_p.h>
-
#if defined(HAVE_WIDGETS)
#include <private/qgstreamervideowidget_p.h>
#endif
@@ -84,7 +85,9 @@ QT_BEGIN_NAMESPACE
CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *parent):
QMediaService(parent),
- m_cameraInfoControl(0)
+ m_cameraInfoControl(0),
+ m_viewfinderSettingsControl(0),
+ m_viewfinderSettingsControl2(0)
{
m_captureSession = 0;
m_metaDataControl = 0;
@@ -127,7 +130,6 @@ CameraBinService::CameraBinService(GstElementFactory *sourceFactory, QObject *pa
delete m_videoWindow;
m_videoWindow = 0;
}
-
#if defined(HAVE_WIDGETS)
m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
@@ -164,8 +166,6 @@ QMediaControl *CameraBinService::requestControl(const char *name)
if (!m_captureSession)
return 0;
- //qDebug() << "Request control" << name;
-
if (!m_videoOutput) {
if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
m_videoOutput = m_videoRenderer;
@@ -241,8 +241,17 @@ QMediaControl *CameraBinService::requestControl(const char *name)
if (qstrcmp(name, QCameraCaptureBufferFormatControl_iid) == 0)
return m_captureSession->captureBufferFormatControl();
- if (qstrcmp(name, QCameraViewfinderSettingsControl_iid) == 0)
- return m_captureSession->viewfinderSettingsControl();
+ if (qstrcmp(name, QCameraViewfinderSettingsControl_iid) == 0) {
+ if (!m_viewfinderSettingsControl)
+ m_viewfinderSettingsControl = new CameraBinViewfinderSettings(m_captureSession);
+ return m_viewfinderSettingsControl;
+ }
+
+ if (qstrcmp(name, QCameraViewfinderSettingsControl2_iid) == 0) {
+ if (!m_viewfinderSettingsControl2)
+ m_viewfinderSettingsControl2 = new CameraBinViewfinderSettings2(m_captureSession);
+ return m_viewfinderSettingsControl2;
+ }
if (qstrcmp(name, QCameraInfoControl_iid) == 0) {
if (!m_cameraInfoControl)
@@ -263,7 +272,7 @@ void CameraBinService::releaseControl(QMediaControl *control)
bool CameraBinService::isCameraBinAvailable()
{
- GstElementFactory *factory = gst_element_factory_find("camerabin2");
+ GstElementFactory *factory = gst_element_factory_find(QT_GSTREAMER_CAMERABIN_ELEMENT_NAME);
if (factory) {
gst_object_unref(GST_OBJECT(factory));
return true;
diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.h b/src/plugins/gstreamer/camerabin/camerabinservice.h
index a38e36034..814df7e51 100644
--- a/src/plugins/gstreamer/camerabin/camerabinservice.h
+++ b/src/plugins/gstreamer/camerabin/camerabinservice.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -54,6 +54,8 @@ class QGstreamerElementFactory;
class CameraBinMetaData;
class CameraBinImageCapture;
class CameraBinMetaData;
+class CameraBinViewfinderSettings;
+class CameraBinViewfinderSettings2;
class CameraBinService : public QMediaService
{
@@ -86,6 +88,9 @@ private:
#endif
CameraBinImageCapture *m_imageCaptureControl;
QMediaControl *m_cameraInfoControl;
+
+ CameraBinViewfinderSettings *m_viewfinderSettingsControl;
+ CameraBinViewfinderSettings2 *m_viewfinderSettingsControl2;
};
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp
index 51024b7d9..bee81a953 100644
--- a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h
index e31a667cb..7bf375670 100644
--- a/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h
+++ b/src/plugins/gstreamer/camerabin/camerabinserviceplugin.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
index 1ed663b9b..ed7e7d415 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -43,9 +43,9 @@
#include "camerabinflash.h"
#include "camerabinfocus.h"
#include "camerabinlocks.h"
-#include "camerabinzoom.h"
#endif
+#include "camerabinzoom.h"
#include "camerabinimageprocessing.h"
#include "camerabinviewfindersettings.h"
@@ -55,6 +55,7 @@
#include <private/qgstreamervideorendererinterface_p.h>
#include <private/qgstutils_p.h>
#include <qmediarecorder.h>
+#include <qvideosurfaceformat.h>
#ifdef HAVE_GST_PHOTOGRAPHY
#include <gst/interfaces/photography.h>
@@ -106,17 +107,12 @@
#define PREVIEW_CAPS_4_3 \
"video/x-raw-rgb, width = (int) 640, height = (int) 480"
-//using GST_STATE_READY for QCamera::LoadedState
-//may not work reliably at least with some webcams.
-
-//#define USE_READY_STATE_ON_LOADED
-
QT_BEGIN_NAMESPACE
CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *parent)
:QObject(parent),
m_recordingActive(false),
- m_state(QCamera::UnloadedState),
+ m_status(QCamera::UnloadedStatus),
m_pendingState(QCamera::UnloadedState),
m_muted(false),
m_busy(false),
@@ -125,11 +121,20 @@ CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *pa
m_videoInputFactory(0),
m_viewfinder(0),
m_viewfinderInterface(0),
+#ifdef HAVE_GST_PHOTOGRAPHY
+ m_cameraExposureControl(0),
+ m_cameraFlashControl(0),
+ m_cameraFocusControl(0),
+ m_cameraLocksControl(0),
+#endif
+ m_cameraSrc(0),
m_videoSrc(0),
m_viewfinderElement(0),
m_sourceFactory(sourceFactory),
m_viewfinderHasChanged(true),
- m_videoInputHasChanged(true),
+ m_inputDeviceHasChanged(true),
+ m_usingWrapperCameraBinSrc(false),
+ m_viewfinderProbe(this),
m_audioSrc(0),
m_audioConvert(0),
m_capsFilter(0),
@@ -140,8 +145,8 @@ CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *pa
{
if (m_sourceFactory)
gst_object_ref(GST_OBJECT(m_sourceFactory));
+ m_camerabin = gst_element_factory_make(QT_GSTREAMER_CAMERABIN_ELEMENT_NAME, "camerabin");
- m_camerabin = gst_element_factory_make("camerabin2", "camerabin2");
g_signal_connect(G_OBJECT(m_camerabin), "notify::idle", G_CALLBACK(updateBusyStatus), this);
g_signal_connect(G_OBJECT(m_camerabin), "element-added", G_CALLBACK(elementAdded), this);
g_signal_connect(G_OBJECT(m_camerabin), "element-removed", G_CALLBACK(elementRemoved), this);
@@ -158,18 +163,10 @@ CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *pa
m_imageEncodeControl = new CameraBinImageEncoder(this);
m_recorderControl = new CameraBinRecorder(this);
m_mediaContainerControl = new CameraBinContainer(this);
-
-#ifdef HAVE_GST_PHOTOGRAPHY
- m_cameraExposureControl = new CameraBinExposure(this);
- m_cameraFlashControl = new CameraBinFlash(this);
- m_cameraFocusControl = new CameraBinFocus(this);
- m_cameraLocksControl = new CameraBinLocks(this);
m_cameraZoomControl = new CameraBinZoom(this);
-#endif
m_imageProcessingControl = new CameraBinImageProcessing(this);
m_captureDestinationControl = new CameraBinCaptureDestination(this);
m_captureBufferFormatControl = new CameraBinCaptureBufferFormat(this);
- m_viewfinderSettingsControl = new CameraBinViewfinderSettings(this);
QByteArray envFlags = qgetenv("QT_GSTREAMER_CAMERABIN_FLAGS");
if (!envFlags.isEmpty())
@@ -178,7 +175,15 @@ CameraBinSession::CameraBinSession(GstElementFactory *sourceFactory, QObject *pa
//post image preview in RGB format
g_object_set(G_OBJECT(m_camerabin), POST_PREVIEWS_PROPERTY, TRUE, NULL);
+#if GST_CHECK_VERSION(1,0,0)
+ GstCaps *previewCaps = gst_caps_new_simple(
+ "video/x-raw",
+ "format", G_TYPE_STRING, "RGBx",
+ NULL);
+#else
GstCaps *previewCaps = gst_caps_from_string("video/x-raw-rgb");
+#endif
+
g_object_set(G_OBJECT(m_camerabin), PREVIEW_CAPS_PROPERTY, previewCaps, NULL);
gst_caps_unref(previewCaps);
}
@@ -215,24 +220,48 @@ GstPhotography *CameraBinSession::photography()
return 0;
}
-#endif
-CameraBinSession::CameraRole CameraBinSession::cameraRole() const
+CameraBinExposure *CameraBinSession::cameraExposureControl()
{
- return BackCamera;
+ if (!m_cameraExposureControl && photography())
+ m_cameraExposureControl = new CameraBinExposure(this);
+ return m_cameraExposureControl;
}
-/*
- Configure camera during Loaded->Active states stansition.
-*/
+CameraBinFlash *CameraBinSession::cameraFlashControl()
+{
+ if (!m_cameraFlashControl && photography())
+ m_cameraFlashControl = new CameraBinFlash(this);
+ return m_cameraFlashControl;
+}
+
+CameraBinFocus *CameraBinSession::cameraFocusControl()
+{
+ if (!m_cameraFocusControl && photography())
+ m_cameraFocusControl = new CameraBinFocus(this);
+ return m_cameraFocusControl;
+}
+
+CameraBinLocks *CameraBinSession::cameraLocksControl()
+{
+ if (!m_cameraLocksControl && photography())
+ m_cameraLocksControl = new CameraBinLocks(this);
+ return m_cameraLocksControl;
+}
+#endif
+
bool CameraBinSession::setupCameraBin()
{
if (!buildCameraSource())
return false;
if (m_viewfinderHasChanged) {
- if (m_viewfinderElement)
+ if (m_viewfinderElement) {
+ GstPad *pad = gst_element_get_static_pad(m_viewfinderElement, "sink");
+ m_viewfinderProbe.removeProbeFromPad(pad);
+ gst_object_unref(GST_OBJECT(pad));
gst_object_unref(GST_OBJECT(m_viewfinderElement));
+ }
m_viewfinderElement = m_viewfinderInterface ? m_viewfinderInterface->videoSink() : 0;
#if CAMERABIN_DEBUG
@@ -240,9 +269,16 @@ bool CameraBinSession::setupCameraBin()
#endif
m_viewfinderHasChanged = false;
if (!m_viewfinderElement) {
- qWarning() << "Staring camera without viewfinder available";
+ if (m_pendingState == QCamera::ActiveState)
+ qWarning() << "Starting camera without viewfinder available";
m_viewfinderElement = gst_element_factory_make("fakesink", NULL);
}
+
+ GstPad *pad = gst_element_get_static_pad(m_viewfinderElement, "sink");
+ m_viewfinderProbe.addProbeToPad(pad);
+ gst_object_unref(GST_OBJECT(pad));
+
+ g_object_set(G_OBJECT(m_viewfinderElement), "sync", FALSE, NULL);
qt_gst_object_ref_sink(GST_OBJECT(m_viewfinderElement));
gst_element_set_state(m_camerabin, GST_STATE_NULL);
g_object_set(G_OBJECT(m_camerabin), VIEWFINDER_SINK_PROPERTY, m_viewfinderElement, NULL);
@@ -251,61 +287,33 @@ bool CameraBinSession::setupCameraBin()
return true;
}
-static GstCaps *resolutionToCaps(const QSize &resolution, const QPair<int, int> &rate = qMakePair<int,int>(0,0))
+static GstCaps *resolutionToCaps(const QSize &resolution,
+ qreal frameRate = 0.0,
+ QVideoFrame::PixelFormat pixelFormat = QVideoFrame::Format_Invalid)
{
- if (resolution.isEmpty())
- return gst_caps_new_any();
-
GstCaps *caps = 0;
- if (rate.second > 0) {
- caps = gst_caps_new_full(gst_structure_new("video/x-raw-yuv",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- "framerate", GST_TYPE_FRACTION, rate.first, rate.second,
- NULL),
- gst_structure_new("video/x-raw-rgb",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- "framerate", GST_TYPE_FRACTION, rate.first, rate.second,
- NULL),
- gst_structure_new("video/x-raw-data",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- "framerate", GST_TYPE_FRACTION, rate.first, rate.second,
- NULL),
- gst_structure_new("video/x-android-buffer",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- "framerate", GST_TYPE_FRACTION, rate.first, rate.second,
- NULL),
- gst_structure_new("image/jpeg",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- "framerate", GST_TYPE_FRACTION, rate.first, rate.second,
- NULL),
- NULL);
- } else {
- caps = gst_caps_new_full (gst_structure_new ("video/x-raw-yuv",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- NULL),
- gst_structure_new ("video/x-raw-rgb",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- NULL),
- gst_structure_new("video/x-raw-data",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- NULL),
- gst_structure_new ("video/x-android-buffer",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- NULL),
- gst_structure_new ("image/jpeg",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- NULL),
- NULL);
+ if (pixelFormat == QVideoFrame::Format_Invalid)
+ caps = QGstUtils::videoFilterCaps();
+ else
+ caps = QGstUtils::capsForFormats(QList<QVideoFrame::PixelFormat>() << pixelFormat);
+
+ if (!resolution.isEmpty()) {
+ gst_caps_set_simple(
+ caps,
+ "width", G_TYPE_INT, resolution.width(),
+ "height", G_TYPE_INT, resolution.height(),
+ NULL);
+ }
+
+ if (frameRate > 0.0) {
+ gint numerator;
+ gint denominator;
+ gst_util_double_to_fraction(frameRate, &numerator, &denominator);
+
+ gst_caps_set_simple(
+ caps,
+ "framerate", GST_TYPE_FRACTION, numerator, denominator,
+ NULL);
}
return caps;
@@ -313,76 +321,92 @@ static GstCaps *resolutionToCaps(const QSize &resolution, const QPair<int, int>
void CameraBinSession::setupCaptureResolution()
{
- QSize resolution = m_imageEncodeControl->imageSettings().resolution();
- if (!resolution.isEmpty()) {
- GstCaps *caps = resolutionToCaps(resolution);
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << "set image resolution" << resolution << gst_caps_to_string(caps);
-#endif
- g_object_set(m_camerabin, IMAGE_CAPTURE_CAPS_PROPERTY, caps, NULL);
- gst_caps_unref(caps);
- } else {
- g_object_set(m_camerabin, IMAGE_CAPTURE_CAPS_PROPERTY, NULL, NULL);
- }
-
- resolution = m_videoEncodeControl->actualVideoSettings().resolution();
- //qreal framerate = m_videoEncodeControl->videoSettings().frameRate();
- if (!resolution.isEmpty()) {
- GstCaps *caps = resolutionToCaps(resolution /*, framerate*/); //convert to rational
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << "set video resolution" << resolution << gst_caps_to_string(caps);
-#endif
- g_object_set(m_camerabin, VIDEO_CAPTURE_CAPS_PROPERTY, caps, NULL);
- gst_caps_unref(caps);
- } else {
- g_object_set(m_camerabin, VIDEO_CAPTURE_CAPS_PROPERTY, NULL, NULL);
- }
+ QSize viewfinderResolution = m_viewfinderSettings.resolution();
+ qreal viewfinderFrameRate = m_viewfinderSettings.maximumFrameRate();
+ QVideoFrame::PixelFormat viewfinderPixelFormat = m_viewfinderSettings.pixelFormat();
+ const QSize imageResolution = m_imageEncodeControl->imageSettings().resolution();
+ const QSize videoResolution = m_videoEncodeControl->actualVideoSettings().resolution();
+
+ // WrapperCameraBinSrc cannot have different caps on its imgsrc, vidsrc and vfsrc pads.
+ // If capture resolution is specified, use it also for the viewfinder to avoid caps negotiation
+ // to fail.
+ if (m_usingWrapperCameraBinSrc) {
+ if (m_captureMode == QCamera::CaptureStillImage && !imageResolution.isEmpty())
+ viewfinderResolution = imageResolution;
+ else if (m_captureMode == QCamera::CaptureVideo && !videoResolution.isEmpty())
+ viewfinderResolution = videoResolution;
+
+ // Make sure we don't use incompatible frame rate and pixel format with the new resolution
+ if (viewfinderResolution != m_viewfinderSettings.resolution() &&
+ (!qFuzzyIsNull(viewfinderFrameRate) || viewfinderPixelFormat != QVideoFrame::Format_Invalid)) {
+
+ enum {
+ Nothing = 0x0,
+ OnlyFrameRate = 0x1,
+ OnlyPixelFormat = 0x2,
+ Both = 0x4
+ };
+ quint8 found = Nothing;
+
+ for (int i = 0; i < m_supportedViewfinderSettings.count() && !(found & Both); ++i) {
+ const QCameraViewfinderSettings &s = m_supportedViewfinderSettings.at(i);
+ if (s.resolution() == viewfinderResolution) {
+ if ((qFuzzyIsNull(viewfinderFrameRate) || s.maximumFrameRate() == viewfinderFrameRate)
+ && (viewfinderPixelFormat == QVideoFrame::Format_Invalid || s.pixelFormat() == viewfinderPixelFormat))
+ found |= Both;
+ else if (s.maximumFrameRate() == viewfinderFrameRate)
+ found |= OnlyFrameRate;
+ else if (s.pixelFormat() == viewfinderPixelFormat)
+ found |= OnlyPixelFormat;
+ }
+ }
- GstElement *mfw_v4lsrc = 0;
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSrc), "video-source")) {
- GstElement *videoSrc = 0;
- g_object_get(G_OBJECT(m_videoSrc), "video-source", &videoSrc, NULL);
- if (videoSrc) {
- const char *name = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(gst_element_get_factory(videoSrc)));
- if (!qstrcmp(name, "mfw_v4lsrc"))
- mfw_v4lsrc = videoSrc;
+ if (found & Both) {
+ // no-op
+ } else if (found & OnlyPixelFormat) {
+ viewfinderFrameRate = qreal(0);
+ } else if (found & OnlyFrameRate) {
+ viewfinderPixelFormat = QVideoFrame::Format_Invalid;
+ } else {
+ viewfinderPixelFormat = QVideoFrame::Format_Invalid;
+ viewfinderFrameRate = qreal(0);
+ }
}
}
- resolution = m_viewfinderSettingsControl->resolution();
- if (!resolution.isEmpty()) {
- GstCaps *caps = resolutionToCaps(resolution);
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << "set viewfinder resolution" << resolution << gst_caps_to_string(caps);
-#endif
- g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, caps, NULL);
- gst_caps_unref(caps);
-
- if (mfw_v4lsrc) {
- int capMode = 0;
- if (resolution == QSize(320, 240))
- capMode = 1;
- else if (resolution == QSize(720, 480))
- capMode = 2;
- else if (resolution == QSize(720, 576))
- capMode = 3;
- else if (resolution == QSize(1280, 720))
- capMode = 4;
- else if (resolution == QSize(1920, 1080))
- capMode = 5;
- g_object_set(G_OBJECT(mfw_v4lsrc), "capture-mode", capMode, NULL);
- }
- } else {
- g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, NULL, NULL);
- }
+ GstCaps *caps = resolutionToCaps(imageResolution);
+ g_object_set(m_camerabin, IMAGE_CAPTURE_CAPS_PROPERTY, caps, NULL);
+ gst_caps_unref(caps);
+
+ qreal framerate = m_videoEncodeControl->videoSettings().frameRate();
+ caps = resolutionToCaps(videoResolution, framerate);
+ g_object_set(m_camerabin, VIDEO_CAPTURE_CAPS_PROPERTY, caps, NULL);
+ gst_caps_unref(caps);
+
+ caps = resolutionToCaps(viewfinderResolution, viewfinderFrameRate, viewfinderPixelFormat);
+ g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, caps, NULL);
+ gst_caps_unref(caps);
- const qreal maxFps = m_viewfinderSettingsControl->maximumFrameRate();
- if (!qFuzzyIsNull(maxFps)) {
- if (mfw_v4lsrc) {
+ // Special case when using mfw_v4lsrc
+ if (m_videoSrc && qstrcmp(gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(gst_element_get_factory(m_videoSrc))), "mfw_v4lsrc") == 0) {
+ int capMode = 0;
+ if (viewfinderResolution == QSize(320, 240))
+ capMode = 1;
+ else if (viewfinderResolution == QSize(720, 480))
+ capMode = 2;
+ else if (viewfinderResolution == QSize(720, 576))
+ capMode = 3;
+ else if (viewfinderResolution == QSize(1280, 720))
+ capMode = 4;
+ else if (viewfinderResolution == QSize(1920, 1080))
+ capMode = 5;
+ g_object_set(G_OBJECT(m_videoSrc), "capture-mode", capMode, NULL);
+
+ if (!qFuzzyIsNull(viewfinderFrameRate)) {
int n, d;
- gst_util_double_to_fraction(maxFps, &n, &d);
- g_object_set(G_OBJECT(mfw_v4lsrc), "fps-n", n, NULL);
- g_object_set(G_OBJECT(mfw_v4lsrc), "fps-d", d, NULL);
+ gst_util_double_to_fraction(viewfinderFrameRate, &n, &d);
+ g_object_set(G_OBJECT(m_videoSrc), "fps-n", n, NULL);
+ g_object_set(G_OBJECT(m_videoSrc), "fps-d", d, NULL);
}
}
@@ -396,19 +420,23 @@ void CameraBinSession::setAudioCaptureCaps()
const int sampleRate = settings.sampleRate();
const int channelCount = settings.channelCount();
- if (sampleRate == -1 && channelCount == -1)
+ if (sampleRate <= 0 && channelCount <=0)
return;
+#if GST_CHECK_VERSION(1,0,0)
+ GstStructure *structure = gst_structure_new_empty(QT_GSTREAMER_RAW_AUDIO_MIME);
+#else
GstStructure *structure = gst_structure_new(
- "audio/x-raw-int",
+ QT_GSTREAMER_RAW_AUDIO_MIME,
"endianness", G_TYPE_INT, 1234,
"signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 16,
"depth", G_TYPE_INT, 16,
NULL);
- if (sampleRate != -1)
+#endif
+ if (sampleRate > 0)
gst_structure_set(structure, "rate", G_TYPE_INT, sampleRate, NULL);
- if (channelCount != -1)
+ if (channelCount > 0)
gst_structure_set(structure, "channels", G_TYPE_INT, channelCount, NULL);
GstCaps *caps = gst_caps_new_full(structure, NULL);
@@ -424,87 +452,92 @@ GstElement *CameraBinSession::buildCameraSource()
#if CAMERABIN_DEBUG
qDebug() << Q_FUNC_INFO;
#endif
- if (!m_videoInputHasChanged)
- return m_videoSrc;
- m_videoInputHasChanged = false;
+ if (!m_inputDeviceHasChanged)
+ return m_cameraSrc;
- GstElement *videoSrc = 0;
+ m_inputDeviceHasChanged = false;
+ m_usingWrapperCameraBinSrc = false;
- if (!videoSrc)
- g_object_get(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, &videoSrc, NULL);
+ GstElement *camSrc = 0;
+ g_object_get(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, &camSrc, NULL);
- if (m_sourceFactory)
- m_videoSrc = gst_element_factory_create(m_sourceFactory, "camera_source");
+ if (!m_cameraSrc && m_sourceFactory)
+ m_cameraSrc = gst_element_factory_create(m_sourceFactory, "camera_source");
// If gstreamer has set a default source use it.
- if (!m_videoSrc)
- m_videoSrc = videoSrc;
+ if (!m_cameraSrc)
+ m_cameraSrc = camSrc;
- if (m_videoSrc && !m_inputDevice.isEmpty()) {
+ if (m_cameraSrc && !m_inputDevice.isEmpty()) {
#if CAMERABIN_DEBUG
qDebug() << "set camera device" << m_inputDevice;
#endif
+ const char *const cameraSrcName = gst_plugin_feature_get_name(
+ GST_PLUGIN_FEATURE(gst_element_get_factory(m_cameraSrc)));
+ m_usingWrapperCameraBinSrc = qstrcmp(cameraSrcName, "wrappercamerabinsrc") == 0;
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSrc), "video-source")) {
- GstElement *src = 0;
+ if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_cameraSrc), "video-source")) {
+ if (!m_videoSrc) {
+ /* QT_GSTREAMER_CAMERABIN_VIDEOSRC can be used to set the video source element.
- /* QT_GSTREAMER_CAMERABIN_VIDEOSRC can be used to set the video source element.
+ --- Usage
- --- Usage
+ QT_GSTREAMER_CAMERABIN_VIDEOSRC=[drivername=elementname[,drivername2=elementname2 ...],][elementname]
- QT_GSTREAMER_CAMERABIN_VIDEOSRC=[drivername=elementname[,drivername2=elementname2 ...],][elementname]
+ --- Examples
- --- Examples
+ Always use 'somevideosrc':
+ QT_GSTREAMER_CAMERABIN_VIDEOSRC="somevideosrc"
- 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 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");
- 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;
+ if (!envVideoSource.isEmpty()) {
+ QList<QByteArray> sources = envVideoSource.split(',');
+ foreach (const QByteArray &source, sources) {
+ QList<QByteArray> keyValue = source.split('=');
+ if (keyValue.count() == 1) {
+ m_videoSrc = gst_element_factory_make(keyValue.at(0), "camera_source");
+ break;
+ } else if (keyValue.at(0) == QGstUtils::cameraDriver(m_inputDevice, m_sourceFactory)) {
+ m_videoSrc = gst_element_factory_make(keyValue.at(1), "camera_source");
+ break;
+ }
}
+ } else if (m_videoInputFactory) {
+ m_videoSrc = m_videoInputFactory->buildElement();
}
- } else if (m_videoInputFactory) {
- src = m_videoInputFactory->buildElement();
- }
- if (!src)
- src = gst_element_factory_make("v4l2src", "camera_source");
+ if (!m_videoSrc)
+ m_videoSrc = gst_element_factory_make("v4l2src", "camera_source");
- if (src) {
- g_object_set(G_OBJECT(src), "device", m_inputDevice.toUtf8().constData(), NULL);
- g_object_set(G_OBJECT(m_videoSrc), "video-source", src, NULL);
+ g_object_set(G_OBJECT(m_cameraSrc), "video-source", m_videoSrc, NULL);
}
- } else if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSrc), "camera-device")) {
+
+ if (m_videoSrc)
+ g_object_set(G_OBJECT(m_videoSrc), "device", m_inputDevice.toUtf8().constData(), NULL);
+
+ } else if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_cameraSrc), "camera-device")) {
if (m_inputDevice == QLatin1String("secondary")) {
- g_object_set(G_OBJECT(m_videoSrc), "camera-device", 1, NULL);
+ g_object_set(G_OBJECT(m_cameraSrc), "camera-device", 1, NULL);
} else {
- g_object_set(G_OBJECT(m_videoSrc), "camera-device", 0, NULL);
+ g_object_set(G_OBJECT(m_cameraSrc), "camera-device", 0, NULL);
}
}
}
- if (m_videoSrc != videoSrc)
- g_object_set(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, m_videoSrc, NULL);
+ if (m_cameraSrc != camSrc)
+ g_object_set(G_OBJECT(m_camerabin), CAMERA_SOURCE_PROPERTY, m_cameraSrc, NULL);
- if (videoSrc)
- gst_object_unref(GST_OBJECT(videoSrc));
+ if (camSrc)
+ gst_object_unref(GST_OBJECT(camSrc));
- return m_videoSrc;
+ return m_cameraSrc;
}
void CameraBinSession::captureImage(int requestId, const QString &fileName)
@@ -617,7 +650,7 @@ void CameraBinSession::setDevice(const QString &device)
{
if (m_inputDevice != device) {
m_inputDevice = device;
- m_videoInputHasChanged = true;
+ m_inputDeviceHasChanged = true;
}
}
@@ -629,7 +662,7 @@ void CameraBinSession::setAudioInput(QGstreamerElementFactory *audioInput)
void CameraBinSession::setVideoInput(QGstreamerElementFactory *videoInput)
{
m_videoInputFactory = videoInput;
- m_videoInputHasChanged = true;
+ m_inputDeviceHasChanged = true;
}
bool CameraBinSession::isReady() const
@@ -677,6 +710,28 @@ void CameraBinSession::setViewfinder(QObject *viewfinder)
}
}
+QList<QCameraViewfinderSettings> CameraBinSession::supportedViewfinderSettings() const
+{
+ return m_supportedViewfinderSettings;
+}
+
+QCameraViewfinderSettings CameraBinSession::viewfinderSettings() const
+{
+ return m_status == QCamera::ActiveStatus ? m_actualViewfinderSettings : m_viewfinderSettings;
+}
+
+void CameraBinSession::ViewfinderProbe::probeCaps(GstCaps *caps)
+{
+ // Update actual viewfinder settings on viewfinder caps change
+ const GstStructure *s = gst_caps_get_structure(caps, 0);
+ const QPair<qreal, qreal> frameRate = QGstUtils::structureFrameRateRange(s);
+ session->m_actualViewfinderSettings.setResolution(QGstUtils::structureResolution(s));
+ session->m_actualViewfinderSettings.setMinimumFrameRate(frameRate.first);
+ session->m_actualViewfinderSettings.setMaximumFrameRate(frameRate.second);
+ session->m_actualViewfinderSettings.setPixelFormat(QGstUtils::structurePixelFormat(s));
+ session->m_actualViewfinderSettings.setPixelAspectRatio(QGstUtils::structurePixelAspectRatio(s));
+}
+
void CameraBinSession::handleViewfinderChange()
{
//the viewfinder will be reloaded
@@ -685,9 +740,20 @@ void CameraBinSession::handleViewfinderChange()
emit viewfinderChanged();
}
-QCamera::State CameraBinSession::state() const
+void CameraBinSession::setStatus(QCamera::Status status)
{
- return m_state;
+ if (m_status == status)
+ return;
+
+ m_status = status;
+ emit statusChanged(m_status);
+
+ setStateHelper(m_pendingState);
+}
+
+QCamera::Status CameraBinSession::status() const
+{
+ return m_status;
}
QCamera::State CameraBinSession::pendingState() const
@@ -707,64 +773,114 @@ void CameraBinSession::setState(QCamera::State newState)
qDebug() << Q_FUNC_INFO << newState;
#endif
- switch (newState) {
- case QCamera::UnloadedState:
- if (m_recordingActive)
- stopVideoRecording();
-
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
-
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
- m_state = newState;
- if (m_busy)
- emit busyChanged(m_busy = false);
+ setStateHelper(newState);
+}
- emit stateChanged(m_state);
+void CameraBinSession::setStateHelper(QCamera::State state)
+{
+ switch (state) {
+ case QCamera::UnloadedState:
+ unload();
break;
case QCamera::LoadedState:
- if (m_recordingActive)
- stopVideoRecording();
-
- if (m_videoInputHasChanged) {
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
-
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
- buildCameraSource();
- }
-#ifdef USE_READY_STATE_ON_LOADED
- gst_element_set_state(m_camerabin, GST_STATE_READY);
-#else
- m_state = QCamera::LoadedState;
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
- emit stateChanged(m_state);
-#endif
+ if (m_status == QCamera::ActiveStatus)
+ stop();
+ else if (m_status == QCamera::UnloadedStatus)
+ load();
break;
case QCamera::ActiveState:
- if (setupCameraBin()) {
- GstState binState = GST_STATE_NULL;
- GstState pending = GST_STATE_NULL;
- gst_element_get_state(m_camerabin, &binState, &pending, 0);
+ // If the viewfinder changed while in the loaded state, we need to reload the pipeline
+ if (m_status == QCamera::LoadedStatus && !m_viewfinderHasChanged)
+ start();
+ else if (m_status == QCamera::UnloadedStatus || m_viewfinderHasChanged)
+ load();
+ }
+}
- m_recorderControl->applySettings();
+void CameraBinSession::setError(int err, const QString &errorString)
+{
+ m_pendingState = QCamera::UnloadedState;
+ emit error(err, errorString);
+ setStatus(QCamera::UnloadedStatus);
+}
- GstEncodingContainerProfile *profile = m_recorderControl->videoProfile();
- g_object_set (G_OBJECT(m_camerabin),
- "video-profile",
- profile,
- NULL);
- gst_encoding_profile_unref(profile);
+void CameraBinSession::load()
+{
+ if (m_status != QCamera::UnloadedStatus && !m_viewfinderHasChanged)
+ return;
- setAudioCaptureCaps();
+ setStatus(QCamera::LoadingStatus);
- setupCaptureResolution();
+ gst_element_set_state(m_camerabin, GST_STATE_NULL);
- gst_element_set_state(m_camerabin, GST_STATE_PLAYING);
- }
+ if (!setupCameraBin()) {
+ setError(QCamera::CameraError, QStringLiteral("No camera source available"));
+ return;
}
+
+ gst_element_set_state(m_camerabin, GST_STATE_READY);
+}
+
+void CameraBinSession::unload()
+{
+ if (m_status == QCamera::UnloadedStatus || m_status == QCamera::UnloadingStatus)
+ return;
+
+ setStatus(QCamera::UnloadingStatus);
+
+ if (m_recordingActive)
+ stopVideoRecording();
+
+ if (m_viewfinderInterface)
+ m_viewfinderInterface->stopRenderer();
+
+ gst_element_set_state(m_camerabin, GST_STATE_NULL);
+
+ if (m_busy)
+ emit busyChanged(m_busy = false);
+
+ m_supportedViewfinderSettings.clear();
+
+ setStatus(QCamera::UnloadedStatus);
+}
+
+void CameraBinSession::start()
+{
+ if (m_status != QCamera::LoadedStatus)
+ return;
+
+ setStatus(QCamera::StartingStatus);
+
+ m_recorderControl->applySettings();
+
+ GstEncodingContainerProfile *profile = m_recorderControl->videoProfile();
+ g_object_set (G_OBJECT(m_camerabin),
+ "video-profile",
+ profile,
+ NULL);
+ gst_encoding_profile_unref(profile);
+
+ setAudioCaptureCaps();
+
+ setupCaptureResolution();
+
+ gst_element_set_state(m_camerabin, GST_STATE_PLAYING);
+}
+
+void CameraBinSession::stop()
+{
+ if (m_status != QCamera::ActiveStatus)
+ return;
+
+ setStatus(QCamera::StoppingStatus);
+
+ if (m_recordingActive)
+ stopVideoRecording();
+
+ if (m_viewfinderInterface)
+ m_viewfinderInterface->stopRenderer();
+
+ gst_element_set_state(m_camerabin, GST_STATE_READY);
}
bool CameraBinSession::isBusy() const
@@ -796,7 +912,7 @@ qint64 CameraBinSession::duration() const
if (fileSink) {
GstFormat format = GST_FORMAT_TIME;
gint64 duration = 0;
- bool ret = gst_element_query_position(fileSink, &format, &duration);
+ bool ret = qt_gst_element_query_position(fileSink, format, &duration);
gst_object_unref(GST_OBJECT(fileSink));
if (ret)
return duration / 1000000;
@@ -831,129 +947,57 @@ void CameraBinSession::setMetaData(const QMap<QByteArray, QVariant> &data)
{
m_metaData = data;
- if (m_camerabin) {
- GstIterator *elements = gst_bin_iterate_all_by_interface(GST_BIN(m_camerabin), GST_TYPE_TAG_SETTER);
- GstElement *element = 0;
- while (gst_iterator_next(elements, (void**)&element) == GST_ITERATOR_OK) {
- gst_tag_setter_reset_tags(GST_TAG_SETTER(element));
-
- QMapIterator<QByteArray, QVariant> it(data);
- while (it.hasNext()) {
- it.next();
- const QString tagName = it.key();
- const QVariant tagValue = it.value();
-
- switch(tagValue.type()) {
- case QVariant::String:
- gst_tag_setter_add_tags(GST_TAG_SETTER(element),
- GST_TAG_MERGE_REPLACE,
- tagName.toUtf8().constData(),
- tagValue.toString().toUtf8().constData(),
- NULL);
- break;
- case QVariant::Int:
- case QVariant::LongLong:
- gst_tag_setter_add_tags(GST_TAG_SETTER(element),
- GST_TAG_MERGE_REPLACE,
- tagName.toUtf8().constData(),
- tagValue.toInt(),
- NULL);
- break;
- case QVariant::Double:
- gst_tag_setter_add_tags(GST_TAG_SETTER(element),
- GST_TAG_MERGE_REPLACE,
- tagName.toUtf8().constData(),
- tagValue.toDouble(),
- NULL);
- break;
- case QVariant::DateTime: {
- QDateTime date = tagValue.toDateTime().toLocalTime();
- gst_tag_setter_add_tags(GST_TAG_SETTER(element),
- GST_TAG_MERGE_REPLACE,
- tagName.toUtf8().constData(),
- gst_date_time_new_local_time(
- date.date().year(), date.date().month(), date.date().day(),
- date.time().hour(), date.time().minute(), date.time().second()),
- NULL);
- break;
- }
- default:
- break;
- }
- }
- }
- gst_iterator_free(elements);
- }
+ if (m_camerabin)
+ QGstUtils::setMetaData(m_camerabin, data);
}
bool CameraBinSession::processSyncMessage(const QGstreamerMessage &message)
{
GstMessage* gm = message.rawMessage();
- const GstStructure *st;
- const GValue *image;
- GstBuffer *buffer = NULL;
if (gm && GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) {
- if (m_captureMode == QCamera::CaptureStillImage &&
- gst_structure_has_name(gm->structure, "preview-image")) {
- st = gst_message_get_structure(gm);
-
- if (gst_structure_has_field_typed(st, "buffer", GST_TYPE_BUFFER)) {
- image = gst_structure_get_value(st, "buffer");
- if (image) {
- buffer = gst_value_get_buffer(image);
-
- QImage img;
-
- GstCaps *caps = gst_buffer_get_caps(buffer);
- if (caps) {
- GstStructure *structure = gst_caps_get_structure(caps, 0);
- gint width = 0;
- gint height = 0;
-#if CAMERABIN_DEBUG
- qDebug() << "Preview caps:" << gst_structure_to_string(structure);
+ const GstStructure *st = gst_message_get_structure(gm);
+ const GValue *sampleValue = 0;
+ if (m_captureMode == QCamera::CaptureStillImage
+ && gst_structure_has_name(st, "preview-image")
+#if GST_CHECK_VERSION(1,0,0)
+ && gst_structure_has_field_typed(st, "sample", GST_TYPE_SAMPLE)
+ && (sampleValue = gst_structure_get_value(st, "sample"))) {
+ GstSample * const sample = gst_value_get_sample(sampleValue);
+ GstCaps * const previewCaps = gst_sample_get_caps(sample);
+ GstBuffer * const buffer = gst_sample_get_buffer(sample);
+#else
+ && gst_structure_has_field_typed(st, "buffer", GST_TYPE_BUFFER)
+ && (sampleValue = gst_structure_get_value(st, "buffer"))) {
+ GstBuffer * const buffer = gst_value_get_buffer(sampleValue);
#endif
- if (structure &&
- gst_structure_get_int(structure, "width", &width) &&
- gst_structure_get_int(structure, "height", &height) &&
- width > 0 && height > 0) {
- if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-rgb") == 0) {
- QImage::Format format = QImage::Format_Invalid;
- int bpp = 0;
- gst_structure_get_int(structure, "bpp", &bpp);
-
- if (bpp == 24)
- format = QImage::Format_RGB888;
- else if (bpp == 32)
- format = QImage::Format_RGB32;
-
- if (format != QImage::Format_Invalid) {
- img = QImage((const uchar *)buffer->data, width, height, format);
- img.bits(); //detach
- }
- }
- }
- gst_caps_unref(caps);
-
- static QMetaMethod exposedSignal = QMetaMethod::fromSignal(&CameraBinSession::imageExposed);
- exposedSignal.invoke(this,
- Qt::QueuedConnection,
- Q_ARG(int,m_requestId));
-
- static QMetaMethod capturedSignal = QMetaMethod::fromSignal(&CameraBinSession::imageCaptured);
- capturedSignal.invoke(this,
- Qt::QueuedConnection,
- Q_ARG(int,m_requestId),
- Q_ARG(QImage,img));
- }
-
- }
- return true;
+ QImage image;
+#if GST_CHECK_VERSION(1,0,0)
+ GstVideoInfo previewInfo;
+ if (gst_video_info_from_caps(&previewInfo, previewCaps))
+ image = QGstUtils::bufferToImage(buffer, previewInfo);
+ gst_sample_unref(sample);
+#else
+ image = QGstUtils::bufferToImage(buffer);
+ gst_buffer_unref(buffer);
+#endif
+ if (!image.isNull()) {
+ static QMetaMethod exposedSignal = QMetaMethod::fromSignal(&CameraBinSession::imageExposed);
+ exposedSignal.invoke(this,
+ Qt::QueuedConnection,
+ Q_ARG(int,m_requestId));
+
+ static QMetaMethod capturedSignal = QMetaMethod::fromSignal(&CameraBinSession::imageCaptured);
+ capturedSignal.invoke(this,
+ Qt::QueuedConnection,
+ Q_ARG(int,m_requestId),
+ Q_ARG(QImage,image));
}
+ return true;
}
#ifdef HAVE_GST_PHOTOGRAPHY
- if (gst_structure_has_name(gm->structure, GST_PHOTOGRAPHY_AUTOFOCUS_DONE))
+ if (gst_structure_has_name(st, GST_PHOTOGRAPHY_AUTOFOCUS_DONE))
m_cameraFocusControl->handleFocusMessage(gm);
#endif
}
@@ -983,7 +1027,7 @@ bool CameraBinSession::processBusMessage(const QGstreamerMessage &message)
if (message.isEmpty())
message = tr("Camera error");
- emit error(int(QMediaRecorder::ResourceError), message);
+ setError(int(QMediaRecorder::ResourceError), message);
}
#ifdef CAMERABIN_DEBUG_DUMP_BIN
@@ -1049,17 +1093,20 @@ bool CameraBinSession::processBusMessage(const QGstreamerMessage &message)
switch (newState) {
case GST_STATE_VOID_PENDING:
case GST_STATE_NULL:
- if (m_state != QCamera::UnloadedState)
- emit stateChanged(m_state = QCamera::UnloadedState);
+ setStatus(QCamera::UnloadedStatus);
break;
case GST_STATE_READY:
+ if (oldState == GST_STATE_NULL)
+ updateSupportedViewfinderSettings();
+
setMetaData(m_metaData);
- if (m_state != QCamera::LoadedState)
- emit stateChanged(m_state = QCamera::LoadedState);
+ setStatus(QCamera::LoadedStatus);
break;
- case GST_STATE_PAUSED:
case GST_STATE_PLAYING:
- emit stateChanged(m_state = QCamera::ActiveState);
+ setStatus(QCamera::ActiveStatus);
+ break;
+ case GST_STATE_PAUSED:
+ default:
break;
}
}
@@ -1067,7 +1114,6 @@ bool CameraBinSession::processBusMessage(const QGstreamerMessage &message)
default:
break;
}
- //qDebug() << "New session state:" << ENUM_NAME(CameraBinSession,"State",m_state);
}
}
@@ -1128,14 +1174,47 @@ static bool rateLessThan(const QPair<int,int> &r1, const QPair<int,int> &r2)
return r1.first*r2.second < r2.first*r1.second;
}
+GstCaps *CameraBinSession::supportedCaps(QCamera::CaptureModes mode) const
+{
+ GstCaps *supportedCaps = 0;
+
+ // When using wrappercamerabinsrc, get the supported caps directly from the video source element.
+ // This makes sure we only get the caps actually supported by the video source element.
+ if (m_videoSrc) {
+ GstPad *pad = gst_element_get_static_pad(m_videoSrc, "src");
+ if (pad) {
+ supportedCaps = qt_gst_pad_get_caps(pad);
+ gst_object_unref(GST_OBJECT(pad));
+ }
+ }
+
+ // Otherwise, let the camerabin handle this.
+ if (!supportedCaps) {
+ const gchar *prop;
+ switch (mode) {
+ case QCamera::CaptureStillImage:
+ prop = SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY;
+ break;
+ case QCamera::CaptureVideo:
+ prop = SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY;
+ break;
+ case QCamera::CaptureViewfinder:
+ default:
+ prop = SUPPORTED_VIEWFINDER_CAPS_PROPERTY;
+ break;
+ }
+
+ g_object_get(G_OBJECT(m_camerabin), prop, &supportedCaps, NULL);
+ }
+
+ return supportedCaps;
+}
+
QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frameSize, bool *continuous) const
{
QList< QPair<int,int> > res;
- GstCaps *supportedCaps = 0;
- g_object_get(G_OBJECT(m_camerabin),
- SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY,
- &supportedCaps, NULL);
+ GstCaps *supportedCaps = this->supportedCaps(QCamera::CaptureVideo);
if (!supportedCaps)
return res;
@@ -1145,20 +1224,12 @@ QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frame
if (frameSize.isEmpty()) {
caps = gst_caps_copy(supportedCaps);
} else {
- GstCaps *filter = gst_caps_new_full(
- gst_structure_new(
- "video/x-raw-rgb",
- "width" , G_TYPE_INT , frameSize.width(),
- "height" , G_TYPE_INT, frameSize.height(), NULL),
- gst_structure_new(
- "video/x-raw-yuv",
- "width" , G_TYPE_INT, frameSize.width(),
- "height" , G_TYPE_INT, frameSize.height(), NULL),
- gst_structure_new(
- "image/jpeg",
- "width" , G_TYPE_INT, frameSize.width(),
- "height" , G_TYPE_INT, frameSize.height(), NULL),
- NULL);
+ GstCaps *filter = QGstUtils::videoFilterCaps();
+ gst_caps_set_simple(
+ filter,
+ "width", G_TYPE_INT, frameSize.width(),
+ "height", G_TYPE_INT, frameSize.height(),
+ NULL);
caps = gst_caps_intersect(supportedCaps, filter);
gst_caps_unref(filter);
@@ -1169,7 +1240,7 @@ QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frame
caps = gst_caps_make_writable(caps);
for (uint i=0; i<gst_caps_get_size(caps); i++) {
GstStructure *structure = gst_caps_get_structure(caps, i);
- gst_structure_set_name(structure, "video/x-raw-yuv");
+ gst_structure_set_name(structure, "video/x-raw");
const GValue *oldRate = gst_structure_get_value(structure, "framerate");
GValue rate;
memset(&rate, 0, sizeof(rate));
@@ -1178,8 +1249,11 @@ QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frame
gst_structure_remove_all_fields(structure);
gst_structure_set_value(structure, "framerate", &rate);
}
+#if GST_CHECK_VERSION(1,0,0)
+ caps = gst_caps_simplify(caps);
+#else
gst_caps_do_simplify(caps);
-
+#endif
for (uint i=0; i<gst_caps_get_size(caps); i++) {
GstStructure *structure = gst_caps_get_structure(caps, i);
@@ -1190,7 +1264,7 @@ QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frame
qSort(res.begin(), res.end(), rateLessThan);
#if CAMERABIN_DEBUG
- qDebug() << "Supported rates:" << gst_caps_to_string(caps);
+ qDebug() << "Supported rates:" << caps;
qDebug() << res;
#endif
@@ -1243,37 +1317,26 @@ QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate,
if (continuous)
*continuous = false;
- GstCaps *supportedCaps = 0;
- g_object_get(G_OBJECT(m_camerabin),
- (mode == QCamera::CaptureStillImage) ?
- SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY : SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY,
- &supportedCaps, NULL);
-
- if (!supportedCaps)
- return res;
+ GstCaps *supportedCaps = this->supportedCaps(mode);
#if CAMERABIN_DEBUG
- qDebug() << "Source caps:" << gst_caps_to_string(supportedCaps);
+ qDebug() << "Source caps:" << supportedCaps;
#endif
+ if (!supportedCaps)
+ return res;
+
GstCaps *caps = 0;
bool isContinuous = false;
if (rate.first <= 0 || rate.second <= 0) {
caps = gst_caps_copy(supportedCaps);
} else {
- GstCaps *filter = gst_caps_new_full(
- gst_structure_new(
- "video/x-raw-rgb",
- "framerate" , GST_TYPE_FRACTION , rate.first, rate.second, NULL),
- gst_structure_new(
- "video/x-raw-yuv",
- "framerate" , GST_TYPE_FRACTION , rate.first, rate.second, NULL),
- gst_structure_new(
- "image/jpeg",
- "framerate" , GST_TYPE_FRACTION , rate.first, rate.second, NULL),
- NULL);
-
+ GstCaps *filter = QGstUtils::videoFilterCaps();
+ gst_caps_set_simple(
+ filter,
+ "framerate" , GST_TYPE_FRACTION , rate.first, rate.second,
+ NULL);
caps = gst_caps_intersect(supportedCaps, filter);
gst_caps_unref(filter);
}
@@ -1283,7 +1346,7 @@ QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate,
caps = gst_caps_make_writable(caps);
for (uint i=0; i<gst_caps_get_size(caps); i++) {
GstStructure *structure = gst_caps_get_structure(caps, i);
- gst_structure_set_name(structure, "video/x-raw-yuv");
+ gst_structure_set_name(structure, "video/x-raw");
const GValue *oldW = gst_structure_get_value(structure, "width");
const GValue *oldH = gst_structure_get_value(structure, "height");
GValue w;
@@ -1298,7 +1361,13 @@ QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate,
gst_structure_set_value(structure, "width", &w);
gst_structure_set_value(structure, "height", &h);
}
+
+#if GST_CHECK_VERSION(1,0,0)
+ caps = gst_caps_simplify(caps);
+#else
gst_caps_do_simplify(caps);
+#endif
+
for (uint i=0; i<gst_caps_get_size(caps); i++) {
GstStructure *structure = gst_caps_get_structure(caps, i);
@@ -1378,6 +1447,40 @@ QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate,
return res;
}
+void CameraBinSession::updateSupportedViewfinderSettings()
+{
+ m_supportedViewfinderSettings.clear();
+
+ GstCaps *supportedCaps = this->supportedCaps(QCamera::CaptureViewfinder);
+
+ // Convert caps to QCameraViewfinderSettings
+ if (supportedCaps) {
+ supportedCaps = qt_gst_caps_normalize(supportedCaps);
+
+ for (uint i = 0; i < gst_caps_get_size(supportedCaps); i++) {
+ const GstStructure *structure = gst_caps_get_structure(supportedCaps, i);
+
+ QCameraViewfinderSettings s;
+ s.setResolution(QGstUtils::structureResolution(structure));
+ s.setPixelFormat(QGstUtils::structurePixelFormat(structure));
+ s.setPixelAspectRatio(QGstUtils::structurePixelAspectRatio(structure));
+
+ QPair<qreal, qreal> frameRateRange = QGstUtils::structureFrameRateRange(structure);
+ s.setMinimumFrameRate(frameRateRange.first);
+ s.setMaximumFrameRate(frameRateRange.second);
+
+ if (!s.resolution().isEmpty()
+ && s.pixelFormat() != QVideoFrame::Format_Invalid
+ && !m_supportedViewfinderSettings.contains(s)) {
+
+ m_supportedViewfinderSettings.append(s);
+ }
+ }
+
+ gst_caps_unref(supportedCaps);
+ }
+}
+
void CameraBinSession::elementAdded(GstBin *, GstElement *element, CameraBinSession *session)
{
GstElementFactory *factory = gst_element_get_factory(element);
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.h b/src/plugins/gstreamer/camerabin/camerabinsession.h
index 7e8a46dee..71590a7dc 100644
--- a/src/plugins/gstreamer/camerabin/camerabinsession.h
+++ b/src/plugins/gstreamer/camerabin/camerabinsession.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -45,6 +45,7 @@
#endif
#include <private/qgstreamerbushelper_p.h>
+#include <private/qgstreamerbufferprobe_p.h>
#include "qcamera.h"
QT_BEGIN_NAMESPACE
@@ -74,7 +75,6 @@ public:
virtual GstElement *buildElement() = 0;
};
-
class CameraBinSession : public QObject,
public QGstreamerBusMessageFilter,
public QGstreamerSyncMessageFilter
@@ -83,11 +83,6 @@ class CameraBinSession : public QObject,
Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
Q_INTERFACES(QGstreamerBusMessageFilter QGstreamerSyncMessageFilter)
public:
- enum CameraRole {
- FrontCamera, // Secondary camera
- BackCamera // Main photo camera
- };
-
CameraBinSession(GstElementFactory *sourceFactory, QObject *parent);
~CameraBinSession();
@@ -98,8 +93,6 @@ public:
GstElement *cameraSource() { return m_videoSrc; }
QGstreamerBusHelper *bus() { return m_busHelper; }
- CameraRole cameraRole() const;
-
QList< QPair<int,int> > supportedFrameRates(const QSize &frameSize, bool *continuous) const;
QList<QSize> supportedResolutions(QPair<int,int> rate, bool *continuous, QCamera::CaptureModes mode) const;
@@ -121,17 +114,16 @@ public:
CameraBinImageEncoder *imageEncodeControl() const { return m_imageEncodeControl; }
#ifdef HAVE_GST_PHOTOGRAPHY
- CameraBinExposure *cameraExposureControl() const { return m_cameraExposureControl; }
- CameraBinFlash *cameraFlashControl() const { return m_cameraFlashControl; }
- CameraBinFocus *cameraFocusControl() const { return m_cameraFocusControl; }
- CameraBinLocks *cameraLocksControl() const { return m_cameraLocksControl; }
- CameraBinZoom *cameraZoomControl() const { return m_cameraZoomControl; }
+ CameraBinExposure *cameraExposureControl();
+ CameraBinFlash *cameraFlashControl();
+ CameraBinFocus *cameraFocusControl();
+ CameraBinLocks *cameraLocksControl();
#endif
+ CameraBinZoom *cameraZoomControl() const { return m_cameraZoomControl; }
CameraBinImageProcessing *imageProcessingControl() const { return m_imageProcessingControl; }
CameraBinCaptureDestination *captureDestinationControl() const { return m_captureDestinationControl; }
CameraBinCaptureBufferFormat *captureBufferFormatControl() const { return m_captureBufferFormatControl; }
- CameraBinViewfinderSettings *viewfinderSettingsControl() const { return m_viewfinderSettingsControl; }
CameraBinRecorder *recorderControl() const { return m_recorderControl; }
CameraBinContainer *mediaContainerControl() const { return m_mediaContainerControl; }
@@ -146,9 +138,13 @@ public:
QObject *viewfinder() const { return m_viewfinder; }
void setViewfinder(QObject *viewfinder);
+ QList<QCameraViewfinderSettings> supportedViewfinderSettings() const;
+ QCameraViewfinderSettings viewfinderSettings() const;
+ void setViewfinderSettings(const QCameraViewfinderSettings &settings) { m_viewfinderSettings = settings; }
+
void captureImage(int requestId, const QString &fileName);
- QCamera::State state() const;
+ QCamera::Status status() const;
QCamera::State pendingState() const;
bool isBusy() const;
@@ -163,7 +159,7 @@ public:
bool processBusMessage(const QGstreamerMessage &message);
signals:
- void stateChanged(QCamera::State state);
+ void statusChanged(QCamera::Status status);
void pendingStateChanged(QCamera::State state);
void durationChanged(qint64 duration);
void error(int error, const QString &errorString);
@@ -183,11 +179,22 @@ public slots:
private slots:
void handleViewfinderChange();
+ void setupCaptureResolution();
private:
+ void load();
+ void unload();
+ void start();
+ void stop();
+
+ void setStatus(QCamera::Status status);
+ void setStateHelper(QCamera::State state);
+ void setError(int error, const QString &errorString);
+
bool setupCameraBin();
- void setupCaptureResolution();
void setAudioCaptureCaps();
+ GstCaps *supportedCaps(QCamera::CaptureModes mode) const;
+ void updateSupportedViewfinderSettings();
static void updateBusyStatus(GObject *o, GParamSpec *p, gpointer d);
static void elementAdded(GstBin *bin, GstElement *element, CameraBinSession *session);
@@ -197,7 +204,7 @@ private:
QUrl m_actualSink;
bool m_recordingActive;
QString m_captureDevice;
- QCamera::State m_state;
+ QCamera::Status m_status;
QCamera::State m_pendingState;
QString m_inputDevice;
bool m_muted;
@@ -210,6 +217,9 @@ private:
QGstreamerElementFactory *m_videoInputFactory;
QObject *m_viewfinder;
QGstreamerVideoRendererInterface *m_viewfinderInterface;
+ QList<QCameraViewfinderSettings> m_supportedViewfinderSettings;
+ QCameraViewfinderSettings m_viewfinderSettings;
+ QCameraViewfinderSettings m_actualViewfinderSettings;
CameraBinControl *m_cameraControl;
CameraBinAudioEncoder *m_audioEncodeControl;
@@ -222,22 +232,35 @@ private:
CameraBinFlash *m_cameraFlashControl;
CameraBinFocus *m_cameraFocusControl;
CameraBinLocks *m_cameraLocksControl;
- CameraBinZoom *m_cameraZoomControl;
#endif
-
+ CameraBinZoom *m_cameraZoomControl;
CameraBinImageProcessing *m_imageProcessingControl;
CameraBinCaptureDestination *m_captureDestinationControl;
CameraBinCaptureBufferFormat *m_captureBufferFormatControl;
- CameraBinViewfinderSettings *m_viewfinderSettingsControl;
QGstreamerBusHelper *m_busHelper;
GstBus* m_bus;
GstElement *m_camerabin;
+ GstElement *m_cameraSrc;
GstElement *m_videoSrc;
GstElement *m_viewfinderElement;
GstElementFactory *m_sourceFactory;
bool m_viewfinderHasChanged;
- bool m_videoInputHasChanged;
+ bool m_inputDeviceHasChanged;
+ bool m_usingWrapperCameraBinSrc;
+
+ class ViewfinderProbe : public QGstreamerBufferProbe {
+ public:
+ ViewfinderProbe(CameraBinSession *s)
+ : QGstreamerBufferProbe(QGstreamerBufferProbe::ProbeCaps)
+ , session(s)
+ {}
+
+ void probeCaps(GstCaps *caps);
+
+ private:
+ CameraBinSession * const session;
+ } m_viewfinderProbe;
GstElement *m_audioSrc;
GstElement *m_audioConvert;
diff --git a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp
index 554437047..aad059df0 100644
--- a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h
index dabe098ab..9eebf28b8 100644
--- a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h
+++ b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp
index c5cdee40e..8155c182a 100644
--- a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp
@@ -1,7 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd.
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -33,14 +34,14 @@
#include "camerabinviewfindersettings.h"
-
+#include "camerabinsession.h"
QT_BEGIN_NAMESPACE
-CameraBinViewfinderSettings::CameraBinViewfinderSettings(QObject *parent)
- : QCameraViewfinderSettingsControl(parent),
- m_minimumFrameRate(0),
- m_maximumFrameRate(0)
+
+CameraBinViewfinderSettings::CameraBinViewfinderSettings(CameraBinSession *session)
+ : QCameraViewfinderSettingsControl(session)
+ , m_session(session)
{
}
@@ -52,11 +53,11 @@ bool CameraBinViewfinderSettings::isViewfinderParameterSupported(ViewfinderParam
{
switch (parameter) {
case Resolution:
+ case PixelAspectRatio:
case MinimumFrameRate:
case MaximumFrameRate:
- return true;
- case PixelAspectRatio:
case PixelFormat:
+ return true;
case UserParameter:
return false;
}
@@ -67,13 +68,15 @@ QVariant CameraBinViewfinderSettings::viewfinderParameter(ViewfinderParameter pa
{
switch (parameter) {
case Resolution:
- return m_resolution;
+ return m_session->viewfinderSettings().resolution();
+ case PixelAspectRatio:
+ return m_session->viewfinderSettings().pixelAspectRatio();
case MinimumFrameRate:
- return m_minimumFrameRate;
+ return m_session->viewfinderSettings().minimumFrameRate();
case MaximumFrameRate:
- return m_maximumFrameRate;
- case PixelAspectRatio:
+ return m_session->viewfinderSettings().maximumFrameRate();
case PixelFormat:
+ return m_session->viewfinderSettings().pixelFormat();
case UserParameter:
return QVariant();
}
@@ -82,36 +85,28 @@ QVariant CameraBinViewfinderSettings::viewfinderParameter(ViewfinderParameter pa
void CameraBinViewfinderSettings::setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value)
{
+ QCameraViewfinderSettings settings = m_session->viewfinderSettings();
+
switch (parameter) {
case Resolution:
- m_resolution = value.toSize();
+ settings.setResolution(value.toSize());
+ break;
+ case PixelAspectRatio:
+ settings.setPixelAspectRatio(value.toSize());
break;
case MinimumFrameRate:
- m_minimumFrameRate = value.toFloat();
+ settings.setMinimumFrameRate(value.toReal());
break;
case MaximumFrameRate:
- m_maximumFrameRate = value.toFloat();
+ settings.setMaximumFrameRate(value.toReal());
break;
- case PixelAspectRatio:
case PixelFormat:
+ settings.setPixelFormat(qvariant_cast<QVideoFrame::PixelFormat>(value));
case UserParameter:
break;
}
-}
-
-QSize CameraBinViewfinderSettings::resolution() const
-{
- return m_resolution;
-}
-qreal CameraBinViewfinderSettings::minimumFrameRate() const
-{
- return m_minimumFrameRate;
-}
-
-qreal CameraBinViewfinderSettings::maximumFrameRate() const
-{
- return m_maximumFrameRate;
+ m_session->setViewfinderSettings(settings);
}
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h
index c5030ffb4..0180e6f40 100644
--- a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h
+++ b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings.h
@@ -1,7 +1,8 @@
/****************************************************************************
**
** Copyright (C) 2013 Jolla Ltd.
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +11,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +24,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -36,29 +37,23 @@
#include <qcameraviewfindersettingscontrol.h>
-#include <QtCore/qsize.h>
-
QT_BEGIN_NAMESPACE
+class CameraBinSession;
+
class CameraBinViewfinderSettings : public QCameraViewfinderSettingsControl
{
Q_OBJECT
public:
- CameraBinViewfinderSettings(QObject *parent);
+ CameraBinViewfinderSettings(CameraBinSession *session);
~CameraBinViewfinderSettings();
bool isViewfinderParameterSupported(ViewfinderParameter parameter) const;
QVariant viewfinderParameter(ViewfinderParameter parameter) const;
void setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value);
- QSize resolution() const;
- qreal minimumFrameRate() const;
- qreal maximumFrameRate() const;
-
private:
- QSize m_resolution;
- qreal m_minimumFrameRate;
- qreal m_maximumFrameRate;
+ CameraBinSession *m_session;
};
QT_END_NAMESPACE
diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp
new file mode 100644
index 000000000..9e3c43fb4
--- /dev/null
+++ b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "camerabinviewfindersettings2.h"
+#include "camerabinsession.h"
+
+QT_BEGIN_NAMESPACE
+
+CameraBinViewfinderSettings2::CameraBinViewfinderSettings2(CameraBinSession *session)
+ : QCameraViewfinderSettingsControl2(session)
+ , m_session(session)
+{
+
+}
+
+CameraBinViewfinderSettings2::~CameraBinViewfinderSettings2()
+{
+
+}
+
+QList<QCameraViewfinderSettings> CameraBinViewfinderSettings2::supportedViewfinderSettings() const
+{
+ return m_session->supportedViewfinderSettings();
+}
+
+QCameraViewfinderSettings CameraBinViewfinderSettings2::viewfinderSettings() const
+{
+ return m_session->viewfinderSettings();
+}
+
+void CameraBinViewfinderSettings2::setViewfinderSettings(const QCameraViewfinderSettings &settings)
+{
+ m_session->setViewfinderSettings(settings);
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h
new file mode 100644
index 000000000..9a0efd0bb
--- /dev/null
+++ b/src/plugins/gstreamer/camerabin/camerabinviewfindersettings2.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CAMERABINVIEWFINDERSETTINGS2_H
+#define CAMERABINVIEWFINDERSETTINGS2_H
+
+#include <qcameraviewfindersettingscontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class CameraBinSession;
+
+class CameraBinViewfinderSettings2 : public QCameraViewfinderSettingsControl2
+{
+ Q_OBJECT
+public:
+ CameraBinViewfinderSettings2(CameraBinSession *session);
+ ~CameraBinViewfinderSettings2();
+
+ QList<QCameraViewfinderSettings> supportedViewfinderSettings() const;
+
+ QCameraViewfinderSettings viewfinderSettings() const;
+ void setViewfinderSettings(const QCameraViewfinderSettings &settings);
+
+private:
+ CameraBinSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif // CAMERABINVIEWFINDERSETTINGS2_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinzoom.cpp b/src/plugins/gstreamer/camerabin/camerabinzoom.cpp
index b960609b3..a25cf68b4 100644
--- a/src/plugins/gstreamer/camerabin/camerabinzoom.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabinzoom.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
@@ -34,8 +34,6 @@
#include "camerabinzoom.h"
#include "camerabinsession.h"
-#include <gst/interfaces/photography.h>
-
#define ZOOM_PROPERTY "zoom"
#define MAX_ZOOM_PROPERTY "max-zoom"
diff --git a/src/plugins/gstreamer/camerabin/camerabinzoom.h b/src/plugins/gstreamer/camerabin/camerabinzoom.h
index e6bca1ea1..061836a4a 100644
--- a/src/plugins/gstreamer/camerabin/camerabinzoom.h
+++ b/src/plugins/gstreamer/camerabin/camerabinzoom.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp
index 7bada6a85..d40b210b2 100644
--- a/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp
+++ b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
diff --git a/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.h b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.h
index 555406d0c..8a7d69741 100644
--- a/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.h
+++ b/src/plugins/gstreamer/camerabin/camerabuttonlistener_meego.h
@@ -1,7 +1,7 @@
/****************************************************************************
**
-** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/legal
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
@@ -10,9 +10,9 @@
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
-** use the contact form at http://qt.digia.com/contact-us.
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
@@ -23,8 +23,8 @@
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
-** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$