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
4#ifndef QGSTREAMERAUDIOINPUT_P_H
5#define QGSTREAMERAUDIOINPUT_P_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/qtmultimediaglobal_p.h>
19#include <private/qmultimediautils_p.h>
20#include <qaudiodevice.h>
21
22#include <QtCore/qobject.h>
23
24#include <qgst_p.h>
25#include <qgstpipeline_p.h>
26#include <private/qplatformaudioinput_p.h>
27
28QT_BEGIN_NAMESPACE
29
30class QGstreamerMessage;
31class QAudioDevice;
32
33class Q_MULTIMEDIA_EXPORT QGstreamerAudioInput : public QObject, public QPlatformAudioInput
34{
35 Q_OBJECT
36
37public:
38 static QMaybe<QPlatformAudioInput *> create(QAudioInput *parent);
39 ~QGstreamerAudioInput();
40
41 int volume() const;
42 bool isMuted() const;
43
44 bool setAudioInput(const QAudioDevice &);
45 QAudioDevice audioInput() const;
46
47 void setAudioDevice(const QAudioDevice &) override;
48 void setVolume(float volume) override;
49 void setMuted(bool muted) override;
50
51 QGstElement gstElement() const { return gstAudioInput; }
52
53Q_SIGNALS:
54 void mutedChanged(bool);
55 void volumeChanged(int);
56
57private:
58 QGstreamerAudioInput(QGstElement autoaudiosrc, QGstElement volume, QAudioInput *parent);
59
60 float m_volume = 1.;
61 bool m_muted = false;
62
63 QAudioDevice m_audioDevice;
64
65 // Gst elements
66 QGstBin gstAudioInput;
67
68 QGstElement audioSrc;
69 QGstElement audioVolume;
70};
71
72QT_END_NAMESPACE
73
74#endif
75

source code of qtmultimedia/src/plugins/multimedia/gstreamer/common/qgstreameraudioinput_p.h