qtcamzoom.h qtcamflash.h qtcamscene.h qtcamevcomp.h qtcamvideotorch.h \
qtcamwhitebalance.h qtcamcolortone.h qtcamflickerreduction.h \
qtcamnoisereduction.h qtcamiso.h qtcamaperture.h qtcamexposure.h \
- qtcammute.h qtcamnotifications.h qtcamfocus.h qtcamcaf.h qtcamautofocus.h
+ qtcammute.h qtcamnotifications.h qtcamfocus.h qtcamautofocus.h
SOURCES += qtcamconfig.cpp qtcamera.cpp qtcamscanner.cpp qtcamdevice.cpp qtcamviewfinder.cpp \
qtcammode.cpp qtcamgstreamermessagehandler.cpp qtcamgstreamermessagelistener.cpp \
qtcamzoom.cpp qtcamflash.cpp qtcamscene.cpp qtcamevcomp.cpp qtcamvideotorch.cpp \
qtcamwhitebalance.cpp qtcamcolortone.cpp qtcamflickerreduction.cpp \
qtcamnoisereduction.cpp qtcamiso.cpp qtcamaperture.cpp qtcamexposure.cpp \
- qtcammute.cpp qtcamnotifications.cpp qtcamfocus.cpp qtcamcaf.cpp qtcamautofocus.cpp
+ qtcammute.cpp qtcamnotifications.cpp qtcamfocus.cpp qtcamautofocus.cpp
-HEADERS += qtcammode_p.h qtcamdevice_p.h qtcamcapability_p.h qtcamcaf_p.h qtcamautofocus_p.h
+HEADERS += qtcammode_p.h qtcamdevice_p.h qtcamcapability_p.h qtcamautofocus_p.h
LIBS += -lgstphotography-0.10
return d_ptr->status;
}
-bool QtCamAutoFocus::start() {
+QtCamAutoFocus::Status QtCamAutoFocus::cafStatus() {
+ return d_ptr->cafStatus;
+}
+
+bool QtCamAutoFocus::startAutoFocus() {
return d_ptr->setEnabled(true);
}
-bool QtCamAutoFocus::stop() {
+bool QtCamAutoFocus::stopAutoFocus() {
return d_ptr->setEnabled(false);
}
class QtCamAutoFocus : public QObject {
Q_OBJECT
Q_PROPERTY(Status status READ status NOTIFY statusChanged);
+ Q_PROPERTY(Status cafStatus READ cafStatus NOTIFY cafStatusChanged);
Q_ENUMS(Status);
friend class QtCamAutoFocusPrivate;
~QtCamAutoFocus();
Status status();
+ Status cafStatus();
- bool start();
- bool stop();
+ bool startAutoFocus();
+ bool stopAutoFocus();
signals:
void statusChanged();
+ void cafStatusChanged();
private:
QtCamAutoFocusPrivate *d_ptr;
QObject(parent),
dev(device),
q_ptr(q),
- status(QtCamAutoFocus::None) {
+ status(QtCamAutoFocus::None),
+ cafStatus(QtCamAutoFocus::None) {
handler = new QtCamGStreamerMessageHandler(GST_PHOTOGRAPHY_AUTOFOCUS_DONE, this);
this, SLOT(handleMessage(GstMessage *)));
dev->listener()->addHandler(handler);
+
+ cafHandler = new QtCamGStreamerMessageHandler("caf-update", this);
+
+ QObject::connect(cafHandler, SIGNAL(messageSent(GstMessage *)),
+ this, SLOT(handleCafMessage(GstMessage *)));
+
+ dev->listener()->addHandler(cafHandler);
}
~QtCamAutoFocusPrivate() {
return true;
}
-public slots:
- void handleMessage(GstMessage *message) {
+ bool setStatus(QtCamAutoFocus::Status *status, GstMessage *message) {
const GstStructure *s = gst_message_get_structure(message);
int st = GST_PHOTOGRAPHY_FOCUS_STATUS_NONE;
if (gst_structure_get_int(s, "status", &st)) {
- if (status != st) {
- status = (QtCamAutoFocus::Status) st;
-
- // TODO: focus-window-rows, focus-window-columns, focus-windows and the rest
- emit q_ptr->statusChanged();
+ if (*status != st) {
+ *status = (QtCamAutoFocus::Status) st;
+ return true;
}
}
+
+ return false;
+ }
+
+public slots:
+ void handleMessage(GstMessage *message) {
+ if (setStatus(&status, message)) {
+ // TODO: focus-window-rows, focus-window-columns, focus-windows and the rest
+ emit q_ptr->statusChanged();
+ }
+ }
+
+ void handleCafMessage(GstMessage *message) {
+ if (setStatus(&cafStatus, message)) {
+ emit q_ptr->cafStatusChanged();
+ }
}
public:
QtCamDevice *dev;
QtCamAutoFocus *q_ptr;
+
QtCamAutoFocus::Status status;
+ QtCamAutoFocus::Status cafStatus;
+
QtCamGStreamerMessageHandler *handler;
+ QtCamGStreamerMessageHandler *cafHandler;
};
#endif /* QT_CAM_AUTO_FOCUS_P_H */
+++ /dev/null
-/*!
- * This file is part of CameraPlus.
- *
- * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "qtcamcaf.h"
-#include "qtcamdevice.h"
-#include "qtcamcaf_p.h"
-
-QtCamCaf::QtCamCaf(QtCamDevice *dev, QObject *parent) :
- QObject(parent), d_ptr(new QtCamCafPrivate(dev, this, this)) {
-}
-
-QtCamCaf::~QtCamCaf() {
- delete d_ptr; d_ptr = 0;
-}
-
-QtCamCaf::Status QtCamCaf::status() {
- return d_ptr->status;
-}
+++ /dev/null
-// -*- c++ -*-
-
-/*!
- * This file is part of CameraPlus.
- *
- * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef QT_CAM_CAF_H
-#define QT_CAM_CAF_H
-
-#include <QObject>
-
-class QtCamDevice;
-class QtCamCafPrivate;
-
-class QtCamCaf : public QObject {
- Q_OBJECT
- Q_PROPERTY(Status status READ status NOTIFY statusChanged);
- Q_ENUMS(Status);
-
- friend class QtCamCafPrivate;
-
-public:
- typedef enum {
- None = 0,
- Running = 1,
- Fail = 2,
- Success = 3,
- } Status;
-
- QtCamCaf(QtCamDevice *dev, QObject *parent = 0);
- ~QtCamCaf();
-
- Status status();
-
-signals:
- void statusChanged();
-
-private:
- QtCamCafPrivate *d_ptr;
-};
-
-#endif /* QT_CAM_CAF_H */
+++ /dev/null
-// -*- c++ -*-
-
-/*!
- * This file is part of CameraPlus.
- *
- * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef QT_CAM_CAF_P_H
-#define QT_CAM_CAF_P_H
-
-#include "qtcamcaf.h"
-#include "qtcamgstreamermessagehandler.h"
-#include "qtcamgstreamermessagelistener.h"
-#include "qtcamdevice.h"
-#include <QDebug>
-#ifndef GST_USE_UNSTABLE_API
-#define GST_USE_UNSTABLE_API
-#endif /* GST_USE_UNSTABLE_API */
-#include <gst/interfaces/photography.h>
-
-class QtCamCafPrivate : public QObject {
- Q_OBJECT
-
-public:
- QtCamCafPrivate(QtCamDevice *device, QtCamCaf *q, QObject *parent = 0) :
- QObject(parent),
- dev(device),
- q_ptr(q),
- status(QtCamCaf::None) {
-
- handler = new QtCamGStreamerMessageHandler("caf-update", this);
-
- QObject::connect(handler, SIGNAL(messageSent(GstMessage *)),
- this, SLOT(handleMessage(GstMessage *)));
-
- dev->listener()->addHandler(handler);
- }
-
- ~QtCamCafPrivate() {
- dev->listener()->removeHandler(handler);
- delete handler; handler = 0;
- dev = 0;
- q_ptr = 0;
- }
-
-public slots:
- void handleMessage(GstMessage *message) {
- const GstStructure *s = gst_message_get_structure(message);
- int st = GST_PHOTOGRAPHY_FOCUS_STATUS_NONE;
-
- if (gst_structure_get_int(s, "status", &st)) {
- if (status != st) {
- status = (QtCamCaf::Status) st;
-
- emit q_ptr->statusChanged();
- }
- }
- }
-
-public:
- QtCamDevice *dev;
- QtCamCaf *q_ptr;
- QtCamCaf::Status status;
- QtCamGStreamerMessageHandler *handler;
-};
-
-#endif /* QT_CAM_CAF_P_H */