revid: panic if invalid input, or invalid input codec for corresponding input

This commit is contained in:
Saxon 2019-10-12 20:54:32 +10:30
parent 9087f727db
commit 8489d615d8
1 changed files with 6 additions and 0 deletions

View File

@ -177,6 +177,8 @@ func (r *Revid) reset(config Config) error {
case codecutil.MJPEG:
st = mts.EncodeMJPEG
encOptions = append(encOptions, mts.PacketBasedPSI(int(r.config.MinFrames)))
default:
panic("unknown input codec for raspivid input")
}
case File, V4L:
st = mts.EncodeH264
@ -189,9 +191,13 @@ func (r *Revid) reset(config Config) error {
case codecutil.MJPEG:
st = mts.EncodeMJPEG
encOptions = append(encOptions, mts.PacketBasedPSI(int(r.config.MinFrames)))
default:
panic("unknown input codec for RTSP input")
}
case Audio:
st = mts.EncodeAudio
default:
panic("unknown input type")
}
return mts.NewEncoder(dst, float64(fps), st, encOptions...)