mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-10-15 12:00:41 +08:00
35 lines
640 B
Go
35 lines
640 B
Go
package saferecoder
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/xaionaro-go/streamctl/pkg/recoder/libav/saferecoder/process"
|
|
)
|
|
|
|
type OutputID = process.OutputID
|
|
type OutputConfig = process.OutputConfig
|
|
|
|
type Output struct {
|
|
Process *Process
|
|
ID OutputID
|
|
}
|
|
|
|
func (p *Process) NewOutputFromURL(
|
|
ctx context.Context,
|
|
url string,
|
|
cfg OutputConfig,
|
|
) (*Output, error) {
|
|
outputID, err := p.Client.NewOutputFromURL(ctx, url, cfg)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &Output{
|
|
Process: p,
|
|
ID: outputID,
|
|
}, nil
|
|
}
|
|
|
|
func (output *Output) Close() error {
|
|
return output.Process.Client.CloseOutput(context.Background(), output.ID)
|
|
}
|