mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
Add glib main loop to capture manager (#383)
The gstreamer documentation is not particularly amazing on whether or not this is necessary, but it's clear that some gstreamer events will not be delivered to their handlers without a running glib loop. This runs one loop for all pipelines, which should be more than enough. Disclaimer: This may conflict in demodesk/neko with the dragdrop feature. Anyone backporting this bug fix to that repo should investigate whether the loop created by `gtk_main()` will conflict with this one before blindly porting. Fixes #380 Fixes #284
This commit is contained in:
@ -31,12 +31,29 @@ var pSerial int32
|
||||
var pipelines = make(map[int]*Pipeline)
|
||||
var pipelinesLock sync.Mutex
|
||||
var registry *C.GstRegistry
|
||||
var gMainLoop *C.GMainLoop
|
||||
|
||||
func init() {
|
||||
C.gst_init(nil, nil)
|
||||
registry = C.gst_registry_get()
|
||||
}
|
||||
|
||||
func RunMainLoop() {
|
||||
if gMainLoop != nil {
|
||||
return
|
||||
}
|
||||
gMainLoop = C.g_main_loop_new(nil, C.int(0))
|
||||
C.g_main_loop_run(gMainLoop)
|
||||
}
|
||||
|
||||
func QuitMainLoop() {
|
||||
if gMainLoop == nil {
|
||||
return
|
||||
}
|
||||
C.g_main_loop_quit(gMainLoop)
|
||||
gMainLoop = nil
|
||||
}
|
||||
|
||||
func CreatePipeline(pipelineStr string) (*Pipeline, error) {
|
||||
id := atomic.AddInt32(&pSerial, 1)
|
||||
|
||||
|
Reference in New Issue
Block a user