Add log_patterns to process config

log_patterns allow to filter the FFmpeg log messages based on regular
expressions. Each entry of log_patterns is interpreted as regular
expression and matched against every non-progress log line emitted from
FFmpeg. All matching lines are returned in the matches array of the
report.
This commit is contained in:
Ingo Oppermann
2023-03-27 15:50:25 +02:00
parent 814975dfee
commit 0a3117bbd0
12 changed files with 175 additions and 12 deletions

View File

@@ -17,7 +17,7 @@ import (
type FFmpeg interface {
New(config ProcessConfig) (process.Process, error)
NewProcessParser(logger log.Logger, id, reference string) parse.Parser
NewProcessParser(logger log.Logger, id, reference string, logpatterns []string) parse.Parser
NewProbeParser(logger log.Logger) probe.Parser
ValidateInputAddress(address string) bool
ValidateOutputAddress(address string) bool
@@ -168,11 +168,12 @@ func (f *ffmpeg) New(config ProcessConfig) (process.Process, error) {
return ffmpeg, err
}
func (f *ffmpeg) NewProcessParser(logger log.Logger, id, reference string) parse.Parser {
func (f *ffmpeg) NewProcessParser(logger log.Logger, id, reference string, logpatterns []string) parse.Parser {
p := parse.New(parse.Config{
LogLines: f.logLines,
LogHistory: f.historyLength,
LogMinimalHistory: f.minimalHistoryLength,
Patterns: logpatterns,
Logger: logger,
Collector: NewWrappedCollector(id, reference, f.collector),
})