aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pipewire/securitycontext.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-12-07 13:54:11 +0900
committerOphestra <cat@gensokyo.uk>2025-12-07 13:54:11 +0900
commitb9b9705b520cd3effaba3dc5e94c83e36f655bc4 (patch)
treeda70316f6ac5971746d526031592cd2bfcd11143 /internal/pipewire/securitycontext.go
parent246e04214a3554826be1f4285f56044b0850102d (diff)
internal/pipewire: specify opcode and file count with message
This adds checking of FileCount while writing a message. Message encoding is relocated to an exported method to be used externally, probably for test stubbing. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire/securitycontext.go')
-rw-r--r--internal/pipewire/securitycontext.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/pipewire/securitycontext.go b/internal/pipewire/securitycontext.go
index f07d5dc9..107fe994 100644
--- a/internal/pipewire/securitycontext.go
+++ b/internal/pipewire/securitycontext.go
@@ -61,6 +61,12 @@ type SecurityContextCreate struct {
Properties *SPADict `json:"props"`
}
+// Opcode satisfies [Message] with a constant value.
+func (c *SecurityContextCreate) Opcode() byte { return PW_SECURITY_CONTEXT_METHOD_CREATE }
+
+// FileCount satisfies [Message] with a constant value.
+func (c *SecurityContextCreate) FileCount() Int { return 2 }
+
// Size satisfies [KnownSize] with a value computed at runtime.
func (c *SecurityContextCreate) Size() Word {
return SizePrefix +
@@ -106,7 +112,6 @@ func (securityContext *SecurityContext) Create(listenFd, closeFd int, props SPAD
offset := securityContext.ctx.queueFiles(closeFd, listenFd)
return securityContext.ctx.writeMessage(
securityContext.ID,
- PW_SECURITY_CONTEXT_METHOD_CREATE,
&SecurityContextCreate{ListenFd: offset + 1, CloseFd: offset + 0, Properties: &props},
)
}