mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-12-24 12:27:57 +08:00
Decouple the common stream forwarding logic from the specific implementations
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/xaionaro-go/streamctl/pkg/observability"
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamserver/implementations/libav/recoder/types"
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamserver/implementations/libav/saferecoder/grpc/go/recoder_grpc"
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamserver/recoder"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
)
|
||||
@@ -83,7 +84,7 @@ func (c *Client) NewInputFromURL(
|
||||
}
|
||||
|
||||
type OutputID uint64
|
||||
type OutputConfig = types.OutputConfig
|
||||
type OutputConfig = recoder.OutputConfig
|
||||
|
||||
func (c *Client) NewOutputFromURL(
|
||||
ctx context.Context,
|
||||
@@ -158,10 +159,7 @@ func (c *Client) StartRecoding(
|
||||
return nil
|
||||
}
|
||||
|
||||
type RecoderStats struct {
|
||||
BytesCountRead uint64
|
||||
BytesCountWrote uint64
|
||||
}
|
||||
type RecoderStats = recoder.Stats
|
||||
|
||||
func (c *Client) GetRecoderStats(
|
||||
ctx context.Context,
|
||||
|
||||
@@ -15,18 +15,19 @@ import (
|
||||
"github.com/facebookincubator/go-belt/tool/logger"
|
||||
"github.com/xaionaro-go/streamctl/pkg/observability"
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamserver/implementations/libav/saferecoder/process/client"
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamserver/recoder"
|
||||
)
|
||||
|
||||
type InputID = client.InputID
|
||||
type InputConfig = client.InputConfig
|
||||
type InputConfig = recoder.InputConfig
|
||||
|
||||
type OutputID = client.OutputID
|
||||
type OutputConfig = client.OutputConfig
|
||||
type OutputConfig = recoder.OutputConfig
|
||||
|
||||
type RecoderID = client.RecoderID
|
||||
type RecoderConfig = client.RecoderConfig
|
||||
type RecoderConfig = recoder.Config
|
||||
|
||||
type RecoderStats = client.RecoderStats
|
||||
type RecoderStats = recoder.Stats
|
||||
|
||||
type Recoder struct {
|
||||
*client.Client
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamserver/implementations/libav/recoder/types"
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamserver/recoder"
|
||||
)
|
||||
|
||||
type Recoder struct {
|
||||
@@ -27,13 +27,13 @@ func Run(
|
||||
type Client struct{}
|
||||
|
||||
type InputID uint64
|
||||
type InputConfig = types.InputConfig
|
||||
type InputConfig = recoder.InputConfig
|
||||
|
||||
type OutputID uint64
|
||||
type OutputConfig = types.OutputConfig
|
||||
type OutputConfig = recoder.OutputConfig
|
||||
|
||||
type RecoderID uint64
|
||||
type RecoderConfig = types.RecoderConfig
|
||||
type RecoderConfig = recoder.Config
|
||||
|
||||
func (c *Client) NewInputFromURL(
|
||||
ctx context.Context,
|
||||
@@ -67,10 +67,7 @@ func (c *Client) NewRecoder(
|
||||
return 0, fmt.Errorf("not compiled with libav support")
|
||||
}
|
||||
|
||||
type RecoderStats struct {
|
||||
BytesCountRead uint64
|
||||
BytesCountWrote uint64
|
||||
}
|
||||
type RecoderStats = recoder.Stats
|
||||
|
||||
func (c *Client) GetRecoderStats(
|
||||
ctx context.Context,
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamserver/implementations/libav/recoder/types"
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamserver/implementations/libav/saferecoder/process"
|
||||
"github.com/xaionaro-go/streamctl/pkg/streamserver/recoder"
|
||||
)
|
||||
|
||||
type Packet = types.Packet
|
||||
@@ -61,7 +62,7 @@ func (r *Recoder) StartRecoding(
|
||||
)
|
||||
}
|
||||
|
||||
type RecoderStats = process.RecoderStats
|
||||
type RecoderStats = recoder.Stats
|
||||
|
||||
func (r *Recoder) GetStats(ctx context.Context) (*RecoderStats, error) {
|
||||
return r.Process.processBackend.Client.GetRecoderStats(ctx, r.ID)
|
||||
|
||||
Reference in New Issue
Block a user