From e72ebe2f064dcee87b00560fc606acb429c8cfae Mon Sep 17 00:00:00 2001 From: Trek H Date: Fri, 14 Aug 2020 23:04:56 +0930 Subject: [PATCH 1/2] revid: add S0 to pins that are sent via HTTP --- revid/senders.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/revid/senders.go b/revid/senders.go index 5c63de75..c2ee641c 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -95,17 +95,22 @@ func (s *httpSender) Write(d []byte) (int, error) { func (s *httpSender) Close() error { return nil } func httpSend(d []byte, client *netsender.Sender, log func(lvl int8, msg string, args ...interface{})) error { - // Only send if "V0" is configured as an input. + // Only send if "V0" or "S0" are configured as input. send := false ip := client.Param("ip") log(logger.Debug, "making pins, and sending recv request", "ip", ip) - pins := netsender.MakePins(ip, "V") + pins := netsender.MakePins(ip, "V,S") for i, pin := range pins { - if pin.Name == "V0" { - send = true + if pin.Name == "V0" || pin.Name == "S0" { + switch pin.Name { + case "V0": + pins[i].MimeType = "video/mp2t" + case "S0": + pins[i].MimeType = "audio/x-wav" + } pins[i].Value = len(d) pins[i].Data = d - pins[i].MimeType = "video/mp2t" + send = true break } } From cca5582acb1b93ff455438ee1bfd586f16a724b0 Mon Sep 17 00:00:00 2001 From: Trek H Date: Sat, 15 Aug 2020 17:38:45 +0930 Subject: [PATCH 2/2] revid: simplify syntax --- revid/senders.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/revid/senders.go b/revid/senders.go index c2ee641c..82f5cf18 100644 --- a/revid/senders.go +++ b/revid/senders.go @@ -101,18 +101,18 @@ func httpSend(d []byte, client *netsender.Sender, log func(lvl int8, msg string, log(logger.Debug, "making pins, and sending recv request", "ip", ip) pins := netsender.MakePins(ip, "V,S") for i, pin := range pins { - if pin.Name == "V0" || pin.Name == "S0" { - switch pin.Name { - case "V0": - pins[i].MimeType = "video/mp2t" - case "S0": - pins[i].MimeType = "audio/x-wav" - } - pins[i].Value = len(d) - pins[i].Data = d - send = true - break + switch pin.Name { + case "V0": + pins[i].MimeType = "video/mp2t" + case "S0": + pins[i].MimeType = "audio/x-wav" + default: + continue } + pins[i].Value = len(d) + pins[i].Data = d + send = true + break } if !send {