internal/pipewire: implement Core::BoundProps
All checks were successful
Test / Create distribution (push) Successful in 41s
Test / Sandbox (push) Successful in 2m28s
Test / Hakurei (push) Successful in 3m26s
Test / Hpkg (push) Successful in 4m15s
Test / Sandbox (race detector) (push) Successful in 4m25s
Test / Hakurei (race detector) (push) Successful in 5m19s
Test / Flake checks (push) Successful in 1m20s
All checks were successful
Test / Create distribution (push) Successful in 41s
Test / Sandbox (push) Successful in 2m28s
Test / Hakurei (push) Successful in 3m26s
Test / Hpkg (push) Successful in 4m15s
Test / Sandbox (race detector) (push) Successful in 4m25s
Test / Hakurei (race detector) (push) Successful in 5m19s
Test / Flake checks (push) Successful in 1m20s
Very straightforward type, everything is already supported. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
14e33f17e5
commit
77f5b89a41
@ -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"},
|
||||||
|
|||||||
@ -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.
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
@ -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,
|
||||||
|
|||||||
@ -31,4 +31,9 @@ var (
|
|||||||
recvmsg00Message00POD string
|
recvmsg00Message00POD string
|
||||||
//go:embed testdata/10-recvmsg00-message00-footer
|
//go:embed testdata/10-recvmsg00-message00-footer
|
||||||
recvmsg00Message00Footer string
|
recvmsg00Message00Footer string
|
||||||
|
|
||||||
|
//go:embed testdata/11-recvmsg00-message01-header
|
||||||
|
recvmsg00Message01Header string
|
||||||
|
//go:embed testdata/12-recvmsg00-message01-POD
|
||||||
|
recvmsg00Message01POD string
|
||||||
)
|
)
|
||||||
|
|||||||
BIN
internal/pipewire/testdata/11-recvmsg00-message01-header
vendored
Normal file
BIN
internal/pipewire/testdata/11-recvmsg00-message01-header
vendored
Normal file
Binary file not shown.
BIN
internal/pipewire/testdata/12-recvmsg00-message01-POD
vendored
Normal file
BIN
internal/pipewire/testdata/12-recvmsg00-message01-POD
vendored
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user