isobmff-0.14.0.0: A parser and generator for the ISO-14496-12/14 base media file format

Safe HaskellNone
LanguageHaskell2010

Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Contents

Description

Mini EDSL for labelled box fields. The boxfields can be Scalar or ScalarArrays.

Synopsis

Scalar box fields

type U64 label = Scalar Word64 label Source #

type I64 label = Scalar Int64 label Source #

u64 :: Word64 -> U64 label Source #

i64 :: Int64 -> I64 label Source #

type U32 label = Scalar Word32 label Source #

type I32 label = Scalar Int32 label Source #

u32 :: Word32 -> U32 label Source #

i32 :: Int32 -> I32 label Source #

type U16 label = Scalar Word16 label Source #

type I16 label = Scalar Int16 label Source #

u16 :: Word16 -> U16 label Source #

i16 :: Int16 -> I16 label Source #

type U8 label = Scalar Word8 label Source #

type I8 label = Scalar Int8 label Source #

u8 :: Word8 -> U8 label Source #

i8 :: Int8 -> I8 label Source #

newtype Scalar scalartype (label :: k) Source #

A numeric box field with a type level label. Note that it has a Num instance. Use the type aliases above, e.g. U8,I8,U16,I16,U32,I32,U64,I64 from above. Use either the smart constructors, e.g. u8,i8,u16,i16,u32,i32,u64,i64 or the Num instance, whereas the constructors might give a bit more safety.

Constructors

Scalar 

Fields

Instances
IsBox ChunkOffsetTable64 Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Boxes.ChunkOffset

Associated Types

type BoxContent ChunkOffsetTable64 :: Type Source #

IsBox ChunkOffsetTable32 Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Boxes.ChunkOffset

Associated Types

type BoxContent ChunkOffsetTable32 :: Type Source #

(KnownNat scalar, Num o) => FromTypeLit (Scalar o label) (scalar :: Nat) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

fromTypeLit :: proxy (Scalar o label) scalar -> Scalar o label Source #

