| 1 | // Copyright (C) 2021 The Qt Company Ltd. | 
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only | 
| 3 | #ifndef QPLATFORMMEDIACAPTURE_H | 
| 4 | #define QPLATFORMMEDIACAPTURE_H | 
| 5 | |
| 6 | // | 
| 7 | // W A R N I N G | 
| 8 | // ------------- | 
| 9 | // | 
| 10 | // This file is not part of the Qt API. It exists purely as an | 
| 11 | // implementation detail. This header file may change from version to | 
| 12 | // version without notice, or even be removed. | 
| 13 | // | 
| 14 | // We mean it. | 
| 15 | // | 
| 16 | |
| 17 | #include <private/qtmultimediaglobal_p.h> | 
| 18 | #include <QtCore/qobject.h> | 
| 19 | |
| 20 | QT_BEGIN_NAMESPACE | 
| 21 | class QPlatformCamera; | 
| 22 | class QPlatformImageCapture; | 
| 23 | class QPlatformMediaRecorder; | 
| 24 | class QAudioDevice; | 
| 25 | class QCameraDevice; | 
| 26 | class QVideoSink; | 
| 27 | class QPlatformAudioInput; | 
| 28 | class QPlatformAudioOutput; | 
| 29 | class QMediaCaptureSession; | 
| 30 | class QPlatformSurfaceCapture; | 
| 31 | class QPlatformVideoSource; | 
| 32 | class QPlatformAudioBufferInput; | 
| 33 | class QPlatformVideoFrameInput; | 
| 34 | |
| 35 | class Q_MULTIMEDIA_EXPORT QPlatformMediaCaptureSession : public QObject | 
| 36 | { | 
| 37 | Q_OBJECT | 
| 38 | public: | 
| 39 | QPlatformMediaCaptureSession() = default; | 
| 40 | ~QPlatformMediaCaptureSession() override; | 
| 41 | |
| 42 | void setCaptureSession(QMediaCaptureSession *session) { m_session = session; } | 
| 43 | QMediaCaptureSession *captureSession() const { return m_session; } | 
| 44 | |
| 45 | virtual QPlatformCamera *camera() = 0; | 
| 46 | virtual void setCamera(QPlatformCamera *) {} | 
| 47 | |
| 48 | virtual QPlatformSurfaceCapture *screenCapture() { return nullptr; } | 
| 49 | virtual void setScreenCapture(QPlatformSurfaceCapture *) {} | 
| 50 | |
| 51 | virtual QPlatformSurfaceCapture *windowCapture() { return nullptr; } | 
| 52 | virtual void setWindowCapture(QPlatformSurfaceCapture *) { } | 
| 53 | |
| 54 | virtual QPlatformVideoFrameInput *videoFrameInput() { return nullptr; } | 
| 55 | virtual void setVideoFrameInput(QPlatformVideoFrameInput *) { } | 
| 56 | |
| 57 | virtual QPlatformImageCapture *imageCapture() = 0; | 
| 58 | virtual void setImageCapture(QPlatformImageCapture *) {} | 
| 59 | |
| 60 | virtual QPlatformMediaRecorder *mediaRecorder() = 0; | 
| 61 | virtual void setMediaRecorder(QPlatformMediaRecorder *) {} | 
| 62 | |
| 63 | virtual void setAudioInput(QPlatformAudioInput *input) = 0; | 
| 64 | |
| 65 | virtual void setAudioBufferInput(QPlatformAudioBufferInput *) { } | 
| 66 | |
| 67 | virtual void setVideoPreview(QVideoSink * /*sink*/) {} | 
| 68 | |
| 69 | virtual void setAudioOutput(QPlatformAudioOutput *) {} | 
| 70 | |
| 71 | // TBD: implement ordering of the sources basing on the order of adding | 
| 72 | std::vector<QPlatformVideoSource *> activeVideoSources(); | 
| 73 | |
| 74 | Q_SIGNALS: | 
| 75 | void cameraChanged(); | 
| 76 | void screenCaptureChanged(); | 
| 77 | void windowCaptureChanged(); | 
| 78 | void videoFrameInputChanged(); | 
| 79 | void imageCaptureChanged(); | 
| 80 | void encoderChanged(); | 
| 81 | |
| 82 | private: | 
| 83 | QMediaCaptureSession *m_session = nullptr; | 
| 84 | }; | 
| 85 | |
| 86 | QT_END_NAMESPACE | 
| 87 | |
| 88 | |
| 89 | #endif // QPLATFORMMEDIAINTERFACE_H | 
| 90 | 
