Add channels and sample rate params to ALSA
This commit is contained in:
@@ -1,13 +1,14 @@
|
|||||||
package device
|
package device
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/AlexxIT/go2rtc/internal/api"
|
|
||||||
"github.com/AlexxIT/go2rtc/pkg/core"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/AlexxIT/go2rtc/internal/api"
|
||||||
|
"github.com/AlexxIT/go2rtc/pkg/core"
|
||||||
)
|
)
|
||||||
|
|
||||||
func queryToInput(query url.Values) string {
|
func queryToInput(query url.Values) string {
|
||||||
@@ -28,8 +29,16 @@ func queryToInput(query url.Values) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if audio := query.Get("audio"); audio != "" {
|
if audio := query.Get("audio"); audio != "" {
|
||||||
|
// https://trac.ffmpeg.org/wiki/Capture/ALSA
|
||||||
input := "-f alsa"
|
input := "-f alsa"
|
||||||
|
|
||||||
|
for key, value := range query {
|
||||||
|
switch key {
|
||||||
|
case "channels", "sample_rate":
|
||||||
|
input += " -" + key + " " + value[0]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return input + " -i " + indexToItem(audios, audio)
|
return input + " -i " + indexToItem(audios, audio)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user