Skip to content

Commit

Permalink
feat: add split and asplit filters
Browse files Browse the repository at this point in the history
  • Loading branch information
connerdouglass committed Mar 8, 2024
1 parent 831c572 commit 4c1f97a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
24 changes: 24 additions & 0 deletions filter/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,27 @@ func formatTransformOptionValue(value string) string {
}
return value
}

type rawFilter struct {
str string
outputs int
}

func Raw(str string, outputs int) Filter {
return &rawFilter{
str: str,
outputs: outputs,
}
}

func (f *rawFilter) With(key string, value expr.Expr) Filter {
return f
}

func (f *rawFilter) String() string {
return f.str
}

func (f *rawFilter) Outputs() int {
return f.outputs
}
13 changes: 13 additions & 0 deletions filter/filters/asplit.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package filters

import (
"fmt"

"github.com/spiretechnology/spireav/filter"
)

// AudioSplit corresponds to the "asplit" FFmpeg filter.
// Documentation: https://ffmpeg.org/ffmpeg-filters.html#asplit
func AudioSplit(outputs int) filter.Filter {
return filter.Raw(fmt.Sprintf("asplit=%d", outputs), outputs)
}
13 changes: 13 additions & 0 deletions filter/filters/split.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package filters

import (
"fmt"

"github.com/spiretechnology/spireav/filter"
)

// Split corresponds to the "split" FFmpeg filter.
// Documentation: https://ffmpeg.org/ffmpeg-filters.html#split
func Split(outputs int) filter.Filter {
return filter.Raw(fmt.Sprintf("split=%d", outputs), outputs)
}

0 comments on commit 4c1f97a

Please sign in to comment.