Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwasmmediarecorder_p.h
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
4#ifndef QWASMMEDIARECORDER_H
5#define QWASMMEDIARECORDER_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <private/qplatformmediarecorder_p.h>
19#include <private/qplatformmediacapture_p.h>
20#include <QtCore/qglobal.h>
21#include <QtCore/qloggingcategory.h>
22#include <QElapsedTimer>
23#include <QObject>
24
25#include <private/qwasmjs_p.h>
26
28
29Q_DECLARE_LOGGING_CATEGORY(qWasmMediaRecorder)
30
31class QWasmMediaCaptureSession;
32class QIODevice;
33
35{
37public:
40
41 bool isLocationWritable(const QUrl &location) const override;
42 QMediaRecorder::RecorderState state() const override;
43 qint64 duration() const override;
44 void record(QMediaEncoderSettings &settings) override;
45 void pause() override;
46 void resume() override;
47 void stop() override;
48
49 void setCaptureSession(QPlatformMediaCaptureSession *session);
50
51 emscripten::val activeMediaStream() { return m_mediaStream; }
52
53private:
54
55 bool hasCamera() const;
56 void startAudioRecording();
57 void setStream(emscripten::val stream);
58
59 void startStream();
60 void setTrackContraints(QMediaEncoderSettings &settings, emscripten::val stream);
61 void initUserMedia();
62 void setUpFileSink();
63 void initMediaSettings();
64
65 emscripten::val m_mediaRecorder = emscripten::val::undefined();
66 emscripten::val m_mediaStream = emscripten::val::undefined();
67
68 QWasmMediaCaptureSession *m_session = nullptr;
69 QMediaEncoderSettings m_mediaSettings;
70 QIODevice *m_outputTarget;
71 std::unique_ptr<JsMediaRecorder> m_jsMediaRecorderDevice;
72
73 QScopedPointer<qstdweb::EventCallback> m_mediaStreamDataAvailable;
74 QScopedPointer<qstdweb::EventCallback> m_mediaStreamStopped;
75 QScopedPointer<qstdweb::EventCallback> m_mediaStreamError;
76 QScopedPointer<qstdweb::EventCallback> m_mediaStreamStart;
77 QScopedPointer<qstdweb::EventCallback> m_mediaStreamPause;
78 QScopedPointer<qstdweb::EventCallback> m_mediaStreamResume;
79
80 qint64 m_durationMs = 0;
81 bool m_isRecording = false;
82 QScopedPointer <QElapsedTimer> m_durationTimer;
83
84 bool m_hasMediaSettings = false;
85};
86
87QT_END_NAMESPACE
88
89#endif // QWASMMEDIARECORDER_H
The QCamera class provides interface for system camera devices.
Definition qcamera.h:25
bool isTorchModeSupported(QCamera::TorchMode mode) const override
void setManualExposureTime(float) override
void setExposureCompensation(float bias) override
void setColorTemperature(int temperature) override
int isoSensitivity() const override
void setWhiteBalanceMode(QCamera::WhiteBalanceMode mode) override
void setTorchMode(QCamera::TorchMode mode) override
bool isWhiteBalanceModeSupported(QCamera::WhiteBalanceMode mode) const override
void setExposureMode(QCamera::ExposureMode mode) override
bool setCameraFormat(const QCameraFormat &format) override
void setManualIsoSensitivity(int) override
void setFocusMode(QCamera::FocusMode mode) override
QWasmVideoOutput * cameraOutput()
void setActive(bool active) override
bool isFocusModeSupported(QCamera::FocusMode mode) const override
bool isActive() const override
void setCaptureSession(QPlatformMediaCaptureSession *session) override
bool isExposureModeSupported(QCamera::ExposureMode mode) const override
void setCamera(const QCameraDevice &camera) override
int capture(const QString &fileName) override
void setReadyForCapture(bool isReady)
bool isReadyForCapture() const override
void setImageSettings(const QImageEncoderSettings &settings) override
void setCaptureSession(QPlatformMediaCaptureSession *session)
QImageEncoderSettings imageSettings() const override
int captureToBuffer() override
void setMediaRecorder(QPlatformMediaRecorder *recorder) override
void setAudioInput(QPlatformAudioInput *input) override
void setScreenCapture(QPlatformSurfaceCapture *) override
QPlatformSurfaceCapture * screenCapture() override
void setAudioOutput(QPlatformAudioOutput *output) override
QPlatformImageCapture * imageCapture() override
QPlatformMediaRecorder * mediaRecorder() override
QPlatformSurfaceCapture * windowCapture() override
void setImageCapture(QPlatformImageCapture *imageCapture) override
void setWindowCapture(QPlatformSurfaceCapture *) override
void setCamera(QPlatformCamera *camera) override
~QWasmMediaCaptureSession() override
void setVideoPreview(QVideoSink *sink) override
QPlatformCamera * camera() override
void setVideoSource(std::string surfacetype)
QPlatformAudioInput * audioInput() const
QWasmMediaRecorder(QMediaRecorder *parent)
qint64 duration() const override
void setCaptureSession(QPlatformMediaCaptureSession *session)
QMediaRecorder::RecorderState state() const override
void record(QMediaEncoderSettings &settings) override
emscripten::val activeMediaStream()
Combined button and popup list for selecting options.
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")