80 static QPlatformMediaIntegration *instance();
82 explicit QPlatformMediaIntegration(QLatin1String);
83 ~QPlatformMediaIntegration() override;
84 const QPlatformMediaFormatInfo *formatInfo();
86 virtual q23::expected<QPlatformCamera *, QString> createCamera(QCamera *)
88 return q23::unexpected{ notAvailable };
90 virtual QPlatformSurfaceCapture *createScreenCapture(QScreenCapture *) {
return nullptr; }
91 virtual QPlatformSurfaceCapture *createWindowCapture(QWindowCapture *) {
return nullptr; }
93 virtual q23::expected<QPlatformAudioDecoder *, QString> createAudioDecoder(QAudioDecoder *)
95 return q23::unexpected{ notAvailable };
97 virtual q23::expected<std::unique_ptr<QPlatformAudioResampler>, QString>
98 createAudioResampler(
const QAudioFormat & ,
99 const QAudioFormat & );
100 virtual q23::expected<QPlatformMediaCaptureSession *, QString> createCaptureSession()
102 return q23::unexpected{ notAvailable };
104 virtual q23::expected<QPlatformMediaPlayer *, QString> createPlayer(QMediaPlayer *)
106 return q23::unexpected{ notAvailable };
108 virtual q23::expected<QPlatformMediaRecorder *, QString> createRecorder(QMediaRecorder *)
110 return q23::unexpected{ notAvailable };
112 virtual q23::expected<QPlatformImageCapture *, QString> createImageCapture(QImageCapture *)
114 return q23::unexpected{ notAvailable };
117 virtual q23::expected<QPlatformAudioInput *, QString> createAudioInput(QAudioInput *);
118 virtual q23::expected<QPlatformAudioOutput *, QString> createAudioOutput(QAudioOutput *);
120 virtual q23::expected<QPlatformVideoSink *, QString> createVideoSink(QVideoSink *)
122 return q23::unexpected{ notAvailable };
125 QList<QCapturableWindow> capturableWindowsList();
126 bool isCapturableWindowValid(
const QCapturableWindowPrivate &);
127 [[nodiscard]] q23::expected<QCapturableWindow, QString> capturableWindowFromQWindow(QWindow *);
129 QPlatformVideoDevices *videoDevices();
131 QPlatformCapturableWindows *capturableWindows();
133 QPlatformAudioDevices *audioDevices();
135 static QStringList availableBackends();
137 [[nodiscard]]
static QString defaultBackend();
139 static void setBackend(
const QString &backend);
141 QLatin1String name();
144 virtual QVideoFrame convertVideoFrame(QVideoFrame &,
const QVideoFrameFormat &);
146 static QLatin1String audioBackendName();
148 virtual bool isCameraSwitchingDuringRecordingSupported()
const {
return true; }
150 virtual q23::expected<QPlatformCamera *, QString>
151 createGStreamerVideoSource(QGStreamerVideoSource *,
const GstElementOrDescription &)
153 return q23::unexpected{ notAvailable };
156 virtual QGStreamerInterface *gstreamerInterface() {
return nullptr; }
158 void resetInstance();
161 virtual QPlatformMediaFormatInfo *createFormatInfo();
163 virtual QPlatformVideoDevices *createVideoDevices() {
return nullptr; }
165 virtual QPlatformCapturableWindows *createCapturableWindows() {
return nullptr; }
167 virtual std::unique_ptr<QPlatformAudioDevices> createAudioDevices();
169 inline static const QString notAvailable = QStringLiteral(
"Not available");
172 friend class QMockIntegration;
175 std::unique_ptr<QPlatformVideoDevices> m_videoDevices;
176 std::once_flag m_videoDevicesOnceFlag;
178 std::unique_ptr<QPlatformCapturableWindows> m_capturableWindows;
179 std::once_flag m_capturableWindowsOnceFlag;
181 mutable std::unique_ptr<QPlatformMediaFormatInfo> m_formatInfo;
182 mutable std::once_flag m_formatInfoOnceFlg;
184 std::unique_ptr<QPlatformAudioDevices> m_audioDevices;
185 std::once_flag m_audioDevicesOnceFlag;
187 const QLatin1String m_backendName;