From 5a5c4705dd47c7e27f49526b4ccf0d4c7c1bab5a Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sat, 29 Nov 2025 02:58:44 +0900 Subject: internal/pipewire: implement Registry::Bind This change also adds test cases for messages before this one. 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 9e3613ba..7c2b4a90 100644 --- a/internal/pipewire/core.go +++ b/internal/pipewire/core.go @@ -265,3 +265,33 @@ 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) } + +// RegistryBind is sent when the client requests to bind to the +// global object with id and use the client proxy with new_id as +// the proxy. After this call, methods can be sent to the remote +// global object and events can be received. +type RegistryBind struct { + // The [RegistryGlobal.ID] to bind to. + ID Int `json:"id"` + // the [RegistryGlobal.Type] of the global id. + Type String `json:"type"` + // The client version of the interface for type. + Version Int `json:"version"` + // The client proxy id for the global object. + NewID Int `json:"new_id"` +} + +// Size satisfies [KnownSize] with a value computed at runtime. +func (c *RegistryBind) Size() Word { + return SizePrefix + + Size(SizeInt) + + SizeString[Word](c.Type) + + Size(SizeInt) + + Size(SizeInt) +} + +// MarshalBinary satisfies [encoding.BinaryMarshaler] via [Marshal]. +func (c *RegistryBind) MarshalBinary() ([]byte, error) { return Marshal(c) } + +// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. +func (c *RegistryBind) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) } -- cgit v1.3.1