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 static void setPreferredBackend(
const QString &backend);
139 QLatin1String name();
142 virtual QVideoFrame convertVideoFrame(QVideoFrame &,
const QVideoFrameFormat &);
144 static QLatin1String audioBackendName();
146 virtual bool isCameraSwitchingDuringRecordingSupported()
const {
return true; }
148 virtual q23::expected<QPlatformCamera *, QString>
149 createGStreamerVideoSource(QGStreamerVideoSource *,
const GstElementOrDescription &)
151 return q23::unexpected{ notAvailable };
154 virtual QGStreamerInterface *gstreamerInterface() {
return nullptr; }
156 void resetInstance();
159 virtual QPlatformMediaFormatInfo *createFormatInfo();
161 virtual QPlatformVideoDevices *createVideoDevices() {
return nullptr; }
163 virtual QPlatformCapturableWindows *createCapturableWindows() {
return nullptr; }
165 virtual std::unique_ptr<QPlatformAudioDevices> createAudioDevices();
167 inline static const QString notAvailable = QStringLiteral(
"Not available");
170 friend class QMockIntegration;
173 std::unique_ptr<QPlatformVideoDevices> m_videoDevices;
174 std::once_flag m_videoDevicesOnceFlag;
176 std::unique_ptr<QPlatformCapturableWindows> m_capturableWindows;
177 std::once_flag m_capturableWindowsOnceFlag;
179 mutable std::unique_ptr<QPlatformMediaFormatInfo> m_formatInfo;
180 mutable std::once_flag m_formatInfoOnceFlg;
182 std::unique_ptr<QPlatformAudioDevices> m_audioDevices;
183 std::once_flag m_audioDevicesOnceFlag;
185 const QLatin1String m_backendName;