module Data.ByteString.IsoBaseFileFormat.Boxes.SpecificMediaHeader where
import Data.ByteString.IsoBaseFileFormat.Boxes.Box
import Data.ByteString.IsoBaseFileFormat.Boxes.BoxFields
import Data.ByteString.IsoBaseFileFormat.Boxes.FullBox
data SpecificMediaHeader where
VideoMediaHeader
:: Template (U16 "graphicsmode") 0
:+ Template (U16 "reserved") 0
-> SpecificMediaHeader
SoundMediaHeader
:: Template (I16 "balance") 0
:+ Constant (U16Arr "opcolor" 3) '[0,0,0]
-> SpecificMediaHeader
HintMediaHeader
:: U16 "maxPDUsize"
:+ U16 "avgPDUsize"
:+ U16 "maxbitrate"
:+ U16 "avgbitrate"
:+ U32 "reserved"
-> SpecificMediaHeader
NullMediaHeader
:: SpecificMediaHeader
specificMediaHeader
:: ValidBox brand SpecificMediaHeader
=> SpecificMediaHeader -> Box brand SpecificMediaHeader
specificMediaHeader h@(VideoMediaHeader _) = closedFullBox Default 1 h
specificMediaHeader h = closedFullBox Default 0 h
instance IsBoxType SpecificMediaHeader where
type BoxContent SpecificMediaHeader = FullBox 0 SpecificMediaHeader
toBoxType _ (FullBox _ _ (VideoMediaHeader _)) = StdType "vmhd"
toBoxType _ (FullBox _ _ (SoundMediaHeader _)) = StdType "smhd"
toBoxType _ (FullBox _ _ (HintMediaHeader _)) = StdType "hmhd"
toBoxType _ (FullBox _ _ NullMediaHeader) = StdType "nmhd"
instance IsBoxContent SpecificMediaHeader where
boxSize (VideoMediaHeader c) = boxSize c
boxSize (SoundMediaHeader c) = boxSize c
boxSize (HintMediaHeader c) = boxSize c
boxSize NullMediaHeader = boxSize ()
boxBuilder (VideoMediaHeader c) = boxBuilder c
boxBuilder (SoundMediaHeader c) = boxBuilder c
boxBuilder (HintMediaHeader c) = boxBuilder c
boxBuilder NullMediaHeader = boxBuilder ()