mirror of https://bitbucket.org/ausocean/av.git
Merged in simplify-mts-enc-setup (pull request #432)
revid/revid.go: simplified switch in anon func given to setupPipeline that deals with MTS encoder setup
This commit is contained in:
commit
aaafe66cc2
|
@ -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.Info, "config set")
|
||||||
|
|
||||||
r.cfg.Logger.Log(logger.Debug, "setting up revid pipeline")
|
r.cfg.Logger.Log(logger.Debug, "setting up revid pipeline")
|
||||||
|
|
||||||
err = r.setupPipeline(
|
err = r.setupPipeline(
|
||||||
func(dst io.WriteCloser, rate float64) (io.WriteCloser, error) {
|
func(dst io.WriteCloser, rate float64) (io.WriteCloser, error) {
|
||||||
var st int
|
var st int
|
||||||
var encOptions []func(*mts.Encoder) error
|
var encOptions []func(*mts.Encoder) error
|
||||||
|
|
||||||
switch r.cfg.Input {
|
switch r.cfg.Input {
|
||||||
case config.InputRaspivid:
|
case config.InputRaspivid,config.InputFile, config.InputV4L,config.InputRTSP:
|
||||||
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:
|
|
||||||
switch r.cfg.InputCodec {
|
switch r.cfg.InputCodec {
|
||||||
case codecutil.H265:
|
case codecutil.H265:
|
||||||
|
if r.cfg.Input != config.InputRTSP {
|
||||||
|
panic("H265 codec valid only for InputRTSP")
|
||||||
|
}
|
||||||
st = mts.EncodeH265
|
st = mts.EncodeH265
|
||||||
case codecutil.H264:
|
case codecutil.H264:
|
||||||
st = mts.EncodeH264
|
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))
|
encOptions = append(encOptions, mts.TimeBasedPSI(time.Duration(r.cfg.PSITime)*time.Second))
|
||||||
r.cfg.CBR = true
|
r.cfg.CBR = true
|
||||||
default:
|
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:
|
case config.InputAudio:
|
||||||
st = mts.EncodeAudio
|
st = mts.EncodeAudio
|
||||||
|
|
Loading…
Reference in New Issue