2023-08-09 16:00:21 +05:00
|
|
|
package main
|
|
|
|
|
2023-08-21 12:19:31 +05:00
|
|
|
import (
|
|
|
|
"stream_server/rtmp"
|
|
|
|
"stream_server/http"
|
2023-09-18 11:51:55 +05:00
|
|
|
"stream_server/srt"
|
2023-08-21 12:19:31 +05:00
|
|
|
)
|
2023-08-15 14:28:13 +05:00
|
|
|
|
2023-08-09 16:00:21 +05:00
|
|
|
const (
|
|
|
|
SRVTYPE_RTMP uint8 = iota
|
2023-09-18 11:51:55 +05:00
|
|
|
SRVTYPE_SRT
|
2023-08-09 16:00:21 +05:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2023-09-18 11:51:55 +05:00
|
|
|
err := NewIngestServer(SRVTYPE_SRT, "7878")
|
2023-08-09 16:00:21 +05:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2023-08-21 12:19:31 +05:00
|
|
|
err = NewHTTPServer("7879")
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2023-08-09 16:00:21 +05:00
|
|
|
for {
|
|
|
|
}
|
|
|
|
}
|
2023-08-15 14:28:13 +05:00
|
|
|
|
|
|
|
func NewIngestServer(srvr_type uint8, port string) (error) {
|
|
|
|
var err error
|
|
|
|
switch srvr_type {
|
|
|
|
case 0:
|
2023-08-15 14:34:48 +05:00
|
|
|
err = rtmp.NewServer(port)
|
2023-09-18 11:51:55 +05:00
|
|
|
case 1:
|
|
|
|
err = srt.NewServer(port)
|
2023-08-15 14:28:13 +05:00
|
|
|
}
|
|
|
|
return err
|
|
|
|
}
|
2023-08-21 12:19:31 +05:00
|
|
|
|
|
|
|
func NewHTTPServer(port string) (error) {
|
|
|
|
err := http.NewServer(port)
|
|
|
|
return err
|
|
|
|
}
|