map CLI arguments to playback config
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"mxl-player/internal/playback"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultInitialRetryDelay = 500 * time.Millisecond
|
||||
defaultMaxRetryDelay = 10 * time.Second
|
||||
)
|
||||
|
||||
func resolveDomain(shared, override string) string {
|
||||
if override != "" {
|
||||
return override
|
||||
}
|
||||
return shared
|
||||
}
|
||||
|
||||
func (a appArgs) playbackConfig() playback.SessionConfig {
|
||||
return playback.SessionConfig{
|
||||
Video: playback.FeedConfig{
|
||||
Domain: resolveDomain(a.Domain, a.VideoDomain),
|
||||
UUID: a.VideoFlowId,
|
||||
Active: a.VideoFlowId != "",
|
||||
},
|
||||
Audio: playback.FeedConfig{
|
||||
Domain: resolveDomain(a.Domain, a.AudioDomain),
|
||||
UUID: a.AudioFlowId,
|
||||
Active: a.AudioFlowId != "",
|
||||
},
|
||||
SyncRequested: a.SyncRequested,
|
||||
Retry: playback.RetryPolicy{
|
||||
MaxAttempts: a.MaxAttempts,
|
||||
InitialDelay: defaultInitialRetryDelay,
|
||||
MaxDelay: defaultMaxRetryDelay,
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user