aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pipewire/core.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-29 02:58:44 +0900
committerOphestra <cat@gensokyo.uk>2025-11-29 03:01:53 +0900
commit5a5c4705dd47c7e27f49526b4ccf0d4c7c1bab5a (patch)
treea4f01207e10d1a6f5b545f3e54eaddbac3e12ef8 /internal/pipewire/core.go
parentf703aa20a599529aace054ef8befc5128afb59e2 (diff)
internal/pipewire: implement Registry::Bind
This change also adds test cases for messages before this one. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/core.go')
-rw-r--r--internal/pipewire/core.go30
1 files changed, 30 insertions, 0 deletions
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) }