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
qffmpegaudiorenderer_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 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#ifndef QFFMPEGAUDIORENDERER_P_H
4#define QFFMPEGAUDIORENDERER_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
18
19#include "qaudiobuffer.h"
20
22
23class QAudioOutput;
24class QAudioSink;
26
27namespace QFFmpeg {
28
29class AudioRenderer : public Renderer
30{
32public:
34
36
37 ~AudioRenderer() override;
38
39protected:
40 using Microseconds = std::chrono::microseconds;
48
56
63
65 {
68
69 bool isValid() const { return buffer.isValid(); }
70 qsizetype size() const { return buffer.byteCount() - offset; }
71 const char *data() const { return buffer.constData<char>() + offset; }
72 };
73
74 RenderingResult renderInternal(Frame frame) override;
75
76 void onPlaybackRateChanged() override;
77
78 int timerInterval() const override;
79
80 void onPauseChanged() override;
81
82 void freeOutput();
83
84 void updateOutput(const Codec *codec);
85
86 void initResempler(const Codec *codec);
87
88 void onDeviceChanged();
89
90 void updateVolume();
91
92 void updateSynchronization(const SynchronizationStamp &stamp, const Frame &frame);
93
94 Microseconds bufferLoadingTime(const SynchronizationStamp &syncStamp) const;
95
97
99
100private:
101 QPointer<QAudioOutput> m_output;
102 std::unique_ptr<QAudioSink> m_sink;
103 AudioTimings m_timings;
104 BufferLoadingInfo m_bufferLoadingInfo;
105 std::unique_ptr<QFFmpegResampler> m_resampler;
106 QAudioFormat m_format;
107
108 BufferedDataWithOffset m_bufferedData;
109 QIODevice *m_ioDevice = nullptr;
110
111 bool m_deviceChanged = false;
112 bool m_drained = false;
113 bool m_firstFrame = true;
114};
115
116} // namespace QFFmpeg
117
119
120#endif // QFFMPEGAUDIORENDERER_P_H
\inmodule QtMultimedia
The QAudioFormat class stores audio stream parameter information.
\qmltype AudioOutput \instantiates QAudioOutput
The QAudioSink class provides an interface for sending audio data to an audio output device.
Definition qaudiosink.h:24
Microseconds durationForBytes(qsizetype bytes) const
RenderingResult renderInternal(Frame frame) override
int timerInterval() const override
std::chrono::microseconds Microseconds
AudioRenderer(const TimeController &tc, QAudioOutput *output)
void updateSynchronization(const SynchronizationStamp &stamp, const Frame &frame)
void onAudioSinkStateChanged(QAudio::State state)
void setOutput(QAudioOutput *output)
Microseconds bufferLoadingTime(const SynchronizationStamp &syncStamp) const
void updateOutput(const Codec *codec)
void initResempler(const Codec *codec)
TimeController::TimePoint TimePoint
\inmodule QtCore \reentrant
Definition qiodevice.h:34
else opt state
[0]
State
Definition qaudio.h:29
@ IdleState
Definition qaudio.h:29
Combined button and popup list for selecting options.
QMediaFormat::AudioCodec codec
GLenum GLuint buffer
GLenum type
GLenum GLuint GLintptr offset
const GLfloat * tc
#define Q_OBJECT
ptrdiff_t qsizetype
Definition qtypes.h:165
QT_BEGIN_NAMESPACE typedef uchar * output
QFrame frame
[0]
Definition moc.h:23