| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#include <memory> |
| 10 |
#include <string> |
| 11 |
|
| 12 |
#include <pipewire/properties.h> |
| 13 |
|
| 14 |
namespace KODI |
| 15 |
{ |
| 16 |
namespace PIPEWIRE |
| 17 |
{ |
| 18 |
|
| 19 |
class CPipewireNode; |
| 20 |
|
| 21 |
struct PipewirePropertiesDeleter |
| 22 |
{ |
| 23 |
void operator()(pw_properties* p) { pw_properties_free(p); } |
| 24 |
}; |
| 25 |
|
| 26 |
class CPipewireGlobal |
| 27 |
{ |
| 28 |
public: |
| 29 |
CPipewireGlobal() = default; |
| 30 |
~CPipewireGlobal(); |
| 31 |
|
| 32 |
CPipewireGlobal& SetName(const std::string& name) |
| 33 |
{ |
| 34 |
m_name = name; |
| 35 |
return *this; |
| 36 |
} |
| 37 |
|
| 38 |
std::string GetName() const { return m_name; } |
| 39 |
|
| 40 |
CPipewireGlobal& SetDescription(const std::string& description) |
| 41 |
{ |
| 42 |
m_description = description; |
| 43 |
return *this; |
| 44 |
} |
| 45 |
|
| 46 |
std::string GetDescription() const { return m_description; } |
| 47 |
|
| 48 |
CPipewireGlobal& SetID(uint32_t id) |
| 49 |
{ |
| 50 |
m_id = id; |
| 51 |
return *this; |
| 52 |
} |
| 53 |
|
| 54 |
uint32_t GetID() const { return m_id; } |
| 55 |
|
| 56 |
CPipewireGlobal& SetPermissions(uint32_t permissions) |
| 57 |
{ |
| 58 |
m_permissions = permissions; |
| 59 |
return *this; |
| 60 |
} |
| 61 |
|
| 62 |
uint32_t GetPermissions() const { return m_permissions; } |
| 63 |
|
| 64 |
CPipewireGlobal& SetType(const std::string& type) |
| 65 |
{ |
| 66 |
m_type = type; |
| 67 |
return *this; |
| 68 |
} |
| 69 |
|
| 70 |
std::string GetType() const { return m_type; } |
| 71 |
|
| 72 |
CPipewireGlobal& SetVersion(uint32_t version) |
| 73 |
{ |
| 74 |
m_version = version; |
| 75 |
return *this; |
| 76 |
} |
| 77 |
|
| 78 |
uint32_t GetVersion() const { return m_version; } |
| 79 |
|
| 80 |
CPipewireGlobal& SetProperties( |
| 81 |
std::unique_ptr<pw_properties, PipewirePropertiesDeleter> properties) |
| 82 |
{ |
| 83 |
m_properties = std::move(properties); |
| 84 |
return *this; |
| 85 |
} |
| 86 |
|
| 87 |
const pw_properties& GetProperties() const { return *m_properties; } |
| 88 |
|
| 89 |
CPipewireGlobal& SetNode(std::unique_ptr<CPipewireNode> node) |
| 90 |
{ |
| 91 |
m_node = std::move(node); |
| 92 |
return *this; |
| 93 |
} |
| 94 |
|
| 95 |
CPipewireNode& GetNode() const { return *m_node; } |
| 96 |
|
| 97 |
private: |
| 98 |
std::string m_name; |
| 99 |
std::string m_description; |
| 100 |
uint32_t m_id; |
| 101 |
uint32_t m_permissions; |
| 102 |
std::string m_type; |
| 103 |
uint32_t m_version; |
| 104 |
std::unique_ptr<pw_properties, PipewirePropertiesDeleter> m_properties; |
| 105 |
std::unique_ptr<CPipewireNode> m_node; |
| 106 |
}; |
| 107 |
|
| 108 |
} |
| 109 |
} |