Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev

This commit is contained in:
Yoann Lopes
2014-01-30 14:32:29 +01:00
committed by The Qt Project
43 changed files with 1358 additions and 288 deletions

View File

@@ -29,7 +29,8 @@ HEADERS += \
$$PWD/camerabinvideoencoder.h \
$$PWD/camerabinresourcepolicy.h \
$$PWD/camerabincapturedestination.h \
$$PWD/camerabincapturebufferformat.h
$$PWD/camerabincapturebufferformat.h \
$$PWD/camerabinviewfindersettings.h
SOURCES += \
$$PWD/camerabinserviceplugin.cpp \
@@ -46,6 +47,7 @@ SOURCES += \
$$PWD/camerabinvideoencoder.cpp \
$$PWD/camerabinresourcepolicy.cpp \
$$PWD/camerabincapturedestination.cpp \
$$PWD/camerabinviewfindersettings.cpp \
$$PWD/camerabincapturebufferformat.cpp
maemo6 {

View File

@@ -106,18 +106,19 @@ void CameraBinAudioEncoder::resetActualSettings()
GstEncodingProfile *CameraBinAudioEncoder::createProfile()
{
QString codec = m_actualAudioSettings.codec();
QString preset = m_actualAudioSettings.encodingOption(QStringLiteral("preset")).toString();
GstCaps *caps;
if (codec.isEmpty())
caps = gst_caps_new_any();
return 0;
else
caps = gst_caps_from_string(codec.toLatin1());
return (GstEncodingProfile *)gst_encoding_audio_profile_new(
caps,
NULL, //preset
NULL, //restriction
0); //presence
!preset.isEmpty() ? preset.toLatin1().constData() : NULL, //preset
NULL, //restriction
0); //presence
}
QT_END_NAMESPACE

View File

@@ -115,10 +115,11 @@ 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);
}

View File

