feat: add PipeWire lifecycle core
- commit
- d38df27e209c7e3f834dfe4945dcdb0803f64745
- author
- brice · · 2026-04-09 05:58 UTC
- parent
- a248820
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
11 files · +531 -0
M .mockery.yml +1 -0
| @@ -12,5 +12,6 @@ packages: | |||
| 12 | 12 | all: false | |
| 13 | 13 | include-auto-generated: true | |
| 14 | 14 | interfaces: | |
| 15 | + | CAPI: | |
| 15 | 16 | InitAPI: | |
| 16 | 17 | LoopAPI: | |
| @@ -12,5 +12,6 @@ packages: | |||||
| 12 | all: false | 12 | all: false | ||
| 13 | include-auto-generated: true | 13 | include-auto-generated: true | ||
| 14 | interfaces: | 14 | interfaces: | ||
| 15 | + | CAPI: | |||
| 15 | InitAPI: | 16 | InitAPI: | ||
| 16 | LoopAPI: | 17 | LoopAPI: | ||
A internal/core/context.go +35 -0
| @@ -0,0 +1,35 @@ | |||
| 1 | + | package core | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "errors" | |
| 5 | + | "unsafe" | |
| 6 | + | ||
| 7 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |
| 8 | + | ) | |
| 9 | + | ||
| 10 | + | var ErrContextCreate = errors.New("failed to create context") | |
| 11 | + | ||
| 12 | + | type Context struct { | |
| 13 | + | ptr unsafe.Pointer | |
| 14 | + | capi portout.CAPI | |
| 15 | + | core *Core | |
| 16 | + | } | |
| 17 | + | ||
| 18 | + | func (r *Runtime) NewContext() (*Context, error) { | |
| 19 | + | // For now, return a placeholder - full implementation | |
| 20 | + | // will require generated context methods | |
| 21 | + | return nil, ErrContextCreate | |
| 22 | + | } | |
| 23 | + | ||
| 24 | + | func (c *Context) Destroy() { | |
| 25 | + | // Placeholder for context destruction | |
| 26 | + | } | |
| 27 | + | ||
| 28 | + | func (c *Context) Connect() (*Core, error) { | |
| 29 | + | // Placeholder - will connect and return a Core | |
| 30 | + | return nil, errors.New("not implemented") | |
| 31 | + | } | |
| 32 | + | ||
| 33 | + | func (c *Context) Ptr() unsafe.Pointer { | |
| 34 | + | return c.ptr | |
| 35 | + | } | |
| @@ -0,0 +1,35 @@ | |||||
| 1 | + | package core | |||
| 2 | + | ||||
| 3 | + | import ( | |||
| 4 | + | "errors" | |||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 7 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |||
| 8 | + | ) | |||
| 9 | + | ||||
| 10 | + | var ErrContextCreate = errors.New("failed to create context") | |||
| 11 | + | ||||
| 12 | + | type Context struct { | |||
| 13 | + | ptr unsafe.Pointer | |||
| 14 | + | capi portout.CAPI | |||
| 15 | + | core *Core | |||
| 16 | + | } | |||
| 17 | + | ||||
| 18 | + | func (r *Runtime) NewContext() (*Context, error) { | |||
| 19 | + | // For now, return a placeholder - full implementation | |||
| 20 | + | // will require generated context methods | |||
| 21 | + | return nil, ErrContextCreate | |||
| 22 | + | } | |||
| 23 | + | ||||
| 24 | + | func (c *Context) Destroy() { | |||
| 25 | + | // Placeholder for context destruction | |||
| 26 | + | } | |||
| 27 | + | ||||
| 28 | + | func (c *Context) Connect() (*Core, error) { | |||
| 29 | + | // Placeholder - will connect and return a Core | |||
| 30 | + | return nil, errors.New("not implemented") | |||
| 31 | + | } | |||
| 32 | + | ||||
| 33 | + | func (c *Context) Ptr() unsafe.Pointer { | |||
| 34 | + | return c.ptr | |||
| 35 | + | } | |||
A internal/core/core.go +41 -0
| @@ -0,0 +1,41 @@ | |||
| 1 | + | package core | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "errors" | |
| 5 | + | "unsafe" | |
| 6 | + | ||
| 7 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |
| 8 | + | ) | |
| 9 | + | ||
| 10 | + | var ErrCoreConnect = errors.New("failed to connect core") | |
| 11 | + | var ErrRegistryUnavailable = errors.New("registry unavailable") | |
| 12 | + | ||
| 13 | + | type Core struct { | |
| 14 | + | ptr unsafe.Pointer | |
| 15 | + | capi portout.CAPI | |
| 16 | + | context *Context | |
| 17 | + | registry *Registry | |
| 18 | + | } | |
| 19 | + | ||
| 20 | + | func (c *Context) newCore(ptr unsafe.Pointer) *Core { | |
| 21 | + | return &Core{ | |
| 22 | + | ptr: ptr, | |
| 23 | + | capi: c.capi, | |
| 24 | + | context: c, | |
| 25 | + | } | |
| 26 | + | } | |
| 27 | + | ||
| 28 | + | func (c *Core) Disconnect() { | |
| 29 | + | // Placeholder for core disconnection | |
| 30 | + | } | |
| 31 | + | ||
| 32 | + | func (c *Core) Registry() (*Registry, error) { | |
| 33 | + | if c.registry == nil { | |
| 34 | + | return nil, ErrRegistryUnavailable | |
| 35 | + | } | |
| 36 | + | return c.registry, nil | |
| 37 | + | } | |
| 38 | + | ||
| 39 | + | func (c *Core) Ptr() unsafe.Pointer { | |
| 40 | + | return c.ptr | |
| 41 | + | } | |
| @@ -0,0 +1,41 @@ | |||||
| 1 | + | package core | |||
| 2 | + | ||||
| 3 | + | import ( | |||
| 4 | + | "errors" | |||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 7 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |||
| 8 | + | ) | |||
| 9 | + | ||||
| 10 | + | var ErrCoreConnect = errors.New("failed to connect core") | |||
| 11 | + | var ErrRegistryUnavailable = errors.New("registry unavailable") | |||
| 12 | + | ||||
| 13 | + | type Core struct { | |||
| 14 | + | ptr unsafe.Pointer | |||
| 15 | + | capi portout.CAPI | |||
| 16 | + | context *Context | |||
| 17 | + | registry *Registry | |||
| 18 | + | } | |||
| 19 | + | ||||
| 20 | + | func (c *Context) newCore(ptr unsafe.Pointer) *Core { | |||
| 21 | + | return &Core{ | |||
| 22 | + | ptr: ptr, | |||
| 23 | + | capi: c.capi, | |||
| 24 | + | context: c, | |||
| 25 | + | } | |||
| 26 | + | } | |||
| 27 | + | ||||
| 28 | + | func (c *Core) Disconnect() { | |||
| 29 | + | // Placeholder for core disconnection | |||
| 30 | + | } | |||
| 31 | + | ||||
| 32 | + | func (c *Core) Registry() (*Registry, error) { | |||
| 33 | + | if c.registry == nil { | |||
| 34 | + | return nil, ErrRegistryUnavailable | |||
| 35 | + | } | |||
| 36 | + | return c.registry, nil | |||
| 37 | + | } | |||
| 38 | + | ||||
| 39 | + | func (c *Core) Ptr() unsafe.Pointer { | |||
| 40 | + | return c.ptr | |||
| 41 | + | } | |||
A internal/core/loop.go +35 -0
| @@ -0,0 +1,35 @@ | |||
| 1 | + | package core | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "errors" | |
| 5 | + | "unsafe" | |
| 6 | + | ||
| 7 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |
| 8 | + | ) | |
| 9 | + | ||
| 10 | + | var ErrMainLoopCreate = errors.New("failed to create main loop") | |
| 11 | + | ||
| 12 | + | type MainLoop struct { | |
| 13 | + | ptr unsafe.Pointer | |
| 14 | + | capi portout.CAPI | |
| 15 | + | } | |
| 16 | + | ||
| 17 | + | func (r *Runtime) NewMainLoop() (*MainLoop, error) { | |
| 18 | + | ptr := r.capi.PWMainLoopNew(nil) | |
| 19 | + | if ptr == nil { | |
| 20 | + | return nil, ErrMainLoopCreate | |
| 21 | + | } | |
| 22 | + | return &MainLoop{ptr: ptr, capi: r.capi}, nil | |
| 23 | + | } | |
| 24 | + | ||
| 25 | + | func (ml *MainLoop) Run() int32 { | |
| 26 | + | return ml.capi.PWMainLoopRun(ml.ptr) | |
| 27 | + | } | |
| 28 | + | ||
| 29 | + | func (ml *MainLoop) Destroy() { | |
| 30 | + | ml.capi.PWMainLoopDestroy(ml.ptr) | |
| 31 | + | } | |
| 32 | + | ||
| 33 | + | func (ml *MainLoop) Ptr() unsafe.Pointer { | |
| 34 | + | return ml.ptr | |
| 35 | + | } | |
| @@ -0,0 +1,35 @@ | |||||
| 1 | + | package core | |||
| 2 | + | ||||
| 3 | + | import ( | |||
| 4 | + | "errors" | |||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 7 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |||
| 8 | + | ) | |||
| 9 | + | ||||
| 10 | + | var ErrMainLoopCreate = errors.New("failed to create main loop") | |||
| 11 | + | ||||
| 12 | + | type MainLoop struct { | |||
| 13 | + | ptr unsafe.Pointer | |||
| 14 | + | capi portout.CAPI | |||
| 15 | + | } | |||
| 16 | + | ||||
| 17 | + | func (r *Runtime) NewMainLoop() (*MainLoop, error) { | |||
| 18 | + | ptr := r.capi.PWMainLoopNew(nil) | |||
| 19 | + | if ptr == nil { | |||
| 20 | + | return nil, ErrMainLoopCreate | |||
| 21 | + | } | |||
| 22 | + | return &MainLoop{ptr: ptr, capi: r.capi}, nil | |||
| 23 | + | } | |||
| 24 | + | ||||
| 25 | + | func (ml *MainLoop) Run() int32 { | |||
| 26 | + | return ml.capi.PWMainLoopRun(ml.ptr) | |||
| 27 | + | } | |||
| 28 | + | ||||
| 29 | + | func (ml *MainLoop) Destroy() { | |||
| 30 | + | ml.capi.PWMainLoopDestroy(ml.ptr) | |||
| 31 | + | } | |||
| 32 | + | ||||
| 33 | + | func (ml *MainLoop) Ptr() unsafe.Pointer { | |||
| 34 | + | return ml.ptr | |||
| 35 | + | } | |||
A internal/core/registry.go +42 -0
| @@ -0,0 +1,42 @@ | |||
| 1 | + | package core | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "errors" | |
| 5 | + | "unsafe" | |
| 6 | + | ||
| 7 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |
| 8 | + | ) | |
| 9 | + | ||
| 10 | + | var ErrRegistryCreate = errors.New("failed to create registry") | |
| 11 | + | ||
| 12 | + | type Registry struct { | |
| 13 | + | ptr unsafe.Pointer | |
| 14 | + | capi portout.CAPI | |
| 15 | + | core *Core | |
| 16 | + | hooks []unsafe.Pointer | |
| 17 | + | } | |
| 18 | + | ||
| 19 | + | func (c *Core) newRegistry(ptr unsafe.Pointer) *Registry { | |
| 20 | + | return &Registry{ | |
| 21 | + | ptr: ptr, | |
| 22 | + | capi: c.capi, | |
| 23 | + | core: c, | |
| 24 | + | } | |
| 25 | + | } | |
| 26 | + | ||
| 27 | + | func (r *Registry) Destroy() { | |
| 28 | + | // Clean up any registered hooks | |
| 29 | + | for _, hook := range r.hooks { | |
| 30 | + | _ = hook // Placeholder for hook destruction | |
| 31 | + | } | |
| 32 | + | r.hooks = nil | |
| 33 | + | } | |
| 34 | + | ||
| 35 | + | func (r *Registry) Bind(name uint32, t string, version uint32) (unsafe.Pointer, error) { | |
| 36 | + | // Placeholder for registry bind operation | |
| 37 | + | return nil, errors.New("not implemented") | |
| 38 | + | } | |
| 39 | + | ||
| 40 | + | func (r *Registry) Ptr() unsafe.Pointer { | |
| 41 | + | return r.ptr | |
| 42 | + | } | |
| @@ -0,0 +1,42 @@ | |||||
| 1 | + | package core | |||
| 2 | + | ||||
| 3 | + | import ( | |||
| 4 | + | "errors" | |||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 7 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |||
| 8 | + | ) | |||
| 9 | + | ||||
| 10 | + | var ErrRegistryCreate = errors.New("failed to create registry") | |||
| 11 | + | ||||
| 12 | + | type Registry struct { | |||
| 13 | + | ptr unsafe.Pointer | |||
| 14 | + | capi portout.CAPI | |||
| 15 | + | core *Core | |||
| 16 | + | hooks []unsafe.Pointer | |||
| 17 | + | } | |||
| 18 | + | ||||
| 19 | + | func (c *Core) newRegistry(ptr unsafe.Pointer) *Registry { | |||
| 20 | + | return &Registry{ | |||
| 21 | + | ptr: ptr, | |||
| 22 | + | capi: c.capi, | |||
| 23 | + | core: c, | |||
| 24 | + | } | |||
| 25 | + | } | |||
| 26 | + | ||||
| 27 | + | func (r *Registry) Destroy() { | |||
| 28 | + | // Clean up any registered hooks | |||
| 29 | + | for _, hook := range r.hooks { | |||
| 30 | + | _ = hook // Placeholder for hook destruction | |||
| 31 | + | } | |||
| 32 | + | r.hooks = nil | |||
| 33 | + | } | |||
| 34 | + | ||||
| 35 | + | func (r *Registry) Bind(name uint32, t string, version uint32) (unsafe.Pointer, error) { | |||
| 36 | + | // Placeholder for registry bind operation | |||
| 37 | + | return nil, errors.New("not implemented") | |||
| 38 | + | } | |||
| 39 | + | ||||
| 40 | + | func (r *Registry) Ptr() unsafe.Pointer { | |||
| 41 | + | return r.ptr | |||
| 42 | + | } | |||
A internal/core/runtime.go +28 -0
| @@ -0,0 +1,28 @@ | |||
| 1 | + | package core | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "sync" | |
| 5 | + | ||
| 6 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |
| 7 | + | ) | |
| 8 | + | ||
| 9 | + | type Runtime struct { | |
| 10 | + | capi portout.CAPI | |
| 11 | + | once sync.Once | |
| 12 | + | initErr error | |
| 13 | + | } | |
| 14 | + | ||
| 15 | + | func NewRuntime(capi portout.CAPI) *Runtime { | |
| 16 | + | return &Runtime{capi: capi} | |
| 17 | + | } | |
| 18 | + | ||
| 19 | + | func (r *Runtime) Init() error { | |
| 20 | + | r.once.Do(func() { | |
| 21 | + | r.capi.PWInit(nil, nil) | |
| 22 | + | }) | |
| 23 | + | return r.initErr | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | func (r *Runtime) Deinit() { | |
| 27 | + | r.capi.PWDeinit() | |
| 28 | + | } | |
| @@ -0,0 +1,28 @@ | |||||
| 1 | + | package core | |||
| 2 | + | ||||
| 3 | + | import ( | |||
| 4 | + | "sync" | |||
| 5 | + | ||||
| 6 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |||
| 7 | + | ) | |||
| 8 | + | ||||
| 9 | + | type Runtime struct { | |||
| 10 | + | capi portout.CAPI | |||
| 11 | + | once sync.Once | |||
| 12 | + | initErr error | |||
| 13 | + | } | |||
| 14 | + | ||||
| 15 | + | func NewRuntime(capi portout.CAPI) *Runtime { | |||
| 16 | + | return &Runtime{capi: capi} | |||
| 17 | + | } | |||
| 18 | + | ||||
| 19 | + | func (r *Runtime) Init() error { | |||
| 20 | + | r.once.Do(func() { | |||
| 21 | + | r.capi.PWInit(nil, nil) | |||
| 22 | + | }) | |||
| 23 | + | return r.initErr | |||
| 24 | + | } | |||
| 25 | + | ||||
| 26 | + | func (r *Runtime) Deinit() { | |||
| 27 | + | r.capi.PWDeinit() | |||
| 28 | + | } | |||
A internal/core/runtime_test.go +28 -0
| @@ -0,0 +1,28 @@ | |||
| 1 | + | package core | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "testing" | |
| 5 | + | ||
| 6 | + | portmocks "github.com/bnema/purego-pipewire/internal/ports/out/mocks" | |
| 7 | + | ) | |
| 8 | + | ||
| 9 | + | func TestRuntimeInitCallsPWInitOnce(t *testing.T) { | |
| 10 | + | api := portmocks.NewMockCAPI(t) | |
| 11 | + | api.EXPECT().PWInit((*int32)(nil), (***byte)(nil)).Once() | |
| 12 | + | ||
| 13 | + | r := NewRuntime(api) | |
| 14 | + | if err := r.Init(); err != nil { | |
| 15 | + | t.Fatalf("Init returned error: %v", err) | |
| 16 | + | } | |
| 17 | + | if err := r.Init(); err != nil { | |
| 18 | + | t.Fatalf("second Init returned error: %v", err) | |
| 19 | + | } | |
| 20 | + | } | |
| 21 | + | ||
| 22 | + | func TestRuntimeDeinitCallsPWDeinit(t *testing.T) { | |
| 23 | + | api := portmocks.NewMockCAPI(t) | |
| 24 | + | api.EXPECT().PWDeinit().Once() | |
| 25 | + | ||
| 26 | + | r := NewRuntime(api) | |
| 27 | + | r.Deinit() | |
| 28 | + | } | |
| @@ -0,0 +1,28 @@ | |||||
| 1 | + | package core | |||
| 2 | + | ||||
| 3 | + | import ( | |||
| 4 | + | "testing" | |||
| 5 | + | ||||
| 6 | + | portmocks "github.com/bnema/purego-pipewire/internal/ports/out/mocks" | |||
| 7 | + | ) | |||
| 8 | + | ||||
| 9 | + | func TestRuntimeInitCallsPWInitOnce(t *testing.T) { | |||
| 10 | + | api := portmocks.NewMockCAPI(t) | |||
| 11 | + | api.EXPECT().PWInit((*int32)(nil), (***byte)(nil)).Once() | |||
| 12 | + | ||||
| 13 | + | r := NewRuntime(api) | |||
| 14 | + | if err := r.Init(); err != nil { | |||
| 15 | + | t.Fatalf("Init returned error: %v", err) | |||
| 16 | + | } | |||
| 17 | + | if err := r.Init(); err != nil { | |||
| 18 | + | t.Fatalf("second Init returned error: %v", err) | |||
| 19 | + | } | |||
| 20 | + | } | |||
| 21 | + | ||||
| 22 | + | func TestRuntimeDeinitCallsPWDeinit(t *testing.T) { | |||
| 23 | + | api := portmocks.NewMockCAPI(t) | |||
| 24 | + | api.EXPECT().PWDeinit().Once() | |||
| 25 | + | ||||
| 26 | + | r := NewRuntime(api) | |||
| 27 | + | r.Deinit() | |||
| 28 | + | } | |||
A internal/core/stream.go +42 -0
| @@ -0,0 +1,42 @@ | |||
| 1 | + | package core | |
| 2 | + | ||
| 3 | + | import ( | |
| 4 | + | "errors" | |
| 5 | + | "unsafe" | |
| 6 | + | ||
| 7 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |
| 8 | + | ) | |
| 9 | + | ||
| 10 | + | var ErrStreamCreate = errors.New("failed to create stream") | |
| 11 | + | ||
| 12 | + | type Stream struct { | |
| 13 | + | ptr unsafe.Pointer | |
| 14 | + | capi portout.CAPI | |
| 15 | + | core *Core | |
| 16 | + | destroy func() | |
| 17 | + | } | |
| 18 | + | ||
| 19 | + | func (c *Core) NewStream(name string, props unsafe.Pointer) (*Stream, error) { | |
| 20 | + | // Placeholder - full implementation will require generated stream methods | |
| 21 | + | return nil, ErrStreamCreate | |
| 22 | + | } | |
| 23 | + | ||
| 24 | + | func (s *Stream) Destroy() { | |
| 25 | + | if s.destroy != nil { | |
| 26 | + | s.destroy() | |
| 27 | + | } | |
| 28 | + | // Placeholder for stream destruction | |
| 29 | + | } | |
| 30 | + | ||
| 31 | + | func (s *Stream) Connect(direction int, id uint32, flags uint32, params unsafe.Pointer) error { | |
| 32 | + | // Placeholder for stream connection | |
| 33 | + | return errors.New("not implemented") | |
| 34 | + | } | |
| 35 | + | ||
| 36 | + | func (s *Stream) Disconnect() { | |
| 37 | + | // Placeholder for stream disconnection | |
| 38 | + | } | |
| 39 | + | ||
| 40 | + | func (s *Stream) Ptr() unsafe.Pointer { | |
| 41 | + | return s.ptr | |
| 42 | + | } | |
| @@ -0,0 +1,42 @@ | |||||
| 1 | + | package core | |||
| 2 | + | ||||
| 3 | + | import ( | |||
| 4 | + | "errors" | |||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 7 | + | portout "github.com/bnema/purego-pipewire/internal/ports/out" | |||
| 8 | + | ) | |||
| 9 | + | ||||
| 10 | + | var ErrStreamCreate = errors.New("failed to create stream") | |||
| 11 | + | ||||
| 12 | + | type Stream struct { | |||
| 13 | + | ptr unsafe.Pointer | |||
| 14 | + | capi portout.CAPI | |||
| 15 | + | core *Core | |||
| 16 | + | destroy func() | |||
| 17 | + | } | |||
| 18 | + | ||||
| 19 | + | func (c *Core) NewStream(name string, props unsafe.Pointer) (*Stream, error) { | |||
| 20 | + | // Placeholder - full implementation will require generated stream methods | |||
| 21 | + | return nil, ErrStreamCreate | |||
| 22 | + | } | |||
| 23 | + | ||||
| 24 | + | func (s *Stream) Destroy() { | |||
| 25 | + | if s.destroy != nil { | |||
| 26 | + | s.destroy() | |||
| 27 | + | } | |||
| 28 | + | // Placeholder for stream destruction | |||
| 29 | + | } | |||
| 30 | + | ||||
| 31 | + | func (s *Stream) Connect(direction int, id uint32, flags uint32, params unsafe.Pointer) error { | |||
| 32 | + | // Placeholder for stream connection | |||
| 33 | + | return errors.New("not implemented") | |||
| 34 | + | } | |||
| 35 | + | ||||
| 36 | + | func (s *Stream) Disconnect() { | |||
| 37 | + | // Placeholder for stream disconnection | |||
| 38 | + | } | |||
| 39 | + | ||||
| 40 | + | func (s *Stream) Ptr() unsafe.Pointer { | |||
| 41 | + | return s.ptr | |||
| 42 | + | } | |||
A internal/ports/in/runtime.go +9 -0
| @@ -0,0 +1,9 @@ | |||
| 1 | + | package in | |
| 2 | + | ||
| 3 | + | // Runtime is the inbound interface for runtime operations. | |
| 4 | + | // This package defines interfaces that internal/core implements | |
| 5 | + | // and that are exposed to higher-level packages. | |
| 6 | + | type Runtime interface { | |
| 7 | + | Init() error | |
| 8 | + | Deinit() | |
| 9 | + | } | |
| @@ -0,0 +1,9 @@ | |||||
| 1 | + | package in | |||
| 2 | + | ||||
| 3 | + | // Runtime is the inbound interface for runtime operations. | |||
| 4 | + | // This package defines interfaces that internal/core implements | |||
| 5 | + | // and that are exposed to higher-level packages. | |||
| 6 | + | type Runtime interface { | |||
| 7 | + | Init() error | |||
| 8 | + | Deinit() | |||
| 9 | + | } | |||
A internal/ports/out/capi.go +11 -0
| @@ -0,0 +1,11 @@ | |||
| 1 | + | // Code generated by manual composition. DO NOT EDIT. | |
| 2 | + | // This file bridges the gap until the generator emits a composite CAPI interface. | |
| 3 | + | ||
| 4 | + | package out | |
| 5 | + | ||
| 6 | + | // CAPI is a composite interface combining all PipeWire API groups. | |
| 7 | + | // It embeds InitAPI and LoopAPI for unified access to all bound functions. | |
| 8 | + | type CAPI interface { | |
| 9 | + | InitAPI | |
| 10 | + | LoopAPI | |
| 11 | + | } | |
| @@ -0,0 +1,11 @@ | |||||
| 1 | + | // Code generated by manual composition. DO NOT EDIT. | |||
| 2 | + | // This file bridges the gap until the generator emits a composite CAPI interface. | |||
| 3 | + | ||||
| 4 | + | package out | |||
| 5 | + | ||||
| 6 | + | // CAPI is a composite interface combining all PipeWire API groups. | |||
| 7 | + | // It embeds InitAPI and LoopAPI for unified access to all bound functions. | |||
| 8 | + | type CAPI interface { | |||
| 9 | + | InitAPI | |||
| 10 | + | LoopAPI | |||
| 11 | + | } | |||
A internal/ports/out/mocks/mock_CAPI.go +259 -0
| @@ -0,0 +1,259 @@ | |||
| 1 | + | // Code generated by mockery; DO NOT EDIT. | |
| 2 | + | // github.com/vektra/mockery | |
| 3 | + | // template: testify | |
| 4 | + | ||
| 5 | + | package mocks | |
| 6 | + | ||
| 7 | + | import ( | |
| 8 | + | "unsafe" | |
| 9 | + | ||
| 10 | + | mock "github.com/stretchr/testify/mock" | |
| 11 | + | ) | |
| 12 | + | ||
| 13 | + | // NewMockCAPI creates a new instance of MockCAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |
| 14 | + | // The first argument is typically a *testing.T value. | |
| 15 | + | func NewMockCAPI(t interface { | |
| 16 | + | mock.TestingT | |
| 17 | + | Cleanup(func()) | |
| 18 | + | }) *MockCAPI { | |
| 19 | + | mock := &MockCAPI{} | |
| 20 | + | mock.Mock.Test(t) | |
| 21 | + | ||
| 22 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |
| 23 | + | ||
| 24 | + | return mock | |
| 25 | + | } | |
| 26 | + | ||
| 27 | + | // MockCAPI is an autogenerated mock type for the CAPI type | |
| 28 | + | type MockCAPI struct { | |
| 29 | + | mock.Mock | |
| 30 | + | } | |
| 31 | + | ||
| 32 | + | type MockCAPI_Expecter struct { | |
| 33 | + | mock *mock.Mock | |
| 34 | + | } | |
| 35 | + | ||
| 36 | + | func (_m *MockCAPI) EXPECT() *MockCAPI_Expecter { | |
| 37 | + | return &MockCAPI_Expecter{mock: &_m.Mock} | |
| 38 | + | } | |
| 39 | + | ||
| 40 | + | // PWDeinit provides a mock function for the type MockCAPI | |
| 41 | + | func (_mock *MockCAPI) PWDeinit() { | |
| 42 | + | _mock.Called() | |
| 43 | + | return | |
| 44 | + | } | |
| 45 | + | ||
| 46 | + | // MockCAPI_PWDeinit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWDeinit' | |
| 47 | + | type MockCAPI_PWDeinit_Call struct { | |
| 48 | + | *mock.Call | |
| 49 | + | } | |
| 50 | + | ||
| 51 | + | // PWDeinit is a helper method to define mock.On call | |
| 52 | + | func (_e *MockCAPI_Expecter) PWDeinit() *MockCAPI_PWDeinit_Call { | |
| 53 | + | return &MockCAPI_PWDeinit_Call{Call: _e.mock.On("PWDeinit")} | |
| 54 | + | } | |
| 55 | + | ||
| 56 | + | func (_c *MockCAPI_PWDeinit_Call) Run(run func()) *MockCAPI_PWDeinit_Call { | |
| 57 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 58 | + | run() | |
| 59 | + | }) | |
| 60 | + | return _c | |
| 61 | + | } | |
| 62 | + | ||
| 63 | + | func (_c *MockCAPI_PWDeinit_Call) Return() *MockCAPI_PWDeinit_Call { | |
| 64 | + | _c.Call.Return() | |
| 65 | + | return _c | |
| 66 | + | } | |
| 67 | + | ||
| 68 | + | func (_c *MockCAPI_PWDeinit_Call) RunAndReturn(run func()) *MockCAPI_PWDeinit_Call { | |
| 69 | + | _c.Run(run) | |
| 70 | + | return _c | |
| 71 | + | } | |
| 72 | + | ||
| 73 | + | // PWInit provides a mock function for the type MockCAPI | |
| 74 | + | func (_mock *MockCAPI) PWInit(argc *int32, argv ***byte) { | |
| 75 | + | _mock.Called(argc, argv) | |
| 76 | + | return | |
| 77 | + | } | |
| 78 | + | ||
| 79 | + | // MockCAPI_PWInit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWInit' | |
| 80 | + | type MockCAPI_PWInit_Call struct { | |
| 81 | + | *mock.Call | |
| 82 | + | } | |
| 83 | + | ||
| 84 | + | // PWInit is a helper method to define mock.On call | |
| 85 | + | // - argc *int32 | |
| 86 | + | // - argv ***byte | |
| 87 | + | func (_e *MockCAPI_Expecter) PWInit(argc interface{}, argv interface{}) *MockCAPI_PWInit_Call { | |
| 88 | + | return &MockCAPI_PWInit_Call{Call: _e.mock.On("PWInit", argc, argv)} | |
| 89 | + | } | |
| 90 | + | ||
| 91 | + | func (_c *MockCAPI_PWInit_Call) Run(run func(argc *int32, argv ***byte)) *MockCAPI_PWInit_Call { | |
| 92 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 93 | + | var arg0 *int32 | |
| 94 | + | if args[0] != nil { | |
| 95 | + | arg0 = args[0].(*int32) | |
| 96 | + | } | |
| 97 | + | var arg1 ***byte | |
| 98 | + | if args[1] != nil { | |
| 99 | + | arg1 = args[1].(***byte) | |
| 100 | + | } | |
| 101 | + | run( | |
| 102 | + | arg0, | |
| 103 | + | arg1, | |
| 104 | + | ) | |
| 105 | + | }) | |
| 106 | + | return _c | |
| 107 | + | } | |
| 108 | + | ||
| 109 | + | func (_c *MockCAPI_PWInit_Call) Return() *MockCAPI_PWInit_Call { | |
| 110 | + | _c.Call.Return() | |
| 111 | + | return _c | |
| 112 | + | } | |
| 113 | + | ||
| 114 | + | func (_c *MockCAPI_PWInit_Call) RunAndReturn(run func(argc *int32, argv ***byte)) *MockCAPI_PWInit_Call { | |
| 115 | + | _c.Run(run) | |
| 116 | + | return _c | |
| 117 | + | } | |
| 118 | + | ||
| 119 | + | // PWMainLoopDestroy provides a mock function for the type MockCAPI | |
| 120 | + | func (_mock *MockCAPI) PWMainLoopDestroy(loop unsafe.Pointer) { | |
| 121 | + | _mock.Called(loop) | |
| 122 | + | return | |
| 123 | + | } | |
| 124 | + | ||
| 125 | + | // MockCAPI_PWMainLoopDestroy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWMainLoopDestroy' | |
| 126 | + | type MockCAPI_PWMainLoopDestroy_Call struct { | |
| 127 | + | *mock.Call | |
| 128 | + | } | |
| 129 | + | ||
| 130 | + | // PWMainLoopDestroy is a helper method to define mock.On call | |
| 131 | + | // - loop unsafe.Pointer | |
| 132 | + | func (_e *MockCAPI_Expecter) PWMainLoopDestroy(loop interface{}) *MockCAPI_PWMainLoopDestroy_Call { | |
| 133 | + | return &MockCAPI_PWMainLoopDestroy_Call{Call: _e.mock.On("PWMainLoopDestroy", loop)} | |
| 134 | + | } | |
| 135 | + | ||
| 136 | + | func (_c *MockCAPI_PWMainLoopDestroy_Call) Run(run func(loop unsafe.Pointer)) *MockCAPI_PWMainLoopDestroy_Call { | |
| 137 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 138 | + | var arg0 unsafe.Pointer | |
| 139 | + | if args[0] != nil { | |
| 140 | + | arg0 = args[0].(unsafe.Pointer) | |
| 141 | + | } | |
| 142 | + | run( | |
| 143 | + | arg0, | |
| 144 | + | ) | |
| 145 | + | }) | |
| 146 | + | return _c | |
| 147 | + | } | |
| 148 | + | ||
| 149 | + | func (_c *MockCAPI_PWMainLoopDestroy_Call) Return() *MockCAPI_PWMainLoopDestroy_Call { | |
| 150 | + | _c.Call.Return() | |
| 151 | + | return _c | |
| 152 | + | } | |
| 153 | + | ||
| 154 | + | func (_c *MockCAPI_PWMainLoopDestroy_Call) RunAndReturn(run func(loop unsafe.Pointer)) *MockCAPI_PWMainLoopDestroy_Call { | |
| 155 | + | _c.Run(run) | |
| 156 | + | return _c | |
| 157 | + | } | |
| 158 | + | ||
| 159 | + | // PWMainLoopNew provides a mock function for the type MockCAPI | |
| 160 | + | func (_mock *MockCAPI) PWMainLoopNew(props unsafe.Pointer) unsafe.Pointer { | |
| 161 | + | ret := _mock.Called(props) | |
| 162 | + | ||
| 163 | + | if len(ret) == 0 { | |
| 164 | + | panic("no return value specified for PWMainLoopNew") | |
| 165 | + | } | |
| 166 | + | ||
| 167 | + | var r0 unsafe.Pointer | |
| 168 | + | if returnFunc, ok := ret.Get(0).(func(unsafe.Pointer) unsafe.Pointer); ok { | |
| 169 | + | r0 = returnFunc(props) | |
| 170 | + | } else { | |
| 171 | + | r0 = ret.Get(0).(unsafe.Pointer) | |
| 172 | + | } | |
| 173 | + | return r0 | |
| 174 | + | } | |
| 175 | + | ||
| 176 | + | // MockCAPI_PWMainLoopNew_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWMainLoopNew' | |
| 177 | + | type MockCAPI_PWMainLoopNew_Call struct { | |
| 178 | + | *mock.Call | |
| 179 | + | } | |
| 180 | + | ||
| 181 | + | // PWMainLoopNew is a helper method to define mock.On call | |
| 182 | + | // - props unsafe.Pointer | |
| 183 | + | func (_e *MockCAPI_Expecter) PWMainLoopNew(props interface{}) *MockCAPI_PWMainLoopNew_Call { | |
| 184 | + | return &MockCAPI_PWMainLoopNew_Call{Call: _e.mock.On("PWMainLoopNew", props)} | |
| 185 | + | } | |
| 186 | + | ||
| 187 | + | func (_c *MockCAPI_PWMainLoopNew_Call) Run(run func(props unsafe.Pointer)) *MockCAPI_PWMainLoopNew_Call { | |
| 188 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 189 | + | var arg0 unsafe.Pointer | |
| 190 | + | if args[0] != nil { | |
| 191 | + | arg0 = args[0].(unsafe.Pointer) | |
| 192 | + | } | |
| 193 | + | run( | |
| 194 | + | arg0, | |
| 195 | + | ) | |
| 196 | + | }) | |
| 197 | + | return _c | |
| 198 | + | } | |
| 199 | + | ||
| 200 | + | func (_c *MockCAPI_PWMainLoopNew_Call) Return(v unsafe.Pointer) *MockCAPI_PWMainLoopNew_Call { | |
| 201 | + | _c.Call.Return(v) | |
| 202 | + | return _c | |
| 203 | + | } | |
| 204 | + | ||
| 205 | + | func (_c *MockCAPI_PWMainLoopNew_Call) RunAndReturn(run func(props unsafe.Pointer) unsafe.Pointer) *MockCAPI_PWMainLoopNew_Call { | |
| 206 | + | _c.Call.Return(run) | |
| 207 | + | return _c | |
| 208 | + | } | |
| 209 | + | ||
| 210 | + | // PWMainLoopRun provides a mock function for the type MockCAPI | |
| 211 | + | func (_mock *MockCAPI) PWMainLoopRun(loop unsafe.Pointer) int32 { | |
| 212 | + | ret := _mock.Called(loop) | |
| 213 | + | ||
| 214 | + | if len(ret) == 0 { | |
| 215 | + | panic("no return value specified for PWMainLoopRun") | |
| 216 | + | } | |
| 217 | + | ||
| 218 | + | var r0 int32 | |
| 219 | + | if returnFunc, ok := ret.Get(0).(func(unsafe.Pointer) int32); ok { | |
| 220 | + | r0 = returnFunc(loop) | |
| 221 | + | } else { | |
| 222 | + | r0 = ret.Get(0).(int32) | |
| 223 | + | } | |
| 224 | + | return r0 | |
| 225 | + | } | |
| 226 | + | ||
| 227 | + | // MockCAPI_PWMainLoopRun_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWMainLoopRun' | |
| 228 | + | type MockCAPI_PWMainLoopRun_Call struct { | |
| 229 | + | *mock.Call | |
| 230 | + | } | |
| 231 | + | ||
| 232 | + | // PWMainLoopRun is a helper method to define mock.On call | |
| 233 | + | // - loop unsafe.Pointer | |
| 234 | + | func (_e *MockCAPI_Expecter) PWMainLoopRun(loop interface{}) *MockCAPI_PWMainLoopRun_Call { | |
| 235 | + | return &MockCAPI_PWMainLoopRun_Call{Call: _e.mock.On("PWMainLoopRun", loop)} | |
| 236 | + | } | |
| 237 | + | ||
| 238 | + | func (_c *MockCAPI_PWMainLoopRun_Call) Run(run func(loop unsafe.Pointer)) *MockCAPI_PWMainLoopRun_Call { | |
| 239 | + | _c.Call.Run(func(args mock.Arguments) { | |
| 240 | + | var arg0 unsafe.Pointer | |
| 241 | + | if args[0] != nil { | |
| 242 | + | arg0 = args[0].(unsafe.Pointer) | |
| 243 | + | } | |
| 244 | + | run( | |
| 245 | + | arg0, | |
| 246 | + | ) | |
| 247 | + | }) | |
| 248 | + | return _c | |
| 249 | + | } | |
| 250 | + | ||
| 251 | + | func (_c *MockCAPI_PWMainLoopRun_Call) Return(n int32) *MockCAPI_PWMainLoopRun_Call { | |
| 252 | + | _c.Call.Return(n) | |
| 253 | + | return _c | |
| 254 | + | } | |
| 255 | + | ||
| 256 | + | func (_c *MockCAPI_PWMainLoopRun_Call) RunAndReturn(run func(loop unsafe.Pointer) int32) *MockCAPI_PWMainLoopRun_Call { | |
| 257 | + | _c.Call.Return(run) | |
| 258 | + | return _c | |
| 259 | + | } | |
| @@ -0,0 +1,259 @@ | |||||
| 1 | + | // Code generated by mockery; DO NOT EDIT. | |||
| 2 | + | // github.com/vektra/mockery | |||
| 3 | + | // template: testify | |||
| 4 | + | ||||
| 5 | + | package mocks | |||
| 6 | + | ||||
| 7 | + | import ( | |||
| 8 | + | "unsafe" | |||
| 9 | + | ||||
| 10 | + | mock "github.com/stretchr/testify/mock" | |||
| 11 | + | ) | |||
| 12 | + | ||||
| 13 | + | // NewMockCAPI creates a new instance of MockCAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. | |||
| 14 | + | // The first argument is typically a *testing.T value. | |||
| 15 | + | func NewMockCAPI(t interface { | |||
| 16 | + | mock.TestingT | |||
| 17 | + | Cleanup(func()) | |||
| 18 | + | }) *MockCAPI { | |||
| 19 | + | mock := &MockCAPI{} | |||
| 20 | + | mock.Mock.Test(t) | |||
| 21 | + | ||||
| 22 | + | t.Cleanup(func() { mock.AssertExpectations(t) }) | |||
| 23 | + | ||||
| 24 | + | return mock | |||
| 25 | + | } | |||
| 26 | + | ||||
| 27 | + | // MockCAPI is an autogenerated mock type for the CAPI type | |||
| 28 | + | type MockCAPI struct { | |||
| 29 | + | mock.Mock | |||
| 30 | + | } | |||
| 31 | + | ||||
| 32 | + | type MockCAPI_Expecter struct { | |||
| 33 | + | mock *mock.Mock | |||
| 34 | + | } | |||
| 35 | + | ||||
| 36 | + | func (_m *MockCAPI) EXPECT() *MockCAPI_Expecter { | |||
| 37 | + | return &MockCAPI_Expecter{mock: &_m.Mock} | |||
| 38 | + | } | |||
| 39 | + | ||||
| 40 | + | // PWDeinit provides a mock function for the type MockCAPI | |||
| 41 | + | func (_mock *MockCAPI) PWDeinit() { | |||
| 42 | + | _mock.Called() | |||
| 43 | + | return | |||
| 44 | + | } | |||
| 45 | + | ||||
| 46 | + | // MockCAPI_PWDeinit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWDeinit' | |||
| 47 | + | type MockCAPI_PWDeinit_Call struct { | |||
| 48 | + | *mock.Call | |||
| 49 | + | } | |||
| 50 | + | ||||
| 51 | + | // PWDeinit is a helper method to define mock.On call | |||
| 52 | + | func (_e *MockCAPI_Expecter) PWDeinit() *MockCAPI_PWDeinit_Call { | |||
| 53 | + | return &MockCAPI_PWDeinit_Call{Call: _e.mock.On("PWDeinit")} | |||
| 54 | + | } | |||
| 55 | + | ||||
| 56 | + | func (_c *MockCAPI_PWDeinit_Call) Run(run func()) *MockCAPI_PWDeinit_Call { | |||
| 57 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 58 | + | run() | |||
| 59 | + | }) | |||
| 60 | + | return _c | |||
| 61 | + | } | |||
| 62 | + | ||||
| 63 | + | func (_c *MockCAPI_PWDeinit_Call) Return() *MockCAPI_PWDeinit_Call { | |||
| 64 | + | _c.Call.Return() | |||
| 65 | + | return _c | |||
| 66 | + | } | |||
| 67 | + | ||||
| 68 | + | func (_c *MockCAPI_PWDeinit_Call) RunAndReturn(run func()) *MockCAPI_PWDeinit_Call { | |||
| 69 | + | _c.Run(run) | |||
| 70 | + | return _c | |||
| 71 | + | } | |||
| 72 | + | ||||
| 73 | + | // PWInit provides a mock function for the type MockCAPI | |||
| 74 | + | func (_mock *MockCAPI) PWInit(argc *int32, argv ***byte) { | |||
| 75 | + | _mock.Called(argc, argv) | |||
| 76 | + | return | |||
| 77 | + | } | |||
| 78 | + | ||||
| 79 | + | // MockCAPI_PWInit_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWInit' | |||
| 80 | + | type MockCAPI_PWInit_Call struct { | |||
| 81 | + | *mock.Call | |||
| 82 | + | } | |||
| 83 | + | ||||
| 84 | + | // PWInit is a helper method to define mock.On call | |||
| 85 | + | // - argc *int32 | |||
| 86 | + | // - argv ***byte | |||
| 87 | + | func (_e *MockCAPI_Expecter) PWInit(argc interface{}, argv interface{}) *MockCAPI_PWInit_Call { | |||
| 88 | + | return &MockCAPI_PWInit_Call{Call: _e.mock.On("PWInit", argc, argv)} | |||
| 89 | + | } | |||
| 90 | + | ||||
| 91 | + | func (_c *MockCAPI_PWInit_Call) Run(run func(argc *int32, argv ***byte)) *MockCAPI_PWInit_Call { | |||
| 92 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 93 | + | var arg0 *int32 | |||
| 94 | + | if args[0] != nil { | |||
| 95 | + | arg0 = args[0].(*int32) | |||
| 96 | + | } | |||
| 97 | + | var arg1 ***byte | |||
| 98 | + | if args[1] != nil { | |||
| 99 | + | arg1 = args[1].(***byte) | |||
| 100 | + | } | |||
| 101 | + | run( | |||
| 102 | + | arg0, | |||
| 103 | + | arg1, | |||
| 104 | + | ) | |||
| 105 | + | }) | |||
| 106 | + | return _c | |||
| 107 | + | } | |||
| 108 | + | ||||
| 109 | + | func (_c *MockCAPI_PWInit_Call) Return() *MockCAPI_PWInit_Call { | |||
| 110 | + | _c.Call.Return() | |||
| 111 | + | return _c | |||
| 112 | + | } | |||
| 113 | + | ||||
| 114 | + | func (_c *MockCAPI_PWInit_Call) RunAndReturn(run func(argc *int32, argv ***byte)) *MockCAPI_PWInit_Call { | |||
| 115 | + | _c.Run(run) | |||
| 116 | + | return _c | |||
| 117 | + | } | |||
| 118 | + | ||||
| 119 | + | // PWMainLoopDestroy provides a mock function for the type MockCAPI | |||
| 120 | + | func (_mock *MockCAPI) PWMainLoopDestroy(loop unsafe.Pointer) { | |||
| 121 | + | _mock.Called(loop) | |||
| 122 | + | return | |||
| 123 | + | } | |||
| 124 | + | ||||
| 125 | + | // MockCAPI_PWMainLoopDestroy_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWMainLoopDestroy' | |||
| 126 | + | type MockCAPI_PWMainLoopDestroy_Call struct { | |||
| 127 | + | *mock.Call | |||
| 128 | + | } | |||
| 129 | + | ||||
| 130 | + | // PWMainLoopDestroy is a helper method to define mock.On call | |||
| 131 | + | // - loop unsafe.Pointer | |||
| 132 | + | func (_e *MockCAPI_Expecter) PWMainLoopDestroy(loop interface{}) *MockCAPI_PWMainLoopDestroy_Call { | |||
| 133 | + | return &MockCAPI_PWMainLoopDestroy_Call{Call: _e.mock.On("PWMainLoopDestroy", loop)} | |||
| 134 | + | } | |||
| 135 | + | ||||
| 136 | + | func (_c *MockCAPI_PWMainLoopDestroy_Call) Run(run func(loop unsafe.Pointer)) *MockCAPI_PWMainLoopDestroy_Call { | |||
| 137 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 138 | + | var arg0 unsafe.Pointer | |||
| 139 | + | if args[0] != nil { | |||
| 140 | + | arg0 = args[0].(unsafe.Pointer) | |||
| 141 | + | } | |||
| 142 | + | run( | |||
| 143 | + | arg0, | |||
| 144 | + | ) | |||
| 145 | + | }) | |||
| 146 | + | return _c | |||
| 147 | + | } | |||
| 148 | + | ||||
| 149 | + | func (_c *MockCAPI_PWMainLoopDestroy_Call) Return() *MockCAPI_PWMainLoopDestroy_Call { | |||
| 150 | + | _c.Call.Return() | |||
| 151 | + | return _c | |||
| 152 | + | } | |||
| 153 | + | ||||
| 154 | + | func (_c *MockCAPI_PWMainLoopDestroy_Call) RunAndReturn(run func(loop unsafe.Pointer)) *MockCAPI_PWMainLoopDestroy_Call { | |||
| 155 | + | _c.Run(run) | |||
| 156 | + | return _c | |||
| 157 | + | } | |||
| 158 | + | ||||
| 159 | + | // PWMainLoopNew provides a mock function for the type MockCAPI | |||
| 160 | + | func (_mock *MockCAPI) PWMainLoopNew(props unsafe.Pointer) unsafe.Pointer { | |||
| 161 | + | ret := _mock.Called(props) | |||
| 162 | + | ||||
| 163 | + | if len(ret) == 0 { | |||
| 164 | + | panic("no return value specified for PWMainLoopNew") | |||
| 165 | + | } | |||
| 166 | + | ||||
| 167 | + | var r0 unsafe.Pointer | |||
| 168 | + | if returnFunc, ok := ret.Get(0).(func(unsafe.Pointer) unsafe.Pointer); ok { | |||
| 169 | + | r0 = returnFunc(props) | |||
| 170 | + | } else { | |||
| 171 | + | r0 = ret.Get(0).(unsafe.Pointer) | |||
| 172 | + | } | |||
| 173 | + | return r0 | |||
| 174 | + | } | |||
| 175 | + | ||||
| 176 | + | // MockCAPI_PWMainLoopNew_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWMainLoopNew' | |||
| 177 | + | type MockCAPI_PWMainLoopNew_Call struct { | |||
| 178 | + | *mock.Call | |||
| 179 | + | } | |||
| 180 | + | ||||
| 181 | + | // PWMainLoopNew is a helper method to define mock.On call | |||
| 182 | + | // - props unsafe.Pointer | |||
| 183 | + | func (_e *MockCAPI_Expecter) PWMainLoopNew(props interface{}) *MockCAPI_PWMainLoopNew_Call { | |||
| 184 | + | return &MockCAPI_PWMainLoopNew_Call{Call: _e.mock.On("PWMainLoopNew", props)} | |||
| 185 | + | } | |||
| 186 | + | ||||
| 187 | + | func (_c *MockCAPI_PWMainLoopNew_Call) Run(run func(props unsafe.Pointer)) *MockCAPI_PWMainLoopNew_Call { | |||
| 188 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 189 | + | var arg0 unsafe.Pointer | |||
| 190 | + | if args[0] != nil { | |||
| 191 | + | arg0 = args[0].(unsafe.Pointer) | |||
| 192 | + | } | |||
| 193 | + | run( | |||
| 194 | + | arg0, | |||
| 195 | + | ) | |||
| 196 | + | }) | |||
| 197 | + | return _c | |||
| 198 | + | } | |||
| 199 | + | ||||
| 200 | + | func (_c *MockCAPI_PWMainLoopNew_Call) Return(v unsafe.Pointer) *MockCAPI_PWMainLoopNew_Call { | |||
| 201 | + | _c.Call.Return(v) | |||
| 202 | + | return _c | |||
| 203 | + | } | |||
| 204 | + | ||||
| 205 | + | func (_c *MockCAPI_PWMainLoopNew_Call) RunAndReturn(run func(props unsafe.Pointer) unsafe.Pointer) *MockCAPI_PWMainLoopNew_Call { | |||
| 206 | + | _c.Call.Return(run) | |||
| 207 | + | return _c | |||
| 208 | + | } | |||
| 209 | + | ||||
| 210 | + | // PWMainLoopRun provides a mock function for the type MockCAPI | |||
| 211 | + | func (_mock *MockCAPI) PWMainLoopRun(loop unsafe.Pointer) int32 { | |||
| 212 | + | ret := _mock.Called(loop) | |||
| 213 | + | ||||
| 214 | + | if len(ret) == 0 { | |||
| 215 | + | panic("no return value specified for PWMainLoopRun") | |||
| 216 | + | } | |||
| 217 | + | ||||
| 218 | + | var r0 int32 | |||
| 219 | + | if returnFunc, ok := ret.Get(0).(func(unsafe.Pointer) int32); ok { | |||
| 220 | + | r0 = returnFunc(loop) | |||
| 221 | + | } else { | |||
| 222 | + | r0 = ret.Get(0).(int32) | |||
| 223 | + | } | |||
| 224 | + | return r0 | |||
| 225 | + | } | |||
| 226 | + | ||||
| 227 | + | // MockCAPI_PWMainLoopRun_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PWMainLoopRun' | |||
| 228 | + | type MockCAPI_PWMainLoopRun_Call struct { | |||
| 229 | + | *mock.Call | |||
| 230 | + | } | |||
| 231 | + | ||||
| 232 | + | // PWMainLoopRun is a helper method to define mock.On call | |||
| 233 | + | // - loop unsafe.Pointer | |||
| 234 | + | func (_e *MockCAPI_Expecter) PWMainLoopRun(loop interface{}) *MockCAPI_PWMainLoopRun_Call { | |||
| 235 | + | return &MockCAPI_PWMainLoopRun_Call{Call: _e.mock.On("PWMainLoopRun", loop)} | |||
| 236 | + | } | |||
| 237 | + | ||||
| 238 | + | func (_c *MockCAPI_PWMainLoopRun_Call) Run(run func(loop unsafe.Pointer)) *MockCAPI_PWMainLoopRun_Call { | |||
| 239 | + | _c.Call.Run(func(args mock.Arguments) { | |||
| 240 | + | var arg0 unsafe.Pointer | |||
| 241 | + | if args[0] != nil { | |||
| 242 | + | arg0 = args[0].(unsafe.Pointer) | |||
| 243 | + | } | |||
| 244 | + | run( | |||
| 245 | + | arg0, | |||
| 246 | + | ) | |||
| 247 | + | }) | |||
| 248 | + | return _c | |||
| 249 | + | } | |||
| 250 | + | ||||
| 251 | + | func (_c *MockCAPI_PWMainLoopRun_Call) Return(n int32) *MockCAPI_PWMainLoopRun_Call { | |||
| 252 | + | _c.Call.Return(n) | |||
| 253 | + | return _c | |||
| 254 | + | } | |||
| 255 | + | ||||
| 256 | + | func (_c *MockCAPI_PWMainLoopRun_Call) RunAndReturn(run func(loop unsafe.Pointer) int32) *MockCAPI_PWMainLoopRun_Call { | |||
| 257 | + | _c.Call.Return(run) | |||
| 258 | + | return _c | |||
| 259 | + | } | |||