From 3e9d7ef5236390ce6e07ef5d506e8b27103542e2 Mon Sep 17 00:00:00 2001 From: Saxon Milton Date: Mon, 16 Apr 2018 14:55:28 +0930 Subject: [PATCH] Two different outputs rather than rtmp output and two different methods --- revid/Config.go | 9 ++++++++- revid/Revid.go | 17 +++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/revid/Config.go b/revid/Config.go index 06b99c1a..d792704b 100644 --- a/revid/Config.go +++ b/revid/Config.go @@ -82,6 +82,7 @@ const ( QuantizationOff = 16 Yes = 17 No = 18 + NativeRtmp = 19 ) // Default config settings @@ -169,7 +170,13 @@ func (config *Config) Validate(r *revid) error { switch config.Output { case Http: 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 == "" { return errors.New("Bad RTMP URL") } diff --git a/revid/Revid.go b/revid/Revid.go index 506ff995..c5f64fef 100644 --- a/revid/Revid.go +++ b/revid/Revid.go @@ -154,15 +154,12 @@ func (r *revid) changeState(config Config) error { case File: r.sendClip = r.sendClipToFile r.setupOutput = r.setupOutputForFile - case Rtmp: - switch r.config.RtmpMethod { - case Ffmpeg: - r.setupOutput = r.setupOutputForFfmpegRtmp - r.sendClip = r.sendClipToFfmpegRtmp - case LibRtmp: - r.setupOutput = r.setupOutputForLibRtmp - r.sendClip = r.sendClipToLibRtmp - } + case FfmpegRtmp: + r.setupOutput = r.setupOutputForFfmpegRtmp + r.sendClip = r.sendClipToFfmpegRtmp + case NativeRtmp: + r.setupOutput = r.setupOutputForLibRtmp + r.sendClip = r.sendClipToLibRtmp case Http: r.sendClip = r.sendClipToHTTP } @@ -366,7 +363,7 @@ func (r *revid) outputClips() { break } r.Log(Error, err.Error()) - if r.config.RtmpMethod == LibRtmp && errorCount > 5 { + if r.config.Output == NativeRtmp && errorCount > 5 { reboot() } }