Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qwasmaudiooutput_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 QWASMAUDIOOUTPUT_H
5#define QWASMAUDIOOUTPUT_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/qplatformaudiooutput_p.h>
19#include "qwasmmediaplayer_p.h"
20
21#include <emscripten/val.h>
22#include <private/qstdweb_p.h>
23#include <private/qwasmaudiosink_p.h>
24#include <QIODevice>
25#include <QObject>
26
28
29class Q_MULTIMEDIA_EXPORT QWasmAudioOutput : public QObject, public QPlatformAudioOutput
30{
32
33public:
36
38 MEDIA_ERR_ABORTED = 1,
41 MEDIA_ERR_SRC_NOT_SUPPORTED
42 };
43
44 void setAudioDevice(const QAudioDevice &device) final;
45 void setMuted(bool muted) override;
46 void setVolume(float volume) override;
47
48 void start();
49 void stop();
50 void pause();
51
52 void setSource(const QUrl &url);
53 void setSource(QIODevice *stream);
54
56 void readyChanged(bool);
57 void bufferingChanged(qint32 percent);
58 void errorOccured(qint32 code, const QString &message);
61 void durationChanged(qint64 duration);
65
66private:
67 void doElementCallbacks();
68 void createAudioElement(const std::string &id);
69
73 QScopedPointer<qstdweb::EventCallback> m_durationChangeEvent;
75 QScopedPointer<qstdweb::EventCallback> m_canPlayChangeEvent;
76 QScopedPointer<qstdweb::EventCallback> m_canPlayThroughChangeEvent;
77
78 QScopedPointer<qstdweb::EventCallback> m_playingChangeEvent;
79 QScopedPointer<qstdweb::EventCallback> m_progressChangeEvent;
83
84 QString m_source;
85 QIODevice *m_audioIODevice = nullptr;
86 emscripten::val m_audio = emscripten::val::undefined();
87 QMediaPlayer::MediaStatus m_currentMediaStatus;
88 qreal m_currentBufferedValue;
89};
90
92
93#endif // QWASMAUDIOOUTPUT_H
IOBluetoothDevice * device
The QAudioDevice class provides an information about audio devices and their functionality.
\qmltype AudioOutput \instantiates QAudioOutput
\inmodule QtCore \reentrant
Definition qiodevice.h:34
MediaStatus
\qmlproperty enumeration QtMultimedia::MediaPlayer::playbackState
\inmodule QtCore
Definition qobject.h:90
virtual void setMuted(bool)
virtual void setVolume(float)
virtual void setAudioDevice(const QAudioDevice &)
\inmodule QtCore
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qurl.h:94
void progressChanged(qint32 position)
void sizeChange(qint32 width, qint32 height)
void bufferingChanged(qint32 percent)
void errorOccured(qint32 code, const QString &message)
void stateChanged(QWasmMediaPlayer::QWasmMediaPlayerState newState)
void statusChanged(QMediaPlayer::MediaStatus status)
QWasmAudioOutput(QAudioOutput *qq)
void readyChanged(bool)
void durationChanged(qint64 duration)
void newState(QList< State > &states, const char *token, const char *lexem, bool pre)
Combined button and popup list for selecting options.
EGLStreamKHR stream
GLint GLsizei GLsizei height
GLint GLsizei width
GLuint GLsizei const GLchar * message
GLuint start
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define Q_OBJECT
#define Q_SIGNALS
int qint32
Definition qtypes.h:44
long long qint64
Definition qtypes.h:55
double qreal
Definition qtypes.h:92
QUrl url("example.com")
[constructor-url-reference]