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
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 void setVideoElement(emscripten::val videoElement);
55
57 void readyChanged(bool);
58 void bufferingChanged(qint32 percent);
59 void errorOccured(qint32 code, const QString &message);
62 void durationChanged(qint64 duration);
66
67private:
68 void doElementCallbacks();
69 void createAudioElement(const std::string &id);
70
71 emscripten::val videoElement();
72
73 QScopedPointer<QWasmAudioSink> m_sink;
74 QScopedPointer<qstdweb::EventCallback> m_playEvent;
75 QScopedPointer<qstdweb::EventCallback> m_endedEvent;
76 QScopedPointer<qstdweb::EventCallback> m_durationChangeEvent;
77 QScopedPointer<qstdweb::EventCallback> m_errorChangeEvent;
78 QScopedPointer<qstdweb::EventCallback> m_canPlayChangeEvent;
79 QScopedPointer<qstdweb::EventCallback> m_canPlayThroughChangeEvent;
80
81 QScopedPointer<qstdweb::EventCallback> m_playingChangeEvent;
82 QScopedPointer<qstdweb::EventCallback> m_progressChangeEvent;
83 QScopedPointer<qstdweb::EventCallback> m_pauseChangeEvent;
84 QScopedPointer<qstdweb::EventCallback> m_timeUpdateEvent;
85 QScopedPointer<qstdweb::EventCallback> m_loadedDataEvent;
86
87 QString m_source;
88 QIODevice *m_audioIODevice = nullptr;
89 emscripten::val m_audio = emscripten::val::undefined();
90 emscripten::val m_videoElement = emscripten::val::undefined();
91 QMediaPlayer::MediaStatus m_currentMediaStatus;
92 qreal m_currentBufferedValue;
93};
94
96
97#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:103
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\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:49
long long qint64
Definition qtypes.h:60
double qreal
Definition qtypes.h:187
QUrl url("example.com")
[constructor-url-reference]