diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-11-25 08:34:19 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-11-25 08:34:19 +0900 |
| commit | 591637264a76771d36531a3e51e7db40ef853421 (patch) | |
| tree | 65841f27922657c3bcca1fe23aec49dcae997ed6 /internal/pipewire/core.go | |
| parent | e77652bf89bf1f1e55174cd61a745cf13ca31e48 (diff) | |
internal/pipewire: implement Core::GetRegistry
This struct is entirely supported, so this change is very straightforward.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/core.go')
| -rw-r--r-- | internal/pipewire/core.go | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/internal/pipewire/core.go b/internal/pipewire/core.go index 9a408e2f..137c9bc5 100644 --- a/internal/pipewire/core.go +++ b/internal/pipewire/core.go @@ -68,15 +68,43 @@ const ( // CoreHello is the first message sent by a client. type CoreHello struct { - // version number of the client; PW_VERSION_CORE + // The version number of the client, usually PW_VERSION_CORE. Version Int } // MarshalBinary satisfies [encoding.BinaryMarshaler] via [MarshalAppend]. -func (c *CoreHello) MarshalBinary() ([]byte, error) { return MarshalAppend(make([]byte, 0, 24), c) } +func (c *CoreHello) MarshalBinary() ([]byte, error) { + return MarshalAppend(make([]byte, 0, 24), c) +} // UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. func (c *CoreHello) UnmarshalBinary(data []byte) error { _, err := Unmarshal(data, c) return err } + +// CoreGetRegistry is sent when a client requests to bind to the +// registry object and list the available objects on the server. +// +// Like with all bindings, first the client allocates a new proxy +// id and puts this as the new_id field. Methods and Events can +// then be sent and received on the new_id (in the message Id field). +type CoreGetRegistry struct { + // The version of the registry interface used on the client, + // usually PW_VERSION_REGISTRY. + Version Int + // The id of the new proxy with the registry interface, + // ends up as [Header.ID] in future messages. + NewID Int +} + +// MarshalBinary satisfies [encoding.BinaryMarshaler] via [MarshalAppend]. +func (c *CoreGetRegistry) MarshalBinary() ([]byte, error) { + return MarshalAppend(make([]byte, 0, 40), c) +} + +// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. +func (c *CoreGetRegistry) UnmarshalBinary(data []byte) error { + _, err := Unmarshal(data, c) + return err +} |
