mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
broadcast_autostart as config option, #398.
This commit is contained in:
parent
0d7887e9d2
commit
57596315e9
@ -107,9 +107,11 @@ nat1to1: <ip>
|
|||||||
#### `NEKO_BROADCAST_PIPELINE`:
|
#### `NEKO_BROADCAST_PIPELINE`:
|
||||||
- Makes it possible to create custom gstreamer pipeline used for broadcasting, strings `{url}`, `{device}` and `{display}` will be replaced.
|
- Makes it possible to create custom gstreamer pipeline used for broadcasting, strings `{url}`, `{device}` and `{display}` will be replaced.
|
||||||
#### `NEKO_BROADCAST_URL`:
|
#### `NEKO_BROADCAST_URL`:
|
||||||
- Set a default URL for broadcast streams. Setting this value will automatically enable broadcasting when n.eko starts. It can be disabled/changed later by admins in the GUI.
|
- Set a default URL for broadcast streams. It can be disabled/changed later by admins in the GUI.
|
||||||
- e.g. `rtmp://<your-server>:1935/ingest/<stream-key>`
|
- e.g. `rtmp://<your-server>:1935/ingest/<stream-key>`
|
||||||
|
#### `NEKO_BROADCAST_AUTOSTART`:
|
||||||
|
- Automatically start broadcasting when neko starts and broadcast_url is set.
|
||||||
|
- e.g. `true`
|
||||||
### Server
|
### Server
|
||||||
|
|
||||||
#### `NEKO_BIND`:
|
#### `NEKO_BIND`:
|
||||||
|
@ -22,7 +22,7 @@ type BroacastManagerCtx struct {
|
|||||||
started bool
|
started bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func broadcastNew(pipelineFn func(url string) (string, error), defaultUrl string) *BroacastManagerCtx {
|
func broadcastNew(pipelineFn func(url string) (string, error), url string, started bool) *BroacastManagerCtx {
|
||||||
logger := log.With().
|
logger := log.With().
|
||||||
Str("module", "capture").
|
Str("module", "capture").
|
||||||
Str("submodule", "broadcast").
|
Str("submodule", "broadcast").
|
||||||
@ -31,8 +31,8 @@ func broadcastNew(pipelineFn func(url string) (string, error), defaultUrl string
|
|||||||
return &BroacastManagerCtx{
|
return &BroacastManagerCtx{
|
||||||
logger: logger,
|
logger: logger,
|
||||||
pipelineFn: pipelineFn,
|
pipelineFn: pipelineFn,
|
||||||
url: defaultUrl,
|
url: url,
|
||||||
started: defaultUrl != "",
|
started: started,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
|
|||||||
// sinks
|
// sinks
|
||||||
broadcast: broadcastNew(func(url string) (string, error) {
|
broadcast: broadcastNew(func(url string) (string, error) {
|
||||||
return NewBroadcastPipeline(config.AudioDevice, config.Display, config.BroadcastPipeline, url)
|
return NewBroadcastPipeline(config.AudioDevice, config.Display, config.BroadcastPipeline, url)
|
||||||
}, config.BroadcastUrl),
|
}, config.BroadcastUrl, config.BroadcastAutostart),
|
||||||
audio: streamSinkNew(config.AudioCodec, func() (string, error) {
|
audio: streamSinkNew(config.AudioCodec, func() (string, error) {
|
||||||
return NewAudioPipeline(config.AudioCodec, config.AudioDevice, config.AudioPipeline, config.AudioBitrate)
|
return NewAudioPipeline(config.AudioCodec, config.AudioDevice, config.AudioPipeline, config.AudioBitrate)
|
||||||
}, "audio"),
|
}, "audio"),
|
||||||
|
@ -36,6 +36,7 @@ type Capture struct {
|
|||||||
// broadcast
|
// broadcast
|
||||||
BroadcastPipeline string
|
BroadcastPipeline string
|
||||||
BroadcastUrl string
|
BroadcastUrl string
|
||||||
|
BroadcastAutostart bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Capture) Init(cmd *cobra.Command) error {
|
func (Capture) Init(cmd *cobra.Command) error {
|
||||||
@ -155,11 +156,16 @@ func (Capture) Init(cmd *cobra.Command) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.PersistentFlags().String("broadcast_url", "", "URL for broadcasting, setting this value will automatically enable broadcasting")
|
cmd.PersistentFlags().String("broadcast_url", "", "a default default URL for broadcast streams, can be disabled/changed later by admins in the GUI")
|
||||||
if err := viper.BindPFlag("broadcast_url", cmd.PersistentFlags().Lookup("broadcast_url")); err != nil {
|
if err := viper.BindPFlag("broadcast_url", cmd.PersistentFlags().Lookup("broadcast_url")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmd.PersistentFlags().Bool("broadcast_autostart", true, "automatically start broadcasting when neko starts and broadcast_url is set")
|
||||||
|
if err := viper.BindPFlag("broadcast_autostart", cmd.PersistentFlags().Lookup("broadcast_autostart")); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,4 +253,5 @@ func (s *Capture) Set() {
|
|||||||
|
|
||||||
s.BroadcastPipeline = viper.GetString("broadcast_pipeline")
|
s.BroadcastPipeline = viper.GetString("broadcast_pipeline")
|
||||||
s.BroadcastUrl = viper.GetString("broadcast_url")
|
s.BroadcastUrl = viper.GetString("broadcast_url")
|
||||||
|
s.BroadcastAutostart = viper.GetBool("broadcast_autostart")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user