aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pipewire
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-12-02 06:16:18 +0900
committerOphestra <cat@gensokyo.uk>2025-12-02 06:16:18 +0900
commite7a665e043a2b82cad2d61189935898d1d46f0ff (patch)
tree9409e7f1fa48e708c180d221364dc18ea9b5d54d /internal/pipewire
parentaf741f20a003d48863eb5e9f7cf71052abd4116d (diff)
internal/pipewire: handle Core::Error
This event is not encountered in the pw-container sample, but already has existing sample from an excerpt. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/pipewire')
-rw-r--r--internal/pipewire/core.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/pipewire/core.go b/internal/pipewire/core.go
index fe7fb78e..671bbd53 100644
--- a/internal/pipewire/core.go
+++ b/internal/pipewire/core.go
@@ -206,6 +206,14 @@ type CoreError struct {
Message String `json:"message"`
}
+func (c *CoreError) Error() string {
+ return "received Core::Error on" +
+ " id " + strconv.Itoa(int(c.ID)) +
+ " seq " + strconv.Itoa(int(c.Sequence)) +
+ " res " + strconv.Itoa(int(c.Result)) +
+ ": " + c.Message
+}
+
// Size satisfies [KnownSize] with a value computed at runtime.
func (c *CoreError) Size() Word {
return SizePrefix +
@@ -543,6 +551,13 @@ func (core *Core) consume(opcode byte, files []int, unmarshal func(v any) error)
// anything, and this behaviour is never mentioned in documentation
return nil
+ case PW_CORE_EVENT_ERROR:
+ var coreError CoreError
+ if err := unmarshal(&coreError); err != nil {
+ return err
+ }
+ return &coreError
+
case PW_CORE_EVENT_BOUND_PROPS:
var boundProps CoreBoundProps
if err := unmarshal(&boundProps); err != nil {