mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
broadcast naming convention & on destroy.
This commit is contained in:
parent
bd45e81afe
commit
d09b6dcb10
@ -4,7 +4,26 @@ import (
|
||||
"demodesk/neko/internal/capture/gst"
|
||||
)
|
||||
|
||||
func (manager *CaptureManagerCtx) StartBroadcastPipeline() {
|
||||
func (manager *CaptureManagerCtx) StartBroadcast(url string) {
|
||||
manager.broadcast_url = url
|
||||
manager.broadcasting = true
|
||||
manager.createBroadcastPipeline()
|
||||
}
|
||||
|
||||
func (manager *CaptureManagerCtx) StopBroadcast() {
|
||||
manager.broadcasting = false
|
||||
manager.destroyBroadcastPipeline()
|
||||
}
|
||||
|
||||
func (manager *CaptureManagerCtx) BroadcastEnabled() bool {
|
||||
return manager.broadcasting
|
||||
}
|
||||
|
||||
func (manager *CaptureManagerCtx) BroadcastUrl() string {
|
||||
return manager.broadcast_url
|
||||
}
|
||||
|
||||
func (manager *CaptureManagerCtx) createBroadcastPipeline() {
|
||||
var err error
|
||||
|
||||
if manager.broadcast != nil || !manager.BroadcastEnabled() {
|
||||
@ -32,7 +51,7 @@ func (manager *CaptureManagerCtx) StartBroadcastPipeline() {
|
||||
manager.logger.Info().Msgf("starting broadcast pipeline")
|
||||
}
|
||||
|
||||
func (manager *CaptureManagerCtx) StopBroadcastPipeline() {
|
||||
func (manager *CaptureManagerCtx) destroyBroadcastPipeline() {
|
||||
if manager.broadcast == nil {
|
||||
return
|
||||
}
|
||||
@ -41,22 +60,3 @@ func (manager *CaptureManagerCtx) StopBroadcastPipeline() {
|
||||
manager.logger.Info().Msgf("stopping broadcast pipeline")
|
||||
manager.broadcast = nil
|
||||
}
|
||||
|
||||
func (manager *CaptureManagerCtx) StartBroadcast(url string) {
|
||||
manager.broadcast_url = url
|
||||
manager.broadcasting = true
|
||||
manager.StartBroadcastPipeline()
|
||||
}
|
||||
|
||||
func (manager *CaptureManagerCtx) StopBroadcast() {
|
||||
manager.broadcasting = false
|
||||
manager.StopBroadcastPipeline()
|
||||
}
|
||||
|
||||
func (manager *CaptureManagerCtx) BroadcastEnabled() bool {
|
||||
return manager.broadcasting
|
||||
}
|
||||
|
||||
func (manager *CaptureManagerCtx) BroadcastUrl() string {
|
||||
return manager.broadcast_url
|
||||
}
|
||||
|
@ -42,16 +42,16 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
|
||||
}
|
||||
|
||||
func (manager *CaptureManagerCtx) Start() {
|
||||
manager.StartBroadcastPipeline()
|
||||
manager.createBroadcastPipeline()
|
||||
|
||||
manager.desktop.OnBeforeScreenSizeChange(func() {
|
||||
manager.destroyVideoPipeline()
|
||||
manager.StopBroadcastPipeline()
|
||||
manager.destroyBroadcastPipeline()
|
||||
})
|
||||
|
||||
manager.desktop.OnAfterScreenSizeChange(func() {
|
||||
manager.createVideoPipeline()
|
||||
manager.StartBroadcastPipeline()
|
||||
manager.createBroadcastPipeline()
|
||||
})
|
||||
|
||||
go func() {
|
||||
@ -75,8 +75,10 @@ func (manager *CaptureManagerCtx) Start() {
|
||||
|
||||
func (manager *CaptureManagerCtx) Shutdown() error {
|
||||
manager.logger.Info().Msgf("capture shutting down")
|
||||
manager.emit_stop <- true
|
||||
manager.StopStream()
|
||||
|
||||
manager.destroyBroadcastPipeline()
|
||||
manager.emit_stop <- true
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user