File indexing completed on 2023-09-24 08:40:15

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 
0042 private:
0043     explicit Server(Context *context);
0044 
0045     void reset();
0046     void updateDefaultDevices();
0047 
0048     class ServerPrivate *const d;
0049 
0050     friend class ServerPrivate;
0051     friend class Context;
0052     friend class ContextPrivate;
0053 };
0054 
0055 } // PulseAudioQt
0056 
0057 #endif // CONTEXT_H