automovie 0.3.4 → 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.
Files changed (331) hide show
  1. package/README.md +40 -139
  2. package/lib/AUTOMOVIE_CAPTURE_OPTIONS.d.ts +5 -2
  3. package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js +6 -2
  4. package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js.map +1 -1
  5. package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.d.ts +3 -1
  6. package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js +3 -1
  7. package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js.map +1 -1
  8. package/lib/AUTOMOVIE_INSPECT_OPTIONS.d.ts +5 -2
  9. package/lib/AUTOMOVIE_INSPECT_OPTIONS.js +5 -2
  10. package/lib/AUTOMOVIE_INSPECT_OPTIONS.js.map +1 -1
  11. package/lib/AUTOMOVIE_RENDER_OPTIONS.d.ts +6 -2
  12. package/lib/AUTOMOVIE_RENDER_OPTIONS.js +8 -2
  13. package/lib/AUTOMOVIE_RENDER_OPTIONS.js.map +1 -1
  14. package/lib/AUTOMOVIE_REVIEW_OPTIONS.d.ts +3 -1
  15. package/lib/AUTOMOVIE_REVIEW_OPTIONS.js +12 -1
  16. package/lib/AUTOMOVIE_REVIEW_OPTIONS.js.map +1 -1
  17. package/lib/AutoMovieCaptureBackend.d.ts +4 -6
  18. package/lib/AutoMovieCaptureHost.d.ts +73 -53
  19. package/lib/AutoMovieCaptureHost.js +89 -56
  20. package/lib/AutoMovieCaptureHost.js.map +1 -1
  21. package/lib/AutoMovieCommand.d.ts +69 -20
  22. package/lib/AutoMovieFfmpegStaticPath.d.ts +6 -0
  23. package/lib/AutoMovieFfmpegStaticPath.js +3 -0
  24. package/lib/AutoMovieFfmpegStaticPath.js.map +1 -0
  25. package/lib/AutoMovieMp4Boxes.d.ts +78 -0
  26. package/lib/AutoMovieMp4Boxes.js +227 -0
  27. package/lib/AutoMovieMp4Boxes.js.map +1 -0
  28. package/lib/AutoMovieRenderOutputReservation.d.ts +18 -0
  29. package/lib/AutoMovieRenderOutputReservation.js +118 -0
  30. package/lib/AutoMovieRenderOutputReservation.js.map +1 -0
  31. package/lib/IAutoMovieChromium.d.ts +13 -57
  32. package/lib/IAutoMovieDeliveryAudioTrack.d.ts +17 -0
  33. package/lib/IAutoMovieDeliveryAudioTrack.js +3 -0
  34. package/lib/IAutoMovieDeliveryAudioTrack.js.map +1 -0
  35. package/lib/IAutoMovieDeliveryProfileFinding.d.ts +21 -0
  36. package/lib/IAutoMovieDeliveryProfileFinding.js +3 -0
  37. package/lib/IAutoMovieDeliveryProfileFinding.js.map +1 -0
  38. package/lib/IAutoMovieFfmpegSources.d.ts +11 -0
  39. package/lib/IAutoMovieFfmpegSources.js +3 -0
  40. package/lib/IAutoMovieFfmpegSources.js.map +1 -0
  41. package/lib/IAutoMovieReviewObservation.d.ts +66 -0
  42. package/lib/IAutoMovieReviewObservation.js +3 -0
  43. package/lib/IAutoMovieReviewObservation.js.map +1 -0
  44. package/lib/IAutoMovieVerification.d.ts +163 -0
  45. package/lib/IAutoMovieVerification.js +3 -0
  46. package/lib/IAutoMovieVerification.js.map +1 -0
  47. package/lib/auditAutoMovieAlphaSamples.d.ts +23 -0
  48. package/lib/auditAutoMovieAlphaSamples.js +183 -0
  49. package/lib/auditAutoMovieAlphaSamples.js.map +1 -0
  50. package/lib/auditAutoMovieDeliveryProfile.d.ts +33 -0
  51. package/lib/auditAutoMovieDeliveryProfile.js +93 -0
  52. package/lib/auditAutoMovieDeliveryProfile.js.map +1 -0
  53. package/lib/captureAutoMovie.d.ts +23 -11
  54. package/lib/captureAutoMovie.js +102 -18
  55. package/lib/captureAutoMovie.js.map +1 -1
  56. package/lib/createAutoMovieDeliveryAudioLog.d.ts +31 -0
  57. package/lib/createAutoMovieDeliveryAudioLog.js +110 -0
  58. package/lib/createAutoMovieDeliveryAudioLog.js.map +1 -0
  59. package/lib/createAutoMovieDeliveryAudioScan.d.ts +39 -0
  60. package/lib/createAutoMovieDeliveryAudioScan.js +125 -0
  61. package/lib/createAutoMovieDeliveryAudioScan.js.map +1 -0
  62. package/lib/createAutoMovieVerificationInputScope.d.ts +19 -0
  63. package/lib/createAutoMovieVerificationInputScope.js +147 -0
  64. package/lib/createAutoMovieVerificationInputScope.js.map +1 -0
  65. package/lib/createAutoMovieVerificationMediaHash.d.ts +5 -0
  66. package/lib/createAutoMovieVerificationMediaHash.js +61 -0
  67. package/lib/createAutoMovieVerificationMediaHash.js.map +1 -0
  68. package/lib/decodeAutoMovieDeliveryAudio.d.ts +24 -0
  69. package/lib/decodeAutoMovieDeliveryAudio.js +77 -0
  70. package/lib/decodeAutoMovieDeliveryAudio.js.map +1 -0
  71. package/lib/deriveAutoMovieProjectName.d.ts +14 -11
  72. package/lib/deriveAutoMovieProjectName.js +14 -11
  73. package/lib/deriveAutoMovieProjectName.js.map +1 -1
  74. package/lib/findAutoMovieFreePort.d.ts +5 -10
  75. package/lib/findAutoMovieFreePort.js +5 -10
  76. package/lib/findAutoMovieFreePort.js.map +1 -1
  77. package/lib/formatAutoMovieInspectUrl.d.ts +6 -10
  78. package/lib/formatAutoMovieInspectUrl.js +6 -10
  79. package/lib/formatAutoMovieInspectUrl.js.map +1 -1
  80. package/lib/hashAutoMovieFile.d.ts +5 -0
  81. package/lib/hashAutoMovieFile.js +16 -0
  82. package/lib/hashAutoMovieFile.js.map +1 -0
  83. package/lib/importAutoMovieVerificationEntry.d.mts +2 -0
  84. package/lib/importAutoMovieVerificationEntry.mjs +6 -0
  85. package/lib/importAutoMovieVerificationEntry.mjs.map +1 -0
  86. package/lib/index.d.ts +9 -0
  87. package/lib/index.js +9 -0
  88. package/lib/index.js.map +1 -1
  89. package/lib/inspectAutoMovie.d.ts +15 -9
  90. package/lib/inspectAutoMovie.js +25 -9
  91. package/lib/inspectAutoMovie.js.map +1 -1
  92. package/lib/inspectAutoMovieVerificationCapture.d.ts +15 -0
  93. package/lib/inspectAutoMovieVerificationCapture.js +221 -0
  94. package/lib/inspectAutoMovieVerificationCapture.js.map +1 -0
  95. package/lib/inspectAutoMovieVerificationDelivery.d.ts +13 -0
  96. package/lib/inspectAutoMovieVerificationDelivery.js +247 -0
  97. package/lib/inspectAutoMovieVerificationDelivery.js.map +1 -0
  98. package/lib/inspectAutoMovieVerificationReview.d.ts +11 -0
  99. package/lib/inspectAutoMovieVerificationReview.js +141 -0
  100. package/lib/inspectAutoMovieVerificationReview.js.map +1 -0
  101. package/lib/launchAutoMovieChromium.d.ts +9 -11
  102. package/lib/launchAutoMovieChromium.js +10 -11
  103. package/lib/launchAutoMovieChromium.js.map +1 -1
  104. package/lib/listAutoMovieReleaseFindings.d.ts +9 -0
  105. package/lib/listAutoMovieReleaseFindings.js +58 -0
  106. package/lib/listAutoMovieReleaseFindings.js.map +1 -0
  107. package/lib/loadAutoMovieProductionModule.d.ts +11 -10
  108. package/lib/loadAutoMovieProductionModule.js +18 -10
  109. package/lib/loadAutoMovieProductionModule.js.map +1 -1
  110. package/lib/loadAutoMovieVerificationModule.d.ts +6 -0
  111. package/lib/loadAutoMovieVerificationModule.js +246 -0
  112. package/lib/loadAutoMovieVerificationModule.js.map +1 -0
  113. package/lib/planAutoMovieChromiumLaunch.d.ts +7 -13
  114. package/lib/planAutoMovieChromiumLaunch.js +7 -13
  115. package/lib/planAutoMovieChromiumLaunch.js.map +1 -1
  116. package/lib/planAutoMovieDeliveryAudioDecode.d.ts +10 -0
  117. package/lib/planAutoMovieDeliveryAudioDecode.js +29 -0
  118. package/lib/planAutoMovieDeliveryAudioDecode.js.map +1 -0
  119. package/lib/planAutoMovieDeliveryDecode.d.ts +19 -0
  120. package/lib/planAutoMovieDeliveryDecode.js +57 -0
  121. package/lib/planAutoMovieDeliveryDecode.js.map +1 -0
  122. package/lib/planAutoMovieDeliveryInput.d.ts +11 -0
  123. package/lib/planAutoMovieDeliveryInput.js +26 -0
  124. package/lib/planAutoMovieDeliveryInput.js.map +1 -0
  125. package/lib/planAutoMovieModulePageViteConfig.d.ts +13 -10
  126. package/lib/planAutoMovieModulePageViteConfig.js +13 -10
  127. package/lib/planAutoMovieModulePageViteConfig.js.map +1 -1
  128. package/lib/promptAutoMovieProjectName.d.ts +6 -10
  129. package/lib/promptAutoMovieProjectName.js +6 -10
  130. package/lib/promptAutoMovieProjectName.js.map +1 -1
  131. package/lib/publishAutoMovieRenderAttempt.d.ts +32 -0
  132. package/lib/publishAutoMovieRenderAttempt.js +91 -0
  133. package/lib/publishAutoMovieRenderAttempt.js.map +1 -0
  134. package/lib/readAutoMovieAddArguments.d.ts +10 -11
  135. package/lib/readAutoMovieAddArguments.js +10 -11
  136. package/lib/readAutoMovieAddArguments.js.map +1 -1
  137. package/lib/readAutoMovieCaptureHostOptions.d.ts +19 -17
  138. package/lib/readAutoMovieCaptureHostOptions.js +16 -17
  139. package/lib/readAutoMovieCaptureHostOptions.js.map +1 -1
  140. package/lib/readAutoMovieCommandArguments.d.ts +6 -9
  141. package/lib/readAutoMovieCommandArguments.js +9 -10
  142. package/lib/readAutoMovieCommandArguments.js.map +1 -1
  143. package/lib/readAutoMovieCreateArguments.d.ts +7 -11
  144. package/lib/readAutoMovieCreateArguments.js +7 -11
  145. package/lib/readAutoMovieCreateArguments.js.map +1 -1
  146. package/lib/readAutoMovieDeliveryAudioTrack.d.ts +21 -0
  147. package/lib/readAutoMovieDeliveryAudioTrack.js +104 -0
  148. package/lib/readAutoMovieDeliveryAudioTrack.js.map +1 -0
  149. package/lib/readAutoMovieDeliveryDecode.d.ts +19 -0
  150. package/lib/readAutoMovieDeliveryDecode.js +209 -0
  151. package/lib/readAutoMovieDeliveryDecode.js.map +1 -0
  152. package/lib/readAutoMovieDeliveryProbe.d.ts +35 -0
  153. package/lib/readAutoMovieDeliveryProbe.js +363 -0
  154. package/lib/readAutoMovieDeliveryProbe.js.map +1 -0
  155. package/lib/readAutoMovieErrorCode.d.ts +9 -0
  156. package/lib/readAutoMovieErrorCode.js +18 -0
  157. package/lib/readAutoMovieErrorCode.js.map +1 -0
  158. package/lib/readAutoMovieInspectHostOptions.d.ts +15 -16
  159. package/lib/readAutoMovieInspectHostOptions.js +11 -15
  160. package/lib/readAutoMovieInspectHostOptions.js.map +1 -1
  161. package/lib/readAutoMovieNameOption.d.ts +4 -10
  162. package/lib/readAutoMovieNameOption.js +4 -10
  163. package/lib/readAutoMovieNameOption.js.map +1 -1
  164. package/lib/readAutoMoviePageTimeout.d.ts +13 -0
  165. package/lib/readAutoMoviePageTimeout.js +21 -0
  166. package/lib/readAutoMoviePageTimeout.js.map +1 -0
  167. package/lib/readAutoMovieRenderOptions.d.ts +24 -16
  168. package/lib/readAutoMovieRenderOptions.js +23 -16
  169. package/lib/readAutoMovieRenderOptions.js.map +1 -1
  170. package/lib/readAutoMovieReviewObservation.d.ts +6 -0
  171. package/lib/readAutoMovieReviewObservation.js +108 -0
  172. package/lib/readAutoMovieReviewObservation.js.map +1 -0
  173. package/lib/readAutoMovieReviewOptions.d.ts +32 -24
  174. package/lib/readAutoMovieReviewOptions.js +82 -18
  175. package/lib/readAutoMovieReviewOptions.js.map +1 -1
  176. package/lib/readAutoMovieRevision.d.ts +3 -9
  177. package/lib/readAutoMovieRevision.js +3 -9
  178. package/lib/readAutoMovieRevision.js.map +1 -1
  179. package/lib/readAutoMovieVerifyOptions.d.ts +17 -0
  180. package/lib/readAutoMovieVerifyOptions.js +45 -0
  181. package/lib/readAutoMovieVerifyOptions.js.map +1 -0
  182. package/lib/readAutoMovieVideoProbe.d.ts +6 -10
  183. package/lib/readAutoMovieVideoProbe.js +20 -13
  184. package/lib/readAutoMovieVideoProbe.js.map +1 -1
  185. package/lib/recordAutoMoviePlayback.d.ts +18 -11
  186. package/lib/recordAutoMoviePlayback.js +26 -13
  187. package/lib/recordAutoMoviePlayback.js.map +1 -1
  188. package/lib/renderAutoMovie.d.ts +16 -10
  189. package/lib/renderAutoMovie.js +31 -14
  190. package/lib/renderAutoMovie.js.map +1 -1
  191. package/lib/renderAutoMovieScaffoldNextSteps.d.ts +10 -10
  192. package/lib/renderAutoMovieScaffoldNextSteps.js +10 -10
  193. package/lib/renderAutoMovieVideo.d.ts +53 -15
  194. package/lib/renderAutoMovieVideo.js +290 -45
  195. package/lib/renderAutoMovieVideo.js.map +1 -1
  196. package/lib/resolveAutoMovieFfmpeg.d.ts +12 -15
  197. package/lib/resolveAutoMovieFfmpeg.js +12 -17
  198. package/lib/resolveAutoMovieFfmpeg.js.map +1 -1
  199. package/lib/reviewAutoMovie.d.ts +10 -10
  200. package/lib/reviewAutoMovie.js +15 -10
  201. package/lib/reviewAutoMovie.js.map +1 -1
  202. package/lib/reviewAutoMovieFile.d.ts +21 -0
  203. package/lib/reviewAutoMovieFile.js +378 -0
  204. package/lib/reviewAutoMovieFile.js.map +1 -0
  205. package/lib/run.d.ts +32 -18
  206. package/lib/run.js +67 -23
  207. package/lib/run.js.map +1 -1
  208. package/lib/runAutoMovieDeliveryAudioDecode.d.ts +18 -0
  209. package/lib/runAutoMovieDeliveryAudioDecode.js +28 -0
  210. package/lib/runAutoMovieDeliveryAudioDecode.js.map +1 -0
  211. package/lib/runAutoMovieDeliveryDecode.d.ts +19 -0
  212. package/lib/runAutoMovieDeliveryDecode.js +42 -0
  213. package/lib/runAutoMovieDeliveryDecode.js.map +1 -0
  214. package/lib/runAutoMovieDeliveryReferenceDecode.d.ts +28 -0
  215. package/lib/runAutoMovieDeliveryReferenceDecode.js +77 -0
  216. package/lib/runAutoMovieDeliveryReferenceDecode.js.map +1 -0
  217. package/lib/runAutoMovieDeliverySourceAudioDecode.d.ts +20 -0
  218. package/lib/runAutoMovieDeliverySourceAudioDecode.js +56 -0
  219. package/lib/runAutoMovieDeliverySourceAudioDecode.js.map +1 -0
  220. package/lib/runAutoMovieFfmpeg.d.ts +15 -10
  221. package/lib/runAutoMovieFfmpeg.js +36 -13
  222. package/lib/runAutoMovieFfmpeg.js.map +1 -1
  223. package/lib/runAutoMovieVerification.d.ts +28 -0
  224. package/lib/runAutoMovieVerification.js +393 -0
  225. package/lib/runAutoMovieVerification.js.map +1 -0
  226. package/lib/sameAutoMovieReviewFile.d.ts +2 -0
  227. package/lib/sameAutoMovieReviewFile.js +57 -0
  228. package/lib/sameAutoMovieReviewFile.js.map +1 -0
  229. package/lib/selectAutoMovieProjectName.d.ts +8 -11
  230. package/lib/selectAutoMovieProjectName.js +8 -11
  231. package/lib/selectAutoMovieProjectName.js.map +1 -1
  232. package/lib/serveAutoMovieDrawPage.d.ts +14 -11
  233. package/lib/serveAutoMovieDrawPage.js +14 -11
  234. package/lib/serveAutoMovieDrawPage.js.map +1 -1
  235. package/lib/serveAutoMovieInspectorPage.d.ts +4 -8
  236. package/lib/serveAutoMovieInspectorPage.js +3 -9
  237. package/lib/serveAutoMovieInspectorPage.js.map +1 -1
  238. package/lib/verifyAutoMovie.d.ts +19 -0
  239. package/lib/verifyAutoMovie.js +44 -0
  240. package/lib/verifyAutoMovie.js.map +1 -0
  241. package/lib/writeAutoMovieModulePage.d.ts +17 -12
  242. package/lib/writeAutoMovieModulePage.js +13 -11
  243. package/lib/writeAutoMovieModulePage.js.map +1 -1
  244. package/lib/writeAutoMovieVerificationReceipt.d.ts +2 -0
  245. package/lib/writeAutoMovieVerificationReceipt.js +75 -0
  246. package/lib/writeAutoMovieVerificationReceipt.js.map +1 -0
  247. package/package.json +8 -8
  248. package/src/AUTOMOVIE_CAPTURE_OPTIONS.ts +6 -2
  249. package/src/AUTOMOVIE_DEFAULT_PROJECT_NAME.ts +3 -1
  250. package/src/AUTOMOVIE_INSPECT_OPTIONS.ts +5 -2
  251. package/src/AUTOMOVIE_RENDER_OPTIONS.ts +8 -2
  252. package/src/AUTOMOVIE_REVIEW_OPTIONS.ts +12 -1
  253. package/src/AutoMovieCaptureBackend.ts +4 -6
  254. package/src/AutoMovieCaptureHost.ts +122 -68
  255. package/src/AutoMovieCommand.ts +71 -20
  256. package/src/AutoMovieFfmpegStaticPath.ts +7 -0
  257. package/src/AutoMovieMp4Boxes.ts +263 -0
  258. package/src/AutoMovieRenderOutputReservation.ts +97 -0
  259. package/src/IAutoMovieChromium.ts +13 -57
  260. package/src/IAutoMovieDeliveryAudioTrack.ts +19 -0
  261. package/src/IAutoMovieDeliveryProfileFinding.ts +24 -0
  262. package/src/IAutoMovieFfmpegSources.ts +13 -0
  263. package/src/IAutoMovieReviewObservation.ts +59 -0
  264. package/src/IAutoMovieVerification.ts +207 -0
  265. package/src/auditAutoMovieAlphaSamples.ts +201 -0
  266. package/src/auditAutoMovieDeliveryProfile.ts +125 -0
  267. package/src/captureAutoMovie.ts +137 -28
  268. package/src/createAutoMovieDeliveryAudioLog.ts +141 -0
  269. package/src/createAutoMovieDeliveryAudioScan.ts +150 -0
  270. package/src/createAutoMovieVerificationInputScope.ts +156 -0
  271. package/src/createAutoMovieVerificationMediaHash.ts +32 -0
  272. package/src/decodeAutoMovieDeliveryAudio.ts +95 -0
  273. package/src/deriveAutoMovieProjectName.ts +14 -11
  274. package/src/findAutoMovieFreePort.ts +5 -10
  275. package/src/formatAutoMovieInspectUrl.ts +6 -10
  276. package/src/hashAutoMovieFile.ts +12 -0
  277. package/src/importAutoMovieVerificationEntry.mts +6 -0
  278. package/src/index.ts +9 -0
  279. package/src/inspectAutoMovie.ts +28 -11
  280. package/src/inspectAutoMovieVerificationCapture.ts +292 -0
  281. package/src/inspectAutoMovieVerificationDelivery.ts +301 -0
  282. package/src/inspectAutoMovieVerificationReview.ts +130 -0
  283. package/src/launchAutoMovieChromium.ts +14 -12
  284. package/src/listAutoMovieReleaseFindings.ts +87 -0
  285. package/src/loadAutoMovieProductionModule.ts +22 -15
  286. package/src/loadAutoMovieVerificationModule.ts +278 -0
  287. package/src/planAutoMovieChromiumLaunch.ts +7 -13
  288. package/src/planAutoMovieDeliveryAudioDecode.ts +26 -0
  289. package/src/planAutoMovieDeliveryDecode.ts +66 -0
  290. package/src/planAutoMovieDeliveryInput.ts +25 -0
  291. package/src/planAutoMovieModulePageViteConfig.ts +13 -10
  292. package/src/promptAutoMovieProjectName.ts +6 -10
  293. package/src/publishAutoMovieRenderAttempt.ts +89 -0
  294. package/src/readAutoMovieAddArguments.ts +10 -11
  295. package/src/readAutoMovieCaptureHostOptions.ts +22 -17
  296. package/src/readAutoMovieCommandArguments.ts +8 -10
  297. package/src/readAutoMovieCreateArguments.ts +7 -11
  298. package/src/readAutoMovieDeliveryAudioTrack.ts +137 -0
  299. package/src/readAutoMovieDeliveryDecode.ts +269 -0
  300. package/src/readAutoMovieDeliveryProbe.ts +499 -0
  301. package/src/readAutoMovieErrorCode.ts +13 -0
  302. package/src/readAutoMovieInspectHostOptions.ts +15 -16
  303. package/src/readAutoMovieNameOption.ts +4 -10
  304. package/src/readAutoMoviePageTimeout.ts +19 -0
  305. package/src/readAutoMovieRenderOptions.ts +34 -16
  306. package/src/readAutoMovieReviewObservation.ts +146 -0
  307. package/src/readAutoMovieReviewOptions.ts +133 -28
  308. package/src/readAutoMovieRevision.ts +3 -9
  309. package/src/readAutoMovieVerifyOptions.ts +50 -0
  310. package/src/readAutoMovieVideoProbe.ts +24 -13
  311. package/src/recordAutoMoviePlayback.ts +26 -13
  312. package/src/renderAutoMovie.ts +38 -17
  313. package/src/renderAutoMovieScaffoldNextSteps.ts +10 -10
  314. package/src/renderAutoMovieVideo.ts +474 -85
  315. package/src/resolveAutoMovieFfmpeg.ts +17 -24
  316. package/src/reviewAutoMovie.ts +21 -16
  317. package/src/reviewAutoMovieFile.ts +479 -0
  318. package/src/run.ts +75 -25
  319. package/src/runAutoMovieDeliveryAudioDecode.ts +45 -0
  320. package/src/runAutoMovieDeliveryDecode.ts +63 -0
  321. package/src/runAutoMovieDeliveryReferenceDecode.ts +107 -0
  322. package/src/runAutoMovieDeliverySourceAudioDecode.ts +71 -0
  323. package/src/runAutoMovieFfmpeg.ts +48 -14
  324. package/src/runAutoMovieVerification.ts +487 -0
  325. package/src/sameAutoMovieReviewFile.ts +23 -0
  326. package/src/selectAutoMovieProjectName.ts +8 -11
  327. package/src/serveAutoMovieDrawPage.ts +16 -12
  328. package/src/serveAutoMovieInspectorPage.ts +6 -9
  329. package/src/verifyAutoMovie.ts +67 -0
  330. package/src/writeAutoMovieModulePage.ts +17 -12
  331. package/src/writeAutoMovieVerificationReceipt.ts +51 -0
