File indexing completed on 2024-04-21 15:32:40

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 "pulseaudioqt_export.h"
0011 #include <QObject>
0012 
0013 namespace PulseAudioQt
0014 {
0015 class Sink;
0016 class Source;
0017 class Context;
0018 
0019 class PULSEAUDIOQT_EXPORT Server : public QObject
0020 {
0021     Q_OBJECT
0022 
0023 public:
0024     ~Server();
0025 
0026     Sink *defaultSink() const;
0027     void setDefaultSink(Sink *sink);
0028 
0029     Source *defaultSource() const;
0030     void setDefaultSource(Source *source);
0031 
0032     /**
0033      * Whether PulseAudio is provided via pipewire-pulse.
0034      */
0035     bool isPipeWire() const;
0036 
0037 Q_SIGNALS:
0038     void defaultSinkChanged(PulseAudioQt::Sink *sink);
0039     void defaultSourceChanged(PulseAudioQt::Source *source);
0040     void isPipeWireChanged();
0041     void updated();
0042 
0043 private:
0044     explicit Server(Context *context);
0045 
0046     void reset();
0047     void updateDefaultDevices();
0048 
0049     class ServerPrivate *const d;
0050 
0051     friend class ServerPrivate;
0052     friend class Context;
0053     friend class ContextPrivate;
0054 };
0055 
0056 } // PulseAudioQt
0057 
0058 #endif // CONTEXT_H