aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pipewire/core.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-25 08:52:06 +0900
committerOphestra <cat@gensokyo.uk>2025-11-25 08:52:06 +0900
commitfc3d78fe010f9e3c22a058723bf816570553c0da (patch)
tree3b618c0e5aa1501f9ff9182fdf2c2ceb12f6d34c /internal/pipewire/core.go
parent591637264a76771d36531a3e51e7db40ef853421 (diff)
internal/pipewire: implement Core::Sync
Once again, already entirely supported, the offset is not yet fully verified but makes intuitive sense. Will verify this on future occurrences of the message. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/core.go')
-rw-r--r--internal/pipewire/core.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/pipewire/core.go b/internal/pipewire/core.go
index 137c9bc5..7a052086 100644
--- a/internal/pipewire/core.go
+++ b/internal/pipewire/core.go
@@ -83,6 +83,34 @@ func (c *CoreHello) UnmarshalBinary(data []byte) error {
return err
}
+const (
+ // CoreSyncSequenceOffset is the offset to [Header.Sequence] to produce [CoreSync.Sequence].
+ CoreSyncSequenceOffset = 0x40000000
+)
+
+// The CoreSync message will result in a Done event from the server.
+// When the Done event is received, the client can be sure that all
+// operations before the Sync method have been completed.
+type CoreSync struct {
+ // The id will be returned in the Done event,
+ // ends up as [Header.ID] in a future message.
+ ID Int
+ // Usually generated automatically and will be
+ // returned in the Done event.
+ Sequence Int
+}
+
+// MarshalBinary satisfies [encoding.BinaryMarshaler] via [MarshalAppend].
+func (c *CoreSync) MarshalBinary() ([]byte, error) {
+ return MarshalAppend(make([]byte, 0, 40), c)
+}
+
+// UnmarshalBinary satisfies [encoding.BinaryUnmarshaler] via [Unmarshal].
+func (c *CoreSync) UnmarshalBinary(data []byte) error {
+ _, err := Unmarshal(data, c)
+ return err
+}
+
// CoreGetRegistry is sent when a client requests to bind to the
// registry object and list the available objects on the server.
//