Normalize bitrate mode and refresh manual CRF

This commit is contained in:
Stu Leak 2026-01-04 06:34:42 -05:00
parent 2b6242c04e
commit e4c387dc45

12
main.go
View File

@ -6872,6 +6872,9 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
cb(val) cb(val)
} }
callCallback("updateEncodingControls") callCallback("updateEncodingControls")
if updateEncodingControls != nil {
updateEncodingControls()
}
} }
setResolution := func(val string) { setResolution := func(val string) {
@ -7804,6 +7807,12 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
"VBR": "VBR (Variable Bitrate)", "VBR": "VBR (Variable Bitrate)",
"Target Size": "Target Size (Calculate from file size)", "Target Size": "Target Size (Calculate from file size)",
} }
normalizeBitrateMode := func(mode string) string {
if shortCode, ok := bitrateModeMap[mode]; ok {
return shortCode
}
return mode
}
bitrateModeSelect = widget.NewSelect(bitrateModeOptions, func(value string) { bitrateModeSelect = widget.NewSelect(bitrateModeOptions, func(value string) {
// Extract short code from label // Extract short code from label
if shortCode, ok := bitrateModeMap[value]; ok { if shortCode, ok := bitrateModeMap[value]; ok {
@ -7828,6 +7837,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
} else { } else {
bitrateModeSelect.SetSelected(state.convert.BitrateMode) bitrateModeSelect.SetSelected(state.convert.BitrateMode)
} }
state.convert.BitrateMode = normalizeBitrateMode(state.convert.BitrateMode)
// Manual CRF entry // Manual CRF entry
// CRF entry with debouncing (300ms delay) and validation // CRF entry with debouncing (300ms delay) and validation
@ -8366,7 +8376,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
setBitratePreset(state.convert.BitratePreset) setBitratePreset(state.convert.BitratePreset)
updateEncodingControls = func() { updateEncodingControls = func() {
mode := state.convert.BitrateMode mode := normalizeBitrateMode(state.convert.BitrateMode)
isLossless := state.convert.Quality == "Lossless" isLossless := state.convert.Quality == "Lossless"
supportsLossless := codecSupportsLossless(state.convert.VideoCodec) supportsLossless := codecSupportsLossless(state.convert.VideoCodec)