| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include "PipewireProxy.h" |
| 12 |
|
| 13 |
#include <memory> |
| 14 |
#include <set> |
| 15 |
|
| 16 |
#include <pipewire/node.h> |
| 17 |
#include <spa/param/audio/iec958.h> |
| 18 |
#include <spa/param/audio/raw.h> |
| 19 |
|
| 20 |
namespace KODI |
| 21 |
{ |
| 22 |
namespace PIPEWIRE |
| 23 |
{ |
| 24 |
|
| 25 |
class CPipewire; |
| 26 |
class CPipewireRegistry; |
| 27 |
|
| 28 |
class CPipewireNode : public CPipewireProxy |
| 29 |
{ |
| 30 |
public: |
| 31 |
explicit CPipewireNode(CPipewireRegistry& registry, uint32_t id, const char* type); |
| 32 |
CPipewireNode() = delete; |
| 33 |
~CPipewireNode() override; |
| 34 |
|
| 35 |
void EnumerateFormats(); |
| 36 |
|
| 37 |
pw_node_info* GetInfo() { return m_info.get(); } |
| 38 |
|
| 39 |
std::set<spa_audio_format>& GetFormats() { return m_formats; } |
| 40 |
std::set<spa_audio_channel>& GetChannels() { return m_channels; } |
| 41 |
std::set<uint32_t>& GetRates() { return m_rates; } |
| 42 |
std::set<spa_audio_iec958_codec>& GetIEC958Codecs() { return m_iec958Codecs; } |
| 43 |
|
| 44 |
private: |
| 45 |
void Parse(uint32_t type, void* body, uint32_t size); |
| 46 |
|
| 47 |
static void Info(void* userdata, const struct pw_node_info* info); |
| 48 |
static void Param(void* userdata, |
| 49 |
int seq, |
| 50 |
uint32_t id, |
| 51 |
uint32_t index, |
| 52 |
uint32_t next, |
| 53 |
const struct spa_pod* param); |
| 54 |
|
| 55 |
static pw_node_events CreateNodeEvents(); |
| 56 |
|
| 57 |
const pw_node_events m_nodeEvents; |
| 58 |
|
| 59 |
spa_hook m_objectListener; |
| 60 |
|
| 61 |
struct PipewireNodeInfoDeleter |
| 62 |
{ |
| 63 |
void operator()(pw_node_info* p) { pw_node_info_free(p); } |
| 64 |
}; |
| 65 |
|
| 66 |
std::unique_ptr<pw_node_info, PipewireNodeInfoDeleter> m_info; |
| 67 |
|
| 68 |
std::set<spa_audio_format> m_formats; |
| 69 |
std::set<spa_audio_channel> m_channels; |
| 70 |
std::set<uint32_t> m_rates; |
| 71 |
std::set<spa_audio_iec958_codec> m_iec958Codecs; |
| 72 |
}; |
| 73 |
|
| 74 |
} |
| 75 |
} |