summaryrefslogtreecommitdiffstats
path: root/src/plugins/multimedia/gstreamer/common/qgstreameraudiooutput_p.h
blob: 4b528d9eed566f6d347ac249e5f6e7bdadf2d028 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QGSTREAMERAUDIOOUTPUT_P_H
#define QGSTREAMERAUDIOOUTPUT_P_H

//
//  W A R N I N G
//  -------------
//
// This file is not part of the Qt API.  It exists purely as an
// implementation detail.  This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//

#include <QtCore/qobject.h>
#include <QtMultimedia/private/qmultimediautils_p.h>
#include <QtMultimedia/private/qplatformaudiooutput_p.h>
#include <QtMultimedia/private/qtmultimediaglobal_p.h>
#include <QtMultimedia/qaudiodevice.h>

#include <common/qgst_p.h>
#include <common/qgstpipeline_p.h>

QT_BEGIN_NAMESPACE

class QAudioDevice;

class QGstreamerAudioOutput : public QObject, public QPlatformAudioOutput
{
public:
    static QMaybe<QPlatformAudioOutput *> create(QAudioOutput *parent);
    ~QGstreamerAudioOutput();

    void setAudioDevice(const QAudioDevice &) override;
    void setVolume(float) override;
    void setMuted(bool) override;

    QGstElement gstElement() const { return gstAudioOutput; }

private:
    QGstreamerAudioOutput(QGstElement audioconvert, QGstElement audioresample, QGstElement volume,
                          QGstElement autoaudiosink, QAudioOutput *parent);

    QAudioDevice m_audioOutput;

    // Gst elements
    QGstPipeline gstPipeline;
    QGstBin gstAudioOutput;

    QGstElement audioQueue;
    QGstElement audioConvert;
    QGstElement audioResample;
    QGstElement audioVolume;
    QGstElement audioSink;
};

QT_END_NAMESPACE

#endif