47 lines
859 B
Go
47 lines
859 B
Go
package main
|
|
|
|
import (
|
|
"stream_server/rtmp"
|
|
"stream_server/http"
|
|
"stream_server/srt"
|
|
"flag"
|
|
)
|
|
|
|
const (
|
|
SRVTYPE_RTMP uint = iota
|
|
SRVTYPE_SRT
|
|
)
|
|
|
|
func main() {
|
|
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(*http_port)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
for {
|
|
}
|
|
}
|
|
|
|
func NewIngestServer(srvr_type uint, port string) (error) {
|
|
var err error
|
|
switch srvr_type {
|
|
case 0:
|
|
err = rtmp.NewServer(port)
|
|
case 1:
|
|
err = srt.NewServer(port)
|
|
}
|
|
return err
|
|
}
|
|
|
|
func NewHTTPServer(port string) (error) {
|
|
err := http.NewServer(port)
|
|
return err
|
|
}
|