@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.
Files changed (483) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +349 -0
  3. package/dist/index.d.ts +12 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +12 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/modules/css/BrowserCssResourceEmbedder.d.ts +5 -0
  8. package/dist/modules/css/BrowserCssResourceEmbedder.d.ts.map +1 -0
  9. package/dist/modules/css/BrowserCssResourceEmbedder.js +41 -0
  10. package/dist/modules/css/BrowserCssResourceEmbedder.js.map +1 -0
  11. package/dist/modules/css/CssMinifier.d.ts +12 -0
  12. package/dist/modules/css/CssMinifier.d.ts.map +1 -0
  13. package/dist/modules/css/CssMinifier.js +47 -0
  14. package/dist/modules/css/CssMinifier.js.map +1 -0
  15. package/dist/modules/css/CssResourceEmbedder.d.ts +4 -0
  16. package/dist/modules/css/CssResourceEmbedder.d.ts.map +1 -0
  17. package/dist/modules/css/CssResourceEmbedder.js +2 -0
  18. package/dist/modules/css/CssResourceEmbedder.js.map +1 -0
  19. package/dist/modules/css/CssScoper.d.ts +16 -0
  20. package/dist/modules/css/CssScoper.d.ts.map +1 -0
  21. package/dist/modules/css/CssScoper.js +109 -0
  22. package/dist/modules/css/CssScoper.js.map +1 -0
  23. package/dist/modules/css/NoopCssResourceEmbedder.d.ts +12 -0
  24. package/dist/modules/css/NoopCssResourceEmbedder.d.ts.map +1 -0
  25. package/dist/modules/css/NoopCssResourceEmbedder.js +13 -0
  26. package/dist/modules/css/NoopCssResourceEmbedder.js.map +1 -0
  27. package/dist/modules/css/index.d.ts +6 -0
  28. package/dist/modules/css/index.d.ts.map +1 -0
  29. package/dist/modules/css/index.js +5 -0
  30. package/dist/modules/css/index.js.map +1 -0
  31. package/dist/modules/document/CssVariable.d.ts +46 -0
  32. package/dist/modules/document/CssVariable.d.ts.map +1 -0
  33. package/dist/modules/document/CssVariable.js +47 -0
  34. package/dist/modules/document/CssVariable.js.map +1 -0
  35. package/dist/modules/document/Document.d.ts +43 -0
  36. package/dist/modules/document/Document.d.ts.map +1 -0
  37. package/dist/modules/document/Document.js +86 -0
  38. package/dist/modules/document/Document.js.map +1 -0
  39. package/dist/modules/document/DocumentEditor.d.ts +111 -0
  40. package/dist/modules/document/DocumentEditor.d.ts.map +1 -0
  41. package/dist/modules/document/DocumentEditor.js +555 -0
  42. package/dist/modules/document/DocumentEditor.js.map +1 -0
  43. package/dist/modules/document/Letter.d.ts +17 -0
  44. package/dist/modules/document/Letter.d.ts.map +1 -0
  45. package/dist/modules/document/Letter.js +17 -0
  46. package/dist/modules/document/Letter.js.map +1 -0
  47. package/dist/modules/document/Line.d.ts +31 -0
  48. package/dist/modules/document/Line.d.ts.map +1 -0
  49. package/dist/modules/document/Line.js +94 -0
  50. package/dist/modules/document/Line.js.map +1 -0
  51. package/dist/modules/document/LineState.d.ts +6 -0
  52. package/dist/modules/document/LineState.d.ts.map +1 -0
  53. package/dist/modules/document/LineState.js +7 -0
  54. package/dist/modules/document/LineState.js.map +1 -0
  55. package/dist/modules/document/NarrationPace.d.ts +20 -0
  56. package/dist/modules/document/NarrationPace.d.ts.map +1 -0
  57. package/dist/modules/document/NarrationPace.js +60 -0
  58. package/dist/modules/document/NarrationPace.js.map +1 -0
  59. package/dist/modules/document/Section.d.ts +45 -0
  60. package/dist/modules/document/Section.d.ts.map +1 -0
  61. package/dist/modules/document/Section.js +94 -0
  62. package/dist/modules/document/Section.js.map +1 -0
  63. package/dist/modules/document/Segment.d.ts +40 -0
  64. package/dist/modules/document/Segment.d.ts.map +1 -0
  65. package/dist/modules/document/Segment.js +85 -0
  66. package/dist/modules/document/Segment.js.map +1 -0
  67. package/dist/modules/document/Tag.d.ts +24 -0
  68. package/dist/modules/document/Tag.d.ts.map +1 -0
  69. package/dist/modules/document/Tag.js +37 -0
  70. package/dist/modules/document/Tag.js.map +1 -0
  71. package/dist/modules/document/TimeFragment.d.ts +11 -0
  72. package/dist/modules/document/TimeFragment.d.ts.map +1 -0
  73. package/dist/modules/document/TimeFragment.js +29 -0
  74. package/dist/modules/document/TimeFragment.js.map +1 -0
  75. package/dist/modules/document/Word.d.ts +40 -0
  76. package/dist/modules/document/Word.d.ts.map +1 -0
  77. package/dist/modules/document/Word.js +114 -0
  78. package/dist/modules/document/Word.js.map +1 -0
  79. package/dist/modules/document/WordState.d.ts +6 -0
  80. package/dist/modules/document/WordState.d.ts.map +1 -0
  81. package/dist/modules/document/WordState.js +7 -0
  82. package/dist/modules/document/WordState.js.map +1 -0
  83. package/dist/modules/document/index.d.ts +14 -0
  84. package/dist/modules/document/index.d.ts.map +1 -0
  85. package/dist/modules/document/index.js +14 -0
  86. package/dist/modules/document/index.js.map +1 -0
  87. package/dist/modules/effect/CarryQuotesEffect.d.ts +47 -0
  88. package/dist/modules/effect/CarryQuotesEffect.d.ts.map +1 -0
  89. package/dist/modules/effect/CarryQuotesEffect.js +181 -0
  90. package/dist/modules/effect/CarryQuotesEffect.js.map +1 -0
  91. package/dist/modules/effect/Effect.d.ts +16 -0
  92. package/dist/modules/effect/Effect.d.ts.map +1 -0
  93. package/dist/modules/effect/Effect.js +2 -0
  94. package/dist/modules/effect/Effect.js.map +1 -0
  95. package/dist/modules/effect/GapFreeEffect.d.ts +24 -0
  96. package/dist/modules/effect/GapFreeEffect.d.ts.map +1 -0
  97. package/dist/modules/effect/GapFreeEffect.js +67 -0
  98. package/dist/modules/effect/GapFreeEffect.js.map +1 -0
  99. package/dist/modules/effect/RemovePunctuationEffect.d.ts +21 -0
  100. package/dist/modules/effect/RemovePunctuationEffect.d.ts.map +1 -0
  101. package/dist/modules/effect/RemovePunctuationEffect.js +52 -0
  102. package/dist/modules/effect/RemovePunctuationEffect.js.map +1 -0
  103. package/dist/modules/effect/SmartLowercaseEffect.d.ts +21 -0
  104. package/dist/modules/effect/SmartLowercaseEffect.d.ts.map +1 -0
  105. package/dist/modules/effect/SmartLowercaseEffect.js +45 -0
  106. package/dist/modules/effect/SmartLowercaseEffect.js.map +1 -0
  107. package/dist/modules/effect/SmartPunctuationEffect.d.ts +25 -0
  108. package/dist/modules/effect/SmartPunctuationEffect.d.ts.map +1 -0
  109. package/dist/modules/effect/SmartPunctuationEffect.js +68 -0
  110. package/dist/modules/effect/SmartPunctuationEffect.js.map +1 -0
  111. package/dist/modules/effect/index.d.ts +7 -0
  112. package/dist/modules/effect/index.d.ts.map +1 -0
  113. package/dist/modules/effect/index.js +6 -0
  114. package/dist/modules/effect/index.js.map +1 -0
  115. package/dist/modules/pipeline/PipelineProgress.d.ts +30 -0
  116. package/dist/modules/pipeline/PipelineProgress.d.ts.map +1 -0
  117. package/dist/modules/pipeline/PipelineProgress.js +2 -0
  118. package/dist/modules/pipeline/PipelineProgress.js.map +1 -0
  119. package/dist/modules/pipeline/RenderPipeline.d.ts +105 -0
  120. package/dist/modules/pipeline/RenderPipeline.d.ts.map +1 -0
  121. package/dist/modules/pipeline/RenderPipeline.js +232 -0
  122. package/dist/modules/pipeline/RenderPipeline.js.map +1 -0
  123. package/dist/modules/pipeline/RenderPipelineBuilder.d.ts +143 -0
  124. package/dist/modules/pipeline/RenderPipelineBuilder.d.ts.map +1 -0
  125. package/dist/modules/pipeline/RenderPipelineBuilder.js +317 -0
  126. package/dist/modules/pipeline/RenderPipelineBuilder.js.map +1 -0
  127. package/dist/modules/pipeline/index.d.ts +6 -0
  128. package/dist/modules/pipeline/index.d.ts.map +1 -0
  129. package/dist/modules/pipeline/index.js +3 -0
  130. package/dist/modules/pipeline/index.js.map +1 -0
  131. package/dist/modules/profiling/Profiler.d.ts +115 -0
  132. package/dist/modules/profiling/Profiler.d.ts.map +1 -0
  133. package/dist/modules/profiling/Profiler.js +316 -0
  134. package/dist/modules/profiling/Profiler.js.map +1 -0
  135. package/dist/modules/profiling/index.d.ts +2 -0
  136. package/dist/modules/profiling/index.d.ts.map +1 -0
  137. package/dist/modules/profiling/index.js +2 -0
  138. package/dist/modules/profiling/index.js.map +1 -0
  139. package/dist/modules/rendering/AlignmentConfig.d.ts +21 -0
  140. package/dist/modules/rendering/AlignmentConfig.d.ts.map +1 -0
  141. package/dist/modules/rendering/AlignmentConfig.js +2 -0
  142. package/dist/modules/rendering/AlignmentConfig.js.map +1 -0
  143. package/dist/modules/rendering/BoxEdges.d.ts +8 -0
  144. package/dist/modules/rendering/BoxEdges.d.ts.map +1 -0
  145. package/dist/modules/rendering/BoxEdges.js +2 -0
  146. package/dist/modules/rendering/BoxEdges.js.map +1 -0
  147. package/dist/modules/rendering/BrowserOverlayFrameRenderer.d.ts +12 -0
  148. package/dist/modules/rendering/BrowserOverlayFrameRenderer.d.ts.map +1 -0
  149. package/dist/modules/rendering/BrowserOverlayFrameRenderer.js +31 -0
  150. package/dist/modules/rendering/BrowserOverlayFrameRenderer.js.map +1 -0
  151. package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts +57 -0
  152. package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts.map +1 -0
  153. package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js +775 -0
  154. package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js.map +1 -0
  155. package/dist/modules/rendering/ElementRenderOverrides.d.ts +15 -0
  156. package/dist/modules/rendering/ElementRenderOverrides.d.ts.map +1 -0
  157. package/dist/modules/rendering/ElementRenderOverrides.js +24 -0
  158. package/dist/modules/rendering/ElementRenderOverrides.js.map +1 -0
  159. package/dist/modules/rendering/InlineStyleMap.d.ts +9 -0
  160. package/dist/modules/rendering/InlineStyleMap.d.ts.map +1 -0
  161. package/dist/modules/rendering/InlineStyleMap.js +2 -0
  162. package/dist/modules/rendering/InlineStyleMap.js.map +1 -0
  163. package/dist/modules/rendering/LayeredSubtitleFrame.d.ts +20 -0
  164. package/dist/modules/rendering/LayeredSubtitleFrame.d.ts.map +1 -0
  165. package/dist/modules/rendering/LayeredSubtitleFrame.js +36 -0
  166. package/dist/modules/rendering/LayeredSubtitleFrame.js.map +1 -0
  167. package/dist/modules/rendering/OverlayFrameRenderer.d.ts +27 -0
  168. package/dist/modules/rendering/OverlayFrameRenderer.d.ts.map +1 -0
  169. package/dist/modules/rendering/OverlayFrameRenderer.js +2 -0
  170. package/dist/modules/rendering/OverlayFrameRenderer.js.map +1 -0
  171. package/dist/modules/rendering/RenderingConfig.d.ts +22 -0
  172. package/dist/modules/rendering/RenderingConfig.d.ts.map +1 -0
  173. package/dist/modules/rendering/RenderingConfig.js +2 -0
  174. package/dist/modules/rendering/RenderingConfig.js.map +1 -0
  175. package/dist/modules/rendering/ScopedRenderOverride.d.ts +19 -0
  176. package/dist/modules/rendering/ScopedRenderOverride.d.ts.map +1 -0
  177. package/dist/modules/rendering/ScopedRenderOverride.js +2 -0
  178. package/dist/modules/rendering/ScopedRenderOverride.js.map +1 -0
  179. package/dist/modules/rendering/SegmentPaintRegionResolver.d.ts +41 -0
  180. package/dist/modules/rendering/SegmentPaintRegionResolver.d.ts.map +1 -0
  181. package/dist/modules/rendering/SegmentPaintRegionResolver.js +47 -0
  182. package/dist/modules/rendering/SegmentPaintRegionResolver.js.map +1 -0
  183. package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts +58 -0
  184. package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.d.ts.map +1 -0
  185. package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js +132 -0
  186. package/dist/modules/rendering/SegmentSubtreeHtmlBuilder.js.map +1 -0
  187. package/dist/modules/rendering/SubtitleFrameRenderer.d.ts +111 -0
  188. package/dist/modules/rendering/SubtitleFrameRenderer.d.ts.map +1 -0
  189. package/dist/modules/rendering/SubtitleFrameRenderer.js +2 -0
  190. package/dist/modules/rendering/SubtitleFrameRenderer.js.map +1 -0
  191. package/dist/modules/rendering/VideoFrameLayerClass.d.ts +21 -0
  192. package/dist/modules/rendering/VideoFrameLayerClass.d.ts.map +1 -0
  193. package/dist/modules/rendering/VideoFrameLayerClass.js +21 -0
  194. package/dist/modules/rendering/VideoFrameLayerClass.js.map +1 -0
  195. package/dist/modules/rendering/VideoFrameSource.d.ts +29 -0
  196. package/dist/modules/rendering/VideoFrameSource.d.ts.map +1 -0
  197. package/dist/modules/rendering/VideoFrameSource.js +2 -0
  198. package/dist/modules/rendering/VideoFrameSource.js.map +1 -0
  199. package/dist/modules/rendering/index.d.ts +14 -0
  200. package/dist/modules/rendering/index.d.ts.map +1 -0
  201. package/dist/modules/rendering/index.js +6 -0
  202. package/dist/modules/rendering/index.js.map +1 -0
  203. package/dist/modules/splitting/BalancedLineSplitter.d.ts +24 -0
  204. package/dist/modules/splitting/BalancedLineSplitter.d.ts.map +1 -0
  205. package/dist/modules/splitting/BalancedLineSplitter.js +81 -0
  206. package/dist/modules/splitting/BalancedLineSplitter.js.map +1 -0
  207. package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts +31 -0
  208. package/dist/modules/splitting/BalancedPixelWidthLineSplitter.d.ts.map +1 -0
  209. package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js +99 -0
  210. package/dist/modules/splitting/BalancedPixelWidthLineSplitter.js.map +1 -0
  211. package/dist/modules/splitting/BoundarySegmentSplitter.d.ts +19 -0
  212. package/dist/modules/splitting/BoundarySegmentSplitter.d.ts.map +1 -0
  213. package/dist/modules/splitting/BoundarySegmentSplitter.js +38 -0
  214. package/dist/modules/splitting/BoundarySegmentSplitter.js.map +1 -0
  215. package/dist/modules/splitting/CompositeSegmentSplitter.d.ts +8 -0
  216. package/dist/modules/splitting/CompositeSegmentSplitter.d.ts.map +1 -0
  217. package/dist/modules/splitting/CompositeSegmentSplitter.js +12 -0
  218. package/dist/modules/splitting/CompositeSegmentSplitter.js.map +1 -0
  219. package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts +56 -0
  220. package/dist/modules/splitting/DomProbeCanvasTextMeasurer.d.ts.map +1 -0
  221. package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js +197 -0
  222. package/dist/modules/splitting/DomProbeCanvasTextMeasurer.js.map +1 -0
  223. package/dist/modules/splitting/GraphemeWordSplitter.d.ts +11 -0
  224. package/dist/modules/splitting/GraphemeWordSplitter.d.ts.map +1 -0
  225. package/dist/modules/splitting/GraphemeWordSplitter.js +12 -0
  226. package/dist/modules/splitting/GraphemeWordSplitter.js.map +1 -0
  227. package/dist/modules/splitting/LimitByCharsSegmentSplitter.d.ts +15 -0
  228. package/dist/modules/splitting/LimitByCharsSegmentSplitter.d.ts.map +1 -0
  229. package/dist/modules/splitting/LimitByCharsSegmentSplitter.js +64 -0
  230. package/dist/modules/splitting/LimitByCharsSegmentSplitter.js.map +1 -0
  231. package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.d.ts +30 -0
  232. package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.d.ts.map +1 -0
  233. package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.js +66 -0
  234. package/dist/modules/splitting/LimitByScaledCharsSegmentSplitter.js.map +1 -0
  235. package/dist/modules/splitting/LimitByWordsSegmentSplitter.d.ts +12 -0
  236. package/dist/modules/splitting/LimitByWordsSegmentSplitter.d.ts.map +1 -0
  237. package/dist/modules/splitting/LimitByWordsSegmentSplitter.js +25 -0
  238. package/dist/modules/splitting/LimitByWordsSegmentSplitter.js.map +1 -0
  239. package/dist/modules/splitting/LineSplitter.d.ts +10 -0
  240. package/dist/modules/splitting/LineSplitter.d.ts.map +1 -0
  241. package/dist/modules/splitting/LineSplitter.js +2 -0
  242. package/dist/modules/splitting/LineSplitter.js.map +1 -0
  243. package/dist/modules/splitting/PauseBasedSegmentSplitter.d.ts +24 -0
  244. package/dist/modules/splitting/PauseBasedSegmentSplitter.d.ts.map +1 -0
  245. package/dist/modules/splitting/PauseBasedSegmentSplitter.js +43 -0
  246. package/dist/modules/splitting/PauseBasedSegmentSplitter.js.map +1 -0
  247. package/dist/modules/splitting/SegmentSplitter.d.ts +10 -0
  248. package/dist/modules/splitting/SegmentSplitter.d.ts.map +1 -0
  249. package/dist/modules/splitting/SegmentSplitter.js +2 -0
  250. package/dist/modules/splitting/SegmentSplitter.js.map +1 -0
  251. package/dist/modules/splitting/SpeakerChangeSegmentSplitter.d.ts +17 -0
  252. package/dist/modules/splitting/SpeakerChangeSegmentSplitter.d.ts.map +1 -0
  253. package/dist/modules/splitting/SpeakerChangeSegmentSplitter.js +46 -0
  254. package/dist/modules/splitting/SpeakerChangeSegmentSplitter.js.map +1 -0
  255. package/dist/modules/splitting/TextMeasurer.d.ts +15 -0
  256. package/dist/modules/splitting/TextMeasurer.d.ts.map +1 -0
  257. package/dist/modules/splitting/TextMeasurer.js +2 -0
  258. package/dist/modules/splitting/TextMeasurer.js.map +1 -0
  259. package/dist/modules/splitting/WordSplitter.d.ts +8 -0
  260. package/dist/modules/splitting/WordSplitter.d.ts.map +1 -0
  261. package/dist/modules/splitting/WordSplitter.js +2 -0
  262. package/dist/modules/splitting/WordSplitter.js.map +1 -0
  263. package/dist/modules/splitting/index.d.ts +24 -0
  264. package/dist/modules/splitting/index.d.ts.map +1 -0
  265. package/dist/modules/splitting/index.js +12 -0
  266. package/dist/modules/splitting/index.js.map +1 -0
  267. package/dist/modules/svg-filter/SvgFilter.d.ts +16 -0
  268. package/dist/modules/svg-filter/SvgFilter.d.ts.map +1 -0
  269. package/dist/modules/svg-filter/SvgFilter.js +28 -0
  270. package/dist/modules/svg-filter/SvgFilter.js.map +1 -0
  271. package/dist/modules/svg-filter/SvgFilterBundle.d.ts +16 -0
  272. package/dist/modules/svg-filter/SvgFilterBundle.d.ts.map +1 -0
  273. package/dist/modules/svg-filter/SvgFilterBundle.js +20 -0
  274. package/dist/modules/svg-filter/SvgFilterBundle.js.map +1 -0
  275. package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts +16 -0
  276. package/dist/modules/svg-filter/SvgFilterDefinitions.d.ts.map +1 -0
  277. package/dist/modules/svg-filter/SvgFilterDefinitions.js +25 -0
  278. package/dist/modules/svg-filter/SvgFilterDefinitions.js.map +1 -0
  279. package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts +21 -0
  280. package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts.map +1 -0
  281. package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js +50 -0
  282. package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js.map +1 -0
  283. package/dist/modules/svg-filter/SvgFilterLengthResolver.d.ts +17 -0
  284. package/dist/modules/svg-filter/SvgFilterLengthResolver.d.ts.map +1 -0
  285. package/dist/modules/svg-filter/SvgFilterLengthResolver.js +27 -0
  286. package/dist/modules/svg-filter/SvgFilterLengthResolver.js.map +1 -0
  287. package/dist/modules/svg-filter/SvgFilterScope.d.ts +18 -0
  288. package/dist/modules/svg-filter/SvgFilterScope.d.ts.map +1 -0
  289. package/dist/modules/svg-filter/SvgFilterScope.js +28 -0
  290. package/dist/modules/svg-filter/SvgFilterScope.js.map +1 -0
  291. package/dist/modules/svg-filter/SvgFilterScopeProvider.d.ts +52 -0
  292. package/dist/modules/svg-filter/SvgFilterScopeProvider.d.ts.map +1 -0
  293. package/dist/modules/svg-filter/SvgFilterScopeProvider.js +2 -0
  294. package/dist/modules/svg-filter/SvgFilterScopeProvider.js.map +1 -0
  295. package/dist/modules/svg-filter/SvgFilterScoper.d.ts +60 -0
  296. package/dist/modules/svg-filter/SvgFilterScoper.d.ts.map +1 -0
  297. package/dist/modules/svg-filter/SvgFilterScoper.js +58 -0
  298. package/dist/modules/svg-filter/SvgFilterScoper.js.map +1 -0
  299. package/dist/modules/svg-filter/index.d.ts +10 -0
  300. package/dist/modules/svg-filter/index.d.ts.map +1 -0
  301. package/dist/modules/svg-filter/index.js +8 -0
  302. package/dist/modules/svg-filter/index.js.map +1 -0
  303. package/dist/modules/tagging/RegexTagger.d.ts +11 -0
  304. package/dist/modules/tagging/RegexTagger.d.ts.map +1 -0
  305. package/dist/modules/tagging/RegexTagger.js +32 -0
  306. package/dist/modules/tagging/RegexTagger.js.map +1 -0
  307. package/dist/modules/tagging/SpanTagger.d.ts +25 -0
  308. package/dist/modules/tagging/SpanTagger.d.ts.map +1 -0
  309. package/dist/modules/tagging/SpanTagger.js +73 -0
  310. package/dist/modules/tagging/SpanTagger.js.map +1 -0
  311. package/dist/modules/tagging/StructureTagger.d.ts +20 -0
  312. package/dist/modules/tagging/StructureTagger.d.ts.map +1 -0
  313. package/dist/modules/tagging/StructureTagger.js +74 -0
  314. package/dist/modules/tagging/StructureTagger.js.map +1 -0
  315. package/dist/modules/tagging/Tagger.d.ts +5 -0
  316. package/dist/modules/tagging/Tagger.d.ts.map +1 -0
  317. package/dist/modules/tagging/Tagger.js +5 -0
  318. package/dist/modules/tagging/Tagger.js.map +1 -0
  319. package/dist/modules/tagging/WordlistTagger.d.ts +11 -0
  320. package/dist/modules/tagging/WordlistTagger.d.ts.map +1 -0
  321. package/dist/modules/tagging/WordlistTagger.js +31 -0
  322. package/dist/modules/tagging/WordlistTagger.js.map +1 -0
  323. package/dist/modules/tagging/index.d.ts +6 -0
  324. package/dist/modules/tagging/index.d.ts.map +1 -0
  325. package/dist/modules/tagging/index.js +6 -0
  326. package/dist/modules/tagging/index.js.map +1 -0
  327. package/dist/modules/transcription/AudioDecoder.d.ts +11 -0
  328. package/dist/modules/transcription/AudioDecoder.d.ts.map +1 -0
  329. package/dist/modules/transcription/AudioDecoder.js +2 -0
  330. package/dist/modules/transcription/AudioDecoder.js.map +1 -0
  331. package/dist/modules/transcription/BrowserAudioDecoder.d.ts +13 -0
  332. package/dist/modules/transcription/BrowserAudioDecoder.d.ts.map +1 -0
  333. package/dist/modules/transcription/BrowserAudioDecoder.js +34 -0
  334. package/dist/modules/transcription/BrowserAudioDecoder.js.map +1 -0
  335. package/dist/modules/transcription/PassthroughTranscriber.d.ts +20 -0
  336. package/dist/modules/transcription/PassthroughTranscriber.d.ts.map +1 -0
  337. package/dist/modules/transcription/PassthroughTranscriber.js +23 -0
  338. package/dist/modules/transcription/PassthroughTranscriber.js.map +1 -0
  339. package/dist/modules/transcription/PreDecodedAudioDecoder.d.ts +12 -0
  340. package/dist/modules/transcription/PreDecodedAudioDecoder.d.ts.map +1 -0
  341. package/dist/modules/transcription/PreDecodedAudioDecoder.js +14 -0
  342. package/dist/modules/transcription/PreDecodedAudioDecoder.js.map +1 -0
  343. package/dist/modules/transcription/SrtTranscriber.d.ts +33 -0
  344. package/dist/modules/transcription/SrtTranscriber.d.ts.map +1 -0
  345. package/dist/modules/transcription/SrtTranscriber.js +111 -0
  346. package/dist/modules/transcription/SrtTranscriber.js.map +1 -0
  347. package/dist/modules/transcription/Transcriber.d.ts +23 -0
  348. package/dist/modules/transcription/Transcriber.d.ts.map +1 -0
  349. package/dist/modules/transcription/Transcriber.js +2 -0
  350. package/dist/modules/transcription/Transcriber.js.map +1 -0
  351. package/dist/modules/transcription/WhisperTranscriber.d.ts +44 -0
  352. package/dist/modules/transcription/WhisperTranscriber.d.ts.map +1 -0
  353. package/dist/modules/transcription/WhisperTranscriber.js +162 -0
  354. package/dist/modules/transcription/WhisperTranscriber.js.map +1 -0
  355. package/dist/modules/transcription/index.d.ts +8 -0
  356. package/dist/modules/transcription/index.d.ts.map +1 -0
  357. package/dist/modules/transcription/index.js +6 -0
  358. package/dist/modules/transcription/index.js.map +1 -0
  359. package/dist/modules/video/RenderJob.d.ts +95 -0
  360. package/dist/modules/video/RenderJob.d.ts.map +1 -0
  361. package/dist/modules/video/RenderJob.js +2 -0
  362. package/dist/modules/video/RenderJob.js.map +1 -0
  363. package/dist/modules/video/VideoRenderer.d.ts +5 -0
  364. package/dist/modules/video/VideoRenderer.d.ts.map +1 -0
  365. package/dist/modules/video/VideoRenderer.js +2 -0
  366. package/dist/modules/video/VideoRenderer.js.map +1 -0
  367. package/dist/modules/video/index.d.ts +33 -0
  368. package/dist/modules/video/index.d.ts.map +1 -0
  369. package/dist/modules/video/index.js +17 -0
  370. package/dist/modules/video/index.js.map +1 -0
  371. package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts +69 -0
  372. package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.d.ts.map +1 -0
  373. package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js +206 -0
  374. package/dist/modules/video/mediabunny/MediaBunnyVideoRenderer.js.map +1 -0
  375. package/dist/modules/video/mediabunny/audio/AudioTrackBridge.d.ts +24 -0
  376. package/dist/modules/video/mediabunny/audio/AudioTrackBridge.d.ts.map +1 -0
  377. package/dist/modules/video/mediabunny/audio/AudioTrackBridge.js +2 -0
  378. package/dist/modules/video/mediabunny/audio/AudioTrackBridge.js.map +1 -0
  379. package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts +20 -0
  380. package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.d.ts.map +1 -0
  381. package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.js +2 -0
  382. package/dist/modules/video/mediabunny/audio/AudioTrackBridgeFactory.js.map +1 -0
  383. package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.d.ts +11 -0
  384. package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.d.ts.map +1 -0
  385. package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js +32 -0
  386. package/dist/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.js.map +1 -0
  387. package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.d.ts +12 -0
  388. package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.d.ts.map +1 -0
  389. package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.js +14 -0
  390. package/dist/modules/video/mediabunny/audio/DiscardAudioTrackBridge.js.map +1 -0
  391. package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts +28 -0
  392. package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.d.ts.map +1 -0
  393. package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js +52 -0
  394. package/dist/modules/video/mediabunny/audio/PassthroughAudioTrackBridge.js.map +1 -0
  395. package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts +25 -0
  396. package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.d.ts.map +1 -0
  397. package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js +52 -0
  398. package/dist/modules/video/mediabunny/audio/TranscodeAudioTrackBridge.js.map +1 -0
  399. package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts +32 -0
  400. package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.d.ts.map +1 -0
  401. package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js +60 -0
  402. package/dist/modules/video/mediabunny/caption/BatchedSubtitleLayerSource.js.map +1 -0
  403. package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts +27 -0
  404. package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.d.ts.map +1 -0
  405. package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js +72 -0
  406. package/dist/modules/video/mediabunny/caption/ComposedSubtitleLayerSource.js.map +1 -0
  407. package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts +32 -0
  408. package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.d.ts.map +1 -0
  409. package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.js +2 -0
  410. package/dist/modules/video/mediabunny/caption/SubtitleLayerSource.js.map +1 -0
  411. package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts +25 -0
  412. package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.d.ts.map +1 -0
  413. package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js +37 -0
  414. package/dist/modules/video/mediabunny/caption/VideoBoundSubtitleLayerSource.js.map +1 -0
  415. package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts +32 -0
  416. package/dist/modules/video/mediabunny/codec/CodecPolicy.d.ts.map +1 -0
  417. package/dist/modules/video/mediabunny/codec/CodecPolicy.js +2 -0
  418. package/dist/modules/video/mediabunny/codec/CodecPolicy.js.map +1 -0
  419. package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.d.ts +59 -0
  420. package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.d.ts.map +1 -0
  421. package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.js +110 -0
  422. package/dist/modules/video/mediabunny/codec/DefaultCodecPolicy.js.map +1 -0
  423. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.d.ts +27 -0
  424. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.d.ts.map +1 -0
  425. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js +44 -0
  426. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder.js.map +1 -0
  427. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.d.ts +10 -0
  428. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.d.ts.map +1 -0
  429. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.js +15 -0
  430. package/dist/modules/video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory.js.map +1 -0
  431. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.d.ts +29 -0
  432. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.d.ts.map +1 -0
  433. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.js +2 -0
  434. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoder.js.map +1 -0
  435. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.d.ts +16 -0
  436. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.d.ts.map +1 -0
  437. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.js +2 -0
  438. package/dist/modules/video/mediabunny/encoder/VideoTrackEncoderFactory.js.map +1 -0
  439. package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts +25 -0
  440. package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts.map +1 -0
  441. package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js +74 -0
  442. package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js.map +1 -0
  443. package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.d.ts +26 -0
  444. package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.d.ts.map +1 -0
  445. package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.js +147 -0
  446. package/dist/modules/video/mediabunny/frame/CustomWebCodecsVideoFrameDecoder.js.map +1 -0
  447. package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.d.ts +12 -0
  448. package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.d.ts.map +1 -0
  449. package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js +25 -0
  450. package/dist/modules/video/mediabunny/frame/DefaultVideoFrameDecoderFactory.js.map +1 -0
  451. package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts +30 -0
  452. package/dist/modules/video/mediabunny/frame/FrameCompositor.d.ts.map +1 -0
  453. package/dist/modules/video/mediabunny/frame/FrameCompositor.js +2 -0
  454. package/dist/modules/video/mediabunny/frame/FrameCompositor.js.map +1 -0
  455. package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.d.ts +44 -0
  456. package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.d.ts.map +1 -0
  457. package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.js +334 -0
  458. package/dist/modules/video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder.js.map +1 -0
  459. package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts +10 -0
  460. package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.d.ts.map +1 -0
  461. package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js +17 -0
  462. package/dist/modules/video/mediabunny/frame/LayeredFrameCompositor.js.map +1 -0
  463. package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.d.ts +30 -0
  464. package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.d.ts.map +1 -0
  465. package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.js +2 -0
  466. package/dist/modules/video/mediabunny/frame/VideoFrameDecoder.js.map +1 -0
  467. package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts +22 -0
  468. package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.d.ts.map +1 -0
  469. package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.js +2 -0
  470. package/dist/modules/video/mediabunny/frame/VideoFrameDecoderFactory.js.map +1 -0
  471. package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.d.ts +17 -0
  472. package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.d.ts.map +1 -0
  473. package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.js +48 -0
  474. package/dist/modules/video/mediabunny/frame/WebCodecsVideoFrameDecoder.js.map +1 -0
  475. package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.d.ts +11 -0
  476. package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.d.ts.map +1 -0
  477. package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.js +22 -0
  478. package/dist/modules/video/mediabunny/output/MediaBunnyOutputTargetBuilder.js.map +1 -0
  479. package/dist/modules/video/mediabunny/output/OutputTargetBuilder.d.ts +27 -0
  480. package/dist/modules/video/mediabunny/output/OutputTargetBuilder.d.ts.map +1 -0
  481. package/dist/modules/video/mediabunny/output/OutputTargetBuilder.js +2 -0
  482. package/dist/modules/video/mediabunny/output/OutputTargetBuilder.js.map +1 -0
  483. package/package.json +67 -0
