All checks were successful
Test / Create distribution (push) Successful in 35s
Test / Sandbox (push) Successful in 2m21s
Test / Hakurei (push) Successful in 3m16s
Test / Hpkg (push) Successful in 4m12s
Test / Sandbox (race detector) (push) Successful in 4m29s
Test / Hakurei (race detector) (push) Successful in 5m13s
Test / Flake checks (push) Successful in 1m28s
This is required to achieve zero allocation (other than reflect). Signed-off-by: Ophestra <cat@gensokyo.uk>
77 lines
2.1 KiB
Go
77 lines
2.1 KiB
Go
package pipewire
|
|
|
|
/* pipewire/client.h */
|
|
|
|
const (
|
|
PW_TYPE_INTERFACE_Client = PW_TYPE_INFO_INTERFACE_BASE + "Client"
|
|
PW_CLIENT_PERM_MASK = PW_PERM_RWXM
|
|
PW_VERSION_CLIENT = 3
|
|
|
|
PW_ID_CLIENT = 1
|
|
)
|
|
|
|
const (
|
|
PW_CLIENT_CHANGE_MASK_PROPS = 1 << iota
|
|
|
|
PW_CLIENT_CHANGE_MASK_ALL = 1<<iota - 1
|
|
)
|
|
|
|
const (
|
|
PW_CLIENT_EVENT_INFO = iota
|
|
PW_CLIENT_EVENT_PERMISSIONS
|
|
PW_CLIENT_EVENT_NUM
|
|
|
|
PW_VERSION_CLIENT_EVENTS = 0
|
|
)
|
|
|
|
const (
|
|
PW_CLIENT_METHOD_ADD_LISTENER = iota
|
|
PW_CLIENT_METHOD_ERROR
|
|
PW_CLIENT_METHOD_UPDATE_PROPERTIES
|
|
PW_CLIENT_METHOD_GET_PERMISSIONS
|
|
PW_CLIENT_METHOD_UPDATE_PERMISSIONS
|
|
PW_CLIENT_METHOD_NUM
|
|
|
|
PW_VERSION_CLIENT_METHODS = 0
|
|
)
|
|
|
|
// The ClientInfo event provides client information updates.
|
|
// This is emitted when binding to a client or when the client info is updated later.
|
|
type ClientInfo struct {
|
|
// The global id of the client.
|
|
ID Int
|
|
// The changes emitted by this event.
|
|
ChangeMask Long
|
|
// Properties of this object, valid when change_mask has PW_CLIENT_CHANGE_MASK_PROPS.
|
|
Props *SPADict
|
|
}
|
|
|
|
// Size satisfies [KnownSize] with a value computed at runtime.
|
|
func (c *ClientInfo) Size() Word {
|
|
return SizePrefix +
|
|
Size(SizeInt) +
|
|
Size(SizeLong) +
|
|
c.Props.Size()
|
|
}
|
|
|
|
// MarshalBinary satisfies [encoding.BinaryMarshaler] via [Marshal].
|
|
func (c *ClientInfo) MarshalBinary() ([]byte, error) { return Marshal(c) }
|
|
|
|
// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal].
|
|
func (c *ClientInfo) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) }
|
|
|
|
// ClientUpdateProperties is used to update the properties of a client.
|
|
type ClientUpdateProperties struct {
|
|
// Props are properties to update on the client.
|
|
Props *SPADict
|
|
}
|
|
|
|
// Size satisfies [KnownSize] with a value computed at runtime.
|
|
func (c *ClientUpdateProperties) Size() Word { return SizePrefix + c.Props.Size() }
|
|
|
|
// MarshalBinary satisfies [encoding.BinaryMarshaler] via [Marshal].
|
|
func (c *ClientUpdateProperties) MarshalBinary() ([]byte, error) { return Marshal(c) }
|
|
|
|
// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal].
|
|
func (c *ClientUpdateProperties) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) }
|