diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-12-10 01:25:30 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-12-10 01:25:30 +0900 |
| commit | 0e2fb1788f48540fd7a860b8c571e3a8c1cae756 (patch) | |
| tree | cb93b12a512c77c8f423e159f2b9a50730d2a509 /internal/pipewire/core.go | |
| parent | d8417e292762eebbbe7203aa98eb34eb5c34434e (diff) | |
internal/pipewire: implement Registry::Destroy
This requires error handling infrastructure in Core that does not yet exist, so it is not exported for now. It has been manually tested via linkname against PipeWire.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/core.go')
| -rw-r--r-- | internal/pipewire/core.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/internal/pipewire/core.go b/internal/pipewire/core.go index fc3edd4e..eec62da3 100644 --- a/internal/pipewire/core.go +++ b/internal/pipewire/core.go @@ -608,6 +608,39 @@ func (registry *Registry) bind(proxy eventProxy, id, version Int) (Int, error) { ) } +// RegistryDestroy is sent to try to destroy the global object with id. +// This might fail when the client does not have permission. +type RegistryDestroy struct { + // The global id to destroy. + ID Int `json:"id"` +} + +// Opcode satisfies [Message] with a constant value. +func (c *RegistryDestroy) Opcode() byte { return PW_REGISTRY_METHOD_DESTROY } + +// FileCount satisfies [Message] with a constant value. +func (c *RegistryDestroy) FileCount() Int { return 0 } + +// Size satisfies [KnownSize] with a constant value. +func (c *RegistryDestroy) Size() Word { + return SizePrefix + + Size(SizeInt) +} + +// MarshalBinary satisfies [encoding.BinaryMarshaler] via [Marshal]. +func (c *RegistryDestroy) MarshalBinary() ([]byte, error) { return Marshal(c) } + +// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. +func (c *RegistryDestroy) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) } + +// destroy queues a [RegistryDestroy] message for the PipeWire server. +func (registry *Registry) destroy(id Int) error { + return registry.ctx.writeMessage( + registry.ID, + &RegistryDestroy{id}, + ) +} + // An UnsupportedObjectTypeError is the name of a type not known by the server [Registry]. type UnsupportedObjectTypeError string |