@@ -1,14 +1,126 @@
1
+ import type {
2
+ IAutoMovieControlRecord,
3
+ IAutoMovieDeliveryContentAudit,
4
+ IAutoMovieDialogueLipSync,
5
+ IAutoMovieDrawnVideoResult,
6
+ } from "@automovie/interface";
1
7
  import type * as Render from "@automovie/render";
8
+ import { createHash } from "node:crypto";
9
+ import { createReadStream } from "node:fs";
2
10
  import * as fs from "node:fs/promises";
3
11
  import * as path from "node:path";
4
12
 
5
13
  import type { AutoMovieCaptureHost } from "./AutoMovieCaptureHost";
14
+ import { AutoMovieRenderOutputReservation } from "./AutoMovieRenderOutputReservation";
15
+ import type { IAutoMovieDeliveryProfileFinding } from "./IAutoMovieDeliveryProfileFinding";
16
+ import { auditAutoMovieAlphaSamples } from "./auditAutoMovieAlphaSamples";
17
+ import { auditAutoMovieDeliveryProfile } from "./auditAutoMovieDeliveryProfile";
18
+ import { listAutoMovieReleaseFindings } from "./listAutoMovieReleaseFindings";
19
+ import { publishAutoMovieRenderAttempt } from "./publishAutoMovieRenderAttempt";
6
20
  import { readAutoMovieRevision } from "./readAutoMovieRevision";
