input/gvctrl/gvctrl.go: adapted CBRBitrate option function to supported 1080 resolution bitrates

This commit is contained in:
Saxon 2019-10-25 00:58:48 +10:30
parent d3cb619389
commit a5064e872c
2 changed files with 12 additions and 17 deletions

View File

@ -241,22 +241,16 @@ func VBRBitrate(r int) Option {
// value is selected.
func CBRBitrate(r int) Option {
return func(s settings) (settings, error) {
var (
cbrRates256 = []int{128, 256, 512, 1024}
cbrRates360 = []int{512, 1024, 2048, 3072}
cbrRates720 = []int{1024, 2048, 4096, 6144}
)
switch s.res {
case res720:
s.cbrBitrate = convRate(r, cbrRates720)
case res360:
s.cbrBitrate = convRate(r, cbrRates360)
case res256:
s.cbrBitrate = convRate(r, cbrRates256)
default:
v, ok := map[string]string{
res1080: convRate(r, []int{2048, 4096, 6144, 8192}),
res720: convRate(r, []int{1024, 2048, 4096, 6144}),
res360: convRate(r, []int{512, 1024, 2048, 3072}),
res256: convRate(r, []int{128, 256, 512, 1024}),
}[s.res]
if !ok {
panic("bad resolution")
}
s.cbrBitrate = v
return s, nil
}
}

View File

@ -36,9 +36,10 @@ import (
// The strings used in encoding the settings form to indicate resultion.
const (
res256 = "4480256" // 480x256
res360 = "6400360" // 640x360
res720 = "12800720" // 1280x720
res256 = "4480256" // 480x256
res360 = "6400360" // 640x360
res720 = "12800720" // 1280x720
res1080 = "192001080" // 1920x1080
)
// Default values for fields in the settings struct when the newSettings