| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include <memory> |
| 12 |
|
| 13 |
#include <pipewire/core.h> |
| 14 |
|
| 15 |
namespace KODI |
| 16 |
{ |
| 17 |
namespace PIPEWIRE |
| 18 |
{ |
| 19 |
|
| 20 |
class CPipewireContext; |
| 21 |
|
| 22 |
class CPipewireCore |
| 23 |
{ |
| 24 |
public: |
| 25 |
explicit CPipewireCore(CPipewireContext& context); |
| 26 |
CPipewireCore() = delete; |
| 27 |
~CPipewireCore(); |
| 28 |
|
| 29 |
pw_core* Get() const { return m_core.get(); } |
| 30 |
|
| 31 |
CPipewireContext& GetContext() const { return m_context; } |
| 32 |
|
| 33 |
void Sync(); |
| 34 |
int GetSync() const { return m_sync; } |
| 35 |
|
| 36 |
private: |
| 37 |
static void OnCoreDone(void* userdata, uint32_t id, int seq); |
| 38 |
|
| 39 |
static pw_core_events CreateCoreEvents(); |
| 40 |
|
| 41 |
CPipewireContext& m_context; |
| 42 |
|
| 43 |
const pw_core_events m_coreEvents; |
| 44 |
|
| 45 |
spa_hook m_coreListener; |
| 46 |
|
| 47 |
struct PipewireCoreDeleter |
| 48 |
{ |
| 49 |
void operator()(pw_core* p) { pw_core_disconnect(p); } |
| 50 |
}; |
| 51 |
|
| 52 |
std::unique_ptr<pw_core, PipewireCoreDeleter> m_core; |
| 53 |
|
| 54 |
int m_sync; |
| 55 |
}; |
| 56 |
|
| 57 |
} |
| 58 |
} |