diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-11-28 01:57:30 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-11-28 02:32:45 +0900 |
| commit | 5c12425d48e7f3aad70a4e712ec35b96653b9935 (patch) | |
| tree | 8556c3e8cb8f3ba111ae29ad9a13502cbe9f5935 /internal/pipewire/core.go | |
| parent | cbe86dc4f02bc43d00fd362692a123549ad48efc (diff) | |
internal/pipewire: implement Registry::Global
Dealing with this event reawakened my burning hatred for OOP.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/core.go')
| -rw-r--r-- | internal/pipewire/core.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/internal/pipewire/core.go b/internal/pipewire/core.go index c172d0cb..a54ec111 100644 --- a/internal/pipewire/core.go +++ b/internal/pipewire/core.go @@ -225,3 +225,33 @@ func (c *CoreGetRegistry) MarshalBinary() ([]byte, error) { return Marshal(c) } // UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. func (c *CoreGetRegistry) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) } + +// A RegistryGlobal event is emitted to notify a client about a new global object. +type RegistryGlobal struct { + // The global id. + ID Int `json:"id"` + // Permission bits. + Permissions Int `json:"permissions"` + // The type of object. + Type String `json:"type"` + // The server version of the object. + Version Int `json:"version"` + // Extra global properties. + Properties *SPADict `json:"props"` +} + +// Size satisfies [KnownSize] with a value computed at runtime. +func (c *RegistryGlobal) Size() Word { + return SizePrefix + + Size(SizeInt) + + Size(SizeInt) + + SizeString[Word](c.Type) + + Size(SizeInt) + + c.Properties.Size() +} + +// MarshalBinary satisfies [encoding.BinaryMarshaler] via [Marshal]. +func (c *RegistryGlobal) MarshalBinary() ([]byte, error) { return Marshal(c) } + +// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. +func (c *RegistryGlobal) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) } |
