module Data.ByteString.IsoBaseFileFormat.Boxes.DataReference
(DataReference()
,DataEntryUrl()
,DataEntryUrn()
,dataReference
,localMediaDataReference
,localMediaDataEntryUrl
,dataEntryUrl
,dataEntryUrn
)
where
import Data.ByteString.IsoBaseFileFormat.Boxes.Box
import Data.ByteString.IsoBaseFileFormat.Boxes.FullBox
import Data.ByteString.IsoBaseFileFormat.Boxes.BoxFields
hiding (Default)
import qualified Data.Text as T
import Data.Singletons.Prelude.List (Length)
import Data.Default
newtype DataReference =
DataReference (U32 "entry_count")
deriving (Default,IsBoxContent)
newtype DataEntryUrl =
DataEntryUrl (Maybe T.Text)
deriving (Default,IsBoxContent)
newtype DataEntryUrn =
DataEntryUrn (T.Text :+ T.Text)
deriving (IsBoxContent)
dataReference
:: KnownNat (Length ts)
=> Boxes ts -> Box (ContainerBox (FullBox DataReference 0) ts)
dataReference bs =
containerBox (FullBox 0 $ DataReference (typeListLength bs))
bs
localMediaDataReference
:: Box (ContainerBox (FullBox DataReference 0) '[Box (FullBox DataEntryUrl 0)])
localMediaDataReference = dataReference (singletonBox localMediaDataEntryUrl)
localMediaDataEntryUrl
:: Box (FullBox DataEntryUrl 0)
localMediaDataEntryUrl = dataEntryUrl True Nothing
dataEntryUrl
:: Bool -> Maybe T.Text -> Box (FullBox DataEntryUrl 0)
dataEntryUrl isLocal Nothing = Box (FullBox (fromIntegral $ fromEnum isLocal) $ DataEntryUrl Nothing)
dataEntryUrl isLocal murl = Box (FullBox (fromIntegral $ fromEnum isLocal) $ DataEntryUrl murl)
dataEntryUrn
:: Bool -> T.Text -> T.Text -> Box (FullBox DataEntryUrn 0)
dataEntryUrn isLocal urn url = Box (FullBox (fromIntegral $ fromEnum isLocal) $ DataEntryUrn $ urn :+ url)
instance IsBox DataReference
type instance BoxTypeSymbol DataReference = "dref"
instance IsBox DataEntryUrn
type instance BoxTypeSymbol DataEntryUrn = "urn "
instance IsBox DataEntryUrl
type instance BoxTypeSymbol DataEntryUrl = "urn "