Skip to content

Commit

Permalink
feat: expose WithOptions function for outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
connerdouglass committed Mar 20, 2024
1 parent 353f3fc commit 919fd17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions output/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package output
import "strconv"

func WithFormat(format string) Option {
return withOptions("-f", format)
return WithOptions("-f", format)
}

func WithFormatMP4() Option {
Expand All @@ -21,7 +21,7 @@ func WithFormatMOV() Option {
}

func withDefaultMP4Options() Option {
return withOptions(
return WithOptions(
"-movflags", "use_metadata_tags",
"-vcodec", "h264",
"-pix_fmt", "yuv420p",
Expand All @@ -32,21 +32,21 @@ func withDefaultMP4Options() Option {
}

func WithFrameRate(frameRate string) Option {
return withOptions("-r", frameRate)
return WithOptions("-r", frameRate)
}

func WithTimecode(timecode string) Option {
return withOptions("-timecode", timecode)
return WithOptions("-timecode", timecode)
}

func WithConstantRateFactor(factor int) Option {
return withOptions("-crf", strconv.Itoa(factor))
return WithOptions("-crf", strconv.Itoa(factor))
}

func WithVideoCodec(codec string) Option {
return withOptions("-vcodec", codec)
return WithOptions("-vcodec", codec)
}

func WithAudioCodec(codec string) Option {
return withOptions("-acodec", codec)
return WithOptions("-acodec", codec)
}
2 changes: 1 addition & 1 deletion output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (o *outputWithArgs) Options() []string {
return o.opts
}

func withOptions(opts ...string) Option {
func WithOptions(opts ...string) Option {
return func() []string {
return opts
}
Expand Down

0 comments on commit 919fd17

Please sign in to comment.