mirror of
https://github.com/u2takey/ffmpeg-go.git
synced 2025-10-05 16:06:52 +08:00
Close u2takey/ffmpeg-go#80
Discover CommandOption type and ffmpeg.GlobalCommandOptions array, that is processed before running ffmpeg or ffprobe commands. Add tests.
This commit is contained in:
7
run.go
7
run.go
@@ -236,6 +236,10 @@ func (s *Stream) ErrorToStdOut() *Stream {
|
||||
return s.WithErrorOutput(os.Stdout)
|
||||
}
|
||||
|
||||
type CommandOption func(cmd *exec.Cmd)
|
||||
|
||||
var GlobalCommandOptions = make([]CommandOption, 0)
|
||||
|
||||
type CompilationOption func(s *Stream, cmd *exec.Cmd)
|
||||
|
||||
func (s *Stream) SetFfmpegPath(path string) *Stream {
|
||||
@@ -259,6 +263,9 @@ func (s *Stream) Compile(options ...CompilationOption) *exec.Cmd {
|
||||
for _, option := range options {
|
||||
option(s, cmd)
|
||||
}
|
||||
for _, option := range GlobalCommandOptions {
|
||||
option(cmd)
|
||||
}
|
||||
log.Printf("compiled command: ffmpeg %s\n", strings.Join(args, " "))
|
||||
return cmd
|
||||
}
|
||||
|
Reference in New Issue
Block a user