diff --git a/internal/pipewire/core.go b/internal/pipewire/core.go index 05fd03b..407ea95 100644 --- a/internal/pipewire/core.go +++ b/internal/pipewire/core.go @@ -108,6 +108,20 @@ func (c *CoreInfo) MarshalBinary() ([]byte, error) { return Marshal(c) } // UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. func (c *CoreInfo) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) } +// The CoreDone event is emitted as a result of a client Sync method. +type CoreDone struct { + // Passed from [CoreSync.ID]. + ID Int + // Passed from [CoreSync.Sequence]. + Sequence Int +} + +// MarshalBinary satisfies [encoding.BinaryMarshaler] via [Marshal]. +func (c *CoreDone) MarshalBinary() ([]byte, error) { return Marshal(c) } + +// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal]. +func (c *CoreDone) UnmarshalBinary(data []byte) error { return Unmarshal(data, c) } + // 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 { diff --git a/internal/pipewire/core_test.go b/internal/pipewire/core_test.go index 1dc6327..7d3fad3 100644 --- a/internal/pipewire/core_test.go +++ b/internal/pipewire/core_test.go @@ -12,7 +12,12 @@ func TestFooterCoreGeneration(t *testing.T) { encodingTestCases[pipewire.Footer[pipewire.FooterCoreGeneration], *pipewire.Footer[pipewire.FooterCoreGeneration]]{ {"sample", []byte(recvmsg00Message00Footer), pipewire.Footer[pipewire.FooterCoreGeneration]{ Opcode: pipewire.FOOTER_CORE_OPCODE_GENERATION, - Payload: pipewire.FooterCoreGeneration{RegistryGeneration: 34}, + Payload: pipewire.FooterCoreGeneration{RegistryGeneration: 0x22}, + }, nil}, + + {"sample*", []byte(recvmsg00Message05Footer), pipewire.Footer[pipewire.FooterCoreGeneration]{ + Opcode: pipewire.FOOTER_CORE_OPCODE_GENERATION, + Payload: pipewire.FooterCoreGeneration{RegistryGeneration: 0x23}, }, nil}, }.run(t) } @@ -65,6 +70,17 @@ func TestCoreInfo(t *testing.T) { }.run(t) } +func TestCoreDone(t *testing.T) { + t.Parallel() + + encodingTestCases[pipewire.CoreDone, *pipewire.CoreDone]{ + {"sample", []byte(recvmsg00Message05POD), pipewire.CoreDone{ + ID: -1, + Sequence: 0, + }, nil}, + }.run(t) +} + func TestCoreBoundProps(t *testing.T) { t.Parallel() diff --git a/internal/pipewire/header_test.go b/internal/pipewire/header_test.go index 56f51c8..fba5d83 100644 --- a/internal/pipewire/header_test.go +++ b/internal/pipewire/header_test.go @@ -65,6 +65,12 @@ func TestHeader(t *testing.T) { Size: 0x7d0, Sequence: 4, FileCount: 0, }, nil}, + {"PW_CORE_EVENT_DONE", []byte(recvmsg00Message05Header), pipewire.Header{ + ID: pipewire.PW_ID_CORE, + Opcode: pipewire.PW_CORE_EVENT_DONE, + Size: 0x58, Sequence: 5, FileCount: 0, + }, nil}, + {"PW_SECURITY_CONTEXT_METHOD_CREATE", []byte{ // Id 3, 0, 0, 0, diff --git a/internal/pipewire/pipewire_test.go b/internal/pipewire/pipewire_test.go index 3d2ff05..78e44f4 100644 --- a/internal/pipewire/pipewire_test.go +++ b/internal/pipewire/pipewire_test.go @@ -51,4 +51,11 @@ var ( recvmsg00Message04Header string //go:embed testdata/18-recvmsg00-message04-POD recvmsg00Message04POD string + + //go:embed testdata/19-recvmsg00-message05-header + recvmsg00Message05Header string + //go:embed testdata/20-recvmsg00-message05-POD + recvmsg00Message05POD string + //go:embed testdata/21-recvmsg00-message05-footer + recvmsg00Message05Footer string ) diff --git a/internal/pipewire/testdata/19-recvmsg00-message05-header b/internal/pipewire/testdata/19-recvmsg00-message05-header new file mode 100644 index 0000000..41c8aa7 Binary files /dev/null and b/internal/pipewire/testdata/19-recvmsg00-message05-header differ diff --git a/internal/pipewire/testdata/20-recvmsg00-message05-POD b/internal/pipewire/testdata/20-recvmsg00-message05-POD new file mode 100644 index 0000000..bc14f3c Binary files /dev/null and b/internal/pipewire/testdata/20-recvmsg00-message05-POD differ diff --git a/internal/pipewire/testdata/21-recvmsg00-message05-footer b/internal/pipewire/testdata/21-recvmsg00-message05-footer new file mode 100644 index 0000000..92ab10b Binary files /dev/null and b/internal/pipewire/testdata/21-recvmsg00-message05-footer differ