diff --git a/server/cmd/serve.go b/server/cmd/serve.go index 2c7dfde..b6a7807 100644 --- a/server/cmd/serve.go +++ b/server/cmd/serve.go @@ -20,6 +20,7 @@ func init() { neko.Service.Server, neko.Service.WebRTC, neko.Service.Remote, + neko.Service.Broadcast, neko.Service.WebSocket, } diff --git a/server/internal/broadcast/manager.go b/server/internal/broadcast/manager.go index 8937ffa..bca83cf 100644 --- a/server/internal/broadcast/manager.go +++ b/server/internal/broadcast/manager.go @@ -12,14 +12,16 @@ type BroadcastManager struct { logger zerolog.Logger pipeline *gst.Pipeline remote *config.Remote + config *config.Broadcast enabled bool url string } -func New(remote *config.Remote) *BroadcastManager { +func New(remote *config.Remote, config *config.Broadcast) *BroadcastManager { return &BroadcastManager{ logger: log.With().Str("module", "remote").Logger(), remote: remote, + config: config, enabled: false, url: "", } diff --git a/server/internal/types/config/broadcast.go b/server/internal/types/config/broadcast.go new file mode 100644 index 0000000..f928448 --- /dev/null +++ b/server/internal/types/config/broadcast.go @@ -0,0 +1,37 @@ +package config + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +type Broadcast struct { + // Enabled bool + // AudioParams string + // VideoParams string +} + +func (Broadcast) Init(cmd *cobra.Command) error { + // cmd.PersistentFlags().Bool("broadcast", false, "enable boradcasting") + // if err := viper.BindPFlag("broadcast", cmd.PersistentFlags().Lookup("broadcast")); err != nil { + // return err + // } + + // cmd.PersistentFlags().String("cast_audio", "", "audio codec parameters to use for broadcasting") + // if err := viper.BindPFlag("cast_audio", cmd.PersistentFlags().Lookup("cast_audio")); err != nil { + // return err + // } + + // cmd.PersistentFlags().String("cast_video", "", "video codec parameters to use for broadcasting") + // if err := viper.BindPFlag("cast_video", cmd.PersistentFlags().Lookup("cast_video")); err != nil { + // return err + // } + + return nil +} + +func (s *Broadcast) Set() { + // s.Enabled = viper.GetBool("broadcast") + // s.AudioParams = viper.GetString("cast_audio") + // s.VideoParams = viper.GetString("cast_video") +} diff --git a/server/neko.go b/server/neko.go index 7d4dabb..6c3d616 100644 --- a/server/neko.go +++ b/server/neko.go @@ -62,6 +62,7 @@ func init() { Root: &config.Root{}, Server: &config.Server{}, Remote: &config.Remote{}, + Broadcast: &config.Broadcast{}, WebRTC: &config.WebRTC{}, WebSocket: &config.WebSocket{}, } @@ -100,6 +101,7 @@ type Neko struct { Version *Version Root *config.Root Remote *config.Remote + Broadcast *config.Broadcast Server *config.Server WebRTC *config.WebRTC WebSocket *config.WebSocket @@ -118,7 +120,7 @@ func (neko *Neko) Preflight() { } func (neko *Neko) Start() { - broadcastManager := broadcast.New(neko.Remote) + broadcastManager := broadcast.New(neko.Remote, neko.Broadcast) remoteManager := remote.New(neko.Remote, broadcastManager) remoteManager.Start()