isobmff-builder 0.11.2.0 → 0.11.3.0
raw patch · 15 files changed
+52/−114 lines, 15 filesdep ~bytestringdep ~criteriondep ~data-defaultPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: bytestring, criterion, data-default, hspec, mtl, singletons, tagged, template-haskell, text, time, type-list, type-spec, vector
API changes (from Hackage documentation)
- Data.Type.BitRecords.Builder.LazyByteStringBuilder: instance Data.Type.BitRecords.Builder.LazyByteStringBuilder.BitStringBuilderHoley (Data.Proxy.Proxy Data.Type.BitRecords.Core.BitRecord ('Data.Type.BitRecords.Core.BitRecordDoc d)) a
- Data.Type.BitRecords.Builder.LazyByteStringBuilder: instance Data.Type.BitRecords.Builder.LazyByteStringBuilder.BitStringBuilderHoley (Data.Proxy.Proxy Data.Type.BitRecords.Core.BitRecord r) a => Data.Type.BitRecords.Builder.LazyByteStringBuilder.BitStringBuilderHoley (Data.Proxy.Proxy Data.Type.BitRecords.Core.BitRecord ('Data.Type.BitRecords.Core.BitRecordDocNested d r)) a
- Data.Type.BitRecords.Core: [BitRecordDocNested] :: PrettyType -> BitRecord -> BitRecord
- Data.Type.BitRecords.Core: [BitRecordDoc] :: PrettyType -> BitRecord
- Data.ByteString.Mp4.Boxes.AudioSpecificConfig: type AudioConfigCommon aoId samplingFrequencyIndex channels rest = ("audio-specific-config" <:> PutHex8 (FromEnum AudioObjectTypeId aoId)) #+$ (((AudioObjectTypeRec aoId :+: BitRecordOfEnum samplingFrequencyIndex) :+: BitRecordOfEnum channels) :+: rest)
+ Data.ByteString.Mp4.Boxes.AudioSpecificConfig: type AudioConfigCommon aoId samplingFrequencyIndex channels rest = ((AudioObjectTypeRec aoId :+: BitRecordOfEnum samplingFrequencyIndex) :+: BitRecordOfEnum channels) :+: rest
- Data.ByteString.Mp4.Boxes.AudioSpecificConfig: type AudioObjectTypeRec n = ((If ((FromEnum AudioObjectTypeId n) <=? 30) "AudioObjectType" "ExtAudioObjectType") <:> PutHex8 (FromEnum AudioObjectTypeId n)) #+$ (AudioObjectTypeField1 (FromEnum AudioObjectTypeId n) .+: AudioObjectTypeField2 (FromEnum AudioObjectTypeId n))
+ Data.ByteString.Mp4.Boxes.AudioSpecificConfig: type AudioObjectTypeRec n = AudioObjectTypeField1 (FromEnum AudioObjectTypeId n) .+: AudioObjectTypeField2 (FromEnum AudioObjectTypeId n)
Files
- .gitignore +1/−0
- isobmff-builder.cabal +20/−20
- spec/BitRecordsSpec.hs +1/−1
- spec/Mp4AudioFileSpec.hs +1/−4
- src/Data/ByteString/Mp4/Boxes/AudioSpecificConfig.hs +14/−23
- src/Data/ByteString/Mp4/Boxes/BaseDescriptor.hs +1/−2
- src/Data/ByteString/Mp4/Boxes/DecoderConfigDescriptor.hs +2/−4
- src/Data/ByteString/Mp4/Boxes/DecoderSpecificInfo.hs +1/−2
- src/Data/ByteString/Mp4/Boxes/ElementaryStreamDescriptor.hs +2/−3
- src/Data/ByteString/Mp4/Boxes/Expandable.hs +3/−4
- src/Data/ByteString/Mp4/Boxes/SyncLayerConfigDescriptor.hs +1/−3
- src/Data/Type/BitRecords/Builder/LazyByteStringBuilder.hs +0/−9
- src/Data/Type/BitRecords/Core.hs +2/−36
- src/Data/Type/BitRecords/Sized.hs +2/−2
- stack.yaml +1/−1
.gitignore view
@@ -12,3 +12,4 @@ /.dir-locals.el *.refactored.hs /*.html+*-build-timed.log
isobmff-builder.cabal view
@@ -1,5 +1,5 @@ name: isobmff-builder-version: 0.11.2.0+version: 0.11.3.0 synopsis: A (bytestring-) builder for the ISO-14496-12 base media file format description: Please see README.md homepage: https://github.com/sheyll/isobmff-builder#readme@@ -108,18 +108,18 @@ , Data.Type.BitRecords.SizedString , Data.Type.BitRecords.Sized build-depends: base >= 4.9 && < 5- , bytestring >= 0.10.8.1 && < 0.11- , type-list >= 0.5.0.0 && < 0.6- , data-default >= 0.7.1.1 && < 0.8- , vector >= 0.11 && < 0.12- , singletons >= 2.2 && < 3- , tagged >= 0.8 && < 1- , time >= 1.6.0.1 && < 2- , text >= 1.2.2.1 && < 2+ , bytestring+ , type-list+ , data-default+ , vector+ , singletons+ , tagged+ , time+ , text , type-spec >= 0.3- , mtl >= 2.2 && < 3+ , mtl , pretty-types >= 0.2.3 && < 0.3- , template-haskell >= 2.11 && < 3+ , template-haskell default-language: Haskell2010 ghc-options: -O2 -Wall -funbox-strict-fields -fno-warn-unused-do-bind -fprint-explicit-kinds if flag(tracing)@@ -176,15 +176,15 @@ , Mp4AudioSegmentSpec , TypeLayoutSpec build-depends: base >= 4.9 && < 5- , bytestring >= 0.10.8.1- , hspec >= 2.2 && < 3+ , bytestring+ , hspec , isobmff-builder , binary- , text >= 1.2.2.1 && < 2- , type-spec >= 0.3- , mtl >= 2.2 && < 3+ , text+ , type-spec+ , mtl , QuickCheck- , tagged >= 0.8 && < 1+ , tagged , pretty-types >= 0.2.1 && < 0.3 default-language: Haskell2010 default-extensions: BangPatterns@@ -231,9 +231,9 @@ build-depends: base >= 4.9 && < 5 , isobmff-builder , binary- , bytestring >= 0.10.8.1 && < 0.11- , criterion >= 1.1 && < 2- , tagged >= 0.8 && < 1+ , bytestring+ , criterion+ , tagged , type-spec >= 0.3 default-language: Haskell2010 default-extensions: BangPatterns
spec/BitRecordsSpec.hs view
@@ -159,7 +159,7 @@ showARecord (Proxy :: Proxy (RecordField [utf8|Heλλo World!|])) `shouldBe` "utf-8(112) := <<He\955\955o World!>> [14 Bytes]" describe "Sized SizeField16 SizedString" $ it "renders the number bytes not chars as the size field value" $- showARecord (Proxy :: Proxy (SizedField16 [utf8|Heλλo World!|])) `shouldBe` "sized-field\n size: U16 := hex: 000e (dec: 14)\n utf-8(112) := <<He\955\955o World!>> [14 Bytes]"+ showARecord (Proxy :: Proxy (SizedField16 [utf8|Heλλo World!|])) `shouldBe` "size: U16 := hex: 000e (dec: 14)\n utf-8(112) := <<He\955\955o World!>> [14 Bytes]" describe "bitStringBuilder" $ do describe "no length prefix" $ it "renders no size prefix and the string as UTF-8 bytes" $
spec/Mp4AudioFileSpec.hs view
@@ -49,7 +49,7 @@ "<< 03 19 00 01 00 04 11 40 15 00 00 00 00 00 00 00 00 00 00 00 05 02 11 88 06 01 02 >>" it "can be pretty printed" $ showRecord (Proxy @(BitRecordOfDescriptor $~ Eval Mp4AacLcEsDescriptor))- `shouldStartWith` "base-descriptor: 03\n"+ `shouldStartWith` "U8 := hex: 03 (dec: 3)\n" describe "Mp4HeAacEsDescriptor" $ do it "can be transformed to binary output" $ bitStringPrinter (Proxy @(BitRecordOfDescriptor $~ Eval Mp4HeAacEsDescriptor))@@ -59,9 +59,6 @@ (MkEnumValue (Proxy @'SF24000)) `shouldBe` "<< 03 1a 00 01 00 04 12 40 15 00 00 00 00 00 00 00 00 00 00 00 05 03 29 8b 08 03 00 81 00 >>"- it "can be pretty printed" $- showRecord (Proxy @(BitRecordOfDescriptor $~ Eval Mp4HeAacEsDescriptor))- `shouldStartWith` "base-descriptor: 03\n" describe "SingleAudioTrackInit version 0" $ do it "renders some output at all" $ do creationTime <- mp4CurrentTime
src/Data/ByteString/Mp4/Boxes/AudioSpecificConfig.hs view
@@ -44,27 +44,21 @@ -> IsA (DecoderSpecificInfo 'AudioIso14496_3 'AudioStream) type instance- Eval (AudioConfigSbrExplicitHierachical- aoId- subCfg- freq- channels- extFreq- ) =- ('MkDecoderSpecificInfo- (AudioConfigCommon 'Sbr freq channels- ("SBR audio object type" <:> PutHex8 (FromEnum AudioObjectTypeId aoId)- #+: BitRecordOfEnum extFreq- :+: AudioObjectTypeRec aoId- :+: BitRecordOfAudioSubConfig subCfg)))+ Eval+ (AudioConfigSbrExplicitHierachical aoId subCfg freq channels+ extFreq)+ =+ 'MkDecoderSpecificInfo+ (AudioConfigCommon 'Sbr freq channels+ (BitRecordOfEnum extFreq :+:+ AudioObjectTypeRec aoId :+: BitRecordOfAudioSubConfig subCfg)) -- | Common header for audio specific config type AudioConfigCommon aoId samplingFrequencyIndex channels rest =- ("audio-specific-config" <:> PutHex8 (FromEnum AudioObjectTypeId aoId))- #+$ (AudioObjectTypeRec aoId- :+: BitRecordOfEnum samplingFrequencyIndex- :+: BitRecordOfEnum channels- :+: rest)+ AudioObjectTypeRec aoId+ :+: BitRecordOfEnum samplingFrequencyIndex+ :+: BitRecordOfEnum channels+ :+: rest -- ** Audio Object Type @@ -144,11 +138,8 @@ type instance FromEnum AudioObjectTypeId 'AoDst = 35 type AudioObjectTypeRec n =- (If ((FromEnum AudioObjectTypeId n) <=? 30)- "AudioObjectType"- "ExtAudioObjectType") <:> PutHex8 (FromEnum AudioObjectTypeId n)- #+$ AudioObjectTypeField1 (FromEnum AudioObjectTypeId n)- .+: AudioObjectTypeField2 (FromEnum AudioObjectTypeId n)+ AudioObjectTypeField1 (FromEnum AudioObjectTypeId n)+ .+: AudioObjectTypeField2 (FromEnum AudioObjectTypeId n) type family AudioObjectTypeField1 (n :: Nat) :: IsA (BitRecordField ('MkFieldBits :: BitField (B 5) Nat 5)) where
src/Data/ByteString/Mp4/Boxes/BaseDescriptor.hs view
@@ -17,8 +17,7 @@ type instance BitRecordOfDescriptor $~ ('MkDescriptor body :: Descriptor (tag :: ClassTag tagInd)) =- ("base-descriptor" <:> PutHex8 tagInd)- #+$ FieldU8 := tagInd+ FieldU8 := tagInd .+: Eval (StaticExpandableContent body) type family GetClassTag (c :: ClassTag n) :: Nat where
src/Data/ByteString/Mp4/Boxes/DecoderConfigDescriptor.hs view
@@ -4,7 +4,6 @@ import Data.ByteString.Mp4.Boxes.BaseDescriptor import Data.ByteString.Mp4.Boxes.DecoderSpecificInfo import Data.Type.BitRecords-import Data.Type.Pretty import Data.Kind.Extra import GHC.TypeLits @@ -28,8 +27,7 @@ :: BitRecord where DecoderConfigDescriptorBody ot st di ps =- PutStr "decoder-config-descriptor"- #+$ (BitRecordOfEnum (SetEnum "objectTypeIndication" ObjectTypeIndicationEnum ot)+ BitRecordOfEnum (SetEnum "objectTypeIndication" ObjectTypeIndicationEnum ot) :+: BitRecordOfEnum (SetEnum "objectTypeIndication" StreamTypeEnum st) :+: "upstream" @: Flag .+: "reserved" @: Field 1 := 1@@ -42,7 +40,7 @@ (di ?:: LengthIn 0 1)) :+: Eval (BitRecordOfList (Extract :>>>: BitRecordOfDescriptor)- (ps ?:: LengthIn 0 255)))+ (ps ?:: LengthIn 0 255)) -- ** 'ProfileLevelIndicationIndexDescriptor'
src/Data/ByteString/Mp4/Boxes/DecoderSpecificInfo.hs view
@@ -3,7 +3,6 @@ import Data.ByteString.Mp4.Boxes.BaseDescriptor import Data.Type.BitRecords-import Data.Type.Pretty import Data.Kind.Extra import Data.Kind (type Type) @@ -18,7 +17,7 @@ :: IsA (DecoderSpecificInfo ot st :-> Descriptor 'DecSpecificInfo) type instance DescriptorOfDecoderSpecificInfo $~ 'MkDecoderSpecificInfo body =- 'MkDescriptor (PutStr "decoder-specific-info" #+$ body)+ 'MkDescriptor body type ObjectTypeIndicationEnum = FixedEnum ObjectTypeIndication 8
src/Data/ByteString/Mp4/Boxes/ElementaryStreamDescriptor.hs view
@@ -64,14 +64,13 @@ type instance Eval (ESDescriptor esId depEsId url ocrEsId streamPrio decConfig slConfig) = 'MkDescriptor- (PutStr "elementary-stream-descriptor"- #+$ "esId" @: FieldU16 :~ esId+ ("esId" @: FieldU16 :~ esId .+: "depEsIdFlag" @: FlagJust depEsId .+: "urlFlag" @: FlagJust url .+: "ocrEsIdFlag" @: FlagJust ocrEsId .+: "streamPriority" @: Field 5 :~ streamPrio .+: ("depEsId" @: FieldU16 :+? depEsId)- :+: (PutStr "url" #+: (Eval (OptionalRecordOf (Fun1 RecordField) url)))+ :+: (Eval (OptionalRecordOf (Fun1 RecordField) url)) :+: ("ocrEsId" @: FieldU16 :+? ocrEsId) :+: (BitRecordOfDescriptor $~ Eval decConfig) :+: (BitRecordOfDescriptor $~ Eval slConfig)
src/Data/ByteString/Mp4/Boxes/Expandable.hs view
@@ -13,10 +13,9 @@ type StaticExpandableContentMaxBits = 32 type instance Eval (StaticExpandableContent record) =- (("expandable-content-size" <:>- PutHex32 (ShiftR StaticExpandableContentMaxBits (BitRecordSize record) 3)- #+$ ExpandableSize (ShiftR StaticExpandableContentMaxBits (BitRecordSize record) 3))- :+: record)+ (ExpandableSize+ (ShiftR StaticExpandableContentMaxBits (BitRecordSize record) 3))+ :+: record type family ExpandableSize (s :: Nat) :: BitRecord where ExpandableSize 0 = 'EmptyBitRecord
src/Data/ByteString/Mp4/Boxes/SyncLayerConfigDescriptor.hs view
@@ -13,6 +13,4 @@ -- this value is too much. The righteous one ever only uses __two__. Only a fool -- will use __256__. type instance Eval Mp4SyncLayerDescriptor =- 'MkDescriptor- (PutStr "mp4-sync-layer-descriptor"- #+$ ('BitRecordMember ("predefined" @: FieldU8 := 0x02)))+ 'MkDescriptor ('BitRecordMember ("predefined" @: FieldU8 := 0x02))
src/Data/Type/BitRecords/Builder/LazyByteStringBuilder.hs view
@@ -295,15 +295,6 @@ -- *** 'EmptyBitRecord' and '...Pretty' -instance forall d r a . BitStringBuilderHoley (Proxy r) a =>- BitStringBuilderHoley (Proxy ('BitRecordDocNested d r)) a where- type ToBitStringBuilder (Proxy ('BitRecordDocNested d r)) a =- ToBitStringBuilder (Proxy r) a- bitStringBuilderHoley _ = bitStringBuilderHoley (Proxy @r)--instance BitStringBuilderHoley (Proxy ('BitRecordDoc d)) a where- bitStringBuilderHoley _ = id- instance BitStringBuilderHoley (Proxy 'EmptyBitRecord) a where bitStringBuilderHoley _ = id
src/Data/Type/BitRecords/Core.hs view
@@ -18,9 +18,7 @@ -- | 'BitRecordField's assembly data BitRecord where EmptyBitRecord :: BitRecord- BitRecordDoc :: PrettyType -> BitRecord BitRecordMember :: IsA (BitRecordField t) -> BitRecord- BitRecordDocNested :: PrettyType -> BitRecord -> BitRecord BitRecordAppend :: BitRecord -> BitRecord -> BitRecord -- TODO MissingBitRecord :: ErrorMessage -> BitRecord @@ -34,17 +32,13 @@ -- | Eval the size in as a number of bits from a 'BitRecord' type family BitRecordSize (x :: BitRecord) :: Nat where BitRecordSize 'EmptyBitRecord = 0- BitRecordSize ('BitRecordDoc d) = 0 BitRecordSize ('BitRecordMember f) = BitRecordFieldSize f- BitRecordSize ('BitRecordDocNested d r) = BitRecordSize r BitRecordSize ('BitRecordAppend l r) = BitRecordSize l + BitRecordSize r -- | The total number of members in a record. type family BitRecordMemberCount (b :: BitRecord) :: Nat where BitRecordMemberCount 'EmptyBitRecord = 0- BitRecordMemberCount ('BitRecordDoc r) = 0 BitRecordMemberCount ('BitRecordMember f) = 1- BitRecordMemberCount ('BitRecordDocNested d r) = BitRecordMemberCount r BitRecordMemberCount ('BitRecordAppend l r) = BitRecordMemberCount l + BitRecordMemberCount r -- | Return the size of the record.@@ -56,30 +50,6 @@ type OptionalRecordOf (f :: IsA (s :-> IsA BitRecord)) (x :: Maybe s) = (Optional (Pure 'EmptyBitRecord) f $~ x :: IsA BitRecord) --- TODO remove??---- ** Record PrettyPrinting---- | Augment the pretty printed output of a 'BitRecord'-data (prettyTitle :: PrettyType) #: (r :: IsA BitRecord) :: IsA BitRecord-infixr 4 #:-type instance Eval (prettyTitle #: r) = Append ('BitRecordDoc prettyTitle) (Eval r)---- | Augment the pretty printed output of a 'BitRecord'-type (prettyTitle :: PrettyType) #+: (r :: BitRecord) =- Append ('BitRecordDoc prettyTitle) r-infixr 4 #+:---- | Augment the pretty printed output of a 'BitRecord'-data (prettyTitle :: PrettyType) #$ (r :: IsA BitRecord) :: IsA BitRecord-infixr 2 #$-type instance Eval (prettyTitle #$ r) = 'BitRecordDocNested prettyTitle (Eval r)---- | Augment the pretty printed output of a 'BitRecord'-type (prettyTitle :: PrettyType) #+$ (r :: BitRecord)- = 'BitRecordDocNested prettyTitle r-infixr 2 #+$- -- ** Record composition -- | Combine two 'BitRecord's to form a new 'BitRecord'. If the parameters are@@ -296,10 +266,8 @@ -- | An optional field in a bit record data MaybeField :: Maybe (IsA (BitRecordField t)) -> IsA BitRecord-type instance Eval (MaybeField ('Just fld)) =- Append ('BitRecordDoc (PutStr "Just")) ('BitRecordMember fld)-type instance Eval (MaybeField 'Nothing) =- 'BitRecordDoc (PutStr "Nothing")+type instance Eval (MaybeField ('Just fld)) = 'BitRecordMember fld+type instance Eval (MaybeField 'Nothing) = 'EmptyBitRecord -- | A 'BitRecordField' can be used as 'BitRecordMember' data RecordField :: IsA (BitRecordField t) -> IsA BitRecord@@ -332,8 +300,6 @@ PrettyRecord ('BitRecordMember m) = PrettyField m PrettyRecord ' EmptyBitRecord = 'PrettyNewline PrettyRecord ('BitRecordAppend l r) = PrettyRecord l <$$> PrettyRecord r- PrettyRecord ('BitRecordDoc p) = p- PrettyRecord ('BitRecordDocNested p r) = p <$$--> PrettyRecord r type instance ToPretty (f :: IsA (BitRecordField t)) = PrettyField f
src/Data/Type/BitRecords/Sized.hs view
@@ -20,7 +20,7 @@ (r :: BitRecord) :: IsA BitRecord type instance Eval (Sized sf r) =- PutStr "sized-record" #+$ ("size" @: sf := SizeFieldValue r .+: r)+ "size" @: sf := SizeFieldValue r .+: r -- | A convenient alias for a 'Sized' with an 'FieldU8' size field. type Sized8 t = Sized FieldU8 t@@ -41,7 +41,7 @@ (r :: IsA (BitRecordField (u :: BitField (rt' :: Type) (st' :: k0) (len0 :: Nat)))) :: IsA BitRecord type instance Eval (SizedField sf r) =- PutStr "sized-field" #+$ "size" @: sf := SizeFieldValue r .+. r+ "size" @: sf := SizeFieldValue r .+. r -- | A convenient alias for a 'SizedField' with an 'FieldU8' size field. type SizedField8 t = SizedField FieldU8 t
stack.yaml view
@@ -1,4 +1,4 @@-resolver: lts-7.5+resolver: lts-8.2 packages: - '.'