Change response sources API

This commit is contained in:
Alexey Khit
2023-09-01 22:27:33 +03:00
parent 22787b979d
commit 0621b82aff
14 changed files with 29 additions and 29 deletions
+1 -1
View File
@@ -79,7 +79,7 @@ func initDevices() {
audios = append(audios, name)
}
streams = append(streams, api.Source{
streams = append(streams, &api.Source{
Name: name, URL: "ffmpeg:device?" + kind + "=" + name,
})
}
+2 -2
View File
@@ -70,7 +70,7 @@ func initDevices() {
m := re.FindAllStringSubmatch(string(b), -1)
for _, i := range m {
size, _, _ := strings.Cut(i[4], " ")
stream := api.Source{
stream := &api.Source{
Name: i[3] + " | " + i[4],
URL: "ffmpeg:device?video=" + name + "&input_format=" + i[2] + "&video_size=" + size,
}
@@ -86,7 +86,7 @@ func initDevices() {
err = exec.Command(Bin, "-f", "alsa", "-i", "default", "-t", "1", "-f", "null", "-").Run()
if err == nil {
stream := api.Source{
stream := &api.Source{
Name: "ALSA default",
URL: "ffmpeg:device?audio=default&channels=1&sample_rate=16000&#audio=opus",
}
+1 -1
View File
@@ -80,7 +80,7 @@ func initDevices() {
name := m[1]
kind := m[2]
stream := api.Source{
stream := &api.Source{
Name: name, URL: "ffmpeg:device?" + kind + "=" + name,
}
+1 -1
View File
@@ -40,7 +40,7 @@ func GetInput(src string) (string, error) {
var Bin string
var videos, audios []string
var streams []api.Source
var streams []*api.Source
var runonce sync.Once
func apiDevices(w http.ResponseWriter, r *http.Request) {
+2 -2
View File
@@ -7,8 +7,8 @@ import (
const ProbeVideoToolboxH264 = "-f lavfi -i testsrc2=size=svga -t 1 -c h264_videotoolbox -f null -"
const ProbeVideoToolboxH265 = "-f lavfi -i testsrc2=size=svga -t 1 -c hevc_videotoolbox -f null -"
func ProbeAll(bin string) []api.Source {
return []api.Source{
func ProbeAll(bin string) []*api.Source {
return []*api.Source{
{
Name: runToString(bin, ProbeVideoToolboxH264),
URL: "ffmpeg:...#video=h264#hardware=" + EngineVideoToolbox,
+3 -3
View File
@@ -14,9 +14,9 @@ const ProbeVAAPIJPEG = "-init_hw_device vaapi -f lavfi -i testsrc2 -t 1 -vf form
const ProbeCUDAH264 = "-init_hw_device cuda -f lavfi -i testsrc2 -t 1 -c h264_nvenc -f null -"
const ProbeCUDAH265 = "-init_hw_device cuda -f lavfi -i testsrc2 -t 1 -c hevc_nvenc -f null -"
func ProbeAll(bin string) []api.Source {
func ProbeAll(bin string) []*api.Source {
if runtime.GOARCH == "arm64" || runtime.GOARCH == "arm" {
return []api.Source{
return []*api.Source{
{
Name: runToString(bin, ProbeV4L2M2MH264),
URL: "ffmpeg:...#video=h264#hardware=" + EngineV4L2M2M,
@@ -28,7 +28,7 @@ func ProbeAll(bin string) []api.Source {
}
}
return []api.Source{
return []*api.Source{
{
Name: runToString(bin, ProbeVAAPIH264),
URL: "ffmpeg:...#video=h264#hardware=" + EngineVAAPI,
+2 -2
View File
@@ -8,8 +8,8 @@ const ProbeDXVA2JPEG = "-init_hw_device dxva2 -f lavfi -i testsrc2 -t 1 -c mjpeg
const ProbeCUDAH264 = "-init_hw_device cuda -f lavfi -i testsrc2 -t 1 -c h264_nvenc -f null -"
const ProbeCUDAH265 = "-init_hw_device cuda -f lavfi -i testsrc2 -t 1 -c hevc_nvenc -f null -"
func ProbeAll(bin string) []api.Source {
return []api.Source{
func ProbeAll(bin string) []*api.Source {
return []*api.Source{
{
Name: runToString(bin, ProbeDXVA2H264),
URL: "ffmpeg:...#video=h264#hardware=" + EngineDXVA2,