@@ -0,0 +1,95 @@
1
+ import type { Document } from '../document/Document';
2
+ import type { SubtitleStyle } from '../rendering/SubtitleFrameRenderer';
3
+ export type OutputFormat = 'mp4' | 'webm';
4
+ export type RenderQuality = 'low' | 'medium' | 'high' | 'very-high';
5
+ /**
6
+ * One write emitted into a `RenderJob.outputStream`: a byte slice and the
7
+ * absolute file offset where it lands. `position` is not monotonic — the
8
+ * muxer may seek back to patch earlier header regions once total sizes
9
+ * are known.
10
+ */
11
+ export interface RenderOutputChunk {
12
+ type: 'write';
13
+ data: Uint8Array;
14
+ position: number;
15
+ }
16
+ /**
17
+ * Reasons the input's audio may end up missing from the output, surfaced
18
+ * only when the input actually had an audio track.
19
+ */
20
+ export type AudioDiscardReason =
21
+ /** The input had an audio track but its codec could not be identified. */
22
+ 'unknown-source-codec'
23
+ /** No codec is encodable by the host that the output container can hold. */
24
+ | 'no-encodable-target-codec';
25
+ /**
26
+ * Information surfaced when the renderer cannot decode the input through
27
+ * the fast (WebCodecs) path and would have to fall back to a slower
28
+ * decoder. Lets the caller warn the user before the slow path runs.
29
+ */
30
+ export interface FallbackDecoderInfo {
31
+ /** Codec of the input video track that triggered the fallback. */
32
+ inputCodec: string;
33
+ }
34
+ export interface RenderJob {
35
+ video: File;
36
+ document: Document;
37
+ /**
38
+ * Available styles keyed by `Section.kind`. The renderer dispatches
39
+ * per-frame to the entry matching the active Section's `kind`.
40
+ */
41
+ styles: Readonly<Record<string, SubtitleStyle>>;
42
+ /**
43
+ * Frame-invariant HTML composited above subtitles inside the same
44
+ * SVG `foreignObject`. Self-contained: any styling must be inline.
45
+ */
46
+ overlayHtml?: string;
47
+ outputFormat?: OutputFormat;
48
+ quality?: RenderQuality;
49
+ /**
50
+ * Target output dimensions. When omitted, the renderer keeps the
51
+ * input track's intrinsic display dimensions. When set, the source
52
+ * frames are scaled to these dimensions before composition; the
53
+ * subtitle layer is rendered directly at this size so text stays
54
+ * crisp instead of being scaled along with the video.
55
+ *
56
+ * Callers are responsible for keeping the aspect ratio consistent
57
+ * with the source — the renderer does not letterbox or crop.
58
+ */
59
+ outputResolution?: {
60
+ width: number;
61
+ height: number;
62
+ };
63
+ /**
64
+ * Sink for the encoded bytes. When set, the renderer writes chunks to
65
+ * it as the encoder produces them and `RenderResult.blob` is `null`.
66
+ * When unset, the encoded file accumulates in memory and is returned
67
+ * via `RenderResult.blob`.
68
+ */
69
+ outputStream?: WritableStream<RenderOutputChunk>;
70
+ /**
71
+ * Called when the input had an audio track but the renderer has to
72
+ * drop it. Not invoked when the input has no audio at all.
73
+ */
74
+ onAudioDiscarded?: (reason: AudioDiscardReason) => void;
75
+ /**
76
+ * Called when the renderer cannot decode the input through the fast
77
+ * (WebCodecs) path and would have to fall back to a slower decoder.
78
+ * Resolve with `true` to continue with the fallback, `false` to abort
79
+ * the render. When not provided, the renderer uses the fallback
80
+ * silently. The render rejects with a `DOMException` of name
81
+ * `'AbortError'` when the caller resolves with `false`.
82
+ */
83
+ confirmFallbackDecoder?: (info: FallbackDecoderInfo) => Promise<boolean>;
84
+ }
85
+ export interface RenderResult {
86
+ /** Encoded file in memory, or `null` when the job supplied `outputStream`. */
87
+ blob: Blob | null;
88
+ mimeType: string;
89
+ }
90
+ export interface RenderProgress {
91
+ percent: number;
92
+ currentFrame: number;
93
+ totalFrames: number;
94
+ }
95
+ //# sourceMappingURL=RenderJob.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderJob.d.ts","sourceRoot":"","sources":["../../../src/modules/video/RenderJob.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAE9E,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAEpE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AW,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=RenderJob.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RenderJob.js","sourceRoot":"","sources":["../../../src/modules/video/RenderJob.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import type { RenderJob, RenderResult, RenderProgress } from '../video/RenderJob';
2
+ export interface VideoRenderer {
3
+ render(job: RenderJob, onProgress?: (progress: RenderProgress) => void): Promise<RenderResult>;
4
+ }
5
+ //# sourceMappingURL=VideoRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoRenderer.d.ts","sourceRoot":"","sources":["../../../src/modules/video/VideoRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAExF,MAAM,WAAW,aAAa;IAC5B,MAAM,CACJ,GAAG,EAAE,SAAS,EACd,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,GAC9C,OAAO,CAAC,YAAY,CAAC,CAAC;CAC1B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=VideoRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VideoRenderer.js","sourceRoot":"","sources":["../../../src/modules/video/VideoRenderer.ts"],"names":[],"mappings":""}
@@ -0,0 +1,33 @@
1
+ export type { VideoRenderer } from '../video/VideoRenderer';
2
+ export type { RenderJob, RenderResult, RenderProgress, RenderOutputChunk, OutputFormat, RenderQuality, AudioDiscardReason, FallbackDecoderInfo, } from '../video/RenderJob';
3
+ export { MediaBunnyVideoRenderer } from '../video/mediabunny/MediaBunnyVideoRenderer';
4
+ export type { MediaBunnyVideoRendererConfig } from '../video/mediabunny/MediaBunnyVideoRenderer';
5
+ export type { CodecPolicy, VideoCodecResolution, VideoCodecResolutionRequest, } from '../video/mediabunny/codec/CodecPolicy';
6
+ export { DefaultCodecPolicy } from '../video/mediabunny/codec/DefaultCodecPolicy';
7
+ export type { VideoFrameDecoder, DecodedVideoFrame, } from '../video/mediabunny/frame/VideoFrameDecoder';
8
+ export type { VideoFrameDecoderFactory, VideoFrameDecoderRequest, } from '../video/mediabunny/frame/VideoFrameDecoderFactory';
9
+ export { DefaultVideoFrameDecoderFactory } from '../video/mediabunny/frame/DefaultVideoFrameDecoderFactory';
10
+ export { WebCodecsVideoFrameDecoder } from '../video/mediabunny/frame/WebCodecsVideoFrameDecoder';
11
+ export { HtmlVideoElementVideoFrameDecoder } from '../video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder';
12
+ export type { VideoTrackEncoder } from '../video/mediabunny/encoder/VideoTrackEncoder';
13
+ export type { VideoTrackEncoderFactory, VideoTrackEncoderFactoryRequest, } from '../video/mediabunny/encoder/VideoTrackEncoderFactory';
14
+ export { MediaBunnyCanvasVideoTrackEncoder, } from '../video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder';
15
+ export type { MediaBunnyCanvasVideoTrackEncoderConfig, } from '../video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder';
16
+ export { MediaBunnyCanvasVideoTrackEncoderFactory, } from '../video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory';
17
+ export type { FrameCompositor } from '../video/mediabunny/frame/FrameCompositor';
18
+ export { LayeredFrameCompositor } from '../video/mediabunny/frame/LayeredFrameCompositor';
19
+ export type { SubtitleLayerSource } from '../video/mediabunny/caption/SubtitleLayerSource';
20
+ export { BatchedSubtitleLayerSource } from '../video/mediabunny/caption/BatchedSubtitleLayerSource';
21
+ export { VideoBoundSubtitleLayerSource } from '../video/mediabunny/caption/VideoBoundSubtitleLayerSource';
22
+ export { ComposedSubtitleLayerSource } from '../video/mediabunny/caption/ComposedSubtitleLayerSource';
23
+ export type { AudioTrackBridge } from '../video/mediabunny/audio/AudioTrackBridge';
24
+ export type { AudioTrackBridgeFactory, AudioTrackBridgeRequest, } from '../video/mediabunny/audio/AudioTrackBridgeFactory';
25
+ export { DefaultAudioTrackBridgeFactory } from '../video/mediabunny/audio/DefaultAudioTrackBridgeFactory';
26
+ export { PassthroughAudioTrackBridge } from '../video/mediabunny/audio/PassthroughAudioTrackBridge';
27
+ export type { PassthroughAudioTrackBridgeConfig, } from '../video/mediabunny/audio/PassthroughAudioTrackBridge';
28
+ export { TranscodeAudioTrackBridge } from '../video/mediabunny/audio/TranscodeAudioTrackBridge';
29
+ export type { TranscodeAudioTrackBridgeConfig, } from '../video/mediabunny/audio/TranscodeAudioTrackBridge';
30
+ export { DiscardAudioTrackBridge } from '../video/mediabunny/audio/DiscardAudioTrackBridge';
31
+ export type { OutputTargetBuilder, OutputTargetBuildRequest, OutputTargetBuildResult, } from '../video/mediabunny/output/OutputTargetBuilder';
32
+ export { MediaBunnyOutputTargetBuilder } from '../video/mediabunny/output/MediaBunnyOutputTargetBuilder';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/video/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,YAAY,EACV,SAAS,EACT,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAC5F,YAAY,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAEvG,YAAY,EACV,WAAW,EACX,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAExF,YAAY,EACV,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,mDAAmD,CAAC;AAC3D,YAAY,EACV,wBAAwB,EACxB,wB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YAAY,EACV,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAAE,MAAM,gEAAgE,CAAC"}
@@ -0,0 +1,17 @@
1
+ export { MediaBunnyVideoRenderer } from '../video/mediabunny/MediaBunnyVideoRenderer';
2
+ export { DefaultCodecPolicy } from '../video/mediabunny/codec/DefaultCodecPolicy';
3
+ export { DefaultVideoFrameDecoderFactory } from '../video/mediabunny/frame/DefaultVideoFrameDecoderFactory';
4
+ export { WebCodecsVideoFrameDecoder } from '../video/mediabunny/frame/WebCodecsVideoFrameDecoder';
5
+ export { HtmlVideoElementVideoFrameDecoder } from '../video/mediabunny/frame/HtmlVideoElementVideoFrameDecoder';
6
+ export { MediaBunnyCanvasVideoTrackEncoder, } from '../video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoder';
7
+ export { MediaBunnyCanvasVideoTrackEncoderFactory, } from '../video/mediabunny/encoder/MediaBunnyCanvasVideoTrackEncoderFactory';
8
+ export { LayeredFrameCompositor } from '../video/mediabunny/frame/LayeredFrameCompositor';
9
+ export { BatchedSubtitleLayerSource } from '../video/mediabunny/caption/BatchedSubtitleLayerSource';
10
+ export { VideoBoundSubtitleLayerSource } from '../video/mediabunny/caption/VideoBoundSubtitleLayerSource';
11
+ export { ComposedSubtitleLayerSource } from '../video/mediabunny/caption/ComposedSubtitleLayerSource';
12
+ export { DefaultAudioTrackBridgeFactory } from '../video/mediabunny/audio/DefaultAudioTrackBridgeFactory';
13
+ export { PassthroughAudioTrackBridge } from '../video/mediabunny/audio/PassthroughAudioTrackBridge';
14
+ export { TranscodeAudioTrackBridge } from '../video/mediabunny/audio/TranscodeAudioTrackBridge';
15
+ export { DiscardAudioTrackBridge } from '../video/mediabunny/audio/DiscardAudioTrackBridge';
16
+ export { MediaBunnyOutputTargetBuilder } from '../video/mediabunny/output/MediaBunnyOutputTargetBuilder';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/video/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mDAAmD,CAAC;AAQ5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AAUxF,OAAO,EAAE,+BAA+B,EAAE,MAAM,iEAAiE,CAAC;AAClH,OAAO,EAAE,0BAA0B,EAAE,MAAM,4DAA4D,CAAC;AACxG,OAAO,EAAE,iCAAiC,EAAE,MAAM,mEAAmE,CAAC;AAOtH,OAAO,EACL,iCAAiC,GAClC,MAAM,qEAAqE,CAAC;AAI7E,OAAO,EACL,wCAAwC,GACzC,MAAM,4EAA4E,CAAC;AAGpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AAGhG,OAAO,EAAE,0BAA0B,EAAE,MAAM,8DAA8D,CAAC;AAC1G,OAAO,EAAE,6BAA6B,EAAE,MAAM,iEAAiE,CAAC;AAChH,OAAO,EAAE,2BAA2B,EAAE,MAAM,+DAA+D,CAAC;AAO5G,OAAO,EAAE,8BAA8B,EAAE,MAAM,gEAAgE,CAAC;AAChH,OAAO,EAAE,2BAA2B,EAAE,MAAM,6DAA6D,CAAC;AAI1G,OAAO,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AAItG,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAOlG,OAAO,EAAE,6BAA6B,EAAE,MAAM,gEAAgE,CAAC"}
@@ -0,0 +1,69 @@
1
+ import type { VideoRenderer } from '../../video/VideoRenderer';
2
+ import type { RenderJob, RenderResult, RenderProgress } from '../../video/RenderJob';
3
+ import type { OverlayFrameRenderer } from '../../rendering/OverlayFrameRenderer';
4
+ import type { CodecPolicy } from '../../video/mediabunny/codec/CodecPolicy';
5
+ import type { VideoFrameDecoderFactory } from '../../video/mediabunny/frame/VideoFrameDecoderFactory';
6
+ import type { AudioTrackBridgeFactory } from '../../video/mediabunny/audio/AudioTrackBridgeFactory';
7
+ import type { OutputTargetBuilder } from '../../video/mediabunny/output/OutputTargetBuilder';
8
+ import type { VideoTrackEncoderFactory } from '../../video/mediabunny/encoder/VideoTrackEncoderFactory';
9
+ import type { FrameCompositor } from '../../video/mediabunny/frame/FrameCompositor';
10
+ import type { SubtitleLayerSource } from '../../video/mediabunny/caption/SubtitleLayerSource';
11
+ export interface MediaBunnyVideoRendererConfig {
12
+ /**
13
+ * Produces the caption raster painted onto each output frame. The
14
+ * coordinator does not split styles, snap times to caption ticks,
15
+ * or composite layers — all caption-side strategy lives behind
16
+ * this single source.
17
+ */
18
+ subtitleLayer: SubtitleLayerSource;
19
+ overlayRenderer: OverlayFrameRenderer;
20
+ codecPolicy: CodecPolicy;
21
+ videoFrameDecoderFactory: VideoFrameDecoderFactory;
22
+ videoTrackEncoderFactory: VideoTrackEncoderFactory;
23
+ audioTrackBridgeFactory: AudioTrackBridgeFactory;
24
+ outputTargetBuilder: OutputTargetBuilder;
25
+ frameCompositor: FrameCompositor;
26
+ }
27
+ /**
28
+ * Renders a `RenderJob` into a mediabunny {@link Output} container.
29
+ *
30
+ * Coordinates the decoder, the subtitle layer source, the frame
31
+ * compositor, the encoder, and the audio bridge. Caption strategy
32
+ * (batching, video-frame sampling, mixed) lives entirely behind the
33
+ * configured {@link SubtitleLayerSource}.
34
+ *
35
+ * One job at a time per instance: concurrent {@link render} calls on
36
+ * the same instance are not supported.
37
+ *
38
+ * Caption ticks step at most at {@link CAPTION_FPS_CAP}; inputs
39
+ * below that cap step at the input's own framerate.
40
+ */
41
+ export declare class MediaBunnyVideoRenderer implements VideoRenderer {
42
+ private readonly subtitleLayer;
43
+ private readonly overlayRenderer;
44
+ private readonly codecPolicy;
45
+ private readonly videoFrameDecoderFactory;
46
+ private readonly videoTrackEncoderFactory;
47
+ private readonly audioTrackBridgeFactory;
48
+ private readonly outputTargetBuilder;
49
+ private readonly frameCompositor;
50
+ constructor(config: MediaBunnyVideoRendererConfig);
51
+ render(job: RenderJob, onProgress?: (progress: RenderProgress) => void): Promise<RenderResult>;
52
+ private runEncodeLoop;
53
+ private toEncoderConfig;
54
+ private computeDuration;
55
+ /**
56
+ * Resolves the final pixel dimensions for the output. When the caller
57
+ * specifies `outputResolution`, those values win — but the renderer
58
+ * never upscales beyond the source and snaps to even numbers, which
59
+ * most hardware video encoders require.
60
+ */
61
+ private resolveOutputDimensions;
62
+ private toEven;
63
+ private readFrameRate;
64
+ private toProgress;
65
+ private safeCancel;
66
+ private assertWebCodecsAvailable;
67
+ private buildResult;
68
+ }
69
+ //# sourceMappingURL=MediaBunnyVideoRenderer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaBunnyVideoRenderer.d.ts","sourceRoot":"","sources":["../../../../src/modules/video/mediabunny/MediaBunnyVideoRenderer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EACV,SAAS,EACT,YAAY,EACZ,cAAc,EAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,oBAAoB,EAAgB,MAAM,yCAAyC,CAAC;AAClG,OAAO,KAAK,EAAE,WAAW,EAAwB,MAAM,6CAA6C,CAAC;AACrG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AAEzG,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAEvG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAEhG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AAC3G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iDAAiD,CAAC;AACvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAQjG,MAAM,WAAW,6BAA6B;IAC5C;;;;;OAKG;IACH,aAAa,EAAE,mBAAmB,CAAC;IACnC,eAAe,EAAE,oBAAoB,CAAC;IACtC,WAAW,EAAE,WAAW,CAAC;IACzB,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,wBAAwB,EAAE,wBAAwB,CAAC;IACnD,uBAAuB,EAAE,uBAAuB,CAAC;IACjD,mBAAmB,EAAE,mBAAmB,CAAC;IACzC,eAAe,EAAE,eAAe,CAAC;CAClC;AAWD;;;;;;;;;;;;;GAaG;AACH,qBAAa,uBAAwB,YAAW,aAAa;IAE3D,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAsB;IACpD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAuB;IACvD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA2B;IACpE,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAA2B;IACpE,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAA0B;IAClE,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAsB;IAC1D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAkB;gBAEtC,MAAM,EAAE,6BAA6B;IAW3C,MAAM,CACV,GAAG,EAAE,SAAS,EACd,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,IAAI,GAC9C,OAAO,CAAC,YAAY,CAAC;YAyEV,aAAa;IA6B3B,OAAO,CAAC,eAAe;YAWT,eAAe;IAQ7B;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,MAAM;YAKA,aAAa;IAe3B,OAAO,CAAC,UAAU;YAKJ,UAAU;IASxB,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,WAAW;CAQpB"}
@@ -0,0 +1,206 @@
1
+ import { Input, BlobSource, ALL_FORMATS, } from 'mediabunny';
2
+ // Captions step at the video's frame rate up to this cap. Past it,
3
+ // per-letter or per-word animations gain nothing from extra renders
4
+ // (the eye doesn't resolve sub-30fps differences in caption motion)
5
+ // and the per-batch subtitle decode dominates the render budget.
6
+ const CAPTION_FPS_CAP = 30;
7
+ /**
8
+ * Renders a `RenderJob` into a mediabunny {@link Output} container.
9
+ *
10
+ * Coordinates the decoder, the subtitle layer source, the frame
11
+ * compositor, the encoder, and the audio bridge. Caption strategy
12
+ * (batching, video-frame sampling, mixed) lives entirely behind the
13
+ * configured {@link SubtitleLayerSource}.
14
+ *
15
+ * One job at a time per instance: concurrent {@link render} calls on
16
+ * the same instance are not supported.
17
+ *
18
+ * Caption ticks step at most at {@link CAPTION_FPS_CAP}; inputs
19
+ * below that cap step at the input's own framerate.
20
+ */
21
+ export class MediaBunnyVideoRenderer {
22
+ subtitleLayer;
23
+ overlayRenderer;
24
+ codecPolicy;
25
+ videoFrameDecoderFactory;
26
+ videoTrackEncoderFactory;
27
+ audioTrackBridgeFactory;
28
+ outputTargetBuilder;
29
+ frameCompositor;
30
+ constructor(config) {
31
+ this.subtitleLayer = config.subtitleLayer;
32
+ this.overlayRenderer = config.overlayRenderer;
33
+ this.codecPolicy = config.codecPolicy;
34
+ this.videoFrameDecoderFactory = config.videoFrameDecoderFactory;
35
+ this.videoTrackEncoderFactory = config.videoTrackEncoderFactory;
36
+ this.audioTrackBridgeFactory = config.audioTrackBridgeFactory;
37
+ this.outputTargetBuilder = config.outputTargetBuilder;
38
+ this.frameCompositor = config.frameCompositor;
39
+ }
40
+ async render(job, onProgress) {
41
+ this.assertWebCodecsAvailable();
42
+ const input = new Input({ formats: ALL_FORMATS, source: new BlobSource(job.video) });
43
+ const videoTrack = await input.getPrimaryVideoTrack();
44
+ if (!videoTrack) {
45
+ throw new Error('No video track found in the input file');
46
+ }
47
+ const { width, height } = this.resolveOutputDimensions(videoTrack.displayWidth, videoTrack.displayHeight, job.outputResolution);
48
+ const fps = await this.readFrameRate(videoTrack);
49
+ const captionInterval = 1 / Math.min(fps, CAPTION_FPS_CAP);
50
+ await this.subtitleLayer.open(job.document, job.styles, width, height, captionInterval);
51
+ const { output, target, format } = this.outputTargetBuilder.build({
52
+ format: job.outputFormat,
53
+ stream: job.outputStream,
54
+ });
55
+ const codecResolution = await this.codecPolicy.resolveVideo({
56
+ supportedCodecs: format.getSupportedVideoCodecs(),
57
+ width,
58
+ height,
59
+ fps,
60
+ quality: job.quality,
61
+ });
62
+ const encoder = this.videoTrackEncoderFactory.create({
63
+ width,
64
+ height,
65
+ encoderConfig: this.toEncoderConfig(codecResolution),
66
+ });
67
+ encoder.attachTo(output);
68
+ const audioBridge = await this.audioTrackBridgeFactory.create({
69
+ input,
70
+ format,
71
+ ...(job.onAudioDiscarded ? { onAudioDiscarded: job.onAudioDiscarded } : {}),
72
+ });
73
+ await audioBridge.attachTo(output);
74
+ const decoder = await this.videoFrameDecoderFactory.create({
75
+ track: videoTrack,
76
+ source: job.video,
77
+ ...(job.confirmFallbackDecoder ? { confirmFallback: job.confirmFallbackDecoder } : {}),
78
+ });
79
+ const duration = await this.computeDuration(videoTrack);
80
+ const overlay = job.overlayHtml ? await this.overlayRenderer.render(job.overlayHtml, width, height) : null;
81
+ await output.start();
82
+ try {
83
+ await this.runEncodeLoop({ decoder, encoder, audioBridge, duration, overlay, onProgress });
84
+ await audioBridge.finish();
85
+ await output.finalize();
86
+ }
87
+ catch (err) {
88
+ await this.safeCancel(output);
89
+ throw err;
90
+ }
91
+ finally {
92
+ decoder.close();
93
+ this.subtitleLayer.close();
94
+ }
95
+ return this.buildResult(target, job.outputFormat);
96
+ }
97
+ // One decoded video frame is alive at any time: holding more would
98
+ // back-pressure the WebCodecs frame pool into a stall.
99
+ async runEncodeLoop(params) {
100
+ const width = params.encoder.width;
101
+ const height = params.encoder.height;
102
+ let frameCount = 0;
103
+ for await (const frame of params.decoder.samples()) {
104
+ try {
105
+ if (frame.timestamp < 0)
106
+ continue;
107
+ const captionLayer = await this.subtitleLayer.frameAt(frame.timestamp, frame);
108
+ await params.encoder.encode(frame.timestamp, frame.duration, (ctx) => {
109
+ this.frameCompositor.compose(ctx, {
110
+ frame,
111
+ captions: captionLayer,
112
+ overlay: params.overlay,
113
+ width,
114
+ height,
115
+ });
116
+ });
117
+ await params.audioBridge.pumpUntil(frame.timestamp);
118
+ frameCount++;
119
+ if (params.onProgress)
120
+ params.onProgress(this.toProgress(frame.timestamp, params.duration, frameCount));
121
+ }
122
+ finally {
123
+ frame.close();
124
+ }
125
+ }
126
+ }
127
+ toEncoderConfig(resolution) {
128
+ const config = {
129
+ codec: resolution.codec,
130
+ bitrate: resolution.bitrate,
131
+ bitrateMode: resolution.bitrateMode,
132
+ latencyMode: resolution.latencyMode,
133
+ };
134
+ if (resolution.contentHint !== undefined)
135
+ config.contentHint = resolution.contentHint;
136
+ return config;
137
+ }
138
+ async computeDuration(videoTrack) {
139
+ try {
140
+ return await videoTrack.computeDuration();
141
+ }
142
+ catch {
143
+ return 0;
144
+ }
145
+ }
146
+ /**
147
+ * Resolves the final pixel dimensions for the output. When the caller
148
+ * specifies `outputResolution`, those values win — but the renderer
149
+ * never upscales beyond the source and snaps to even numbers, which
150
+ * most hardware video encoders require.
151
+ */
152
+ resolveOutputDimensions(sourceWidth, sourceHeight, requested) {
153
+ if (!requested)
154
+ return { width: sourceWidth, height: sourceHeight };
155
+ const width = Math.min(requested.width, sourceWidth);
156
+ const height = Math.min(requested.height, sourceHeight);
157
+ return { width: this.toEven(width), height: this.toEven(height) };
158
+ }
159
+ toEven(value) {
160
+ const rounded = Math.round(value);
161
+ return rounded % 2 === 0 ? rounded : rounded - 1;
162
+ }
163
+ async readFrameRate(videoTrack) {
164
+ try {
165
+ const stats = await videoTrack.computePacketStats(120);
166
+ if (Number.isFinite(stats.averagePacketRate) && stats.averagePacketRate > 0) {
167
+ return stats.averagePacketRate;
168
+ }
169
+ }
170
+ catch {
171
+ // Falls through to the default.
172
+ }
173
+ console.warn('Could not determine input frame rate; defaulting to 30 fps');
174
+ return 30;
175
+ }
176
+ toProgress(timestamp, duration, frameCount) {
177
+ const percent = duration > 0 ? Math.min(100, Math.round((timestamp / duration) * 100)) : 0;
178
+ return { percent, currentFrame: frameCount, totalFrames: 0 };
179
+ }
180
+ async safeCancel(output) {
181
+ if (output.state === 'finalized' || output.state === 'canceled')
182
+ return;
183
+ try {
184
+ await output.cancel();
185
+ }
186
+ catch {
187
+ // Cancellation is best-effort; the original error has priority.
188
+ }
189
+ }
190
+ assertWebCodecsAvailable() {
191
+ if (typeof globalThis.VideoEncoder === 'undefined') {
192
+ throw new Error('This browser does not support video encoding (WebCodecs). ' +
193
+ 'Use Chrome, Firefox, or Safari 17.4+ on a recent device.');
194
+ }
195
+ }
196
+ buildResult(target, format) {
197
+ const mimeType = format === 'webm' ? 'video/webm' : 'video/mp4';
198
+ if (!target)
199
+ return { blob: null, mimeType };
200
+ return {
201
+ blob: new Blob([target.buffer], { type: mimeType }),
202
+ mimeType,
203
+ };
204
+ }
205
+ }
206
+ //# sourceMappingURL=MediaBunnyVideoRenderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MediaBunnyVideoRenderer.js","sourceRoot":"","sources":["../../../../src/modules/video/mediabunny/MediaBunnyVideoRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,UAAU,EACV,WAAW,GAIZ,MAAM,YAAY,CAAC;AAoBpB,mEAAmE;AACnE,oEAAoE;AACpE,oEAAoE;AACpE,iEAAiE;AACjE,MAAM,eAAe,GAAG,EAAE,CAAC;AA4B3B;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,uBAAuB;IAEjB,aAAa,CAAsB;IACnC,eAAe,CAAuB;IACtC,WAAW,CAAc;IACzB,wBAAwB,CAA2B;IACnD,wBAAwB,CAA2B;IACnD,uBAAuB,CAA0B;IACjD,mBAAmB,CAAsB;IACzC,eAAe,CAAkB;IAElD,YAAY,MAAqC;QAC/C,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC;QAC1C,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QAC9C,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACt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,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,GAAG,QAAQ,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3F,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;IAC/D,CAAC;IAEO,KAAK,CAAC,UAAU,CAAC,MAAc;QACrC,IAAI,MAAM,CAAC,KAAK,KAAK,WAAW,IAAI,MAAM,CAAC,KAAK,KAAK,UAAU;YAAE,OAAO;QACxE,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,gEAAgE;QAClE,CAAC;IACH,CAAC;IAEO,wBAAwB;QAC9B,IAAI,OAAQ,UAAyC,CAAC,YAAY,KAAK,WAAW,EAAE,CAAC;YACnF,MAAM,IAAI,KAAK,CACb,4DAA4D;gBAC1D,0DAA0D,CAC7D,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,WAAW,CAAC,MAA2B,EAAE,MAAgC;QAC/E,MAAM,QAAQ,GAAG,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC;QAChE,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAC7C,OAAO;YACL,IAAI,EAAE,IAAI,IAAI,CAAC,CAAC,MAAM,CAAC,MAAO,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;YACpD,QAAQ;SACT,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ import type { Output } from 'mediabunny';
2
+ /**
3
+ * Bridges the input file's audio track to the output.
4
+ *
5
+ * Lifecycle: {@link attachTo} once before output start, {@link pumpUntil}
6
+ * once per encoded video frame to keep audio in lockstep, and
7
+ * {@link finish} once after the last video frame to drain any remaining
8
+ * data before the output is finalized.
9
+ */
10
+ export interface AudioTrackBridge {
11
+ /**
12
+ * Wires the bridge into the output. Must be called once before the
13
+ * output is started.
14
+ */
15
+ attachTo(output: Output): Promise<void>;
16
+ /**
17
+ * Pushes any pending audio data whose timestamp is at or before
18
+ * `videoTimestamp` (in seconds) into the output.
19
+ */
20
+ pumpUntil(videoTimestamp: number): Promise<void>;
21
+ /** Drains all remaining audio data into the output. */
22
+ finish(): Promise<void>;
23
+ }
24
+ //# sourceMappingURL=AudioTrackBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AudioTrackBridge.d.ts","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/AudioTrackBridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC;;;OAGG;IACH,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,uDAAuD;IACvD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACzB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AudioTrackBridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AudioTrackBridge.js","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/AudioTrackBridge.ts"],"names":[],"mappings":""}
@@ -0,0 +1,20 @@
1
+ import type { Input, OutputFormat as MediaBunnyOutputFormat } from 'mediabunny';
2
+ import type { AudioTrackBridge } from '../../../video/mediabunny/audio/AudioTrackBridge';
3
+ import type { AudioDiscardReason } from '../../../video/RenderJob';
4
+ export interface AudioTrackBridgeRequest {
5
+ input: Input;
6
+ format: MediaBunnyOutputFormat;
7
+ /**
8
+ * Called when the input had an audio track but the bridge has to drop
9
+ * it. Not invoked when the input has no audio at all.
10
+ */
11
+ onAudioDiscarded?: (reason: AudioDiscardReason) => void;
12
+ }
13
+ /**
14
+ * Picks an appropriate {@link AudioTrackBridge} given the input file and
15
+ * the chosen output container.
16
+ */
17
+ export interface AudioTrackBridgeFactory {
18
+ create(request: AudioTrackBridgeRequest): Promise<AudioTrackBridge>;
19
+ }
20
+ //# sourceMappingURL=AudioTrackBridgeFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AudioTrackBridgeFactory.d.ts","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/AudioTrackBridgeFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,IAAI,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACzF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,KAAK,CAAC;IACb,MAAM,EAAE,sBAAsB,CAAC;IAC/B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACzD;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACrE"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=AudioTrackBridgeFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AudioTrackBridgeFactory.js","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/AudioTrackBridgeFactory.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import type { AudioTrackBridge } from '../../../video/mediabunny/audio/AudioTrackBridge';
2
+ import type { AudioTrackBridgeFactory, AudioTrackBridgeRequest } from '../../../video/mediabunny/audio/AudioTrackBridgeFactory';
3
+ /**
4
+ * Decides whether to copy the input audio packets verbatim, transcode
5
+ * them into a codec the output container accepts, or — only when neither
6
+ * path is possible — drop audio altogether.
7
+ */
8
+ export declare class DefaultAudioTrackBridgeFactory implements AudioTrackBridgeFactory {
9
+ create(request: AudioTrackBridgeRequest): Promise<AudioTrackBridge>;
10
+ }
11
+ //# sourceMappingURL=DefaultAudioTrackBridgeFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultAudioTrackBridgeFactory.d.ts","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,gBAAgB,EACjB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,yDAAyD,CAAC;AAKjE;;;;GAIG;AACH,qBAAa,8BAA+B,YAAW,uBAAuB;IAEtE,MAAM,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAmB1E"}
@@ -0,0 +1,32 @@
1
+ import { getFirstEncodableAudioCodec } from 'mediabunny';
2
+ import { PassthroughAudioTrackBridge } from '../../../video/mediabunny/audio/PassthroughAudioTrackBridge';
3
+ import { TranscodeAudioTrackBridge } from '../../../video/mediabunny/audio/TranscodeAudioTrackBridge';
4
+ import { DiscardAudioTrackBridge } from '../../../video/mediabunny/audio/DiscardAudioTrackBridge';
5
+ /**
6
+ * Decides whether to copy the input audio packets verbatim, transcode
7
+ * them into a codec the output container accepts, or — only when neither
8
+ * path is possible — drop audio altogether.
9
+ */
10
+ export class DefaultAudioTrackBridgeFactory {
11
+ async create(request) {
12
+ const track = await request.input.getPrimaryAudioTrack();
13
+ if (!track)
14
+ return new DiscardAudioTrackBridge();
15
+ const codec = await track.getCodec();
16
+ if (!codec) {
17
+ request.onAudioDiscarded?.('unknown-source-codec');
18
+ return new DiscardAudioTrackBridge();
19
+ }
20
+ const supportedCodecs = request.format.getSupportedAudioCodecs();
21
+ if (supportedCodecs.includes(codec)) {
22
+ return new PassthroughAudioTrackBridge({ inputTrack: track, codec });
23
+ }
24
+ const transcodeTarget = await getFirstEncodableAudioCodec(supportedCodecs);
25
+ if (transcodeTarget) {
26
+ return new TranscodeAudioTrackBridge({ inputTrack: track, codec: transcodeTarget });
27
+ }
28
+ request.onAudioDiscarded?.('no-encodable-target-codec');
29
+ return new DiscardAudioTrackBridge();
30
+ }
31
+ }
32
+ //# sourceMappingURL=DefaultAudioTrackBridgeFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DefaultAudioTrackBridgeFactory.js","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/DefaultAudioTrackBridgeFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAQzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,6DAA6D,CAAC;AAC1G,OAAO,EAAE,yBAAyB,EAAE,MAAM,2DAA2D,CAAC;AACtG,OAAO,EAAE,uBAAuB,EAAE,MAAM,yDAAyD,CAAC;AAElG;;;;GAIG;AACH,MAAM,OAAO,8BAA8B;IAEzC,KAAK,CAAC,MAAM,CAAC,OAAgC;QAC3C,MAAM,KAAK,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC;QACzD,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,uBAAuB,EAAE,CAAC;QACjD,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;QACrC,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,gBAAgB,EAAE,CAAC,sBAAsB,CAAC,CAAC;YACnD,OAAO,IAAI,uBAAuB,EAAE,CAAC;QACvC,CAAC;QACD,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,CAAC;QACjE,IAAI,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACpC,OAAO,IAAI,2BAA2B,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QACvE,CAAC;QACD,MAAM,eAAe,GAAG,MAAM,2BAA2B,CAAC,eAAe,CAAC,CAAC;QAC3E,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,IAAI,yBAAyB,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,CAAC,CAAC;QACtF,CAAC;QACD,OAAO,CAAC,gBAAgB,EAAE,CAAC,2BAA2B,CAAC,CAAC;QACxD,OAAO,IAAI,uBAAuB,EAAE,CAAC;IACvC,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ import type { AudioTrackBridge } from '../../../video/mediabunny/audio/AudioTrackBridge';
2
+ /**
3
+ * No-op bridge used when the input has no audio or when its audio codec
4
+ * cannot be put into the chosen output container without a transcode
5
+ * step the host can't perform. The output ends up with no audio track.
6
+ */
7
+ export declare class DiscardAudioTrackBridge implements AudioTrackBridge {
8
+ attachTo(): Promise<void>;
9
+ pumpUntil(): Promise<void>;
10
+ finish(): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=DiscardAudioTrackBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiscardAudioTrackBridge.d.ts","sourceRoot":"","sources":["../../../../../src/modules/video/mediabunny/audio/DiscardAudioTrackBridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AAEzF;;;;GAIG;AACH,qBAAa,uBAAwB,YAAW,gBAAgB;IAExD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAGzB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAG1B,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAE9B"}