21
+ import { runAutoMovieDeliveryDecode } from "./runAutoMovieDeliveryDecode";
22
+ import { runAutoMovieDeliveryReferenceDecode } from "./runAutoMovieDeliveryReferenceDecode";
7
23
  import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
8
24
 
25
+ type DeliveryAudit = IAutoMovieDeliveryContentAudit.IResult;
26
+
27
+ /** The render operations this host needs from a production's draw session. */
28
+ interface IDeliveryHost {
29
+ render: Pick<
30
+ typeof Render,
31
+ | "renderAutoMovieDrawnVideo"
32
+ | "auditAutoMovieDeliveryContent"
33
+ | "createAutoMovieLoudnessMeter"
34
+ | "AUTOMOVIE_MP4_SRGB_COLOUR"
35
+ | "assertProductionAacProfile"
36
+ | "assertProductionVideoProfile"
37
+ | "resolveProductionVideoProfile"
38
+ >;
39
+ session(
40
+ props: Parameters<AutoMovieCaptureHost["session"]>[0],
41
+ ): Promise<
42
+ Pick<
43
+ Render.AutoMovieDrawSession,
44
+ "backend" | "close" | "frame" | "speak" | "subject"
45
+ >
46
+ >;
47
+ }
48
+
9
49
  /**
10
- * The delivery encoding of a drawn subject: H.264 in yuv420p at CRF 18, without tone mapping, as the production's render used; the frame format is the subject's own clock and raster.
50
+ * Scene and encoded evidence from a single release attempt on the output
51
+ * directory.
11
52
  */
