@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,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No-op bridge used when the input has no audio or when its audio codec
|
|
3
|
+
* cannot be put into the chosen output container without a transcode
|
|
4
|
+
* step the host can't perform. The output ends up with no audio track.
|
|
5
|
+
*/
|
|
6
|
+
export class DiscardAudioTrackBridge {
|
|
7
|
+
async attachTo() {
|
|
8
|
+
}
|
|
9
|
+
async pumpUntil() {
|
|
10
|
+
}
|
|
11
|
+
async finish() {
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=DiscardAudioTrackBridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DiscardAudioTrackBridge.js","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/DiscardAudioTrackBridge.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAO,uBAAuB;IAElC,KAAK,CAAC,QAAQ;IACd,CAAC;IAED,KAAK,CAAC,SAAS;IACf,CAAC;IAED,KAAK,CAAC,MAAM;IACZ,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type AudioCodec, type InputAudioTrack, type Output } from 'mediabunny';
|
|
2
|
+
import type { AudioTrackBridge } from '../../../video/mediabunny/audio/AudioTrackBridge';
|
|
3
|
+
export interface PassthroughAudioTrackBridgeConfig {
|
|
4
|
+
inputTrack: InputAudioTrack;
|
|
5
|
+
codec: AudioCodec;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Copies the input's encoded audio packets straight into the output
|
|
9
|
+
* without decoding or re-encoding. The first packet carries the input's
|
|
10
|
+
* decoder config so downstream consumers can decode the rest.
|
|
11
|
+
*
|
|
12
|
+
* Requires that the chosen output container can hold the input audio
|
|
13
|
+
* codec; otherwise pick a different bridge or change the container.
|
|
14
|
+
*/
|
|
15
|
+
export declare class PassthroughAudioTrackBridge implements AudioTrackBridge {
|
|
16
|
+
private readonly config;
|
|
17
|
+
private readonly source;
|
|
18
|
+
private readonly sink;
|
|
19
|
+
private nextPacket;
|
|
20
|
+
private decoderConfig;
|
|
21
|
+
private firstPacketPending;
|
|
22
|
+
constructor(config: PassthroughAudioTrackBridgeConfig);
|
|
23
|
+
attachTo(output: Output): Promise<void>;
|
|
24
|
+
pumpUntil(videoTimestamp: number): Promise<void>;
|
|
25
|
+
finish(): Promise<void>;
|
|
26
|
+
private emit;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=PassthroughAudioTrackBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PassthroughAudioTrackBridge.d.ts","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,UAAU,EAEf,KAAK,eAAe,EACpB,KAAK,MAAM,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEzF,MAAM,WAAW,iCAAiC;IAChD,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,EAAE,UAAU,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,qBAAa,2BAA4B,YAAW,gBAAgB;IAQtD,OAAO,CAAC,QAAQ,CAAC,MAAM;IANnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;IAClD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAoB;IACzC,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,aAAa,CAAmC;IACxD,OAAO,CAAC,kBAAkB,CAAQ;gBAEL,MAAM,EAAE,iCAAiC;IAKhE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMvC,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOhD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;YAOf,IAAI;CAWnB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { EncodedAudioPacketSource, EncodedPacketSink, } from 'mediabunny';
|
|
2
|
+
/**
|
|
3
|
+
* Copies the input's encoded audio packets straight into the output
|
|
4
|
+
* without decoding or re-encoding. The first packet carries the input's
|
|
5
|
+
* decoder config so downstream consumers can decode the rest.
|
|
6
|
+
*
|
|
7
|
+
* Requires that the chosen output container can hold the input audio
|
|
8
|
+
* codec; otherwise pick a different bridge or change the container.
|
|
9
|
+
*/
|
|
10
|
+
export class PassthroughAudioTrackBridge {
|
|
11
|
+
config;
|
|
12
|
+
source;
|
|
13
|
+
sink;
|
|
14
|
+
nextPacket = null;
|
|
15
|
+
decoderConfig = null;
|
|
16
|
+
firstPacketPending = true;
|
|
17
|
+
constructor(config) {
|
|
18
|
+
this.config = config;
|
|
19
|
+
this.source = new EncodedAudioPacketSource(config.codec);
|
|
20
|
+
this.sink = new EncodedPacketSink(config.inputTrack);
|
|
21
|
+
}
|
|
22
|
+
async attachTo(output) {
|
|
23
|
+
output.addAudioTrack(this.source);
|
|
24
|
+
this.nextPacket = await this.sink.getFirstPacket();
|
|
25
|
+
this.decoderConfig = await this.config.inputTrack.getDecoderConfig();
|
|
26
|
+
}
|
|
27
|
+
async pumpUntil(videoTimestamp) {
|
|
28
|
+
while (this.nextPacket && this.nextPacket.timestamp <= videoTimestamp) {
|
|
29
|
+
await this.emit(this.nextPacket);
|
|
30
|
+
this.nextPacket = await this.sink.getNextPacket(this.nextPacket);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async finish() {
|
|
34
|
+
while (this.nextPacket) {
|
|
35
|
+
await this.emit(this.nextPacket);
|
|
36
|
+
this.nextPacket = await this.sink.getNextPacket(this.nextPacket);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async emit(packet) {
|
|
40
|
+
// Packets before t=0 (timestamp offsets from container metadata) are
|
|
41
|
+
// discarded — the output writer rejects negative timestamps.
|
|
42
|
+
if (packet.timestamp < 0)
|
|
43
|
+
return;
|
|
44
|
+
if (this.firstPacketPending && this.decoderConfig) {
|
|
45
|
+
await this.source.add(packet, { decoderConfig: this.decoderConfig });
|
|
46
|
+
this.firstPacketPending = false;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
await this.source.add(packet);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=PassthroughAudioTrackBridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PassthroughAudioTrackBridge.js","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,iBAAiB,GAKlB,MAAM,YAAY,CAAC;AAQpB;;;;;;;GAOG;AACH,MAAM,OAAO,2BAA2B;IAQT;IANZ,MAAM,CAA2B;IACjC,IAAI,CAAoB;IACjC,UAAU,GAAyB,IAAI,CAAC;IACxC,aAAa,GAA8B,IAAI,CAAC;IAChD,kBAAkB,GAAG,IAAI,CAAC;IAElC,YAA6B,MAAyC;QAAzC,WAAM,GAAN,MAAM,CAAmC;QACpE,IAAI,CAAC,MAAM,GAAG,IAAI,wBAAwB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,GAAG,IAAI,iBAAiB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACvD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAc;QAC3B,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;QACnD,IAAI,CAAC,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,cAAsB;QACpC,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,IAAI,cAAc,EAAE,CAAC;YACtE,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACjC,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;YACvB,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACjC,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,IAAI,CAAC,MAAqB;QACtC,qEAAqE;QACrE,6DAA6D;QAC7D,IAAI,MAAM,CAAC,SAAS,GAAG,CAAC;YAAE,OAAO;QACjC,IAAI,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YAClD,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;YACrE,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,OAAO;QACT,CAAC;QACD,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AudioCodec, type InputAudioTrack, type Output } from 'mediabunny';
|
|
2
|
+
import type { AudioTrackBridge } from '../../../video/mediabunny/audio/AudioTrackBridge';
|
|
3
|
+
export interface TranscodeAudioTrackBridgeConfig {
|
|
4
|
+
inputTrack: InputAudioTrack;
|
|
5
|
+
/** Target codec to encode into. Must be supported by the output container. */
|
|
6
|
+
codec: AudioCodec;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Decodes the input audio track and re-encodes it into the requested
|
|
10
|
+
* target codec on the fly. Used when the input's codec cannot be copied
|
|
11
|
+
* into the chosen output container as-is.
|
|
12
|
+
*/
|
|
13
|
+
export declare class TranscodeAudioTrackBridge implements AudioTrackBridge {
|
|
14
|
+
private readonly source;
|
|
15
|
+
private readonly sink;
|
|
16
|
+
private iterator;
|
|
17
|
+
private nextSample;
|
|
18
|
+
constructor(config: TranscodeAudioTrackBridgeConfig);
|
|
19
|
+
attachTo(output: Output): Promise<void>;
|
|
20
|
+
pumpUntil(videoTimestamp: number): Promise<void>;
|
|
21
|
+
finish(): Promise<void>;
|
|
22
|
+
private emit;
|
|
23
|
+
private advance;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=TranscodeAudioTrackBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranscodeAudioTrackBridge.d.ts","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,UAAU,EAEf,KAAK,eAAe,EACpB,KAAK,MAAM,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEzF,MAAM,WAAW,+BAA+B;IAC9C,UAAU,EAAE,eAAe,CAAC;IAC5B,8EAA8E;IAC9E,KAAK,EAAE,UAAU,CAAC;CACnB;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,gBAAgB;IAEhE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoB;IAC3C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAkB;IACvC,OAAO,CAAC,QAAQ,CAA2C;IAC3D,OAAO,CAAC,UAAU,CAA4B;gBAElC,MAAM,EAAE,+BAA+B;IAK7C,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMvC,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOhD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;YAOf,IAAI;YAYJ,OAAO;CAKtB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AudioSampleSink, AudioSampleSource, QUALITY_HIGH, } from 'mediabunny';
|
|
2
|
+
/**
|
|
3
|
+
* Decodes the input audio track and re-encodes it into the requested
|
|
4
|
+
* target codec on the fly. Used when the input's codec cannot be copied
|
|
5
|
+
* into the chosen output container as-is.
|
|
6
|
+
*/
|
|
7
|
+
export class TranscodeAudioTrackBridge {
|
|
8
|
+
source;
|
|
9
|
+
sink;
|
|
10
|
+
iterator = null;
|
|
11
|
+
nextSample = null;
|
|
12
|
+
constructor(config) {
|
|
13
|
+
this.source = new AudioSampleSource({ codec: config.codec, bitrate: QUALITY_HIGH });
|
|
14
|
+
this.sink = new AudioSampleSink(config.inputTrack);
|
|
15
|
+
}
|
|
16
|
+
async attachTo(output) {
|
|
17
|
+
output.addAudioTrack(this.source);
|
|
18
|
+
this.iterator = this.sink.samples()[Symbol.asyncIterator]();
|
|
19
|
+
this.nextSample = await this.advance();
|
|
20
|
+
}
|
|
21
|
+
async pumpUntil(videoTimestamp) {
|
|
22
|
+
while (this.nextSample && this.nextSample.timestamp <= videoTimestamp) {
|
|
23
|
+
await this.emit(this.nextSample);
|
|
24
|
+
this.nextSample = await this.advance();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async finish() {
|
|
28
|
+
while (this.nextSample) {
|
|
29
|
+
await this.emit(this.nextSample);
|
|
30
|
+
this.nextSample = await this.advance();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async emit(sample) {
|
|
34
|
+
try {
|
|
35
|
+
// Samples before t=0 (container offsets) are discarded because the
|
|
36
|
+
// muxer rejects negative timestamps.
|
|
37
|
+
if (sample.timestamp >= 0) {
|
|
38
|
+
await this.source.add(sample);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
sample.close();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async advance() {
|
|
46
|
+
if (!this.iterator)
|
|
47
|
+
return null;
|
|
48
|
+
const { value, done } = await this.iterator.next();
|
|
49
|
+
return done || !value ? null : value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=TranscodeAudioTrackBridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranscodeAudioTrackBridge.js","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,YAAY,GAKb,MAAM,YAAY,CAAC;AASpB;;;;GAIG;AACH,MAAM,OAAO,yBAAyB;IAEnB,MAAM,CAAoB;IAC1B,IAAI,CAAkB;IAC/B,QAAQ,GAAsC,IAAI,CAAC;IACnD,UAAU,GAAuB,IAAI,CAAC;IAE9C,YAAY,MAAuC;QACjD,IAAI,CAAC,MAAM,GAAG,IAAI,iBAAiB,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;QACpF,IAAI,CAAC,IAAI,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAc;QAC3B,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;QAC5D,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,cAAsB;QACpC,OAAO,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,IAAI,cAAc,EAAE,CAAC;YACtE,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACjC,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACzC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC;YACvB,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACjC,IAAI,CAAC,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACzC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,IAAI,CAAC,MAAmB;QACpC,IAAI,CAAC;YACH,mEAAmE;YACnE,qCAAqC;YACrC,IAAI,MAAM,CAAC,SAAS,IAAI,CAAC,EAAE,CAAC;gBAC1B,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAChC,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,OAAO;QACnB,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QAChC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnD,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Document } from '../../../document/Document';
|
|
2
|
+
import type { SubtitleFrame, SubtitleFrameRenderer, SubtitleStyle } from '../../../rendering/SubtitleFrameRenderer';
|
|
3
|
+
import type { DecodedVideoFrame } from '../../../video/mediabunny/frame/VideoFrameDecoder';
|
|
4
|
+
import type { SubtitleLayerSource } from '../../../video/mediabunny/caption/SubtitleLayerSource';
|
|
5
|
+
/**
|
|
6
|
+
* `SubtitleLayerSource` that renders ahead in chunks sized to the
|
|
7
|
+
* underlying renderer's preferred batch size, amortizing the fixed
|
|
8
|
+
* cost of a batch fetch across many video frames. The decoded video
|
|
9
|
+
* frame passed to `frameAt` is ignored.
|
|
10
|
+
*
|
|
11
|
+
* Picks the right strategy for sections whose stylesheets are
|
|
12
|
+
* independent of the underlying video pixels.
|
|
13
|
+
*
|
|
14
|
+
* Times handed to `frameAt` are expected to land on a caption tick
|
|
15
|
+
* (a multiple of the `captionInterval` supplied at `open`); the
|
|
16
|
+
* source rounds to absorb the FP roundtrip but does not snap from
|
|
17
|
+
* arbitrary timestamps.
|
|
18
|
+
*/
|
|
19
|
+
export declare class BatchedSubtitleLayerSource implements SubtitleLayerSource {
|
|
20
|
+
private readonly subtitleRenderer;
|
|
21
|
+
private captionInterval;
|
|
22
|
+
private batchSize;
|
|
23
|
+
private currentChunkFirstIdx;
|
|
24
|
+
private currentChunkFrames;
|
|
25
|
+
private opened;
|
|
26
|
+
constructor(subtitleRenderer: SubtitleFrameRenderer);
|
|
27
|
+
open(doc: Document, styles: Readonly<Record<string, SubtitleStyle>>, width: number, height: number, captionInterval: number): Promise<void>;
|
|
28
|
+
frameAt(time: number, _videoFrame: DecodedVideoFrame): Promise<SubtitleFrame | null>;
|
|
29
|
+
close(): void;
|
|
30
|
+
private loadNextChunk;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=BatchedSubtitleLayerSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BatchedSubtitleLayerSource.d.ts","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,aAAa,EACd,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAEjG;;;;;;;;;;;;;GAaG;AACH,qBAAa,0BAA2B,YAAW,mBAAmB;IAQxD,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAN7C,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,kBAAkB,CAA2C;IACrE,OAAO,CAAC,MAAM,CAAS;gBAEM,gBAAgB,EAAE,qBAAqB;IAE9D,IAAI,CACR,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,EAC/C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC;IAWV,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAS1F,KAAK,IAAI,IAAI;YAMC,aAAa;CAU5B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `SubtitleLayerSource` that renders ahead in chunks sized to the
|
|
3
|
+
* underlying renderer's preferred batch size, amortizing the fixed
|
|
4
|
+
* cost of a batch fetch across many video frames. The decoded video
|
|
5
|
+
* frame passed to `frameAt` is ignored.
|
|
6
|
+
*
|
|
7
|
+
* Picks the right strategy for sections whose stylesheets are
|
|
8
|
+
* independent of the underlying video pixels.
|
|
9
|
+
*
|
|
10
|
+
* Times handed to `frameAt` are expected to land on a caption tick
|
|
11
|
+
* (a multiple of the `captionInterval` supplied at `open`); the
|
|
12
|
+
* source rounds to absorb the FP roundtrip but does not snap from
|
|
13
|
+
* arbitrary timestamps.
|
|
14
|
+
*/
|
|
15
|
+
export class BatchedSubtitleLayerSource {
|
|
16
|
+
subtitleRenderer;
|
|
17
|
+
captionInterval = 0;
|
|
18
|
+
batchSize = 0;
|
|
19
|
+
currentChunkFirstIdx = 0;
|
|
20
|
+
currentChunkFrames = [];
|
|
21
|
+
opened = false;
|
|
22
|
+
constructor(subtitleRenderer) {
|
|
23
|
+
this.subtitleRenderer = subtitleRenderer;
|
|
24
|
+
}
|
|
25
|
+
async open(doc, styles, width, height, captionInterval) {
|
|
26
|
+
await this.subtitleRenderer.open(doc, styles, width, height);
|
|
27
|
+
this.captionInterval = captionInterval;
|
|
28
|
+
this.batchSize = await this.subtitleRenderer.getMaxBatchSize();
|
|
29
|
+
// Sentinel: the first `frameAt` call's while-condition fires one
|
|
30
|
+
// `loadNextChunk` that lands the resident window at index 0.
|
|
31
|
+
this.currentChunkFirstIdx = -this.batchSize;
|
|
32
|
+
this.currentChunkFrames = [];
|
|
33
|
+
this.opened = true;
|
|
34
|
+
}
|
|
35
|
+
async frameAt(time, _videoFrame) {
|
|
36
|
+
if (!this.opened)
|
|
37
|
+
return null;
|
|
38
|
+
const captionIdx = Math.round(time / this.captionInterval);
|
|
39
|
+
while (captionIdx >= this.currentChunkFirstIdx + this.batchSize) {
|
|
40
|
+
await this.loadNextChunk();
|
|
41
|
+
}
|
|
42
|
+
return this.currentChunkFrames[captionIdx - this.currentChunkFirstIdx] ?? null;
|
|
43
|
+
}
|
|
44
|
+
close() {
|
|
45
|
+
this.subtitleRenderer.close();
|
|
46
|
+
this.currentChunkFrames = [];
|
|
47
|
+
this.opened = false;
|
|
48
|
+
}
|
|
49
|
+
async loadNextChunk() {
|
|
50
|
+
this.currentChunkFirstIdx += this.batchSize;
|
|
51
|
+
const timestamps = [];
|
|
52
|
+
for (let i = 0; i < this.batchSize; i++) {
|
|
53
|
+
// Each timestamp is freshly computed from its absolute index
|
|
54
|
+
// to avoid floating-point accumulation drift across long videos.
|
|
55
|
+
timestamps.push((this.currentChunkFirstIdx + i) * this.captionInterval);
|
|
56
|
+
}
|
|
57
|
+
this.currentChunkFrames = await this.subtitleRenderer.getFrames(timestamps);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=BatchedSubtitleLayerSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BatchedSubtitleLayerSource.js","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.ts"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,0BAA0B;IAQR;IANrB,eAAe,GAAG,CAAC,CAAC;IACpB,SAAS,GAAG,CAAC,CAAC;IACd,oBAAoB,GAAG,CAAC,CAAC;IACzB,kBAAkB,GAAwC,EAAE,CAAC;IAC7D,MAAM,GAAG,KAAK,CAAC;IAEvB,YAA6B,gBAAuC;QAAvC,qBAAgB,GAAhB,gBAAgB,CAAuB;IAAG,CAAC;IAExE,KAAK,CAAC,IAAI,CACR,GAAa,EACb,MAA+C,EAC/C,KAAa,EACb,MAAc,EACd,eAAuB;QAEvB,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAC7D,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,SAAS,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,CAAC;QAC/D,iEAAiE;QACjE,6DAA6D;QAC7D,IAAI,CAAC,oBAAoB,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;QAC5C,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,WAA8B;QACxD,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QAC9B,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC;QAC3D,OAAO,UAAU,IAAI,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;YAChE,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC7B,CAAC;QACD,OAAO,IAAI,CAAC,kBAAkB,CAAC,UAAU,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,IAAI,CAAC;IACjF,CAAC;IAED,KAAK;QACH,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAEO,KAAK,CAAC,aAAa;QACzB,IAAI,CAAC,oBAAoB,IAAI,IAAI,CAAC,SAAS,CAAC;QAC5C,MAAM,UAAU,GAAa,EAAE,CAAC;QAChC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,6DAA6D;YAC7D,iEAAiE;YACjE,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,oBAAoB,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC;QAC1E,CAAC;QACD,IAAI,CAAC,kBAAkB,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9E,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Document } from '../../../document/Document';
|
|
2
|
+
import type { SubtitleFrame, SubtitleStyle } from '../../../rendering/SubtitleFrameRenderer';
|
|
3
|
+
import type { DecodedVideoFrame } from '../../../video/mediabunny/frame/VideoFrameDecoder';
|
|
4
|
+
import type { SubtitleLayerSource } from '../../../video/mediabunny/caption/SubtitleLayerSource';
|
|
5
|
+
/**
|
|
6
|
+
* Composes two `SubtitleLayerSource`s, routing each Section to one
|
|
7
|
+
* of them by whether its style declares
|
|
8
|
+
* `rendering.videoFrame.required`. Snaps the time of each
|
|
9
|
+
* `frameAt` call to the nearest caption tick and merges the rasters
|
|
10
|
+
* produced by sub-sources with active sections into a single frame.
|
|
11
|
+
*
|
|
12
|
+
* `frameAt` expects monotonically advancing times.
|
|
13
|
+
*/
|
|
14
|
+
export declare class ComposedSubtitleLayerSource implements SubtitleLayerSource {
|
|
15
|
+
private readonly batchedSource;
|
|
16
|
+
private readonly videoBoundSource;
|
|
17
|
+
private captionInterval;
|
|
18
|
+
private captionIdx;
|
|
19
|
+
private readonly openedSources;
|
|
20
|
+
constructor(batchedSource: SubtitleLayerSource, videoBoundSource: SubtitleLayerSource);
|
|
21
|
+
open(doc: Document, styles: Readonly<Record<string, SubtitleStyle>>, width: number, height: number, captionInterval: number): Promise<void>;
|
|
22
|
+
frameAt(time: number, videoFrame: DecodedVideoFrame): Promise<SubtitleFrame | null>;
|
|
23
|
+
close(): void;
|
|
24
|
+
private partitionStyles;
|
|
25
|
+
private advanceCaptionIdxToTime;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=ComposedSubtitleLayerSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComposedSubtitleLayerSource.d.ts","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACd,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAC;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAajG;;;;;;;;GAQG;AACH,qBAAa,2BAA4B,YAAW,mBAAmB;IAOnE,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IANnC,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA6B;gBAGxC,aAAa,EAAE,mBAAmB,EAClC,gBAAgB,EAAE,mBAAmB;IAGlD,IAAI,CACR,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,EAC/C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC;IAcV,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IASzF,KAAK,IAAI,IAAI;IAKb,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,uBAAuB;CAOhC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { LayeredSubtitleFrame } from '../../../rendering/LayeredSubtitleFrame';
|
|
2
|
+
// 1 µs tolerance: absorbs IEEE-754 rounding at exact interval
|
|
3
|
+
// boundaries (a video frame whose timestamp matches a caption
|
|
4
|
+
// midpoint to the last few ULPs) without affecting any real
|
|
5
|
+
// sub-frame difference.
|
|
6
|
+
const CAPTION_BOUNDARY_EPSILON_S = 1e-6;
|
|
7
|
+
/**
|
|
8
|
+
* Composes two `SubtitleLayerSource`s, routing each Section to one
|
|
9
|
+
* of them by whether its style declares
|
|
10
|
+
* `rendering.videoFrame.required`. Snaps the time of each
|
|
11
|
+
* `frameAt` call to the nearest caption tick and merges the rasters
|
|
12
|
+
* produced by sub-sources with active sections into a single frame.
|
|
13
|
+
*
|
|
14
|
+
* `frameAt` expects monotonically advancing times.
|
|
15
|
+
*/
|
|
16
|
+
export class ComposedSubtitleLayerSource {
|
|
17
|
+
batchedSource;
|
|
18
|
+
videoBoundSource;
|
|
19
|
+
captionInterval = 0;
|
|
20
|
+
captionIdx = 0;
|
|
21
|
+
openedSources = [];
|
|
22
|
+
constructor(batchedSource, videoBoundSource) {
|
|
23
|
+
this.batchedSource = batchedSource;
|
|
24
|
+
this.videoBoundSource = videoBoundSource;
|
|
25
|
+
}
|
|
26
|
+
async open(doc, styles, width, height, captionInterval) {
|
|
27
|
+
this.captionInterval = captionInterval;
|
|
28
|
+
this.captionIdx = 0;
|
|
29
|
+
const { batched, videoBound } = this.partitionStyles(styles);
|
|
30
|
+
if (Object.keys(batched).length > 0) {
|
|
31
|
+
await this.batchedSource.open(doc, batched, width, height, captionInterval);
|
|
32
|
+
this.openedSources.push(this.batchedSource);
|
|
33
|
+
}
|
|
34
|
+
if (Object.keys(videoBound).length > 0) {
|
|
35
|
+
await this.videoBoundSource.open(doc, videoBound, width, height, captionInterval);
|
|
36
|
+
this.openedSources.push(this.videoBoundSource);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async frameAt(time, videoFrame) {
|
|
40
|
+
this.captionIdx = this.advanceCaptionIdxToTime(this.captionIdx, time);
|
|
41
|
+
const captionTime = this.captionIdx * this.captionInterval;
|
|
42
|
+
const layers = await Promise.all(this.openedSources.map((source) => source.frameAt(captionTime, videoFrame)));
|
|
43
|
+
return LayeredSubtitleFrame.from(...layers);
|
|
44
|
+
}
|
|
45
|
+
close() {
|
|
46
|
+
for (const source of this.openedSources)
|
|
47
|
+
source.close();
|
|
48
|
+
this.openedSources.length = 0;
|
|
49
|
+
}
|
|
50
|
+
partitionStyles(styles) {
|
|
51
|
+
const batched = {};
|
|
52
|
+
const videoBound = {};
|
|
53
|
+
for (const [kind, style] of Object.entries(styles)) {
|
|
54
|
+
if (style.rendering.videoFrame.required)
|
|
55
|
+
videoBound[kind] = style;
|
|
56
|
+
else
|
|
57
|
+
batched[kind] = style;
|
|
58
|
+
}
|
|
59
|
+
return { batched, videoBound };
|
|
60
|
+
}
|
|
61
|
+
// Caption N covers `[(N-0.5)·interval, (N+0.5)·interval)`. This
|
|
62
|
+
// halves the worst-case timing error vs. floor-only mapping at
|
|
63
|
+
// the cost of letting a caption appear up to `interval/2` early.
|
|
64
|
+
advanceCaptionIdxToTime(currentIdx, time) {
|
|
65
|
+
let idx = currentIdx;
|
|
66
|
+
while ((idx + 0.5) * this.captionInterval <= time + CAPTION_BOUNDARY_EPSILON_S) {
|
|
67
|
+
idx++;
|
|
68
|
+
}
|
|
69
|
+
return idx;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=ComposedSubtitleLayerSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComposedSubtitleLayerSource.js","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAI/E,8DAA8D;AAC9D,8DAA8D;AAC9D,4DAA4D;AAC5D,wBAAwB;AACxB,MAAM,0BAA0B,GAAG,IAAI,CAAC;AAOxC;;;;;;;;GAQG;AACH,MAAM,OAAO,2BAA2B;IAOnB;IACA;IANX,eAAe,GAAG,CAAC,CAAC;IACpB,UAAU,GAAG,CAAC,CAAC;IACN,aAAa,GAA0B,EAAE,CAAC;IAE3D,YACmB,aAAkC,EAClC,gBAAqC;QADrC,kBAAa,GAAb,aAAa,CAAqB;QAClC,qBAAgB,GAAhB,gBAAgB,CAAqB;IACrD,CAAC;IAEJ,KAAK,CAAC,IAAI,CACR,GAAa,EACb,MAA+C,EAC/C,KAAa,EACb,MAAc,EACd,eAAuB;QAEvB,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC7D,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;YAC5E,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC9C,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvC,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;YAClF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,UAA6B;QACvD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACtE,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC;QAC3D,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAC9B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAC5E,CAAC;QACF,OAAO,oBAAoB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK;QACH,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,aAAa;YAAE,MAAM,CAAC,KAAK,EAAE,CAAC;QACxD,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC;IAChC,CAAC;IAEO,eAAe,CAAC,MAA+C;QACrE,MAAM,OAAO,GAAkC,EAAE,CAAC;QAClD,MAAM,UAAU,GAAkC,EAAE,CAAC;QACrD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACnD,IAAI,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,QAAQ;gBAAE,UAAU,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;;gBAC7D,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QAC7B,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;IACjC,CAAC;IAED,gEAAgE;IAChE,+DAA+D;IAC/D,iEAAiE;IACzD,uBAAuB,CAAC,UAAkB,EAAE,IAAY;QAC9D,IAAI,GAAG,GAAG,UAAU,CAAC;QACrB,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,eAAe,IAAI,IAAI,GAAG,0BAA0B,EAAE,CAAC;YAC/E,GAAG,EAAE,CAAC;QACR,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Document } from '../../../document/Document';
|
|
2
|
+
import type { SubtitleFrame, SubtitleStyle } from '../../../rendering/SubtitleFrameRenderer';
|
|
3
|
+
import type { DecodedVideoFrame } from '../../../video/mediabunny/frame/VideoFrameDecoder';
|
|
4
|
+
/**
|
|
5
|
+
* Produces one caption raster per video frame for a render.
|
|
6
|
+
*
|
|
7
|
+
* Lifecycle is per-render: {@link open} prepares the source for a
|
|
8
|
+
* specific document and style set, {@link frameAt} services each
|
|
9
|
+
* video frame of that render in monotonically advancing `time`
|
|
10
|
+
* order, and {@link close} releases the underlying resources.
|
|
11
|
+
* Open/close pairs may repeat against the same instance, but a
|
|
12
|
+
* source cannot serve two renders concurrently.
|
|
13
|
+
*/
|
|
14
|
+
export interface SubtitleLayerSource {
|
|
15
|
+
/**
|
|
16
|
+
* Prepares the source for a render at the given dimensions, scoped
|
|
17
|
+
* to `styles` keyed by `Section.kind`.
|
|
18
|
+
*
|
|
19
|
+
* @param captionInterval Seconds between successive caption ticks.
|
|
20
|
+
*/
|
|
21
|
+
open(doc: Document, styles: Readonly<Record<string, SubtitleStyle>>, width: number, height: number, captionInterval: number): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Resolves to the caption raster at `time`, or `null` when no
|
|
24
|
+
* Section served by this source is active.
|
|
25
|
+
*
|
|
26
|
+
* @param time Presentation timestamp of `videoFrame` in seconds.
|
|
27
|
+
* @param videoFrame Decoded video frame at `time`.
|
|
28
|
+
*/
|
|
29
|
+
frameAt(time: number, videoFrame: DecodedVideoFrame): Promise<SubtitleFrame | null>;
|
|
30
|
+
close(): void;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=SubtitleLayerSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubtitleLayerSource.d.ts","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/caption/SubtitleLayerSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACd,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAC;AAE3F;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,IAAI,CACF,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,EAC/C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjB;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAEpF,KAAK,IAAI,IAAI,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubtitleLayerSource.js","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/caption/SubtitleLayerSource.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Document } from '../../../document/Document';
|
|
2
|
+
import type { SubtitleFrame, SubtitleFrameRenderer, SubtitleStyle } from '../../../rendering/SubtitleFrameRenderer';
|
|
3
|
+
import type { DecodedVideoFrame } from '../../../video/mediabunny/frame/VideoFrameDecoder';
|
|
4
|
+
import type { SubtitleLayerSource } from '../../../video/mediabunny/caption/SubtitleLayerSource';
|
|
5
|
+
/**
|
|
6
|
+
* `SubtitleLayerSource` that publishes each decoded video frame into
|
|
7
|
+
* a single-slot `VideoFrameSource` and asks the underlying renderer
|
|
8
|
+
* for the matching caption tile, one render per call. The
|
|
9
|
+
* `captionInterval` argument is unused; the cadence is whatever the
|
|
10
|
+
* caller drives `frameAt` at.
|
|
11
|
+
*
|
|
12
|
+
* Picks the right strategy for sections whose stylesheets sample the
|
|
13
|
+
* underlying video pixels (background-image filters, blur sourced
|
|
14
|
+
* from the frame, etc.). The per-call render is expensive — use
|
|
15
|
+
* only for the style subset that genuinely needs the sampling.
|
|
16
|
+
*/
|
|
17
|
+
export declare class VideoBoundSubtitleLayerSource implements SubtitleLayerSource {
|
|
18
|
+
private readonly subtitleRenderer;
|
|
19
|
+
private videoFrameSource;
|
|
20
|
+
constructor(subtitleRenderer: SubtitleFrameRenderer);
|
|
21
|
+
open(doc: Document, styles: Readonly<Record<string, SubtitleStyle>>, width: number, height: number, _captionInterval: number): Promise<void>;
|
|
22
|
+
frameAt(time: number, videoFrame: DecodedVideoFrame): Promise<SubtitleFrame | null>;
|
|
23
|
+
close(): void;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=VideoBoundSubtitleLayerSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VideoBoundSubtitleLayerSource.d.ts","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,aAAa,EACd,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mDAAmD,CAAC;AAE3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAEjG;;;;;;;;;;;GAWG;AACH,qBAAa,6BAA8B,YAAW,mBAAmB;IAI3D,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAF7C,OAAO,CAAC,gBAAgB,CAAwC;gBAEnC,gBAAgB,EAAE,qBAAqB;IAE9D,IAAI,CACR,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,EAC/C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;IAKV,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAQzF,KAAK,IAAI,IAAI;CAId"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { CurrentFrameVideoSource } from '../../../video/mediabunny/frame/CurrentFrameVideoSource';
|
|
2
|
+
/**
|
|
3
|
+
* `SubtitleLayerSource` that publishes each decoded video frame into
|
|
4
|
+
* a single-slot `VideoFrameSource` and asks the underlying renderer
|
|
5
|
+
* for the matching caption tile, one render per call. The
|
|
6
|
+
* `captionInterval` argument is unused; the cadence is whatever the
|
|
7
|
+
* caller drives `frameAt` at.
|
|
8
|
+
*
|
|
9
|
+
* Picks the right strategy for sections whose stylesheets sample the
|
|
10
|
+
* underlying video pixels (background-image filters, blur sourced
|
|
11
|
+
* from the frame, etc.). The per-call render is expensive — use
|
|
12
|
+
* only for the style subset that genuinely needs the sampling.
|
|
13
|
+
*/
|
|
14
|
+
export class VideoBoundSubtitleLayerSource {
|
|
15
|
+
subtitleRenderer;
|
|
16
|
+
videoFrameSource = null;
|
|
17
|
+
constructor(subtitleRenderer) {
|
|
18
|
+
this.subtitleRenderer = subtitleRenderer;
|
|
19
|
+
}
|
|
20
|
+
async open(doc, styles, width, height, _captionInterval) {
|
|
21
|
+
this.videoFrameSource = new CurrentFrameVideoSource(width, height);
|
|
22
|
+
await this.subtitleRenderer.open(doc, styles, width, height, this.videoFrameSource);
|
|
23
|
+
}
|
|
24
|
+
async frameAt(time, videoFrame) {
|
|
25
|
+
if (!this.videoFrameSource)
|
|
26
|
+
return null;
|
|
27
|
+
// Publish before fetching: the renderer's stylesheets pull the
|
|
28
|
+
// frame back through `videoFrameSource` while `getFrame` runs.
|
|
29
|
+
this.videoFrameSource.setCurrent(time, videoFrame);
|
|
30
|
+
return this.subtitleRenderer.getFrame(time);
|
|
31
|
+
}
|
|
32
|
+
close() {
|
|
33
|
+
this.subtitleRenderer.close();
|
|
34
|
+
this.videoFrameSource = null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=VideoBoundSubtitleLayerSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VideoBoundSubtitleLayerSource.js","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAGlG;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,6BAA6B;IAIX;IAFrB,gBAAgB,GAAmC,IAAI,CAAC;IAEhE,YAA6B,gBAAuC;QAAvC,qBAAgB,GAAhB,gBAAgB,CAAuB;IAAG,CAAC;IAExE,KAAK,CAAC,IAAI,CACR,GAAa,EACb,MAA+C,EAC/C,KAAa,EACb,MAAc,EACd,gBAAwB;QAExB,IAAI,CAAC,gBAAgB,GAAG,IAAI,uBAAuB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACnE,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACtF,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,UAA6B;QACvD,IAAI,CAAC,IAAI,CAAC,gBAAgB;YAAE,OAAO,IAAI,CAAC;QACxC,+DAA+D;QAC/D,+DAA+D;QAC/D,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK;QACH,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,CAAC;QAC9B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { VideoCodec } from 'mediabunny';
|
|
2
|
+
import type { RenderQuality } from '../../../video/RenderJob';
|
|
3
|
+
export interface VideoCodecResolutionRequest {
|
|
4
|
+
/** Codecs the chosen output container can hold. */
|
|
5
|
+
supportedCodecs: VideoCodec[];
|
|
6
|
+
/** Display width of the input video, in pixels. */
|
|
7
|
+
width: number;
|
|
8
|
+
/** Display height of the input video, in pixels. */
|
|
9
|
+
height: number;
|
|
10
|
+
/** Average frame rate of the input video, in Hz. */
|
|
11
|
+
fps: number;
|
|
12
|
+
/** Subjective quality preset selected by the caller. */
|
|
13
|
+
quality: RenderQuality | undefined;
|
|
14
|
+
}
|
|
15
|
+
export interface VideoCodecResolution {
|
|
16
|
+
codec: VideoCodec;
|
|
17
|
+
/** Target bitrate in bits per second. */
|
|
18
|
+
bitrate: number;
|
|
19
|
+
bitrateMode: 'constant' | 'variable';
|
|
20
|
+
latencyMode: 'quality' | 'realtime';
|
|
21
|
+
/** Optional hint about the content being encoded, e.g. `'text'` for high-contrast overlays. */
|
|
22
|
+
contentHint?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Resolves codec, bitrate and encoder knobs for a render.
|
|
26
|
+
*
|
|
27
|
+
* Throws if no codec in `supportedCodecs` can be encoded by the host.
|
|
28
|
+
*/
|
|
29
|
+
export interface CodecPolicy {
|
|
30
|
+
resolveVideo(request: VideoCodecResolutionRequest): Promise<VideoCodecResolution>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=CodecPolicy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodecPolicy.d.ts","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/codec/CodecPolicy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,WAAW,2BAA2B;IAC1C,mDAAmD;IACnD,eAAe,EAAE,UAAU,EAAE,CAAC;IAC9B,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,GAAG,EAAE,MAAM,CAAC;IACZ,wDAAwD;IACxD,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;CACpC;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,UAAU,CAAC;IAClB,yCAAyC;IACzC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,UAAU,GAAG,UAAU,CAAC;IACrC,WAAW,EAAE,SAAS,GAAG,UAAU,CAAC;IACpC,+FAA+F;IAC/F,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACnF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodecPolicy.js","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/codec/CodecPolicy.ts"],"names":[],"mappings":""}
|