From 5c12425d48e7f3aad70a4e712ec35b96653b9935 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Fri, 28 Nov 2025 01:57:30 +0900 Subject: internal/pipewire: implement Registry::Global Dealing with this event reawakened my burning hatred for OOP. Signed-off-by: Ophestra --- internal/pipewire/core.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'internal/pipewire/core.go') 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) } -- cgit v1.3.1