mirror of
https://github.com/datarhei/core.git
synced 2025-09-26 20:11:29 +08:00
Allow to override ffmpeg binary
This commit is contained in:
@@ -30,6 +30,7 @@ type FFmpeg interface {
|
||||
}
|
||||
|
||||
type ProcessConfig struct {
|
||||
Binary string // Override the default binary
|
||||
Reconnect bool // Whether to reconnect
|
||||
ReconnectDelay time.Duration // Duration until next reconnect
|
||||
StaleTimeout time.Duration // Duration to wait until killing the process if there is no progress in the process
|
||||
@@ -150,8 +151,13 @@ func (f *ffmpeg) New(config ProcessConfig) (process.Process, error) {
|
||||
limitMode = process.LimitModeSoft
|
||||
}
|
||||
|
||||
binary := f.binary
|
||||
if len(config.Binary) != 0 {
|
||||
binary = config.Binary
|
||||
}
|
||||
|
||||
ffmpeg, err := process.New(process.Config{
|
||||
Binary: f.binary,
|
||||
Binary: binary,
|
||||
Args: config.Args,
|
||||
Reconnect: config.Reconnect,
|
||||
ReconnectDelay: config.ReconnectDelay,
|
||||
|
@@ -169,6 +169,7 @@ type ProcessConfig struct {
|
||||
ID string `json:"id"`
|
||||
Owner string `json:"owner"`
|
||||
Domain string `json:"domain"`
|
||||
Binary string `json:"binary"`
|
||||
Type string `json:"type" validate:"oneof='ffmpeg' ''" jsonschema:"enum=ffmpeg,enum="`
|
||||
Reference string `json:"reference"`
|
||||
Input []ProcessConfigIO `json:"input" validate:"required"`
|
||||
@@ -191,6 +192,7 @@ func (cfg *ProcessConfig) Marshal() (*app.Config, map[string]interface{}) {
|
||||
ID: cfg.ID,
|
||||
Owner: cfg.Owner,
|
||||
Domain: cfg.Domain,
|
||||
Binary: cfg.Binary,
|
||||
Reference: cfg.Reference,
|
||||
Options: cfg.Options,
|
||||
Reconnect: cfg.Reconnect,
|
||||
@@ -283,6 +285,7 @@ func (cfg *ProcessConfig) Unmarshal(c *app.Config, metadata map[string]interface
|
||||
cfg.ID = c.ID
|
||||
cfg.Owner = c.Owner
|
||||
cfg.Domain = c.Domain
|
||||
cfg.Binary = c.Binary
|
||||
cfg.Reference = c.Reference
|
||||
cfg.Type = "ffmpeg"
|
||||
cfg.Reconnect = c.Reconnect
|
||||
|
@@ -72,6 +72,7 @@ type Config struct {
|
||||
Reference string
|
||||
Owner string
|
||||
Domain string
|
||||
Binary string
|
||||
FFVersion string
|
||||
Input []ConfigIO
|
||||
Output []ConfigIO
|
||||
@@ -102,6 +103,7 @@ func (config *Config) Clone() *Config {
|
||||
Reference: config.Reference,
|
||||
Owner: config.Owner,
|
||||
Domain: config.Domain,
|
||||
Binary: config.Binary,
|
||||
FFVersion: config.FFVersion,
|
||||
Reconnect: config.Reconnect,
|
||||
ReconnectDelay: config.ReconnectDelay,
|
||||
@@ -173,6 +175,7 @@ func (config *Config) Hash() []byte {
|
||||
b.WriteString(config.Reference)
|
||||
b.WriteString(config.Owner)
|
||||
b.WriteString(config.Domain)
|
||||
b.WriteString(config.Binary)
|
||||
b.WriteString(config.Scheduler)
|
||||
b.WriteString(strings.Join(config.Options, ","))
|
||||
b.WriteString(strings.Join(config.LogPatterns, ","))
|
||||
|
@@ -436,6 +436,7 @@ func (r *restream) load() error {
|
||||
}
|
||||
|
||||
ffmpeg, err := r.ffmpeg.New(ffmpeg.ProcessConfig{
|
||||
Binary: t.config.Binary,
|
||||
Reconnect: t.config.Reconnect,
|
||||
ReconnectDelay: time.Duration(t.config.ReconnectDelay) * time.Second,
|
||||
StaleTimeout: time.Duration(t.config.StaleTimeout) * time.Second,
|
||||
@@ -619,6 +620,7 @@ func (r *restream) createTask(config *app.Config) (*task, error) {
|
||||
}
|
||||
|
||||
ffmpeg, err := r.ffmpeg.New(ffmpeg.ProcessConfig{
|
||||
Binary: t.config.Binary,
|
||||
Reconnect: t.config.Reconnect,
|
||||
ReconnectDelay: time.Duration(t.config.ReconnectDelay) * time.Second,
|
||||
StaleTimeout: time.Duration(t.config.StaleTimeout) * time.Second,
|
||||
|
Reference in New Issue
Block a user