internal/pipewire: implement Core::BoundProps
Some checks failed
Test / Create distribution (push) Successful in 41s
Test / Sandbox (push) Failing after 1m17s
Test / Hakurei (push) Failing after 1m53s
Test / Sandbox (race detector) (push) Failing after 2m15s
Test / Hpkg (push) Failing after 2m22s
Test / Hakurei (race detector) (push) Failing after 3m48s
Test / Flake checks (push) Has been skipped

Very straightforward type, everything is already supported.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
Ophestra 2025-11-25 18:37:50 +09:00
parent 14e33f17e5
commit 662797f398
Signed by: cat
SSH Key Fingerprint: SHA256:wr6yH7sDDbUFi81k/GsIGwpM3O2QrwqYlLF26CcJa4w
6 changed files with 57 additions and 0 deletions

View File

@ -7,6 +7,8 @@ import (
) )
func TestClientUpdateProperties(t *testing.T) { func TestClientUpdateProperties(t *testing.T) {
t.Parallel()
encodingTestCases[pipewire.ClientUpdateProperties, *pipewire.ClientUpdateProperties]{ encodingTestCases[pipewire.ClientUpdateProperties, *pipewire.ClientUpdateProperties]{
{"sample", []byte(sendmsg00Message01POD), pipewire.ClientUpdateProperties{Props: &pipewire.SPADict{NItems: 0x1e, Items: []pipewire.SPADictItem{ {"sample", []byte(sendmsg00Message01POD), pipewire.ClientUpdateProperties{Props: &pipewire.SPADict{NItems: 0x1e, Items: []pipewire.SPADictItem{
{Key: "remote.intention", Value: "manager"}, {Key: "remote.intention", Value: "manager"},

View File

@ -111,6 +111,26 @@ func (c *CoreInfo) UnmarshalBinary(data []byte) error {
return err return err
} }
// The CoreBoundProps event is emitted when a local object ID is bound to a global ID.
// It is emitted before the global becomes visible in the registry.
type CoreBoundProps struct {
// A proxy id.
ID Int
// The global_id as it will appear in the registry.
GlobalID Int
// The properties of the global.
Props *SPADict
}
// MarshalBinary satisfies [encoding.BinaryMarshaler] via [Marshal].
func (c *CoreBoundProps) MarshalBinary() ([]byte, error) { return Marshal(c) }
// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal].
func (c *CoreBoundProps) UnmarshalBinary(data []byte) error {
_, err := Unmarshal(data, c)
return err
}
// CoreHello is the first message sent by a client. // CoreHello is the first message sent by a client.
type CoreHello struct { type CoreHello struct {
// The version number of the client, usually PW_VERSION_CORE. // The version number of the client, usually PW_VERSION_CORE.

View File

@ -7,6 +7,8 @@ import (
) )
func TestFooterCoreGeneration(t *testing.T) { func TestFooterCoreGeneration(t *testing.T) {
t.Parallel()
encodingTestCases[pipewire.Footer[pipewire.FooterCoreGeneration], *pipewire.Footer[pipewire.FooterCoreGeneration]]{ encodingTestCases[pipewire.Footer[pipewire.FooterCoreGeneration], *pipewire.Footer[pipewire.FooterCoreGeneration]]{
{"sample", []byte(recvmsg00Message00Footer), pipewire.Footer[pipewire.FooterCoreGeneration]{ {"sample", []byte(recvmsg00Message00Footer), pipewire.Footer[pipewire.FooterCoreGeneration]{
Opcode: pipewire.FOOTER_CORE_OPCODE_GENERATION, Opcode: pipewire.FOOTER_CORE_OPCODE_GENERATION,
@ -16,6 +18,8 @@ func TestFooterCoreGeneration(t *testing.T) {
} }
func TestCoreInfo(t *testing.T) { func TestCoreInfo(t *testing.T) {
t.Parallel()
encodingTestCases[pipewire.CoreInfo, *pipewire.CoreInfo]{ encodingTestCases[pipewire.CoreInfo, *pipewire.CoreInfo]{
{"sample", []byte(recvmsg00Message00POD), pipewire.CoreInfo{ {"sample", []byte(recvmsg00Message00POD), pipewire.CoreInfo{
ID: 0, ID: 0,
@ -61,7 +65,28 @@ func TestCoreInfo(t *testing.T) {
}.run(t) }.run(t)
} }
func TestCoreBoundProps(t *testing.T) {
t.Parallel()
encodingTestCases[pipewire.CoreBoundProps, *pipewire.CoreBoundProps]{
{"sample", []byte(recvmsg00Message01POD), pipewire.CoreBoundProps{
ID: pipewire.PW_ID_CLIENT,
GlobalID: 34,
Props: &pipewire.SPADict{NItems: 7, Items: []pipewire.SPADictItem{
{Key: "object.serial", Value: "34"},
{Key: "module.id", Value: "2"},
{Key: "pipewire.protocol", Value: "protocol-native"},
{Key: "pipewire.sec.pid", Value: "1443"},
{Key: "pipewire.sec.uid", Value: "1000"},
{Key: "pipewire.sec.gid", Value: "100"},
{Key: "pipewire.sec.socket", Value: "pipewire-0-manager"}},
}}, nil},
}.run(t)
}
func TestCoreHello(t *testing.T) { func TestCoreHello(t *testing.T) {
t.Parallel()
encodingTestCases[pipewire.CoreHello, *pipewire.CoreHello]{ encodingTestCases[pipewire.CoreHello, *pipewire.CoreHello]{
{"sample", []byte(sendmsg00Message00POD), pipewire.CoreHello{ {"sample", []byte(sendmsg00Message00POD), pipewire.CoreHello{
Version: pipewire.PW_VERSION_CORE, Version: pipewire.PW_VERSION_CORE,
@ -70,6 +95,8 @@ func TestCoreHello(t *testing.T) {
} }
func TestCoreSync(t *testing.T) { func TestCoreSync(t *testing.T) {
t.Parallel()
encodingTestCases[pipewire.CoreSync, *pipewire.CoreSync]{ encodingTestCases[pipewire.CoreSync, *pipewire.CoreSync]{
{"sample", []byte(sendmsg00Message03POD), pipewire.CoreSync{ {"sample", []byte(sendmsg00Message03POD), pipewire.CoreSync{
ID: pipewire.PW_ID_CORE, ID: pipewire.PW_ID_CORE,
@ -79,6 +106,8 @@ func TestCoreSync(t *testing.T) {
} }
func TestCoreGetRegistry(t *testing.T) { func TestCoreGetRegistry(t *testing.T) {
t.Parallel()
encodingTestCases[pipewire.CoreGetRegistry, *pipewire.CoreGetRegistry]{ encodingTestCases[pipewire.CoreGetRegistry, *pipewire.CoreGetRegistry]{
{"sample", []byte(sendmsg00Message02POD), pipewire.CoreGetRegistry{ {"sample", []byte(sendmsg00Message02POD), pipewire.CoreGetRegistry{
Version: pipewire.PW_VERSION_REGISTRY, Version: pipewire.PW_VERSION_REGISTRY,

View File

@ -41,6 +41,12 @@ func TestHeader(t *testing.T) {
Size: 0x6b8, Sequence: 0, FileCount: 0, Size: 0x6b8, Sequence: 0, FileCount: 0,
}, nil}, }, nil},
{"PW_CORE_EVENT_BOUND_PROPS", []byte(recvmsg00Message01Header), pipewire.Header{
ID: pipewire.PW_ID_CORE,
Opcode: pipewire.PW_CORE_EVENT_BOUND_PROPS,
Size: 0x198, Sequence: 1, FileCount: 0,
}, nil},
{"PW_SECURITY_CONTEXT_METHOD_CREATE", []byte{ {"PW_SECURITY_CONTEXT_METHOD_CREATE", []byte{
// Id // Id
3, 0, 0, 0, 3, 0, 0, 0,

Binary file not shown.

Binary file not shown.