From 83aa2ca8c533cace99d5dddfd424ddcd83d1f7f5 Mon Sep 17 00:00:00 2001 From: Mohammed Sameer Date: Sat, 8 Sep 2012 20:07:38 +0300 Subject: [PATCH] Added iso capability --- lib/lib.pro | 4 ++-- lib/qtcamcapability_p.h | 20 ++++++++++++++++++++ lib/qtcamiso.cpp | 37 +++++++++++++++++++++++++++++++++++++ lib/qtcamiso.h | 22 ++++++++++++++++++++++ 4 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 lib/qtcamiso.cpp create mode 100644 lib/qtcamiso.h diff --git a/lib/lib.pro b/lib/lib.pro index 2f330fa..e80bbc9 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -17,7 +17,7 @@ HEADERS += qtcamconfig.h qtcamera.h qtcamscanner.h qtcamdevice.h qtcamviewfinder qtcamimagemode.h qtcamvideomode.h qtcammetadata.h qtcamcapability.h \ qtcamzoom.h qtcamflash.h qtcamscene.h qtcamevcomp.h qtcamvideotorch.h \ qtcamwhitebalance.h qtcamcolortone.h qtcamflickerreduction.h \ - qtcamnoisereduction.h + qtcamnoisereduction.h qtcamiso.h SOURCES += qtcamconfig.cpp qtcamera.cpp qtcamscanner.cpp qtcamdevice.cpp qtcamviewfinder.cpp \ qtcammode.cpp qtcamgstreamermessagehandler.cpp qtcamgstreamermessagelistener.cpp \ @@ -26,7 +26,7 @@ SOURCES += qtcamconfig.cpp qtcamera.cpp qtcamscanner.cpp qtcamdevice.cpp qtcamvi qtcamimagemode.cpp qtcamvideomode.cpp qtcammetadata.cpp qtcamcapability.cpp \ qtcamzoom.cpp qtcamflash.cpp qtcamscene.cpp qtcamevcomp.cpp qtcamvideotorch.cpp \ qtcamwhitebalance.cpp qtcamcolortone.cpp qtcamflickerreduction.cpp \ - qtcamnoisereduction.cpp + qtcamnoisereduction.cpp qtcamiso.cpp HEADERS += qtcammode_p.h qtcamdevice_p.h qtcamcapability_p.h diff --git a/lib/qtcamcapability_p.h b/lib/qtcamcapability_p.h index 54d9829..4cc43a9 100644 --- a/lib/qtcamcapability_p.h +++ b/lib/qtcamcapability_p.h @@ -47,6 +47,26 @@ public: } } + bool uintValue(unsigned int *val) { + if (!src) { + return false; + } + + g_object_get(src, prop.toAscii().data(), val, NULL); + + return true; + } + + bool setUintValue(unsigned int val) { + if (!src) { + return false; + } + + g_object_set(src, prop.toAscii().data(), val, NULL); + + return true; + } + bool intValue(int *val) { if (!src) { return false; diff --git a/lib/qtcamiso.cpp b/lib/qtcamiso.cpp new file mode 100644 index 0000000..a7d2982 --- /dev/null +++ b/lib/qtcamiso.cpp @@ -0,0 +1,37 @@ +#include "qtcamiso.h" +#include "qtcamcapability_p.h" + +#define ISO_MIN 0 +#define ISO_MAX 6400 + +QtCamIso::QtCamIso(QtCamDevice *dev, QObject *parent) : + QtCamCapability(new QtCamCapabilityPrivate(dev, QtCamCapability::IsoSpeed, "iso-speed"), + parent) { + // TODO: QML +} + +QtCamIso::~QtCamIso() { + +} + +unsigned int QtCamIso::value() { + unsigned int val = 0; + + if (!d_ptr->uintValue(&val)) { + return 0; + } + + return val; +} + +bool QtCamIso::setValue(unsigned int val) { + return d_ptr->setUintValue(val); +} + +unsigned int QtCamIso::minimumValue() { + return ISO_MIN; +} + +unsigned int QtCamIso::maximumValue() { + return ISO_MAX; +} diff --git a/lib/qtcamiso.h b/lib/qtcamiso.h new file mode 100644 index 0000000..f482089 --- /dev/null +++ b/lib/qtcamiso.h @@ -0,0 +1,22 @@ +// -*- c++ -*- + +#ifndef QT_CAM_ISO_H +#define QT_CAM_ISO_H + +#include "qtcamcapability.h" + +class QtCamIso : public QtCamCapability { + Q_OBJECT + +public: + QtCamIso(QtCamDevice *dev, QObject *parent = 0); + ~QtCamIso(); + + unsigned int value(); + bool setValue(unsigned int val); + + unsigned int minimumValue(); + unsigned int maximumValue(); +}; + +#endif /* QT_CAM_ISO_H */ -- 2.25.1