Expose device list update func (#463)

This commit is contained in:
Clyde Bazile
2023-01-13 19:02:46 -05:00
committed by GitHub
parent 6ac1424488
commit 85597da5bb
6 changed files with 30 additions and 0 deletions

View File

@@ -17,6 +17,11 @@ type camera struct {
}
func init() {
Initialize()
}
// Initialize finds and registers camera devices. This is part of an experimental API.
func Initialize() {
devices, err := avfoundation.Devices(avfoundation.Video)
if err != nil {
panic(err)

View File

@@ -73,6 +73,11 @@ type camera struct {
}
func init() {
Initialize()
}
// Initialize finds and registers camera devices. This is part of an experimental API.
func Initialize() {
discovered := make(map[string]struct{})
discover(discovered, "/dev/v4l/by-path/*")
discover(discovered, "/dev/video*")

View File

@@ -32,6 +32,11 @@ type camera struct {
}
func init() {
Initialize()
}
// Initialize finds and registers camera devices. This is part of an experimental API.
func Initialize() {
C.CoInitializeEx(nil, C.COINIT_MULTITHREADED)
var list C.cameraList

View File

@@ -39,6 +39,11 @@ type microphone struct {
}
func init() {
Initialize()
}
// Initialize finds and registers active playback or capture devices. This is part of an experimental API.
func Initialize() {
var err error
ctx, err = malgo.InitContext(nil, malgo.ContextConfig{}, func(message string) {
logger.Debugf("%v\n", message)

View File

@@ -20,6 +20,11 @@ type screen struct {
}
func init() {
Initialize()
}
// Initialize finds and registers active displays. This is part of an experimental API.
func Initialize() {
activeDisplays := screenshot.NumActiveDisplays()
for i := 0; i < activeDisplays; i++ {
priority := driver.PriorityNormal

View File

@@ -22,6 +22,11 @@ func deviceID(num int) string {
}
func init() {
Initialize()
}
// Initialize finds and registers active displays. This is part of an experimental API.
func Initialize() {
dp, err := openDisplay()
if err != nil {
// No x11 display available.