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
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
24#include <emscripten.h>
25#include <emscripten/val.h>
26#include <emscripten/bind.h>
27#include <private/qstdweb_p.h>
28
30
31Q_DECLARE_LOGGING_CATEGORY(qWasmMediaRecorder)
32
34class QIODevice;
35
37{
39public:
41 ~QWasmMediaRecorder() final;
42
43 bool isLocationWritable(const QUrl &location) const override;
44 QMediaRecorder::RecorderState state() const override;
45 qint64 duration() const override;
47 void pause() override;
48 void resume() override;
49 void stop() override;
50
52
53private:
54
55 bool hasCamera() const;
56 void startAudioRecording();
57 void setStream(emscripten::val stream);
58 void streamCallback(emscripten::val event);
59 void exceptionCallback(emscripten::val event);
60 void dataAvailableCallback(emscripten::val dataEvent);
61 void startStream();
62 void setTrackContraints(QMediaEncoderSettings &settings, emscripten::val stream);
63 void initUserMedia();
64 void audioDataAvailable(emscripten::val Blob, double timeCodeDifference);
65 void setUpFileSink();
66
67 emscripten::val m_mediaRecorder = emscripten::val::undefined();
68 emscripten::val m_mediaStream = emscripten::val::undefined();
69
70 QWasmMediaCaptureSession *m_session = nullptr;
71 QMediaEncoderSettings m_mediaSettings;
72 QIODevice *m_outputTarget;
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
84private Q_SLOTS:
85};
86
88
89#endif // QWASMMEDIARECORDER_H
\inmodule QtCore \reentrant
Definition qiodevice.h:34
\inmodule QtMultimedia
RecorderState
\qmlproperty enumeration QtMultimedia::MediaRecorder::recorderState
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore
Definition qurl.h:94
qint64 duration() const override
bool isLocationWritable(const QUrl &location) const override
void setCaptureSession(QPlatformMediaCaptureSession *session)
QWasmMediaRecorder(QMediaRecorder *parent)
QMediaRecorder::RecorderState state() const override
void record(QMediaEncoderSettings &settings) override
Combined button and popup list for selecting options.
EGLStreamKHR stream
#define Q_DECLARE_LOGGING_CATEGORY(name)
GLint location
struct _cl_event * event
#define Q_OBJECT
#define Q_SLOTS
long long qint64
Definition qtypes.h:60
QSettings settings("MySoft", "Star Runner")
[0]