add audio support, trying to manage MSD device
This commit is contained in:
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"rkkvm/config"
|
||||
"rkkvm/http/hw/rtc"
|
||||
"rkkvm/http/hw/stream"
|
||||
@@ -28,36 +27,31 @@ func main() {
|
||||
ustreamer.Start()
|
||||
//go ustreamer.Watch()
|
||||
} else if cfg.Stream.Source == config.StreamSourceH264 {
|
||||
ffmpeg := stream.InitFFmpeg(cfg.FFmpeg.Path, cfg.FFmpeg.FormatArgs())
|
||||
ffmpeg := stream.InitFFmpeg(cfg.Video.Path, cfg.Video.FormatArgs())
|
||||
ffmpeg.Start()
|
||||
//go ffmpeg.Watch()
|
||||
|
||||
audio := stream.InitPipedCmd(config.Get().Audio)
|
||||
audio.Start()
|
||||
} else {
|
||||
log.Fatalf("unsupported stream source type: %v", cfg.Stream.Source)
|
||||
}
|
||||
|
||||
webrtc, err := rtc.Init(cfg.WebRtc.Host, cfg.WebRtc.Port)
|
||||
webrtc, err := rtc.InitListener(cfg.WebRtc.Host, cfg.WebRtc.Port, 5006)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
go webrtc.Read()
|
||||
go webrtc.Listen()
|
||||
defer webrtc.Close()
|
||||
go webrtc.VideoListenerRead()
|
||||
go webrtc.AudioListenerRead()
|
||||
|
||||
r := gin.Default()
|
||||
r.Use(gin.Recovery())
|
||||
r.GET("/ping", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"message": "pong",
|
||||
})
|
||||
})
|
||||
route.Api(r)
|
||||
route.Static(r)
|
||||
|
||||
if cfg.NanoKVMUISupport {
|
||||
r.POST("/api/auth/login", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"token": "disabled",
|
||||
})
|
||||
})
|
||||
route.Auth(r)
|
||||
route.VM(r)
|
||||
}
|
||||
|
||||
r.Run(fmt.Sprintf(":%d", cfg.Port))
|
||||
|
||||
Reference in New Issue
Block a user