@tscaps/engine 0.1.1
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/LICENSE +21 -0
- package/README.md +349 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/modules/css/BrowserCssResourceEmbedder.d.ts +5 -0
- package/dist/modules/css/BrowserCssResourceEmbedder.d.ts.map +1 -0
- package/dist/modules/css/BrowserCssResourceEmbedder.js +41 -0
- package/dist/modules/css/BrowserCssResourceEmbedder.js.map +1 -0
- package/dist/modules/css/CssMinifier.d.ts +12 -0
- package/dist/modules/css/CssMinifier.d.ts.map +1 -0
- package/dist/modules/css/CssMinifier.js +47 -0
- package/dist/modules/css/CssMinifier.js.map +1 -0
- package/dist/modules/css/CssResourceEmbedder.d.ts +4 -0
- package/dist/modules/css/CssResourceEmbedder.d.ts.map +1 -0
- package/dist/modules/css/CssResourceEmbedder.js +2 -0
- package/dist/modules/css/CssResourceEmbedder.js.map +1 -0
- package/dist/modules/css/CssScoper.d.ts +16 -0
- package/dist/modules/css/CssScoper.d.ts.map +1 -0
- package/dist/modules/css/CssScoper.js +109 -0
- package/dist/modules/css/CssScoper.js.map +1 -0
- package/dist/modules/css/NoopCssResourceEmbedder.d.ts +12 -0
- package/dist/modules/css/NoopCssResourceEmbedder.d.ts.map +1 -0
- package/dist/modules/css/NoopCssResourceEmbedder.js +13 -0
- package/dist/modules/css/NoopCssResourceEmbedder.js.map +1 -0
- package/dist/modules/css/index.d.ts +6 -0
- package/dist/modules/css/index.d.ts.map +1 -0
- package/dist/modules/css/index.js +5 -0
- package/dist/modules/css/index.js.map +1 -0
- package/dist/modules/document/CssVariable.d.ts +46 -0
- package/dist/modules/document/CssVariable.d.ts.map +1 -0
- package/dist/modules/document/CssVariable.js +47 -0
- package/dist/modules/document/CssVariable.js.map +1 -0
- package/dist/modules/document/Document.d.ts +43 -0
- package/dist/modules/document/Document.d.ts.map +1 -0
- package/dist/modules/document/Document.js +86 -0
- package/dist/modules/document/Document.js.map +1 -0
- package/dist/modules/document/DocumentEditor.d.ts +111 -0
- package/dist/modules/document/DocumentEditor.d.ts.map +1 -0
- package/dist/modules/document/DocumentEditor.js +555 -0
- package/dist/modules/document/DocumentEditor.js.map +1 -0
- package/dist/modules/document/Letter.d.ts +17 -0
- package/dist/modules/document/Letter.d.ts.map +1 -0
- package/dist/modules/document/Letter.js +17 -0
- package/dist/modules/document/Letter.js.map +1 -0
- package/dist/modules/document/Line.d.ts +31 -0
- package/dist/modules/document/Line.d.ts.map +1 -0
- package/dist/modules/document/Line.js +94 -0
- package/dist/modules/document/Line.js.map +1 -0
- package/dist/modules/document/LineState.d.ts +6 -0
- package/dist/modules/document/LineState.d.ts.map +1 -0
- package/dist/modules/document/LineState.js +7 -0
- package/dist/modules/document/LineState.js.map +1 -0
- package/dist/modules/document/NarrationPace.d.ts +20 -0
- package/dist/modules/document/NarrationPace.d.ts.map +1 -0
- package/dist/modules/document/NarrationPace.js +60 -0
- package/dist/modules/document/NarrationPace.js.map +1 -0
- package/dist/modules/document/Section.d.ts +45 -0
- package/dist/modules/document/Section.d.ts.map +1 -0
- package/dist/modules/document/Section.js +94 -0
- package/dist/modules/document/Section.js.map +1 -0
- package/dist/modules/document/Segment.d.ts +40 -0
- package/dist/modules/document/Segment.d.ts.map +1 -0
- package/dist/modules/document/Segment.js +85 -0
- package/dist/modules/document/Segment.js.map +1 -0
- package/dist/modules/document/Tag.d.ts +24 -0
- package/dist/modules/document/Tag.d.ts.map +1 -0
- package/dist/modules/document/Tag.js +37 -0
- package/dist/modules/document/Tag.js.map +1 -0
- package/dist/modules/document/TimeFragment.d.ts +11 -0
- package/dist/modules/document/TimeFragment.d.ts.map +1 -0
- package/dist/modules/document/TimeFragment.js +29 -0
- package/dist/modules/document/TimeFragment.js.map +1 -0
- package/dist/modules/document/Word.d.ts +40 -0
- package/dist/modules/document/Word.d.ts.map +1 -0
- package/dist/modules/document/Word.js +114 -0
- package/dist/modules/document/Word.js.map +1 -0
- package/dist/modules/document/WordState.d.ts +6 -0
- package/dist/modules/document/WordState.d.ts.map +1 -0
- package/dist/modules/document/WordState.js +7 -0
- package/dist/modules/document/WordState.js.map +1 -0
- package/dist/modules/document/index.d.ts +14 -0
- package/dist/modules/document/index.d.ts.map +1 -0
- package/dist/modules/document/index.js +14 -0
- package/dist/modules/document/index.js.map +1 -0
- package/dist/modules/effect/CarryQuotesEffect.d.ts +47 -0
- package/dist/modules/effect/CarryQuotesEffect.d.ts.map +1 -0
- package/dist/modules/effect/CarryQuotesEffect.js +181 -0
- package/dist/modules/effect/CarryQuotesEffect.js.map +1 -0
- package/dist/modules/effect/Effect.d.ts +16 -0
- package/dist/modules/effect/Effect.d.ts.map +1 -0
- package/dist/modules/effect/Effect.js +2 -0
- package/dist/modules/effect/Effect.js.map +1 -0
- package/dist/modules/effect/GapFreeEffect.d.ts +24 -0
- package/dist/modules/effect/GapFreeEffect.d.ts.map +1 -0
- package/dist/modules/effect/GapFreeEffect.js +67 -0
- package/dist/modules/effect/GapFreeEffect.js.map +1 -0
- package/dist/modules/effect/RemovePunctuationEffect.d.ts +21 -0
- package/dist/modules/effect/RemovePunctuationEffect.d.ts.map +1 -0
- package/dist/modules/effect/RemovePunctuationEffect.js +52 -0
- package/dist/modules/effect/RemovePunctuationEffect.js.map +1 -0
- package/dist/modules/effect/SmartLowercaseEffect.d.ts +21 -0
- package/dist/modules/effect/SmartLowercaseEffect.d.ts.map +1 -0
- package/dist/modules/effect/SmartLowercaseEffect.js +45 -0
- package/dist/modules/effect/SmartLowercaseEffect.js.map +1 -0
- package/dist/modules/effect/SmartPunctuationEffect.d.ts +25 -0
- package/dist/modules/effect/SmartPunctuationEffect.d.ts.map +1 -0
- package/dist/modules/effect/SmartPunctuationEffect.js +68 -0
- package/dist/modules/effect/SmartPunctuationEffect.js.map +1 -0
- package/dist/modules/effect/index.d.ts +7 -0
- package/dist/modules/effect/index.d.ts.map +1 -0
- package/dist/modules/effect/index.js +6 -0
- package/dist/modules/effect/index.js.map +1 -0
- package/dist/modules/pipeline/PipelineProgress.d.ts +30 -0
- package/dist/modules/pipeline/PipelineProgress.d.ts.map +1 -0
- package/dist/modules/pipeline/PipelineProgress.js +2 -0
- package/dist/modules/pipeline/PipelineProgress.js.map +1 -0
- package/dist/modules/pipeline/RenderPipeline.d.ts +105 -0
- package/dist/modules/pipeline/RenderPipeline.d.ts.map +1 -0
- package/dist/modules/pipeline/RenderPipeline.js +232 -0
- package/dist/modules/pipeline/RenderPipeline.js.map +1 -0
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts +143 -0
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts.map +1 -0
- package/dist/modules/pipeline/RenderPipelineBuilder.js +317 -0
- package/dist/modules/pipeline/RenderPipelineBuilder.js.map +1 -0
- package/dist/modules/pipeline/index.d.ts +6 -0
- package/dist/modules/pipeline/index.d.ts.map +1 -0
- package/dist/modules/pipeline/index.js +3 -0
- package/dist/modules/pipeline/index.js.map +1 -0
- package/dist/modules/profiling/Profiler.d.ts +115 -0
- package/dist/modules/profiling/Profiler.d.ts.map +1 -0
- package/dist/modules/profiling/Profiler.js +316 -0
- package/dist/modules/profiling/Profiler.js.map +1 -0
- package/dist/modules/profiling/index.d.ts +2 -0
- package/dist/modules/profiling/index.d.ts.map +1 -0
- package/dist/modules/profiling/index.js +2 -0
- package/dist/modules/profiling/index.js.map +1 -0
- package/dist/modules/rendering/AlignmentConfig.d.ts +21 -0
- package/dist/modules/rendering/AlignmentConfig.d.ts.map +1 -0
- package/dist/modules/rendering/AlignmentConfig.js +2 -0
- package/dist/modules/rendering/AlignmentConfig.js.map +1 -0
- package/dist/modules/rendering/BoxEdges.d.ts +8 -0
- package/dist/modules/rendering/BoxEdges.d.ts.map +1 -0
- package/dist/modules/rendering/BoxEdges.js +2 -0
- package/dist/modules/rendering/BoxEdges.js.map +1 -0
- package/dist/modules/rendering/BrowserOverlayFrameRenderer.d.ts +12 -0
- package/dist/modules/rendering/BrowserOverlayFrameRenderer.d.ts.map +1 -0
- package/dist/modules/rendering/BrowserOverlayFrameRenderer.js +31 -0
- package/dist/modules/rendering/BrowserOverlayFrameRenderer.js.map +1 -0
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts +57 -0
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts.map +1 -0
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js +775 -0
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js.map +1 -0
- package/dist/modules/rendering/ElementRenderOverrides.d.ts +15 -0
- package/dist/modules/rendering/ElementRenderOverrides.d.ts.map +1 -0
- package/dist/modules/rendering/ElementRenderOverrides.js +24 -0
- package/dist/modules/rendering/ElementRenderOverrides.js.map +1 -0
- package/dist/modules/rendering/InlineStyleMap.d.ts +9 -0
- package/dist/modules/rendering/InlineStyleMap.d.ts.map +1 -0
- package/dist/modules/rendering/InlineStyleMap.js +2 -0
- package/dist/modules/rendering/InlineStyleMap.js.map +1 -0
- package/dist/modules/rendering/LayeredSubtitleFrame.d.ts +20 -0
- package/dist/modules/rendering/LayeredSubtitleFrame.d.ts.map +1 -0
- package/dist/modules/rendering/LayeredSubtitleFrame.js +36 -0
- package/dist/modules/rendering/LayeredSubtitleFrame.js.map +1 -0
- package/dist/modules/rendering/OverlayFrameRenderer.d.ts +27 -0
- package/dist/modules/rendering/OverlayFrameRenderer.d.ts.map +1 -0
- package/dist/modules/rendering/OverlayFrameRenderer.js +2 -0
- package/dist/modules/rendering/OverlayFrameRenderer.js.map +1 -0
- package/dist/modules/rendering/RenderingConfig.d.ts +22 -0
- package/dist/modules/rendering/RenderingConfig.d.ts.map +1 -0
- package/dist/modules/rendering/RenderingConfig.js +2 -0
- package/dist/modules/rendering/RenderingConfig.js.map +1 -0
- package/dist/modules/rendering/ScopedRenderOverride.d.ts +19 -0
- package/dist/modules/rendering/ScopedRenderOverride.d.ts.map +1 -0
- package/dist/modules/rendering/ScopedRenderOverride.js +2 -0
- package/dist/modules/rendering/ScopedRenderOverride.js.map +1 -0
- package/dist/modules/rendering/SegmentPaintRegionResolver.d.ts +41 -0
- package/dist/modules/rendering/SegmentPaintRegionResolver.d.ts.map +1 -0
- package/dist/modules/rendering/SegmentPaintRegionResolver.js +47 -0
- package/dist/modules/rendering/SegmentPaintRegionResolver.js.map +1 -0
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts +58 -0
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js +132 -0
- package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js.map +1 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts +111 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts.map +1 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.js +2 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.js.map +1 -0
- package/dist/modules/rendering/VideoFrameLayerClass.d.ts +21 -0
- package/dist/modules/rendering/VideoFrameLayerClass.d.ts.map +1 -0
- package/dist/modules/rendering/VideoFrameLayerClass.js +21 -0
- package/dist/modules/rendering/VideoFrameLayerClass.js.map +1 -0
- package/dist/modules/rendering/VideoFrameSource.d.ts +29 -0
- package/dist/modules/rendering/VideoFrameSource.d.ts.map +1 -0
- package/dist/modules/rendering/VideoFrameSource.js +2 -0
- package/dist/modules/rendering/VideoFrameSource.js.map +1 -0
- package/dist/modules/rendering/index.d.ts +14 -0
- package/dist/modules/rendering/index.d.ts.map +1 -0
- package/dist/modules/rendering/index.js +6 -0
- package/dist/modules/rendering/index.js.map +1 -0
- package/dist/modules/splitting/BalancedLineSplitter.d.ts +24 -0
- package/dist/modules/splitting/BalancedLineSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/BalancedLineSplitter.js +81 -0
- package/dist/modules/splitting/BalancedLineSplitter.js.map +1 -0
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts +31 -0
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js +99 -0
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js.map +1 -0
- package/dist/modules/splitting/BoundarySegmentSplitter.d.ts +19 -0
- package/dist/modules/splitting/BoundarySegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/BoundarySegmentSplitter.js +38 -0
- package/dist/modules/splitting/BoundarySegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/CompositeSegmentSplitter.d.ts +8 -0
- package/dist/modules/splitting/CompositeSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/CompositeSegmentSplitter.js +12 -0
- package/dist/modules/splitting/CompositeSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts +56 -0
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts.map +1 -0
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js +197 -0
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js.map +1 -0
- package/dist/modules/splitting/GraphemeWordSplitter.d.ts +11 -0
- package/dist/modules/splitting/GraphemeWordSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/GraphemeWordSplitter.js +12 -0
- package/dist/modules/splitting/GraphemeWordSplitter.js.map +1 -0
- package/dist/modules/splitting/LimitByCharsSegmentSplitter.d.ts +15 -0
- package/dist/modules/splitting/LimitByCharsSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/LimitByCharsSegmentSplitter.js +64 -0
- package/dist/modules/splitting/LimitByCharsSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.d.ts +30 -0
- package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.js +66 -0
- package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/LimitByWordsSegmentSplitter.d.ts +12 -0
- package/dist/modules/splitting/LimitByWordsSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/LimitByWordsSegmentSplitter.js +25 -0
- package/dist/modules/splitting/LimitByWordsSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/LineSplitter.d.ts +10 -0
- package/dist/modules/splitting/LineSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/LineSplitter.js +2 -0
- package/dist/modules/splitting/LineSplitter.js.map +1 -0
- package/dist/modules/splitting/PauseBasedSegmentSplitter.d.ts +24 -0
- package/dist/modules/splitting/PauseBasedSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/PauseBasedSegmentSplitter.js +43 -0
- package/dist/modules/splitting/PauseBasedSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/SegmentSplitter.d.ts +10 -0
- package/dist/modules/splitting/SegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/SegmentSplitter.js +2 -0
- package/dist/modules/splitting/SegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/SpeakerChangeSegmentSplitter.d.ts +17 -0
- package/dist/modules/splitting/SpeakerChangeSegmentSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/SpeakerChangeSegmentSplitter.js +46 -0
- package/dist/modules/splitting/SpeakerChangeSegmentSplitter.js.map +1 -0
- package/dist/modules/splitting/TextMeasurer.d.ts +15 -0
- package/dist/modules/splitting/TextMeasurer.d.ts.map +1 -0
- package/dist/modules/splitting/TextMeasurer.js +2 -0
- package/dist/modules/splitting/TextMeasurer.js.map +1 -0
- package/dist/modules/splitting/WordSplitter.d.ts +8 -0
- package/dist/modules/splitting/WordSplitter.d.ts.map +1 -0
- package/dist/modules/splitting/WordSplitter.js +2 -0
- package/dist/modules/splitting/WordSplitter.js.map +1 -0
- package/dist/modules/splitting/index.d.ts +24 -0
- package/dist/modules/splitting/index.d.ts.map +1 -0
- package/dist/modules/splitting/index.js +12 -0
- package/dist/modules/splitting/index.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilter.d.ts +16 -0
- package/dist/modules/svg-filter/SvgFilter.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilter.js +28 -0
- package/dist/modules/svg-filter/SvgFilter.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterBundle.d.ts +16 -0
- package/dist/modules/svg-filter/SvgFilterBundle.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterBundle.js +20 -0
- package/dist/modules/svg-filter/SvgFilterBundle.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts +16 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.js +25 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts +21 -0
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js +50 -0
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterLengthResolver.d.ts +17 -0
- package/dist/modules/svg-filter/SvgFilterLengthResolver.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterLengthResolver.js +27 -0
- package/dist/modules/svg-filter/SvgFilterLengthResolver.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScope.d.ts +18 -0
- package/dist/modules/svg-filter/SvgFilterScope.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScope.js +28 -0
- package/dist/modules/svg-filter/SvgFilterScope.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScopeProvider.d.ts +52 -0
- package/dist/modules/svg-filter/SvgFilterScopeProvider.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScopeProvider.js +2 -0
- package/dist/modules/svg-filter/SvgFilterScopeProvider.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScoper.d.ts +60 -0
- package/dist/modules/svg-filter/SvgFilterScoper.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterScoper.js +58 -0
- package/dist/modules/svg-filter/SvgFilterScoper.js.map +1 -0
- package/dist/modules/svg-filter/index.d.ts +10 -0
- package/dist/modules/svg-filter/index.d.ts.map +1 -0
- package/dist/modules/svg-filter/index.js +8 -0
- package/dist/modules/svg-filter/index.js.map +1 -0
- package/dist/modules/tagging/RegexTagger.d.ts +11 -0
- package/dist/modules/tagging/RegexTagger.d.ts.map +1 -0
- package/dist/modules/tagging/RegexTagger.js +32 -0
- package/dist/modules/tagging/RegexTagger.js.map +1 -0
- package/dist/modules/tagging/SpanTagger.d.ts +25 -0
- package/dist/modules/tagging/SpanTagger.d.ts.map +1 -0
- package/dist/modules/tagging/SpanTagger.js +73 -0
- package/dist/modules/tagging/SpanTagger.js.map +1 -0
- package/dist/modules/tagging/StructureTagger.d.ts +20 -0
- package/dist/modules/tagging/StructureTagger.d.ts.map +1 -0
- package/dist/modules/tagging/StructureTagger.js +74 -0
- package/dist/modules/tagging/StructureTagger.js.map +1 -0
- package/dist/modules/tagging/Tagger.d.ts +5 -0
- package/dist/modules/tagging/Tagger.d.ts.map +1 -0
- package/dist/modules/tagging/Tagger.js +5 -0
- package/dist/modules/tagging/Tagger.js.map +1 -0
- package/dist/modules/tagging/WordlistTagger.d.ts +11 -0
- package/dist/modules/tagging/WordlistTagger.d.ts.map +1 -0
- package/dist/modules/tagging/WordlistTagger.js +31 -0
- package/dist/modules/tagging/WordlistTagger.js.map +1 -0
- package/dist/modules/tagging/index.d.ts +6 -0
- package/dist/modules/tagging/index.d.ts.map +1 -0
- package/dist/modules/tagging/index.js +6 -0
- package/dist/modules/tagging/index.js.map +1 -0
- package/dist/modules/transcription/AudioDecoder.d.ts +11 -0
- package/dist/modules/transcription/AudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/AudioDecoder.js +2 -0
- package/dist/modules/transcription/AudioDecoder.js.map +1 -0
- package/dist/modules/transcription/BrowserAudioDecoder.d.ts +13 -0
- package/dist/modules/transcription/BrowserAudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/BrowserAudioDecoder.js +34 -0
- package/dist/modules/transcription/BrowserAudioDecoder.js.map +1 -0
- package/dist/modules/transcription/PassthroughTranscriber.d.ts +20 -0
- package/dist/modules/transcription/PassthroughTranscriber.d.ts.map +1 -0
- package/dist/modules/transcription/PassthroughTranscriber.js +23 -0
- package/dist/modules/transcription/PassthroughTranscriber.js.map +1 -0
- package/dist/modules/transcription/PreDecodedAudioDecoder.d.ts +12 -0
- package/dist/modules/transcription/PreDecodedAudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/PreDecodedAudioDecoder.js +14 -0
- package/dist/modules/transcription/PreDecodedAudioDecoder.js.map +1 -0
- package/dist/modules/transcription/SrtTranscriber.d.ts +33 -0
- package/dist/modules/transcription/SrtTranscriber.d.ts.map +1 -0
- package/dist/modules/transcription/SrtTranscriber.js +111 -0
- package/dist/modules/transcription/SrtTranscriber.js.map +1 -0
- package/dist/modules/transcription/Transcriber.d.ts +23 -0
- package/dist/modules/transcription/Transcriber.d.ts.map +1 -0
- package/dist/modules/transcription/Transcriber.js +2 -0
- package/dist/modules/transcription/Transcriber.js.map +1 -0
- package/dist/modules/transcription/WhisperTranscriber.d.ts +44 -0
- package/dist/modules/transcription/WhisperTranscriber.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperTranscriber.js +162 -0
- package/dist/modules/transcription/WhisperTranscriber.js.map +1 -0
- package/dist/modules/transcription/index.d.ts +8 -0
- package/dist/modules/transcription/index.d.ts.map +1 -0
- package/dist/modules/transcription/index.js +6 -0
- package/dist/modules/transcription/index.js.map +1 -0
- package/dist/modules/video/RenderJob.d.ts +95 -0
- package/dist/modules/video/RenderJob.d.ts.map +1 -0
- package/dist/modules/video/RenderJob.js +2 -0
- package/dist/modules/video/RenderJob.js.map +1 -0
- package/dist/modules/video/VideoRenderer.d.ts +5 -0
- package/dist/modules/video/VideoRenderer.d.ts.map +1 -0
- package/dist/modules/video/VideoRenderer.js +2 -0
- package/dist/modules/video/VideoRenderer.js.map +1 -0
- package/dist/modules/video/index.d.ts +33 -0
- package/dist/modules/video/index.d.ts.map +1 -0
- package/dist/modules/video/index.js +17 -0
- package/dist/modules/video/index.js.map +1 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts +69 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js +206 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridge.d.ts +24 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridge.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridge.js +2 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridge.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts +20 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.js +2 -0
- package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.d.ts +11 -0
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js +32 -0
- package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.d.ts +12 -0
- package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.js +14 -0
- package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts +28 -0
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js +52 -0
- package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js.map +1 -0
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts +25 -0
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js +52 -0
- package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js.map +1 -0
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts +32 -0
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js +60 -0
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js.map +1 -0
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts +27 -0
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js +72 -0
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js.map +1 -0
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts +32 -0
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.js +2 -0
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.js.map +1 -0
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts +25 -0
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js +37 -0
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js.map +1 -0
- package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts +32 -0
- package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/codec/CodecPolicy.js +2 -0
- package/dist/modules/video/mediabunny/codec/CodecPolicy.js.map +1 -0
- package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.d.ts +59 -0
- package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.js +110 -0
- package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.js.map +1 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.d.ts +27 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js +44 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js.map +1 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.d.ts +10 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.js +15 -0
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.d.ts +29 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.js +2 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.js.map +1 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.d.ts +16 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.js +2 -0
- package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts +25 -0
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js +74 -0
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.d.ts +26 -0
- package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.js +147 -0
- package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.d.ts +12 -0
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js +25 -0
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts +30 -0
- package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/FrameCompositor.js +2 -0
- package/dist/modules/video/mediabunny/frame/FrameCompositor.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.d.ts +44 -0
- package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.js +334 -0
- package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts +10 -0
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js +17 -0
- package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.d.ts +30 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.js +2 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts +22 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.js +2 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.d.ts +17 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.js +48 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.js.map +1 -0
- package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.d.ts +11 -0
- package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.js +22 -0
- package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.js.map +1 -0
- package/dist/modules/video/mediabunny/output/OutputTargetBuilder.d.ts +27 -0
- package/dist/modules/video/mediabunny/output/OutputTargetBuilder.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/output/OutputTargetBuilder.js +2 -0
- package/dist/modules/video/mediabunny/output/OutputTargetBuilder.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { BalancedPixelWidthLineSplitter } from '../splitting/BalancedPixelWidthLineSplitter';
|
|
2
|
+
import { DomProbeCanvasTextMeasurer } from '../splitting/DomProbeCanvasTextMeasurer';
|
|
3
|
+
/**
|
|
4
|
+
* Orchestrates the end-to-end render flow over the components supplied
|
|
5
|
+
* by `RenderPipelineBuilder`: transcribe → split → tag (structural and
|
|
6
|
+
* semantic) → apply effects → render. Each step is also exposed
|
|
7
|
+
* individually so callers can inspect or mutate the current `Document`
|
|
8
|
+
* between stages.
|
|
9
|
+
*
|
|
10
|
+
* The pipeline owns the current `Document`. After a step it stores the
|
|
11
|
+
* result and feeds it to the next step; `getDocument`/`setDocument`
|
|
12
|
+
* give callers a read/replace handle for that state. `run` short-
|
|
13
|
+
* circuits through every step in order; if a Document is already
|
|
14
|
+
* loaded (whether from a previous step or via `setDocument`), it skips
|
|
15
|
+
* the transcription step and starts from splitting.
|
|
16
|
+
*
|
|
17
|
+
* Instances are built by `RenderPipelineBuilder.build` — the builder
|
|
18
|
+
* is the supported construction surface.
|
|
19
|
+
*/
|
|
20
|
+
export class RenderPipeline {
|
|
21
|
+
config;
|
|
22
|
+
currentDocument = null;
|
|
23
|
+
cachedVideoDimensions = null;
|
|
24
|
+
cachedVideoFile = null;
|
|
25
|
+
constructor(config) {
|
|
26
|
+
this.config = config;
|
|
27
|
+
}
|
|
28
|
+
/** Current document state; `null` before transcription runs. */
|
|
29
|
+
getDocument() {
|
|
30
|
+
return this.currentDocument;
|
|
31
|
+
}
|
|
32
|
+
/** Replaces the current document — typical after a manual edit between steps. */
|
|
33
|
+
setDocument(document) {
|
|
34
|
+
this.currentDocument = document;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Runs every step in order and returns the final render result.
|
|
38
|
+
* Skips transcription when a document is already loaded.
|
|
39
|
+
*/
|
|
40
|
+
async run(onProgress) {
|
|
41
|
+
if (this.currentDocument === null) {
|
|
42
|
+
await this.runTranscriptionStep(onProgress);
|
|
43
|
+
}
|
|
44
|
+
await this.runSplittingStep(onProgress);
|
|
45
|
+
this.runStructuralTaggingStep(onProgress);
|
|
46
|
+
await this.runSemanticTaggingStep(onProgress);
|
|
47
|
+
this.runEffectsStep(onProgress);
|
|
48
|
+
return this.runRenderingStep(onProgress);
|
|
49
|
+
}
|
|
50
|
+
async runTranscriptionStep(onProgress) {
|
|
51
|
+
const transcriber = this.config.transcriber;
|
|
52
|
+
const previous = transcriber.onProgress;
|
|
53
|
+
transcriber.onProgress = (event) => onProgress?.({ stage: 'transcribing', inner: event });
|
|
54
|
+
try {
|
|
55
|
+
const document = await transcriber.transcribe(this.config.video, this.config.transcriberOptions);
|
|
56
|
+
this.currentDocument = document;
|
|
57
|
+
return document;
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
this.restoreTranscriberProgressHandler(transcriber, previous);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
restoreTranscriberProgressHandler(transcriber, previous) {
|
|
64
|
+
if (previous === undefined) {
|
|
65
|
+
delete transcriber.onProgress;
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
transcriber.onProgress = previous;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async runSplittingStep(onProgress) {
|
|
72
|
+
const document = this.requireDocument('splitting');
|
|
73
|
+
onProgress?.({ stage: 'splitting', status: 'started' });
|
|
74
|
+
const segmentSplit = this.applySegmentSplitterToSections(document);
|
|
75
|
+
const lineSplit = await this.applyLineSplittingToSections(segmentSplit);
|
|
76
|
+
this.currentDocument = lineSplit;
|
|
77
|
+
onProgress?.({ stage: 'splitting', status: 'completed' });
|
|
78
|
+
return lineSplit;
|
|
79
|
+
}
|
|
80
|
+
runStructuralTaggingStep(onProgress) {
|
|
81
|
+
const document = this.requireDocument('structural tagging');
|
|
82
|
+
onProgress?.({ stage: 'tagging-structural', status: 'started' });
|
|
83
|
+
const tagged = this.config.structureTagger.tag(document);
|
|
84
|
+
this.currentDocument = tagged;
|
|
85
|
+
onProgress?.({ stage: 'tagging-structural', status: 'completed' });
|
|
86
|
+
return tagged;
|
|
87
|
+
}
|
|
88
|
+
async runSemanticTaggingStep(onProgress) {
|
|
89
|
+
const document = this.requireDocument('semantic tagging');
|
|
90
|
+
onProgress?.({ stage: 'tagging-semantic', status: 'started' });
|
|
91
|
+
let result = document;
|
|
92
|
+
for (const tagger of this.config.semanticTaggers) {
|
|
93
|
+
result = await tagger.tag(result);
|
|
94
|
+
}
|
|
95
|
+
this.currentDocument = result;
|
|
96
|
+
onProgress?.({ stage: 'tagging-semantic', status: 'completed' });
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
runEffectsStep(onProgress) {
|
|
100
|
+
const document = this.requireDocument('effects');
|
|
101
|
+
onProgress?.({ stage: 'applying-effects', status: 'started' });
|
|
102
|
+
let result = document;
|
|
103
|
+
for (const effect of this.config.effects) {
|
|
104
|
+
result = effect.apply(result);
|
|
105
|
+
}
|
|
106
|
+
this.currentDocument = result;
|
|
107
|
+
onProgress?.({ stage: 'applying-effects', status: 'completed' });
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
async runRenderingStep(onProgress) {
|
|
111
|
+
const document = this.requireDocument('rendering');
|
|
112
|
+
const styles = this.resolveStylesForDocument(document);
|
|
113
|
+
const job = this.buildRenderJob(document, styles);
|
|
114
|
+
return this.config.videoRenderer.render(job, (progress) => {
|
|
115
|
+
onProgress?.({ stage: 'rendering', inner: progress });
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
requireDocument(stageName) {
|
|
119
|
+
if (this.currentDocument === null) {
|
|
120
|
+
throw new Error(`RenderPipeline: cannot run ${stageName} step — no document loaded yet`);
|
|
121
|
+
}
|
|
122
|
+
return this.currentDocument;
|
|
123
|
+
}
|
|
124
|
+
applySegmentSplitterToSections(document) {
|
|
125
|
+
const sections = document.sections.map((section) => section.with({ segments: this.config.segmentSplitter.split(section.segments) }));
|
|
126
|
+
return document.with({ sections });
|
|
127
|
+
}
|
|
128
|
+
async applyLineSplittingToSections(document) {
|
|
129
|
+
const lineSplitter = await this.resolveLineSplitter();
|
|
130
|
+
if (lineSplitter === null)
|
|
131
|
+
return document;
|
|
132
|
+
const sections = document.sections.map((section) => section.with({ segments: lineSplitter.split(section.segments) }));
|
|
133
|
+
return document.with({ sections });
|
|
134
|
+
}
|
|
135
|
+
async resolveLineSplitter() {
|
|
136
|
+
if (this.config.lineSplitter !== null)
|
|
137
|
+
return this.config.lineSplitter;
|
|
138
|
+
// The default measurer needs one resolved css + one output size to
|
|
139
|
+
// anchor its probe. With explicit per-kind styles the consumer has
|
|
140
|
+
// gone beyond a single visual rule, so the default doesn't fit;
|
|
141
|
+
// they must supply their own LineSplitter.
|
|
142
|
+
if (this.config.explicitStyles !== null)
|
|
143
|
+
return null;
|
|
144
|
+
return this.buildDefaultLineSplitter();
|
|
145
|
+
}
|
|
146
|
+
async buildDefaultLineSplitter() {
|
|
147
|
+
const dimensions = await this.resolveOutputDimensions();
|
|
148
|
+
const measurer = new DomProbeCanvasTextMeasurer({
|
|
149
|
+
css: this.config.defaultStyle.css,
|
|
150
|
+
cssVars: this.extractCssVariablesFromInlineStyles(this.config.defaultStyle.inlineStyles),
|
|
151
|
+
containerWidth: dimensions.width,
|
|
152
|
+
containerHeight: dimensions.height,
|
|
153
|
+
});
|
|
154
|
+
const { maxLines, minLines, maxWidthRatio } = this.config.defaultLineSplitterConfig;
|
|
155
|
+
return new BalancedPixelWidthLineSplitter({
|
|
156
|
+
maxLines,
|
|
157
|
+
minLines,
|
|
158
|
+
maxWidth: Math.round(dimensions.width * maxWidthRatio),
|
|
159
|
+
}, measurer);
|
|
160
|
+
}
|
|
161
|
+
extractCssVariablesFromInlineStyles(inlineStyles) {
|
|
162
|
+
const result = {};
|
|
163
|
+
for (const [key, value] of Object.entries(inlineStyles)) {
|
|
164
|
+
if (key.startsWith('--'))
|
|
165
|
+
result[key] = value;
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
async resolveOutputDimensions() {
|
|
170
|
+
if (this.config.outputResolution !== undefined)
|
|
171
|
+
return this.config.outputResolution;
|
|
172
|
+
if (this.cachedVideoDimensions !== null)
|
|
173
|
+
return this.cachedVideoDimensions;
|
|
174
|
+
this.cachedVideoDimensions = await this.probeVideoNaturalDimensions(this.config.video);
|
|
175
|
+
return this.cachedVideoDimensions;
|
|
176
|
+
}
|
|
177
|
+
probeVideoNaturalDimensions(video) {
|
|
178
|
+
return new Promise((resolve, reject) => {
|
|
179
|
+
const url = URL.createObjectURL(video);
|
|
180
|
+
const element = document.createElement('video');
|
|
181
|
+
element.preload = 'metadata';
|
|
182
|
+
element.muted = true;
|
|
183
|
+
element.onloadedmetadata = () => {
|
|
184
|
+
URL.revokeObjectURL(url);
|
|
185
|
+
resolve({ width: element.videoWidth, height: element.videoHeight });
|
|
186
|
+
};
|
|
187
|
+
element.onerror = () => {
|
|
188
|
+
URL.revokeObjectURL(url);
|
|
189
|
+
reject(new Error('Failed to read video metadata while probing natural dimensions'));
|
|
190
|
+
};
|
|
191
|
+
element.src = url;
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
resolveStylesForDocument(document) {
|
|
195
|
+
if (this.config.explicitStyles !== null)
|
|
196
|
+
return this.config.explicitStyles;
|
|
197
|
+
const styles = {};
|
|
198
|
+
for (const section of document.sections) {
|
|
199
|
+
styles[section.kind] = this.config.defaultStyle;
|
|
200
|
+
}
|
|
201
|
+
return styles;
|
|
202
|
+
}
|
|
203
|
+
buildRenderJob(document, styles) {
|
|
204
|
+
return {
|
|
205
|
+
video: this.resolveVideoAsFile(),
|
|
206
|
+
document,
|
|
207
|
+
styles,
|
|
208
|
+
...(this.config.overlayHtml !== undefined && { overlayHtml: this.config.overlayHtml }),
|
|
209
|
+
...(this.config.outputFormat !== undefined && { outputFormat: this.config.outputFormat }),
|
|
210
|
+
...(this.config.quality !== undefined && { quality: this.config.quality }),
|
|
211
|
+
...(this.config.outputResolution !== undefined && { outputResolution: this.config.outputResolution }),
|
|
212
|
+
...(this.config.outputStream !== undefined && { outputStream: this.config.outputStream }),
|
|
213
|
+
...(this.config.onAudioDiscarded !== undefined && { onAudioDiscarded: this.config.onAudioDiscarded }),
|
|
214
|
+
...(this.config.confirmFallbackDecoder !== undefined && { confirmFallbackDecoder: this.config.confirmFallbackDecoder }),
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* The video renderer's job expects a `File`. Inputs that arrive as a
|
|
219
|
+
* raw `Blob` are wrapped once and reused across runs so the same
|
|
220
|
+
* underlying bytes back every render call.
|
|
221
|
+
*/
|
|
222
|
+
resolveVideoAsFile() {
|
|
223
|
+
if (this.cachedVideoFile !== null)
|
|
224
|
+
return this.cachedVideoFile;
|
|
225
|
+
const source = this.config.video;
|
|
226
|
+
this.cachedVideoFile = source instanceof File
|
|
227
|
+
? source
|
|
228
|
+
: new File([source], 'input', { type: source.type });
|
|
229
|
+
return this.cachedVideoFile;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=RenderPipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderPipeline.js","sourceRoot":"","sources":["../../../src/modules/pipeline/RenderPipeline.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,8BAA8B,EAAE,MAAM,mDAAmD,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAyD3F;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,cAAc;IAKI;IAJrB,eAAe,GAAoB,IAAI,CAAC;IACxC,qBAAqB,GAA4B,IAAI,CAAC;IACtD,eAAe,GAAgB,IAAI,CAAC;IAE5C,YAA6B,MAA4B;QAA5B,WAAM,GAAN,MAAM,CAAsB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MAAM,CAAC,gBAAgB,KAAK,SAAS,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;YACrG,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,KAAK,SAAS,IAAI,EAAE,sBAAsB,EAAE,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;SACxH,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACK,kBAAkB;QACxB,IAAI,IAAI,CAAC,eAAe,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC,eAAe,CAAC;QAC/D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,MAAM,YAAY,IAAI;YAC3C,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { Transcriber, TranscriberOptions } from '../transcription/Transcriber';
|
|
2
|
+
import type { SegmentSplitter } from '../splitting/SegmentSplitter';
|
|
3
|
+
import type { LineSplitter } from '../splitting/LineSplitter';
|
|
4
|
+
import type { WordSplitter } from '../splitting/WordSplitter';
|
|
5
|
+
import type { Tagger } from '../tagging/Tagger';
|
|
6
|
+
import type { Effect } from '../effect/Effect';
|
|
7
|
+
import type { SubtitleFrameRenderer, SubtitleStyle } from '../rendering/SubtitleFrameRenderer';
|
|
8
|
+
import type { OverlayFrameRenderer } from '../rendering/OverlayFrameRenderer';
|
|
9
|
+
import type { AlignmentConfig } from '../rendering/AlignmentConfig';
|
|
10
|
+
import type { RenderingConfig } from '../rendering/RenderingConfig';
|
|
11
|
+
import type { InlineStyleMap } from '../rendering/InlineStyleMap';
|
|
12
|
+
import type { CssResourceEmbedder } from '../css/CssResourceEmbedder';
|
|
13
|
+
import type { VideoRenderer } from '../video/VideoRenderer';
|
|
14
|
+
import type { OutputFormat, RenderQuality, RenderOutputChunk, AudioDiscardReason, FallbackDecoderInfo } from '../video/RenderJob';
|
|
15
|
+
import { RenderPipeline } from '../pipeline/RenderPipeline';
|
|
16
|
+
/**
|
|
17
|
+
* Knobs that drive the default segment splitter — a composite that
|
|
18
|
+
* first cuts on hard sentence boundaries and then enforces a
|
|
19
|
+
* weighted character budget per segment. Honoured only when no
|
|
20
|
+
* explicit `SegmentSplitter` is supplied.
|
|
21
|
+
*/
|
|
22
|
+
export interface DefaultSegmentSplitterConfig {
|
|
23
|
+
separators: ReadonlyArray<string>;
|
|
24
|
+
maxChars: number;
|
|
25
|
+
minChars: number;
|
|
26
|
+
scale: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Knobs that drive the default line splitter — pixel-balanced over a
|
|
30
|
+
* DOM-probed text measurer. `maxWidthRatio` is multiplied by the
|
|
31
|
+
* resolved output width to derive the absolute pixel budget per line.
|
|
32
|
+
* Honoured only when no explicit `LineSplitter` is supplied.
|
|
33
|
+
*/
|
|
34
|
+
export interface DefaultLineSplitterConfig {
|
|
35
|
+
maxLines: number;
|
|
36
|
+
minLines: number;
|
|
37
|
+
maxWidthRatio: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Fluent assembler that produces a {@link RenderPipeline} preloaded with
|
|
41
|
+
* sensible defaults for every stage of the render flow: an in-browser
|
|
42
|
+
* Whisper transcriber, a sentence + scaled-char segment splitter, a
|
|
43
|
+
* pixel-balanced line splitter (built lazily once output size is known),
|
|
44
|
+
* the structural tagger, no semantic taggers, no effects, and a
|
|
45
|
+
* MediaBunny-backed video renderer.
|
|
46
|
+
*
|
|
47
|
+
* Every `with*` method narrows one slot and leaves the rest at their
|
|
48
|
+
* defaults; defaults stay in place until explicitly replaced. The only
|
|
49
|
+
* required input is the source video — `build` throws otherwise.
|
|
50
|
+
*
|
|
51
|
+
* Two granularities for styling: single-style callers shape the default
|
|
52
|
+
* via `withCss`/`withAlignment`/`withRenderingConfig`/`withInlineStyles`
|
|
53
|
+
* (or replace it wholesale with `withSubtitleStyle`); multi-kind callers
|
|
54
|
+
* pass a full per-kind map through `withSubtitleStyles`. The default
|
|
55
|
+
* line splitter only fits the single-style path — `withSubtitleStyles`
|
|
56
|
+
* disables it unless the caller also supplies their own splitter.
|
|
57
|
+
*
|
|
58
|
+
* Tweaking the default splitters' parameters without rebuilding them
|
|
59
|
+
* goes through the symmetric `withDefaultSegmentSplitterConfig` /
|
|
60
|
+
* `withDefaultLineSplitterConfig`.
|
|
61
|
+
*/
|
|
62
|
+
export declare class RenderPipelineBuilder {
|
|
63
|
+
private video;
|
|
64
|
+
private transcriber;
|
|
65
|
+
private transcriberOptions;
|
|
66
|
+
private segmentSplitter;
|
|
67
|
+
private defaultSegmentSplitterConfig;
|
|
68
|
+
private lineSplitter;
|
|
69
|
+
private defaultLineSplitterConfig;
|
|
70
|
+
private wordSplitter;
|
|
71
|
+
private semanticTaggers;
|
|
72
|
+
private effects;
|
|
73
|
+
private style;
|
|
74
|
+
private explicitStyles;
|
|
75
|
+
private outputFormat;
|
|
76
|
+
private quality;
|
|
77
|
+
private outputResolution;
|
|
78
|
+
private outputStream;
|
|
79
|
+
private overlayHtml;
|
|
80
|
+
private onAudioDiscarded;
|
|
81
|
+
private confirmFallbackDecoder;
|
|
82
|
+
private videoRenderer;
|
|
83
|
+
private subtitleFrameRenderer;
|
|
84
|
+
private overlayFrameRenderer;
|
|
85
|
+
private cssResourceEmbedder;
|
|
86
|
+
withInputVideo(video: File | Blob): this;
|
|
87
|
+
withTranscriber(transcriber: Transcriber): this;
|
|
88
|
+
withTranscriberOptions(options: TranscriberOptions): this;
|
|
89
|
+
withSegmentSplitter(splitter: SegmentSplitter): this;
|
|
90
|
+
withDefaultSegmentSplitterConfig(partial: Partial<DefaultSegmentSplitterConfig>): this;
|
|
91
|
+
withLineSplitter(splitter: LineSplitter): this;
|
|
92
|
+
withDefaultLineSplitterConfig(partial: Partial<DefaultLineSplitterConfig>): this;
|
|
93
|
+
withWordSplitter(splitter: WordSplitter): this;
|
|
94
|
+
addTagger(tagger: Tagger): this;
|
|
95
|
+
withTaggers(taggers: ReadonlyArray<Tagger>): this;
|
|
96
|
+
addEffect(effect: Effect): this;
|
|
97
|
+
withEffects(effects: ReadonlyArray<Effect>): this;
|
|
98
|
+
withCss(css: string): this;
|
|
99
|
+
withAlignment(alignment: AlignmentConfig): this;
|
|
100
|
+
withRenderingConfig(rendering: RenderingConfig): this;
|
|
101
|
+
withInlineStyles(inlineStyles: InlineStyleMap): this;
|
|
102
|
+
/** Replaces the single-style default wholesale; subsequent style atajos layer on top of this. */
|
|
103
|
+
withSubtitleStyle(style: SubtitleStyle): this;
|
|
104
|
+
/**
|
|
105
|
+
* Switches to the multi-kind mode: the supplied map is passed to the
|
|
106
|
+
* video renderer as-is, the single-style default is no longer used,
|
|
107
|
+
* and the default line splitter is disabled (callers in this mode
|
|
108
|
+
* must supply their own via `withLineSplitter` if they want one).
|
|
109
|
+
*/
|
|
110
|
+
withSubtitleStyles(styles: Readonly<Record<string, SubtitleStyle>>): this;
|
|
111
|
+
withOutputFormat(format: OutputFormat): this;
|
|
112
|
+
withOutputResolution(width: number, height: number): this;
|
|
113
|
+
withQuality(quality: RenderQuality): this;
|
|
114
|
+
withOutputStream(stream: WritableStream<RenderOutputChunk>): this;
|
|
115
|
+
withOverlayHtml(html: string): this;
|
|
116
|
+
withOnAudioDiscarded(callback: (reason: AudioDiscardReason) => void): this;
|
|
117
|
+
withConfirmFallbackDecoder(callback: (info: FallbackDecoderInfo) => Promise<boolean>): this;
|
|
118
|
+
withVideoRenderer(renderer: VideoRenderer): this;
|
|
119
|
+
/**
|
|
120
|
+
* Feeds the default MediaBunny video renderer. Ignored if a full
|
|
121
|
+
* `VideoRenderer` was supplied via `withVideoRenderer`.
|
|
122
|
+
*/
|
|
123
|
+
withSubtitleFrameRenderer(renderer: SubtitleFrameRenderer): this;
|
|
124
|
+
/**
|
|
125
|
+
* Feeds the default MediaBunny video renderer. Ignored if a full
|
|
126
|
+
* `VideoRenderer` was supplied via `withVideoRenderer`.
|
|
127
|
+
*/
|
|
128
|
+
withOverlayFrameRenderer(renderer: OverlayFrameRenderer): this;
|
|
129
|
+
/**
|
|
130
|
+
* Feeds the default subtitle frame renderer. Ignored if a full
|
|
131
|
+
* `SubtitleFrameRenderer` or `VideoRenderer` was supplied.
|
|
132
|
+
*/
|
|
133
|
+
withCssResourceEmbedder(embedder: CssResourceEmbedder): this;
|
|
134
|
+
/** Materialises the pipeline. Throws if no input video has been supplied. */
|
|
135
|
+
build(): RenderPipeline;
|
|
136
|
+
private buildConfig;
|
|
137
|
+
private buildDefaultTranscriber;
|
|
138
|
+
private buildDefaultSegmentSplitter;
|
|
139
|
+
private buildDefaultVideoRenderer;
|
|
140
|
+
private buildDefaultSubtitleLayerSource;
|
|
141
|
+
private resolveSubtitleFrameRenderer;
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=RenderPipelineBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RenderPipelineBuilder.d.ts","sourceRoot":"","sources":["../../../src/modules/pipeline/RenderPipelineBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAG1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAKpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,EAAE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