mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-28 18:12:25 -05:00
[chore] update dependencies (#4458)
- codeberg.org/gruf/go-ffmpreg: v0.6.11 -> v0.6.12 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4458 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
This commit is contained in:
parent
3db2d42247
commit
dfdf06e4ad
8 changed files with 110 additions and 36 deletions
2
go.mod
2
go.mod
|
|
@ -21,7 +21,7 @@ require (
|
||||||
codeberg.org/gruf/go-errors/v2 v2.3.2
|
codeberg.org/gruf/go-errors/v2 v2.3.2
|
||||||
codeberg.org/gruf/go-fastcopy v1.1.3
|
codeberg.org/gruf/go-fastcopy v1.1.3
|
||||||
codeberg.org/gruf/go-fastpath/v2 v2.0.0
|
codeberg.org/gruf/go-fastpath/v2 v2.0.0
|
||||||
codeberg.org/gruf/go-ffmpreg v0.6.11
|
codeberg.org/gruf/go-ffmpreg v0.6.12
|
||||||
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf
|
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf
|
||||||
codeberg.org/gruf/go-kv/v2 v2.0.7
|
codeberg.org/gruf/go-kv/v2 v2.0.7
|
||||||
codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f
|
codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f
|
||||||
|
|
|
||||||
4
go.sum
generated
4
go.sum
generated
|
|
@ -26,8 +26,8 @@ codeberg.org/gruf/go-fastcopy v1.1.3 h1:Jo9VTQjI6KYimlw25PPc7YLA3Xm+XMQhaHwKnM7x
|
||||||
codeberg.org/gruf/go-fastcopy v1.1.3/go.mod h1:GDDYR0Cnb3U/AIfGM3983V/L+GN+vuwVMvrmVABo21s=
|
codeberg.org/gruf/go-fastcopy v1.1.3/go.mod h1:GDDYR0Cnb3U/AIfGM3983V/L+GN+vuwVMvrmVABo21s=
|
||||||
codeberg.org/gruf/go-fastpath/v2 v2.0.0 h1:iAS9GZahFhyWEH0KLhFEJR+txx1ZhMXxYzu2q5Qo9c0=
|
codeberg.org/gruf/go-fastpath/v2 v2.0.0 h1:iAS9GZahFhyWEH0KLhFEJR+txx1ZhMXxYzu2q5Qo9c0=
|
||||||
codeberg.org/gruf/go-fastpath/v2 v2.0.0/go.mod h1:3pPqu5nZjpbRrOqvLyAK7puS1OfEtQvjd6342Cwz56Q=
|
codeberg.org/gruf/go-fastpath/v2 v2.0.0/go.mod h1:3pPqu5nZjpbRrOqvLyAK7puS1OfEtQvjd6342Cwz56Q=
|
||||||
codeberg.org/gruf/go-ffmpreg v0.6.11 h1:+lvB5Loy0KUAKfv6nOZRWHFVgN08cpHhUlYcZxL8M20=
|
codeberg.org/gruf/go-ffmpreg v0.6.12 h1:mPdRx1TAQJQPhRkTOOHnRSY6omNCLJ7M6ajjuEMNNvE=
|
||||||
codeberg.org/gruf/go-ffmpreg v0.6.11/go.mod h1:tGqIMh/I2cizqauxxNAN+WGkICI0j5G3xwF1uBkyw1E=
|
codeberg.org/gruf/go-ffmpreg v0.6.12/go.mod h1:tGqIMh/I2cizqauxxNAN+WGkICI0j5G3xwF1uBkyw1E=
|
||||||
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf h1:84s/ii8N6lYlskZjHH+DG6jyia8w2mXMZlRwFn8Gs3A=
|
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf h1:84s/ii8N6lYlskZjHH+DG6jyia8w2mXMZlRwFn8Gs3A=
|
||||||
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf/go.mod h1:zZAICsp5rY7+hxnws2V0ePrWxE0Z2Z/KXcN3p/RQCfk=
|
codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf/go.mod h1:zZAICsp5rY7+hxnws2V0ePrWxE0Z2Z/KXcN3p/RQCfk=
|
||||||
codeberg.org/gruf/go-kv v1.6.5 h1:ttPf0NA8F79pDqBttSudPTVCZmGncumeNIxmeM9ztz0=
|
codeberg.org/gruf/go-kv v1.6.5 h1:ttPf0NA8F79pDqBttSudPTVCZmGncumeNIxmeM9ztz0=
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ func initWASM(ctx context.Context) error {
|
||||||
defer func() {
|
defer func() {
|
||||||
if err == nil && set {
|
if err == nil && set {
|
||||||
// Drop binary.
|
// Drop binary.
|
||||||
embed.B = nil
|
embed.Free()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ func initWASM(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile ffmpreg WebAssembly into memory.
|
// Compile ffmpreg WebAssembly into memory.
|
||||||
mod, err = run.CompileModule(ctx, embed.B)
|
mod, err = run.CompileModule(ctx, embed.B())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
35
vendor/codeberg.org/gruf/go-ffmpreg/embed/lib.go
generated
vendored
35
vendor/codeberg.org/gruf/go-ffmpreg/embed/lib.go
generated
vendored
|
|
@ -1,39 +1,46 @@
|
||||||
package embed
|
package embed
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
_ "embed"
|
_ "embed"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if path := os.Getenv("FFMPREG_WASM"); path != "" {
|
|
||||||
// Read file into memory.
|
|
||||||
B, err = os.ReadFile(path)
|
|
||||||
if err != nil {
|
|
||||||
panic(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wrap bytes in reader.
|
// Wrap bytes in reader.
|
||||||
b := bytes.NewReader(B)
|
r := strings.NewReader(s)
|
||||||
|
|
||||||
// Create unzipper from reader.
|
// Create unzipper from reader.
|
||||||
gz, err := gzip.NewReader(b)
|
gz, err := gzip.NewReader(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract gzipped binary.
|
// Extract gzipped binary.
|
||||||
B, err = io.ReadAll(gz)
|
b, err := io.ReadAll(gz)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set binary.
|
||||||
|
s = string(b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// B returns a copy of
|
||||||
|
// embedded binary data.
|
||||||
|
func B() []byte {
|
||||||
|
if s == "" {
|
||||||
|
panic("binary already dropped from memory")
|
||||||
|
}
|
||||||
|
return []byte(s)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free will drop embedded
|
||||||
|
// binary from runtime mem.
|
||||||
|
func Free() { s = "" }
|
||||||
|
|
||||||
//go:embed ffmpreg.wasm.gz
|
//go:embed ffmpreg.wasm.gz
|
||||||
var B []byte
|
var s string
|
||||||
|
|
|
||||||
97
vendor/codeberg.org/gruf/go-ffmpreg/wasm/funcs.go
generated
vendored
97
vendor/codeberg.org/gruf/go-ffmpreg/wasm/funcs.go
generated
vendored
|
|
@ -9,22 +9,93 @@ import (
|
||||||
|
|
||||||
type snapshotskey struct{}
|
type snapshotskey struct{}
|
||||||
|
|
||||||
|
type snapshotctx struct {
|
||||||
|
context.Context
|
||||||
|
snaps *snapshots
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ctx snapshotctx) Value(key any) any {
|
||||||
|
if _, ok := key.(snapshotskey); ok {
|
||||||
|
return ctx.snaps
|
||||||
|
}
|
||||||
|
return ctx.Context.Value(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
const ringsz uint = 8
|
||||||
|
|
||||||
|
type snapshots struct {
|
||||||
|
r [ringsz]struct {
|
||||||
|
eptr uint32
|
||||||
|
snap experimental.Snapshot
|
||||||
|
}
|
||||||
|
n uint
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *snapshots) get(envptr uint32) experimental.Snapshot {
|
||||||
|
start := (s.n % ringsz)
|
||||||
|
|
||||||
|
for i := start; i != ^uint(0); i-- {
|
||||||
|
if s.r[i].eptr == envptr {
|
||||||
|
snap := s.r[i].snap
|
||||||
|
s.r[i].eptr = 0
|
||||||
|
s.r[i].snap = nil
|
||||||
|
s.n = i - 1
|
||||||
|
return snap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := ringsz - 1; i > start; i-- {
|
||||||
|
if s.r[i].eptr == envptr {
|
||||||
|
snap := s.r[i].snap
|
||||||
|
s.r[i].eptr = 0
|
||||||
|
s.r[i].snap = nil
|
||||||
|
s.n = i - 1
|
||||||
|
return snap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
panic("snapshot not found")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *snapshots) set(envptr uint32, snapshot experimental.Snapshot) {
|
||||||
|
start := (s.n % ringsz)
|
||||||
|
|
||||||
|
for i := start; i < ringsz; i++ {
|
||||||
|
switch s.r[i].eptr {
|
||||||
|
case 0, envptr:
|
||||||
|
s.r[i].eptr = envptr
|
||||||
|
s.r[i].snap = snapshot
|
||||||
|
s.n = i
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for i := uint(0); i < start; i++ {
|
||||||
|
switch s.r[i].eptr {
|
||||||
|
case 0, envptr:
|
||||||
|
s.r[i].eptr = envptr
|
||||||
|
s.r[i].snap = snapshot
|
||||||
|
s.n = i
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
panic("snapshots full")
|
||||||
|
}
|
||||||
|
|
||||||
// withSetjmpLongjmp updates the context to contain wazero/experimental.Snapshotter{} support,
|
// withSetjmpLongjmp updates the context to contain wazero/experimental.Snapshotter{} support,
|
||||||
// and embeds the necessary snapshots map required for later calls to Setjmp() / Longjmp().
|
// and embeds the necessary snapshots map required for later calls to Setjmp() / Longjmp().
|
||||||
func withSetjmpLongjmp(ctx context.Context) context.Context {
|
func withSetjmpLongjmp(ctx context.Context) context.Context {
|
||||||
snapshots := make(map[uint32]experimental.Snapshot, 10)
|
return snapshotctx{Context: experimental.WithSnapshotter(ctx), snaps: new(snapshots)}
|
||||||
ctx = experimental.WithSnapshotter(ctx)
|
|
||||||
ctx = context.WithValue(ctx, snapshotskey{}, snapshots)
|
|
||||||
return ctx
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getSnapshots(ctx context.Context) map[uint32]experimental.Snapshot {
|
func getSnapshots(ctx context.Context) *snapshots {
|
||||||
v, _ := ctx.Value(snapshotskey{}).(map[uint32]experimental.Snapshot)
|
v, _ := ctx.Value(snapshotskey{}).(*snapshots)
|
||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
// setjmp implements the C function: setjmp(env jmp_buf)
|
// setjmp implements the C function: setjmp(env jmp_buf)
|
||||||
func setjmp(ctx context.Context, mod api.Module, stack []uint64) {
|
func setjmp(ctx context.Context, _ api.Module, stack []uint64) {
|
||||||
|
|
||||||
// Input arguments.
|
// Input arguments.
|
||||||
envptr := api.DecodeU32(stack[0])
|
envptr := api.DecodeU32(stack[0])
|
||||||
|
|
@ -35,19 +106,16 @@ func setjmp(ctx context.Context, mod api.Module, stack []uint64) {
|
||||||
|
|
||||||
// Get stored snapshots map.
|
// Get stored snapshots map.
|
||||||
snapshots := getSnapshots(ctx)
|
snapshots := getSnapshots(ctx)
|
||||||
if snapshots == nil {
|
|
||||||
panic("setjmp / longjmp not supported")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set latest snapshot in map.
|
// Set latest snapshot in map.
|
||||||
snapshots[envptr] = snapshot
|
snapshots.set(envptr, snapshot)
|
||||||
|
|
||||||
// Set return.
|
// Set return.
|
||||||
stack[0] = 0
|
stack[0] = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// longjmp implements the C function: int longjmp(env jmp_buf, value int)
|
// longjmp implements the C function: int longjmp(env jmp_buf, value int)
|
||||||
func longjmp(ctx context.Context, mod api.Module, stack []uint64) {
|
func longjmp(ctx context.Context, _ api.Module, stack []uint64) {
|
||||||
|
|
||||||
// Input arguments.
|
// Input arguments.
|
||||||
envptr := api.DecodeU32(stack[0])
|
envptr := api.DecodeU32(stack[0])
|
||||||
|
|
@ -60,10 +128,7 @@ func longjmp(ctx context.Context, mod api.Module, stack []uint64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get snapshot stored in map.
|
// Get snapshot stored in map.
|
||||||
snapshot := snapshots[envptr]
|
snapshot := snapshots.get(envptr)
|
||||||
if snapshot == nil {
|
|
||||||
panic("must first call setjmp")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set return.
|
// Set return.
|
||||||
stack[0] = 0
|
stack[0] = 0
|
||||||
|
|
|
||||||
1
vendor/codeberg.org/gruf/go-ffmpreg/wasm/run.go
generated
vendored
1
vendor/codeberg.org/gruf/go-ffmpreg/wasm/run.go
generated
vendored
|
|
@ -53,6 +53,7 @@ func Run(
|
||||||
modcfg = modcfg.WithStdin(args.Stdin)
|
modcfg = modcfg.WithStdin(args.Stdin)
|
||||||
modcfg = modcfg.WithStdout(args.Stdout)
|
modcfg = modcfg.WithStdout(args.Stdout)
|
||||||
modcfg = modcfg.WithStderr(args.Stderr)
|
modcfg = modcfg.WithStderr(args.Stderr)
|
||||||
|
modcfg = modcfg.WithName("")
|
||||||
|
|
||||||
if args.Config != nil {
|
if args.Config != nil {
|
||||||
// Pass through config fn.
|
// Pass through config fn.
|
||||||
|
|
|
||||||
1
vendor/codeberg.org/gruf/go-ffmpreg/wasm/runtime.go
generated
vendored
1
vendor/codeberg.org/gruf/go-ffmpreg/wasm/runtime.go
generated
vendored
|
|
@ -28,6 +28,7 @@ func NewRuntime(ctx context.Context, cfg wazero.RuntimeConfig) (wazero.Runtime,
|
||||||
|
|
||||||
// Set core features ffmpeg compiled with.
|
// Set core features ffmpeg compiled with.
|
||||||
cfg = cfg.WithCoreFeatures(CoreFeatures)
|
cfg = cfg.WithCoreFeatures(CoreFeatures)
|
||||||
|
cfg = cfg.WithDebugInfoEnabled(false)
|
||||||
|
|
||||||
// Instantiate runtime with prepared config.
|
// Instantiate runtime with prepared config.
|
||||||
rt := wazero.NewRuntimeWithConfig(ctx, cfg)
|
rt := wazero.NewRuntimeWithConfig(ctx, cfg)
|
||||||
|
|
|
||||||
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
|
|
@ -247,7 +247,7 @@ codeberg.org/gruf/go-fastcopy
|
||||||
# codeberg.org/gruf/go-fastpath/v2 v2.0.0
|
# codeberg.org/gruf/go-fastpath/v2 v2.0.0
|
||||||
## explicit; go 1.14
|
## explicit; go 1.14
|
||||||
codeberg.org/gruf/go-fastpath/v2
|
codeberg.org/gruf/go-fastpath/v2
|
||||||
# codeberg.org/gruf/go-ffmpreg v0.6.11
|
# codeberg.org/gruf/go-ffmpreg v0.6.12
|
||||||
## explicit; go 1.22.0
|
## explicit; go 1.22.0
|
||||||
codeberg.org/gruf/go-ffmpreg/embed
|
codeberg.org/gruf/go-ffmpreg/embed
|
||||||
codeberg.org/gruf/go-ffmpreg/wasm
|
codeberg.org/gruf/go-ffmpreg/wasm
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue