@carbonenginejs/runtime-resource 0.9.2 → 0.11.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 +3 -2
- package/README.md +47 -6
- package/dist/CjsMotherLode.js +88 -88
- package/dist/CjsMotherLode.js.map +1 -1
- package/dist/CjsResMan.js +717 -228
- package/dist/CjsResMan.js.map +1 -1
- package/dist/CjsResManFetchProvider.js +94 -0
- package/dist/CjsResManFetchProvider.js.map +1 -0
- package/dist/{CjsResManQueue.js → CjsResManWorkQueue.js} +112 -25
- package/dist/CjsResManWorkQueue.js.map +1 -0
- package/dist/format/CjsBlueReader.js +89 -0
- package/dist/format/CjsBlueReader.js.map +1 -1
- package/dist/format/CjsFormat.js +42 -16
- package/dist/format/CjsFormat.js.map +1 -1
- package/dist/format/CjsReader.js +4 -0
- package/dist/format/CjsReader.js.map +1 -1
- package/dist/format/CjsResourceProbe.js +2 -0
- package/dist/format/CjsResourceProbe.js.map +1 -1
- package/dist/format/effect/effectPermutationGraph.js +257 -0
- package/dist/format/effect/effectPermutationGraph.js.map +1 -0
- package/dist/format/effect/effectReflectionPackage.js +636 -0
- package/dist/format/effect/effectReflectionPackage.js.map +1 -0
- package/dist/format/effect/sha256.js +114 -0
- package/dist/format/effect/sha256.js.map +1 -0
- package/dist/format/payloadContract.js +20 -0
- package/dist/format/payloadContract.js.map +1 -1
- package/dist/formats/black/CjsBlackFormat.js +15 -1
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/black/core/CjsBlackBinaryReader.js +103 -0
- package/dist/formats/black/core/CjsBlackBinaryReader.js.map +1 -1
- package/dist/formats/black/core/CjsBlackPropertyReaders.js +61 -0
- package/dist/formats/black/core/CjsBlackPropertyReaders.js.map +1 -1
- package/dist/formats/black/core/CjsBlackReader.js +125 -0
- package/dist/formats/black/core/CjsBlackReader.js.map +1 -1
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js +103 -0
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js.map +1 -1
- package/dist/formats/black/core/helpers.js +17 -0
- package/dist/formats/black/core/helpers.js.map +1 -1
- package/dist/formats/bnk/CjsBnkFormat.js +8 -0
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/helpers.js +20 -0
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/musicNodes.js +40 -3
- package/dist/formats/bnk/core/musicNodes.js.map +1 -1
- package/dist/formats/bnk/core/soundbanksInfo.js +2 -0
- package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -1
- package/dist/formats/cmf/core/binary.js +71 -0
- package/dist/formats/cmf/core/binary.js.map +1 -1
- package/dist/formats/cmf/core/buffers.js +4 -0
- package/dist/formats/cmf/core/buffers.js.map +1 -1
- package/dist/formats/cmf/core/helpers.js +31 -0
- package/dist/formats/cmf/core/helpers.js.map +1 -1
- package/dist/formats/cmf/core/schema.js +10 -0
- package/dist/formats/cmf/core/schema.js.map +1 -1
- package/dist/formats/cmf/core/shared.js +9 -0
- package/dist/formats/cmf/core/shared.js.map +1 -1
- package/dist/formats/cmf/core/writer.js +54 -0
- package/dist/formats/cmf/core/writer.js.map +1 -1
- package/dist/formats/dds/core/bc6h.js +10 -0
- package/dist/formats/dds/core/bc6h.js.map +1 -1
- package/dist/formats/dds/core/bc7.js +16 -0
- package/dist/formats/dds/core/bc7.js.map +1 -1
- package/dist/formats/dds/core/helpers.js +47 -0
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/dxbc/CjsDxbcFormat.js +142 -0
- package/dist/formats/dxbc/CjsDxbcFormat.js.map +1 -0
- package/dist/formats/dxbc/core/DxbcReader.js +266 -0
- package/dist/formats/dxbc/core/DxbcReader.js.map +1 -0
- package/dist/formats/dxbc/core/container.js +169 -0
- package/dist/formats/dxbc/core/container.js.map +1 -0
- package/dist/formats/dxbc/core/decoder.js +789 -0
- package/dist/formats/dxbc/core/decoder.js.map +1 -0
- package/dist/formats/dxbc/core/errors.js +19 -0
- package/dist/formats/dxbc/core/errors.js.map +1 -0
- package/dist/formats/dxbc/core/helpers.js +220 -0
- package/dist/formats/dxbc/core/helpers.js.map +1 -0
- package/dist/formats/dxbc/core/opcodes.js +45 -0
- package/dist/formats/dxbc/core/opcodes.js.map +1 -0
- package/dist/formats/dxbc/core/program.js +91 -0
- package/dist/formats/dxbc/core/program.js.map +1 -0
- package/dist/formats/dxbc/core/signature.js +172 -0
- package/dist/formats/dxbc/core/signature.js.map +1 -0
- package/dist/formats/dxbc/index.js +2 -0
- package/dist/formats/dxbc/index.js.map +1 -0
- package/dist/formats/fbx/core/helpers.js +21 -0
- package/dist/formats/fbx/core/helpers.js.map +1 -1
- package/dist/formats/flac/CjsFlacFormat.js +49 -0
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/formats/flac/core/helpers.js +20 -0
- package/dist/formats/flac/core/helpers.js.map +1 -1
- package/dist/formats/gif/CjsGifFormat.js +49 -0
- package/dist/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/formats/gif/core/helpers.js +20 -0
- package/dist/formats/gif/core/helpers.js.map +1 -1
- package/dist/formats/gltf/core/helpers.js +15 -0
- package/dist/formats/gltf/core/helpers.js.map +1 -1
- package/dist/formats/gltf/core/parser.js +13 -0
- package/dist/formats/gltf/core/parser.js.map +1 -1
- package/dist/formats/gltf/core/targets.js +10 -0
- package/dist/formats/gltf/core/targets.js.map +1 -1
- package/dist/formats/gr2/core/bitknit2.js +2 -0
- package/dist/formats/gr2/core/bitknit2.js.map +1 -1
- package/dist/formats/gr2/core/helpers.js +20 -0
- package/dist/formats/gr2/core/helpers.js.map +1 -1
- package/dist/formats/gr2/core/targets.js +10 -0
- package/dist/formats/gr2/core/targets.js.map +1 -1
- package/dist/formats/hlsl/CjsHlslFormat.js +254 -0
- package/dist/formats/hlsl/CjsHlslFormat.js.map +1 -0
- package/dist/formats/hlsl/core/HlslBinaryUtils.js +15 -0
- package/dist/formats/hlsl/core/HlslBinaryUtils.js.map +1 -0
- package/dist/formats/hlsl/core/HlslEffectReadError.js +19 -0
- package/dist/formats/hlsl/core/HlslEffectReadError.js.map +1 -0
- package/dist/formats/hlsl/core/HlslEffectStateManager.js +130 -0
- package/dist/formats/hlsl/core/HlslEffectStateManager.js.map +1 -0
- package/dist/formats/hlsl/core/HlslReader.js +266 -0
- package/dist/formats/hlsl/core/HlslReader.js.map +1 -0
- package/dist/formats/hlsl/core/HlslRenderStateSetup.js +37 -0
- package/dist/formats/hlsl/core/HlslRenderStateSetup.js.map +1 -0
- package/dist/formats/hlsl/core/HlslResourceSetDescription.js +94 -0
- package/dist/formats/hlsl/core/HlslResourceSetDescription.js.map +1 -0
- package/dist/formats/hlsl/core/HlslShaderBytecode.js +44 -0
- package/dist/formats/hlsl/core/HlslShaderBytecode.js.map +1 -0
- package/dist/formats/hlsl/core/analysis.js +51 -0
- package/dist/formats/hlsl/core/analysis.js.map +1 -0
- package/dist/formats/hlsl/core/helpers.js +270 -0
- package/dist/formats/hlsl/core/helpers.js.map +1 -0
- package/dist/formats/hlsl/core/json.js +284 -0
- package/dist/formats/hlsl/core/json.js.map +1 -0
- package/dist/formats/hlsl/core/metadata.js +327 -0
- package/dist/formats/hlsl/core/metadata.js.map +1 -0
- package/dist/formats/hlsl/core/portableReflection.js +848 -0
- package/dist/formats/hlsl/core/portableReflection.js.map +1 -0
- package/dist/formats/hlsl/core/render-states.js +280 -0
- package/dist/formats/hlsl/core/render-states.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/HlslRenderContextEnum.js +43 -0
- package/dist/formats/hlsl/core/tr2/HlslRenderContextEnum.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +294 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslShaderPermutation.js +33 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslShaderPermutation.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js +416 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectConstant.js +40 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectConstant.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js +742 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectLibrary.js +52 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectLibrary.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectParameterAnnotation.js +38 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectParameterAnnotation.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectResource.js +50 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectResource.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js +86 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectTechnique.js +31 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectTechnique.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslPass.js +42 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslPass.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslSamplerDescription.js +55 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslSamplerDescription.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslSamplerSetup.js +29 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslSamplerSetup.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslShader.js +220 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslShader.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslShaderOption.js +30 -0
- package/dist/formats/hlsl/core/tr2/shader/HlslShaderOption.js.map +1 -0
- package/dist/formats/hlsl/index.js +2 -0
- package/dist/formats/hlsl/index.js.map +1 -0
- package/dist/formats/hlsl/portable.js +2 -0
- package/dist/formats/hlsl/portable.js.map +1 -0
- package/dist/formats/index.js +4 -0
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/jpeg/core/helpers.js +52 -0
- package/dist/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/formats/jpeg/core/jpeg.js +93 -0
- package/dist/formats/jpeg/core/jpeg.js.map +1 -1
- package/dist/formats/mp3/core/helpers.js +37 -0
- package/dist/formats/mp3/core/helpers.js.map +1 -1
- package/dist/formats/mp4/core/helpers.js +35 -0
- package/dist/formats/mp4/core/helpers.js.map +1 -1
- package/dist/formats/ogg/CjsOggFormat.js +49 -0
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/formats/ogg/core/helpers.js +23 -0
- package/dist/formats/ogg/core/helpers.js.map +1 -1
- package/dist/formats/ogg/core/vorbis.js +13 -0
- package/dist/formats/ogg/core/vorbis.js.map +1 -1
- package/dist/formats/png/core/helpers.js +52 -0
- package/dist/formats/png/core/helpers.js.map +1 -1
- package/dist/formats/red/CjsRedFormat.js +2 -0
- package/dist/formats/red/CjsRedFormat.js.map +1 -1
- package/dist/formats/red/core/CjsRedReader.js +52 -0
- package/dist/formats/red/core/CjsRedReader.js.map +1 -1
- package/dist/formats/red/core/helpers.js +19 -0
- package/dist/formats/red/core/helpers.js.map +1 -1
- package/dist/formats/stl/core/stl.js +8 -0
- package/dist/formats/stl/core/stl.js.map +1 -1
- package/dist/formats/stl/core/targets.js +10 -0
- package/dist/formats/stl/core/targets.js.map +1 -1
- package/dist/formats/tga/core/helpers.js +47 -0
- package/dist/formats/tga/core/helpers.js.map +1 -1
- package/dist/formats/wav/core/helpers.js +37 -0
- package/dist/formats/wav/core/helpers.js.map +1 -1
- package/dist/formats/webgl/CjsWebglFormat.js +221 -0
- package/dist/formats/webgl/CjsWebglFormat.js.map +1 -0
- package/dist/formats/webgl/core/cewg/CewgPackage.js +339 -0
- package/dist/formats/webgl/core/cewg/CewgPackage.js.map +1 -0
- package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js +104 -0
- package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js.map +1 -0
- package/dist/formats/webgl/core/cewg/binary.js +101 -0
- package/dist/formats/webgl/core/cewg/binary.js.map +1 -0
- package/dist/formats/webgl/core/cewgCompleteness.js +81 -0
- package/dist/formats/webgl/core/cewgCompleteness.js.map +1 -0
- package/dist/formats/webgl/core/effectPackage.js +789 -0
- package/dist/formats/webgl/core/effectPackage.js.map +1 -0
- package/dist/formats/webgl/core/effectPackageValidation.js +331 -0
- package/dist/formats/webgl/core/effectPackageValidation.js.map +1 -0
- package/dist/formats/webgl/core/errors.js +27 -0
- package/dist/formats/webgl/core/errors.js.map +1 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +2678 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslHelpers.js +89 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslHelpers.js.map +1 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +428 -0
- package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -0
- package/dist/formats/webgl/core/helpers.js +306 -0
- package/dist/formats/webgl/core/helpers.js.map +1 -0
- package/dist/formats/webgl/index.js +2 -0
- package/dist/formats/webgl/index.js.map +1 -0
- package/dist/formats/webgpu/CjsWebgpuFormat.js +376 -0
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js +415 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js +100 -0
- package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/binary.js +93 -0
- package/dist/formats/webgpu/core/cewgpu/binary.js.map +1 -0
- package/dist/formats/webgpu/core/cewgpu/tags.js +17 -0
- package/dist/formats/webgpu/core/cewgpu/tags.js.map +1 -0
- package/dist/formats/webgpu/core/effectAnalysis.js +82 -0
- package/dist/formats/webgpu/core/effectAnalysis.js.map +1 -0
- package/dist/formats/webgpu/core/effectBackendBodySet.js +305 -0
- package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -0
- package/dist/formats/webgpu/core/effectPackageValidation.js +1078 -0
- package/dist/formats/webgpu/core/effectPackageValidation.js.map +1 -0
- package/dist/formats/webgpu/core/errors.js +20 -0
- package/dist/formats/webgpu/core/errors.js.map +1 -0
- package/dist/formats/webgpu/core/helpers.js +448 -0
- package/dist/formats/webgpu/core/helpers.js.map +1 -0
- package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js +223 -0
- package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js.map +1 -0
- package/dist/formats/webgpu/core/ir/buildControlFlow.js +220 -0
- package/dist/formats/webgpu/core/ir/buildControlFlow.js.map +1 -0
- package/dist/formats/webgpu/core/ir/indexableTemps.js +137 -0
- package/dist/formats/webgpu/core/ir/indexableTemps.js.map +1 -0
- package/dist/formats/webgpu/core/ir/inferValueTypes.js +454 -0
- package/dist/formats/webgpu/core/ir/inferValueTypes.js.map +1 -0
- package/dist/formats/webgpu/core/ir/lowerDxbcToIr.js +494 -0
- package/dist/formats/webgpu/core/ir/lowerDxbcToIr.js.map +1 -0
- package/dist/formats/webgpu/core/ir/resolveRegisterFlow.js +177 -0
- package/dist/formats/webgpu/core/ir/resolveRegisterFlow.js.map +1 -0
- package/dist/formats/webgpu/core/ir/sourceLanes.js +61 -0
- package/dist/formats/webgpu/core/ir/sourceLanes.js.map +1 -0
- package/dist/formats/webgpu/core/packageEffect.js +300 -0
- package/dist/formats/webgpu/core/packageEffect.js.map +1 -0
- package/dist/formats/webgpu/core/packageEffectSelection.js +164 -0
- package/dist/formats/webgpu/core/packageEffectSelection.js.map +1 -0
- package/dist/formats/webgpu/core/packageMetadata.js +8 -0
- package/dist/formats/webgpu/core/packageMetadata.js.map +1 -0
- package/dist/formats/webgpu/core/schema.js +4 -0
- package/dist/formats/webgpu/core/schema.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +275 -0
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js +182 -0
- package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +324 -0
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/emitWgsl.js +356 -0
- package/dist/formats/webgpu/core/wgsl/emitWgsl.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/hoistEscapingValues.js +77 -0
- package/dist/formats/webgpu/core/wgsl/hoistEscapingValues.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerBindingLayout.js +451 -0
- package/dist/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js +754 -0
- package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js +457 -0
- package/dist/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerFragmentProgram.js +1572 -0
- package/dist/formats/webgpu/core/wgsl/lowerFragmentProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerMergeHistogramsComputeProgram.js +659 -0
- package/dist/formats/webgpu/core/wgsl/lowerMergeHistogramsComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerParticleClearComputePrograms.js +734 -0
- package/dist/formats/webgpu/core/wgsl/lowerParticleClearComputePrograms.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerParticleEmitComputeProgram.js +583 -0
- package/dist/formats/webgpu/core/wgsl/lowerParticleEmitComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerSkinVerticesComputeProgram.js +621 -0
- package/dist/formats/webgpu/core/wgsl/lowerSkinVerticesComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortComputeProgram.js +824 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortInnerComputeProgram.js +697 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortInnerComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortStepComputeProgram.js +559 -0
- package/dist/formats/webgpu/core/wgsl/lowerSortStepComputeProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/lowerVertexProgram.js +1328 -0
- package/dist/formats/webgpu/core/wgsl/lowerVertexProgram.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/particleEmitSemanticDigest.js +110 -0
- package/dist/formats/webgpu/core/wgsl/particleEmitSemanticDigest.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/precisionControls.js +55 -0
- package/dist/formats/webgpu/core/wgsl/precisionControls.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/selectionPlans.js +758 -0
- package/dist/formats/webgpu/core/wgsl/selectionPlans.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/uniformity.js +78 -0
- package/dist/formats/webgpu/core/wgsl/uniformity.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/validateExactComputeIr.js +196 -0
- package/dist/formats/webgpu/core/wgsl/validateExactComputeIr.js.map +1 -0
- package/dist/formats/webgpu/core/wgsl/validateHandleOperand.js +37 -0
- package/dist/formats/webgpu/core/wgsl/validateHandleOperand.js.map +1 -0
- package/dist/formats/webgpu/index.js +2 -0
- package/dist/formats/webgpu/index.js.map +1 -0
- package/dist/formats/webm/core/helpers.js +35 -0
- package/dist/formats/webm/core/helpers.js.map +1 -1
- package/dist/formats/webp/CjsWebpFormat.js +49 -0
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/formats/webp/core/helpers.js +23 -0
- package/dist/formats/webp/core/helpers.js.map +1 -1
- package/dist/formats/wem/CjsWemFormat.js +8 -0
- package/dist/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/formats/wem/core/bitStream.js +2 -0
- package/dist/formats/wem/core/bitStream.js.map +1 -1
- package/dist/formats/wem/core/helpers.js +20 -0
- package/dist/formats/wem/core/helpers.js.map +1 -1
- package/dist/formats/yaml/CjsYamlFormat.js +45 -0
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/formats/yaml/core/CjsYamlReader.js +91 -0
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
- package/dist/formats/yaml/core/helpers.js +10 -0
- package/dist/formats/yaml/core/helpers.js.map +1 -1
- package/dist/index.js +56 -43
- package/dist/index.js.map +1 -1
- package/dist/{CjsResource.js → resource/CjsResource.js} +232 -17
- package/dist/resource/CjsResource.js.map +1 -0
- package/dist/{resources → resource}/Tr2LightProfileRes.js +4 -3
- package/dist/resource/Tr2LightProfileRes.js.map +1 -0
- package/dist/{resources → resource/audio}/AudioGeometryResData.js +1 -1
- package/dist/resource/audio/AudioGeometryResData.js.map +1 -0
- package/dist/resource/audio/CjsAudioBufferRes.js +86 -0
- package/dist/resource/audio/CjsAudioBufferRes.js.map +1 -0
- package/dist/resource/audio/CjsAudioRes.js +213 -0
- package/dist/resource/audio/CjsAudioRes.js.map +1 -0
- package/dist/resource/audio/index.js +4 -0
- package/dist/resource/audio/index.js.map +1 -0
- package/dist/{resources → resource/geometry}/MeshDecalData.js +1 -1
- package/dist/resource/geometry/MeshDecalData.js.map +1 -0
- package/dist/{resources → resource/geometry}/MeshDecalLodData.js +1 -1
- package/dist/resource/geometry/MeshDecalLodData.js.map +1 -0
- package/dist/resource/geometry/TriGeometryRes.js +656 -0
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResAreaData.js +1 -1
- package/dist/resource/geometry/TriGeometryResAreaData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResJointData.js +1 -1
- package/dist/resource/geometry/TriGeometryResJointData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResLodData.js +1 -1
- package/dist/resource/geometry/TriGeometryResLodData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResMeshData.js +1 -1
- package/dist/resource/geometry/TriGeometryResMeshData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriGeometryResSkeletonData.js +1 -1
- package/dist/resource/geometry/TriGeometryResSkeletonData.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriJointBinding.js +1 -1
- package/dist/resource/geometry/TriJointBinding.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriMorphTargetGeometryConstants.js +1 -1
- package/dist/resource/geometry/TriMorphTargetGeometryConstants.js.map +1 -0
- package/dist/{resources → resource/geometry}/TriRtGeometryConstants.js +1 -1
- package/dist/resource/geometry/TriRtGeometryConstants.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/GStateBindingCallbackData.js +1 -1
- package/dist/resource/geometry/granny/GStateBindingCallbackData.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/Tr2GrannyIntersectionResult.js +1 -1
- package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/Tr2GrannyStateRes.js +6 -5
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/TriGrannyRes.js +6 -5
- package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -0
- package/dist/{resources → resource/geometry/granny}/enums.js +1 -9
- package/dist/resource/geometry/granny/enums.js.map +1 -0
- package/dist/resource/geometry/granny/index.js +6 -0
- package/dist/resource/geometry/granny/index.js.map +1 -0
- package/dist/resource/geometry/index.js +17 -0
- package/dist/resource/geometry/index.js.map +1 -0
- package/dist/resource/index.js +52 -0
- package/dist/resource/index.js.map +1 -0
- package/dist/resource/resourceBoundary.js +64 -0
- package/dist/resource/resourceBoundary.js.map +1 -0
- package/dist/resource/shader/Tr2EffectRes.js +429 -0
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -0
- package/dist/resource/shader/Tr2MaterialArea.js +34 -0
- package/dist/resource/shader/Tr2MaterialArea.js.map +1 -0
- package/dist/resource/shader/Tr2MaterialMesh.js +30 -0
- package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -0
- package/dist/resource/shader/Tr2MaterialRes.js +35 -0
- package/dist/resource/shader/Tr2MaterialRes.js.map +1 -0
- package/dist/resource/shader/Tr2Shader.js +256 -0
- package/dist/resource/shader/Tr2Shader.js.map +1 -0
- package/dist/resource/shader/Tr2ShaderPermutation.js +47 -0
- package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -0
- package/dist/resource/shader/index.js +17 -0
- package/dist/resource/shader/index.js.map +1 -0
- package/dist/resource/shader/portable.js +33 -0
- package/dist/resource/shader/portable.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectConstant.js +135 -0
- package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectDefine.js +28 -0
- package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +107 -0
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +145 -0
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +103 -0
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectResource.js +84 -0
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +239 -0
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +66 -0
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -0
- package/dist/resource/shader/reflection/Tr2Pass.js +109 -0
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -0
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +75 -0
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -0
- package/dist/{texture → resource/texture}/CjsTextureArrayRes.js +83 -6
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -0
- package/dist/{texture/CjsTextureParameterProxy.js → resource/texture/CjsTextureArrayResParameterProxy.js} +56 -10
- package/dist/resource/texture/CjsTextureArrayResParameterProxy.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2ImageRes.js +6 -4
- package/dist/resource/texture/Tr2ImageRes.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TextureLodManager.js +3 -1
- package/dist/resource/texture/Tr2TextureLodManager.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TextureLodUpdateRequest.js +1 -1
- package/dist/resource/texture/Tr2TextureLodUpdateRequest.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePackChannel.js +1 -1
- package/dist/resource/texture/Tr2TexturePackChannel.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipeline.js +6 -4
- package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineParams.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineParams.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepCompress.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepGenerateMips.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLimitSize.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLoad.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -0
- package/dist/{resources → resource/texture}/Tr2TexturePipelineStepPack.js +1 -1
- package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -0
- package/dist/{resources → resource/texture}/TriTextureRes.js +42 -26
- package/dist/resource/texture/TriTextureRes.js.map +1 -0
- package/dist/resource/texture/index.js +15 -0
- package/dist/resource/texture/index.js.map +1 -0
- package/dist/{resources → resource/texture}/texturePipelineBehavior.js +59 -59
- package/dist/resource/texture/texturePipelineBehavior.js.map +1 -0
- package/dist/worker/CjsResManMainThreadLoader.js +87 -0
- package/dist/worker/CjsResManMainThreadLoader.js.map +1 -0
- package/dist/worker/CjsResManWorker.js +217 -0
- package/dist/worker/CjsResManWorker.js.map +1 -0
- package/dist/worker/CjsResManWorkerLoader.js +434 -0
- package/dist/worker/CjsResManWorkerLoader.js.map +1 -0
- package/dist/worker/protocol.js +12 -0
- package/dist/worker/protocol.js.map +1 -0
- package/docs/README.md +16 -3
- package/docs/architecture.md +39 -16
- package/docs/concepts/resource-lifecycle.md +2 -1
- package/docs/formats/README.md +8 -0
- package/docs/formats/provenance.md +11 -3
- package/docs/reference/classes/README.md +6 -4
- package/docs/reference/classes/audio.md +30 -0
- package/docs/reference/classes/core.md +31 -11
- package/docs/reference/classes/formats.md +440 -0
- package/docs/reference/classes/resources.md +151 -41
- package/docs/reference/classes/texture.md +7 -7
- package/docs/reference/motherlode-cache.md +17 -0
- package/docs/reference/queues.md +9 -1
- package/docs/reference/workers.md +135 -0
- package/docs/roadmap.md +27 -1
- package/format-notices/dxbc/LICENSE +21 -0
- package/format-notices/dxbc/NOTICE +20 -0
- package/format-notices/hlsl/LICENSE +21 -0
- package/format-notices/hlsl/NOTICE +25 -0
- package/format-notices/webgl/LICENSE +21 -0
- package/format-notices/webgl/NOTICE +35 -0
- package/format-notices/webgpu/LICENSE +21 -0
- package/format-notices/webgpu/NOTICE +31 -0
- package/package.json +13 -1
- package/dist/CjsResManQueue.js.map +0 -1
- package/dist/CjsResource.js.map +0 -1
- package/dist/CjsResourceSource.js +0 -68
- package/dist/CjsResourceSource.js.map +0 -1
- package/dist/resourcePath.js +0 -18
- package/dist/resourcePath.js.map +0 -1
- package/dist/resourceStates.js +0 -9
- package/dist/resourceStates.js.map +0 -1
- package/dist/resources/AudioGeometryResData.js.map +0 -1
- package/dist/resources/GStateBindingCallbackData.js.map +0 -1
- package/dist/resources/MeshDecalData.js.map +0 -1
- package/dist/resources/MeshDecalLodData.js.map +0 -1
- package/dist/resources/Tr2EffectRes.js +0 -71
- package/dist/resources/Tr2EffectRes.js.map +0 -1
- package/dist/resources/Tr2GrannyIntersectionResult.js.map +0 -1
- package/dist/resources/Tr2GrannyStateRes.js.map +0 -1
- package/dist/resources/Tr2ImageRes.js.map +0 -1
- package/dist/resources/Tr2LightProfileRes.js.map +0 -1
- package/dist/resources/Tr2MaterialArea.js +0 -34
- package/dist/resources/Tr2MaterialArea.js.map +0 -1
- package/dist/resources/Tr2MaterialMesh.js +0 -31
- package/dist/resources/Tr2MaterialMesh.js.map +0 -1
- package/dist/resources/Tr2MaterialRes.js +0 -34
- package/dist/resources/Tr2MaterialRes.js.map +0 -1
- package/dist/resources/Tr2ShaderPermutation.js +0 -43
- package/dist/resources/Tr2ShaderPermutation.js.map +0 -1
- package/dist/resources/Tr2TextureLodManager.js.map +0 -1
- package/dist/resources/Tr2TextureLodUpdateRequest.js.map +0 -1
- package/dist/resources/Tr2TexturePackChannel.js.map +0 -1
- package/dist/resources/Tr2TexturePipeline.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineParams.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepCompress.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepGenerateMips.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepLimitSize.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepLoad.js.map +0 -1
- package/dist/resources/Tr2TexturePipelineStepPack.js.map +0 -1
- package/dist/resources/TriGeometryRes.js +0 -239
- package/dist/resources/TriGeometryRes.js.map +0 -1
- package/dist/resources/TriGeometryResAreaData.js.map +0 -1
- package/dist/resources/TriGeometryResJointData.js.map +0 -1
- package/dist/resources/TriGeometryResLodData.js.map +0 -1
- package/dist/resources/TriGeometryResMeshData.js.map +0 -1
- package/dist/resources/TriGeometryResSkeletonData.js.map +0 -1
- package/dist/resources/TriGrannyRes.js.map +0 -1
- package/dist/resources/TriJointBinding.js.map +0 -1
- package/dist/resources/TriMorphTargetGeometryConstants.js.map +0 -1
- package/dist/resources/TriRtGeometryConstants.js.map +0 -1
- package/dist/resources/TriTextureRes.js.map +0 -1
- package/dist/resources/enums.js.map +0 -1
- package/dist/resources/resourceBoundary.js +0 -47
- package/dist/resources/resourceBoundary.js.map +0 -1
- package/dist/resources/texturePipelineBehavior.js.map +0 -1
- package/dist/texture/CjsTextureArrayRes.js.map +0 -1
- package/dist/texture/CjsTextureParameterProxy.js.map +0 -1
|
@@ -9,9 +9,16 @@ const FORMAT_NAME = "CjsFlacFormat";
|
|
|
9
9
|
*/
|
|
10
10
|
class CjsFlacFormat {
|
|
11
11
|
#values = DEFAULT_VALUES;
|
|
12
|
+
|
|
13
|
+
/** Creates a CjsFlacFormat with caller-provided reader configuration. */
|
|
12
14
|
constructor(options = {}) {
|
|
13
15
|
this.SetValues(options);
|
|
14
16
|
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Applies caller-provided options after normalizing supported fields for the
|
|
20
|
+
* FLAC format configuration.
|
|
21
|
+
*/
|
|
15
22
|
SetValues(options = {}) {
|
|
16
23
|
this.#values = normalizeValues(this.#values, {
|
|
17
24
|
inputType: "flac",
|
|
@@ -19,51 +26,93 @@ class CjsFlacFormat {
|
|
|
19
26
|
}, FORMAT_NAME);
|
|
20
27
|
return this;
|
|
21
28
|
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Returns a snapshot of the normalized reader options for the FLAC format
|
|
32
|
+
* configuration.
|
|
33
|
+
*/
|
|
22
34
|
GetValues(options = {}) {
|
|
23
35
|
return normalizeValues(this.#values, {
|
|
24
36
|
inputType: "flac",
|
|
25
37
|
...options
|
|
26
38
|
}, FORMAT_NAME);
|
|
27
39
|
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Reads the primary public payload representation from the supplied input
|
|
43
|
+
* for the FLAC format configuration.
|
|
44
|
+
*/
|
|
28
45
|
Read(input, options = {}) {
|
|
29
46
|
return readWithValues(input, this.GetValues(options));
|
|
30
47
|
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Reads the primary public payload representation asynchronously for the
|
|
51
|
+
* FLAC format configuration.
|
|
52
|
+
*/
|
|
31
53
|
async ReadAsync(input, options = {}) {
|
|
32
54
|
return this.Read(input, options);
|
|
33
55
|
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Returns structural metadata without materializing the decoded payload for
|
|
59
|
+
* the FLAC format configuration.
|
|
60
|
+
*/
|
|
34
61
|
Inspect(input, options = {}) {
|
|
35
62
|
return inspectWithValues(input, this.GetValues(options));
|
|
36
63
|
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Reports whether input meets the active decoder capability constraints for
|
|
67
|
+
* the FLAC format configuration.
|
|
68
|
+
*/
|
|
37
69
|
IsSupported(input, options = {}) {
|
|
38
70
|
return isSupportedWithValues(input, this.GetValues(options));
|
|
39
71
|
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Converts the current decoded payload into a JSON-safe representation for
|
|
75
|
+
* the FLAC format configuration.
|
|
76
|
+
*/
|
|
40
77
|
ToJSON(value) {
|
|
41
78
|
return toJsonValue(value);
|
|
42
79
|
}
|
|
80
|
+
|
|
81
|
+
/** Provides the one-shot FLAC payload reader entry point. */
|
|
43
82
|
static read(input, options = {}) {
|
|
44
83
|
return readWithValues(input, normalizeValues(DEFAULT_VALUES, {
|
|
45
84
|
inputType: "flac",
|
|
46
85
|
...options
|
|
47
86
|
}, FORMAT_NAME));
|
|
48
87
|
}
|
|
88
|
+
|
|
89
|
+
/** Provides the asynchronous one-shot FLAC payload reader entry point. */
|
|
49
90
|
static async readAsync(input, options = {}) {
|
|
50
91
|
return CjsFlacFormat.read(input, options);
|
|
51
92
|
}
|
|
93
|
+
|
|
94
|
+
/** Provides the one-shot FLAC metadata inspection entry point. */
|
|
52
95
|
static inspect(input, options = {}) {
|
|
53
96
|
return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, {
|
|
54
97
|
inputType: "flac",
|
|
55
98
|
...options
|
|
56
99
|
}, FORMAT_NAME));
|
|
57
100
|
}
|
|
101
|
+
|
|
102
|
+
/** Checks one input against the FLAC decoder capability contract. */
|
|
58
103
|
static isSupported(input, options = {}) {
|
|
59
104
|
return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, {
|
|
60
105
|
inputType: "flac",
|
|
61
106
|
...options
|
|
62
107
|
}, FORMAT_NAME));
|
|
63
108
|
}
|
|
109
|
+
|
|
110
|
+
/** Provides the one-shot FLAC JSON conversion entry point. */
|
|
64
111
|
static toJSON(value) {
|
|
65
112
|
return toJsonValue(value);
|
|
66
113
|
}
|
|
114
|
+
|
|
115
|
+
/** Checks whether caller-provided bytes carry the expected FLAC signature. */
|
|
67
116
|
static isFLAC(input) {
|
|
68
117
|
try {
|
|
69
118
|
return isFLAC(toBytes(input));
|
|
@@ -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 isSupportedWithValues,\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\n{\n #values = DEFAULT_VALUES;\n\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"flac\", ...options }, FORMAT_NAME);\n return this;\n }\n\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"flac\", ...options }, FORMAT_NAME);\n }\n\n Read(input, options = {}) { return readWithValues(input, this.GetValues(options)); }\n async ReadAsync(input, options = {}) { return this.Read(input, options); }\n Inspect(input, options = {}) { return inspectWithValues(input, this.GetValues(options)); }\n IsSupported(input, options = {}) { return isSupportedWithValues(input, this.GetValues(options)); }\n ToJSON(value) { return toJsonValue(value); }\n\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"flac\", ...options }, FORMAT_NAME));\n }\n\n static async readAsync(input, options = {}) { return CjsFlacFormat.read(input, options); }\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"flac\", ...options }, FORMAT_NAME));\n }\n\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"flac\", ...options }, FORMAT_NAME));\n }\n\n static toJSON(value) { return toJsonValue(value); }\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 type = Object.freeze([ \"audio\" ]);\n static mediaTypes = Object.freeze([ \"audio\" ]);\n static inputTypes = Object.freeze([ \"flac\" ]);\n static outputTypes = Object.freeze([]);\n static debugOutputTypes = Object.freeze([ \"flacJson\", OUTPUT_RAW ]);\n static implementationStatus = \"metadata-only\";\n}\n\nexport default CjsFlacFormat;\n"],"names":["FORMAT_NAME","CjsFlacFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isFLAC","toBytes","Output","Object","freeze","RAW","OUTPUT_RAW","PCM","OUTPUT_PCM","JSON","OUTPUT_JSON","OUTPUT_FLAC_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes","implementationStatus"],"mappings":";;AAcA,MAAMA,WAAW,GAAG,eAAe;;AAEnC;AACA;AACA;AACA;AACA;AACO,MAAMC,aAAa,CAC1B;EACI,OAAO,GAAGC,cAAc;
|
|
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 isSupportedWithValues,\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\n{\n #values = DEFAULT_VALUES;\n\n /** Creates a CjsFlacFormat with caller-provided reader configuration. */\n constructor(options = {})\n {\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 * Reports whether input meets the active decoder capability constraints for\n * the FLAC format configuration.\n */\n IsSupported(input, options = {}) { return isSupportedWithValues(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 isSupported(input, options = {})\n {\n return isSupportedWithValues(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 type = Object.freeze([ \"audio\" ]);\n static mediaTypes = Object.freeze([ \"audio\" ]);\n static inputTypes = Object.freeze([ \"flac\" ]);\n static outputTypes = Object.freeze([]);\n static debugOutputTypes = Object.freeze([ \"flacJson\", OUTPUT_RAW ]);\n static implementationStatus = \"metadata-only\";\n}\n\nexport default CjsFlacFormat;\n"],"names":["FORMAT_NAME","CjsFlacFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isFLAC","toBytes","Output","Object","freeze","RAW","OUTPUT_RAW","PCM","OUTPUT_PCM","JSON","OUTPUT_JSON","OUTPUT_FLAC_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes","implementationStatus"],"mappings":";;AAcA,MAAMA,WAAW,GAAG,eAAe;;AAEnC;AACA;AACA;AACA;AACA;AACO,MAAMC,aAAa,CAC1B;EACI,OAAO,GAAGC,cAAc;;AAExB;AACAC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,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,EAAEJ,WAAW,CAAC;AAC5F,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACIQ,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,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AAE,CAAC;EAC9C,OAAOU,UAAU,GAAGX,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;AAC7C,EAAA,OAAOW,WAAW,GAAGZ,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;EACtC,OAAOY,gBAAgB,GAAGb,MAAM,CAACC,MAAM,CAAC,CAAE,UAAU,EAAEE,UAAU,CAAE,CAAC;EACnE,OAAOW,oBAAoB,GAAG,eAAe;AACjD;;;;"}
|
|
@@ -7,6 +7,11 @@ const DEFAULT_VALUES = Object.freeze({
|
|
|
7
7
|
source: ""
|
|
8
8
|
});
|
|
9
9
|
const DEBUG_OUTPUT = "flacJson";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Normalizes reader options against their supported defaults for the FLAC format
|
|
13
|
+
* reader.
|
|
14
|
+
*/
|
|
10
15
|
function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = "CjsFlacFormat") {
|
|
11
16
|
const values = {
|
|
12
17
|
...DEFAULT_VALUES,
|
|
@@ -19,15 +24,21 @@ function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = "CjsF
|
|
|
19
24
|
}
|
|
20
25
|
return values;
|
|
21
26
|
}
|
|
27
|
+
|
|
28
|
+
/** Returns a byte view over the supplied binary input for the FLAC format reader. */
|
|
22
29
|
function toBytes(input) {
|
|
23
30
|
if (input instanceof Uint8Array) return input;
|
|
24
31
|
if (input instanceof ArrayBuffer) return new Uint8Array(input);
|
|
25
32
|
if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
|
|
26
33
|
throw new TypeError("FLAC input must be Uint8Array, ArrayBuffer, or DataView");
|
|
27
34
|
}
|
|
35
|
+
|
|
36
|
+
/** Reports whether the current FLAC format reader satisfies FLAC. */
|
|
28
37
|
function isFLAC(bytes) {
|
|
29
38
|
return bytes.byteLength >= 4 && bytes[0] === 0x66 && bytes[1] === 0x4c && bytes[2] === 0x61 && bytes[3] === 0x43;
|
|
30
39
|
}
|
|
40
|
+
|
|
41
|
+
/** Inspects input using normalized format options for the FLAC format reader. */
|
|
31
42
|
function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
|
|
32
43
|
const bytes = toBytes(input);
|
|
33
44
|
if (!isFLAC(bytes)) throw new TypeError("CjsFlacFormat: input is not a FLAC stream");
|
|
@@ -40,6 +51,11 @@ function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
|
|
|
40
51
|
...inspectBytes(bytes)
|
|
41
52
|
};
|
|
42
53
|
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Reports whether input is supported under normalized format options for the
|
|
57
|
+
* FLAC format reader.
|
|
58
|
+
*/
|
|
43
59
|
function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
|
|
44
60
|
try {
|
|
45
61
|
const metadata = inspectWithValues(input, values, expectedType);
|
|
@@ -85,6 +101,8 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = ""
|
|
|
85
101
|
};
|
|
86
102
|
}
|
|
87
103
|
}
|
|
104
|
+
|
|
105
|
+
/** Reads input using normalized format options for the FLAC format reader. */
|
|
88
106
|
function readWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
|
|
89
107
|
const bytes = toBytes(input);
|
|
90
108
|
const metadata = inspectWithValues(bytes, values, expectedType);
|
|
@@ -107,6 +125,8 @@ function readWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
|
|
|
107
125
|
bytes
|
|
108
126
|
};
|
|
109
127
|
}
|
|
128
|
+
|
|
129
|
+
/** Converts a parsed payload into a JSON-safe value for the FLAC format reader. */
|
|
110
130
|
function toJsonValue(value) {
|
|
111
131
|
if (value instanceof Uint8Array) return {
|
|
112
132
|
byteLength: value.byteLength
|
|
@@ -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\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\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\nexport function isFLAC(bytes)\n{\n return bytes.byteLength >= 4 && bytes[0] === 0x66 && bytes[1] === 0x4c && bytes[2] === 0x61 && bytes[3] === 0x43;\n}\n\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\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\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\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;AAExB,SAASC,eAAeA,CAACC,IAAI,GAAGR,cAAc,EAAES,OAAO,GAAG,EAAE,EAAEC,UAAU,GAAG,eAAe,EACjG;AACI,EAAA,MAAMC,MAAM,GAAG;AAAE,IAAA,GAAGX,cAAc;AAAE,IAAA,IAAIQ,IAAI,IAAI,EAAE,CAAC;IAAE,IAAIC,OAAO,IAAI,EAAE;GAAG;EACzEE,MAAM,CAACP,SAAS,GAAGO,MAAM,CAACP,SAAS,GAAGQ,MAAM,CAACD,MAAM,CAACP,SAAS,CAAC,CAACS,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAACC,WAAW,EAAE,GAAG,EAAE;AACrG,EAAA,IAAI,CAAC,CAAEjB,UAAU,EAAEC,UAAU,EAAEC,WAAW,EAAEO,YAAY,CAAE,CAACS,QAAQ,CAACJ,MAAM,CAACR,IAAI,CAAC,EAChF;AACI,IAAA,MAAM,IAAIa,SAAS,CAAC,CAAA,EAAGN,UAAU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"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,GAAGR,cAAc,EAAES,OAAO,GAAG,EAAE,EAAEC,UAAU,GAAG,eAAe,EACjG;AACI,EAAA,MAAMC,MAAM,GAAG;AAAE,IAAA,GAAGX,cAAc;AAAE,IAAA,IAAIQ,IAAI,IAAI,EAAE,CAAC;IAAE,IA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AACsC,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;;;;"}
|
|
@@ -8,9 +8,16 @@ const FORMAT_NAME = "CjsGifFormat";
|
|
|
8
8
|
*/
|
|
9
9
|
class CjsGifFormat {
|
|
10
10
|
#values = DEFAULT_VALUES;
|
|
11
|
+
|
|
12
|
+
/** Creates a CjsGifFormat with caller-provided reader configuration. */
|
|
11
13
|
constructor(options = {}) {
|
|
12
14
|
this.SetValues(options);
|
|
13
15
|
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Applies caller-provided options after normalizing supported fields for the
|
|
19
|
+
* GIF format configuration.
|
|
20
|
+
*/
|
|
14
21
|
SetValues(options = {}) {
|
|
15
22
|
this.#values = normalizeValues(this.#values, {
|
|
16
23
|
inputType: "gif",
|
|
@@ -18,51 +25,93 @@ class CjsGifFormat {
|
|
|
18
25
|
}, FORMAT_NAME);
|
|
19
26
|
return this;
|
|
20
27
|
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Returns a snapshot of the normalized reader options for the GIF format
|
|
31
|
+
* configuration.
|
|
32
|
+
*/
|
|
21
33
|
GetValues(options = {}) {
|
|
22
34
|
return normalizeValues(this.#values, {
|
|
23
35
|
inputType: "gif",
|
|
24
36
|
...options
|
|
25
37
|
}, FORMAT_NAME);
|
|
26
38
|
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Reads the primary public payload representation from the supplied input
|
|
42
|
+
* for the GIF format configuration.
|
|
43
|
+
*/
|
|
27
44
|
Read(input, options = {}) {
|
|
28
45
|
return readWithValues(input, this.GetValues(options));
|
|
29
46
|
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Reads the primary public payload representation asynchronously for the GIF
|
|
50
|
+
* format configuration.
|
|
51
|
+
*/
|
|
30
52
|
async ReadAsync(input, options = {}) {
|
|
31
53
|
return this.Read(input, options);
|
|
32
54
|
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Returns structural metadata without materializing the decoded payload for
|
|
58
|
+
* the GIF format configuration.
|
|
59
|
+
*/
|
|
33
60
|
Inspect(input, options = {}) {
|
|
34
61
|
return inspectWithValues(input, this.GetValues(options));
|
|
35
62
|
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Reports whether input meets the active decoder capability constraints for
|
|
66
|
+
* the GIF format configuration.
|
|
67
|
+
*/
|
|
36
68
|
IsSupported(input, options = {}) {
|
|
37
69
|
return isSupportedWithValues(input, this.GetValues(options));
|
|
38
70
|
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Converts the current decoded payload into a JSON-safe representation for
|
|
74
|
+
* the GIF format configuration.
|
|
75
|
+
*/
|
|
39
76
|
ToJSON(value) {
|
|
40
77
|
return toJsonValue(value);
|
|
41
78
|
}
|
|
79
|
+
|
|
80
|
+
/** Provides the one-shot GIF payload reader entry point. */
|
|
42
81
|
static read(input, options = {}) {
|
|
43
82
|
return readWithValues(input, normalizeValues(DEFAULT_VALUES, {
|
|
44
83
|
inputType: "gif",
|
|
45
84
|
...options
|
|
46
85
|
}, FORMAT_NAME));
|
|
47
86
|
}
|
|
87
|
+
|
|
88
|
+
/** Provides the asynchronous one-shot GIF payload reader entry point. */
|
|
48
89
|
static async readAsync(input, options = {}) {
|
|
49
90
|
return CjsGifFormat.read(input, options);
|
|
50
91
|
}
|
|
92
|
+
|
|
93
|
+
/** Provides the one-shot GIF metadata inspection entry point. */
|
|
51
94
|
static inspect(input, options = {}) {
|
|
52
95
|
return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, {
|
|
53
96
|
inputType: "gif",
|
|
54
97
|
...options
|
|
55
98
|
}, FORMAT_NAME));
|
|
56
99
|
}
|
|
100
|
+
|
|
101
|
+
/** Checks one input against the GIF decoder capability contract. */
|
|
57
102
|
static isSupported(input, options = {}) {
|
|
58
103
|
return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, {
|
|
59
104
|
inputType: "gif",
|
|
60
105
|
...options
|
|
61
106
|
}, FORMAT_NAME));
|
|
62
107
|
}
|
|
108
|
+
|
|
109
|
+
/** Provides the one-shot GIF JSON conversion entry point. */
|
|
63
110
|
static toJSON(value) {
|
|
64
111
|
return toJsonValue(value);
|
|
65
112
|
}
|
|
113
|
+
|
|
114
|
+
/** Checks whether caller-provided bytes carry the expected GIF signature. */
|
|
66
115
|
static isGIF(input) {
|
|
67
116
|
try {
|
|
68
117
|
return isGIF(toBytes(input));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsGifFormat.js","sources":["../../../../src/formats/gif/CjsGifFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_IMAGE,\n OUTPUT_JSON,\n OUTPUT_RAW,\n OUTPUT_RGBA,\n inspectWithValues,\n isGIF,\n isSupportedWithValues,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsGifFormat\";\n\n/**\n * GIF format profile that inspects header and frame metadata and reads GIF\n * bytes into raw, debug JSON, or LZW-decoded RGBA frame payloads.\n */\nexport class CjsGifFormat\n{\n #values = DEFAULT_VALUES;\n\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"gif\", ...options }, FORMAT_NAME);\n return this;\n }\n\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"gif\", ...options }, FORMAT_NAME);\n }\n\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options));\n }\n\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options));\n }\n\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options));\n }\n\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"gif\", ...options }, FORMAT_NAME));\n }\n\n static async readAsync(input, options = {})\n {\n return CjsGifFormat.read(input, options);\n }\n\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"gif\", ...options }, FORMAT_NAME));\n }\n\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"gif\", ...options }, FORMAT_NAME));\n }\n\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n static isGIF(input)\n {\n try\n {\n return isGIF(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n IMAGE: OUTPUT_IMAGE,\n RGBA: OUTPUT_RGBA,\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON\n });\n static OUTPUT_GIF_JSON = \"gifJson\";\n static type = Object.freeze([ \"image\" ]);\n static mediaTypes = Object.freeze([ \"image\" ]);\n static inputTypes = Object.freeze([ \"gif\" ]);\n static outputTypes = Object.freeze([ OUTPUT_IMAGE, OUTPUT_RGBA ]);\n static debugOutputTypes = Object.freeze([ \"gifJson\", OUTPUT_RAW ]);\n}\n\nexport default CjsGifFormat;\n"],"names":["FORMAT_NAME","CjsGifFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isGIF","toBytes","Output","Object","freeze","IMAGE","OUTPUT_IMAGE","RGBA","OUTPUT_RGBA","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","OUTPUT_GIF_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;AAeA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACO,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;
|
|
1
|
+
{"version":3,"file":"CjsGifFormat.js","sources":["../../../../src/formats/gif/CjsGifFormat.js"],"sourcesContent":["import {\n DEFAULT_VALUES,\n OUTPUT_IMAGE,\n OUTPUT_JSON,\n OUTPUT_RAW,\n OUTPUT_RGBA,\n inspectWithValues,\n isGIF,\n isSupportedWithValues,\n normalizeValues,\n readWithValues,\n toBytes,\n toJsonValue\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsGifFormat\";\n\n/**\n * GIF format profile that inspects header and frame metadata and reads GIF\n * bytes into raw, debug JSON, or LZW-decoded RGBA frame payloads.\n */\nexport class CjsGifFormat\n{\n #values = DEFAULT_VALUES;\n\n /** Creates a CjsGifFormat with caller-provided reader configuration. */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Applies caller-provided options after normalizing supported fields for the\n * GIF format configuration.\n */\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, { inputType: \"gif\", ...options }, FORMAT_NAME);\n return this;\n }\n\n /**\n * Returns a snapshot of the normalized reader options for the GIF format\n * configuration.\n */\n GetValues(options = {})\n {\n return normalizeValues(this.#values, { inputType: \"gif\", ...options }, FORMAT_NAME);\n }\n\n /**\n * Reads the primary public payload representation from the supplied input\n * for the GIF format configuration.\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options));\n }\n\n /**\n * Reads the primary public payload representation asynchronously for the GIF\n * format configuration.\n */\n async ReadAsync(input, options = {})\n {\n return this.Read(input, options);\n }\n\n /**\n * Returns structural metadata without materializing the decoded payload for\n * the GIF format configuration.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options));\n }\n\n /**\n * Reports whether input meets the active decoder capability constraints for\n * the GIF format configuration.\n */\n IsSupported(input, options = {})\n {\n return isSupportedWithValues(input, this.GetValues(options));\n }\n\n /**\n * Converts the current decoded payload into a JSON-safe representation for\n * the GIF format configuration.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /** Provides the one-shot GIF payload reader entry point. */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"gif\", ...options }, FORMAT_NAME));\n }\n\n /** Provides the asynchronous one-shot GIF payload reader entry point. */\n static async readAsync(input, options = {})\n {\n return CjsGifFormat.read(input, options);\n }\n\n /** Provides the one-shot GIF metadata inspection entry point. */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"gif\", ...options }, FORMAT_NAME));\n }\n\n /** Checks one input against the GIF decoder capability contract. */\n static isSupported(input, options = {})\n {\n return isSupportedWithValues(input, normalizeValues(DEFAULT_VALUES, { inputType: \"gif\", ...options }, FORMAT_NAME));\n }\n\n /** Provides the one-shot GIF JSON conversion entry point. */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /** Checks whether caller-provided bytes carry the expected GIF signature. */\n static isGIF(input)\n {\n try\n {\n return isGIF(toBytes(input));\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Emit targets for this format (canonical frozen enum).\n */\n static Output = Object.freeze({\n IMAGE: OUTPUT_IMAGE,\n RGBA: OUTPUT_RGBA,\n RAW: OUTPUT_RAW,\n JSON: OUTPUT_JSON\n });\n static OUTPUT_GIF_JSON = \"gifJson\";\n static type = Object.freeze([ \"image\" ]);\n static mediaTypes = Object.freeze([ \"image\" ]);\n static inputTypes = Object.freeze([ \"gif\" ]);\n static outputTypes = Object.freeze([ OUTPUT_IMAGE, OUTPUT_RGBA ]);\n static debugOutputTypes = Object.freeze([ \"gifJson\", OUTPUT_RAW ]);\n}\n\nexport default CjsGifFormat;\n"],"names":["FORMAT_NAME","CjsGifFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","inputType","GetValues","Read","input","readWithValues","ReadAsync","Inspect","inspectWithValues","IsSupported","isSupportedWithValues","ToJSON","value","toJsonValue","read","readAsync","inspect","isSupported","toJSON","isGIF","toBytes","Output","Object","freeze","IMAGE","OUTPUT_IMAGE","RGBA","OUTPUT_RGBA","RAW","OUTPUT_RAW","JSON","OUTPUT_JSON","OUTPUT_GIF_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;AAeA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACO,MAAMC,YAAY,CACzB;EACI,OAAO,GAAGC,cAAc;;AAExB;AACAC,EAAAA,WAAWA,CAACC,OAAO,GAAG,EAAE,EACxB;AACI,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,KAAK;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AAC3F,IAAA,OAAO,IAAI;AACf,EAAA;;AAEA;AACJ;AACA;AACA;AACIQ,EAAAA,SAASA,CAACJ,OAAO,GAAG,EAAE,EACtB;AACI,IAAA,OAAOE,eAAe,CAAC,IAAI,CAAC,OAAO,EAAE;AAAEC,MAAAA,SAAS,EAAE,KAAK;MAAE,GAAGH;KAAS,EAAEJ,WAAW,CAAC;AACvF,EAAA;;AAEA;AACJ;AACA;AACA;AACIS,EAAAA,IAAIA,CAACC,KAAK,EAAEN,OAAO,GAAG,EAAE,EACxB;IACI,OAAOO,cAAc,CAACD,KAAK,EAA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EM,UAAU,CAAE,CAAC;AACtE;;;;"}
|
|
@@ -7,6 +7,11 @@ const DEFAULT_VALUES = Object.freeze({
|
|
|
7
7
|
inputType: "gif",
|
|
8
8
|
source: ""
|
|
9
9
|
});
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Normalizes reader options against their supported defaults for the GIF format
|
|
13
|
+
* reader.
|
|
14
|
+
*/
|
|
10
15
|
function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = "CjsGifFormat") {
|
|
11
16
|
if (!options || typeof options !== "object" || Array.isArray(options)) {
|
|
12
17
|
throw new TypeError(`${readerName}: options must be an object`);
|
|
@@ -25,15 +30,21 @@ function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = "CjsG
|
|
|
25
30
|
}
|
|
26
31
|
return values;
|
|
27
32
|
}
|
|
33
|
+
|
|
34
|
+
/** Returns a byte view over the supplied binary input for the GIF format reader. */
|
|
28
35
|
function toBytes(input) {
|
|
29
36
|
if (input instanceof Uint8Array) return input;
|
|
30
37
|
if (input instanceof ArrayBuffer) return new Uint8Array(input);
|
|
31
38
|
if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
|
|
32
39
|
throw new TypeError("GIF input must be Uint8Array, ArrayBuffer, or a view");
|
|
33
40
|
}
|
|
41
|
+
|
|
42
|
+
/** Reports whether the current GIF format reader satisfies GIF. */
|
|
34
43
|
function isGIF(bytes) {
|
|
35
44
|
return bytes.byteLength >= 13 && (ascii(bytes, 0, 6) === "GIF87a" || ascii(bytes, 0, 6) === "GIF89a");
|
|
36
45
|
}
|
|
46
|
+
|
|
47
|
+
/** Inspects input using normalized format options for the GIF format reader. */
|
|
37
48
|
function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = "gif") {
|
|
38
49
|
const bytes = toBytes(input);
|
|
39
50
|
if (!isGIF(bytes)) throw new TypeError("CjsGifFormat: input is not a GIF87a/GIF89a image");
|
|
@@ -47,6 +58,11 @@ function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = "gif")
|
|
|
47
58
|
source: values.source || "buffer"
|
|
48
59
|
};
|
|
49
60
|
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Reports whether input is supported under normalized format options for the GIF
|
|
64
|
+
* format reader.
|
|
65
|
+
*/
|
|
50
66
|
function isSupportedWithValues(input, values = DEFAULT_VALUES) {
|
|
51
67
|
try {
|
|
52
68
|
const metadata = inspectWithValues(input, values);
|
|
@@ -96,6 +112,8 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES) {
|
|
|
96
112
|
};
|
|
97
113
|
}
|
|
98
114
|
}
|
|
115
|
+
|
|
116
|
+
/** Reads input using normalized format options for the GIF format reader. */
|
|
99
117
|
function readWithValues(input, values = DEFAULT_VALUES) {
|
|
100
118
|
const bytes = toBytes(input);
|
|
101
119
|
const metadata = inspectWithValues(bytes, values);
|
|
@@ -119,6 +137,8 @@ function readWithValues(input, values = DEFAULT_VALUES) {
|
|
|
119
137
|
error.code = "CJS_FORMAT_OUTPUT_NOT_IMPLEMENTED";
|
|
120
138
|
throw error;
|
|
121
139
|
}
|
|
140
|
+
|
|
141
|
+
/** Converts a parsed payload into a JSON-safe value for the GIF format reader. */
|
|
122
142
|
function toJsonValue(value) {
|
|
123
143
|
if (value instanceof Uint8Array) return {
|
|
124
144
|
byteLength: value.byteLength
|