mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore] update go ffmpreg to v0.6.0 (#3515)
* pull in go-ffmpreg v0.6.0 * add code comment * grrr linter * set empty module name when calling ffmpeg / ffprobe
This commit is contained in:
@ -21,6 +21,7 @@ package ffmpeg
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
|
||||
"codeberg.org/gruf/go-ffmpreg/wasm"
|
||||
)
|
||||
@ -35,12 +36,25 @@ var ffmpegRunner runner
|
||||
// prepares the runner to only allow max given concurrent running instances.
|
||||
func InitFfmpeg(ctx context.Context, max int) error {
|
||||
ffmpegRunner.Init(max)
|
||||
return compileFfmpeg(ctx)
|
||||
return initWASM(ctx)
|
||||
}
|
||||
|
||||
// Ffmpeg runs the given arguments with an instance of ffmpeg.
|
||||
func Ffmpeg(ctx context.Context, args Args) (uint32, error) {
|
||||
return ffmpegRunner.Run(ctx, func() (uint32, error) {
|
||||
return wasm.Run(ctx, runtime, ffmpeg, args)
|
||||
|
||||
// Load WASM rt and module.
|
||||
ffmpreg := ffmpreg.Load()
|
||||
if ffmpreg == nil {
|
||||
return 0, errors.New("wasm not initialized")
|
||||
}
|
||||
|
||||
// Call into ffmpeg.
|
||||
args.Name = "ffmpeg"
|
||||
return wasm.Run(ctx,
|
||||
ffmpreg.run,
|
||||
ffmpreg.mod,
|
||||
args,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user