refactor(ffmpeg): selected_frame and frame(n) starts from 1
* refactor(ffmpeg): selected_frame and frame(n) starts from 1 * test: update golden files
|
|
@ -88,7 +88,7 @@ func (av *AVContext) ProcessFrames(maxFrames int) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (av *AVContext) SelectFrame(n int) (err error) {
|
func (av *AVContext) SelectFrame(n int) (err error) {
|
||||||
nn := C.int(n)
|
nn := C.int(n - 1)
|
||||||
if av.thumbContext != nil && nn > av.availableIndex {
|
if av.thumbContext != nil && nn > av.availableIndex {
|
||||||
nn = av.availableIndex
|
nn = av.availableIndex
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +123,7 @@ func (av *AVContext) Metadata() *Metadata {
|
||||||
}
|
}
|
||||||
var selectedFrame int
|
var selectedFrame int
|
||||||
if av.availableIndex > 0 && av.selectedIndex > -1 {
|
if av.availableIndex > 0 && av.selectedIndex > -1 {
|
||||||
selectedFrame = int(av.selectedIndex)
|
selectedFrame = int(av.selectedIndex) + 1
|
||||||
}
|
}
|
||||||
return &Metadata{
|
return &Metadata{
|
||||||
Orientation: av.orientation,
|
Orientation: av.orientation,
|
||||||
|
|
|
||||||
BIN
testdata/golden/export/alpha-webm.webm-5.jpg
vendored
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 7.9 KiB |
BIN
testdata/golden/export/everybody-betray-me.mkv-5.jpg
vendored
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
BIN
testdata/golden/export/macabre.mp4-5.jpg
vendored
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
BIN
testdata/golden/export/schizo.flv-5.jpg
vendored
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
BIN
testdata/golden/export/schizo_0.mp4-5.jpg
vendored
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
BIN
testdata/golden/export/schizo_180.mp4-5.jpg
vendored
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
BIN
testdata/golden/export/schizo_270.mp4-5.jpg
vendored
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
BIN
testdata/golden/export/schizo_90.mp4-5.jpg
vendored
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":12040,"width":720,"height":576,"fps":25,"selected_frame":4,"has_video":true,"has_audio":false}
|
{"orientation":1,"duration":12040,"width":720,"height":576,"fps":25,"selected_frame":5,"has_video":true,"has_audio":false}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":12040,"width":720,"height":576,"fps":25,"selected_frame":99,"has_video":true,"has_audio":false}
|
{"orientation":1,"duration":12040,"width":720,"height":576,"fps":25,"selected_frame":100,"has_video":true,"has_audio":false}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":12040,"width":720,"height":576,"fps":25,"selected_frame":99,"has_video":true,"has_audio":false}
|
{"orientation":1,"duration":12040,"width":720,"height":576,"fps":25,"selected_frame":100,"has_video":true,"has_audio":false}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":5,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":6,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":7407,"width":640,"height":480,"fps":29.9,"selected_frame":5,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":7407,"width":640,"height":480,"fps":30.1,"selected_frame":5,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":99,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":100,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":99,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":100,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":3925,"width":492,"height":360,"fps":30,"selected_frame":4,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":3925,"width":492,"height":360,"fps":30,"selected_frame":5,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":3925,"width":492,"height":360,"fps":30,"selected_frame":29,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":3925,"width":492,"height":360,"fps":30,"selected_frame":30,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":3925,"width":492,"height":360,"fps":30,"selected_frame":29,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":3925,"width":492,"height":360,"fps":30,"selected_frame":30,"has_video":true,"has_audio":true}
|
||||||
2
testdata/golden/meta/schizo.flv-10.meta.json
vendored
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":27.9,"selected_frame":5,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":27.9,"selected_frame":6,"has_video":true,"has_audio":true}
|
||||||
2
testdata/golden/meta/schizo.flv-5.meta.json
vendored
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":26.3,"selected_frame":5,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":25.6,"selected_frame":5,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":29.7,"selected_frame":75,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":29.7,"selected_frame":76,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":29.7,"selected_frame":75,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":29.7,"selected_frame":76,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":5,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":6,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":19,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":20,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":19,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":20,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":3,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":4,"has_video":true,"has_audio":true}
|
{"orientation":3,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":5,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":3,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":19,"has_video":true,"has_audio":true}
|
{"orientation":3,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":20,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":3,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":19,"has_video":true,"has_audio":true}
|
{"orientation":3,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":20,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":6,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":6,"has_video":true,"has_audio":true}
|
{"orientation":6,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":7,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":6,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":19,"has_video":true,"has_audio":true}
|
{"orientation":6,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":20,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":6,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":19,"has_video":true,"has_audio":true}
|
{"orientation":6,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":20,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":8,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":7,"has_video":true,"has_audio":true}
|
{"orientation":8,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":8,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":8,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":19,"has_video":true,"has_audio":true}
|
{"orientation":8,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":20,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":8,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":19,"has_video":true,"has_audio":true}
|
{"orientation":8,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":20,"has_video":true,"has_audio":true}
|
||||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
|
@ -1 +1 @@
|
||||||
{"format":"mkv","content_type":"video/x-matroska","orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":43,"has_video":true,"has_audio":true}
|
{"format":"mkv","content_type":"video/x-matroska","orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":44,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"format":"mkv","content_type":"video/x-matroska","orientation":1,"duration":7407,"width":640,"height":480,"fps":29.9,"selected_frame":3,"has_video":true,"has_audio":true}
|
{"format":"mkv","content_type":"video/x-matroska","orientation":1,"duration":7407,"width":640,"height":480,"fps":29.9,"selected_frame":4,"has_video":true,"has_audio":true}
|
||||||