module Data.ByteString.IsoBaseFileFormat.Boxes.TrackHeader where
import Data.ByteString.IsoBaseFileFormat.Boxes.Box
import Data.ByteString.IsoBaseFileFormat.Boxes.BoxFields
import Data.ByteString.IsoBaseFileFormat.Boxes.FullBox
import Data.ByteString.IsoBaseFileFormat.Boxes.Versioned
trackHeader
:: (ValidBox brand (TrackHeader version), version ~ GetVersion brand)
=> TrackHeader version -> Box brand (TrackHeader version)
trackHeader = closedFullBox Default 0
data TrackHeader (version :: Nat) where
TrackHeader ::
Versioned TrackHeaderTimesV0 TrackHeaderTimesV1 version
:+ Constant (I32Arr "reserved" 2) '[0, 0]
:+ Template (I16 "layer") 0
:+ Template (I16 "alternate_group") 0
:+ Template (I16 "volume") 256
:+ Constant (I16 "reserved") 0
:+ Template (I32Arr "matrix" 9)
'[65536, 0, 0, 0, 65536, 0, 0, 0, 1073741824]
:+ I32 "width"
:+ I32 "height"
-> TrackHeader version
type TrackHeaderTimesV0 = TrackHeaderTimes (Scalar Word32)
type TrackHeaderTimesV1 = TrackHeaderTimes (Scalar Word64)
type TrackHeaderTimes uint =
uint "creation_time"
:+ uint "modification_time"
:+ U32 "track_ID"
:+ Constant (U32 "reserved") 0
:+ uint "duration"
instance IsBoxContent (TrackHeader version) where
boxSize (TrackHeader c) = boxSize c
boxBuilder (TrackHeader c) = boxBuilder c
instance KnownNat version => IsBoxType (TrackHeader version) where
type BoxContent (TrackHeader version) = FullBox version (TrackHeader version)
toBoxType _ _ = StdType "tkhd"