detached f2f7189

refactor: trim unused public wrapper scaffolding

commit
f2f7189c28eb6c0c806001d7d89030023d1c247b
author
brice · · 2026-04-09 08:20 UTC
parent
b35cd9f
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
5 files · +7 -83
M pipewire/context.go +0 -21
@@ -1,29 +1,8 @@
11 package pipewire
22
3-import (
4- "github.com/bnema/purego-pipewire/internal/core"
5-)
6-
73 // Context is the public interface for PipeWire context operations.
84 // Contexts manage resources and connections to the PipeWire server.
95 type Context interface {
106 Destroy()
117 Connect() (Core, error)
128 }
13-
14-// contextWrapper wraps the internal core.Context to implement the public Context interface.
15-type contextWrapper struct {
16- inner *core.Context
17-}
18-
19-func (cw contextWrapper) Destroy() {
20- cw.inner.Destroy()
21-}
22-
23-func (cw contextWrapper) Connect() (Core, error) {
24- c, err := cw.inner.Connect()
25- if err != nil {
26- return nil, err
27- }
28- return coreWrapper{inner: c}, nil
29-}
@@ -1,29 +1,8 @@
1 package pipewire1 package pipewire
2 2
3-import (
4- "github.com/bnema/purego-pipewire/internal/core"
5-)
6-
7 // Context is the public interface for PipeWire context operations.3 // Context is the public interface for PipeWire context operations.
8 // Contexts manage resources and connections to the PipeWire server.4 // Contexts manage resources and connections to the PipeWire server.
9 type Context interface {5 type Context interface {
10 Destroy()6 Destroy()
11 Connect() (Core, error)7 Connect() (Core, error)
12 }8 }
13-
14-// contextWrapper wraps the internal core.Context to implement the public Context interface.
15-type contextWrapper struct {
16- inner *core.Context
17-}
18-
19-func (cw contextWrapper) Destroy() {
20- cw.inner.Destroy()
21-}
22-
23-func (cw contextWrapper) Connect() (Core, error) {
24- c, err := cw.inner.Connect()
25- if err != nil {
26- return nil, err
27- }
28- return coreWrapper{inner: c}, nil
29-}
M pipewire/core.go +0 -27
@@ -2,8 +2,6 @@ package pipewire
22
33 import (
44 "unsafe"
5-
6- "github.com/bnema/purego-pipewire/internal/core"
75 )
86
97 // Core is the public interface for PipeWire core connection operations.
@@ -13,28 +11,3 @@ type Core interface {
1311 Registry() (Registry, error)
1412 NewStream(name string, props unsafe.Pointer) (Stream, error)
1513 }
16-
17-// coreWrapper wraps the internal core.Core to implement the public Core interface.
18-type coreWrapper struct {
19- inner *core.Core
20-}
21-
22-func (cw coreWrapper) Disconnect() {
23- cw.inner.Disconnect()
24-}
25-
26-func (cw coreWrapper) Registry() (Registry, error) {
27- r, err := cw.inner.Registry()
28- if err != nil {
29- return nil, err
30- }
31- return registryWrapper{inner: r}, nil
32-}
33-
34-func (cw coreWrapper) NewStream(name string, props unsafe.Pointer) (Stream, error) {
35- s, err := cw.inner.NewStream(name, props)
36- if err != nil {
37- return nil, err
38- }
39- return streamWrapper{inner: s}, nil
40-}
@@ -2,8 +2,6 @@ package pipewire
2 2
3 import (3 import (
4 "unsafe"4 "unsafe"
5-
6- "github.com/bnema/purego-pipewire/internal/core"
7 )5 )
8 6
9 // Core is the public interface for PipeWire core connection operations.7 // Core is the public interface for PipeWire core connection operations.
@@ -13,28 +11,3 @@ type Core interface {
13 Registry() (Registry, error)11 Registry() (Registry, error)
14 NewStream(name string, props unsafe.Pointer) (Stream, error)12 NewStream(name string, props unsafe.Pointer) (Stream, error)
15 }13 }
16-
17-// coreWrapper wraps the internal core.Core to implement the public Core interface.
18-type coreWrapper struct {
19- inner *core.Core
20-}
21-
22-func (cw coreWrapper) Disconnect() {
23- cw.inner.Disconnect()
24-}
25-
26-func (cw coreWrapper) Registry() (Registry, error) {
27- r, err := cw.inner.Registry()
28- if err != nil {
29- return nil, err
30- }
31- return registryWrapper{inner: r}, nil
32-}
33-
34-func (cw coreWrapper) NewStream(name string, props unsafe.Pointer) (Stream, error) {
35- s, err := cw.inner.NewStream(name, props)
36- if err != nil {
37- return nil, err
38- }
39- return streamWrapper{inner: s}, nil
40-}
M pipewire/readme_test.go +7 -1
@@ -2,12 +2,18 @@ package pipewire_test
22
33 import (
44 "os"
5+ "path/filepath"
6+ "runtime"
57 "strings"
68 "testing"
79 )
810
911 func TestReadmeMentionsGenerateAndMockery(t *testing.T) {
10- b, err := os.ReadFile("../README.md")
12+ _, file, _, ok := runtime.Caller(0)
13+ if !ok {
14+ t.Fatal("runtime.Caller failed")
15+ }
16+ b, err := os.ReadFile(filepath.Join(filepath.Dir(file), "..", "README.md"))
1117 if err != nil {
1218 t.Fatalf("ReadFile returned error: %v", err)
1319 }
@@ -2,12 +2,18 @@ package pipewire_test
2 2
3 import (3 import (
4 "os"4 "os"
5+ "path/filepath"
6+ "runtime"
5 "strings"7 "strings"
6 "testing"8 "testing"
7 )9 )
8 10
9 func TestReadmeMentionsGenerateAndMockery(t *testing.T) {11 func TestReadmeMentionsGenerateAndMockery(t *testing.T) {
10- b, err := os.ReadFile("../README.md")12+ _, file, _, ok := runtime.Caller(0)
13+ if !ok {
14+ t.Fatal("runtime.Caller failed")
15+ }
16+ b, err := os.ReadFile(filepath.Join(filepath.Dir(file), "..", "README.md"))
11 if err != nil {17 if err != nil {
12 t.Fatalf("ReadFile returned error: %v", err)18 t.Fatalf("ReadFile returned error: %v", err)
13 }19 }
M pipewire/registry.go +0 -15
@@ -2,8 +2,6 @@ package pipewire
22
33 import (
44 "unsafe"
5-
6- "github.com/bnema/purego-pipewire/internal/core"
75 )
86
97 // Registry is the public interface for PipeWire registry operations.
@@ -12,16 +10,3 @@ type Registry interface {
1210 Destroy()
1311 Bind(name uint32, t string, version uint32) (unsafe.Pointer, error)
1412 }
15-
16-// registryWrapper wraps the internal core.Registry to implement the public Registry interface.
17-type registryWrapper struct {
18- inner *core.Registry
19-}
20-
21-func (rw registryWrapper) Destroy() {
22- rw.inner.Destroy()
23-}
24-
25-func (rw registryWrapper) Bind(name uint32, t string, version uint32) (unsafe.Pointer, error) {
26- return rw.inner.Bind(name, t, version)
27-}
@@ -2,8 +2,6 @@ package pipewire
2 2
3 import (3 import (
4 "unsafe"4 "unsafe"
5-
6- "github.com/bnema/purego-pipewire/internal/core"
7 )5 )
8 6
9 // Registry is the public interface for PipeWire registry operations.7 // Registry is the public interface for PipeWire registry operations.
@@ -12,16 +10,3 @@ type Registry interface {
12 Destroy()10 Destroy()
13 Bind(name uint32, t string, version uint32) (unsafe.Pointer, error)11 Bind(name uint32, t string, version uint32) (unsafe.Pointer, error)
14 }12 }
15-
16-// registryWrapper wraps the internal core.Registry to implement the public Registry interface.
17-type registryWrapper struct {
18- inner *core.Registry
19-}
20-
21-func (rw registryWrapper) Destroy() {
22- rw.inner.Destroy()
23-}
24-
25-func (rw registryWrapper) Bind(name uint32, t string, version uint32) (unsafe.Pointer, error) {
26- return rw.inner.Bind(name, t, version)
27-}
M pipewire/stream.go +0 -19
@@ -2,8 +2,6 @@ package pipewire
22
33 import (
44 "unsafe"
5-
6- "github.com/bnema/purego-pipewire/internal/core"
75 )
86
97 // Stream is the public interface for PipeWire stream operations.
@@ -13,20 +11,3 @@ type Stream interface {
1311 Connect(direction int, id uint32, flags uint32, params unsafe.Pointer) error
1412 Disconnect()
1513 }
16-
17-// streamWrapper wraps the internal core.Stream to implement the public Stream interface.
18-type streamWrapper struct {
19- inner *core.Stream
20-}
21-
22-func (sw streamWrapper) Destroy() {
23- sw.inner.Destroy()
24-}
25-
26-func (sw streamWrapper) Connect(direction int, id uint32, flags uint32, params unsafe.Pointer) error {
27- return sw.inner.Connect(direction, id, flags, params)
28-}
29-
30-func (sw streamWrapper) Disconnect() {
31- sw.inner.Disconnect()
32-}
@@ -2,8 +2,6 @@ package pipewire
2 2
3 import (3 import (
4 "unsafe"4 "unsafe"
5-
6- "github.com/bnema/purego-pipewire/internal/core"
7 )5 )
8 6
9 // Stream is the public interface for PipeWire stream operations.7 // Stream is the public interface for PipeWire stream operations.
@@ -13,20 +11,3 @@ type Stream interface {
13 Connect(direction int, id uint32, flags uint32, params unsafe.Pointer) error11 Connect(direction int, id uint32, flags uint32, params unsafe.Pointer) error
14 Disconnect()12 Disconnect()
15 }13 }
16-
17-// streamWrapper wraps the internal core.Stream to implement the public Stream interface.
18-type streamWrapper struct {
19- inner *core.Stream
20-}
21-
22-func (sw streamWrapper) Destroy() {
23- sw.inner.Destroy()
24-}
25-
26-func (sw streamWrapper) Connect(direction int, id uint32, flags uint32, params unsafe.Pointer) error {
27- return sw.inner.Connect(direction, id, flags, params)
28-}
29-
30-func (sw streamWrapper) Disconnect() {
31- sw.inner.Disconnect()
32-}

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