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
+ qtcammute.h qtcamnotifications.h qtcamfocus.h qtcamcaf.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
+ qtcammute.cpp qtcamnotifications.cpp qtcamfocus.cpp qtcamcaf.cpp
-HEADERS += qtcammode_p.h qtcamdevice_p.h qtcamcapability_p.h
+HEADERS += qtcammode_p.h qtcamdevice_p.h qtcamcapability_p.h qtcamcaf_p.h
LIBS += -lgstphotography-0.10
--- /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 */
qDebug() << "Message" << gst_structure_get_name(s);
#endif
- QList<QtCamGStreamerMessageHandler *> list =
- map.values(gst_structure_get_name(s));
+ QList<QtCamGStreamerMessageHandler *> list = map.values(gst_structure_get_name(s));
foreach (QtCamGStreamerMessageHandler *handler, list) {
handler->handleMessage(message);