refactor(ffmpeg): use float for FPS
* refactor(ffmpeg): use float for FPS * test: update golden files
This commit is contained in:
parent
2cf461421d
commit
5ff3407305
7 changed files with 17 additions and 17 deletions
|
|
@ -23,16 +23,16 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Metadata struct {
|
type Metadata struct {
|
||||||
Orientation int `json:"orientation"`
|
Orientation int `json:"orientation"`
|
||||||
Duration int `json:"duration,omitempty"`
|
Duration int `json:"duration,omitempty"`
|
||||||
Width int `json:"width,omitempty"`
|
Width int `json:"width,omitempty"`
|
||||||
Height int `json:"height,omitempty"`
|
Height int `json:"height,omitempty"`
|
||||||
Title string `json:"title,omitempty"`
|
Title string `json:"title,omitempty"`
|
||||||
Artist string `json:"artist,omitempty"`
|
Artist string `json:"artist,omitempty"`
|
||||||
FPS int `json:"fps,omitempty"`
|
FPS float64 `json:"fps,omitempty"`
|
||||||
SelectedFrame int `json:"selected_frame,omitempty"`
|
SelectedFrame int `json:"selected_frame,omitempty"`
|
||||||
HasVideo bool `json:"has_video"`
|
HasVideo bool `json:"has_video"`
|
||||||
HasAudio bool `json:"has_audio"`
|
HasAudio bool `json:"has_audio"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AVContext struct {
|
type AVContext struct {
|
||||||
|
|
@ -139,7 +139,7 @@ func (av *AVContext) Metadata() *Metadata {
|
||||||
Height: av.height,
|
Height: av.height,
|
||||||
Title: av.title,
|
Title: av.title,
|
||||||
Artist: av.artist,
|
Artist: av.artist,
|
||||||
FPS: int(math.Round(fps)),
|
FPS: math.Round(fps*10) / 10,
|
||||||
SelectedFrame: selectedFrame,
|
SelectedFrame: selectedFrame,
|
||||||
HasVideo: av.hasVideo,
|
HasVideo: av.hasVideo,
|
||||||
HasAudio: av.hasAudio,
|
HasAudio: av.hasAudio,
|
||||||
|
|
|
||||||
|
|
@ -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":29.9,"selected_frame":5,"has_video":true,"has_audio":true}
|
||||||
2
testdata/golden/meta/schizo.flv-10.meta.json
vendored
2
testdata/golden/meta/schizo.flv-10.meta.json
vendored
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":28,"selected_frame":5,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":27.9,"selected_frame":5,"has_video":true,"has_audio":true}
|
||||||
2
testdata/golden/meta/schizo.flv-5.meta.json
vendored
2
testdata/golden/meta/schizo.flv-5.meta.json
vendored
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":26,"selected_frame":5,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":26.3,"selected_frame":5,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":30,"selected_frame":75,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":29.7,"selected_frame":75,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":30,"selected_frame":75,"has_video":true,"has_audio":true}
|
{"orientation":1,"duration":2560,"width":480,"height":360,"fps":29.7,"selected_frame":75,"has_video":true,"has_audio":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"format":"mkv","content_type":"video/x-matroska","orientation":1,"duration":7407,"width":640,"height":480,"fps":30,"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":3,"has_video":true,"has_audio":true}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue