feat: implement initial configuration and gstreamer pipeline setup

This commit is contained in:
Garionion 2025-04-09 18:10:34 +02:00
parent d672f04be2
commit 4a6f36f1ef
Signed by: garionion
SSH key fingerprint: SHA256:6uQQGh4dHIdYnrR+qeLdgx5SDmbttGp2HusA73563QA
9 changed files with 566 additions and 50 deletions

60
internal/ndi/discovery.go Normal file
View file

@ -0,0 +1,60 @@
package ndi
import (
"fmt"
"github.com/bitfocus/gondi"
"os"
)
var NDI_LIB_PATH = ""
func discovery() {
var (
libndi = ""
libndiEnv = os.Getenv("LIBNDI")
)
if libndiEnv != "" {
libndi = libndiEnv
} else if NDI_LIB_PATH != "" {
libndi = fmt.Sprintf("%s/lib/libndi.so", NDI_LIB_PATH)
} else {
fmt.Println("LIBNDI environment variable is not set")
return
}
fmt.Println("Initializing NDI")
if err := gondi.InitLibrary(libndi); err != nil {
fmt.Println("Failed to initialize NDI library:", err)
return
}
version := gondi.GetVersion()
fmt.Printf("NDI version: %s\n", version)
findInstance, err := gondi.NewFindInstance(true, "", "")
if err != nil {
panic(err)
}
defer findInstance.Destroy()
// Wait for sources to appear
fmt.Println("Looking for sources...")
for {
more := findInstance.WaitForSources(5000)
if !more {
break
}
}
// Fetch the sources
sources := findInstance.GetCurrentSources()
if len(sources) == 0 {
fmt.Println("No sources found")
return
}
for _, source := range sources {
fmt.Printf("Found source: %q: %q\n", source.Name(), source.Address())
}
}