mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2025-09-26 20:31:11 +08:00
29 lines
602 B
Go
29 lines
602 B
Go
package gopro
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/AlexxIT/go2rtc/internal/api"
|
|
"github.com/AlexxIT/go2rtc/internal/streams"
|
|
"github.com/AlexxIT/go2rtc/pkg/core"
|
|
"github.com/AlexxIT/go2rtc/pkg/gopro"
|
|
)
|
|
|
|
func Init() {
|
|
streams.HandleFunc("gopro", func(source string) (core.Producer, error) {
|
|
return gopro.Dial(source)
|
|
})
|
|
|
|
api.HandleFunc("api/gopro", apiGoPro)
|
|
}
|
|
|
|
func apiGoPro(w http.ResponseWriter, r *http.Request) {
|
|
var items []*api.Source
|
|
|
|
for _, host := range gopro.Discovery() {
|
|
items = append(items, &api.Source{Name: host, URL: "gopro://" + host})
|
|
}
|
|
|
|
api.ResponseSources(w, items)
|
|
}
|