detached 9d99e50

docs: clarify temporary playback format plumbing

commit
9d99e5024fe6ac2d6788fb008ece35c649749b59
author
brice · · 2026-04-10 12:44 UTC
parent
fcdec78
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
4 files · +18 -2
M internal/capi/stream_ops.go +3 -0
@@ -87,6 +87,9 @@ func (s *streamOpsImpl) CreatePlaybackStream(loopPtr unsafe.Pointer, name string
8787
8888 func (s *streamOpsImpl) ConnectPlaybackStream(streamPtr unsafe.Pointer, format portout.PlaybackFormat) error {
8989 // Validate format before making the C call.
90+ // NOTE: The format fields are not yet forwarded to PipeWire as SPA params.
91+ // This validation is a temporary guard that will be superseded once SPA
92+ // param building is wired in a subsequent task.
9093 if format.SampleRate <= 0 || format.Channels <= 0 || format.FramesPerBuffer <= 0 {
9194 return fmt.Errorf("invalid PlaybackFormat: SampleRate=%d, Channels=%d, FramesPerBuffer=%d",
9295 format.SampleRate, format.Channels, format.FramesPerBuffer)
@@ -87,6 +87,9 @@ func (s *streamOpsImpl) CreatePlaybackStream(loopPtr unsafe.Pointer, name string
87 87
88 func (s *streamOpsImpl) ConnectPlaybackStream(streamPtr unsafe.Pointer, format portout.PlaybackFormat) error {88 func (s *streamOpsImpl) ConnectPlaybackStream(streamPtr unsafe.Pointer, format portout.PlaybackFormat) error {
89 // Validate format before making the C call.89 // Validate format before making the C call.
90+ // NOTE: The format fields are not yet forwarded to PipeWire as SPA params.
91+ // This validation is a temporary guard that will be superseded once SPA
92+ // param building is wired in a subsequent task.
90 if format.SampleRate <= 0 || format.Channels <= 0 || format.FramesPerBuffer <= 0 {93 if format.SampleRate <= 0 || format.Channels <= 0 || format.FramesPerBuffer <= 0 {
91 return fmt.Errorf("invalid PlaybackFormat: SampleRate=%d, Channels=%d, FramesPerBuffer=%d",94 return fmt.Errorf("invalid PlaybackFormat: SampleRate=%d, Channels=%d, FramesPerBuffer=%d",
92 format.SampleRate, format.Channels, format.FramesPerBuffer)95 format.SampleRate, format.Channels, format.FramesPerBuffer)
M internal/capi/stream_ops_test.go +6 -1
@@ -268,7 +268,9 @@ func TestDisconnectStreamReturnsNilOnSuccess(t *testing.T) {
268268 }
269269
270270 // TestConnectPlaybackStreamRejectsMissingFormat verifies that ConnectPlaybackStream
271-// now requires a PlaybackFormat and rejects a zero-valued format.
271+// rejects a zero-valued PlaybackFormat at the StreamOps layer. This is a temporary
272+// guard; once SPA params are wired, the rejection will also cover missing/invalid
273+// SPA param construction.
272274 func TestConnectPlaybackStreamRejectsMissingFormat(t *testing.T) {
273275 origConnect := pw_stream_connect
274276 t.Cleanup(func() { pw_stream_connect = origConnect })
@@ -292,6 +294,9 @@ func TestConnectPlaybackStreamRejectsMissingFormat(t *testing.T) {
292294
293295 // TestConnectPlaybackStreamBuildsParamsFromFormat verifies that ConnectPlaybackStream
294296 // accepts a valid PlaybackFormat and calls pw_stream_connect successfully.
297+// NOTE: The format is not yet forwarded to PipeWire as SPA params; this test
298+// only confirms that the format is accepted at the seam. A subsequent task
299+// will add tests verifying that the format values reach the C call.
295300 func TestConnectPlaybackStreamBuildsParamsFromFormat(t *testing.T) {
296301 origConnect := pw_stream_connect
297302 t.Cleanup(func() { pw_stream_connect = origConnect })
@@ -268,7 +268,9 @@ func TestDisconnectStreamReturnsNilOnSuccess(t *testing.T) {
268 }268 }
269 269
270 // TestConnectPlaybackStreamRejectsMissingFormat verifies that ConnectPlaybackStream270 // TestConnectPlaybackStreamRejectsMissingFormat verifies that ConnectPlaybackStream
271-// now requires a PlaybackFormat and rejects a zero-valued format.271+// rejects a zero-valued PlaybackFormat at the StreamOps layer. This is a temporary
272+// guard; once SPA params are wired, the rejection will also cover missing/invalid
273+// SPA param construction.
272 func TestConnectPlaybackStreamRejectsMissingFormat(t *testing.T) {274 func TestConnectPlaybackStreamRejectsMissingFormat(t *testing.T) {
273 origConnect := pw_stream_connect275 origConnect := pw_stream_connect
274 t.Cleanup(func() { pw_stream_connect = origConnect })276 t.Cleanup(func() { pw_stream_connect = origConnect })
@@ -292,6 +294,9 @@ func TestConnectPlaybackStreamRejectsMissingFormat(t *testing.T) {
292 294
293 // TestConnectPlaybackStreamBuildsParamsFromFormat verifies that ConnectPlaybackStream295 // TestConnectPlaybackStreamBuildsParamsFromFormat verifies that ConnectPlaybackStream
294 // accepts a valid PlaybackFormat and calls pw_stream_connect successfully.296 // accepts a valid PlaybackFormat and calls pw_stream_connect successfully.
297+// NOTE: The format is not yet forwarded to PipeWire as SPA params; this test
298+// only confirms that the format is accepted at the seam. A subsequent task
299+// will add tests verifying that the format values reach the C call.
295 func TestConnectPlaybackStreamBuildsParamsFromFormat(t *testing.T) {300 func TestConnectPlaybackStreamBuildsParamsFromFormat(t *testing.T) {
296 origConnect := pw_stream_connect301 origConnect := pw_stream_connect
297 t.Cleanup(func() { pw_stream_connect = origConnect })302 t.Cleanup(func() { pw_stream_connect = origConnect })
M internal/core/player_rt.go +3 -0
@@ -36,6 +36,9 @@ func (b *PCMBuffer) allocate() {
3636
3737 // PlayerConfig holds configuration for the player
3838 type PlayerConfig struct {
39+ // SampleRate is carried here for upcoming runtime format negotiation.
40+ // It is not yet consumed by the core player but will be used when the
41+ // StreamOps layer builds SPA params for PipeWire.
3942 SampleRate int
4043 FramesPerBuffer int
4144 Channels int
@@ -36,6 +36,9 @@ func (b *PCMBuffer) allocate() {
36 36
37 // PlayerConfig holds configuration for the player37 // PlayerConfig holds configuration for the player
38 type PlayerConfig struct {38 type PlayerConfig struct {
39+ // SampleRate is carried here for upcoming runtime format negotiation.
40+ // It is not yet consumed by the core player but will be used when the
41+ // StreamOps layer builds SPA params for PipeWire.
39 SampleRate int42 SampleRate int
40 FramesPerBuffer int43 FramesPerBuffer int
41 Channels int44 Channels int
M internal/ports/out/stream_ops.go +6 -1
@@ -3,6 +3,10 @@ package out
33 import "unsafe"
44
55 // PlaybackFormat describes the audio format for a playback stream.
6+// The fields are carried through the public API and core config now so the
7+// plumbing is in place for upcoming runtime format negotiation. The values
8+// are not yet forwarded to PipeWire; that will happen when SPA param
9+// building is wired in a subsequent task.
610 type PlaybackFormat struct {
711 SampleRate int
812 Channels int
@@ -19,7 +23,8 @@ type StreamOps interface {
1923 CreatePlaybackStream(loopPtr unsafe.Pointer, name string, onProcess func()) (streamPtr unsafe.Pointer, err error)
2024
2125 // ConnectPlaybackStream connects the stream for playback output using the
22- // given format. Returns an error if the format is invalid or the C call fails.
26+ // given format. The format is currently validated but not yet forwarded to
27+ // PipeWire as SPA params; that wiring will happen in a subsequent task.
2328 ConnectPlaybackStream(streamPtr unsafe.Pointer, format PlaybackFormat) error
2429
2530 // SetStreamActive activates or deactivates the stream.
@@ -3,6 +3,10 @@ package out
3 import "unsafe"3 import "unsafe"
4 4
5 // PlaybackFormat describes the audio format for a playback stream.5 // PlaybackFormat describes the audio format for a playback stream.
6+// The fields are carried through the public API and core config now so the
7+// plumbing is in place for upcoming runtime format negotiation. The values
8+// are not yet forwarded to PipeWire; that will happen when SPA param
9+// building is wired in a subsequent task.
6 type PlaybackFormat struct {10 type PlaybackFormat struct {
7 SampleRate int11 SampleRate int
8 Channels int12 Channels int
@@ -19,7 +23,8 @@ type StreamOps interface {
19 CreatePlaybackStream(loopPtr unsafe.Pointer, name string, onProcess func()) (streamPtr unsafe.Pointer, err error)23 CreatePlaybackStream(loopPtr unsafe.Pointer, name string, onProcess func()) (streamPtr unsafe.Pointer, err error)
20 24
21 // ConnectPlaybackStream connects the stream for playback output using the25 // ConnectPlaybackStream connects the stream for playback output using the
22- // given format. Returns an error if the format is invalid or the C call fails.26+ // given format. The format is currently validated but not yet forwarded to
27+ // PipeWire as SPA params; that wiring will happen in a subsequent task.
23 ConnectPlaybackStream(streamPtr unsafe.Pointer, format PlaybackFormat) error28 ConnectPlaybackStream(streamPtr unsafe.Pointer, format PlaybackFormat) error
24 29
25 // SetStreamActive activates or deactivates the stream.30 // SetStreamActive activates or deactivates the stream.

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 8

↑↓ moveenter openesc close