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
qwindowsaudiosink_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists for the convenience
9// of other Qt classes. This header file may change from version to
10// version without notice, or even be removed.
11//
12// We mean it.
13//
14
15#ifndef QWINDOWSAUDIOOUTPUT_H
16#define QWINDOWSAUDIOOUTPUT_H
17
18#include <QtCore/qdebug.h>
19#include <QtCore/qelapsedtimer.h>
20#include <QtCore/qiodevice.h>
21#include <QtCore/qstring.h>
22#include <QtCore/qstringlist.h>
23#include <QtCore/qdatetime.h>
24#include <QtCore/qmutex.h>
25#include <QtCore/qtimer.h>
26#include <QtCore/qpointer.h>
27
28#include <QtMultimedia/qaudio.h>
29#include <QtMultimedia/qaudiodevice.h>
30#include <private/qaudiosystem_p.h>
31#include <qcomptr_p.h>
32#include <qwindowsresampler_p.h>
33
34#include <audioclient.h>
35#include <mmdeviceapi.h>
36
38
40
42{
44public:
45 QWindowsAudioSink(ComPtr<IMMDevice> device, QObject *parent);
47
48 void setFormat(const QAudioFormat& fmt) override;
49 QAudioFormat format() const override;
50 QIODevice* start() override;
51 void start(QIODevice* device) override;
52 void stop() override;
53 void reset() override;
54 void suspend() override;
55 void resume() override;
56 qsizetype bytesFree() const override;
57 void setBufferSize(qsizetype value) override;
58 qsizetype bufferSize() const override { return m_bufferSize; }
59 qint64 processedUSecs() const override;
60 QAudio::Error error() const override { return errorState; }
61 QAudio::State state() const override { return deviceState; }
62 void setVolume(qreal) override;
63 qreal volume() const override { return m_volume; }
64
65private:
66 friend class OutputPrivate;
67 qint64 write(const char *data, qint64 len);
68 qint64 push(const char *data, qint64 len);
69
70 bool open();
71 void close();
72
73 void deviceStateChange(QAudio::State, QAudio::Error);
74
75 void pullSource();
76 qint64 remainingPlayTimeUs();
77
78 QAudioFormat m_format;
79 QAudio::Error errorState = QAudio::NoError;
81 QAudio::State suspendedInState = QAudio::SuspendedState;
82
83 qsizetype m_bufferSize = 0;
84 qreal m_volume = 1.0;
85 QTimer *m_timer = nullptr;
86 QScopedPointer<QIODevice> m_pushSource;
87 QPointer<QIODevice> m_pullSource;
88 ComPtr<IMMDevice> m_device;
89 ComPtr<IAudioClient> m_audioClient;
90 ComPtr<IAudioRenderClient> m_renderClient;
91 QWindowsResampler m_resampler;
92};
93
95
96
97#endif // QWINDOWSAUDIOOUTPUT_H
IOBluetoothDevice * device
The QAudioFormat class stores audio stream parameter information.
\inmodule QtCore \reentrant
Definition qiodevice.h:34
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore
Definition qtimer.h:20
qint64 processedUSecs() const override
void setFormat(const QAudioFormat &fmt) override
void suspend() override
QAudioFormat format() const override
QAudio::State state() const override
qsizetype bufferSize() const override
void setVolume(qreal) override
qsizetype bytesFree() const override
void setBufferSize(qsizetype value) override
QAudio::Error error() const override
QWindowsAudioSink(ComPtr< IMMDevice > device, QObject *parent)
QIODevice * start() override
qreal volume() const override
State
Definition qaudio.h:29
@ StoppedState
Definition qaudio.h:29
@ SuspendedState
Definition qaudio.h:29
Error
Definition qaudio.h:28
@ NoError
Definition qaudio.h:28
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum GLsizei len
#define Q_OBJECT
ptrdiff_t qsizetype
Definition qtypes.h:165
long long qint64
Definition qtypes.h:60
double qreal
Definition qtypes.h:187
QVideoFrameFormat::PixelFormat fmt
file open(QIODevice::ReadOnly)
gzip write("uncompressed data")
stack push(command1)