File indexing completed on 2024-05-19 13:23:46

0001 /*
0002     SPDX-FileCopyrightText: 2016 David Rosca <nowrep@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef SERVER_H
0008 #define SERVER_H
0009 
0010 #include <QObject>
0011 #include <pulse/introspect.h>
0012 
0013 namespace QPulseAudio
0014 {
0015 class Sink;
0016 class Source;
0017 class Context;
0018 
0019 class Server : public QObject
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     explicit Server(Context *context);
0025 
0026     Sink *defaultSink() const;
0027     void setDefaultSink(Sink *sink);
0028 
0029     Source *defaultSource() const;
0030     void setDefaultSource(Source *source);
0031 
0032     void reset();
0033     void update(const pa_server_info *info);
0034 
0035     bool isPipeWire() const;
0036 
0037 Q_SIGNALS:
0038     void defaultSinkChanged(Sink *sink);
0039     void defaultSourceChanged(Source *source);
0040     void updated();
0041 
0042 private:
0043     void updateDefaultDevices();
0044 
0045     QString m_defaultSinkName;
0046     QString m_defaultSourceName;
0047     Sink *m_defaultSink = nullptr;
0048     Source *m_defaultSource = nullptr;
0049     bool m_isPipeWire = false;
0050 };
0051 
0052 } // QPulseAudio
0053 
0054 #endif // CONTEXT_H