Eq scalartype => Eq (Scalar scalartype label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

(==) :: Scalar scalartype label -> Scalar scalartype label -> Bool #

(/=) :: Scalar scalartype label -> Scalar scalartype label -> Bool #

Num scalartype => Num (Scalar scalartype label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

(+) :: Scalar scalartype label -> Scalar scalartype label -> Scalar scalartype label #

(-) :: Scalar scalartype label -> Scalar scalartype label -> Scalar scalartype label #

(*) :: Scalar scalartype label -> Scalar scalartype label -> Scalar scalartype label #

negate :: Scalar scalartype label -> Scalar scalartype label #

abs :: Scalar scalartype label -> Scalar scalartype label #

signum :: Scalar scalartype label -> Scalar scalartype label #

fromInteger :: Integer -> Scalar scalartype label #

Ord scalartype => Ord (Scalar scalartype label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

compare :: Scalar scalartype label -> Scalar scalartype label -> Ordering #

(<) :: Scalar scalartype label -> Scalar scalartype label -> Bool #

(<=) :: Scalar scalartype label -> Scalar scalartype label -> Bool #

(>) :: Scalar scalartype label -> Scalar scalartype label -> Bool #

(>=) :: Scalar scalartype label -> Scalar scalartype label -> Bool #

max :: Scalar scalartype label -> Scalar scalartype label -> Scalar scalartype label #

min :: Scalar scalartype label -> Scalar scalartype label -> Scalar scalartype label #

Read scalartype => Read (Scalar scalartype label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

readsPrec :: Int -> ReadS (Scalar scalartype label) #

readList :: ReadS [Scalar scalartype label] #

readPrec :: ReadPrec (Scalar scalartype label) #

readListPrec :: ReadPrec [Scalar scalartype label] #

Show scalartype => Show (Scalar scalartype label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

showsPrec :: Int -> Scalar scalartype label -> ShowS #

show :: Scalar scalartype label -> String #

showList :: [Scalar scalartype label] -> ShowS #

Default scalartype => Default (Scalar scalartype label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

def :: Scalar scalartype label #

IsBoxContent (Scalar Int64 label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

IsBoxContent (Scalar Int32 label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

IsBoxContent (Scalar Int16 label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

IsBoxContent (Scalar Int8 label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

IsBoxContent (Scalar Word64 label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

IsBoxContent (Scalar Word32 label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

IsBoxContent (Scalar Word16 label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

IsBoxContent (Scalar Word8 label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

type BoxContent ChunkOffsetTable64 Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Boxes.ChunkOffset

type BoxContent ChunkOffsetTable32 Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Boxes.ChunkOffset

type BoxTypeSymbol ChunkOffsetTable64 Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Boxes.ChunkOffset

type BoxTypeSymbol ChunkOffsetTable32 Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Boxes.ChunkOffset

relabelScalar :: Scalar t l -> Scalar t l' Source #

Relabel a scalar value, e.g. convert a Scalar U32 "foo" to a Scalar U32 "bar".

Array fields

type U64Arr label size = ScalarArray label size Word64 Source #

u64Arr :: (KnownNat size, KnownSymbol label) => [Word64] -> U64Arr label size Source #

type I64Arr label size = ScalarArray label size Int64 Source #

i64Arr :: (KnownNat size, KnownSymbol label) => [Int64] -> I64Arr label size Source #

type U32Arr label size = ScalarArray label size Word32 Source #

u32Arr :: (KnownNat size, KnownSymbol label) => [Word32] -> U32Arr label size Source #

type I32Arr label size = ScalarArray label size Int32 Source #

i32Arr :: (KnownNat size, KnownSymbol label) => [Int32] -> I32Arr label size Source #

type U16Arr label size = ScalarArray label size Word16 Source #

u16Arr :: (KnownNat size, KnownSymbol label) => [Word16] -> U16Arr label size Source #

type I16Arr label size = ScalarArray label size Int16 Source #

i16Arr :: (KnownNat size, KnownSymbol label) => [Int16] -> I16Arr label size Source #

type U8Arr label size = ScalarArray label size Word8 Source #

u8Arr :: (KnownNat size, KnownSymbol label) => [Word8] -> U8Arr label size Source #

type I8Arr label size = ScalarArray label size Int8 Source #

i8Arr :: (KnownNat size, KnownSymbol label) => [Int8] -> I8Arr label size Source #

newtype ScalarArray (label :: k) (len :: Nat) o where Source #

A box field that is an array of Scalars with a type level label. Use the type aliases, e.g. U8Arr,I8Arr,U16Arr,I16Arr,U32Arr,I32Arr,U64Arr,I64Arr from above. Use the smart constructors, e.g. u8Arr,i8Arr,u16Arr,i16Arr,u32Arr,i32Arr,u64Arr,i64Arr .

Constructors

ScalarArray :: Vector o -> ScalarArray label n o 
Instances
(KnownSymbol label, SingI arr, Num o, SingKind [Nat], KnownNat len, len ~ Length arr) => FromTypeLit (ScalarArray label len o) (arr :: [Nat]) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

fromTypeLit :: proxy (ScalarArray label len o) arr -> ScalarArray label len o Source #

Eq o => Eq (ScalarArray label len o) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

(==) :: ScalarArray label len o -> ScalarArray label len o -> Bool #

(/=) :: ScalarArray label len o -> ScalarArray label len o -> Bool #

Show o => Show (ScalarArray label len o) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

showsPrec :: Int -> ScalarArray label len o -> ShowS #

show :: ScalarArray label len o -> String #

showList :: [ScalarArray label len o] -> ShowS #

(Default o, KnownNat len) => Default (ScalarArray label len o) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

def :: ScalarArray label len o #

(Num o, IsBoxContent (Scalar o label)) => IsBoxContent (ScalarArray label len o) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

boxSize :: ScalarArray label len o -> BoxSize Source #

boxBuilder :: ScalarArray label len o -> Builder Source #

fromList :: forall label n o. (KnownSymbol label, KnownNat n) => [o] -> ScalarArray label n o Source #

Internal function

Constant fields

data Constant o v where Source #

Wrapper around a field, e.g. a Scalar or ScalarArray, with a type level value. The wrapped content must implement FromTypeLit. Extends get the value of a Constant use fromTypeLit.

Constructors

Constant :: Constant o v 

Template Fields

data Template o v where Source #

Fields with default values that can be overriden with custom value. Like Constant this is a wrapper around a field, e.g. a Scalar or ScalarArray, with a type level default value. The wrapped content must implement FromTypeLit.

Constructors

Template :: Template o v 
Custom :: !o -> Template o v 

templateValue :: FromTypeLit o v => Template o v -> o Source #

Get a value from a Template.

Conversion from type-level numbers and lists to values

class FromTypeLit o v where Source #

Types that can be constructed from type level value representations.

Methods

fromTypeLit :: proxy o v -> o Source #

Instances
KnownSymbol str => FromTypeLit Text (str :: Symbol) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

fromTypeLit :: proxy Text str -> Text Source #

KnownSymbol str => FromTypeLit (U32Text label) (str :: Symbol) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

fromTypeLit :: proxy (U32Text label) str -> U32Text label Source #

(KnownNat scalar, Num o) => FromTypeLit (Scalar o label) (scalar :: Nat) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

fromTypeLit :: proxy (Scalar o label) scalar -> Scalar o label Source #

(KnownSymbol label, SingI arr, Num o, SingKind [Nat], KnownNat len, len ~ Length arr) => FromTypeLit (ScalarArray label len o) (arr :: [Nat]) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

fromTypeLit :: proxy (ScalarArray label len o) arr -> ScalarArray label len o Source #

String/Text field types

newtype FixSizeText (len :: Nat) (label :: Symbol) where Source #

A fixed size string, the first byte is the string length, after the String, the field is padded with 0 bytes. The string must be in UTF8 format.

Constructors

FixSizeText :: Text -> FixSizeText len label 
Instances
IsTextSize len => Default (FixSizeText len label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

def :: FixSizeText len label #

IsTextSize len => IsBoxContent (FixSizeText len label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

boxSize :: FixSizeText len label -> BoxSize Source #

boxBuilder :: FixSizeText len label -> Builder Source #

type IsTextSize len = (KnownNat len, 1 <= len, len <= 255) Source #

A constraint that matches type level numbers that are valid text sizes for FixSizeTexts.

newtype U32Text (label :: Symbol) where Source #

Four character strings embedded in a uint32.

Constructors

U32Text :: Word32 -> U32Text label 
Instances
KnownSymbol str => FromTypeLit (U32Text label) (str :: Symbol) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

fromTypeLit :: proxy (U32Text label) str -> U32Text label Source #

IsString (U32Text label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

fromString :: String -> U32Text label #

Default (U32Text label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields

Methods

def :: U32Text label #

IsBoxContent (U32Text label) Source # 
Instance details

Defined in Data.ByteString.IsoBaseFileFormat.Util.BoxFields