Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qwasmmediacapturesession.cpp
Go to the documentation of this file.
1// Copyright (C) 2022 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
6
7#include "qwasmcamera_p.h"
8#include <private/qplatformmediadevices_p.h>
9#include <private/qplatformmediaintegration_p.h>
10#include <private/qwasmmediadevices_p.h>
11
12Q_LOGGING_CATEGORY(qWasmMediaCaptureSession, "qt.multimedia.wasm.capturesession")
13
15{
16 QWasmMediaDevices *wasmMediaDevices = static_cast<QWasmMediaDevices *>(QPlatformMediaIntegration::instance()->mediaDevices());
17 wasmMediaDevices->initDevices();
18}
19
21
23{
24 return m_camera.data();
25}
26
28{
29 if (!camera) {
30 if (m_camera == nullptr)
31 return;
32 m_camera.reset(nullptr);
33 } else {
34 QWasmCamera *wasmCamera = static_cast<QWasmCamera *>(camera);
35 if (m_camera.data() == wasmCamera)
36 return;
37 m_camera.reset(wasmCamera);
38 m_camera->setCaptureSession(this);
39 }
41}
42
47
49{
50 if (m_imageCapture == imageCapture)
51 return;
52
53 if (m_imageCapture)
54 m_imageCapture->setCaptureSession(nullptr);
55
56 m_imageCapture = static_cast<QWasmImageCapture *>(imageCapture);
57
58 if (m_imageCapture) {
59 m_imageCapture->setCaptureSession(this);
60
61 m_imageCapture->setReadyForCapture(true);
63 }
64}
65
70
72{
73 if (m_mediaRecorder == mediaRecorder)
74 return;
75
76 if (m_mediaRecorder)
77 m_mediaRecorder->setCaptureSession(nullptr);
78
79 m_mediaRecorder = static_cast<QWasmMediaRecorder *>(mediaRecorder);
80
81 if (m_mediaRecorder)
82 m_mediaRecorder->setCaptureSession(this);
83}
84
86{
87 if (m_audioInput == input)
88 return;
89
90 m_needsAudio = (bool)input;
91 m_audioInput = input;
92}
93
95{
96 return m_needsAudio;
97}
98
100{
101 if (m_wasmSink == sink)
102 return;
103 m_wasmSink = sink;
104}
105
107{
108 if (m_audioOutput == output)
109 return;
110 m_audioOutput = output;
111}
static QPlatformMediaIntegration * instance()
T * data() const noexcept
Returns the value of the pointer referenced by this object.
void reset(T *other=nullptr) noexcept(noexcept(Cleanup::cleanup(std::declval< T * >())))
Deletes the existing object it is pointing to (if any), and sets its pointer to other.
The QVideoSink class represents a generic sink for video data.
Definition qvideosink.h:22
void setCaptureSession(QPlatformMediaCaptureSession *session) override
void setReadyForCapture(bool isReady)
void setCaptureSession(QPlatformMediaCaptureSession *session)
void setMediaRecorder(QPlatformMediaRecorder *recorder) override
void setAudioInput(QPlatformAudioInput *input) override
void setAudioOutput(QPlatformAudioOutput *output) override
QPlatformImageCapture * imageCapture() override
QPlatformMediaRecorder * mediaRecorder() override
void setImageCapture(QPlatformImageCapture *imageCapture) override
void setCamera(QPlatformCamera *camera) override
~QWasmMediaCaptureSession() override
void setVideoPreview(QVideoSink *sink) override
QPlatformCamera * camera() override
void setCaptureSession(QPlatformMediaCaptureSession *session)
QCamera * camera
Definition camera.cpp:19
QImageCapture * imageCapture
Definition camera.cpp:21
#define Q_LOGGING_CATEGORY(name,...)
GLsizei GLenum GLboolean sink
GLenum GLenum GLenum input
#define emit
QT_BEGIN_NAMESPACE typedef uchar * output