revid: add S0 to pins that are sent via HTTP

This commit is contained in:
Trek H 2020-08-14 23:04:56 +09:30
parent 9f4e7439d1
commit e72ebe2f06
1 changed files with 10 additions and 5 deletions

View File

@ -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
}
}