2022-11-10 11:24:33 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-10-20 21:24:49 +00:00
|
|
|
"fmt"
|
2022-11-10 11:24:33 +00:00
|
|
|
"log"
|
2022-11-11 03:40:53 +00:00
|
|
|
"os"
|
2023-10-21 18:36:22 +00:00
|
|
|
|
|
|
|
"github.com/pulsejet/go-vod/go_vod"
|
2022-11-10 11:24:33 +00:00
|
|
|
)
|
|
|
|
|
2023-10-25 01:45:40 +00:00
|
|
|
const VERSION = "0.1.23"
|
2023-03-09 19:57:15 +00:00
|
|
|
|
2022-11-10 11:24:33 +00:00
|
|
|
func main() {
|
2023-10-20 21:12:09 +00:00
|
|
|
// Build initial configuration
|
2023-10-21 18:36:22 +00:00
|
|
|
c := &go_vod.Config{
|
2023-10-20 21:12:09 +00:00
|
|
|
VersionMonitor: false,
|
2023-10-21 18:36:22 +00:00
|
|
|
Version: VERSION,
|
2023-03-09 19:57:15 +00:00
|
|
|
Bind: ":47788",
|
|
|
|
ChunkSize: 3,
|
2023-03-15 17:21:44 +00:00
|
|
|
LookBehind: 3,
|
2023-03-09 19:57:15 +00:00
|
|
|
GoalBufferMin: 1,
|
|
|
|
GoalBufferMax: 4,
|
|
|
|
StreamIdleTime: 60,
|
|
|
|
ManagerIdleTime: 60,
|
2022-11-15 10:09:33 +00:00
|
|
|
}
|
|
|
|
|
2023-10-20 21:12:09 +00:00
|
|
|
// Parse arguments
|
|
|
|
for _, arg := range os.Args[1:] {
|
|
|
|
if arg == "-version-monitor" {
|
|
|
|
c.VersionMonitor = true
|
2023-10-20 21:24:49 +00:00
|
|
|
} else if arg == "-version" {
|
|
|
|
fmt.Print("go-vod " + VERSION)
|
2023-10-20 21:12:09 +00:00
|
|
|
return
|
|
|
|
} else {
|
2023-10-21 18:27:25 +00:00
|
|
|
c.FromFile(arg) // config file
|
2023-10-20 21:12:09 +00:00
|
|
|
}
|
2022-11-15 10:09:33 +00:00
|
|
|
}
|
|
|
|
|
2023-10-21 18:27:25 +00:00
|
|
|
// Auto detect ffmpeg and ffprobe
|
|
|
|
c.AutoDetect()
|
2023-04-10 23:44:39 +00:00
|
|
|
|
2023-10-21 18:36:22 +00:00
|
|
|
// Start server
|
2023-10-21 18:45:30 +00:00
|
|
|
code := go_vod.NewHandler(c).Start()
|
|
|
|
|
|
|
|
// Exit
|
|
|
|
log.Println("Exiting go-vod with status code", code)
|
|
|
|
os.Exit(code)
|
2022-11-10 11:24:33 +00:00
|
|
|
}
|