Null-DRM-Official/apps/streamd/internal/deps/fetch_mp4decrypt.go
404errordeveloper ac8701b5a6
All checks were successful
release / build-and-upload (push) Successful in 6m20s
modules-release / build-and-upload (push) Successful in 4m51s
streamd: optional keys, per-stream proxy, auto deps; agent module.yaml sync; RTE AutoPlay; Telegram release announces
- streamd: MPD-only start, proxy field, ffmpeg/NRE/mp4decrypt auto-install
- GET/PUT /api/modules for module.yaml sync; agent sync_modules
- RTE Live-tab AutoPlay fixes; modules zip named bbc/rte/tg4.zip
- Telegram notify scripts wired into Forgejo release workflows
2026-10-09 00:17:23 +02:00

50 lines
1.4 KiB
Go

package deps
import (
"fmt"
"os"
"path/filepath"
"runtime"
)
// Official Bento4 SDK binaries from bento4.com (v1.6.0-641).
// linux/arm64 and windows/arm64 are not published there — clear error.
func fetchMP4Decrypt(binDir string, logf func(string, ...any)) (string, error) {
url, archiveName, err := bento4URL()
if err != nil {
return "", err
}
archivePath := filepath.Join(binDir, archiveName)
if err := downloadTo(url, archivePath, logf); err != nil {
return "", err
}
defer func() { _ = os.Remove(archivePath) }()
want := "mp4decrypt"
if runtime.GOOS == "windows" {
want = "mp4decrypt.exe"
}
dest := filepath.Join(binDir, want)
if err := extractNamed(archivePath, binDir, want, dest); err != nil {
return "", err
}
chmodX(dest)
return dest, nil
}
func bento4URL() (url, archiveName string, err error) {
const base = "https://www.bok.net/Bento4/binaries/"
switch runtime.GOOS + "/" + runtime.GOARCH {
case "windows/amd64":
name := "Bento4-SDK-1-6-0-641.x86_64-microsoft-win32.zip"
return base + name, name, nil
case "linux/amd64":
name := "Bento4-SDK-1-6-0-641.x86_64-unknown-linux.zip"
return base + name, name, nil
case "darwin/amd64", "darwin/arm64":
name := "Bento4-SDK-1-6-0-641.universal-apple-macosx.zip"
return base + name, name, nil
default:
return "", "", fmt.Errorf("no Bento4 binary for %s/%s (place mp4decrypt in bin/ manually)", runtime.GOOS, runtime.GOARCH)
}
}