Skip to content

Commit

Permalink
Added image type, replaced snake case by camel case in types
Browse files Browse the repository at this point in the history
  • Loading branch information
cajax committed Dec 23, 2019
1 parent 208ed58 commit d51f7d3
Show file tree
Hide file tree
Showing 3 changed files with 398 additions and 355 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
bin/
yami.iml
example/video.mp4
example/image.jpg
27 changes: 26 additions & 1 deletion example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ import (
)

func main() {
mediainfo, err := yami.GetMediaInfo("video.mp4", 10*time.Second,"--Language=raw")
videoDetails("video.mp4")
imageDetails("image.jpg")
}

func videoDetails(filename string){
mediainfo, err := yami.GetMediaInfo(filename, 10*time.Second,"--Language=raw")

if err != nil {
log.Panic(err)
Expand All @@ -30,3 +35,23 @@ func main() {
log.Printf("Audio Format:\t%s", audio.Format)
log.Printf("Channels:\t\t%d", audio.Channels)
}

func imageDetails(filename string){
mediainfo, err := yami.GetMediaInfo(filename, 10*time.Second,"--Language=raw")

if err != nil {
log.Panic(err)
}

b, err := json.MarshalIndent(mediainfo, "", " ")
if err != nil {
log.Panic(err)
}
log.Println(string(b))

image := mediainfo.GetFirstImageTrack()

log.Printf("Format:\t%s", image.Format)
log.Printf("Width:\t%d", image.Width)
log.Printf("Height:\t%d", image.Height)
}
Loading

0 comments on commit d51f7d3

Please sign in to comment.