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 QFFMPEGAUDIOINPUT_H
4#define QFFMPEGAUDIOINPUT_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
17#include <private/qplatformaudioinput_p.h>
18#include <private/qplatformaudiobufferinput_p.h>
19#include "qffmpegthread_p.h"
20#include <qaudioinput.h>
21
22QT_BEGIN_NAMESPACE
23
24class QAudioSource;
25class QAudioBuffer;
26namespace QFFmpeg {
27class AudioSourceIO;
28}
29
30constexpr int DefaultAudioInputBufferSize = 4096;
31
32class QFFmpegAudioInput : public QPlatformAudioBufferInputBase, public QPlatformAudioInput
33{
34 // for qobject_cast
35 Q_OBJECT
36public:
37 QFFmpegAudioInput(QAudioInput *qq);
38 ~QFFmpegAudioInput();
39
40 void setAudioDevice(const QAudioDevice &/*device*/) override;
41 void setMuted(bool /*muted*/) override;
42 void setVolume(float /*volume*/) override;
43
44 void setFrameSize(int frameSize);
45 void setRunning(bool b);
46
47 int bufferSize() const;
48
49private:
50 QFFmpeg::AudioSourceIO *audioIO = nullptr;
51 std::unique_ptr<QThread> inputThread;
52};
53
54QT_END_NAMESPACE
55
56
57#endif // QPLATFORMAUDIOINPUT_H
58

source code of qtmultimedia/src/plugins/multimedia/ffmpeg/qffmpegaudioinput_p.h