Trim extra UI rebuild guard

This commit is contained in:
Stu 2025-12-10 05:02:17 -05:00
parent 22e325e123
commit a393183d83

28
main.go
View File

@ -469,18 +469,18 @@ func (s *appState) buildComparePane(src *videoSource, onStop func(), setSess fun
videoImg := canvas.NewImageFromResource(nil)
videoImg.SetMinSize(fyne.NewSize(960, 540))
// Populate a preview frame if available
if len(src.PreviewFrames) == 0 {
if frames, err := capturePreviewFrames(src.Path, src.Duration); err == nil && len(frames) > 0 {
src.PreviewFrames = frames
if len(src.PreviewFrames) == 0 {
if frames, err := capturePreviewFrames(src.Path, src.Duration); err == nil && len(frames) > 0 {
src.PreviewFrames = frames
}
}
}
if len(src.PreviewFrames) > 0 {
s.currentFrame = src.PreviewFrames[0]
videoImg.File = s.currentFrame
videoImg.Refresh()
}
videoImg.FillMode = canvas.ImageFillContain
stage := container.NewMax(stageBG, videoImg)
if len(src.PreviewFrames) > 0 {
s.currentFrame = src.PreviewFrames[0]
videoImg.File = s.currentFrame
videoImg.Refresh()
}
videoImg.FillMode = canvas.ImageFillContain
stage := container.NewMax(stageBG, videoImg)
currentTime := widget.NewLabel("0:00")
totalTime := widget.NewLabel(src.DurationString())
@ -3930,9 +3930,6 @@ func (p *playSession) runVideo(offset float64) {
fmt.Printf("❌ FATAL: ffmpeg not found in PATH: %v\n", pathErr)
}
logging.Debug(logging.CatFFMPEG, "video start failed: %v (%s)", err, errMsg)
fyne.Do(func() {
dialog.ShowError(fmt.Errorf("Failed to start video decode: %v\n%s", err, errMsg), fyne.CurrentApp().Driver().AllWindows()[0])
})
return
}
fmt.Printf("✅ FFmpeg started (PID: %d) in %.3fs\n", cmd.Process.Pid, time.Since(startTime).Seconds())
@ -3986,9 +3983,6 @@ func (p *playSession) runVideo(offset float64) {
fmt.Printf(" FFmpeg error: %s\n", msg)
}
logging.Debug(logging.CatFFMPEG, "video read failed: %v (%s)", err, msg)
fyne.Do(func() {
dialog.ShowError(fmt.Errorf("Video decode failed: %v\n%s", err, msg), fyne.CurrentApp().Driver().AllWindows()[0])
})
return
}