File indexing completed on 2024-11-10 04:57:06

0001 /*
0002     SPDX-FileCopyrightText: 2018-2020 Red Hat Inc
0003     SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
0004     SPDX-FileContributor: Jan Grulich <jgrulich@redhat.com>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #pragma once
0010 
0011 #include <QDebug>
0012 #include <QObject>
0013 
0014 #include <pipewire/pipewire.h>
0015 #include <spa/utils/hook.h>
0016 
0017 namespace KWin
0018 {
0019 
0020 class PipeWireCore : public QObject
0021 {
0022     Q_OBJECT
0023 public:
0024     PipeWireCore();
0025 
0026     static void onCoreError(void *data, uint32_t id, int seq, int res, const char *message);
0027 
0028     ~PipeWireCore();
0029 
0030     bool init();
0031 
0032     static std::shared_ptr<PipeWireCore> self();
0033 
0034     struct pw_core *pwCore = nullptr;
0035     struct pw_context *pwContext = nullptr;
0036     struct pw_loop *pwMainLoop = nullptr;
0037     spa_hook coreListener;
0038     QString m_error;
0039 
0040     pw_core_events pwCoreEvents = {};
0041 
0042 Q_SIGNALS:
0043     void pipewireFailed(const QString &message);
0044 };
0045 
0046 } // namespace KWin