diff options
author | Artem Dyomin <artem.dyomin@qt.io> | 2023-06-27 18:44:46 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-07-06 11:37:57 +0000 |
commit | 0a19d2a54b35957bcdbc26f654298073d4bb8cbe (patch) | |
tree | d6c019fd47fb493dbc685936542b94ac1fe5a8fd /src/plugins/multimedia/ffmpeg/qffmpegimagecapture_p.h | |
parent | db5cea8b94e90fd07d786f611de014145d19cb9a (diff) |
Implement image capturing for ScreenCapture and WindowCapture
The idea is that frames observers, ImageCapture and MediaRecorder,
should communicate with QPlatformVideoSource, not with inheritors.
The approach has been already applied for CaptureSession
and MediaRecorder (in the previous patches).
The current patch applies the approach for ImageCapture with
additional cleanup, e.g. unnecessary stuff, like cameraActiveChange,
has been eliminated.
Change-Id: Ib354b2023cf6716bd1100419cadf888fc5489d97
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit f0db56bde4875f4b4fb26f31f66441c3615e60cb)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/plugins/multimedia/ffmpeg/qffmpegimagecapture_p.h')
-rw-r--r-- | src/plugins/multimedia/ffmpeg/qffmpegimagecapture_p.h | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/plugins/multimedia/ffmpeg/qffmpegimagecapture_p.h b/src/plugins/multimedia/ffmpeg/qffmpegimagecapture_p.h index 8eef92cad..43faacf7d 100644 --- a/src/plugins/multimedia/ffmpeg/qffmpegimagecapture_p.h +++ b/src/plugins/multimedia/ffmpeg/qffmpegimagecapture_p.h @@ -24,7 +24,6 @@ QT_BEGIN_NAMESPACE class QFFmpegImageCapture : public QPlatformImageCapture - { Q_OBJECT public: @@ -40,20 +39,19 @@ public: void setCaptureSession(QPlatformMediaCaptureSession *session); +protected: + virtual int doCapture(const QString &fileName); + virtual void setupVideoSourceConnections(); + QPlatformVideoSource *videoSource() const; void updateReadyForCapture(); -public Q_SLOTS: - void cameraActiveChanged(bool active); +protected Q_SLOTS: void newVideoFrame(const QVideoFrame &frame); - void onCameraChanged(); - -protected: - virtual int doCapture(const QString &fileName); - virtual void setupCameraConnections(); - QPlatformCamera *m_camera = nullptr; + void onVideoSourceChanged(); private: QFFmpegMediaCaptureSession *m_session = nullptr; + QPointer<QPlatformVideoSource> m_videoSource; int m_lastId = 0; QImageEncoderSettings m_settings; @@ -63,9 +61,7 @@ private: QMediaMetaData metaData; }; - QQueue<PendingImage> pendingImages; - bool passImage = false; - bool cameraActive = false; + QQueue<PendingImage> m_pendingImages; bool m_isReadyForCapture = false; }; |