Auto stash before merge of "rtmpOutputFunctionality" and "origin/rtmpOutputFunctionality"

This commit is contained in:
Unknown 2018-03-14 11:32:22 +10:30
parent d718534f0f
commit 431b2c4a5f
2 changed files with 43 additions and 15 deletions

View File

@ -77,6 +77,8 @@ const (
Revid = 12 Revid = 12
Flv = 13 Flv = 13
LibRtmp = 14 LibRtmp = 14
QuantizationOn = 15
QuantizationOff = 16
) )
// Default config settings // Default config settings
@ -88,11 +90,22 @@ const (
defaultTimeout = "0" defaultTimeout = "0"
defaultQuantization = "40" defaultQuantization = "40"
defaultBitrate = "0" defaultBitrate = "0"
defaultQuantizationMode = QuantizationOff
) )
// checkConfig checks for any errors in the config files and defaults settings // checkConfig checks for any errors in the config files and defaults settings
// if particular parameters have not been defined. // if particular parameters have not been defined.
func (config *Config) Validate(r *revidInst) error { func (config *Config) Validate(r *revidInst) error {
switch config.QuantizationMode {
case QuantizationOn:
case QuantizationOff:
case NothingDefined:
r.Log(Warning, "No quantization mode defined, defaulting to QuantizationOff!")
config.QuantizationMode = QuantizationOff
default:
return errors.New("Bad QuantizationMode define in config!")
}
switch config.Input { switch config.Input {
case Rtp: case Rtp:
case Raspivid: case Raspivid:

View File

@ -451,24 +451,39 @@ func (r *revidInst) setupOutputForFile() (err error) {
// setupInputForRaspivid sets up things for input from raspivid i.e. starts // setupInputForRaspivid sets up things for input from raspivid i.e. starts
// a raspivid process and pipes it's data output. // a raspivid process and pipes it's data output.
func (r *revidInst) setupInputForRaspivid() error { func (r *revidInst) setupInputForRaspivid() error {
//fps,_ := strconv.Atoi(r.config.FrameRate)
//r.parser.SetDelay( uint( float64(1000) / float64(fps) ) )
r.Log(Info, "Starting raspivid!") r.Log(Info, "Starting raspivid!")
switch r.config.InputCodec { switch r.config.InputCodec {
case H264: case H264:
r.cmd = exec.Command("raspivid", switch r.config.QuantizationMode {
"-cd", "H264", case QuantizationOn:
"-o", "-", r.cmd = exec.Command("raspivid",
"-n", "-cd", "H264",
"-t", r.config.Timeout, "-o", "-",
"-b", "500000", "-n",
//"-qp", r.config.Quantization, "-t", r.config.Timeout,
"-w", r.config.Width, "-b", "0",
"-h", r.config.Height, "-qp", r.config.Quantization,
"-fps", r.config.FrameRate, "-w", r.config.Width,
"-ih", "-h", r.config.Height,
"-g", r.config.IntraRefreshPeriod, "-fps", r.config.FrameRate,
) "-ih",
"-g", r.config.IntraRefreshPeriod,
)
case QuantizationOff:
r.cmd = exec.Command("raspivid",
"-cd", "H264",
"-o", "-",
"-n",
"-t", r.config.Timeout,
"-b", r.config.Bitrate,
"-w", r.config.Width,
"-h", r.config.Height,
"-fps", r.config.FrameRate,
"-ih",
"-g", r.config.IntraRefreshPeriod,
)
}
case Mjpeg: case Mjpeg:
r.cmd = exec.Command("raspivid", r.cmd = exec.Command("raspivid",
"-cd", "MJPEG", "-cd", "MJPEG",