mirror of https://bitbucket.org/ausocean/av.git
revid/revid.go: simplified switch in anon func given to setupPipeline that deals with MTS encoder setup
This commit is contained in:
parent
e318690e83
commit
3f41014eab
|
@ -168,37 +168,19 @@ func (r *Revid) reset(c config.Config) error {
|
|||
r.cfg.Logger.Log(logger.Info, "config set")
|
||||
|
||||
r.cfg.Logger.Log(logger.Debug, "setting up revid pipeline")
|
||||
|
||||
err = r.setupPipeline(
|
||||
func(dst io.WriteCloser, rate float64) (io.WriteCloser, error) {
|
||||
var st int
|
||||
var encOptions []func(*mts.Encoder) error
|
||||
|
||||
switch r.cfg.Input {
|
||||
case config.InputRaspivid:
|
||||
switch r.cfg.InputCodec {
|
||||
case codecutil.H264:
|
||||
st = mts.EncodeH264
|
||||
case codecutil.MJPEG:
|
||||
st = mts.EncodeMJPEG
|
||||
encOptions = append(encOptions, mts.TimeBasedPSI(time.Duration(r.cfg.PSITime)*time.Second))
|
||||
r.cfg.CBR = true
|
||||
default:
|
||||
panic("unknown input codec for raspivid input")
|
||||
}
|
||||
case config.InputFile, config.InputV4L:
|
||||
switch r.cfg.InputCodec {
|
||||
case codecutil.H264:
|
||||
st = mts.EncodeH264
|
||||
case codecutil.MJPEG:
|
||||
st = mts.EncodeMJPEG
|
||||
encOptions = append(encOptions, mts.TimeBasedPSI(time.Duration(r.cfg.PSITime)*time.Second))
|
||||
r.cfg.CBR = true
|
||||
default:
|
||||
panic(fmt.Sprintf("unknown input codec %d for v4l or input file input", r.cfg.InputCodec))
|
||||
}
|
||||
case config.InputRTSP:
|
||||
case config.InputRaspivid,config.InputFile, config.InputV4L,config.InputRTSP:
|
||||
switch r.cfg.InputCodec {
|
||||
case codecutil.H265:
|
||||
if r.cfg.Input != config.InputRTSP {
|
||||
panic("H265 codec valid only for InputRTSP")
|
||||
}
|
||||
st = mts.EncodeH265
|
||||
case codecutil.H264:
|
||||
st = mts.EncodeH264
|
||||
|
@ -207,7 +189,7 @@ func (r *Revid) reset(c config.Config) error {
|
|||
encOptions = append(encOptions, mts.TimeBasedPSI(time.Duration(r.cfg.PSITime)*time.Second))
|
||||
r.cfg.CBR = true
|
||||
default:
|
||||
panic("unknown input codec for RTSP input")
|
||||
panic(fmt.Sprintf("unknown input codec for Raspivid, File, V4l or RTSP input", r.cfg.InputCodec))
|
||||
}
|
||||
case config.InputAudio:
|
||||
st = mts.EncodeAudio
|
||||
|
|
Loading…
Reference in New Issue