revid: back to working state

This commit is contained in:
saxon 2018-11-21 18:14:36 +10:30
parent 4c01514b41
commit 315ba6bd76
3 changed files with 9 additions and 15 deletions

View File

@ -30,6 +30,7 @@ package main
import (
"flag"
"fmt"
"os"
"runtime/pprof"
"strconv"
@ -107,10 +108,10 @@ var (
flagNames = [noOfConfigFlags]struct{ name, description string }{
{"Input", "The input type: Raspivid, File"},
{"InputCodec", "The codec of the input: H264, Mjpeg"},
{"Output", "The output type: Http, Rtmp, File, Udp"},
{"Output", "The output type: Http, Rtmp, File, Udp, Rtp"},
{"RtmpMethod", "The method used to send over rtmp: Ffmpeg, Librtmp"},
// NOTE: we add rtp here when we have this functionality
{"Packetization", "The method of data packetisation: Flv, Mpegts, Rtp, None"},
{"Packetization", "The method of data packetisation: Flv, Mpegts, None"},
{"QuantizationMode", "Whether quantization if on or off (variable bitrate): On, Off"},
{"Verbosity", "Verbosity: Info, Warning, Error, Fatal"},
{"FramesPerClip", "Number of frames per clip sent"},
@ -213,6 +214,10 @@ func handleFlags() {
config.Output = revid.FfmpegRtmp
case "Udp":
config.Output = revid.Udp
case "Rtp":
fmt.Println("rtp output")
config.Output = revid.Rtp
config.Packetization = revid.MpegtsRtp
case "":
default:
logger.Log(smartlogger.Error, pkg+"bad output argument")

View File

@ -208,19 +208,6 @@ func (c *Config) Validate(r *Revid) error {
return errors.New("bad output type defined in config")
}
switch c.Packetization {
case None:
case Mpegts:
case Flv:
case Rtp:
case NothingDefined:
c.Logger.Log(smartlogger.Warning, pkg+"no packetization option defined, defaulting",
"packetization", defaultPacketization)
c.Packetization = defaultPacketization
default:
return errors.New("bad packetization option defined in config")
}
switch c.HorizontalFlip {
case Yes:
case No:

View File

@ -228,6 +228,7 @@ func (r *Revid) reset(config Config) error {
case Http:
r.destination = newHttpSender(r.ns, r.config.Logger.Log)
case Rtp:
fmt.Println("here")
s, err := newUdpSender(r.config.RtpAddress, r.config.Logger.Log)
if err != nil {
return err
@ -279,6 +280,7 @@ func (r *Revid) reset(config Config) error {
return err
}
case MpegtsRtp:
fmt.Println("here")
r.config.Logger.Log(smartlogger.Info, pkg+"using RTP packetisation")
frameRate, _ := strconv.Atoi(r.config.FrameRate)
r.encoder = rtp.NewEncoder(&r.packer, frameRate)