[feature/OFFICIALLY UNSUPPORTED] add nowasm build tag to disable building with WebAssembly (#3429)

* add experimental build-tag 'nowasm' which uses local ffmpeg / ffprobe

* updated experimental support message

* add comment to build script explaining build tag

* add nowasm build tags to moderncsqlite files
This commit is contained in:
kim
2024-10-14 09:59:12 +00:00
committed by GitHub
parent 157ee3193d
commit 6a76b9d609
13 changed files with 301 additions and 26 deletions

View File

@@ -19,9 +19,6 @@ package ffmpeg
import (
"context"
"codeberg.org/gruf/go-ffmpreg/wasm"
"github.com/tetratelabs/wazero"
)
// runner simply abstracts away the complexities
@@ -53,7 +50,7 @@ func (r *runner) Init(n int) {
// Run will attempt to pass the given compiled WebAssembly module with args to run(), waiting on
// the receiving runner until a free slot is available to run an instance, (if a limit is enabled).
func (r *runner) Run(ctx context.Context, cmod wazero.CompiledModule, args Args) (uint32, error) {
func (r *runner) Run(ctx context.Context, run func() (uint32, error)) (uint32, error) {
select {
// Context canceled.
case <-ctx.Done():
@@ -66,6 +63,6 @@ func (r *runner) Run(ctx context.Context, cmod wazero.CompiledModule, args Args)
// Release slot back to pool on end.
defer func() { r.pool <- struct{}{} }()
// Pass to main module runner function.
return wasm.Run(ctx, runtime, cmod, args)
// Call run.
return run()
}