@@ -54,12 +54,43 @@ struct QGstreamerMetaDataKeyLookup
const char *token;
};
static QVariant fromGStreamerOrientation(const QVariant &value)
{
// Note gstreamer tokens either describe the counter clockwise rotation of the
// image or the clockwise transform to apply to correct the image. The orientation
// value returned is the clockwise rotation of the image.
const QString token = value.toString();
if (token == QStringLiteral("rotate-90"))
return 270;
else if (token == QStringLiteral("rotate-180"))
return 180;
else if (token == QStringLiteral("rotate-270"))
return 90;
else
return 0;
}
static QVariant toGStreamerOrientation(const QVariant &value)
{
switch (value.toInt()) {
case 90:
return QStringLiteral("rotate-270");
case 180:
return QStringLiteral("rotate-180");
case 270:
return QStringLiteral("rotate-90");
default:
return QStringLiteral("rotate-0");
}
}
static const QGstreamerMetaDataKeyLookup qt_gstreamerMetaDataKeys[] =
{
{ QMediaMetaData::Title, GST_TAG_TITLE },
//{ QMediaMetaData::SubTitle, 0 },
//{ QMediaMetaData::Author, 0 },
{ QMediaMetaData::Comment, GST_TAG_COMMENT },
{ QMediaMetaData::Date, GST_TAG_DATE_TIME },
{ QMediaMetaData::Description, GST_TAG_DESCRIPTION },
//{ QMediaMetaData::Category, 0 },
{ QMediaMetaData::Genre, GST_TAG_GENRE },
@@ -120,7 +151,9 @@ static const QGstreamerMetaDataKeyLookup qt_gstreamerMetaDataKeys[] =
//{ QMediaMetaData::CameraManufacturer, 0 },
//{ QMediaMetaData::CameraModel, 0 },
//{ QMediaMetaData::Event, 0 },
//{ QMediaMetaData::Subject, 0 }
//{ QMediaMetaData::Subject, 0 },
{ QMediaMetaData::Orientation, GST_TAG_IMAGE_ORIENTATION }
};
CameraBinMetaData::CameraBinMetaData(QObject *parent)
@@ -130,6 +163,10 @@ CameraBinMetaData::CameraBinMetaData(QObject *parent)
QVariant CameraBinMetaData::metaData(const QString &key) const
{
if (key == QMediaMetaData::Orientation) {
return fromGStreamerOrientation(m_values.value(QByteArray(GST_TAG_IMAGE_ORIENTATION)));
}
static const int count = sizeof(qt_gstreamerMetaDataKeys) / sizeof(QGstreamerMetaDataKeyLookup);
for (int i = 0; i < count; ++i) {
@@ -144,6 +181,15 @@ QVariant CameraBinMetaData::metaData(const QString &key) const
void CameraBinMetaData::setMetaData(const QString &key, const QVariant &value)
{
if (key == QMediaMetaData::Orientation) {
m_values.insert(QByteArray(GST_TAG_IMAGE_ORIENTATION), toGStreamerOrientation(value));
emit QMetaDataWriterControl::metaDataChanged();
emit metaDataChanged(m_values);
return;
}
static const int count = sizeof(qt_gstreamerMetaDataKeys) / sizeof(QGstreamerMetaDataKeyLookup);
for (int i = 0; i < count; ++i) {

View File

@@ -191,8 +191,10 @@ GstEncodingContainerProfile *CameraBinRecorder::videoProfile()
GstEncodingProfile *audioProfile = m_session->audioEncodeControl()->createProfile();
GstEncodingProfile *videoProfile = m_session->videoEncodeControl()->createProfile();
gst_encoding_container_profile_add_profile(containerProfile, audioProfile);
gst_encoding_container_profile_add_profile(containerProfile, videoProfile);
if (audioProfile)
gst_encoding_container_profile_add_profile(containerProfile, audioProfile);
if (videoProfile)
gst_encoding_container_profile_add_profile(containerProfile, videoProfile);
}
return containerProfile;

View File

@@ -61,6 +61,7 @@
#include "camerabinimageprocessing.h"
#include "camerabincapturebufferformat.h"
#include "camerabincapturedestination.h"
#include "camerabinviewfindersettings.h"
#include <private/qgstreamerbushelper_p.h>
#include <private/qgstreameraudioinputselector_p.h>
@@ -240,6 +241,9 @@ 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();
return 0;
}

View File

@@ -55,6 +55,7 @@
#endif
#include "camerabinimageprocessing.h"
#include "camerabinviewfindersettings.h"
#include "camerabincapturedestination.h"
#include "camerabincapturebufferformat.h"
@@ -75,6 +76,7 @@
#include <QtGui/qdesktopservices.h>
#include <QtGui/qimage.h>
#include <QtCore/qdatetime.h>
//#define CAMERABIN_DEBUG 1
//#define CAMERABIN_DEBUG_DUMP_BIN 1
@@ -91,6 +93,8 @@
#define AUDIO_SOURCE_PROPERTY "audio-source"
#define SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY "image-capture-supported-caps"
#define SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY "video-capture-supported-caps"
#define SUPPORTED_VIEWFINDER_CAPS_PROPERTY "viewfinder-supported-caps"
#define AUDIO_CAPTURE_CAPS_PROPERTY "audio-capture-caps"
#define IMAGE_CAPTURE_CAPS_PROPERTY "image-capture-caps"
#define VIDEO_CAPTURE_CAPS_PROPERTY "video-capture-caps"
#define VIEWFINDER_CAPS_PROPERTY "viewfinder-caps"
@@ -110,10 +114,6 @@
#define PREVIEW_CAPS_4_3 \
"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
//may not work reliably at least with some webcams.
@@ -170,6 +170,7 @@ CameraBinSession::CameraBinSession(QObject *parent)
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())
@@ -246,8 +247,7 @@ 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, const QPair<int, int> &rate = qMakePair<int,int>(0,0))
{
if (resolution.isEmpty())
return gst_caps_new_any();
@@ -263,7 +263,23 @@ static GstCaps *resolutionToCaps(const QSize &resolution,
"width", G_TYPE_INT, resolution.width(),
"height", G_TYPE_INT, resolution.height(),
"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 {
caps = gst_caps_new_full (gst_structure_new ("video/x-raw-yuv",
"width", G_TYPE_INT, resolution.width(),
@@ -271,88 +287,92 @@ static GstCaps *resolutionToCaps(const QSize &resolution,
NULL),
gst_structure_new ("video/x-raw-rgb",
"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;
}
void CameraBinSession::setupCaptureResolution()
{
if (m_captureMode == QCamera::CaptureStillImage) {
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()) {
GstCaps *caps = resolutionToCaps(resolution);
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);
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);
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 {
g_object_set(m_camerabin, IMAGE_CAPTURE_CAPS_PROPERTY, GST_CAPS_ANY, NULL);
}
//on low res cameras the viewfinder resolution should not be bigger
//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);
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);
}
if (m_captureMode == QCamera::CaptureVideo) {
QSize resolution = m_videoEncodeControl->actualVideoSettings().resolution();
//qreal framerate = m_videoEncodeControl->videoSettings().frameRate();
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();
}
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
//Use the same resolution for viewfinder and video capture
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);
gst_caps_unref(caps);
} else {
g_object_set(m_camerabin, VIEWFINDER_CAPS_PROPERTY, NULL, NULL);
}
}
void CameraBinSession::setAudioCaptureCaps()
{
QAudioEncoderSettings settings = m_audioEncodeControl->audioSettings();
const int sampleRate = settings.sampleRate();
const int channelCount = settings.channelCount();
if (sampleRate == -1 && channelCount == -1)
return;
GstStructure *structure = gst_structure_new(
"audio/x-raw-int",
"endianness", G_TYPE_INT, 1234,
"signed", G_TYPE_BOOLEAN, TRUE,
"width", G_TYPE_INT, 16,
"depth", G_TYPE_INT, 16,
NULL);
if (sampleRate != -1)
gst_structure_set(structure, "rate", G_TYPE_INT, sampleRate, NULL);
if (channelCount != -1)
gst_structure_set(structure, "channels", G_TYPE_INT, channelCount, NULL);
GstCaps *caps = gst_caps_new_full(structure, NULL);
g_object_set(G_OBJECT(m_camerabin), AUDIO_CAPTURE_CAPS_PROPERTY, caps, NULL);
gst_caps_unref(caps);
}
GstElement *CameraBinSession::buildCameraSource()
{
#if CAMERABIN_DEBUG
@@ -658,14 +678,14 @@ void CameraBinSession::setState(QCamera::State newState)
GstState pending = GST_STATE_NULL;
gst_element_get_state(m_camerabin, &binState, &pending, 0);
if (captureMode() == QCamera::CaptureVideo) {
m_recorderControl->applySettings();
m_recorderControl->applySettings();
g_object_set (G_OBJECT(m_camerabin),
"video-profile",
m_recorderControl->videoProfile(),
NULL);
}
g_object_set (G_OBJECT(m_camerabin),
"video-profile",
m_recorderControl->videoProfile(),
NULL);
setAudioCaptureCaps();
setupCaptureResolution();
@@ -745,7 +765,7 @@ void CameraBinSession::setMetaData(const QMap<QByteArray, QVariant> &data)
switch(tagValue.type()) {
case QVariant::String:
gst_tag_setter_add_tags(GST_TAG_SETTER(element),
GST_TAG_MERGE_REPLACE_ALL,
GST_TAG_MERGE_REPLACE,
tagName.toUtf8().constData(),
tagValue.toString().toUtf8().constData(),
NULL);
@@ -753,18 +773,29 @@ void CameraBinSession::setMetaData(const QMap<QByteArray, QVariant> &data)
case QVariant::Int:
case QVariant::LongLong:
gst_tag_setter_add_tags(GST_TAG_SETTER(element),
GST_TAG_MERGE_REPLACE_ALL,
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_ALL,
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;
}
@@ -940,6 +971,7 @@ bool CameraBinSession::processBusMessage(const QGstreamerMessage &message)
emit stateChanged(m_state = QCamera::UnloadedState);
break;
case GST_STATE_READY:
setMetaData(m_metaData);
if (m_state != QCamera::LoadedState)
emit stateChanged(m_state = QCamera::LoadedState);
break;

View File

@@ -74,6 +74,7 @@ class CameraBinZoom;
class CameraBinCaptureDestination;
class CameraBinCaptureBufferFormat;
class QGstreamerVideoRendererInterface;
class CameraBinViewfinderSettings;
class QGstreamerElementFactory
{
@@ -136,7 +137,7 @@ public:
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; }
@@ -192,6 +193,7 @@ private slots:
private:
bool setupCameraBin();
void setupCaptureResolution();
void setAudioCaptureCaps();
static void updateBusyStatus(GObject *o, GParamSpec *p, gpointer d);
QUrl m_sink;
@@ -229,6 +231,7 @@ private:
CameraBinImageProcessing *m_imageProcessingControl;
CameraBinCaptureDestination *m_captureDestinationControl;
CameraBinCaptureBufferFormat *m_captureBufferFormatControl;
CameraBinViewfinderSettings *m_viewfinderSettingsControl;
QGstreamerBusHelper *m_busHelper;
GstBus* m_bus;

View File

@@ -160,18 +160,25 @@ QPair<int,int> CameraBinVideoEncoder::rateAsRational(qreal frameRate) const
GstEncodingProfile *CameraBinVideoEncoder::createProfile()
{
QString codec = m_actualVideoSettings.codec();
QString preset = m_actualVideoSettings.encodingOption(QStringLiteral("preset")).toString();
GstCaps *caps;
if (codec.isEmpty())
caps = gst_caps_new_any();
caps = 0;
else
caps = gst_caps_from_string(codec.toLatin1());
return (GstEncodingProfile *)gst_encoding_video_profile_new(
GstEncodingVideoProfile *profile = gst_encoding_video_profile_new(
caps,
NULL, //preset
!preset.isEmpty() ? preset.toLatin1().constData() : NULL, //preset
NULL, //restriction
0); //presence
1); //presence
gst_encoding_video_profile_set_pass(profile, 0);
gst_encoding_video_profile_set_variableframerate(profile, TRUE);
return (GstEncodingProfile *)profile;
}
QT_END_NAMESPACE

View 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

View File

@@ -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