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