blob: 5244236be7e3fc4f0a1269bf9da8747f4569bcd7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qwasmmediadevices_p.h"
#include "private/qcameradevice_p.h"
#include "qwasmaudiosource_p.h"
#include "qwasmaudiosink_p.h"
#include "qwasmaudiodevice_p.h"
#include <AL/al.h>
#include <AL/alc.h>
QT_BEGIN_NAMESPACE
QWasmMediaDevices::QWasmMediaDevices()
: QPlatformMediaDevices()
{
auto capture = alcGetString(nullptr, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);
// present even if there is no capture device
if (capture)
m_ins.append((new QWasmAudioDevice(capture, "WebAssembly audio capture device", true,
QAudioDevice::Input))->create());
auto playback = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER);
// present even if there is no playback device
if (playback)
m_outs.append((new QWasmAudioDevice(playback, "WebAssembly audio playback device", true,
QAudioDevice::Output))->create());
}
QList<QAudioDevice> QWasmMediaDevices::audioInputs() const
{
return m_ins;
}
QList<QAudioDevice> QWasmMediaDevices::audioOutputs() const
{
return m_outs;
}
QList<QCameraDevice> QWasmMediaDevices::videoInputs() const
{
return {};
}
QPlatformAudioSource *QWasmMediaDevices::createAudioSource(const QAudioDevice &deviceInfo,
QObject *parent)
{
return new QWasmAudioSource(deviceInfo.id(), parent);
}
QPlatformAudioSink *QWasmMediaDevices::createAudioSink(const QAudioDevice &deviceInfo,
QObject *parent)
{
return new QWasmAudioSink(deviceInfo.id(), parent);
}
QT_END_NAMESPACE
|