@tscaps/engine 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -8
- package/dist/modules/document/CssVariable.d.ts +6 -0
- package/dist/modules/document/CssVariable.d.ts.map +1 -1
- package/dist/modules/document/CssVariable.js +6 -0
- package/dist/modules/document/CssVariable.js.map +1 -1
- package/dist/modules/document/Document.d.ts +3 -0
- package/dist/modules/document/Document.d.ts.map +1 -1
- package/dist/modules/document/Document.js +12 -1
- package/dist/modules/document/Document.js.map +1 -1
- package/dist/modules/document/DocumentEditor.d.ts +16 -4
- package/dist/modules/document/DocumentEditor.d.ts.map +1 -1
- package/dist/modules/document/DocumentEditor.js +14 -10
- package/dist/modules/document/DocumentEditor.js.map +1 -1
- package/dist/modules/document/Line.d.ts +6 -0
- package/dist/modules/document/Line.d.ts.map +1 -1
- package/dist/modules/document/Line.js +10 -0
- package/dist/modules/document/Line.js.map +1 -1
- package/dist/modules/document/Word.d.ts +8 -0
- package/dist/modules/document/Word.d.ts.map +1 -1
- package/dist/modules/document/Word.js +11 -1
- package/dist/modules/document/Word.js.map +1 -1
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts +1 -1
- package/dist/modules/pipeline/RenderPipelineBuilder.d.ts.map +1 -1
- package/dist/modules/pipeline/RenderPipelineBuilder.js +15 -5
- package/dist/modules/pipeline/RenderPipelineBuilder.js.map +1 -1
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts +18 -8
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js +27 -21
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js.map +1 -1
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts +41 -33
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/index.d.ts +4 -0
- package/dist/modules/rendering/index.d.ts.map +1 -1
- package/dist/modules/rendering/index.js +2 -0
- package/dist/modules/rendering/index.js.map +1 -1
- package/dist/modules/rendering/subtitle/ActiveRenderSession.d.ts +13 -6
- package/dist/modules/rendering/subtitle/ActiveRenderSession.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/ActiveRenderSession.js +16 -9
- package/dist/modules/rendering/subtitle/ActiveRenderSession.js.map +1 -1
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.d.ts +5 -2
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js +26 -8
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js.map +1 -1
- package/dist/modules/rendering/subtitle/AnimationStateFingerprint.d.ts +20 -0
- package/dist/modules/rendering/subtitle/AnimationStateFingerprint.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/AnimationStateFingerprint.js +2 -0
- package/dist/modules/rendering/subtitle/AnimationStateFingerprint.js.map +1 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.d.ts +4 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.js +8 -0
- package/dist/modules/rendering/subtitle/AssetGroupBuilder.js.map +1 -1
- package/dist/modules/rendering/subtitle/BatchPlanner.d.ts +50 -5
- package/dist/modules/rendering/subtitle/BatchPlanner.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/BatchPlanner.js +97 -15
- package/dist/modules/rendering/subtitle/BatchPlanner.js.map +1 -1
- package/dist/modules/rendering/subtitle/ElementWidthMeasurer.d.ts +56 -0
- package/dist/modules/rendering/subtitle/ElementWidthMeasurer.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/ElementWidthMeasurer.js +119 -0
- package/dist/modules/rendering/subtitle/ElementWidthMeasurer.js.map +1 -0
- package/dist/modules/rendering/subtitle/ElementWidths.d.ts +23 -0
- package/dist/modules/rendering/subtitle/ElementWidths.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/ElementWidths.js +29 -0
- package/dist/modules/rendering/subtitle/ElementWidths.js.map +1 -0
- package/dist/modules/rendering/subtitle/ImageDecodeSpriteSheetRasterProbe.d.ts +18 -0
- package/dist/modules/rendering/subtitle/ImageDecodeSpriteSheetRasterProbe.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/ImageDecodeSpriteSheetRasterProbe.js +42 -0
- package/dist/modules/rendering/subtitle/ImageDecodeSpriteSheetRasterProbe.js.map +1 -0
- package/dist/modules/rendering/subtitle/KeyframeScanAnimationStateFingerprint.d.ts +35 -0
- package/dist/modules/rendering/subtitle/KeyframeScanAnimationStateFingerprint.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/KeyframeScanAnimationStateFingerprint.js +64 -0
- package/dist/modules/rendering/subtitle/KeyframeScanAnimationStateFingerprint.js.map +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.d.ts +2 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.js +12 -1
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.js.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentAnchorVarsBuilder.d.ts +28 -0
- package/dist/modules/rendering/subtitle/SegmentAnchorVarsBuilder.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentAnchorVarsBuilder.js +23 -0
- package/dist/modules/rendering/subtitle/SegmentAnchorVarsBuilder.js.map +1 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.d.ts +3 -0
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js +12 -3
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts +7 -1
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js +23 -5
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js.map +1 -1
- package/dist/modules/rendering/subtitle/SpriteSheetProbeObserver.d.ts +29 -0
- package/dist/modules/rendering/subtitle/SpriteSheetProbeObserver.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetProbeObserver.js +2 -0
- package/dist/modules/rendering/subtitle/SpriteSheetProbeObserver.js.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetRasterProbe.d.ts +19 -0
- package/dist/modules/rendering/subtitle/SpriteSheetRasterProbe.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetRasterProbe.js +2 -0
- package/dist/modules/rendering/subtitle/SpriteSheetRasterProbe.js.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProbe.d.ts +31 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProbe.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProbe.js +89 -0
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProbe.js.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationReading.d.ts +49 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationReading.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationReading.js +87 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationReading.js.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationSupport.d.ts +17 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationSupport.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationSupport.js +53 -0
- package/dist/modules/rendering/subtitle/SubtreeAnimationSupport.js.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeMountAnimationStateFingerprint.d.ts +62 -0
- package/dist/modules/rendering/subtitle/SubtreeMountAnimationStateFingerprint.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SubtreeMountAnimationStateFingerprint.js +153 -0
- package/dist/modules/rendering/subtitle/SubtreeMountAnimationStateFingerprint.js.map +1 -0
- package/dist/modules/rendering/subtitle/SvgFilterStateFingerprint.d.ts +47 -0
- package/dist/modules/rendering/subtitle/SvgFilterStateFingerprint.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/SvgFilterStateFingerprint.js +69 -0
- package/dist/modules/rendering/subtitle/SvgFilterStateFingerprint.js.map +1 -0
- package/dist/modules/rendering/subtitle/UnknownAnimationStateFingerprint.d.ts +9 -0
- package/dist/modules/rendering/subtitle/UnknownAnimationStateFingerprint.d.ts.map +1 -0
- package/dist/modules/rendering/subtitle/UnknownAnimationStateFingerprint.js +10 -0
- package/dist/modules/rendering/subtitle/UnknownAnimationStateFingerprint.js.map +1 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.js +2 -0
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.js.map +1 -1
- package/dist/modules/rendering/types/ElementRenderOverrides.d.ts +2 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.d.ts.map +1 -1
- package/dist/modules/rendering/types/ElementRenderOverrides.js +4 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.js.map +1 -1
- package/dist/modules/splitting/BalancedLineSplitter.d.ts +9 -0
- package/dist/modules/splitting/BalancedLineSplitter.d.ts.map +1 -1
- package/dist/modules/splitting/BalancedLineSplitter.js +15 -3
- package/dist/modules/splitting/BalancedLineSplitter.js.map +1 -1
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts +1 -4
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts.map +1 -1
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js +5 -7
- package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js.map +1 -1
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts +16 -7
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts.map +1 -1
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js +44 -33
- package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js.map +1 -1
- package/dist/modules/splitting/TextMeasurer.d.ts +9 -4
- package/dist/modules/splitting/TextMeasurer.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilter.d.ts +9 -0
- package/dist/modules/svg-filter/SvgFilter.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilter.js +17 -0
- package/dist/modules/svg-filter/SvgFilter.js.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts +7 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefinitions.js +17 -0
- package/dist/modules/svg-filter/SvgFilterDefinitions.js.map +1 -1
- package/dist/modules/tagging/RegexTagger.js +1 -2
- package/dist/modules/tagging/RegexTagger.js.map +1 -1
- package/dist/modules/tagging/SpanTagger.js +1 -2
- package/dist/modules/tagging/SpanTagger.js.map +1 -1
- package/dist/modules/tagging/StructureTagger.js +1 -2
- package/dist/modules/tagging/StructureTagger.js.map +1 -1
- package/dist/modules/tagging/WordlistTagger.js +1 -2
- package/dist/modules/tagging/WordlistTagger.js.map +1 -1
- package/dist/modules/transcription/AudioSegmentLayout.d.ts +23 -0
- package/dist/modules/transcription/AudioSegmentLayout.d.ts.map +1 -0
- package/dist/modules/transcription/AudioSegmentLayout.js +40 -0
- package/dist/modules/transcription/AudioSegmentLayout.js.map +1 -0
- package/dist/modules/transcription/FallbackAudioDecoder.d.ts +25 -0
- package/dist/modules/transcription/FallbackAudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/FallbackAudioDecoder.js +46 -0
- package/dist/modules/transcription/FallbackAudioDecoder.js.map +1 -0
- package/dist/modules/transcription/MediaBunnyAudioOnlyRemuxer.d.ts +71 -0
- package/dist/modules/transcription/MediaBunnyAudioOnlyRemuxer.d.ts.map +1 -0
- package/dist/modules/transcription/MediaBunnyAudioOnlyRemuxer.js +145 -0
- package/dist/modules/transcription/MediaBunnyAudioOnlyRemuxer.js.map +1 -0
- package/dist/modules/transcription/WebAudioAudioDecoder.d.ts +46 -0
- package/dist/modules/transcription/WebAudioAudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/WebAudioAudioDecoder.js +123 -0
- package/dist/modules/transcription/WebAudioAudioDecoder.js.map +1 -0
- package/dist/modules/transcription/index.d.ts +4 -0
- package/dist/modules/transcription/index.d.ts.map +1 -1
- package/dist/modules/transcription/index.js +3 -0
- package/dist/modules/transcription/index.js.map +1 -1
- package/dist/modules/video/RenderJob.d.ts +23 -0
- package/dist/modules/video/RenderJob.d.ts.map +1 -1
- package/dist/modules/video/index.d.ts +5 -3
- package/dist/modules/video/index.d.ts.map +1 -1
- package/dist/modules/video/index.js +2 -0
- package/dist/modules/video/index.js.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.d.ts +33 -1
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.js +97 -20
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.js.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js +1 -0
- package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js.map +1 -1
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts +20 -9
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js +56 -14
- package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js.map +1 -1
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts +29 -10
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js +48 -17
- package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js.map +1 -1
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts +28 -11
- package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts +33 -12
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js +53 -18
- package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js.map +1 -1
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js +7 -3
- package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js.map +1 -1
- package/dist/modules/video/mediabunny/frame/BufferedVideoFrameSource.d.ts +45 -0
- package/dist/modules/video/mediabunny/frame/BufferedVideoFrameSource.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/BufferedVideoFrameSource.js +93 -0
- package/dist/modules/video/mediabunny/frame/BufferedVideoFrameSource.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js +3 -1
- package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js.map +1 -1
- package/dist/modules/video/mediabunny/frame/RetainedVideoFrame.d.ts +26 -0
- package/dist/modules/video/mediabunny/frame/RetainedVideoFrame.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/RetainedVideoFrame.js +55 -0
- package/dist/modules/video/mediabunny/frame/RetainedVideoFrame.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts +6 -1
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderSelectionFailedError.d.ts +14 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderSelectionFailedError.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderSelectionFailedError.js +14 -0
- package/dist/modules/video/mediabunny/frame/VideoFrameDecoderSelectionFailedError.js.map +1 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsOnlyVideoFrameDecoderFactory.d.ts +16 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsOnlyVideoFrameDecoderFactory.d.ts.map +1 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsOnlyVideoFrameDecoderFactory.js +23 -0
- package/dist/modules/video/mediabunny/frame/WebCodecsOnlyVideoFrameDecoderFactory.js.map +1 -0
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.d.ts +9 -3
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.js +24 -7
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.js.map +1 -1
- package/dist/modules/video/mediabunny/painter/FramePainter.d.ts +35 -14
- package/dist/modules/video/mediabunny/painter/FramePainter.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/modules/rendering/subtitle/AbstractAnim.d.ts +0 -13
- package/dist/modules/rendering/subtitle/AbstractAnim.d.ts.map +0 -1
- package/dist/modules/rendering/subtitle/AbstractAnim.js +0 -2
- package/dist/modules/rendering/subtitle/AbstractAnim.js.map +0 -1
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts +0 -39
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts.map +0 -1
- package/dist/modules/rendering/subtitle/AnimationProbe.js +0 -203
- package/dist/modules/rendering/subtitle/AnimationProbe.js.map +0 -1
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.d.ts +0 -17
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.d.ts.map +0 -1
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.js +0 -58
- package/dist/modules/rendering/subtitle/SpriteSheetSizeProber.js.map +0 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts +0 -27
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts.map +0 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js +0 -84
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js.map +0 -1
|
@@ -3,11 +3,12 @@ import type { WordSplitter } from '../../splitting/WordSplitter';
|
|
|
3
3
|
import type { WordFragmenter } from '../../bidi/WordFragmenter';
|
|
4
4
|
import type { VideoFrameSource } from '../../rendering/types/VideoFrameSource';
|
|
5
5
|
import type { BaselineCssComposer } from '../../rendering/styles/BaselineCssComposer';
|
|
6
|
+
import type { AnimationStateFingerprintStrategy } from '../../rendering/subtitle/AnimationStateFingerprint';
|
|
6
7
|
import { ActiveRenderSession } from '../../rendering/subtitle/ActiveRenderSession';
|
|
7
8
|
import type { PreparedStyle } from '../../rendering/subtitle/PreparedStyle';
|
|
8
9
|
/**
|
|
9
10
|
* Assembles an `ActiveRenderSession` and its per-session collaborator
|
|
10
|
-
* graph: animation
|
|
11
|
+
* graph: animation state fingerprint, segment paint-region cache, video-frame
|
|
11
12
|
* vars builder, segment wrapper renderer, batch planner, and sprite
|
|
12
13
|
* sheet compositor.
|
|
13
14
|
*/
|
|
@@ -15,7 +16,9 @@ export declare class ActiveRenderSessionFactory {
|
|
|
15
16
|
private readonly wordSplitter;
|
|
16
17
|
private readonly wordFragmenter;
|
|
17
18
|
private readonly baselineCssComposer;
|
|
18
|
-
|
|
19
|
+
private readonly animationStrategy;
|
|
20
|
+
constructor(wordSplitter: WordSplitter, wordFragmenter: WordFragmenter, baselineCssComposer: BaselineCssComposer, animationStrategy: AnimationStateFingerprintStrategy);
|
|
19
21
|
create(doc: Document, styles: Readonly<Record<string, PreparedStyle>>, width: number, height: number, videoFrameSource: VideoFrameSource | null): ActiveRenderSession;
|
|
22
|
+
private buildAnimationFingerprint;
|
|
20
23
|
}
|
|
21
24
|
//# sourceMappingURL=ActiveRenderSessionFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActiveRenderSessionFactory.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/ActiveRenderSessionFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;
|
|
1
|
+
{"version":3,"file":"ActiveRenderSessionFactory.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/ActiveRenderSessionFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAezF,OAAO,KAAK,EAA6B,iCAAiC,EAAE,MAAM,uDAAuD,CAAC;AAO1I,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE/E;;;;;GAKG;AACH,qBAAa,0BAA0B;IAGnC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAHjB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,cAAc,EAC9B,mBAAmB,EAAE,mBAAmB,EACxC,iBAAiB,EAAE,iCAAiC;IAGvE,MAAM,CACJ,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,gBAAgB,GAAG,IAAI,GACxC,mBAAmB;IAgDtB,OAAO,CAAC,yBAAyB;CAWlC"}
|
|
@@ -8,15 +8,22 @@ import { SegmentSubtreeDecomposer } from '../../rendering/subtitle/SegmentSubtre
|
|
|
8
8
|
import { SegmentPaintRegionResolver } from '../../rendering/subtitle/SegmentPaintRegionResolver';
|
|
9
9
|
import { SegmentPaintRegionCache } from '../../rendering/subtitle/SegmentPaintRegionCache';
|
|
10
10
|
import { VideoFrameVarsBuilder } from '../../rendering/subtitle/VideoFrameVarsBuilder';
|
|
11
|
+
import { SegmentAnchorVarsBuilder } from '../../rendering/subtitle/SegmentAnchorVarsBuilder';
|
|
12
|
+
import { ElementWidthMeasurer } from '../../rendering/subtitle/ElementWidthMeasurer';
|
|
11
13
|
import { SvgFilterMaterializer } from '../../rendering/subtitle/SvgFilterMaterializer';
|
|
14
|
+
import { SvgFilterStateFingerprint } from '../../rendering/subtitle/SvgFilterStateFingerprint';
|
|
12
15
|
import { SegmentWrapperRenderer } from '../../rendering/subtitle/SegmentWrapperRenderer';
|
|
13
|
-
import {
|
|
16
|
+
import { CssKeyframesScanner } from '../../css/CssKeyframesScanner';
|
|
17
|
+
import { KeyframeScanAnimationStateFingerprint } from '../../rendering/subtitle/KeyframeScanAnimationStateFingerprint';
|
|
18
|
+
import { SubtreeMountAnimationStateFingerprint } from '../../rendering/subtitle/SubtreeMountAnimationStateFingerprint';
|
|
19
|
+
import { UnknownAnimationStateFingerprint } from '../../rendering/subtitle/UnknownAnimationStateFingerprint';
|
|
20
|
+
import { SubtreeAnimationSupport } from '../../rendering/subtitle/SubtreeAnimationSupport';
|
|
14
21
|
import { BatchPlanner } from '../../rendering/subtitle/BatchPlanner';
|
|
15
22
|
import { SpriteSheetCompositor } from '../../rendering/subtitle/SpriteSheetCompositor';
|
|
16
23
|
import { ActiveRenderSession } from '../../rendering/subtitle/ActiveRenderSession';
|
|
17
24
|
/**
|
|
18
25
|
* Assembles an `ActiveRenderSession` and its per-session collaborator
|
|
19
|
-
* graph: animation
|
|
26
|
+
* graph: animation state fingerprint, segment paint-region cache, video-frame
|
|
20
27
|
* vars builder, segment wrapper renderer, batch planner, and sprite
|
|
21
28
|
* sheet compositor.
|
|
22
29
|
*/
|
|
@@ -24,23 +31,34 @@ export class ActiveRenderSessionFactory {
|
|
|
24
31
|
wordSplitter;
|
|
25
32
|
wordFragmenter;
|
|
26
33
|
baselineCssComposer;
|
|
27
|
-
|
|
34
|
+
animationStrategy;
|
|
35
|
+
constructor(wordSplitter, wordFragmenter, baselineCssComposer, animationStrategy) {
|
|
28
36
|
this.wordSplitter = wordSplitter;
|
|
29
37
|
this.wordFragmenter = wordFragmenter;
|
|
30
38
|
this.baselineCssComposer = baselineCssComposer;
|
|
39
|
+
this.animationStrategy = animationStrategy;
|
|
31
40
|
}
|
|
32
41
|
create(doc, styles, width, height, videoFrameSource) {
|
|
33
42
|
const subtreeBuilder = new SegmentSubtreeHtmlBuilder(this.wordSplitter, this.wordFragmenter);
|
|
34
43
|
const subtreeDecomposer = new SegmentSubtreeDecomposer();
|
|
35
44
|
const paintRegionResolver = new SegmentPaintRegionResolver();
|
|
36
45
|
const paintRegionCache = new SegmentPaintRegionCache();
|
|
37
|
-
const
|
|
46
|
+
const elementWidthMeasurer = new ElementWidthMeasurer(subtreeBuilder, width, height);
|
|
47
|
+
const filterDefsRenderer = new SvgFilterDefsRenderer(new SvgFilterScoper(), new SvgFilterLengthResolver());
|
|
48
|
+
const filterMaterializer = new SvgFilterMaterializer(filterDefsRenderer, height);
|
|
38
49
|
const videoFrameVarsBuilder = new VideoFrameVarsBuilder(subtreeBuilder, paintRegionResolver, paintRegionCache, width, height, videoFrameSource);
|
|
39
|
-
const wrapperRenderer = new SegmentWrapperRenderer(subtreeBuilder, subtreeDecomposer, filterMaterializer, videoFrameVarsBuilder, new HorizontalPlacementResolver(new HorizontalSideResolver()), width, height);
|
|
40
|
-
const
|
|
41
|
-
const batchPlanner = new BatchPlanner(doc, styles, animationProbe);
|
|
50
|
+
const wrapperRenderer = new SegmentWrapperRenderer(subtreeBuilder, subtreeDecomposer, filterMaterializer, videoFrameVarsBuilder, new SegmentAnchorVarsBuilder(), elementWidthMeasurer, new HorizontalPlacementResolver(new HorizontalSideResolver()), width, height);
|
|
51
|
+
const batchPlanner = new BatchPlanner(doc, styles, this.buildAnimationFingerprint(wrapperRenderer, width, height), new SvgFilterStateFingerprint(filterDefsRenderer, height));
|
|
42
52
|
const spriteSheetCompositor = new SpriteSheetCompositor(styles, wrapperRenderer, this.baselineCssComposer, width, height);
|
|
43
|
-
return new ActiveRenderSession(batchPlanner, spriteSheetCompositor,
|
|
53
|
+
return new ActiveRenderSession(batchPlanner, spriteSheetCompositor, paintRegionCache, elementWidthMeasurer);
|
|
54
|
+
}
|
|
55
|
+
buildAnimationFingerprint(wrapperRenderer, width, height) {
|
|
56
|
+
if (this.animationStrategy === 'none')
|
|
57
|
+
return new UnknownAnimationStateFingerprint();
|
|
58
|
+
if (this.animationStrategy === 'subtree-mount') {
|
|
59
|
+
return new SubtreeMountAnimationStateFingerprint(wrapperRenderer, new SubtreeAnimationSupport(), width, height);
|
|
60
|
+
}
|
|
61
|
+
return new KeyframeScanAnimationStateFingerprint(new CssKeyframesScanner());
|
|
44
62
|
}
|
|
45
63
|
}
|
|
46
64
|
//# sourceMappingURL=ActiveRenderSessionFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActiveRenderSessionFactory.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/ActiveRenderSessionFactory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAG7F,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2CAA2C,CAAC;AAClF,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,wBAAwB,EAAE,MAAM,sDAAsD,CAAC;AAChG,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,mDAAmD,CAAC;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAC5F,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ActiveRenderSessionFactory.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/ActiveRenderSessionFactory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAG7F,OAAO,EAAE,eAAe,EAAE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,IAAI,yBAAyB,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAC1D,CAAC;QACF,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,CACrD,MAAM,EACN,eAAe,EACf,IAAI,CAAC,mBAAmB,EACxB,KAAK,EACL,MAAM,CACP,CAAC;QACF,OAAO,IAAI,mBAAmB,CAC5B,YAAY,EACZ,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,CACrB,CAAC;IACJ,CAAC;IAEO,yBAAyB,CAC/B,eAAuC,EACvC,KAAa,EACb,MAAc;QAEd,IAAI,IAAI,CAAC,iBAAiB,KAAK,MAAM;YAAE,OAAO,IAAI,gCAAgC,EAAE,CAAC;QACrF,IAAI,IAAI,CAAC,iBAAiB,KAAK,eAAe,EAAE,CAAC;YAC/C,OAAO,IAAI,qCAAqC,CAAC,eAAe,EAAE,IAAI,uBAAuB,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;QAClH,CAAC;QACD,OAAO,IAAI,qCAAqC,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Segment } from '../../document/Segment';
|
|
2
|
+
import type { PreparedStyle } from '../../rendering/subtitle/PreparedStyle';
|
|
3
|
+
/** Which implementation answers. `keyframe-scan` is the default; see `history/captions-rendering.md`. */
|
|
4
|
+
export type AnimationStateFingerprintStrategy = 'keyframe-scan' | 'subtree-mount' | 'none';
|
|
5
|
+
/**
|
|
6
|
+
* Describes where a segment's animations stand at one timestamp.
|
|
7
|
+
*
|
|
8
|
+
* Two timestamps described by the same value hold every animation at
|
|
9
|
+
* the same point, so the segment resolves to the same computed styles
|
|
10
|
+
* at both. `null` is not a description: it says the state at that
|
|
11
|
+
* timestamp cannot be compared with the state at any other.
|
|
12
|
+
*
|
|
13
|
+
* `classFingerprint` describes the classes the segment's elements
|
|
14
|
+
* carry at `t`. Two timestamps given the same one match the same
|
|
15
|
+
* rules.
|
|
16
|
+
*/
|
|
17
|
+
export interface AnimationStateFingerprint {
|
|
18
|
+
at(style: PreparedStyle, seg: Segment, t: number, indexInSection: number, classFingerprint: string): Promise<string | null>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=AnimationStateFingerprint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationStateFingerprint.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/AnimationStateFingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAE/E,yGAAyG;AACzG,MAAM,MAAM,iCAAiC,GAAG,eAAe,GAAG,eAAe,GAAG,MAAM,CAAC;AAE3F;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,yBAAyB;IACxC,EAAE,CACA,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,OAAO,EACZ,CAAC,EAAE,MAAM,EACT,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationStateFingerprint.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/AnimationStateFingerprint.ts"],"names":[],"mappings":""}
|
|
@@ -3,12 +3,16 @@ import type { RenderItem, UniqueTile, AssetGroup } from '../../rendering/subtitl
|
|
|
3
3
|
* Builds one asset group: tracks the unique tiles accumulated for an
|
|
4
4
|
* asset key, deduplicates new arrivals by state key, and finalizes
|
|
5
5
|
* into an {@link AssetGroup}.
|
|
6
|
+
*
|
|
6
7
|
*/
|
|
7
8
|
export declare class AssetGroupBuilder {
|
|
8
9
|
readonly assetKey: string;
|
|
9
10
|
private readonly tiles;
|
|
10
11
|
private readonly tileByStateKey;
|
|
11
12
|
constructor(assetKey: string);
|
|
13
|
+
/** Whether this group already holds the tile for `stateKey`, so admitting it costs no room. */
|
|
14
|
+
holds(stateKey: string): boolean;
|
|
15
|
+
get tileCount(): number;
|
|
12
16
|
upsertTile(stateKey: string, items: RenderItem[]): UniqueTile;
|
|
13
17
|
build(): AssetGroup;
|
|
14
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetGroupBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/AssetGroupBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAEhG
|
|
1
|
+
{"version":3,"file":"AssetGroupBuilder.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/AssetGroupBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AAEhG;;;;;GAKG;AACH,qBAAa,iBAAiB;IAIhB,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAHrC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoB;IAC1C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiC;gBAE3C,QAAQ,EAAE,MAAM;IAErC,+FAA+F;IAC/F,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIhC,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,UAAU;IAU7D,KAAK,IAAI,UAAU;CAGpB"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Builds one asset group: tracks the unique tiles accumulated for an
|
|
3
3
|
* asset key, deduplicates new arrivals by state key, and finalizes
|
|
4
4
|
* into an {@link AssetGroup}.
|
|
5
|
+
*
|
|
5
6
|
*/
|
|
6
7
|
export class AssetGroupBuilder {
|
|
7
8
|
assetKey;
|
|
@@ -10,6 +11,13 @@ export class AssetGroupBuilder {
|
|
|
10
11
|
constructor(assetKey) {
|
|
11
12
|
this.assetKey = assetKey;
|
|
12
13
|
}
|
|
14
|
+
/** Whether this group already holds the tile for `stateKey`, so admitting it costs no room. */
|
|
15
|
+
holds(stateKey) {
|
|
16
|
+
return this.tileByStateKey.has(stateKey);
|
|
17
|
+
}
|
|
18
|
+
get tileCount() {
|
|
19
|
+
return this.tiles.length;
|
|
20
|
+
}
|
|
13
21
|
upsertTile(stateKey, items) {
|
|
14
22
|
let tile = this.tileByStateKey.get(stateKey);
|
|
15
23
|
if (!tile) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AssetGroupBuilder.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/AssetGroupBuilder.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"AssetGroupBuilder.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/AssetGroupBuilder.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IAIP;IAHJ,KAAK,GAAiB,EAAE,CAAC;IACzB,cAAc,GAAG,IAAI,GAAG,EAAsB,CAAC;IAEhE,YAAqB,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;IAAG,CAAC;IAEzC,+FAA+F;IAC/F,KAAK,CAAC,QAAgB;QACpB,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,UAAU,CAAC,QAAgB,EAAE,KAAmB;QAC9C,IAAI,IAAI,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC/C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACtB,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK;QACH,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IAC9D,CAAC;CACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Document } from '../../document/Document';
|
|
2
2
|
import type { PreparedStyle } from '../../rendering/subtitle/PreparedStyle';
|
|
3
|
-
import type {
|
|
3
|
+
import type { AnimationStateFingerprint } from '../../rendering/subtitle/AnimationStateFingerprint';
|
|
4
|
+
import type { SvgFilterStateFingerprint } from '../../rendering/subtitle/SvgFilterStateFingerprint';
|
|
4
5
|
import type { BatchPlan } from '../../rendering/subtitle/BatchPlan';
|
|
5
6
|
/**
|
|
6
7
|
* Plans one batch: for each timestamp, finds the active prepared
|
|
@@ -8,17 +9,61 @@ import type { BatchPlan } from '../../rendering/subtitle/BatchPlan';
|
|
|
8
9
|
* rendered sprite carries only the asset payload its tiles need, and
|
|
9
10
|
* deduplicates timestamps that resolve to the same visual state into
|
|
10
11
|
* a single tile inside their group.
|
|
12
|
+
*
|
|
13
|
+
* A batch ends when a group has no room for the picture the next
|
|
14
|
+
* timestamp needs, so the plan covers a prefix of the timestamps it
|
|
15
|
+
* was offered and the caller reads how far it got from the
|
|
16
|
+
* assignments. Offering more than one sheet could ever hold is the
|
|
17
|
+
* point: how much video a sheet covers is then decided by how much
|
|
18
|
+
* the captions move, not by a count fixed before anything was looked
|
|
19
|
+
* at. A still caption can carry a sheet for as long as it stays
|
|
20
|
+
* still.
|
|
11
21
|
*/
|
|
12
22
|
export declare class BatchPlanner {
|
|
13
23
|
private readonly doc;
|
|
14
24
|
private readonly styles;
|
|
15
|
-
private readonly
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
private readonly animationFingerprint;
|
|
26
|
+
private readonly filterFingerprint;
|
|
27
|
+
constructor(doc: Document, styles: Readonly<Record<string, PreparedStyle>>, animationFingerprint: AnimationStateFingerprint, filterFingerprint: SvgFilterStateFingerprint);
|
|
28
|
+
/**
|
|
29
|
+
* Plans as many of `timestamps`, in order, as `maxTiles` distinct
|
|
30
|
+
* pictures can serve. The returned assignments cover a prefix of the
|
|
31
|
+
* input, never fewer than one entry, and the timestamps past it
|
|
32
|
+
* belong to the next batch.
|
|
33
|
+
*
|
|
34
|
+
* The budget is the batch's, not each group's: groups become one
|
|
35
|
+
* sprite sheet each, and it is their total that has to stay inside
|
|
36
|
+
* whatever raster the caller sized `maxTiles` against.
|
|
37
|
+
*/
|
|
38
|
+
plan(timestamps: ReadonlyArray<number>, maxTiles: number): Promise<BatchPlan>;
|
|
39
|
+
/**
|
|
40
|
+
* What this timestamp needs painted — which sprite it belongs in and
|
|
41
|
+
* which picture inside it — or `null` where no Section is active and
|
|
42
|
+
* nothing is painted at all.
|
|
43
|
+
*/
|
|
44
|
+
private pictureAt;
|
|
45
|
+
private builderFor;
|
|
19
46
|
private itemsAt;
|
|
20
47
|
private computeAssetKey;
|
|
48
|
+
/**
|
|
49
|
+
* What every active item paints at `t`. Two timestamps sharing this
|
|
50
|
+
* value paint the same picture, so they share a tile.
|
|
51
|
+
*
|
|
52
|
+
* JSON-encoded rather than joined: two of the parts carry text an
|
|
53
|
+
* author writes — a filter body and the name of a `@keyframes` rule
|
|
54
|
+
* — and no separator can be assumed absent from either.
|
|
55
|
+
*/
|
|
21
56
|
private computeStateKey;
|
|
57
|
+
/**
|
|
58
|
+
* The item's state in four parts: the state its classes are in,
|
|
59
|
+
* where its animations stand, the filter markup it is painted
|
|
60
|
+
* through, and the timestamp itself where any of them cannot answer
|
|
61
|
+
* for the whole frame — an animation is mid-run, a filter reads a
|
|
62
|
+
* variable this side cannot resolve, or the style paints the video
|
|
63
|
+
* frame itself, which differs at every timestamp by definition and
|
|
64
|
+
* is invisible from here.
|
|
65
|
+
*/
|
|
66
|
+
private describeItemState;
|
|
22
67
|
/**
|
|
23
68
|
* Captures every time-varying CSS class the segment subtree
|
|
24
69
|
* exposes (segment, lines, words) so two timestamps that resolve
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatchPlanner.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/BatchPlanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"BatchPlanner.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/BatchPlanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AACvG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAEvG,OAAO,KAAK,EAAE,SAAS,EAA0C,MAAM,uCAAuC,CAAC;AAU/G;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,YAAY;IAGrB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;gBAHjB,GAAG,EAAE,QAAQ,EACb,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,EAC/C,oBAAoB,EAAE,yBAAyB,EAC/C,iBAAiB,EAAE,yBAAyB;IAG/D;;;;;;;;;OASG;IACG,IAAI,CAAC,UAAU,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IA2BnF;;;;OAIG;YACW,SAAS;IAUvB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,OAAO;IAmBf,OAAO,CAAC,eAAe;IAMvB;;;;;;;OAOG;YACW,eAAe;IAM7B;;;;;;;;OAQG;YACW,iBAAiB;IAkB/B;;;;;;OAMG;IACH,OAAO,CAAC,uBAAuB;IAM/B,OAAO,CAAC,oBAAoB;CAK7B"}
|
|
@@ -6,38 +6,86 @@ import { profiler } from '../../profiling/Profiler';
|
|
|
6
6
|
* rendered sprite carries only the asset payload its tiles need, and
|
|
7
7
|
* deduplicates timestamps that resolve to the same visual state into
|
|
8
8
|
* a single tile inside their group.
|
|
9
|
+
*
|
|
10
|
+
* A batch ends when a group has no room for the picture the next
|
|
11
|
+
* timestamp needs, so the plan covers a prefix of the timestamps it
|
|
12
|
+
* was offered and the caller reads how far it got from the
|
|
13
|
+
* assignments. Offering more than one sheet could ever hold is the
|
|
14
|
+
* point: how much video a sheet covers is then decided by how much
|
|
15
|
+
* the captions move, not by a count fixed before anything was looked
|
|
16
|
+
* at. A still caption can carry a sheet for as long as it stays
|
|
17
|
+
* still.
|
|
9
18
|
*/
|
|
10
19
|
export class BatchPlanner {
|
|
11
20
|
doc;
|
|
12
21
|
styles;
|
|
13
|
-
|
|
14
|
-
|
|
22
|
+
animationFingerprint;
|
|
23
|
+
filterFingerprint;
|
|
24
|
+
constructor(doc, styles, animationFingerprint, filterFingerprint) {
|
|
15
25
|
this.doc = doc;
|
|
16
26
|
this.styles = styles;
|
|
17
|
-
this.
|
|
27
|
+
this.animationFingerprint = animationFingerprint;
|
|
28
|
+
this.filterFingerprint = filterFingerprint;
|
|
18
29
|
}
|
|
19
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Plans as many of `timestamps`, in order, as `maxTiles` distinct
|
|
32
|
+
* pictures can serve. The returned assignments cover a prefix of the
|
|
33
|
+
* input, never fewer than one entry, and the timestamps past it
|
|
34
|
+
* belong to the next batch.
|
|
35
|
+
*
|
|
36
|
+
* The budget is the batch's, not each group's: groups become one
|
|
37
|
+
* sprite sheet each, and it is their total that has to stay inside
|
|
38
|
+
* whatever raster the caller sized `maxTiles` against.
|
|
39
|
+
*/
|
|
40
|
+
async plan(timestamps, maxTiles) {
|
|
20
41
|
const builders = new Map();
|
|
21
|
-
const assignments =
|
|
42
|
+
const assignments = [];
|
|
43
|
+
await profiler.time('BatchPlanner.assignTiles', async () => {
|
|
44
|
+
let tilesTaken = 0;
|
|
45
|
+
for (const t of timestamps) {
|
|
46
|
+
const picture = await this.pictureAt(t);
|
|
47
|
+
if (picture === null) {
|
|
48
|
+
assignments.push(null);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const builder = this.builderFor(picture.assetKey, builders);
|
|
52
|
+
const isNewPicture = !builder.holds(picture.stateKey);
|
|
53
|
+
if (isNewPicture && tilesTaken === maxTiles)
|
|
54
|
+
break;
|
|
55
|
+
if (isNewPicture)
|
|
56
|
+
tilesTaken++;
|
|
57
|
+
const tile = builder.upsertTile(picture.stateKey, picture.items);
|
|
58
|
+
assignments.push({ assetKey: picture.assetKey, tileIndex: tile.tileIndex });
|
|
59
|
+
}
|
|
60
|
+
});
|
|
22
61
|
const groups = new Map();
|
|
23
62
|
for (const builder of builders.values()) {
|
|
24
63
|
groups.set(builder.assetKey, builder.build());
|
|
25
64
|
}
|
|
26
65
|
return { groups, assignments };
|
|
27
66
|
}
|
|
28
|
-
|
|
67
|
+
/**
|
|
68
|
+
* What this timestamp needs painted — which sprite it belongs in and
|
|
69
|
+
* which picture inside it — or `null` where no Section is active and
|
|
70
|
+
* nothing is painted at all.
|
|
71
|
+
*/
|
|
72
|
+
async pictureAt(t) {
|
|
29
73
|
const items = profiler.time('BatchPlanner.itemsAt', () => this.itemsAt(t));
|
|
30
74
|
if (items.length === 0)
|
|
31
75
|
return null;
|
|
32
|
-
|
|
76
|
+
return {
|
|
77
|
+
assetKey: this.computeAssetKey(items),
|
|
78
|
+
stateKey: await profiler.time('BatchPlanner.computeStateKey', () => this.computeStateKey(items, t)),
|
|
79
|
+
items,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
builderFor(assetKey, builders) {
|
|
33
83
|
let builder = builders.get(assetKey);
|
|
34
84
|
if (!builder) {
|
|
35
85
|
builder = new AssetGroupBuilder(assetKey);
|
|
36
86
|
builders.set(assetKey, builder);
|
|
37
87
|
}
|
|
38
|
-
|
|
39
|
-
const tile = builder.upsertTile(stateKey, items);
|
|
40
|
-
return { assetKey, tileIndex: tile.tileIndex };
|
|
88
|
+
return builder;
|
|
41
89
|
}
|
|
42
90
|
itemsAt(t) {
|
|
43
91
|
const items = [];
|
|
@@ -66,11 +114,45 @@ export class BatchPlanner {
|
|
|
66
114
|
kinds.add(it.style.kind);
|
|
67
115
|
return [...kinds].sort().join(',');
|
|
68
116
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
117
|
+
/**
|
|
118
|
+
* What every active item paints at `t`. Two timestamps sharing this
|
|
119
|
+
* value paint the same picture, so they share a tile.
|
|
120
|
+
*
|
|
121
|
+
* JSON-encoded rather than joined: two of the parts carry text an
|
|
122
|
+
* author writes — a filter body and the name of a `@keyframes` rule
|
|
123
|
+
* — and no separator can be assumed absent from either.
|
|
124
|
+
*/
|
|
125
|
+
async computeStateKey(items, t) {
|
|
126
|
+
const described = [];
|
|
127
|
+
for (const item of items)
|
|
128
|
+
described.push(await this.describeItemState(item, t));
|
|
129
|
+
return JSON.stringify(described);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The item's state in four parts: the state its classes are in,
|
|
133
|
+
* where its animations stand, the filter markup it is painted
|
|
134
|
+
* through, and the timestamp itself where any of them cannot answer
|
|
135
|
+
* for the whole frame — an animation is mid-run, a filter reads a
|
|
136
|
+
* variable this side cannot resolve, or the style paints the video
|
|
137
|
+
* frame itself, which differs at every timestamp by definition and
|
|
138
|
+
* is invisible from here.
|
|
139
|
+
*/
|
|
140
|
+
async describeItemState({ seg, style, indexInSection }, t) {
|
|
141
|
+
const filters = this.filterFingerprint.at(style.kind, style.filters, t);
|
|
142
|
+
const classes = this.fingerprintSegmentState(seg, t);
|
|
143
|
+
// A style painting the video frame takes a tile per timestamp
|
|
144
|
+
// whatever its animations do, so it is never described.
|
|
145
|
+
const animations = style.rendering.videoFrame.required
|
|
146
|
+
? null
|
|
147
|
+
: await this.animationFingerprint.at(style, seg, t, indexInSection, classes);
|
|
148
|
+
const perFrame = filters === null || animations === null;
|
|
149
|
+
return [
|
|
150
|
+
`${style.kind}:${seg.id}`,
|
|
151
|
+
classes,
|
|
152
|
+
animations ?? '',
|
|
153
|
+
perFrame ? t.toFixed(3) : '',
|
|
154
|
+
filters ?? '',
|
|
155
|
+
];
|
|
74
156
|
}
|
|
75
157
|
/**
|
|
76
158
|
* Captures every time-varying CSS class the segment subtree
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatchPlanner.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/BatchPlanner.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BatchPlanner.js","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/BatchPlanner.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AASvD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,YAAY;IAGJ;IACA;IACA;IACA;IAJnB,YACmB,GAAa,EACb,MAA+C,EAC/C,oBAA+C,EAC/C,iBAA4C;QAH5C,QAAG,GAAH,GAAG,CAAU;QACb,WAAM,GAAN,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,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC1F,OAAO,GAAG,UAAU,KAAK,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IACzD,CAAC;IAEO,oBAAoB,CAAC,IAAU,EAAE,CAAS;QAChD,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACpD,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACvF,OAAO,GAAG,WAAW,IAAI,WAAW,GAAG,CAAC;IAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Segment } from '../../document/Segment';
|
|
2
|
+
import type { PreparedStyle } from '../../rendering/subtitle/PreparedStyle';
|
|
3
|
+
import type { SegmentSubtreeHtmlBuilder, SegmentSubtreeStyleInput } from '../../rendering/subtitle/SegmentSubtreeHtmlBuilder';
|
|
4
|
+
import { ElementWidths } from '../../rendering/subtitle/ElementWidths';
|
|
5
|
+
/**
|
|
6
|
+
* How wide a caption's elements lay out, measured by mounting the
|
|
7
|
+
* subtree under the consumer's own stylesheet and reading the boxes
|
|
8
|
+
* back. Answers once per caption per style and reuses that for every
|
|
9
|
+
* frame the caption is on screen; `clear` drops what it kept.
|
|
10
|
+
*
|
|
11
|
+
* Segments, lines and words answer, and nothing else does. They are the
|
|
12
|
+
* three a stylesheet lays text out in, and every extra kind costs
|
|
13
|
+
* another custom property on every rendered element for a question no
|
|
14
|
+
* stylesheet has asked yet. Adding a kind is adding its variable here.
|
|
15
|
+
*
|
|
16
|
+
* A style whose CSS reads none of the properties is never measured: the
|
|
17
|
+
* work is a mount and a layout read, and nothing would consume it.
|
|
18
|
+
*
|
|
19
|
+
* Measuring the subtree as it is really built is what keeps the answer
|
|
20
|
+
* honest. Whatever classes the caption carries at that moment are on
|
|
21
|
+
* it, so a template that restyles a whole caption on a render state is
|
|
22
|
+
* measured in the typography that state produces, with no second
|
|
23
|
+
* description of that state to keep in step.
|
|
24
|
+
*/
|
|
25
|
+
export declare class ElementWidthMeasurer {
|
|
26
|
+
private readonly subtreeBuilder;
|
|
27
|
+
private readonly viewportWidth;
|
|
28
|
+
private readonly viewportHeight;
|
|
29
|
+
private readonly widthsByKey;
|
|
30
|
+
constructor(subtreeBuilder: SegmentSubtreeHtmlBuilder, viewportWidth: number, viewportHeight: number);
|
|
31
|
+
widthsFor(style: PreparedStyle, styleInput: SegmentSubtreeStyleInput, segment: Segment, t: number, indexInSection: number): ElementWidths;
|
|
32
|
+
clear(): void;
|
|
33
|
+
private styleReadsAnyWidth;
|
|
34
|
+
private measure;
|
|
35
|
+
/**
|
|
36
|
+
* The subtree as it will really be built, with every element named so
|
|
37
|
+
* its box can be found again afterwards.
|
|
38
|
+
*
|
|
39
|
+
* The widths are deliberately absent from it. A stylesheet sizing text
|
|
40
|
+
* from its own width would otherwise have to be measured at the size
|
|
41
|
+
* it is being asked to produce; leaving the properties unset lets the
|
|
42
|
+
* rule fall back, and since the answer is a multiple of the font size,
|
|
43
|
+
* whichever size the fallback lands on gives the same one.
|
|
44
|
+
*/
|
|
45
|
+
private buildMeasurableSubtree;
|
|
46
|
+
private everyElementId;
|
|
47
|
+
/**
|
|
48
|
+
* An element that generates no box reports zero. That is the true
|
|
49
|
+
* answer rather than a missing one — a stylesheet asking the width of
|
|
50
|
+
* something it took out of flow is asking about a box that is not
|
|
51
|
+
* there.
|
|
52
|
+
*/
|
|
53
|
+
private readWidths;
|
|
54
|
+
private widthEmOf;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=ElementWidthMeasurer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ElementWidthMeasurer.d.ts","sourceRoot":"","sources":["../../../../src/modules/rendering/subtitle/ElementWidthMeasurer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,KAAK,EAAE,yBAAyB,EAAE,wBAAwB,EAAE,MAAM,uDAAuD,CAAC;AACjI,OAAO,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAS1E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,oBAAoB;IAI7B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,cAAc;IALjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAoC;gBAG7C,cAAc,EAAE,yBAAyB,EACzC,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,MAAM;IAGzC,SAAS,CACP,KAAK,EAAE,aAAa,EACpB,UAAU,EAAE,wBAAwB,EACpC,OAAO,EAAE,OAAO,EAChB,CAAC,EAAE,MAAM,EACT,cAAc,EAAE,MAAM,GACrB,aAAa;IAWhB,KAAK,IAAI,IAAI;IAIb,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,OAAO;IAuBf;;;;;;;;;OASG;IACH,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,cAAc;IAStB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,SAAS;CAKlB"}
|