From 1420483262ae754849933fbd60a4c8c95fd2dd62 Mon Sep 17 00:00:00 2001 From: nareix Date: Wed, 22 Jun 2016 19:21:01 +0800 Subject: [PATCH] av.go multi changes --- av.go | 124 +++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 88 insertions(+), 36 deletions(-) diff --git a/av.go b/av.go index e0cc1e4..98635b5 100644 --- a/av.go +++ b/av.go @@ -2,12 +2,13 @@ package av import ( "fmt" + "time" ) -type SampleFormat int +type SampleFormat uint8 const ( - U8 = SampleFormat(iota+1) + U8 = SampleFormat(iota + 1) S16 S32 FLT @@ -22,13 +23,13 @@ const ( func (self SampleFormat) BytesPerSample() int { switch self { - case U8,U8P: + case U8, U8P: return 1 - case S16,S16P: + case S16, S16P: return 2 - case FLT,FLTP,S32,S32P,U32: + case FLT, FLTP, S32, S32P, U32: return 4 - case DBL,DBLP: + case DBL, DBLP: return 8 default: return 0 @@ -64,21 +65,21 @@ func (self SampleFormat) String() string { func (self SampleFormat) IsPlanar() bool { switch self { - case S16P,S32P,FLTP,DBLP: + case S16P, S32P, FLTP, DBLP: return true default: return false } } -type ChannelLayout uint64 +type ChannelLayout uint16 func (self ChannelLayout) String() string { return fmt.Sprintf("%dch", self.Count()) } const ( - CH_FRONT_CENTER = ChannelLayout(1<