2 * This file is part of CameraPlus.
4 * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include "qtcamcapability.h"
22 #include "qtcamdevice.h"
23 #include "qtcamdevice_p.h"
24 #include "qtcamcapability_p.h"
26 #ifndef GST_USE_UNSTABLE_API
27 #define GST_USE_UNSTABLE_API
29 #include <gst/interfaces/photography.h>
31 QtCamCapability::Capabilities QtCamCapability::capabilities(QtCamDevice *dev) {
32 if (!dev || !dev->d_ptr || !dev->d_ptr->videoSource) {
33 return QtCamCapability::Capabilities(0);
36 if (!GST_IS_PHOTOGRAPHY(dev->d_ptr->videoSource)) {
37 return QtCamCapability::Capabilities(0);
40 GstPhotography *photo = GST_PHOTOGRAPHY(dev->d_ptr->videoSource);
41 return QtCamCapability::Capabilities(gst_photography_get_capabilities(photo));
44 QtCamCapability::QtCamCapability(QtCamCapabilityPrivate *d, QObject *parent) :
45 QObject(parent), d_ptr(d) {
46 d_ptr->bin = d_ptr->dev->d_ptr->cameraBin;
47 d_ptr->src = d_ptr->dev->d_ptr->videoSource;
50 if (!d_ptr->prop.isEmpty()) {
51 d_ptr->startMonitoring();
55 QtCamCapability::~QtCamCapability() {
56 if (!d_ptr->prop.isEmpty()) {
57 d_ptr->stopMonitoring();
60 delete d_ptr; d_ptr = 0;
63 bool QtCamCapability::isSupported() {
64 return QtCamCapability::capabilities(d_ptr->dev).testFlag(d_ptr->cap);