1 /* Webcamoid, webcam capture application. 2 * Copyright (C) 2016 Gonzalo Exequiel Pedone 3 * 4 * Webcamoid is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * Webcamoid is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with Webcamoid. If not, see <http://www.gnu.org/licenses/>. 16 * 17 * Web-Site: http://webcamoid.github.io/ 18 */ 19 20 #ifndef CAPTUREAVFOUNDATION_H 21 #define CAPTUREAVFOUNDATION_H 22 23 #include "capture.h" 24 25 class CaptureAvFoundationPrivate; 26 class QWaitCondition; 27 class QMutex; 28 29 class CaptureAvFoundation: public Capture 30 { 31 Q_OBJECT 32 33 public: 34 CaptureAvFoundation(QObject *parent=nullptr); 35 ~CaptureAvFoundation(); 36 37 Q_INVOKABLE QStringList webcams() const; 38 Q_INVOKABLE QString device() const; 39 Q_INVOKABLE QList<int> streams(); 40 Q_INVOKABLE QList<int> listTracks(const QString &mimeType); 41 Q_INVOKABLE QString ioMethod() const; 42 Q_INVOKABLE int nBuffers() const; 43 Q_INVOKABLE QString description(const QString &webcam) const; 44 Q_INVOKABLE QVariantList caps(const QString &webcam) const; 45 Q_INVOKABLE QString capsDescription(const AkCaps &caps) const; 46 Q_INVOKABLE QVariantList imageControls() const; 47 Q_INVOKABLE bool setImageControls(const QVariantMap &imageControls); 48 Q_INVOKABLE bool resetImageControls(); 49 Q_INVOKABLE QVariantList cameraControls() const; 50 Q_INVOKABLE bool setCameraControls(const QVariantMap &cameraControls); 51 Q_INVOKABLE bool resetCameraControls(); 52 Q_INVOKABLE AkPacket readFrame(); 53 Q_INVOKABLE quint32 modelId(const QString &webcam) const; 54 55 QMutex &mutex(); 56 QWaitCondition &frameReady(); 57 void *curFrame(); 58 59 private: 60 CaptureAvFoundationPrivate *d; 61 62 QVariantMap controlStatus(const QVariantList &controls) const; 63 64 public slots: 65 bool init(); 66 void uninit(); 67 void setDevice(const QString &device); 68 void setStreams(const QList<int> &streams); 69 void setIoMethod(const QString &ioMethod); 70 void setNBuffers(int nBuffers); 71 void resetDevice(); 72 void resetStreams(); 73 void resetIoMethod(); 74 void resetNBuffers(); 75 void reset(); 76 77 void cameraConnected(); 78 void cameraDisconnected(); 79 80 private slots: 81 void updateDevices(); 82 }; 83 84 #endif // CAPTUREAVFOUNDATION_H 85