4#ifndef QWASMMEDIADEVICES_H
5#define QWASMMEDIADEVICES_H
18#include <private/qplatformaudiodevices_p.h>
20#include <private/qplatformvideodevices_p.h>
23#include <QtCore/private/qstdweb_p.h>
25#include <qaudiodevice.h>
26#include <qcameradevice.h>
28#include <QtCore/qloggingcategory.h>
30#include <emscripten.h>
31#include <emscripten/val.h>
32#include <emscripten/bind.h>
42class QWasmAudioEngine;
68 QObject *parent)
override;
70 QObject *parent)
override;
99 void updateCameraDevices();
100 void enumerateDevices();
101 void watchPermission(
const char *permissionName);
102 void parseDevices(emscripten::val devices);
103 void insertFallbackAudioOutput();
104 QByteArray findDefaultDeviceId(emscripten::val devices, std::string_view deviceKind)
const;
105 static void applyDefaultDevice(QList<QAudioDevice> &audioDevices,
106 const QByteArray &defaultDeviceId);
107 static void applyDefaultDevice(QList<QCameraDevice> &cameraDevices,
108 const QByteArray &defaultDeviceId);
111 QList<QAudioDevice> m_audioOutputs;
112 QList<QAudioDevice> m_audioInputs;
113 QList<QCameraDevice> m_cameraDevices;
115 std::unique_ptr<qstdweb::EventCallback> m_deviceChangedCallback;
116 std::vector<std::unique_ptr<qstdweb::EventCallback>> m_permissionChangedCallbacks;
117 bool m_permissionWatchStarted =
false;
119 bool m_videoInputsAdded =
false;
120 bool m_audioInputsAdded =
false;
121 bool m_audioOutputsAdded =
false;
123 bool m_initDone =
false;
124 emscripten::val devicesList;
The QAudioDevice class provides an information about audio devices and their functionality.
The QCameraDevice class provides general information about camera devices.
QPlatformAudioSink * createAudioSink(const QAudioDevice &, const QAudioFormat &, QObject *parent) override
QList< QAudioDevice > findAudioOutputs() const override
QList< QAudioDevice > findAudioInputs() const override
QPlatformAudioSource * createAudioSource(const QAudioDevice &, const QAudioFormat &, QObject *parent) override
void connectNotify(const QMetaMethod &signal) override
QLatin1String backendName() const override
bool hasCallbackApi() const override
void connectNotify(const QMetaMethod &signal) override
QList< QCameraDevice > findVideoInputs() const override
std::string effectiveDeviceId(const std::string &deviceId, const std::string &deviceKind)
bool containsDeviceId(const DeviceList &devices, const QByteArray &deviceId)
constexpr std::string_view s_communicationsDeviceId
constexpr std::string_view s_defaultDeviceId
std::string stringProperty(const emscripten::val &mediaDevice, const char *property)
bool isAliasDeviceId(std::string_view deviceId)
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcQIORing)