feat(ffmpeg): seek and select frame by duration and float position (#39)
* feat(ffmpeg): seek by duration * remove selected_frame * test: update golden files * remove selected_frame * feat(ffmpeg): seek by duration * feat(ffmpeg): seek by duration * feat(ffmpeg): seek by duration * feat(ffmpeg): seek by duration * feat(ffmpeg): seek by duration * test: update golden files * feat(ffmpeg): seek by duration * test: update golden files
This commit is contained in:
parent
6f9a3d085a
commit
d6b3ec4bdc
59 changed files with 133 additions and 94 deletions
28
processor.go
28
processor.go
|
|
@ -10,6 +10,7 @@ import (
|
|||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Processor struct {
|
||||
|
|
@ -124,10 +125,31 @@ func (p *Processor) Process(ctx context.Context, in *imagor.Blob, params imagorp
|
|||
bands = 4
|
||||
}
|
||||
}
|
||||
case "seek":
|
||||
if ts, e := time.ParseDuration(filter.Args); e == nil {
|
||||
if err = av.SeekDuration(ts); err != nil {
|
||||
return
|
||||
}
|
||||
} else if f, e := strconv.ParseFloat(filter.Args, 64); e == nil {
|
||||
if err = av.SeekPosition(f); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
case "frame":
|
||||
n, _ := strconv.Atoi(filter.Args)
|
||||
if err = av.SelectFrame(n); err != nil {
|
||||
return
|
||||
if ts, e := time.ParseDuration(filter.Args); e == nil {
|
||||
if err = av.SelectDuration(ts); err != nil {
|
||||
return
|
||||
}
|
||||
} else if f, e := strconv.ParseFloat(filter.Args, 64); e == nil {
|
||||
if strings.Contains(filter.Args, ".") {
|
||||
if err = av.SelectPosition(f); err != nil {
|
||||
return
|
||||
}
|
||||
} else if n := int(f); n >= 1 {
|
||||
if err = av.SelectFrame(n); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
case "max_frames":
|
||||
n, _ := strconv.Atoi(filter.Args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue