Two different outputs rather than rtmp output and two different methods

This commit is contained in:
Saxon Milton 2018-04-16 14:55:28 +09:30
parent 093df161f1
commit 3e9d7ef523
2 changed files with 15 additions and 11 deletions

View File

@ -82,6 +82,7 @@ const (
QuantizationOff = 16 QuantizationOff = 16
Yes = 17 Yes = 17
No = 18 No = 18
NativeRtmp = 19
) )
// Default config settings // Default config settings
@ -169,7 +170,13 @@ func (config *Config) Validate(r *revid) error {
switch config.Output { switch config.Output {
case Http: case Http:
case File: case File:
case Rtmp: case NativeRtmp:
if config.RtmpUrl == "" {
return errors.New("Bad RTMP URL")
}
r.Log(Info, "Defaulting frames per clip to 1 for rtmp output!")
config.FramesPerClip = 1
case FfmpegRtmp:
if config.RtmpUrl == "" { if config.RtmpUrl == "" {
return errors.New("Bad RTMP URL") return errors.New("Bad RTMP URL")
} }

View File

@ -154,15 +154,12 @@ func (r *revid) changeState(config Config) error {
case File: case File:
r.sendClip = r.sendClipToFile r.sendClip = r.sendClipToFile
r.setupOutput = r.setupOutputForFile r.setupOutput = r.setupOutputForFile
case Rtmp: case FfmpegRtmp:
switch r.config.RtmpMethod { r.setupOutput = r.setupOutputForFfmpegRtmp
case Ffmpeg: r.sendClip = r.sendClipToFfmpegRtmp
r.setupOutput = r.setupOutputForFfmpegRtmp case NativeRtmp:
r.sendClip = r.sendClipToFfmpegRtmp r.setupOutput = r.setupOutputForLibRtmp
case LibRtmp: r.sendClip = r.sendClipToLibRtmp
r.setupOutput = r.setupOutputForLibRtmp
r.sendClip = r.sendClipToLibRtmp
}
case Http: case Http:
r.sendClip = r.sendClipToHTTP r.sendClip = r.sendClipToHTTP
} }
@ -366,7 +363,7 @@ func (r *revid) outputClips() {
break break
} }
r.Log(Error, err.Error()) r.Log(Error, err.Error())
if r.config.RtmpMethod == LibRtmp && errorCount > 5 { if r.config.Output == NativeRtmp && errorCount > 5 {
reboot() reboot()
} }
} }