Allow the user to specify the viewfinder resolution instead of guessing
Guessing badly prevents the camerabin pipeline from loading at all and the fallbacks used are not representive of the capabilities of most cameras. So either stay out of the process and let gstreamer negotiate a resolution if it can, or use a resolution supplied through the viewfinder settings control by someone hopefully better informed. Task-number: QTBUG-30842 Change-Id: Iec2dcc2476f38822f9e0d02301e46a1f49b7c6da Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
30078eeee1
commit
ff2cac464c
@@ -29,7 +29,8 @@ HEADERS += \
|
|||||||
$$PWD/camerabinvideoencoder.h \
|
$$PWD/camerabinvideoencoder.h \
|
||||||
$$PWD/camerabinresourcepolicy.h \
|
$$PWD/camerabinresourcepolicy.h \
|
||||||
$$PWD/camerabincapturedestination.h \
|
$$PWD/camerabincapturedestination.h \
|
||||||
$$PWD/camerabincapturebufferformat.h
|
$$PWD/camerabincapturebufferformat.h \
|
||||||
|
$$PWD/camerabinviewfindersettings.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$PWD/camerabinserviceplugin.cpp \
|
$$PWD/camerabinserviceplugin.cpp \
|
||||||
@@ -46,6 +47,7 @@ SOURCES += \
|
|||||||
$$PWD/camerabinvideoencoder.cpp \
|
$$PWD/camerabinvideoencoder.cpp \
|
||||||
$$PWD/camerabinresourcepolicy.cpp \
|
$$PWD/camerabinresourcepolicy.cpp \
|
||||||
$$PWD/camerabincapturedestination.cpp \
|
$$PWD/camerabincapturedestination.cpp \
|
||||||
|
$$PWD/camerabinviewfindersettings.cpp \
|
||||||
$$PWD/camerabincapturebufferformat.cpp
|
$$PWD/camerabincapturebufferformat.cpp
|
||||||
|
|
||||||
maemo6 {
|
maemo6 {
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
#include "camerabinimageprocessing.h"
|
#include "camerabinimageprocessing.h"
|
||||||
#include "camerabincapturebufferformat.h"
|
#include "camerabincapturebufferformat.h"
|
||||||
#include "camerabincapturedestination.h"
|
#include "camerabincapturedestination.h"
|
||||||
|
#include "camerabinviewfindersettings.h"
|
||||||
#include <private/qgstreamerbushelper_p.h>
|
#include <private/qgstreamerbushelper_p.h>
|
||||||
|
|
||||||
#include <private/qgstreameraudioinputselector_p.h>
|
#include <private/qgstreameraudioinputselector_p.h>
|
||||||
@@ -240,6 +241,9 @@ QMediaControl *CameraBinService::requestControl(const char *name)
|
|||||||
if (qstrcmp(name, QCameraCaptureBufferFormatControl_iid) == 0)
|
if (qstrcmp(name, QCameraCaptureBufferFormatControl_iid) == 0)
|
||||||
return m_captureSession->captureBufferFormatControl();
|
return m_captureSession->captureBufferFormatControl();
|
||||||
|
|
||||||
|
if (qstrcmp(name, QCameraViewfinderSettingsControl_iid) == 0)
|
||||||
|
return m_captureSession->viewfinderSettingsControl();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "camerabinimageprocessing.h"
|
#include "camerabinimageprocessing.h"
|
||||||
|
#include "camerabinviewfindersettings.h"
|
||||||
|
|
||||||
#include "camerabincapturedestination.h"
|
#include "camerabincapturedestination.h"
|
||||||
#include "camerabincapturebufferformat.h"
|
#include "camerabincapturebufferformat.h"
|
||||||
@@ -91,6 +92,7 @@
|
|||||||
#define AUDIO_SOURCE_PROPERTY "audio-source"
|
#define AUDIO_SOURCE_PROPERTY "audio-source"
|
||||||
#define SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY "image-capture-supported-caps"
|
#define SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY "image-capture-supported-caps"
|
||||||
#define SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY "video-capture-supported-caps"
|
#define SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY "video-capture-supported-caps"
|
||||||
|
#define SUPPORTED_VIEWFINDER_CAPS_PROPERTY "viewfinder-supported-caps"
|
||||||
#define IMAGE_CAPTURE_CAPS_PROPERTY "image-capture-caps"
|
#define IMAGE_CAPTURE_CAPS_PROPERTY "image-capture-caps"
|
||||||
#define VIDEO_CAPTURE_CAPS_PROPERTY "video-capture-caps"
|
#define VIDEO_CAPTURE_CAPS_PROPERTY "video-capture-caps"
|
||||||
#define VIEWFINDER_CAPS_PROPERTY "viewfinder-caps"
|
#define VIEWFINDER_CAPS_PROPERTY "viewfinder-caps"
|
||||||
@@ -110,10 +112,6 @@
|
|||||||
#define PREVIEW_CAPS_4_3 \
|
#define PREVIEW_CAPS_4_3 \
|
||||||
"video/x-raw-rgb, width = (int) 640, height = (int) 480"
|
"video/x-raw-rgb, width = (int) 640, height = (int) 480"
|
||||||
|
|
||||||
#define VIEWFINDER_RESOLUTION_4x3 QSize(640, 480)
|
|
||||||
#define VIEWFINDER_RESOLUTION_3x2 QSize(720, 480)
|
|
||||||
#define VIEWFINDER_RESOLUTION_16x9 QSize(800, 450)
|
|
||||||
|
|
||||||
//using GST_STATE_READY for QCamera::LoadedState
|
//using GST_STATE_READY for QCamera::LoadedState
|
||||||
//may not work reliably at least with some webcams.
|
//may not work reliably at least with some webcams.
|
||||||
|
|
||||||
@@ -170,6 +168,7 @@ CameraBinSession::CameraBinSession(QObject *parent)
|
|||||||
m_imageProcessingControl = new CameraBinImageProcessing(this);
|
m_imageProcessingControl = new CameraBinImageProcessing(this);
|
||||||
m_captureDestinationControl = new CameraBinCaptureDestination(this);
|
m_captureDestinationControl = new CameraBinCaptureDestination(this);
|
||||||
m_captureBufferFormatControl = new CameraBinCaptureBufferFormat(this);
|
m_captureBufferFormatControl = new CameraBinCaptureBufferFormat(this);
|
||||||
|
m_viewfinderSettingsControl = new CameraBinViewfinderSettings(this);
|
||||||
|
|
||||||
QByteArray envFlags = qgetenv("QT_GSTREAMER_CAMERABIN_FLAGS");
|
QByteArray envFlags = qgetenv("QT_GSTREAMER_CAMERABIN_FLAGS");
|
||||||
if (!envFlags.isEmpty())
|
if (!envFlags.isEmpty())
|
||||||
@@ -246,8 +245,7 @@ bool CameraBinSession::setupCameraBin()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *resolutionToCaps(const QSize &resolution,
|
static GstCaps *resolutionToCaps(const QSize &resolution, const QPair<int, int> &rate = qMakePair<int,int>(0,0))
|
||||||
const QPair<int, int> &rate = qMakePair<int,int>(0,0))
|
|
||||||
{
|
{
|
||||||
if (resolution.isEmpty())
|
if (resolution.isEmpty())
|
||||||
return gst_caps_new_any();
|
return gst_caps_new_any();
|
||||||
@@ -263,7 +261,23 @@ static GstCaps *resolutionToCaps(const QSize &resolution,
|
|||||||
"width", G_TYPE_INT, resolution.width(),
|
"width", G_TYPE_INT, resolution.width(),
|
||||||
"height", G_TYPE_INT, resolution.height(),
|
"height", G_TYPE_INT, resolution.height(),
|
||||||
"framerate", GST_TYPE_FRACTION, rate.first, rate.second,
|
"framerate", GST_TYPE_FRACTION, rate.first, rate.second,
|
||||||
NULL), NULL);
|
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 {
|
} else {
|
||||||
caps = gst_caps_new_full (gst_structure_new ("video/x-raw-yuv",
|
caps = gst_caps_new_full (gst_structure_new ("video/x-raw-yuv",
|
||||||
"width", G_TYPE_INT, resolution.width(),
|
"width", G_TYPE_INT, resolution.width(),
|
||||||
@@ -271,28 +285,29 @@ static GstCaps *resolutionToCaps(const QSize &resolution,
|
|||||||
NULL),
|
NULL),
|
||||||
gst_structure_new ("video/x-raw-rgb",
|
gst_structure_new ("video/x-raw-rgb",
|
||||||
"width", G_TYPE_INT, resolution.width(),
|
"width", G_TYPE_INT, resolution.width(),
|
||||||
"height", G_TYPE_INT, resolution.height(), NULL), NULL);
|
"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);
|
||||||
}
|
}
|
||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraBinSession::setupCaptureResolution()
|
void CameraBinSession::setupCaptureResolution()
|
||||||
{
|
{
|
||||||
if (m_captureMode == QCamera::CaptureStillImage) {
|
|
||||||
QSize resolution = m_imageEncodeControl->imageSettings().resolution();
|
QSize resolution = m_imageEncodeControl->imageSettings().resolution();
|
||||||
|
|
||||||
//by default select the maximum supported resolution
|
|
||||||
if (resolution.isEmpty()) {
|
|
||||||
bool continuous = false;
|
|
||||||
QList<QSize> resolutions = supportedResolutions(qMakePair<int,int>(0,0),
|
|
||||||
&continuous,
|
|
||||||
QCamera::CaptureStillImage);
|
|
||||||
if (!resolutions.isEmpty())
|
|
||||||
resolution = resolutions.last();
|
|
||||||
}
|
|
||||||
|
|
||||||
QSize viewfinderResolution = VIEWFINDER_RESOLUTION_4x3;
|
|
||||||
|
|
||||||
if (!resolution.isEmpty()) {
|
if (!resolution.isEmpty()) {
|
||||||
GstCaps *caps = resolutionToCaps(resolution);
|
GstCaps *caps = resolutionToCaps(resolution);
|
||||||
#if CAMERABIN_DEBUG
|
#if CAMERABIN_DEBUG
|
||||||
@@ -300,56 +315,33 @@ void CameraBinSession::setupCaptureResolution()
|
|||||||
#endif
|
#endif
|
||||||
g_object_set(m_camerabin, IMAGE_CAPTURE_CAPS_PROPERTY, caps, NULL);
|
g_object_set(m_camerabin, IMAGE_CAPTURE_CAPS_PROPERTY, caps, NULL);
|
||||||
gst_caps_unref(caps);
|
gst_caps_unref(caps);
|
||||||
|
|
||||||
if (!resolution.isEmpty()) {
|
|
||||||
qreal aspectRatio = qreal(resolution.width()) / resolution.height();
|
|
||||||
if (aspectRatio < 1.4)
|
|
||||||
viewfinderResolution = VIEWFINDER_RESOLUTION_4x3;
|
|
||||||
else if (aspectRatio > 1.7)
|
|
||||||
viewfinderResolution = VIEWFINDER_RESOLUTION_16x9;
|
|
||||||
else
|
|
||||||
viewfinderResolution = VIEWFINDER_RESOLUTION_3x2;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
g_object_set(m_camerabin, IMAGE_CAPTURE_CAPS_PROPERTY, GST_CAPS_ANY, NULL);
|
g_object_set(m_camerabin, IMAGE_CAPTURE_CAPS_PROPERTY, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
//on low res cameras the viewfinder resolution should not be bigger
|
resolution = m_videoEncodeControl->actualVideoSettings().resolution();
|
||||||
//then capture resolution
|
|
||||||
if (viewfinderResolution.width() > resolution.width() && !resolution.isEmpty())
|
|
||||||
viewfinderResolution = resolution;
|
|
||||||
|
|
||||||
GstCaps *viewfinderCaps = resolutionToCaps(viewfinderResolution);
|
|
||||||
#if CAMERABIN_DEBUG
|
|
||||||
qDebug() << "Set viewfinder resolution" << viewfinderResolution <<gst_caps_to_string(viewfinderCaps);
|
|
||||||
#endif
|
|
||||||
g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, viewfinderCaps, NULL);
|
|
||||||
gst_caps_unref(viewfinderCaps);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_captureMode == QCamera::CaptureVideo) {
|
|
||||||
QSize resolution = m_videoEncodeControl->actualVideoSettings().resolution();
|
|
||||||
//qreal framerate = m_videoEncodeControl->videoSettings().frameRate();
|
//qreal framerate = m_videoEncodeControl->videoSettings().frameRate();
|
||||||
|
if (!resolution.isEmpty()) {
|
||||||
if (resolution.isEmpty()) {
|
|
||||||
//select the hightest supported resolution
|
|
||||||
bool continuous = false;
|
|
||||||
QList<QSize> resolutions = supportedResolutions(qMakePair<int,int>(0,0),
|
|
||||||
&continuous,
|
|
||||||
QCamera::CaptureVideo);
|
|
||||||
if (!resolutions.isEmpty())
|
|
||||||
resolution = resolutions.last();
|
|
||||||
}
|
|
||||||
|
|
||||||
GstCaps *caps = resolutionToCaps(resolution /*, framerate*/); //convert to rational
|
GstCaps *caps = resolutionToCaps(resolution /*, framerate*/); //convert to rational
|
||||||
#if CAMERABIN_DEBUG
|
#if CAMERABIN_DEBUG
|
||||||
qDebug() << Q_FUNC_INFO << "set video resolution" << resolution << gst_caps_to_string(caps);
|
qDebug() << Q_FUNC_INFO << "set video resolution" << resolution << gst_caps_to_string(caps);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//Use the same resolution for viewfinder and video capture
|
|
||||||
g_object_set(m_camerabin, VIDEO_CAPTURE_CAPS_PROPERTY, caps, NULL);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, caps, NULL);
|
||||||
gst_caps_unref(caps);
|
gst_caps_unref(caps);
|
||||||
|
} else {
|
||||||
|
g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ class CameraBinZoom;
|
|||||||
class CameraBinCaptureDestination;
|
class CameraBinCaptureDestination;
|
||||||
class CameraBinCaptureBufferFormat;
|
class CameraBinCaptureBufferFormat;
|
||||||
class QGstreamerVideoRendererInterface;
|
class QGstreamerVideoRendererInterface;
|
||||||
|
class CameraBinViewfinderSettings;
|
||||||
|
|
||||||
class QGstreamerElementFactory
|
class QGstreamerElementFactory
|
||||||
{
|
{
|
||||||
@@ -136,7 +137,7 @@ public:
|
|||||||
CameraBinImageProcessing *imageProcessingControl() const { return m_imageProcessingControl; }
|
CameraBinImageProcessing *imageProcessingControl() const { return m_imageProcessingControl; }
|
||||||
CameraBinCaptureDestination *captureDestinationControl() const { return m_captureDestinationControl; }
|
CameraBinCaptureDestination *captureDestinationControl() const { return m_captureDestinationControl; }
|
||||||
CameraBinCaptureBufferFormat *captureBufferFormatControl() const { return m_captureBufferFormatControl; }
|
CameraBinCaptureBufferFormat *captureBufferFormatControl() const { return m_captureBufferFormatControl; }
|
||||||
|
CameraBinViewfinderSettings *viewfinderSettingsControl() const { return m_viewfinderSettingsControl; }
|
||||||
|
|
||||||
CameraBinRecorder *recorderControl() const { return m_recorderControl; }
|
CameraBinRecorder *recorderControl() const { return m_recorderControl; }
|
||||||
CameraBinContainer *mediaContainerControl() const { return m_mediaContainerControl; }
|
CameraBinContainer *mediaContainerControl() const { return m_mediaContainerControl; }
|
||||||
@@ -229,6 +230,7 @@ private:
|
|||||||
CameraBinImageProcessing *m_imageProcessingControl;
|
CameraBinImageProcessing *m_imageProcessingControl;
|
||||||
CameraBinCaptureDestination *m_captureDestinationControl;
|
CameraBinCaptureDestination *m_captureDestinationControl;
|
||||||
CameraBinCaptureBufferFormat *m_captureBufferFormatControl;
|
CameraBinCaptureBufferFormat *m_captureBufferFormatControl;
|
||||||
|
CameraBinViewfinderSettings *m_viewfinderSettingsControl;
|
||||||
|
|
||||||
QGstreamerBusHelper *m_busHelper;
|
QGstreamerBusHelper *m_busHelper;
|
||||||
GstBus* m_bus;
|
GstBus* m_bus;
|
||||||
|
|||||||
106
src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp
Normal file
106
src/plugins/gstreamer/camerabin/camerabinviewfindersettings.cpp
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Jolla Ltd.
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** 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 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.
|
||||||
|
**
|
||||||
|
** 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 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: 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
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include "camerabinviewfindersettings.h"
|
||||||
|
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
CameraBinViewfinderSettings::CameraBinViewfinderSettings(QObject *parent)
|
||||||
|
: QCameraViewfinderSettingsControl(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CameraBinViewfinderSettings::~CameraBinViewfinderSettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CameraBinViewfinderSettings::isViewfinderParameterSupported(ViewfinderParameter parameter) const
|
||||||
|
{
|
||||||
|
switch (parameter) {
|
||||||
|
case Resolution:
|
||||||
|
return true;
|
||||||
|
case PixelAspectRatio:
|
||||||
|
case MinimumFrameRate:
|
||||||
|
case MaximumFrameRate:
|
||||||
|
case PixelFormat:
|
||||||
|
case UserParameter:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QVariant CameraBinViewfinderSettings::viewfinderParameter(ViewfinderParameter parameter) const
|
||||||
|
{
|
||||||
|
switch (parameter) {
|
||||||
|
case Resolution:
|
||||||
|
return m_resolution;
|
||||||
|
case PixelAspectRatio:
|
||||||
|
case MinimumFrameRate:
|
||||||
|
case MaximumFrameRate:
|
||||||
|
case PixelFormat:
|
||||||
|
case UserParameter:
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CameraBinViewfinderSettings::setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value)
|
||||||
|
{
|
||||||
|
switch (parameter) {
|
||||||
|
case Resolution:
|
||||||
|
m_resolution = value.toSize();
|
||||||
|
case PixelAspectRatio:
|
||||||
|
case MinimumFrameRate:
|
||||||
|
case MaximumFrameRate:
|
||||||
|
case PixelFormat:
|
||||||
|
case UserParameter:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QSize CameraBinViewfinderSettings::resolution() const
|
||||||
|
{
|
||||||
|
return m_resolution;
|
||||||
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
**
|
||||||
|
** Copyright (C) 2013 Jolla Ltd.
|
||||||
|
** Contact: http://www.qt-project.org/legal
|
||||||
|
**
|
||||||
|
** This file is part of the Qt Toolkit.
|
||||||
|
**
|
||||||
|
** $QT_BEGIN_LICENSE:LGPL$
|
||||||
|
** 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 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.
|
||||||
|
**
|
||||||
|
** 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 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||||
|
** will be met: 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
|
||||||
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||||
|
**
|
||||||
|
** GNU General Public License Usage
|
||||||
|
** Alternatively, this file may be used under the terms of the GNU
|
||||||
|
** General Public License version 3.0 as published by the Free Software
|
||||||
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
||||||
|
** packaging of this file. Please review the following information to
|
||||||
|
** ensure the GNU General Public License version 3.0 requirements will be
|
||||||
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** $QT_END_LICENSE$
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef CAMERABINVIEWFINDERSETTINGS_H
|
||||||
|
#define CAMERABINVIEWFINDERSETTINGS_H
|
||||||
|
|
||||||
|
#include <qcameraviewfindersettingscontrol.h>
|
||||||
|
|
||||||
|
#include <QtCore/qsize.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class CameraBinViewfinderSettings : public QCameraViewfinderSettingsControl
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
CameraBinViewfinderSettings(QObject *parent);
|
||||||
|
~CameraBinViewfinderSettings();
|
||||||
|
|
||||||
|
bool isViewfinderParameterSupported(ViewfinderParameter parameter) const;
|
||||||
|
QVariant viewfinderParameter(ViewfinderParameter parameter) const;
|
||||||
|
void setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value);
|
||||||
|
|
||||||
|
QSize resolution() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QSize m_resolution;
|
||||||
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user