-
Notifications
You must be signed in to change notification settings - Fork 0
/
options.go
35 lines (29 loc) · 1019 Bytes
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package timelapse
import (
"github.com/mpawlowski/timelapse/src/pkg/ffmpeg"
"github.com/mpawlowski/timelapse/src/pkg/imagemagick"
)
type timelapseOptions struct {
ffmpegOptions []ffmpeg.Option
imagemagickOptions []imagemagick.ConvertOption
}
// Option is an interface for functional options.
type Option func(*timelapseOptions)
func defaultTimelapseOptions() *timelapseOptions {
return &timelapseOptions{
ffmpegOptions: []ffmpeg.Option{},
imagemagickOptions: []imagemagick.ConvertOption{},
}
}
// WithFFMpegVideoOptions is a functional option for setting ffmpeg options.
func WithFFMpegVideoOptions(opts ...ffmpeg.Option) Option {
return func(t *timelapseOptions) {
t.ffmpegOptions = append(t.ffmpegOptions, opts...)
}
}
// WithImageMagickMorphOptions is a functional option for setting imagemagick options.
func WithImageMagickMorphOptions(opts ...imagemagick.ConvertOption) Option {
return func(t *timelapseOptions) {
t.imagemagickOptions = append(t.imagemagickOptions, opts...)
}
}