refactor(ffmpeg): process on select frame

* refactor(ffmpeg): process on select frame

* reset golden

* test: update golden files
This commit is contained in:
Adrian Shum 2022-10-13 18:26:14 +08:00 committed by GitHub
parent 4fe4a1561a
commit da15744b3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 11 additions and 11 deletions

View file

@ -97,6 +97,9 @@ func (av *AVContext) SelectFrame(n int) (err error) {
nn = av.thumbContext.n - 1 nn = av.thumbContext.n - 1
} }
av.selectedIndex = nn av.selectedIndex = nn
if err = av.ProcessFrames(-1); err != nil {
return
}
return nil return nil
} }

View file

@ -72,9 +72,6 @@ func TestAVContext(t *testing.T) {
if frame > -1 { if frame > -1 {
require.NoError(t, av.SelectFrame(frame)) require.NoError(t, av.SelectFrame(frame))
} }
if frame != 9999 {
require.NoError(t, av.ProcessFrames(-1))
}
} }
meta := av.Metadata() meta := av.Metadata()
metaBuf, err := json.Marshal(meta) metaBuf, err := json.Marshal(meta)

View file

@ -1 +1 @@
{"orientation":1,"duration":12040,"width":720,"height":576,"fps":25,"selected_frame":45,"has_video":true,"has_audio":false} {"orientation":1,"duration":12040,"width":720,"height":576,"has_video":true,"has_audio":false}

View file

@ -1 +1 @@
{"orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"selected_frame":43,"has_video":true,"has_audio":true} {"orientation":1,"duration":7407,"width":640,"height":480,"has_video":true,"has_audio":true}

View file

@ -1 +1 @@
{"orientation":1,"duration":3925,"width":492,"height":360,"fps":30,"selected_frame":11,"has_video":true,"has_audio":true} {"orientation":1,"duration":3925,"width":492,"height":360,"has_video":true,"has_audio":true}

View file

@ -1 +1 @@
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":30,"selected_frame":28,"has_video":true,"has_audio":true} {"orientation":1,"duration":2560,"width":480,"height":360,"has_video":true,"has_audio":true}

View file

@ -1 +1 @@
{"orientation":1,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":11,"has_video":true,"has_audio":true} {"orientation":1,"duration":2544,"width":480,"height":360,"has_video":true,"has_audio":true}

View file

@ -1 +1 @@
{"orientation":3,"duration":2544,"width":480,"height":360,"fps":30,"selected_frame":8,"has_video":true,"has_audio":true} {"orientation":3,"duration":2544,"width":480,"height":360,"has_video":true,"has_audio":true}

View file

@ -1 +1 @@
{"orientation":6,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":11,"has_video":true,"has_audio":true} {"orientation":6,"duration":2544,"width":360,"height":480,"has_video":true,"has_audio":true}

View file

@ -1 +1 @@
{"orientation":8,"duration":2544,"width":360,"height":480,"fps":30,"selected_frame":9,"has_video":true,"has_audio":true} {"orientation":8,"duration":2544,"width":360,"height":480,"has_video":true,"has_audio":true}