refactor: duration metadata in millisecond (#25)
* refactor: duration metadata in millisecond * test: update golden files
This commit is contained in:
parent
818aabf13d
commit
f103bd4d01
10 changed files with 19 additions and 19 deletions
|
|
@ -22,15 +22,15 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Metadata struct {
|
type Metadata struct {
|
||||||
Orientation int `json:"orientation"`
|
Orientation int `json:"orientation"`
|
||||||
Duration time.Duration `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"`
|
||||||
HasVideo bool `json:"has_video"`
|
HasVideo bool `json:"has_video"`
|
||||||
HasAudio bool `json:"has_audio"`
|
HasAudio bool `json:"has_audio"`
|
||||||
HasAlpha bool `json:"has_alpha"`
|
HasAlpha bool `json:"has_alpha"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type AVContext struct {
|
type AVContext struct {
|
||||||
|
|
@ -94,7 +94,7 @@ func (av *AVContext) Close() {
|
||||||
func (av *AVContext) Metadata() *Metadata {
|
func (av *AVContext) Metadata() *Metadata {
|
||||||
return &Metadata{
|
return &Metadata{
|
||||||
Orientation: av.orientation,
|
Orientation: av.orientation,
|
||||||
Duration: av.duration,
|
Duration: int(av.duration / time.Millisecond),
|
||||||
Width: av.width,
|
Width: av.width,
|
||||||
Height: av.height,
|
Height: av.height,
|
||||||
Title: av.title,
|
Title: av.title,
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":12040000000,"width":720,"height":576,"has_video":true,"has_audio":false,"has_alpha":true}
|
{"orientation":1,"duration":12040,"width":720,"height":576,"has_video":true,"has_audio":false,"has_alpha":true}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":7407000000,"width":640,"height":480,"has_video":true,"has_audio":true,"has_alpha":false}
|
{"orientation":1,"duration":7407,"width":640,"height":480,"has_video":true,"has_audio":true,"has_alpha":false}
|
||||||
2
testdata/golden/meta/macabre.mp4.meta.json
vendored
2
testdata/golden/meta/macabre.mp4.meta.json
vendored
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":3925000000,"width":492,"height":360,"has_video":true,"has_audio":true,"has_alpha":false}
|
{"orientation":1,"duration":3925,"width":492,"height":360,"has_video":true,"has_audio":true,"has_alpha":false}
|
||||||
2
testdata/golden/meta/schizo.flv.meta.json
vendored
2
testdata/golden/meta/schizo.flv.meta.json
vendored
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2560000000,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false}
|
{"orientation":1,"duration":2560,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false}
|
||||||
2
testdata/golden/meta/schizo_0.mp4.meta.json
vendored
2
testdata/golden/meta/schizo_0.mp4.meta.json
vendored
|
|
@ -1 +1 @@
|
||||||
{"orientation":1,"duration":2544000000,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false}
|
{"orientation":1,"duration":2544,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":3,"duration":2544000000,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false}
|
{"orientation":3,"duration":2544,"width":480,"height":360,"has_video":true,"has_audio":true,"has_alpha":false}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"orientation":6,"duration":2544000000,"width":360,"height":480,"has_video":true,"has_audio":true,"has_alpha":false}
|
{"orientation":6,"duration":2544,"width":360,"height":480,"has_video":true,"has_audio":true,"has_alpha":false}
|
||||||
2
testdata/golden/meta/schizo_90.mp4.meta.json
vendored
2
testdata/golden/meta/schizo_90.mp4.meta.json
vendored
|
|
@ -1 +1 @@
|
||||||
{"orientation":8,"duration":2544000000,"width":360,"height":480,"has_video":true,"has_audio":true,"has_alpha":false}
|
{"orientation":8,"duration":2544,"width":360,"height":480,"has_video":true,"has_audio":true,"has_alpha":false}
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"format":"mkv","content_type":"video/x-matroska","orientation":1,"duration":7407000000,"width":640,"height":480,"has_video":true,"has_audio":true,"has_alpha":false}
|
{"format":"mkv","content_type":"video/x-matroska","orientation":1,"duration":7407,"width":640,"height":480,"has_video":true,"has_audio":true,"has_alpha":false}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue