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
20QT_BEGIN_NAMESPACE
21class QPlatformCamera;
22class QPlatformImageCapture;
23class QPlatformMediaRecorder;
24class QAudioDevice;
25class QCameraDevice;
26class QVideoSink;
27class QPlatformAudioInput;
28class QPlatformAudioOutput;
29class QMediaCaptureSession;
30class QPlatformSurfaceCapture;
31class QPlatformVideoSource;
32
33class Q_MULTIMEDIA_EXPORT QPlatformMediaCaptureSession : public QObject
34{
35 Q_OBJECT
36public:
37 QPlatformMediaCaptureSession() = default;
38 ~QPlatformMediaCaptureSession() override;
39
40 void setCaptureSession(QMediaCaptureSession *session) { m_session = session; }
41 QMediaCaptureSession *captureSession() const { return m_session; }
42
43 virtual QPlatformCamera *camera() = 0;
44 virtual void setCamera(QPlatformCamera *) {}
45
46 virtual QPlatformSurfaceCapture *screenCapture() { return nullptr; }
47 virtual void setScreenCapture(QPlatformSurfaceCapture *) {}
48
49 virtual QPlatformSurfaceCapture *windowCapture() { return nullptr; }
50 virtual void setWindowCapture(QPlatformSurfaceCapture *) { }
51
52 virtual QPlatformImageCapture *imageCapture() = 0;
53 virtual void setImageCapture(QPlatformImageCapture *) {}
54
55 virtual QPlatformMediaRecorder *mediaRecorder() = 0;
56 virtual void setMediaRecorder(QPlatformMediaRecorder *) {}
57
58 virtual void setAudioInput(QPlatformAudioInput *input) = 0;
59
60 virtual void setVideoPreview(QVideoSink * /*sink*/) {}
61
62 virtual void setAudioOutput(QPlatformAudioOutput *) {}
63
64 // TBD: implement ordering of the sources basing on the order of adding
65 std::vector<QPlatformVideoSource *> activeVideoSources();
66
67Q_SIGNALS:
68 void cameraChanged();
69 void screenCaptureChanged();
70 void windowCaptureChanged();
71 void imageCaptureChanged();
72 void encoderChanged();
73
74private:
75 QMediaCaptureSession *m_session = nullptr;
76};
77
78QT_END_NAMESPACE
79
80
81#endif // QPLATFORMMEDIAINTERFACE_H
82

source code of qtmultimedia/src/multimedia/platform/qplatformmediacapture_p.h