@carbonenginejs/runtime-resource 0.20.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +6 -0
- package/dist/CjsResMan.js +1374 -1318
- package/dist/CjsResMan.js.map +1 -1
- package/dist/format/CjsFormat.js +393 -164
- package/dist/format/CjsFormat.js.map +1 -1
- package/dist/format/CjsFormatStore.js +315 -0
- package/dist/format/CjsFormatStore.js.map +1 -0
- package/dist/format/CjsResourceProbe.js +66 -234
- package/dist/format/CjsResourceProbe.js.map +1 -1
- package/dist/format/payloadContract.js +47 -6
- package/dist/format/payloadContract.js.map +1 -1
- package/dist/formats/black/CjsBlackFormat.js +23 -6
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/bnk/CjsBnkFormat.js +122 -120
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/helpers.js +5 -15
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/cmf/CjsCmfFormat.js +31 -14
- package/dist/formats/cmf/CjsCmfFormat.js.map +1 -1
- package/dist/formats/dds/CjsDdsFormat.js +29 -19
- package/dist/formats/dds/CjsDdsFormat.js.map +1 -1
- package/dist/formats/dds/core/helpers.js +4 -5
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/dxbc/CjsDxbcFormat.js +15 -13
- package/dist/formats/dxbc/CjsDxbcFormat.js.map +1 -1
- package/dist/formats/fbx/CjsFbxFormat.js +27 -19
- package/dist/formats/fbx/CjsFbxFormat.js.map +1 -1
- package/dist/formats/fbx/core/helpers.js +4 -4
- package/dist/formats/fbx/core/helpers.js.map +1 -1
- package/dist/formats/flac/CjsFlacFormat.js +19 -17
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/formats/flac/core/helpers.js +5 -11
- package/dist/formats/flac/core/helpers.js.map +1 -1
- package/dist/formats/fsd/32/CjsFsd32Format.js +55 -0
- package/dist/formats/fsd/32/CjsFsd32Format.js.map +1 -0
- package/dist/formats/fsd/32/index.js +2 -0
- package/dist/formats/fsd/32/index.js.map +1 -0
- package/dist/formats/fsd/64/CjsFsd64Format.js +119 -0
- package/dist/formats/fsd/64/CjsFsd64Format.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64Binary.js +393 -0
- package/dist/formats/fsd/64/core/CjsFsd64Binary.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64Reader.js +138 -0
- package/dist/formats/fsd/64/core/CjsFsd64Reader.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaDecoder.js +389 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaDecoder.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaReader.js +43 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaReader.js.map +1 -0
- package/dist/formats/fsd/64/core/fsd64Records.js +60 -0
- package/dist/formats/fsd/64/core/fsd64Records.js.map +1 -0
- package/dist/formats/fsd/64/index.js +7 -0
- package/dist/formats/fsd/64/index.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64ReaderSetCharacterStaticData.js +33 -0
- package/dist/formats/fsd/64/readers/CjsFsd64ReaderSetCharacterStaticData.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentTypes.js +35 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentsInSpace.js +50 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentsInSpace.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAncestries.js +75 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAncestries.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaArchetypes.js +57 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaArchetypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAudioMetadata.js +201 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAudioMetadata.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaBloodlines.js +73 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaBloodlines.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCategories.js +53 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterAvatarBehaviors.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterAvatarBehaviors.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorLocations.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorNames.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorNames.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterModifierLocations.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterModifierLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterPortraitResources.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterPortraitResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterResources.js +81 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterSculptingLocations.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterSculptingLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCompressibleTypes.js +41 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCompressibleTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaContrabandTypes.js +63 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaContrabandTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaControlTowerResources.js +76 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaControlTowerResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationActivities.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationActivities.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoleGroups.js +74 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoleGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoles.js +59 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoles.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributeCategories.js +46 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributeCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributes.js +133 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaEffects.js +236 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaEffects.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaUnits.js +60 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaUnits.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDynamicItemAttributes.js +95 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDynamicItemAttributes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaEpicArcs.js +106 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaEpicArcs.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaExpertSystems.js +86 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaExpertSystems.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaFactions.js +117 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaFactions.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicIds.js +70 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicIds.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicMaterialSets.js +173 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicMaterialSets.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGroups.js +77 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaIcons.js +62 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaIcons.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMarketGroups.js +63 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMarketGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMetaGroups.js +86 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMetaGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporationDivisions.js +72 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporationDivisions.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporations.js +326 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaPaperdolls.js +279 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaPaperdolls.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaRaces.js +64 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaRaces.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchoolMap.js +40 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchoolMap.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchools.js +113 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchools.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkillPlans.js +130 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkillPlans.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentCategories.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentPointValues.js +45 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentPointValues.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentRarities.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentRarities.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponents.js +163 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponents.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotCategories.js +37 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotConfigurations.js +77 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotConfigurations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotNames.js +37 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotNames.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlots.js +74 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlots.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrTierThresholds.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrTierThresholds.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationOperations.js +120 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationOperations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationServices.js +49 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationServices.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeDogma.js +73 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeDogma.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeLists.js +122 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeLists.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeMaterials.js +83 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeMaterials.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypes.js +194 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/index.js +58 -0
- package/dist/formats/fsd/64/readers/index.js.map +1 -0
- package/dist/formats/fsd/CjsFsdFormat.js +62 -0
- package/dist/formats/fsd/CjsFsdFormat.js.map +1 -0
- package/dist/formats/fsd/index.js +9 -0
- package/dist/formats/fsd/index.js.map +1 -0
- package/dist/formats/gif/CjsGifFormat.js +26 -16
- package/dist/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/formats/gif/core/helpers.js +6 -18
- package/dist/formats/gif/core/helpers.js.map +1 -1
- package/dist/formats/gltf/CjsGltfFormat.js +25 -13
- package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/formats/gr2/CjsGr2Format.js +27 -6
- package/dist/formats/gr2/CjsGr2Format.js.map +1 -1
- package/dist/formats/hlsl/CjsHlslFormat.js +20 -16
- package/dist/formats/hlsl/CjsHlslFormat.js.map +1 -1
- package/dist/formats/hlsl/core/analysis.js +1 -1
- package/dist/formats/index.js +5 -0
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/jpeg/CjsJpegFormat.js +26 -19
- package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -1
- package/dist/formats/jpeg/core/helpers.js +6 -15
- package/dist/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/formats/jpeg/core/jpeg.js +0 -3
- package/dist/formats/jpeg/core/jpeg.js.map +1 -1
- package/dist/formats/mp3/CjsMp3Format.js +19 -19
- package/dist/formats/mp3/CjsMp3Format.js.map +1 -1
- package/dist/formats/mp3/core/helpers.js +5 -11
- package/dist/formats/mp3/core/helpers.js.map +1 -1
- package/dist/formats/mp4/CjsMp4Format.js +20 -19
- package/dist/formats/mp4/CjsMp4Format.js.map +1 -1
- package/dist/formats/mp4/core/helpers.js +6 -15
- package/dist/formats/mp4/core/helpers.js.map +1 -1
- package/dist/formats/obj/CjsObjFormat.js +25 -12
- package/dist/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/formats/ogg/CjsOggFormat.js +26 -17
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/formats/ogg/core/helpers.js +5 -16
- package/dist/formats/ogg/core/helpers.js.map +1 -1
- package/dist/formats/pickle/CjsPickleFormat.js +64 -5
- package/dist/formats/pickle/CjsPickleFormat.js.map +1 -1
- package/dist/formats/png/CjsPngFormat.js +28 -19
- package/dist/formats/png/CjsPngFormat.js.map +1 -1
- package/dist/formats/png/core/helpers.js +5 -14
- package/dist/formats/png/core/helpers.js.map +1 -1
- package/dist/formats/red/CjsRedFormat.js +19 -5
- package/dist/formats/red/CjsRedFormat.js.map +1 -1
- package/dist/formats/schemabound/CjsSchemaBoundFormat.js +48 -38
- package/dist/formats/schemabound/CjsSchemaBoundFormat.js.map +1 -1
- package/dist/formats/sqlite/CjsSqliteFormat.js +49 -41
- package/dist/formats/sqlite/CjsSqliteFormat.js.map +1 -1
- package/dist/formats/static/CjsStaticFormat.js +15 -57
- package/dist/formats/static/CjsStaticFormat.js.map +1 -1
- package/dist/formats/static/staticContainers.js +6 -6
- package/dist/formats/static/staticContainers.js.map +1 -1
- package/dist/formats/stl/CjsStlFormat.js +25 -12
- package/dist/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/formats/tga/CjsTgaFormat.js +26 -19
- package/dist/formats/tga/CjsTgaFormat.js.map +1 -1
- package/dist/formats/tga/core/helpers.js +7 -22
- package/dist/formats/tga/core/helpers.js.map +1 -1
- package/dist/formats/wav/CjsWavFormat.js +26 -19
- package/dist/formats/wav/CjsWavFormat.js.map +1 -1
- package/dist/formats/wav/core/helpers.js +7 -16
- package/dist/formats/wav/core/helpers.js.map +1 -1
- package/dist/formats/webgl/CjsWebglFormat.js +11 -13
- package/dist/formats/webgl/CjsWebglFormat.js.map +1 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +31 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/formats/webgl/core/readGlslEffectContainer.js +8 -8
- package/dist/formats/webgl/core/readGlslEffectContainer.js.map +1 -1
- package/dist/formats/webgpu/CjsWebgpuFormat.js +11 -5
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/formats/webm/CjsWebmFormat.js +20 -19
- package/dist/formats/webm/CjsWebmFormat.js.map +1 -1
- package/dist/formats/webm/core/helpers.js +6 -15
- package/dist/formats/webm/core/helpers.js.map +1 -1
- package/dist/formats/webp/CjsWebpFormat.js +19 -17
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/formats/webp/core/helpers.js +5 -11
- package/dist/formats/webp/core/helpers.js.map +1 -1
- package/dist/formats/wem/CjsWemFormat.js +128 -141
- package/dist/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/formats/wem/core/helpers.js +1 -114
- package/dist/formats/wem/core/helpers.js.map +1 -1
- package/dist/formats/wem/core/{resolve.js → probeCodecSupport.js} +11 -18
- package/dist/formats/wem/core/probeCodecSupport.js.map +1 -0
- package/dist/formats/yaml/CjsYamlFormat.js +20 -5
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/generated/index.js +2 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/resources/Tr2RaycastGeometryRes.js +34 -0
- package/dist/generated/resources/Tr2RaycastGeometryRes.js.map +1 -0
- package/dist/generated/resources/index.js +2 -0
- package/dist/generated/resources/index.js.map +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/resource/CjsResource.js +134 -0
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/ResourceRequirement.js +42 -0
- package/dist/resource/ResourceRequirement.js.map +1 -0
- package/dist/resource/Tr2LightProfileRes.js +2 -1
- package/dist/resource/Tr2LightProfileRes.js.map +1 -1
- package/dist/resource/geometry/TriGeometryRes.js +34 -7
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js +184 -7
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -1
- package/dist/resource/geometry/granny/TriGrannyRes.js +20 -8
- package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -1
- package/dist/resource/index.js +1 -0
- package/dist/resource/index.js.map +1 -1
- package/dist/resource/resourceBoundary.js +24 -1
- package/dist/resource/resourceBoundary.js.map +1 -1
- package/dist/resource/shader/Tr2EffectRes.js +2 -1
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
- package/dist/resource/texture/CjsTextureArrayRes.js +2 -1
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
- package/dist/resource/texture/Tr2ImageRes.js +2 -1
- package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
- package/dist/resource/texture/TriTextureRes.js +40 -2
- package/dist/resource/texture/TriTextureRes.js.map +1 -1
- package/docs/architecture.md +121 -116
- package/docs/concepts/format-capabilities.md +90 -0
- package/docs/formats/README.md +14 -6
- package/docs/formats/fsd.md +104 -0
- package/docs/formats/gr2.md +1 -1
- package/docs/formats/hlsl/reference/api.md +6 -4
- package/docs/formats/provenance.md +18 -0
- package/docs/formats/schemabound.md +10 -4
- package/docs/formats/static.md +26 -26
- package/docs/formats/webgpu/reference/api.md +4 -3
- package/docs/reference/classes/core.md +22 -2
- package/docs/reference/classes/formats.md +643 -1
- package/docs/reference/classes/resources.md +463 -453
- package/docs/reference/queues.md +205 -194
- package/docs/roadmap.md +14 -18
- package/format-notices/fsd/LICENSE +21 -0
- package/format-notices/fsd/NOTICE +11 -0
- package/package.json +70 -64
- package/dist/formats/wem/core/resolve.js.map +0 -1
- package/docs/concepts/format-type-resolution.md +0 -79
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CjsFormat } from '../../format/CjsFormat.js';
|
|
2
|
+
import { DEFAULT_VALUES, normalizeValues, readWithValues, inspectWithValues, toJsonValue, probeSupportWithValues, isFLAC, toBytes, OUTPUT_JSON, OUTPUT_PCM, OUTPUT_RAW } from './core/helpers.js';
|
|
2
3
|
|
|
3
4
|
const FORMAT_NAME = "CjsFlacFormat";
|
|
4
5
|
|
|
@@ -7,11 +8,12 @@ const FORMAT_NAME = "CjsFlacFormat";
|
|
|
7
8
|
* inspects stream metadata, and emits raw container bytes or debug JSON
|
|
8
9
|
* without decoding PCM.
|
|
9
10
|
*/
|
|
10
|
-
class CjsFlacFormat {
|
|
11
|
+
class CjsFlacFormat extends CjsFormat {
|
|
11
12
|
#values = DEFAULT_VALUES;
|
|
12
13
|
|
|
13
14
|
/** Creates a CjsFlacFormat with caller-provided reader configuration. */
|
|
14
15
|
constructor(options = {}) {
|
|
16
|
+
super();
|
|
15
17
|
this.SetValues(options);
|
|
16
18
|
}
|
|
17
19
|
|
|
@@ -62,14 +64,6 @@ class CjsFlacFormat {
|
|
|
62
64
|
return inspectWithValues(input, this.GetValues(options));
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
/**
|
|
66
|
-
* Reports whether input meets the active decoder capability constraints for
|
|
67
|
-
* the FLAC format configuration.
|
|
68
|
-
*/
|
|
69
|
-
IsSupported(input, options = {}) {
|
|
70
|
-
return isSupportedWithValues(input, this.GetValues(options));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
67
|
/**
|
|
74
68
|
* Converts the current decoded payload into a JSON-safe representation for
|
|
75
69
|
* the FLAC format configuration.
|
|
@@ -100,8 +94,8 @@ class CjsFlacFormat {
|
|
|
100
94
|
}
|
|
101
95
|
|
|
102
96
|
/** Checks one input against the FLAC decoder capability contract. */
|
|
103
|
-
static
|
|
104
|
-
return
|
|
97
|
+
static probeSupport(input, options = {}) {
|
|
98
|
+
return probeSupportWithValues(input, normalizeValues(DEFAULT_VALUES, {
|
|
105
99
|
inputType: "flac",
|
|
106
100
|
...options
|
|
107
101
|
}, FORMAT_NAME));
|
|
@@ -130,12 +124,20 @@ class CjsFlacFormat {
|
|
|
130
124
|
JSON: OUTPUT_JSON
|
|
131
125
|
});
|
|
132
126
|
static OUTPUT_FLAC_JSON = "flacJson";
|
|
133
|
-
static
|
|
127
|
+
static id = "flac";
|
|
134
128
|
static mediaTypes = Object.freeze(["audio"]);
|
|
135
|
-
static
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
129
|
+
static outputs = CjsFormat.defineOutputs({
|
|
130
|
+
flacJson: {
|
|
131
|
+
role: "debug",
|
|
132
|
+
probes: ["flacJson", "raw"]
|
|
133
|
+
},
|
|
134
|
+
raw: {
|
|
135
|
+
role: "debug",
|
|
136
|
+
default: true,
|
|
137
|
+
passthrough: true
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
static extensions = Object.freeze([".flac"]);
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
export { CjsFlacFormat };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsFlacFormat.js","sources":["../../../../src/formats/flac/CjsFlacFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_JSON,\n OUTPUT_PCM,\n OUTPUT_RAW,\n inspectWithValues,\n isFLAC,\n
|
|
1
|
+
{"version":3,"file":"CjsFlacFormat.js","sources":["../../../../src/formats/flac/CjsFlacFormat.js"],"sourcesContent":["import { CjsFormat } from \"../../format/CjsFormat.js\";\nimport {\n DEFAULT_VALUES,\n OUTPUT_JSON,\n OUTPUT_PCM,\n OUTPUT_RAW,\n inspectWithValues,\n isFLAC,\n probeSupportWithValues,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsFlacFormat\";\n\n/**\n * Metadata-only FLAC format profile that validates the stream signature,\n * inspects stream metadata, and emits raw container bytes or debug JSON\n * without decoding PCM.\n */\nexport class CjsFlacFormat extends CjsFormat\n{\n #values = DEFAULT_VALUES;\n\n /** Creates a CjsFlacFormat with caller-provided reader configuration. */\n constructor(options = {})\n {\n super();\n this.SetValues(options);\n }\n\n /**\n * Applies caller-provided options after normalizing supported fields for the\n * FLAC format configuration.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"flac\", ...options }, FORMAT_NAME);\n return this;\n }\n\n /**\n * Returns a snapshot of the normalized reader options for the FLAC format\n * configuration.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"flac\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Reads the primary public payload representation from the supplied input\n * for the FLAC format configuration.\n */\n Read(input, options = {}) { return readWithValues(input, this.GetValues(options)); }\n\n /**\n * Reads the primary public payload representation asynchronously for the\n * FLAC format configuration.\n */\n async ReadAsync(input, options = {}) { return this.Read(input, options); }\n\n /**\n * Returns structural metadata without materializing the decoded payload for\n * the FLAC format configuration.\n */\n Inspect(input, options = {}) { return inspectWithValues(input, this.GetValues(options)); }\n\n /**\n * Converts the current decoded payload into a JSON-safe representation for\n * the FLAC format configuration.\n */\n ToJSON(value) { return toJsonValue(value); }\n\n /** Provides the one-shot FLAC payload reader entry point. */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"flac\", ...options }, FORMAT_NAME));\n }\n\n /** Provides the asynchronous one-shot FLAC payload reader entry point. */\n static async readAsync(input, options = {}) { return CjsFlacFormat.read(input, options); }\n\n /** Provides the one-shot FLAC metadata inspection entry point. */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"flac\", ...options }, FORMAT_NAME));\n }\n\n /** Checks one input against the FLAC decoder capability contract. */\n static probeSupport(input, options = {})\n {\n return probeSupportWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"flac\", ...options }, FORMAT_NAME));\n }\n\n /** Provides the one-shot FLAC JSON conversion entry point. */\n static toJSON(value) { return toJsonValue(value); }\n\n /** Checks whether caller-provided bytes carry the expected FLAC signature. */\n static isFLAC(input)\n {\n try { return isFLAC(toBytes(input)); }\n catch { return false; }\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n RAW: OUTPUT_RAW,\n PCM: OUTPUT_PCM,\n JSON: OUTPUT_JSON\n });\n static OUTPUT_FLAC_JSON = \"flacJson\";\n static id = \"flac\";\n static mediaTypes = Object.freeze([ \"audio\" ]);\n static outputs = CjsFormat.defineOutputs({\n flacJson: { role: \"debug\", probes: [ \"flacJson\", \"raw\" ] },\n raw: { role: \"debug\", default: true, passthrough: true }\n });\n static extensions = Object.freeze([ \".flac\" ]);\n}\n\nexport default CjsFlacFormat;\n"],"names":["FORMAT_NAME","CjsFlacFormat","CjsFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","probeSupport","probeSupportWithValues","toJSON","isFLAC","toBytes","Output","Object","freeze","RAW","OUTPUT_RAW","PCM","OUTPUT_PCM","JSON","OUTPUT_JSON","OUTPUT_FLAC_JSON","id","mediaTypes","outputs","defineOutputs","flacJson","role","probes","raw","default","passthrough","extensions"],"mappings":";;;AAeA,MAAMA,WAAW,GAAG,eAAe;;AAEnC;AACA;AACA;AACA;AACA;AACO,MAAMC,aAAa,SAASC,SAAS,CAC5C;EACI,OAAO,GAAGC,cAAc;;AAExB;AACAC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,IAAA,KAAK,EAAE;AACP,IAAA,IAAI,CAACC,SAAS,CAACD,OAAO,CAAC;AAC3B,EAAA;;AAEA;AACJ;AACA;AACA;AACIC,EAAAA,SAASA,CAACD,OAAO,GAAG,EAAE,EACtB;IACI,IAAI,CAAC,OAAO,GAAGE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,MAAM;MAAE,GAAGH;KAAS,EAAEL,WAAW,CAAC;AAC5F,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACIS,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,MAAM;MAAE,GAAGH;KAAS,EAAEL,WAAW,CAAC;AACxF,EAAA;;AAEA;AACJ;AACA;AACA;AACIU,EAAAA,IAAIA,CAACC,KAAK,EAAEN,OAAO,GAAG,EAAE,EAAE;IAAE,OAAOO,cAAc,CAACD,KAAK,EAAE,IAAI,CAACF,SAAS,CAACJ,OAAO,CAAC,CAAC;AAAE,EAAA;;AAEnF;AACJ;AACA;AACA;EACI,MAAMQ,SAASA,CAACF,KAAK,EAAEN,OAAO,GAAG,EAAE,EAAE;AAAE,IAAA,OAAO,IAAI,CAACK,IAAI,CAACC,KAAK,EAAEN,OAAO,CAAC;AAAE,EAAA;;AAEzE;AACJ;AACA;AACA;AACIS,EAAAA,OAAOA,CAACH,KAAK,EAAEN,OAAO,GAAG,EAAE,EA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M,CAACC,OAAO,CAACf,KAAK,CAAC,CAAC;AAAE,IAAA,CAAC,CACtC,MAAM;AAAE,MAAA,OAAO,KAAK;AAAE,IAAA;AAC1B,EAAA;;AAEA;AACJ;AACA;AACI,EAAA,OAAOgB,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC1BC,IAAAA,GAAG,EAAEC,UAAU;AACfC,IAAAA,GAAG,EAAEC,UAAU;AACfC,IAAAA,IAAI,EAAEC;AACV,GAAC,CAAC;EACF,OAAOC,gBAAgB,GAAG,UAAU;EACpC,OAAOC,EAAE,GAAG,MAAM;EAClB,OAAOC,UAAU,GAAGV,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;AAC9C,EAAA,OAAOU,OAAO,GAAGrC,SAAS,CAACsC,aAAa,CAAC;AACrCC,IAAAA,QAAQ,EAAE;AAAEC,MAAAA,IAAI,EAAE,OAAO;AAAEC,MAAAA,MAAM,EAAE,CAAE,UAAU,EAAE,KAAK;KAAI;AAC1DC,IAAAA,GAAG,EAAE;AAAEF,MAAAA,IAAI,EAAE,OAAO;AAAEG,MAAAA,OAAO,EAAE,IAAI;AAAEC,MAAAA,WAAW,EAAE;AAAK;AAC3D,GAAC,CAAC;EACF,OAAOC,UAAU,GAAGnB,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,CAAE,CAAC;AAClD;;;;"}
|
|
@@ -56,7 +56,7 @@ function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
|
|
|
56
56
|
* Reports whether input is supported under normalized format options for the
|
|
57
57
|
* FLAC format reader.
|
|
58
58
|
*/
|
|
59
|
-
function
|
|
59
|
+
function probeSupportWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
|
|
60
60
|
try {
|
|
61
61
|
const metadata = inspectWithValues(input, values, expectedType);
|
|
62
62
|
return {
|
|
@@ -64,7 +64,7 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = ""
|
|
|
64
64
|
source: values.source || "buffer",
|
|
65
65
|
supported: "partial",
|
|
66
66
|
confidence: 1,
|
|
67
|
-
|
|
67
|
+
preferredOutput: "raw",
|
|
68
68
|
reason: "FLAC metadata and raw source are recognized; PCM decoding remains a backend/decoder task.",
|
|
69
69
|
metadata,
|
|
70
70
|
variants: [{
|
|
@@ -72,10 +72,7 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = ""
|
|
|
72
72
|
payloadType: "raw",
|
|
73
73
|
codec: "flac",
|
|
74
74
|
mimeType: "audio/flac",
|
|
75
|
-
supported: true
|
|
76
|
-
containerOnly: true,
|
|
77
|
-
isDecoded: false,
|
|
78
|
-
pcmDecodeSupported: false
|
|
75
|
+
supported: true
|
|
79
76
|
}, {
|
|
80
77
|
kind: "pcm",
|
|
81
78
|
payloadType: "pcm",
|
|
@@ -92,7 +89,7 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = ""
|
|
|
92
89
|
source: values.source || "buffer",
|
|
93
90
|
supported: "none",
|
|
94
91
|
confidence: 0,
|
|
95
|
-
|
|
92
|
+
preferredOutput: "",
|
|
96
93
|
reason: error.message,
|
|
97
94
|
metadata: null,
|
|
98
95
|
variants: [],
|
|
@@ -118,9 +115,6 @@ function readWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
|
|
|
118
115
|
payloadType: OUTPUT_RAW,
|
|
119
116
|
sourceFormat: "flac",
|
|
120
117
|
mimeType: "audio/flac",
|
|
121
|
-
containerOnly: true,
|
|
122
|
-
isDecoded: false,
|
|
123
|
-
pcmDecodeSupported: false,
|
|
124
118
|
metadata,
|
|
125
119
|
bytes
|
|
126
120
|
};
|
|
@@ -311,5 +305,5 @@ function readU64BE(bytes, offset) {
|
|
|
311
305
|
return high > 0x1fffff ? null : high * 0x100000000 + low;
|
|
312
306
|
}
|
|
313
307
|
|
|
314
|
-
export { DEFAULT_VALUES, OUTPUT_JSON, OUTPUT_PCM, OUTPUT_RAW, inspectWithValues, isFLAC,
|
|
308
|
+
export { DEFAULT_VALUES, OUTPUT_JSON, OUTPUT_PCM, OUTPUT_RAW, inspectWithValues, isFLAC, normalizeValues, probeSupportWithValues, readWithValues, toBytes, toJsonValue };
|
|
315
309
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":["../../../../../src/formats/flac/core/helpers.js"],"sourcesContent":["export const OUTPUT_RAW = \"raw\";\nexport const OUTPUT_PCM = \"pcm\";\nexport const OUTPUT_JSON = \"json\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_RAW,\n inputType: \"\",\n source: \"\"\n});\n\nconst DEBUG_OUTPUT = \"flacJson\";\n\n/**\n * Normalizes reader options against their supported defaults for the FLAC format\n * reader.\n */\nexport function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = \"CjsFlacFormat\")\n{\n const values = { ...DEFAULT_VALUES, ...(base || {}), ...(options || {}) };\n values.inputType = values.inputType ? String(values.inputType).replace(/^\\./u, \"\").toLowerCase() : \"\";\n if (![ OUTPUT_RAW, OUTPUT_PCM, OUTPUT_JSON, DEBUG_OUTPUT ].includes(values.emit))\n {\n throw new TypeError(`${readerName}: unknown emit value ${JSON.stringify(values.emit)}`);\n }\n return values;\n}\n\n/** Returns a byte view over the supplied binary input for the FLAC format reader. */\nexport function toBytes(input)\n{\n if (input instanceof Uint8Array) return input;\n if (input instanceof ArrayBuffer) return new Uint8Array(input);\n if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);\n throw new TypeError(\"FLAC input must be Uint8Array, ArrayBuffer, or DataView\");\n}\n\n/** Reports whether the current FLAC format reader satisfies FLAC. */\nexport function isFLAC(bytes)\n{\n return bytes.byteLength >= 4 && bytes[0] === 0x66 && bytes[1] === 0x4c && bytes[2] === 0x61 && bytes[3] === 0x43;\n}\n\n/** Inspects input using normalized format options for the FLAC format reader. */\nexport function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = toBytes(input);\n if (!isFLAC(bytes)) throw new TypeError(\"CjsFlacFormat: input is not a FLAC stream\");\n const sourceFormat = expectedType || values.inputType || \"flac\";\n if (sourceFormat !== \"flac\") throw new TypeError(`CjsFlacFormat: expected ${sourceFormat}, got flac`);\n return { payloadType: \"audio\", mediaTypes: [ \"audio\" ], byteLength: bytes.byteLength, ...inspectBytes(bytes) };\n}\n\n/**\n * Reports whether input is supported under normalized format options for the\n * FLAC format reader.\n */\nexport function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n try\n {\n const metadata = inspectWithValues(input, values, expectedType);\n return {\n format: \"flac\",\n source: values.source || \"buffer\",\n supported: \"partial\",\n confidence: 1,\n preferred: \"flac\",\n reason: \"FLAC metadata and raw source are recognized; PCM decoding remains a backend/decoder task.\",\n metadata,\n variants: [\n {\n kind: \"raw\",\n payloadType: \"raw\",\n codec: \"flac\",\n mimeType: \"audio/flac\",\n supported: true,\n containerOnly: true,\n isDecoded: false,\n pcmDecodeSupported: false\n },\n { kind: \"pcm\", payloadType: \"pcm\", codec: \"pcm\", supported: false, reason: \"FLAC PCM decode/output is not implemented in this package.\" }\n ],\n warnings: [],\n errors: []\n };\n }\n catch (error)\n {\n return {\n format: expectedType || values.inputType || \"flac\",\n source: values.source || \"buffer\",\n supported: \"none\",\n confidence: 0,\n preferred: \"\",\n reason: error.message,\n metadata: null,\n variants: [],\n warnings: [],\n errors: [ error.message ]\n };\n }\n}\n\n/** Reads input using normalized format options for the FLAC format reader. */\nexport function readWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = toBytes(input);\n const metadata = inspectWithValues(bytes, values, expectedType);\n if (values.emit === OUTPUT_JSON || values.emit === DEBUG_OUTPUT) return metadata;\n if (values.emit === OUTPUT_PCM)\n {\n const error = new Error(\"flac: PCM decode/output is not implemented in this package\");\n error.code = \"CJS_FORMAT_OUTPUT_NOT_IMPLEMENTED\";\n error.sourceFormat = \"flac\";\n error.emit = values.emit;\n throw error;\n }\n return {\n payloadType: OUTPUT_RAW,\n sourceFormat: \"flac\",\n mimeType: \"audio/flac\",\n containerOnly: true,\n isDecoded: false,\n pcmDecodeSupported: false,\n metadata,\n bytes\n };\n}\n\n/** Converts a parsed payload into a JSON-safe value for the FLAC format reader. */\nexport function toJsonValue(value)\n{\n if (value instanceof Uint8Array) return { byteLength: value.byteLength };\n if (Array.isArray(value)) return value.map(toJsonValue);\n if (value && typeof value === \"object\")\n {\n const output = {};\n for (const [ key, entry ] of Object.entries(value)) output[key] = toJsonValue(entry);\n return output;\n }\n return value;\n}\n\nfunction inspectBytes(bytes)\n{\n const blocks = [];\n let offset = 4;\n let streamInfo = null;\n let comments = null;\n let seekTable = [];\n const pictures = [];\n let hasLastMetadataBlock = false;\n while (offset + 4 <= bytes.byteLength)\n {\n const header = bytes[offset];\n const type = header & 0x7f;\n const isLast = !!(header & 0x80);\n const length = readU24BE(bytes, offset + 1);\n const dataStart = offset + 4;\n const end = dataStart + length;\n if (end > bytes.byteLength) throw new Error(`FLAC metadata block ${type} is truncated`);\n const block = { type, isLast, offset, byteLength: length };\n if (type === 0)\n {\n if (length < 34) throw new Error(\"FLAC STREAMINFO block is truncated\");\n streamInfo = readStreamInfo(bytes, dataStart);\n Object.assign(block, streamInfo);\n }\n else if (type === 4)\n {\n comments = readVorbisComment(bytes, dataStart, end);\n Object.assign(block, { vendor: comments.vendor, comments: comments.comments });\n }\n else if (type === 3)\n {\n seekTable = readSeekTable(bytes, dataStart, length);\n block.points = seekTable;\n }\n else if (type === 6)\n {\n const picture = readPicture(bytes, dataStart, end);\n pictures.push(picture);\n Object.assign(block, picture);\n }\n blocks.push(block);\n offset = end;\n if (isLast)\n {\n hasLastMetadataBlock = true;\n break;\n }\n }\n if (!streamInfo) throw new Error(\"FLAC stream has no STREAMINFO block\");\n return {\n sourceFormat: \"flac\",\n container: \"flac\",\n audioFormat: \"flac\",\n sampleRate: streamInfo.sampleRate,\n channels: streamInfo.channels,\n bitsPerSample: streamInfo.bitsPerSample,\n totalSamples: streamInfo.totalSamples,\n durationSamples: streamInfo.totalSamples,\n durationSeconds: streamInfo.sampleRate ? streamInfo.totalSamples / streamInfo.sampleRate : 0,\n streamInfo,\n comments,\n seekTable,\n pictures,\n metadataBlockCount: blocks.length,\n hasLastMetadataBlock,\n audioDataOffset: offset,\n audioDataBytes: Math.max(0, bytes.byteLength - offset),\n metadataBlocks: blocks\n };\n}\n\nfunction readStreamInfo(bytes, offset)\n{\n const sampleRate = bytes[offset + 10] * 4096 + bytes[offset + 11] * 16 + (bytes[offset + 12] >> 4);\n const channels = ((bytes[offset + 12] >> 1) & 0x07) + 1;\n const bitsPerSample = (((bytes[offset + 12] & 1) << 4) | (bytes[offset + 13] >> 4)) + 1;\n const totalSamples = (bytes[offset + 13] & 0x0f) * 0x100000000 + readU32BE(bytes, offset + 14);\n return {\n minBlockSize: readU16BE(bytes, offset),\n maxBlockSize: readU16BE(bytes, offset + 2),\n minFrameSize: readU24BE(bytes, offset + 4),\n maxFrameSize: readU24BE(bytes, offset + 7),\n sampleRate,\n channels,\n bitsPerSample,\n totalSamples,\n md5: Array.from(bytes.subarray(offset + 18, offset + 34), (value) => value.toString(16).padStart(2, \"0\")).join(\"\")\n };\n}\n\nfunction readVorbisComment(bytes, start, end)\n{\n let offset = start;\n if (offset + 8 > end) throw new Error(\"FLAC Vorbis comment block is truncated\");\n const vendorLength = readU32LE(bytes, offset);\n offset += 4;\n if (offset + vendorLength + 4 > end) throw new Error(\"FLAC Vorbis vendor string is truncated\");\n const vendor = new TextDecoder().decode(bytes.subarray(offset, offset + vendorLength));\n offset += vendorLength;\n const count = readU32LE(bytes, offset);\n offset += 4;\n const result = [];\n for (let index = 0; index < count; index++)\n {\n if (offset + 4 > end) throw new Error(\"FLAC Vorbis comment list is truncated\");\n const length = readU32LE(bytes, offset);\n offset += 4;\n if (offset + length > end) throw new Error(\"FLAC Vorbis comment is truncated\");\n result.push(new TextDecoder().decode(bytes.subarray(offset, offset + length)));\n offset += length;\n }\n return { vendor, comments: result };\n}\n\nfunction readSeekTable(bytes, start, length)\n{\n if (length % 18 !== 0) throw new Error(\"FLAC SEEKTABLE block has an invalid length\");\n const points = [];\n for (let offset = start; offset < start + length; offset += 18)\n {\n points.push({\n sampleNumber: readU64BE(bytes, offset),\n offset: readU64BE(bytes, offset + 8),\n numberSamples: readU16BE(bytes, offset + 16)\n });\n }\n return points;\n}\n\nfunction readPicture(bytes, start, end)\n{\n let offset = start;\n if (offset + 4 > end) throw new Error(\"FLAC picture block is truncated\");\n const pictureType = readU32BE(bytes, offset);\n offset += 4;\n const mimeLength = readU32BE(bytes, offset);\n offset += 4;\n if (offset + mimeLength + 4 > end) throw new Error(\"FLAC picture MIME type is truncated\");\n const mimeType = new TextDecoder().decode(bytes.subarray(offset, offset + mimeLength));\n offset += mimeLength;\n const descriptionLength = readU32BE(bytes, offset);\n offset += 4;\n if (offset + descriptionLength + 20 > end) throw new Error(\"FLAC picture description is truncated\");\n const description = new TextDecoder().decode(bytes.subarray(offset, offset + descriptionLength));\n offset += descriptionLength;\n const width = readU32BE(bytes, offset);\n const height = readU32BE(bytes, offset + 4);\n const colorDepth = readU32BE(bytes, offset + 8);\n const colors = readU32BE(bytes, offset + 12);\n const dataLength = readU32BE(bytes, offset + 16);\n if (offset + 20 + dataLength > end) throw new Error(\"FLAC picture data is truncated\");\n return { pictureType, mimeType, description, width, height, colorDepth, colors, dataByteLength: dataLength };\n}\n\nfunction readU16BE(bytes, offset) { return (bytes[offset] << 8) | bytes[offset + 1]; }\nfunction readU24BE(bytes, offset) { return bytes[offset] * 0x10000 + bytes[offset + 1] * 0x100 + bytes[offset + 2]; }\nfunction readU32BE(bytes, offset) { return bytes[offset] * 0x1000000 + bytes[offset + 1] * 0x10000 + bytes[offset + 2] * 0x100 + bytes[offset + 3]; }\nfunction readU32LE(bytes, offset) { return bytes[offset] + bytes[offset + 1] * 0x100 + bytes[offset + 2] * 0x10000 + bytes[offset + 3] * 0x1000000; }\nfunction readU64BE(bytes, offset)\n{\n const high = readU32BE(bytes, offset);\n const low = readU32BE(bytes, offset + 4);\n return high > 0x1fffff ? null : high * 0x100000000 + low;\n}\n"],"names":["OUTPUT_RAW","OUTPUT_PCM","OUTPUT_JSON","DEFAULT_VALUES","Object","freeze","emit","inputType","source","DEBUG_OUTPUT","normalizeValues","base","options","readerName","values","String","replace","toLowerCase","includes","TypeError","JSON","stringify","toBytes","input","Uint8Array","ArrayBuffer","isView","buffer","byteOffset","byteLength","isFLAC","bytes","inspectWithValues","expectedType","sourceFormat","payloadType","mediaTypes","inspectBytes","isSupportedWithValues","metadata","format","supported","confidence","preferred","reason","variants","kind","codec","mimeType","containerOnly","isDecoded","pcmDecodeSupported","warnings","errors","error","message","readWithValues","Error","code","toJsonValue","value","Array","isArray","map","output","key","entry","entries","blocks","offset","streamInfo","comments","seekTable","pictures","hasLastMetadataBlock","header","type","isLast","length","readU24BE","dataStart","end","block","readStreamInfo","assign","readVorbisComment","vendor","readSeekTable","points","picture","readPicture","push","container","audioFormat","sampleRate","channels","bitsPerSample","totalSamples","durationSamples","durationSeconds","metadataBlockCount","audioDataOffset","audioDataBytes","Math","max","metadataBlocks","readU32BE","minBlockSize","readU16BE","maxBlockSize","minFrameSize","maxFrameSize","md5","from","subarray","toString","padStart","join","start","vendorLength","readU32LE","TextDecoder","decode","count","result","index","sampleNumber","readU64BE","numberSamples","pictureType","mimeLength","descriptionLength","description","width","height","colorDepth","colors","dataLength","dataByteLength","high","low"],"mappings":"AAAO,MAAMA,UAAU,GAAG;AACnB,MAAMC,UAAU,GAAG;AACnB,MAAMC,WAAW,GAAG;MAEdC,cAAc,GAAGC,MAAM,CAACC,MAAM,CAAC;AACxCC,EAAAA,IAAI,EAAEN,UAAU;AAChBO,EAAAA,SAAS,EAAE,EAAE;AACbC,EAAAA,MAAM,EAAE;AACZ,CAAC;AAED,MAAMC,YAAY,GAAG,UAAU;;AAE/B;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAACC,IAAI,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AE;AACpJ,SAASmD,SAASA,CAACzF,KAAK,EAAEsC,MAAM,EAAE;AAAE,EAAA,OAAOtC,KAAK,CAACsC,MAAM,CAAC,GAAGtC,KAAK,CAACsC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,GAAGtC,KAAK,CAACsC,MAAM,GAAG,CAAC,CAAC,GAAG,OAAO,GAAGtC,KAAK,CAACsC,MAAM,GAAG,CAAC,CAAC,GAAG,SAAS;AAAE;AACpJ,SAAS0D,SAASA,CAAChG,KAAK,EAAEsC,MAAM,EAChC;AACI,EAAA,MAAMsE,IAAI,GAAGjC,SAAS,CAAC3E,KAAK,EAAEsC,MAAM,CAAC;EACrC,MAAMuE,GAAG,GAAGlC,SAAS,CAAC3E,KAAK,EAAEsC,MAAM,GAAG,CAAC,CAAC;EACxC,OAAOsE,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAGA,IAAI,GAAG,WAAW,GAAGC,GAAG;AAC5D;;;;"}
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../../../src/formats/flac/core/helpers.js"],"sourcesContent":["export const OUTPUT_RAW = \"raw\";\nexport const OUTPUT_PCM = \"pcm\";\nexport const OUTPUT_JSON = \"json\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_RAW,\n inputType: \"\",\n source: \"\"\n});\n\nconst DEBUG_OUTPUT = \"flacJson\";\n\n/**\n * Normalizes reader options against their supported defaults for the FLAC format\n * reader.\n */\nexport function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = \"CjsFlacFormat\")\n{\n const values = { ...DEFAULT_VALUES, ...(base || {}), ...(options || {}) };\n values.inputType = values.inputType ? String(values.inputType).replace(/^\\./u, \"\").toLowerCase() : \"\";\n if (![ OUTPUT_RAW, OUTPUT_PCM, OUTPUT_JSON, DEBUG_OUTPUT ].includes(values.emit))\n {\n throw new TypeError(`${readerName}: unknown emit value ${JSON.stringify(values.emit)}`);\n }\n return values;\n}\n\n/** Returns a byte view over the supplied binary input for the FLAC format reader. */\nexport function toBytes(input)\n{\n if (input instanceof Uint8Array) return input;\n if (input instanceof ArrayBuffer) return new Uint8Array(input);\n if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);\n throw new TypeError(\"FLAC input must be Uint8Array, ArrayBuffer, or DataView\");\n}\n\n/** Reports whether the current FLAC format reader satisfies FLAC. */\nexport function isFLAC(bytes)\n{\n return bytes.byteLength >= 4 && bytes[0] === 0x66 && bytes[1] === 0x4c && bytes[2] === 0x61 && bytes[3] === 0x43;\n}\n\n/** Inspects input using normalized format options for the FLAC format reader. */\nexport function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = toBytes(input);\n if (!isFLAC(bytes)) throw new TypeError(\"CjsFlacFormat: input is not a FLAC stream\");\n const sourceFormat = expectedType || values.inputType || \"flac\";\n if (sourceFormat !== \"flac\") throw new TypeError(`CjsFlacFormat: expected ${sourceFormat}, got flac`);\n return { payloadType: \"audio\", mediaTypes: [ \"audio\" ], byteLength: bytes.byteLength, ...inspectBytes(bytes) };\n}\n\n/**\n * Reports whether input is supported under normalized format options for the\n * FLAC format reader.\n */\nexport function probeSupportWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n try\n {\n const metadata = inspectWithValues(input, values, expectedType);\n return {\n format: \"flac\",\n source: values.source || \"buffer\",\n supported: \"partial\",\n confidence: 1,\n preferredOutput: \"raw\",\n reason: \"FLAC metadata and raw source are recognized; PCM decoding remains a backend/decoder task.\",\n metadata,\n variants: [\n {\n kind: \"raw\",\n payloadType: \"raw\",\n codec: \"flac\",\n mimeType: \"audio/flac\",\n supported: true,\n },\n { kind: \"pcm\", payloadType: \"pcm\", codec: \"pcm\", supported: false, reason: \"FLAC PCM decode/output is not implemented in this package.\" }\n ],\n warnings: [],\n errors: []\n };\n }\n catch (error)\n {\n return {\n format: expectedType || values.inputType || \"flac\",\n source: values.source || \"buffer\",\n supported: \"none\",\n confidence: 0,\n preferredOutput: \"\",\n reason: error.message,\n metadata: null,\n variants: [],\n warnings: [],\n errors: [ error.message ]\n };\n }\n}\n\n/** Reads input using normalized format options for the FLAC format reader. */\nexport function readWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = toBytes(input);\n const metadata = inspectWithValues(bytes, values, expectedType);\n if (values.emit === OUTPUT_JSON || values.emit === DEBUG_OUTPUT) return metadata;\n if (values.emit === OUTPUT_PCM)\n {\n const error = new Error(\"flac: PCM decode/output is not implemented in this package\");\n error.code = \"CJS_FORMAT_OUTPUT_NOT_IMPLEMENTED\";\n error.sourceFormat = \"flac\";\n error.emit = values.emit;\n throw error;\n }\n return {\n payloadType: OUTPUT_RAW,\n sourceFormat: \"flac\",\n mimeType: \"audio/flac\",\n metadata,\n bytes\n };\n}\n\n/** Converts a parsed payload into a JSON-safe value for the FLAC format reader. */\nexport function toJsonValue(value)\n{\n if (value instanceof Uint8Array) return { byteLength: value.byteLength };\n if (Array.isArray(value)) return value.map(toJsonValue);\n if (value && typeof value === \"object\")\n {\n const output = {};\n for (const [ key, entry ] of Object.entries(value)) output[key] = toJsonValue(entry);\n return output;\n }\n return value;\n}\n\nfunction inspectBytes(bytes)\n{\n const blocks = [];\n let offset = 4;\n let streamInfo = null;\n let comments = null;\n let seekTable = [];\n const pictures = [];\n let hasLastMetadataBlock = false;\n while (offset + 4 <= bytes.byteLength)\n {\n const header = bytes[offset];\n const type = header & 0x7f;\n const isLast = !!(header & 0x80);\n const length = readU24BE(bytes, offset + 1);\n const dataStart = offset + 4;\n const end = dataStart + length;\n if (end > bytes.byteLength) throw new Error(`FLAC metadata block ${type} is truncated`);\n const block = { type, isLast, offset, byteLength: length };\n if (type === 0)\n {\n if (length < 34) throw new Error(\"FLAC STREAMINFO block is truncated\");\n streamInfo = readStreamInfo(bytes, dataStart);\n Object.assign(block, streamInfo);\n }\n else if (type === 4)\n {\n comments = readVorbisComment(bytes, dataStart, end);\n Object.assign(block, { vendor: comments.vendor, comments: comments.comments });\n }\n else if (type === 3)\n {\n seekTable = readSeekTable(bytes, dataStart, length);\n block.points = seekTable;\n }\n else if (type === 6)\n {\n const picture = readPicture(bytes, dataStart, end);\n pictures.push(picture);\n Object.assign(block, picture);\n }\n blocks.push(block);\n offset = end;\n if (isLast)\n {\n hasLastMetadataBlock = true;\n break;\n }\n }\n if (!streamInfo) throw new Error(\"FLAC stream has no STREAMINFO block\");\n return {\n sourceFormat: \"flac\",\n container: \"flac\",\n audioFormat: \"flac\",\n sampleRate: streamInfo.sampleRate,\n channels: streamInfo.channels,\n bitsPerSample: streamInfo.bitsPerSample,\n totalSamples: streamInfo.totalSamples,\n durationSamples: streamInfo.totalSamples,\n durationSeconds: streamInfo.sampleRate ? streamInfo.totalSamples / streamInfo.sampleRate : 0,\n streamInfo,\n comments,\n seekTable,\n pictures,\n metadataBlockCount: blocks.length,\n hasLastMetadataBlock,\n audioDataOffset: offset,\n audioDataBytes: Math.max(0, bytes.byteLength - offset),\n metadataBlocks: blocks\n };\n}\n\nfunction readStreamInfo(bytes, offset)\n{\n const sampleRate = bytes[offset + 10] * 4096 + bytes[offset + 11] * 16 + (bytes[offset + 12] >> 4);\n const channels = ((bytes[offset + 12] >> 1) & 0x07) + 1;\n const bitsPerSample = (((bytes[offset + 12] & 1) << 4) | (bytes[offset + 13] >> 4)) + 1;\n const totalSamples = (bytes[offset + 13] & 0x0f) * 0x100000000 + readU32BE(bytes, offset + 14);\n return {\n minBlockSize: readU16BE(bytes, offset),\n maxBlockSize: readU16BE(bytes, offset + 2),\n minFrameSize: readU24BE(bytes, offset + 4),\n maxFrameSize: readU24BE(bytes, offset + 7),\n sampleRate,\n channels,\n bitsPerSample,\n totalSamples,\n md5: Array.from(bytes.subarray(offset + 18, offset + 34), (value) => value.toString(16).padStart(2, \"0\")).join(\"\")\n };\n}\n\nfunction readVorbisComment(bytes, start, end)\n{\n let offset = start;\n if (offset + 8 > end) throw new Error(\"FLAC Vorbis comment block is truncated\");\n const vendorLength = readU32LE(bytes, offset);\n offset += 4;\n if (offset + vendorLength + 4 > end) throw new Error(\"FLAC Vorbis vendor string is truncated\");\n const vendor = new TextDecoder().decode(bytes.subarray(offset, offset + vendorLength));\n offset += vendorLength;\n const count = readU32LE(bytes, offset);\n offset += 4;\n const result = [];\n for (let index = 0; index < count; index++)\n {\n if (offset + 4 > end) throw new Error(\"FLAC Vorbis comment list is truncated\");\n const length = readU32LE(bytes, offset);\n offset += 4;\n if (offset + length > end) throw new Error(\"FLAC Vorbis comment is truncated\");\n result.push(new TextDecoder().decode(bytes.subarray(offset, offset + length)));\n offset += length;\n }\n return { vendor, comments: result };\n}\n\nfunction readSeekTable(bytes, start, length)\n{\n if (length % 18 !== 0) throw new Error(\"FLAC SEEKTABLE block has an invalid length\");\n const points = [];\n for (let offset = start; offset < start + length; offset += 18)\n {\n points.push({\n sampleNumber: readU64BE(bytes, offset),\n offset: readU64BE(bytes, offset + 8),\n numberSamples: readU16BE(bytes, offset + 16)\n });\n }\n return points;\n}\n\nfunction readPicture(bytes, start, end)\n{\n let offset = start;\n if (offset + 4 > end) throw new Error(\"FLAC picture block is truncated\");\n const pictureType = readU32BE(bytes, offset);\n offset += 4;\n const mimeLength = readU32BE(bytes, offset);\n offset += 4;\n if (offset + mimeLength + 4 > end) throw new Error(\"FLAC picture MIME type is truncated\");\n const mimeType = new TextDecoder().decode(bytes.subarray(offset, offset + mimeLength));\n offset += mimeLength;\n const descriptionLength = readU32BE(bytes, offset);\n offset += 4;\n if (offset + descriptionLength + 20 > end) throw new Error(\"FLAC picture description is truncated\");\n const description = new TextDecoder().decode(bytes.subarray(offset, offset + descriptionLength));\n offset += descriptionLength;\n const width = readU32BE(bytes, offset);\n const height = readU32BE(bytes, offset + 4);\n const colorDepth = readU32BE(bytes, offset + 8);\n const colors = readU32BE(bytes, offset + 12);\n const dataLength = readU32BE(bytes, offset + 16);\n if (offset + 20 + dataLength > end) throw new Error(\"FLAC picture data is truncated\");\n return { pictureType, mimeType, description, width, height, colorDepth, colors, dataByteLength: dataLength };\n}\n\nfunction readU16BE(bytes, offset) { return (bytes[offset] << 8) | bytes[offset + 1]; }\nfunction readU24BE(bytes, offset) { return bytes[offset] * 0x10000 + bytes[offset + 1] * 0x100 + bytes[offset + 2]; }\nfunction readU32BE(bytes, offset) { return bytes[offset] * 0x1000000 + bytes[offset + 1] * 0x10000 + bytes[offset + 2] * 0x100 + bytes[offset + 3]; }\nfunction readU32LE(bytes, offset) { return bytes[offset] + bytes[offset + 1] * 0x100 + bytes[offset + 2] * 0x10000 + bytes[offset + 3] * 0x1000000; }\nfunction readU64BE(bytes, offset)\n{\n const high = readU32BE(bytes, offset);\n const low = readU32BE(bytes, offset + 4);\n return high > 0x1fffff ? null : high * 0x100000000 + low;\n}\n"],"names":["OUTPUT_RAW","OUTPUT_PCM","OUTPUT_JSON","DEFAULT_VALUES","Object","freeze","emit","inputType","source","DEBUG_OUTPUT","normalizeValues","base","options","readerName","values","String","replace","toLowerCase","includes","TypeError","JSON","stringify","toBytes","input","Uint8Array","ArrayBuffer","isView","buffer","byteOffset","byteLength","isFLAC","bytes","inspectWithValues","expectedType","sourceFormat","payloadType","mediaTypes","inspectBytes","probeSupportWithValues","metadata","format","supported","confidence","preferredOutput","reason","variants","kind","codec","mimeType","warnings","errors","error","message","readWithValues","Error","code","toJsonValue","value","Array","isArray","map","output","key","entry","entries","blocks","offset","streamInfo","comments","seekTable","pictures","hasLastMetadataBlock","header","type","isLast","length","readU24BE","dataStart","end","block","readStreamInfo","assign","readVorbisComment","vendor","readSeekTable","points","picture","readPicture","push","container","audioFormat","sampleRate","channels","bitsPerSample","totalSamples","durationSamples","durationSeconds","metadataBlockCount","audioDataOffset","audioDataBytes","Math","max","metadataBlocks","readU32BE","minBlockSize","readU16BE","maxBlockSize","minFrameSize","maxFrameSize","md5","from","subarray","toString","padStart","join","start","vendorLength","readU32LE","TextDecoder","decode","count","result","index","sampleNumber","readU64BE","numberSamples","pictureType","mimeLength","descriptionLength","description","width","height","colorDepth","colors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AAC,CAAC,GAAG,OAAO,GAAGnC,KAAK,CAACmC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,GAAGnC,KAAK,CAACmC,MAAM,GAAG,CAAC,CAAC;AAAE;AACpJ,SAASmD,SAASA,CAACtF,KAAK,EAAEmC,MAAM,EAAE;AAAE,EAAA,OAAOnC,KAAK,CAACmC,MAAM,CAAC,GAAGnC,KAAK,CAACmC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,GAAGnC,KAAK,CAACmC,MAAM,GAAG,CAAC,CAAC,GAAG,OAAO,GAAGnC,KAAK,CAACmC,MAAM,GAAG,CAAC,CAAC,GAAG,SAAS;AAAE;AACpJ,SAAS0D,SAASA,CAAC7F,KAAK,EAAEmC,MAAM,EAChC;AACI,EAAA,MAAMsE,IAAI,GAAGjC,SAAS,CAACxE,KAAK,EAAEmC,MAAM,CAAC;EACrC,MAAMuE,GAAG,GAAGlC,SAAS,CAACxE,KAAK,EAAEmC,MAAM,GAAG,CAAC,CAAC;EACxC,OAAOsE,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAGA,IAAI,GAAG,WAAW,GAAGC,GAAG;AAC5D;;;;"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { CjsFormat } from '../../../format/CjsFormat.js';
|
|
2
|
+
|
|
3
|
+
const VARIANT = "fsd32";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Reserved legacy FSD reader boundary.
|
|
7
|
+
*
|
|
8
|
+
* Legacy FSD has no self-describing outer header, so callers identify it with
|
|
9
|
+
* `bitWidth: 32` (or `variant: "fsd32"`) after the normal extension route has
|
|
10
|
+
* selected FSD. Reading is deliberately unsupported until a schema-driven
|
|
11
|
+
* implementation lands in this directory.
|
|
12
|
+
*/
|
|
13
|
+
class CjsFsd32Format extends CjsFormat {
|
|
14
|
+
static is(_input, options = {}) {
|
|
15
|
+
return options.bitWidth === 32 || options.variant === VARIANT || options.variant === "32";
|
|
16
|
+
}
|
|
17
|
+
static probeSupport(input, options = {}) {
|
|
18
|
+
const identified = this.is(input, options);
|
|
19
|
+
return {
|
|
20
|
+
format: VARIANT,
|
|
21
|
+
source: typeof input === "string" ? "path" : "buffer",
|
|
22
|
+
recognized: identified,
|
|
23
|
+
supported: false,
|
|
24
|
+
reason: identified ? "Legacy 32-bit FSD was identified by the caller, but its reader is not implemented." : "Legacy FSD has no outer header and was not identified by the caller.",
|
|
25
|
+
metadata: {
|
|
26
|
+
family: "fsd",
|
|
27
|
+
variant: identified ? VARIANT : null,
|
|
28
|
+
bitWidth: identified ? 32 : null,
|
|
29
|
+
decodable: false,
|
|
30
|
+
identifiedBy: identified ? "caller" : null
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
static inspect(input, options = {}) {
|
|
35
|
+
return this.probeSupport(input, options).metadata;
|
|
36
|
+
}
|
|
37
|
+
static read(_input, options = {}) {
|
|
38
|
+
const error = new Error("Legacy 32-bit FSD is identified but not readable. " + "Its future schema-driven reader belongs in formats/fsd/32.");
|
|
39
|
+
error.code = "CJS_FSD_32_UNSUPPORTED";
|
|
40
|
+
error.variant = VARIANT;
|
|
41
|
+
error.bitWidth = 32;
|
|
42
|
+
error.path = options.path ?? null;
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
static readJSON(input, options = {}) {
|
|
46
|
+
return this.read(input, options);
|
|
47
|
+
}
|
|
48
|
+
static id = VARIANT;
|
|
49
|
+
static extensions = Object.freeze([".fsdbinary"]);
|
|
50
|
+
static mediaTypes = Object.freeze(["data"]);
|
|
51
|
+
static outputs = Object.freeze({});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { CjsFsd32Format, CjsFsd32Format as default };
|
|
55
|
+
//# sourceMappingURL=CjsFsd32Format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CjsFsd32Format.js","sources":["../../../../../src/formats/fsd/32/CjsFsd32Format.js"],"sourcesContent":["import { CjsFormat } from \"../../../format/CjsFormat.js\";\nconst VARIANT = \"fsd32\";\n\n/**\n * Reserved legacy FSD reader boundary.\n *\n * Legacy FSD has no self-describing outer header, so callers identify it with\n * `bitWidth: 32` (or `variant: \"fsd32\"`) after the normal extension route has\n * selected FSD. Reading is deliberately unsupported until a schema-driven\n * implementation lands in this directory.\n */\nexport class CjsFsd32Format extends CjsFormat\n{\n static is(_input, options = {})\n {\n return options.bitWidth === 32\n || options.variant === VARIANT\n || options.variant === \"32\";\n }\n\n static probeSupport(input, options = {})\n {\n const identified = this.is(input, options);\n\n return {\n format: VARIANT,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: identified,\n supported: false,\n reason: identified\n ? \"Legacy 32-bit FSD was identified by the caller, but its reader is not implemented.\"\n : \"Legacy FSD has no outer header and was not identified by the caller.\",\n metadata: {\n family: \"fsd\",\n variant: identified ? VARIANT : null,\n bitWidth: identified ? 32 : null,\n decodable: false,\n identifiedBy: identified ? \"caller\" : null,\n },\n };\n }\n\n static inspect(input, options = {})\n {\n return this.probeSupport(input, options).metadata;\n }\n\n static read(_input, options = {})\n {\n const error = new Error(\n \"Legacy 32-bit FSD is identified but not readable. \"\n + \"Its future schema-driven reader belongs in formats/fsd/32.\"\n );\n\n error.code = \"CJS_FSD_32_UNSUPPORTED\";\n error.variant = VARIANT;\n error.bitWidth = 32;\n error.path = options.path ?? null;\n throw error;\n }\n\n static readJSON(input, options = {})\n {\n return this.read(input, options);\n }\n\n static id = VARIANT;\n static extensions = Object.freeze([ \".fsdbinary\" ]);\n static mediaTypes = Object.freeze([ \"data\" ]);\n static outputs = Object.freeze({});\n}\n\nexport default CjsFsd32Format;\n"],"names":["VARIANT","CjsFsd32Format","CjsFormat","is","_input","options","bitWidth","variant","probeSupport","input","identified","format","source","recognized","supported","reason","metadata","family","decodable","identifiedBy","inspect","read","error","Error","code","path","readJSON","id","extensions","Object","freeze","mediaTypes","outputs"],"mappings":";;AACA,MAAMA,OAAO,GAAG,OAAO;;AAEvB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AEDD,KAAK,CAACE,IAAI,GAAG,wBAAwB;IACrCF,KAAK,CAACf,OAAO,GAAGP,OAAO;IACvBsB,KAAK,CAAChB,QAAQ,GAAG,EAAE;AACnBgB,IAAAA,KAAK,CAACG,IAAI,GAAGpB,OAAO,CAACoB,IAAI,IAAI,IAAI;AACjC,IAAA,MAAMH,KAAK;AACf,EAAA;EAEA,OAAOI,QAAQA,CAACjB,KAAK,EAAEJ,OAAO,GAAG,EAAE,EACnC;AACI,IAAA,OAAO,IAAI,CAACgB,IAAI,CAACZ,KAAK,EAAEJ,OAAO,CAAC;AACpC,EAAA;EAEA,OAAOsB,EAAE,GAAG3B,OAAO;EACnB,OAAO4B,UAAU,GAAGC,MAAM,CAACC,MAAM,CAAC,CAAE,YAAY,CAAE,CAAC;EACnD,OAAOC,UAAU,GAAGF,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;EAC7C,OAAOE,OAAO,GAAGH,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;AACtC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { CjsFormat } from '../../../format/CjsFormat.js';
|
|
2
|
+
import { CjsFsd64Binary } from './core/CjsFsd64Binary.js';
|
|
3
|
+
|
|
4
|
+
const VARIANT = "cfsd64";
|
|
5
|
+
const OUTPUT_JSON = "json";
|
|
6
|
+
const OUTPUT_PAYLOAD = "payload";
|
|
7
|
+
|
|
8
|
+
/** Identifies and dispatches modern 64-bit cFSD containers. */
|
|
9
|
+
class CjsFsd64Format extends CjsFormat {
|
|
10
|
+
static describe(input, options = {}) {
|
|
11
|
+
const binary = new CjsFsd64Binary(input, {
|
|
12
|
+
path: options.path
|
|
13
|
+
});
|
|
14
|
+
return Object.freeze({
|
|
15
|
+
family: "fsd",
|
|
16
|
+
variant: VARIANT,
|
|
17
|
+
bitWidth: 64,
|
|
18
|
+
headerSize: binary.RootOffset,
|
|
19
|
+
byteLength: binary.ByteLength,
|
|
20
|
+
payloadLength: binary.PayloadLength,
|
|
21
|
+
layoutID: binary.LayoutID,
|
|
22
|
+
schemaID: binary.SchemaID,
|
|
23
|
+
decodable: true
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
static is(input) {
|
|
27
|
+
try {
|
|
28
|
+
this.describe(input);
|
|
29
|
+
return true;
|
|
30
|
+
} catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
static probeSupport(input, options = {}) {
|
|
35
|
+
try {
|
|
36
|
+
const metadata = this.describe(input, options);
|
|
37
|
+
const reader = options.reader ?? options.registry;
|
|
38
|
+
const canReadPayload = typeof reader?.Read === "function";
|
|
39
|
+
const canReadJson = typeof reader?.ReadJSON === "function";
|
|
40
|
+
return {
|
|
41
|
+
format: VARIANT,
|
|
42
|
+
source: typeof input === "string" ? "path" : "buffer",
|
|
43
|
+
recognized: true,
|
|
44
|
+
supported: canReadPayload || canReadJson,
|
|
45
|
+
preferredOutput: canReadPayload ? OUTPUT_PAYLOAD : canReadJson ? OUTPUT_JSON : "",
|
|
46
|
+
reason: canReadPayload || canReadJson ? "Recognized modern 64-bit cFSD and found a reader for the dataset layout." : "Recognized modern 64-bit cFSD; decoding requires options.reader or options.registry.",
|
|
47
|
+
variants: [{
|
|
48
|
+
kind: OUTPUT_PAYLOAD,
|
|
49
|
+
supported: canReadPayload,
|
|
50
|
+
requires: canReadPayload ? [] : ["reader.Read"]
|
|
51
|
+
}, {
|
|
52
|
+
kind: OUTPUT_JSON,
|
|
53
|
+
supported: canReadJson,
|
|
54
|
+
requires: canReadJson ? [] : ["reader.ReadJSON"]
|
|
55
|
+
}],
|
|
56
|
+
metadata
|
|
57
|
+
};
|
|
58
|
+
} catch (error) {
|
|
59
|
+
return {
|
|
60
|
+
format: VARIANT,
|
|
61
|
+
source: typeof input === "string" ? "path" : "buffer",
|
|
62
|
+
recognized: false,
|
|
63
|
+
supported: false,
|
|
64
|
+
reason: error?.message ?? "The input is not a modern cFSD container.",
|
|
65
|
+
variants: [{
|
|
66
|
+
kind: OUTPUT_PAYLOAD,
|
|
67
|
+
supported: false
|
|
68
|
+
}, {
|
|
69
|
+
kind: OUTPUT_JSON,
|
|
70
|
+
supported: false
|
|
71
|
+
}],
|
|
72
|
+
metadata: {
|
|
73
|
+
family: "fsd",
|
|
74
|
+
variant: null,
|
|
75
|
+
bitWidth: null,
|
|
76
|
+
decodable: false
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
static inspect(input, options = {}) {
|
|
82
|
+
return this.describe(input, options);
|
|
83
|
+
}
|
|
84
|
+
static read(input, options = {}) {
|
|
85
|
+
// Validate the format before selecting a dataset layout so malformed
|
|
86
|
+
// modern bytes never surface as a misleading missing-reader failure.
|
|
87
|
+
this.describe(input, options);
|
|
88
|
+
const reader = options.reader ?? options.registry;
|
|
89
|
+
const method = options.emit === OUTPUT_JSON ? "ReadJSON" : "Read";
|
|
90
|
+
if (!reader || typeof reader[method] !== "function") {
|
|
91
|
+
const error = new TypeError(`Modern cFSD ${method} requires options.reader or options.registry exposing ${method}().`);
|
|
92
|
+
error.code = "CJS_FSD_READER_REQUIRED";
|
|
93
|
+
error.method = method;
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
return reader[method](input, options);
|
|
97
|
+
}
|
|
98
|
+
static readJSON(input, options = {}) {
|
|
99
|
+
return this.read(input, {
|
|
100
|
+
...options,
|
|
101
|
+
emit: OUTPUT_JSON
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
static id = VARIANT;
|
|
105
|
+
static extensions = Object.freeze([".fsdbinary"]);
|
|
106
|
+
static mediaTypes = Object.freeze(["data"]);
|
|
107
|
+
static outputs = CjsFormat.defineOutputs({
|
|
108
|
+
payload: {
|
|
109
|
+
default: true,
|
|
110
|
+
decoded: true
|
|
111
|
+
},
|
|
112
|
+
json: {
|
|
113
|
+
decoded: true
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { CjsFsd64Format, CjsFsd64Format as default };
|
|
119
|
+
//# sourceMappingURL=CjsFsd64Format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CjsFsd64Format.js","sources":["../../../../../src/formats/fsd/64/CjsFsd64Format.js"],"sourcesContent":["import { CjsFormat } from \"../../../format/CjsFormat.js\";\nimport { CjsFsd64Binary } from \"./core/CjsFsd64Binary.js\";\n\nconst VARIANT = \"cfsd64\";\nconst OUTPUT_JSON = \"json\";\nconst OUTPUT_PAYLOAD = \"payload\";\n\n/** Identifies and dispatches modern 64-bit cFSD containers. */\nexport class CjsFsd64Format extends CjsFormat\n{\n static describe(input, options = {})\n {\n const binary = new CjsFsd64Binary(input, { path: options.path });\n\n return Object.freeze({\n family: \"fsd\",\n variant: VARIANT,\n bitWidth: 64,\n headerSize: binary.RootOffset,\n byteLength: binary.ByteLength,\n payloadLength: binary.PayloadLength,\n layoutID: binary.LayoutID,\n schemaID: binary.SchemaID,\n decodable: true,\n });\n }\n\n static is(input)\n {\n try\n {\n this.describe(input);\n return true;\n }\n catch\n {\n return false;\n }\n }\n\n static probeSupport(input, options = {})\n {\n try\n {\n const metadata = this.describe(input, options);\n const reader = options.reader ?? options.registry;\n const canReadPayload = typeof reader?.Read === \"function\";\n const canReadJson = typeof reader?.ReadJSON === \"function\";\n\n return {\n format: VARIANT,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: true,\n supported: canReadPayload || canReadJson,\n preferredOutput: canReadPayload ? OUTPUT_PAYLOAD : canReadJson ? OUTPUT_JSON : \"\",\n reason: canReadPayload || canReadJson\n ? \"Recognized modern 64-bit cFSD and found a reader for the dataset layout.\"\n : \"Recognized modern 64-bit cFSD; decoding requires options.reader or options.registry.\",\n variants: [\n { kind: OUTPUT_PAYLOAD, supported: canReadPayload, requires: canReadPayload ? [] : [ \"reader.Read\" ] },\n { kind: OUTPUT_JSON, supported: canReadJson, requires: canReadJson ? [] : [ \"reader.ReadJSON\" ] }\n ],\n metadata,\n };\n }\n catch (error)\n {\n return {\n format: VARIANT,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: false,\n supported: false,\n reason: error?.message ?? \"The input is not a modern cFSD container.\",\n variants: [\n { kind: OUTPUT_PAYLOAD, supported: false },\n { kind: OUTPUT_JSON, supported: false }\n ],\n metadata: {\n family: \"fsd\",\n variant: null,\n bitWidth: null,\n decodable: false,\n },\n };\n }\n }\n\n static inspect(input, options = {})\n {\n return this.describe(input, options);\n }\n\n static read(input, options = {})\n {\n // Validate the format before selecting a dataset layout so malformed\n // modern bytes never surface as a misleading missing-reader failure.\n this.describe(input, options);\n\n const reader = options.reader ?? options.registry;\n const method = options.emit === OUTPUT_JSON ? \"ReadJSON\" : \"Read\";\n\n if (!reader || typeof reader[method] !== \"function\")\n {\n const error = new TypeError(\n `Modern cFSD ${method} requires options.reader or options.registry exposing ${method}().`\n );\n\n error.code = \"CJS_FSD_READER_REQUIRED\";\n error.method = method;\n throw error;\n }\n\n return reader[method](input, options);\n }\n\n static readJSON(input, options = {})\n {\n return this.read(input, { ...options, emit: OUTPUT_JSON });\n }\n\n static id = VARIANT;\n static extensions = Object.freeze([ \".fsdbinary\" ]);\n static mediaTypes = Object.freeze([ \"data\" ]);\n static outputs = CjsFormat.defineOutputs({\n payload: { default: true, decoded: true },\n json: { decoded: true }\n });\n}\n\nexport default CjsFsd64Format;\n"],"names":["VARIANT","OUTPUT_JSON","OUTPUT_PAYLOAD","CjsFsd64Format","CjsFormat","describe","input","options","binary","CjsFsd64Binary","path","Object","freeze","family","variant","bitWidth","headerSize","RootOffset","byteLength","ByteLength","payloadLength","PayloadLength","layoutID","LayoutID","schemaID","SchemaID","decodable","is","probeSupport","metadata","reader","registry","canReadPayload","Read","canReadJson","ReadJSON","format","source","recognized","supported","preferredOutput","reason","variants","kind","requires","error","message","inspect","read","method","emit","TypeError","code","readJSON","id","extensions","mediaTypes","outputs","defineOutputs","payload","default","decoded","json"],"mappings":";;;AAGA,MAAMA,OAAO,GAAG,QAAQ;AACxB,MAAMC,WAAW,GAAG,MAAM;AAC1B,MAAMC,cAAc,GAAG,SAAS;;AAEhC;AACO,MAAMC,cAAc,SAASC,SAAS,CAC7C;EACI,OAAOC,QAAQA,CAACC,KAAK,EAAEC,OAAO,GAAG,EAAE,EACnC;AACI,IAAA,MAAMC,MAAM,GAAG,IAAIC,cAAc,CAACH,KAAK,EAAE;MAAEI,IAAI,EAAEH,OAAO,CAACG;AAAK,KAAC,CAAC;IAEhE,OAAOC,MAAM,CAACC,MAAM,CAAC;AACjBC,MAAAA,MAAM,EAAE,KAAK;AACbC,MAAAA,OAAO,EAAEd,OAAO;AAChBe,MAAAA,QAAQ,EAAE,EAAE;MACZC,UAAU,EAAER,MAAM,CAACS,UAAU;MAC7BC,UAAU,EAAEV,MAAM,CAACW,UAAU;MAC7BC,aAAa,EAAEZ,MAAM,CAACa,aAAa;MACnCC,QAAQ,EAAEd,MAAM,CAACe,QAAQ;MACzBC,QAAQ,EAAEhB,MAAM,CAACiB,QAAQ;AACzBC,MAAAA,SAAS,EAAE;AACf,KAAC,CAAC;AACN,EAAA;EAEA,OAAOC,EAAEA,CAACrB,KAAK,EACf;IACI,IACA;AACI,MAAA,IAAI,CAACD,QAAQ,CAACC,KAAK,CAAC;AACpB,MAAA,OAAO,IAAI;AACf,IAAA,CAAC,CACD,MACA;AACI,MAAA,OAAO,KAAK;AAChB,IAAA;AACJ,EAAA;EAEA,OAAOsB,YAAYA,CAACtB,KAAK,EAAEC,OAAO,GAAG,EAAE,EACvC;IACI,IACA;MACI,MAAMsB,QAAQ,GAAG,IAAI,CAACxB,QAAQ,CAACC,KAAK,EAAEC,OAAO,CAAC;MAC9C,MAAMuB,MAAM,GAAGvB,OAAO,CAACuB,MAAM,IAAIvB,OAAO,CA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