fix: Wails file drop, duplicate listeners, trim drag, crop stage, preview cache/pixfmt, NSIS temp quoting
Build Windows Installer / build (push) Successful in 8m46s

This commit is contained in:
m4xx1m committed 2026-11-12 18:04:53 +03:00
1 parent 65387c5dcd
commit 478dbff654
12 files changed
+563 -226

No files matched your search

+8
View File
@@ -198,6 +198,11 @@ func parseRationalFPS(expr string) float64 {
return 0
}
func IsH264BrowserNativePixFmt(pixFmt string) bool {
p := strings.ToLower(strings.TrimSpace(pixFmt))
return p == "" || p == "yuv420p" || p == "yuvj420p"
}
func isBrowserNative(info *VideoInfo) bool {
extOK := info.Extension == ".mp4" || info.Extension == ".m4v" || info.Extension == ".webm"
if !extOK {
@@ -207,6 +212,9 @@ func isBrowserNative(info *VideoInfo) bool {
if !vOK {
return false
}
if info.VideoCodec == "h264" && !IsH264BrowserNativePixFmt(info.PixFmt) {
return false
}
// If multiple audio tracks exist, browser plays only track 0; if user wants to preview natively it's fine,
// we still treat single-compatible audio as native.
for _, a := range info.AudioStreams {
+33
View File
@@ -94,3 +94,36 @@ func TestParseRationalFPS(t *testing.T) {
}
}
}
func TestParseProbeJSON_H264PixFmtCompatibility(t *testing.T) {
makeSample := func(pixFmt string) []byte {
return []byte(`{
"format": {"duration": "10.0"},
"streams": [{"index": 0, "codec_type": "video", "codec_name": "h264", "width": 1280, "height": 720, "pix_fmt": "` + pixFmt + `"}]
}`)
}
okInfo, err := ParseProbeJSON(makeSample("yuv420p"), "clip.mp4", 100)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if !okInfo.BrowserNative {
t.Fatalf("expected yuv420p mp4 to be browser native")
}
hi10Info, err := ParseProbeJSON(makeSample("yuv420p10le"), "clip10.mp4", 100)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if hi10Info.BrowserNative {
t.Fatalf("expected 10-bit yuv420p10le mp4 NOT to be browser native")
}
fmt422Info, err := ParseProbeJSON(makeSample("yuv422p"), "clip422.mp4", 100)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
if fmt422Info.BrowserNative {
t.Fatalf("expected yuv422p mp4 NOT to be browser native")
}
}