53
+ interface IDeliveryReport {
54
+ /** The rendered subject's name. */
55
+ subject: string;
56
+
57
+ /** The production's source revision, as `readAutoMovieRevision` reads it. */
58
+ revision: ReturnType<typeof readAutoMovieRevision>;
59
+
60
+ /** The draw session's backend. */
61
+ backend: string;
62
+
63
+ /**
64
+ * `published` when the film beside the report is this attempt's, `blocked`
65
+ * when an audit refused it, `failed` when a phase threw.
66
+ */
67
+ status: "published" | "blocked" | "failed";
68
+
69
+ /** The file this attempt published beside the report; null unless published. */
70
+ video: "film.mp4" | "film.mov" | null;
71
+
72
+ /**
73
+ * Present for a transparent render: its `film.mov` is a layer with straight
74
+ * alpha and writes no audio track, because the film it is composited into
75
+ * keeps the soundtrack.
76
+ */
77
+ layer?: { background: "transparent"; audio: "none" };
78
+
79
+ /** The FFmpeg arguments of the encode; empty until drawing finished. */
80
+ args: readonly string[];
81
+
82
+ /** Each drawn frame's index, film second and pixel hash. */
83
+ frames: Pick<
84
+ IAutoMovieDrawnVideoResult["frames"][number],
85
+ "index" | "seconds" | "hash"
86
+ >[];
87
+
88
+ /** The scene inspection over every drawn frame; null until drawing finished. */
89
+ diagnostics: IAutoMovieDrawnVideoResult["diagnostics"] | null;
90
+
91
+ /**
92
+ * The soundtrack mixed from the subject's sound list: its digest, each line's
93
+ * PCM digest and the master's measurements.
94
+ */
95
+ sound: IAutoMovieDrawnVideoResult["sound"] | null;
96
+ /**
97
+ * The film's cut, one row per sequence entry with the output frames it is
98
+ * live in; absent when the subject supplied no cut. It describes the
99
+ * `film.mp4` beside this report only when `status` is `published` and
100
+ * `source.sha256` is that file's digest.
101
+ */
102
+ cut?: IAutoMovieDrawnVideoResult["cut"];
103
+
104
+ /**
105
+ * The content audit of the decoded file against the drawn frames and the
106
+ * encoded soundtrack; null until the audit ran.
107
+ */
108
+ delivery: DeliveryAudit | null;
109
+
110
+ /**
111
+ * How the encoded file differs from its video and audio profiles; empty when
112
+ * it conforms, null when not checked.
113
+ */
114
+ profile: IAutoMovieDeliveryProfileFinding[] | null;
115
+
116
+ /** The staged encoded file and its SHA-256; null until the audit ran. */
117
+ source: IAutoMovieDeliveryContentAudit.ISource | null;
118
+
119
+ /** The phase that blocked or failed and its message; absent when published. */
120
+ failure?: { phase: string; message: string };
121
+ }
122
+
123
+ /** Delivery encoding uses the drawn subject's own clock and raster. */
12
124
  const SPEC: Parameters<typeof Render.renderAutoMovieDrawnVideo>[0]["spec"] = {
13
125
  target: "production",
14
126
  toneMapping: "none",
@@ -18,110 +130,387 @@ const SPEC: Parameters<typeof Render.renderAutoMovieDrawnVideo>[0]["spec"] = {
18
130
  };
19
131
 
20
132
  /**
21
- * Render one subject of a host's draw page into `<out>/film.mp4`, with `render-report.json` beside it.
133
+ * Defaults measure long enough intervals to distinguish them from a transient
134
+ * frame or sample.
135
+ */
136
+ const THRESHOLDS: IAutoMovieDeliveryContentAudit.IThresholds = {
137
+ black: {
138
+ minimumDuration: { ticks: 1, timeBase: [1, 5] },
139
+ minimumPictureRatio: 0.98,
140
+ maximumPixelThreshold: 0.1,
141
+ },
142
+ frozen: {
143
+ minimumDuration: { ticks: 1, timeBase: [1, 2] },
144
+ maximumMeanDifference: 0.001,
145
+ },
146
+ silence: {
147
+ minimumDuration: { ticks: 1, timeBase: [1, 2] },
148
+ maximumAmplitude: 0.001,
149
+ },
150
+ };
151
+
152
+ /**
153
+ * Renders one subject and publishes an approved film beside its shared report.
154
+ * Every measurable audit runs on the drawn frames or the exact staged encoded
155
+ * bytes. The decoded audio's integrated loudness and true peak, measured by the
156
+ * production render's BS.1770-5 meter, must meet the targets the sound-list mix
157
+ * applied or, for a supplied soundtrack, the declared loudness intent, and a
158
+ * phoneme-driven line whose lip-sync lag, measured against the mouth the
159
+ * subject read on each drawn frame, fails the report's verdict blocks. The
160
+ * encoded file must also carry its declared picture profile and, with a
161
+ * soundtrack, the AAC profile, or no audio track without one
162
+ * (`auditAutoMovieDeliveryProfile`); a mismatch blocks like a blocking audit
163
+ * finding and the report's `profile` records each field with its expected and
164
+ * observed values. A blocked attempt replaces the report and preserves the
165
+ * former film. A failed encode still reports the frames and scene inspection
166
+ * already drawn. If the approved film or its report cannot be installed, the
167
+ * former film is put back, so the film and report on disk always come from the
168
+ * same attempt.
22
169
  *
23
- * The subject is opened through the host's draw session, every frame of its clock is drawn by `renderAutoMovieDrawnVideo` into a scratch folder under `<root>/.cache/render/`, and FFmpeg encodes them into a partial file that is renamed to `film.mp4` only once it is complete, so a failed render leaves no file that looks finished. The report names the subject, the source revision, the backend, the encoder's arguments and every frame's second and pixel hash. The scratch folder is deleted and the session closed on every outcome.
170
+ * With `passes`, every frame is also drawn in those guide passes and written
171
+ * under `<out>/controls/` with `record.json`, whose `filmSha256` is the
172
+ * report's `source.sha256`; the folder is staged and installed in the same
173
+ * publish step as the film, so a blocked or failed attempt keeps the former
174
+ * `controls/` with the former film.
24
175
  *
25
- * @evidence contracts/development/common.md#meaningful-documentation States what is written where, how a failure leaves the output, what the report holds, and what is released.
26
- * @evidence contracts/development/implementation.md#principled-implementation Drawing and encoding are the render package's; this host supplies the session, files and FFmpeg, so a delivered frame is drawn by the same function as a capture's still.
27
- * @evidence contracts/development/implementation.md#clear-and-simple-structure Open, draw and encode, rename, report, release.
28
- * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The output is replaced only by a complete encode; no frame is reused from an earlier render.
29
- * @evidence contracts/development/implementation.md#efficient-algorithms One draw and one PNG file per frame, then one FFmpeg run.
30
- * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each render draws afresh.
31
- * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The frame files live in the scratch folder until the encode ends, then are deleted with it; the session's page is closed on every outcome.
176
+ * With `background` `transparent`, the beauty pass is drawn over a transparent
177
+ * background and its straight-alpha PNG files are wrapped unencoded into
178
+ * `film.mov` in `media/automovie/<film>/transparent` by default, so a layer
179
+ * attempt never replaces the film's report. The layer carries no audio: the
180
+ * film's required soundtrack is not expected, none is passed to the wrap and
181
+ * the report's `layer` says so. The black check, which reads a transparent
182
+ * frame as black, does not block; the profile check is replaced by
183
+ * `auditAutoMovieAlphaSamples`, which requires one sample per drawn frame with
184
+ * the frame file's bytes.
32
185
  */
33
- export async function renderAutoMovieVideo(props: {
34
- /** The opened draw host. */
35
- host: AutoMovieCaptureHost;
36
-
37
- /** The production's root folder. */
38
- root: string;
39
-
40
- /** The subject's name, or null for the page's only subject. */
41
- subject: string | null;
42
-
43
- /** Data the subject module reads, as JSON, or null. */
44
- props: unknown;
45
-
46
- /** Output folder, relative to the root or absolute; absent, `media/automovie/<subject>/videos`. */
47
- out?: string;
48
-
49
- /** FFmpeg executable. */
50
- ffmpeg: string;
51
- }): Promise<{
52
- /** The video written. */
186
+ export async function renderAutoMovieVideo(
187
+ props: {
188
+ /** The opened draw host. */
189
+ host: IDeliveryHost;
190
+ /** The production's root folder. */
191
+ root: string;
192
+ /** The subject's name, or null for the page's only subject. */
193
+ subject: string | null;
194
+ /** Data the subject module reads, as JSON, or null. */
195
+ props: unknown;
196
+ /** Output folder, relative to the root or absolute. */
197
+ out?: string;
198
+ /** FFmpeg executable. */
199
+ ffmpeg: string;
200
+ /**
201
+ * Guide passes other than `beauty` drawn at every frame into
202
+ * `<out>/controls/`; absent or empty draws the film alone.
203
+ */
204
+ passes?: readonly string[];
205
+ /**
206
+ * `transparent` renders a straight-alpha layer as `film.mov` with no audio,
207
+ * into `media/automovie/<film>/transparent` by default; absent or `scene`
208
+ * renders the film.
209
+ */
210
+ background?: "scene" | "transparent";
211
+ },
212
+ run: typeof runAutoMovieFfmpeg = runAutoMovieFfmpeg,
213
+ ): Promise<{
53
214
  video: string;
54
-
55
- /** The report written beside it. */
56
215
  report: string;
57
-
58
- /** Frames drawn. */
59
216
  frames: number;
217
+ controls: string | null;
60
218
  }> {
61
- const session: Render.AutoMovieDrawSession = await props.host.session({
219
+ const session = await props.host.session({
62
220
  subject: props.subject,
63
221
  props: props.props,
64
222
  });
65
- const name: string = session.subject.name;
66
- const out: string = path.resolve(
67
- props.root,
68
- props.out ?? path.join("media", "automovie", name, "videos"),
69
- );
70
- const scratch: string = path.join(
223
+ const { name, delivery: intent } = session.subject;
224
+
225
+ // A transparent layer has its own folder, so its attempts never replace the
226
+ // report of the film in `videos/`.
227
+ const transparent: boolean = props.background === "transparent";
228
+ const file: "film.mp4" | "film.mov" = transparent ? "film.mov" : "film.mp4";
229
+ const out = path.resolve(
71
230
  props.root,
72
- ".cache",
73
- "render",
74
- `${name}-${process.pid}-${Date.now()}`,
231
+ props.out ??
232
+ path.join(
233
+ "media",
234
+ "automovie",
235
+ name,
236
+ transparent ? "transparent" : "videos",
237
+ ),
75
238
  );
76
- const partial: string = path.join(out, `.film-${process.pid}.mp4`);
239
+ const video = path.join(out, file);
240
+ const report = path.join(out, "render-report.json");
241
+ const reservation = path.join(out, ".render-publish");
242
+ let reservationTicket: string | undefined;
243
+ let staging: string | undefined;
244
+ let scratch: string | undefined;
77
245
  try {
78
- await fs.mkdir(scratch, { recursive: true });
79
246
  await fs.mkdir(out, { recursive: true });
80
- const result: Awaited<ReturnType<typeof Render.renderAutoMovieDrawnVideo>> =
81
- await props.host.render.renderAutoMovieDrawnVideo({
247
+ staging = await fs.mkdtemp(path.join(out, ".render-"));
248
+ reservationTicket = await AutoMovieRenderOutputReservation.reserve(
249
+ staging,
250
+ reservation,
251
+ out,
252
+ );
253
+ const candidate = path.join(staging, file);
254
+ const pendingReport = path.join(staging, "render-report.json");
255
+ const attempt: IDeliveryReport = {
256
+ subject: name,
257
+ revision: readAutoMovieRevision(props.root),
258
+ backend: session.backend,
259
+ status: "failed",
260
+ video: null,
261
+ args: [],
262
+ frames: [],
263
+ diagnostics: null,
264
+ sound: null,
265
+ delivery: null,
266
+ profile: null,
267
+ source: null,
268
+ ...(transparent
269
+ ? {
270
+ layer: {
271
+ background: "transparent" as const,
272
+ audio: "none" as const,
273
+ },
274
+ }
275
+ : {}),
276
+ };
277
+ const writeReport = async (): Promise<void> =>
278
+ fs.writeFile(pendingReport, JSON.stringify(attempt, null, 2) + "\n");
279
+ let phase = "draw";
280
+ const soundtrack: string | null = transparent
281
+ ? null
282
+ : (intent?.audio?.path ?? null);
283
+ try {
284
+ const frameRoot = path.join(props.root, ".cache", "render");
285
+ await fs.mkdir(frameRoot, { recursive: true });
286
+ scratch = await fs.mkdtemp(path.join(frameRoot, "frames-"));
287
+
288
+ // Control frames are staged beside the film and published with it,
289
+ // inside the output folder whose publish lock this attempt holds.
290
+ const controls =
291
+ (props.passes ?? []).length === 0
292
+ ? null
293
+ : {
294
+ staged: path.join(staging, "controls"),
295
+ installed: path.join(out, "controls"),
296
+ };
297
+ if (controls !== null) await fs.mkdir(controls.staged);
298
+ const result = await props.host.render.renderAutoMovieDrawnVideo({
82
299
  session,
83
300
  spec: SPEC,
84
301
  frameDir: scratch.split(path.sep).join("/"),
85
- outputPath: partial,
86
- audio: null,
87
- write: (file: string, data: Uint8Array): Promise<void> =>
88
- fs.writeFile(file, data),
89
- encode: async (args: readonly string[]): Promise<void> => {
90
- await runAutoMovieFfmpeg(props.ffmpeg, args);
302
+ outputPath: candidate,
303
+ ...(transparent ? { background: "transparent" as const } : {}),
304
+ ...(controls === null
305
+ ? {}
306
+ : {
307
+ controls: {
308
+ passes: props.passes ?? [],
309
+ frameDir: controls.staged.split(path.sep).join("/"),
310
+ },
311
+ }),
312
+ audio:
313
+ soundtrack === null ? null : path.resolve(props.root, soundtrack),
314
+ write: (file, data) => fs.writeFile(file, data),
315
+ read: async (file) => fs.readFile(path.resolve(props.root, file)),
316
+ encode: async (args, drawn) => {
317
+ attempt.args = args;
318
+ // The soundtrack lives in the frame scratch, which is released, so
319
+ // the report names it by file name beside its digest.
320
+ attempt.sound =
321
+ drawn.sound === undefined
322
+ ? null
323
+ : { ...drawn.sound, file: path.posix.basename(drawn.sound.file) };
324
+ attempt.frames = drawn.frames.map(({ index, seconds, hash }) => ({
325
+ index,
326
+ seconds,
327
+ hash,
328
+ }));
329
+ attempt.diagnostics = drawn.diagnostics ?? null;
330
+ if (drawn.cut !== undefined) attempt.cut = drawn.cut;
331
+ phase = "encode";
332
+ await run(props.ffmpeg, args);
91
333
  },
92
334
  });
93
- const video: string = path.join(out, "film.mp4");
94
- await fs.rename(partial, video);
95
- const report: string = path.join(out, "render-report.json");
96
- await fs.writeFile(
97
- report,
98
- JSON.stringify(
99
- {
100
- subject: name,
101
- revision: readAutoMovieRevision(props.root),
102
- backend: session.backend,
103
- video: "film.mp4",
104
- args: result.args,
105
- frames: result.frames.map(
106
- (frame: {
107
- index: number;
108
- seconds: number;
109
- hash: string;
110
- }): { index: number; seconds: number; hash: string } => ({
111
- index: frame.index,
112
- seconds: frame.seconds,
113
- hash: frame.hash,
335
+
336
+ phase = "audit";
337
+ const hash = createHash("sha256");
338
+ for await (const chunk of createReadStream(candidate)) hash.update(chunk);
339
+ attempt.source = {
340
+ file: path.relative(out, candidate).split(path.sep).join("/"),
341
+ sha256: hash.digest("hex"),
342
+ };
343
+ // The decoded audio meets the targets the mix applied (the production's
344
+ // own or EBU R 128), or the production's own for a supplied soundtrack.
345
+ const loudness =
346
+ attempt.sound?.loudness.intent ?? intent?.loudness ?? undefined;
347
+ const expected = {
348
+ frameCount: result.frames.length,
349
+ frameRate: result.frameRate,
350
+ audioRequired: transparent ? false : (intent?.audio?.required ?? false),
351
+ contentRequired: intent !== undefined,
352
+ ...(intent?.allowances === undefined
353
+ ? {}
354
+ : { allowances: intent.allowances }),
355
+ ...(loudness === undefined ? {} : { loudness }),
356
+ };
357
+ const thresholds = intent?.thresholds ?? THRESHOLDS;
358
+ const streams = await runAutoMovieDeliveryDecode(
359
+ props.ffmpeg,
360
+ candidate,
361
+ expected,
362
+ thresholds,
363
+ run,
364
+ props.host.render.createAutoMovieLoudnessMeter,
365
+ );
366
+ // The drawn frames and the soundtrack as the encoder read them, measured
367
+ // the same way, before the frame scratch is released.
368
+ const reference = await runAutoMovieDeliveryReferenceDecode(
369
+ props.ffmpeg,
370
+ attempt.args,
371
+ expected,
372
+ thresholds,
373
+ run,
374
+ );
375
+ attempt.delivery = props.host.render.auditAutoMovieDeliveryContent({
376
+ source: attempt.source,
377
+ expected,
378
+ thresholds,
379
+ streams,
380
+ reference,
381
+ });
382
+
383
+ // The file must carry the picture and sound profiles its types declare;
384
+ // the encoder muxed a soundtrack exactly when it had a second input.
385
+ // A transparent layer instead holds each drawn PNG file as one sample.
386
+ attempt.profile = transparent
387
+ ? await auditAutoMovieAlphaSamples({
388
+ path: candidate,
389
+ frames: result.frames.map(({ file }) => file),
390
+ })
391
+ : await auditAutoMovieDeliveryProfile({
392
+ render: props.host.render,
393
+ path: candidate,
394
+ width: session.subject.width,
395
+ height: session.subject.height,
396
+ frameRate: result.frameRate,
397
+ audio:
398
+ attempt.args.indexOf("-i", attempt.args.indexOf("-i") + 2) >= 0,
399
+ });
400
+
401
+ const failures = [
402
+ ...listAutoMovieReleaseFindings(
403
+ attempt.diagnostics,
404
+ attempt.delivery,
405
+ transparent ? ["black"] : [],
406
+ ),
407
+ ...attempt.profile.map(
408
+ (finding: IAutoMovieDeliveryProfileFinding): string =>
409
+ `unsupported-${finding.media}-profile.${finding.field}: expected ${finding.expected}, observed ${finding.observed}`,
410
+ ),
411
+ // A phoneme-driven line whose sound and mouth part by more than the
412
+ // detectability window blocks; unmeasured and inconclusive lines are
413
+ // only reported.
414
+ ...(attempt.sound?.lipSync ?? []).flatMap(
415
+ (entry: IAutoMovieDialogueLipSync): string[] =>
416
+ entry.status === "measured" && entry.verdict === "fail"
417
+ ? [
418
+ `lip-sync ${entry.line}: the sound is ${entry.lagMilliseconds.toFixed(1)} ms after the mouth, outside -45 to +125 ms`,
419
+ ]
420
+ : [],
421
+ ),
422
+ ];
423
+ if (failures.length > 0) {
424
+ attempt.status = "blocked";
425
+ throw new Error(failures.join(" | "));
426
+ }
427
+
428
+ phase = "publish";
429
+ attempt.status = "published";
430
+ attempt.video = file;
431
+ await writeReport();
432
+ if (controls !== null)
433
+ await writeControlRecord(controls.staged, {
434
+ film: name,
435
+ revision: attempt.revision,
436
+ backend: attempt.backend,
437
+ clock: {
438
+ frameRate: result.frameRate,
439
+ frameCount: result.frames.length,
440
+ width: session.subject.width,
441
+ height: session.subject.height,
442
+ },
443
+ filmSha256: attempt.source.sha256,
444
+ channels: result.controls ?? [],
445
+ });
446
+ await publishAutoMovieRenderAttempt({
447
+ candidate,
448
+ video,
449
+ pendingReport,
450
+ report,
451
+ previous: path.join(staging, "previous-" + file),
452
+ ...(controls === null
453
+ ? {}
454
+ : {
455
+ controls: {
456
+ candidate: controls.staged,
457
+ installed: controls.installed,
458
+ previous: path.join(staging, "previous-controls"),
459
+ },
114
460
  }),
115
- ),
116
- },
117
- null,
118
- 2,
119
- ),
120
- );
121
- return { video, report, frames: result.frames.length };
461
+ });
462
+ return {
463
+ video,
464
+ report,
465
+ frames: result.frames.length,
466
+ controls: controls === null ? null : controls.installed,
467
+ };
468
+ } catch (cause) {
469
+ attempt.video = null;
470
+ if (attempt.status !== "blocked") attempt.status = "failed";
471
+ const message = cause instanceof Error ? cause.message : String(cause);
472
+ attempt.failure = { phase, message };
473
+ try {
474
+ await writeReport();
475
+ await fs.rename(pendingReport, report);
476
+ } catch (reportFailure) {
477
+ throw new AggregateError(
478
+ [cause, reportFailure],
479
+ "Render failed and could not publish " + report + ": " + message,
480
+ );
481
+ }
482
+ throw new Error(
483
+ "Render " + attempt.status + ": " + message + "\n" + report,
484
+ { cause },
485
+ );
486
+ }
122
487
  } finally {
123
- await fs.rm(partial, { force: true });
124
- await fs.rm(scratch, { recursive: true, force: true });
125
- await session.close();
488
+ await Promise.all([
489
+ session.close(),
490
+ ...(staging === undefined ? [] : [fs.rm(staging, { recursive: true })]),
491
+ ...(scratch === undefined ? [] : [fs.rm(scratch, { recursive: true })]),
492
+ ...(reservationTicket === undefined
493
+ ? []
494
+ : [
495
+ AutoMovieRenderOutputReservation.release(
496
+ reservation,
497
+ reservationTicket,
498
+ ),
499
+ ]),
500
+ ]);
126
501
  }
127
502
  }
503
+
504
+ /**
505
+ * Writes a control folder's `record.json`, the file a generation request names
506
+ * and a manifest digests.
507
+ */
508
+ async function writeControlRecord(
509
+ folder: string,
510
+ record: IAutoMovieControlRecord,
511
+ ): Promise<void> {
512
+ await fs.writeFile(
513
+ path.join(folder, "record.json"),
514
+ JSON.stringify(record, null, 2) + "\n",
515
+ );
516
+ }
@@ -1,33 +1,26 @@
1
+ import type { AutoMovieFfmpegStaticPath } from "./AutoMovieFfmpegStaticPath";
2
+ import type { IAutoMovieFfmpegSources } from "./IAutoMovieFfmpegSources";
3
+
1
4
  /**
2
- * Find the FFmpeg executable a capture of a video file runs: `FFMPEG_PATH` when the environment sets it to a non-blank path, else the binary of the production's `ffmpeg-static`.
5
+ * Find the FFmpeg executable a capture of a video file runs: `FFMPEG_PATH` when
6
+ * the environment sets it to a non-blank path, else the binary of the
7
+ * production's `ffmpeg-static`.
3
8
  *
4
- * It throws naming both `FFMPEG_PATH` and `ffmpeg-static` when neither gives a path, so a capture that plans a video says how to supply one before it touches its folder.
9
+ * A production without `ffmpeg-static` installed refuses with the loader's own
10
+ * error, which names the package and the production; one whose `ffmpeg-static`
11
+ * has no binary for this platform refuses naming both `FFMPEG_PATH` and
12
+ * `ffmpeg-static`, so a capture that plans a video says how to supply one
13
+ * before it touches its folder.
5
14
  *
6
- * @evidence contracts/development/common.md#meaningful-documentation States the order of the two sources and the refusal.
7
- * @evidence contracts/development/implementation.md#principled-implementation `ffmpeg-static` exports the path of the binary it downloaded, or null on a platform it has none for; the environment variable wins so a machine's own build can be used.
8
- * @evidence contracts/development/implementation.md#clear-and-simple-structure Read the variable, else load the package, else refuse.
9
- * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No `ffmpeg` on the search path is guessed, because a capture records the binary it ran.
10
- * @evidence contracts/development/implementation.md#efficient-algorithms One module load at most.
11
- * @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Resolved once per capture.
12
- * @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a path and keeps nothing.
15
+ * @param props The environment and the production's loader.
16
+ * @returns The executable's path.
13
17
  */
14
- export function resolveAutoMovieFfmpeg(props: {
15
- /** The environment, read for `FFMPEG_PATH`. */
16
- env: Readonly<Record<string, string | undefined>>;
17
-
18
- /** Loads a package from the production, throwing when it is not installed. */
19
- load: (id: string) => unknown;
20
- }): string {
18
+ export function resolveAutoMovieFfmpeg(props: IAutoMovieFfmpegSources): string {
21
19
  const given: string | undefined = props.env.FFMPEG_PATH?.trim();
22
20
  if (given !== undefined && given !== "") return given;
23
- let binary: unknown = null;
24
- try {
25
- binary = props.load("ffmpeg-static");
26
- } catch {
27
- binary = null;
28
- }
29
- if (typeof binary === "string" && binary !== "") return binary;
21
+ const binary: AutoMovieFfmpegStaticPath = props.load("ffmpeg-static");
22
+ if (binary !== null) return binary;
30
23
  throw new Error(
31
24
  "A video capture needs FFmpeg: set FFMPEG_PATH to an ffmpeg executable, or install ffmpeg-static in the production",
32
25
  );
33
- }
26
+ }