Code refactoring after #859

This commit is contained in:
Alex X
2024-04-30 06:42:17 +03:00
parent 7a0646fd5f
commit 52832223f8
7 changed files with 55 additions and 96 deletions
+41
View File
@@ -0,0 +1,41 @@
package stdin
import (
"io"
"os/exec"
"github.com/AlexxIT/go2rtc/pkg/core"
)
type Client struct {
cmd *exec.Cmd
pipe io.WriteCloser
medias []*core.Media
sender *core.Sender
send int
}
func NewClient(cmd *exec.Cmd) (*Client, error) {
pipe, err := PipeCloser(cmd)
if err != nil {
return nil, err
}
c := &Client{
pipe: pipe,
cmd: cmd,
medias: []*core.Media{
{
Kind: core.KindAudio,
Direction: core.DirectionSendonly,
Codecs: []*core.Codec{
{Name: core.CodecPCMA, ClockRate: 8000},
{Name: core.CodecPCM},
},
},
},
}
return c, nil
}