Add support for date placeholder in process config

Because it doesn't make sense to replace the date placeholder at
process creation, it has to be replaced at every start of the process.

On process creation only the static placeholders (such as process ID)
are replaced. Dynamic placeholders (so far only "date") are not
replaced. On process start, a callback has been introduced that gives
the chance to change the command line. This is the point where
the restreamer replaces the date placeholders.
This commit is contained in:
Ingo Oppermann
2023-02-28 17:46:08 +01:00
parent f345707c63
commit be718eac0a
32 changed files with 2510 additions and 237 deletions

View File

@@ -32,9 +32,10 @@ type ProcessConfig struct {
Reconnect bool
ReconnectDelay time.Duration
StaleTimeout time.Duration
Command []string
Args []string
Parser process.Parser
Logger log.Logger
OnArgs func([]string) []string
OnExit func()
OnStart func()
OnStateChange func(from, to string)
@@ -113,12 +114,13 @@ func New(config Config) (FFmpeg, error) {
func (f *ffmpeg) New(config ProcessConfig) (process.Process, error) {
ffmpeg, err := process.New(process.Config{
Binary: f.binary,
Args: config.Command,
Args: config.Args,
Reconnect: config.Reconnect,
ReconnectDelay: config.ReconnectDelay,
StaleTimeout: config.StaleTimeout,
Parser: config.Parser,
Logger: config.Logger,
OnArgs: config.OnArgs,
OnStart: config.OnStart,
OnExit: config.OnExit,
OnStateChange: func(from, to string) {