diff --git a/main.go b/main.go index f540bf6..fb4540e 100644 --- a/main.go +++ b/main.go @@ -4,19 +4,25 @@ import ( "stream_server/rtmp" "stream_server/http" "stream_server/srt" + "flag" ) const ( - SRVTYPE_RTMP uint8 = iota + SRVTYPE_RTMP uint = iota SRVTYPE_SRT ) func main() { - err := NewIngestServer(SRVTYPE_SRT, "7878") + ingest_type := flag.Uint("ingest_type", 0, "Ingest server type, 0 for RTMP, 1 for SRT") + ingest_port := flag.String("ingest_port", "7878", "Port for stream intake") + http_port := flag.String("http_port", "7879", "Port to serve http requests") + + flag.Parse() + err := NewIngestServer(*ingest_type, *ingest_port) if err != nil { panic(err) } - err = NewHTTPServer("7879") + err = NewHTTPServer(*http_port) if err != nil { panic(err) } @@ -24,7 +30,7 @@ func main() { } } -func NewIngestServer(srvr_type uint8, port string) (error) { +func NewIngestServer(srvr_type uint, port string) (error) { var err error switch srvr_type { case 0: