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.
- package/README.md +40 -139
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.d.ts +5 -2
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js +6 -2
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.d.ts +3 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js +3 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js.map +1 -1
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.d.ts +5 -2
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js +5 -2
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_RENDER_OPTIONS.d.ts +6 -2
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js +8 -2
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.d.ts +3 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js +12 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js.map +1 -1
- package/lib/AutoMovieCaptureBackend.d.ts +4 -6
- package/lib/AutoMovieCaptureHost.d.ts +73 -53
- package/lib/AutoMovieCaptureHost.js +89 -56
- package/lib/AutoMovieCaptureHost.js.map +1 -1
- package/lib/AutoMovieCommand.d.ts +69 -20
- package/lib/AutoMovieFfmpegStaticPath.d.ts +6 -0
- package/lib/AutoMovieFfmpegStaticPath.js +3 -0
- package/lib/AutoMovieFfmpegStaticPath.js.map +1 -0
- package/lib/AutoMovieMp4Boxes.d.ts +78 -0
- package/lib/AutoMovieMp4Boxes.js +227 -0
- package/lib/AutoMovieMp4Boxes.js.map +1 -0
- package/lib/AutoMovieRenderOutputReservation.d.ts +18 -0
- package/lib/AutoMovieRenderOutputReservation.js +118 -0
- package/lib/AutoMovieRenderOutputReservation.js.map +1 -0
- package/lib/IAutoMovieChromium.d.ts +13 -57
- package/lib/IAutoMovieDeliveryAudioTrack.d.ts +17 -0
- package/lib/IAutoMovieDeliveryAudioTrack.js +3 -0
- package/lib/IAutoMovieDeliveryAudioTrack.js.map +1 -0
- package/lib/IAutoMovieDeliveryProfileFinding.d.ts +21 -0
- package/lib/IAutoMovieDeliveryProfileFinding.js +3 -0
- package/lib/IAutoMovieDeliveryProfileFinding.js.map +1 -0
- package/lib/IAutoMovieFfmpegSources.d.ts +11 -0
- package/lib/IAutoMovieFfmpegSources.js +3 -0
- package/lib/IAutoMovieFfmpegSources.js.map +1 -0
- package/lib/IAutoMovieReviewObservation.d.ts +66 -0
- package/lib/IAutoMovieReviewObservation.js +3 -0
- package/lib/IAutoMovieReviewObservation.js.map +1 -0
- package/lib/IAutoMovieVerification.d.ts +163 -0
- package/lib/IAutoMovieVerification.js +3 -0
- package/lib/IAutoMovieVerification.js.map +1 -0
- package/lib/auditAutoMovieAlphaSamples.d.ts +23 -0
- package/lib/auditAutoMovieAlphaSamples.js +183 -0
- package/lib/auditAutoMovieAlphaSamples.js.map +1 -0
- package/lib/auditAutoMovieDeliveryProfile.d.ts +33 -0
- package/lib/auditAutoMovieDeliveryProfile.js +93 -0
- package/lib/auditAutoMovieDeliveryProfile.js.map +1 -0
- package/lib/captureAutoMovie.d.ts +23 -11
- package/lib/captureAutoMovie.js +102 -18
- package/lib/captureAutoMovie.js.map +1 -1
- package/lib/createAutoMovieDeliveryAudioLog.d.ts +31 -0
- package/lib/createAutoMovieDeliveryAudioLog.js +110 -0
- package/lib/createAutoMovieDeliveryAudioLog.js.map +1 -0
- package/lib/createAutoMovieDeliveryAudioScan.d.ts +39 -0
- package/lib/createAutoMovieDeliveryAudioScan.js +125 -0
- package/lib/createAutoMovieDeliveryAudioScan.js.map +1 -0
- package/lib/createAutoMovieVerificationInputScope.d.ts +19 -0
- package/lib/createAutoMovieVerificationInputScope.js +147 -0
- package/lib/createAutoMovieVerificationInputScope.js.map +1 -0
- package/lib/createAutoMovieVerificationMediaHash.d.ts +5 -0
- package/lib/createAutoMovieVerificationMediaHash.js +61 -0
- package/lib/createAutoMovieVerificationMediaHash.js.map +1 -0
- package/lib/decodeAutoMovieDeliveryAudio.d.ts +24 -0
- package/lib/decodeAutoMovieDeliveryAudio.js +77 -0
- package/lib/decodeAutoMovieDeliveryAudio.js.map +1 -0
- package/lib/deriveAutoMovieProjectName.d.ts +14 -11
- package/lib/deriveAutoMovieProjectName.js +14 -11
- package/lib/deriveAutoMovieProjectName.js.map +1 -1
- package/lib/findAutoMovieFreePort.d.ts +5 -10
- package/lib/findAutoMovieFreePort.js +5 -10
- package/lib/findAutoMovieFreePort.js.map +1 -1
- package/lib/formatAutoMovieInspectUrl.d.ts +6 -10
- package/lib/formatAutoMovieInspectUrl.js +6 -10
- package/lib/formatAutoMovieInspectUrl.js.map +1 -1
- package/lib/hashAutoMovieFile.d.ts +5 -0
- package/lib/hashAutoMovieFile.js +16 -0
- package/lib/hashAutoMovieFile.js.map +1 -0
- package/lib/importAutoMovieVerificationEntry.d.mts +2 -0
- package/lib/importAutoMovieVerificationEntry.mjs +6 -0
- package/lib/importAutoMovieVerificationEntry.mjs.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -1
- package/lib/inspectAutoMovie.d.ts +15 -9
- package/lib/inspectAutoMovie.js +25 -9
- package/lib/inspectAutoMovie.js.map +1 -1
- package/lib/inspectAutoMovieVerificationCapture.d.ts +15 -0
- package/lib/inspectAutoMovieVerificationCapture.js +221 -0
- package/lib/inspectAutoMovieVerificationCapture.js.map +1 -0
- package/lib/inspectAutoMovieVerificationDelivery.d.ts +13 -0
- package/lib/inspectAutoMovieVerificationDelivery.js +247 -0
- package/lib/inspectAutoMovieVerificationDelivery.js.map +1 -0
- package/lib/inspectAutoMovieVerificationReview.d.ts +11 -0
- package/lib/inspectAutoMovieVerificationReview.js +141 -0
- package/lib/inspectAutoMovieVerificationReview.js.map +1 -0
- package/lib/launchAutoMovieChromium.d.ts +9 -11
- package/lib/launchAutoMovieChromium.js +10 -11
- package/lib/launchAutoMovieChromium.js.map +1 -1
- package/lib/listAutoMovieReleaseFindings.d.ts +9 -0
- package/lib/listAutoMovieReleaseFindings.js +58 -0
- package/lib/listAutoMovieReleaseFindings.js.map +1 -0
- package/lib/loadAutoMovieProductionModule.d.ts +11 -10
- package/lib/loadAutoMovieProductionModule.js +18 -10
- package/lib/loadAutoMovieProductionModule.js.map +1 -1
- package/lib/loadAutoMovieVerificationModule.d.ts +6 -0
- package/lib/loadAutoMovieVerificationModule.js +246 -0
- package/lib/loadAutoMovieVerificationModule.js.map +1 -0
- package/lib/planAutoMovieChromiumLaunch.d.ts +7 -13
- package/lib/planAutoMovieChromiumLaunch.js +7 -13
- package/lib/planAutoMovieChromiumLaunch.js.map +1 -1
- package/lib/planAutoMovieDeliveryAudioDecode.d.ts +10 -0
- package/lib/planAutoMovieDeliveryAudioDecode.js +29 -0
- package/lib/planAutoMovieDeliveryAudioDecode.js.map +1 -0
- package/lib/planAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/planAutoMovieDeliveryDecode.js +57 -0
- package/lib/planAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/planAutoMovieDeliveryInput.d.ts +11 -0
- package/lib/planAutoMovieDeliveryInput.js +26 -0
- package/lib/planAutoMovieDeliveryInput.js.map +1 -0
- package/lib/planAutoMovieModulePageViteConfig.d.ts +13 -10
- package/lib/planAutoMovieModulePageViteConfig.js +13 -10
- package/lib/planAutoMovieModulePageViteConfig.js.map +1 -1
- package/lib/promptAutoMovieProjectName.d.ts +6 -10
- package/lib/promptAutoMovieProjectName.js +6 -10
- package/lib/promptAutoMovieProjectName.js.map +1 -1
- package/lib/publishAutoMovieRenderAttempt.d.ts +32 -0
- package/lib/publishAutoMovieRenderAttempt.js +91 -0
- package/lib/publishAutoMovieRenderAttempt.js.map +1 -0
- package/lib/readAutoMovieAddArguments.d.ts +10 -11
- package/lib/readAutoMovieAddArguments.js +10 -11
- package/lib/readAutoMovieAddArguments.js.map +1 -1
- package/lib/readAutoMovieCaptureHostOptions.d.ts +19 -17
- package/lib/readAutoMovieCaptureHostOptions.js +16 -17
- package/lib/readAutoMovieCaptureHostOptions.js.map +1 -1
- package/lib/readAutoMovieCommandArguments.d.ts +6 -9
- package/lib/readAutoMovieCommandArguments.js +9 -10
- package/lib/readAutoMovieCommandArguments.js.map +1 -1
- package/lib/readAutoMovieCreateArguments.d.ts +7 -11
- package/lib/readAutoMovieCreateArguments.js +7 -11
- package/lib/readAutoMovieCreateArguments.js.map +1 -1
- package/lib/readAutoMovieDeliveryAudioTrack.d.ts +21 -0
- package/lib/readAutoMovieDeliveryAudioTrack.js +104 -0
- package/lib/readAutoMovieDeliveryAudioTrack.js.map +1 -0
- package/lib/readAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/readAutoMovieDeliveryDecode.js +209 -0
- package/lib/readAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/readAutoMovieDeliveryProbe.d.ts +35 -0
- package/lib/readAutoMovieDeliveryProbe.js +363 -0
- package/lib/readAutoMovieDeliveryProbe.js.map +1 -0
- package/lib/readAutoMovieErrorCode.d.ts +9 -0
- package/lib/readAutoMovieErrorCode.js +18 -0
- package/lib/readAutoMovieErrorCode.js.map +1 -0
- package/lib/readAutoMovieInspectHostOptions.d.ts +15 -16
- package/lib/readAutoMovieInspectHostOptions.js +11 -15
- package/lib/readAutoMovieInspectHostOptions.js.map +1 -1
- package/lib/readAutoMovieNameOption.d.ts +4 -10
- package/lib/readAutoMovieNameOption.js +4 -10
- package/lib/readAutoMovieNameOption.js.map +1 -1
- package/lib/readAutoMoviePageTimeout.d.ts +13 -0
- package/lib/readAutoMoviePageTimeout.js +21 -0
- package/lib/readAutoMoviePageTimeout.js.map +1 -0
- package/lib/readAutoMovieRenderOptions.d.ts +24 -16
- package/lib/readAutoMovieRenderOptions.js +23 -16
- package/lib/readAutoMovieRenderOptions.js.map +1 -1
- package/lib/readAutoMovieReviewObservation.d.ts +6 -0
- package/lib/readAutoMovieReviewObservation.js +108 -0
- package/lib/readAutoMovieReviewObservation.js.map +1 -0
- package/lib/readAutoMovieReviewOptions.d.ts +32 -24
- package/lib/readAutoMovieReviewOptions.js +82 -18
- package/lib/readAutoMovieReviewOptions.js.map +1 -1
- package/lib/readAutoMovieRevision.d.ts +3 -9
- package/lib/readAutoMovieRevision.js +3 -9
- package/lib/readAutoMovieRevision.js.map +1 -1
- package/lib/readAutoMovieVerifyOptions.d.ts +17 -0
- package/lib/readAutoMovieVerifyOptions.js +45 -0
- package/lib/readAutoMovieVerifyOptions.js.map +1 -0
- package/lib/readAutoMovieVideoProbe.d.ts +6 -10
- package/lib/readAutoMovieVideoProbe.js +20 -13
- package/lib/readAutoMovieVideoProbe.js.map +1 -1
- package/lib/recordAutoMoviePlayback.d.ts +18 -11
- package/lib/recordAutoMoviePlayback.js +26 -13
- package/lib/recordAutoMoviePlayback.js.map +1 -1
- package/lib/renderAutoMovie.d.ts +16 -10
- package/lib/renderAutoMovie.js +31 -14
- package/lib/renderAutoMovie.js.map +1 -1
- package/lib/renderAutoMovieScaffoldNextSteps.d.ts +10 -10
- package/lib/renderAutoMovieScaffoldNextSteps.js +10 -10
- package/lib/renderAutoMovieVideo.d.ts +53 -15
- package/lib/renderAutoMovieVideo.js +290 -45
- package/lib/renderAutoMovieVideo.js.map +1 -1
- package/lib/resolveAutoMovieFfmpeg.d.ts +12 -15
- package/lib/resolveAutoMovieFfmpeg.js +12 -17
- package/lib/resolveAutoMovieFfmpeg.js.map +1 -1
- package/lib/reviewAutoMovie.d.ts +10 -10
- package/lib/reviewAutoMovie.js +15 -10
- package/lib/reviewAutoMovie.js.map +1 -1
- package/lib/reviewAutoMovieFile.d.ts +21 -0
- package/lib/reviewAutoMovieFile.js +378 -0
- package/lib/reviewAutoMovieFile.js.map +1 -0
- package/lib/run.d.ts +32 -18
- package/lib/run.js +67 -23
- package/lib/run.js.map +1 -1
- package/lib/runAutoMovieDeliveryAudioDecode.d.ts +18 -0
- package/lib/runAutoMovieDeliveryAudioDecode.js +28 -0
- package/lib/runAutoMovieDeliveryAudioDecode.js.map +1 -0
- package/lib/runAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/runAutoMovieDeliveryDecode.js +42 -0
- package/lib/runAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.d.ts +28 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.js +77 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.js.map +1 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.d.ts +20 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.js +56 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.js.map +1 -0
- package/lib/runAutoMovieFfmpeg.d.ts +15 -10
- package/lib/runAutoMovieFfmpeg.js +36 -13
- package/lib/runAutoMovieFfmpeg.js.map +1 -1
- package/lib/runAutoMovieVerification.d.ts +28 -0
- package/lib/runAutoMovieVerification.js +393 -0
- package/lib/runAutoMovieVerification.js.map +1 -0
- package/lib/sameAutoMovieReviewFile.d.ts +2 -0
- package/lib/sameAutoMovieReviewFile.js +57 -0
- package/lib/sameAutoMovieReviewFile.js.map +1 -0
- package/lib/selectAutoMovieProjectName.d.ts +8 -11
- package/lib/selectAutoMovieProjectName.js +8 -11
- package/lib/selectAutoMovieProjectName.js.map +1 -1
- package/lib/serveAutoMovieDrawPage.d.ts +14 -11
- package/lib/serveAutoMovieDrawPage.js +14 -11
- package/lib/serveAutoMovieDrawPage.js.map +1 -1
- package/lib/serveAutoMovieInspectorPage.d.ts +4 -8
- package/lib/serveAutoMovieInspectorPage.js +3 -9
- package/lib/serveAutoMovieInspectorPage.js.map +1 -1
- package/lib/verifyAutoMovie.d.ts +19 -0
- package/lib/verifyAutoMovie.js +44 -0
- package/lib/verifyAutoMovie.js.map +1 -0
- package/lib/writeAutoMovieModulePage.d.ts +17 -12
- package/lib/writeAutoMovieModulePage.js +13 -11
- package/lib/writeAutoMovieModulePage.js.map +1 -1
- package/lib/writeAutoMovieVerificationReceipt.d.ts +2 -0
- package/lib/writeAutoMovieVerificationReceipt.js +75 -0
- package/lib/writeAutoMovieVerificationReceipt.js.map +1 -0
- package/package.json +8 -8
- package/src/AUTOMOVIE_CAPTURE_OPTIONS.ts +6 -2
- package/src/AUTOMOVIE_DEFAULT_PROJECT_NAME.ts +3 -1
- package/src/AUTOMOVIE_INSPECT_OPTIONS.ts +5 -2
- package/src/AUTOMOVIE_RENDER_OPTIONS.ts +8 -2
- package/src/AUTOMOVIE_REVIEW_OPTIONS.ts +12 -1
- package/src/AutoMovieCaptureBackend.ts +4 -6
- package/src/AutoMovieCaptureHost.ts +122 -68
- package/src/AutoMovieCommand.ts +71 -20
- package/src/AutoMovieFfmpegStaticPath.ts +7 -0
- package/src/AutoMovieMp4Boxes.ts +263 -0
- package/src/AutoMovieRenderOutputReservation.ts +97 -0
- package/src/IAutoMovieChromium.ts +13 -57
- package/src/IAutoMovieDeliveryAudioTrack.ts +19 -0
- package/src/IAutoMovieDeliveryProfileFinding.ts +24 -0
- package/src/IAutoMovieFfmpegSources.ts +13 -0
- package/src/IAutoMovieReviewObservation.ts +59 -0
- package/src/IAutoMovieVerification.ts +207 -0
- package/src/auditAutoMovieAlphaSamples.ts +201 -0
- package/src/auditAutoMovieDeliveryProfile.ts +125 -0
- package/src/captureAutoMovie.ts +137 -28
- package/src/createAutoMovieDeliveryAudioLog.ts +141 -0
- package/src/createAutoMovieDeliveryAudioScan.ts +150 -0
- package/src/createAutoMovieVerificationInputScope.ts +156 -0
- package/src/createAutoMovieVerificationMediaHash.ts +32 -0
- package/src/decodeAutoMovieDeliveryAudio.ts +95 -0
- package/src/deriveAutoMovieProjectName.ts +14 -11
- package/src/findAutoMovieFreePort.ts +5 -10
- package/src/formatAutoMovieInspectUrl.ts +6 -10
- package/src/hashAutoMovieFile.ts +12 -0
- package/src/importAutoMovieVerificationEntry.mts +6 -0
- package/src/index.ts +9 -0
- package/src/inspectAutoMovie.ts +28 -11
- package/src/inspectAutoMovieVerificationCapture.ts +292 -0
- package/src/inspectAutoMovieVerificationDelivery.ts +301 -0
- package/src/inspectAutoMovieVerificationReview.ts +130 -0
- package/src/launchAutoMovieChromium.ts +14 -12
- package/src/listAutoMovieReleaseFindings.ts +87 -0
- package/src/loadAutoMovieProductionModule.ts +22 -15
- package/src/loadAutoMovieVerificationModule.ts +278 -0
- package/src/planAutoMovieChromiumLaunch.ts +7 -13
- package/src/planAutoMovieDeliveryAudioDecode.ts +26 -0
- package/src/planAutoMovieDeliveryDecode.ts +66 -0
- package/src/planAutoMovieDeliveryInput.ts +25 -0
- package/src/planAutoMovieModulePageViteConfig.ts +13 -10
- package/src/promptAutoMovieProjectName.ts +6 -10
- package/src/publishAutoMovieRenderAttempt.ts +89 -0
- package/src/readAutoMovieAddArguments.ts +10 -11
- package/src/readAutoMovieCaptureHostOptions.ts +22 -17
- package/src/readAutoMovieCommandArguments.ts +8 -10
- package/src/readAutoMovieCreateArguments.ts +7 -11
- package/src/readAutoMovieDeliveryAudioTrack.ts +137 -0
- package/src/readAutoMovieDeliveryDecode.ts +269 -0
- package/src/readAutoMovieDeliveryProbe.ts +499 -0
- package/src/readAutoMovieErrorCode.ts +13 -0
- package/src/readAutoMovieInspectHostOptions.ts +15 -16
- package/src/readAutoMovieNameOption.ts +4 -10
- package/src/readAutoMoviePageTimeout.ts +19 -0
- package/src/readAutoMovieRenderOptions.ts +34 -16
- package/src/readAutoMovieReviewObservation.ts +146 -0
- package/src/readAutoMovieReviewOptions.ts +133 -28
- package/src/readAutoMovieRevision.ts +3 -9
- package/src/readAutoMovieVerifyOptions.ts +50 -0
- package/src/readAutoMovieVideoProbe.ts +24 -13
- package/src/recordAutoMoviePlayback.ts +26 -13
- package/src/renderAutoMovie.ts +38 -17
- package/src/renderAutoMovieScaffoldNextSteps.ts +10 -10
- package/src/renderAutoMovieVideo.ts +474 -85
- package/src/resolveAutoMovieFfmpeg.ts +17 -24
- package/src/reviewAutoMovie.ts +21 -16
- package/src/reviewAutoMovieFile.ts +479 -0
- package/src/run.ts +75 -25
- package/src/runAutoMovieDeliveryAudioDecode.ts +45 -0
- package/src/runAutoMovieDeliveryDecode.ts +63 -0
- package/src/runAutoMovieDeliveryReferenceDecode.ts +107 -0
- package/src/runAutoMovieDeliverySourceAudioDecode.ts +71 -0
- package/src/runAutoMovieFfmpeg.ts +48 -14
- package/src/runAutoMovieVerification.ts +487 -0
- package/src/sameAutoMovieReviewFile.ts +23 -0
- package/src/selectAutoMovieProjectName.ts +8 -11
- package/src/serveAutoMovieDrawPage.ts +16 -12
- package/src/serveAutoMovieInspectorPage.ts +6 -9
- package/src/verifyAutoMovie.ts +67 -0
- package/src/writeAutoMovieModulePage.ts +17 -12
- package/src/writeAutoMovieVerificationReceipt.ts +51 -0
package/src/captureAutoMovie.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
IAutoMovieCaptureCellComparison,
|
|
3
3
|
IAutoMovieCaptureCellRecord,
|
|
4
|
+
IAutoMovieCaptureFindingDiff,
|
|
4
5
|
IAutoMovieCapturePlanRequest,
|
|
5
6
|
IAutoMovieCaptureRecord,
|
|
7
|
+
IAutoMovieCaptureStorage,
|
|
6
8
|
} from "@automovie/interface";
|
|
7
9
|
import type * as Render from "@automovie/render";
|
|
8
10
|
import * as fs from "node:fs/promises";
|
|
9
11
|
import * as path from "node:path";
|
|
10
12
|
|
|
11
13
|
import { AutoMovieCaptureHost } from "./AutoMovieCaptureHost";
|
|
14
|
+
import type { AutoMovieFfmpegStaticPath } from "./AutoMovieFfmpegStaticPath";
|
|
12
15
|
import { loadAutoMovieProductionModule } from "./loadAutoMovieProductionModule";
|
|
13
16
|
import { readAutoMovieCaptureHostOptions } from "./readAutoMovieCaptureHostOptions";
|
|
14
17
|
import { readAutoMovieRevision } from "./readAutoMovieRevision";
|
|
@@ -17,19 +20,25 @@ import { resolveAutoMovieFfmpeg } from "./resolveAutoMovieFfmpeg";
|
|
|
17
20
|
import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
|
-
* Run `automovie capture` in a production: read the options through the request
|
|
23
|
+
* Run `automovie capture` in a production: read the options through the request
|
|
24
|
+
* grammar, capture a subject drawn by the draw page or a video file's own
|
|
25
|
+
* frames, print what was written, and resolve to the exit status.
|
|
21
26
|
*
|
|
22
|
-
* Options are read by `readAutoMovieCaptureArguments` and split by
|
|
27
|
+
* Options are read by `readAutoMovieCaptureArguments` and split by
|
|
28
|
+
* `readAutoMovieCaptureHostOptions`; the rest is the request
|
|
29
|
+
* `parseAutoMovieCapturePlanRequest` reads, so the command takes exactly the
|
|
30
|
+
* keys of a page's address. With `--module` the subject is drawn through
|
|
31
|
+
* `AutoMovieCaptureHost`, its module called with the JSON of `--props` when
|
|
32
|
+
* given; with `--file` the file is probed by FFmpeg and captured by
|
|
33
|
+
* `runAutoMovieVideoCapture`, its subject named by `subject` or the file's
|
|
34
|
+
* name. Both write into `--out`, or `media/capture/<subject>`.
|
|
23
35
|
*
|
|
24
|
-
* It prints the folder and how many cells were drawn, the backend, every sheet,
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms One host or two FFmpeg runs plus the probe; printing is linear in the record.
|
|
31
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work One capture per command.
|
|
32
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The host is closed on every outcome.
|
|
36
|
+
* It prints the folder and how many cells were drawn, the backend, every sheet,
|
|
37
|
+
* every cell not drawn with its cause, each unmatched or changed comparison
|
|
38
|
+
* entry, and the comparison's finding outcome with each fixed, new, worse or
|
|
39
|
+
* unmatched finding. The finding outcome does not change the status: the status
|
|
40
|
+
* is 1 when any cell was not drawn, because an undrawn cell is unverified
|
|
41
|
+
* evidence, and 0 otherwise; a refusal throws to `run`, which prints it.
|
|
33
42
|
*/
|
|
34
43
|
export async function captureAutoMovie(props: {
|
|
35
44
|
/** The tokens after `capture`. */
|
|
@@ -40,12 +49,21 @@ export async function captureAutoMovie(props: {
|
|
|
40
49
|
|
|
41
50
|
/** The environment, read for `CHROME_PATH` and `FFMPEG_PATH`. */
|
|
42
51
|
env: Readonly<Record<string, string | undefined>>;
|
|
52
|
+
|
|
53
|
+
/** The caller's output sink, default standard output. */
|
|
54
|
+
write?: (text: string) => void;
|
|
55
|
+
|
|
56
|
+
/** The absolute record path verification expects this capture to write. */
|
|
57
|
+
expectedRecord?: string;
|
|
58
|
+
|
|
59
|
+
/** Receives the absolute path of this attempt's completed capture record. */
|
|
60
|
+
recorded?: (file: string, text: string) => void;
|
|
43
61
|
}): Promise<number> {
|
|
44
62
|
const { root } = props;
|
|
45
|
-
const render: typeof Render = loadAutoMovieProductionModule(
|
|
63
|
+
const render: typeof Render = loadAutoMovieProductionModule<typeof Render>(
|
|
46
64
|
root,
|
|
47
65
|
"@automovie/render",
|
|
48
|
-
)
|
|
66
|
+
);
|
|
49
67
|
const options: ReturnType<typeof readAutoMovieCaptureHostOptions> =
|
|
50
68
|
readAutoMovieCaptureHostOptions(
|
|
51
69
|
render.readAutoMovieCaptureArguments(props.args),
|
|
@@ -53,34 +71,83 @@ export async function captureAutoMovie(props: {
|
|
|
53
71
|
const request: IAutoMovieCapturePlanRequest =
|
|
54
72
|
render.parseAutoMovieCapturePlanRequest(options.request);
|
|
55
73
|
|
|
74
|
+
const recordPath = (folder: string): string =>
|
|
75
|
+
path.join(
|
|
76
|
+
folder,
|
|
77
|
+
...(request.round === null ? [] : ["rounds", request.round]),
|
|
78
|
+
"record.json",
|
|
79
|
+
);
|
|
80
|
+
const admitFolder = (folder: string): void => {
|
|
81
|
+
if (props.expectedRecord === undefined) return;
|
|
82
|
+
const file: string = recordPath(folder);
|
|
83
|
+
if (path.relative(props.expectedRecord, file) !== "")
|
|
84
|
+
throw new Error(
|
|
85
|
+
`The configured capture would write ${file}. The check declares ${props.expectedRecord}.`,
|
|
86
|
+
);
|
|
87
|
+
};
|
|
88
|
+
if (options.out !== null && props.expectedRecord !== undefined)
|
|
89
|
+
admitFolder(path.resolve(root, options.out));
|
|
90
|
+
|
|
91
|
+
let recordText: string | undefined;
|
|
92
|
+
const storage: IAutoMovieCaptureStorage =
|
|
93
|
+
props.recorded === undefined
|
|
94
|
+
? fs
|
|
95
|
+
: {
|
|
96
|
+
...fs,
|
|
97
|
+
writeFile: async (
|
|
98
|
+
file: string,
|
|
99
|
+
data: Parameters<IAutoMovieCaptureStorage["writeFile"]>[1],
|
|
100
|
+
): Promise<void> => {
|
|
101
|
+
await fs.writeFile(file, data);
|
|
102
|
+
if (
|
|
103
|
+
typeof data === "string" &&
|
|
104
|
+
path.basename(file) === "record.json"
|
|
105
|
+
)
|
|
106
|
+
recordText = data;
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
56
110
|
let record: Extract<IAutoMovieCaptureRecord, { state: "complete" }>;
|
|
57
111
|
let backend: string;
|
|
58
112
|
let folder: string;
|
|
59
113
|
if (options.file !== null) {
|
|
60
114
|
// A video file: probe it, then capture its own frames.
|
|
61
|
-
const ffmpeg: string = resolveAutoMovieFfmpeg({
|
|
62
|
-
env: props.env,
|
|
63
|
-
load: (id: string): unknown => loadAutoMovieProductionModule(root, id),
|
|
64
|
-
});
|
|
65
115
|
const file: string = path.resolve(root, options.file);
|
|
66
|
-
const probe: ReturnType<typeof readAutoMovieVideoProbe> =
|
|
67
|
-
readAutoMovieVideoProbe(
|
|
68
|
-
await runAutoMovieFfmpeg(
|
|
69
|
-
ffmpeg,
|
|
70
|
-
["-hide_banner", "-i", file],
|
|
71
|
-
(): boolean => true,
|
|
72
|
-
),
|
|
73
|
-
);
|
|
74
116
|
const name: string = request.subject ?? path.parse(file).name;
|
|
75
117
|
folder = path.resolve(
|
|
76
118
|
root,
|
|
77
119
|
options.out ?? path.join("media", "capture", name),
|
|
78
120
|
);
|
|
121
|
+
if (options.out === null) admitFolder(folder);
|
|
122
|
+
const ffmpeg: string = resolveAutoMovieFfmpeg({
|
|
123
|
+
env: props.env,
|
|
124
|
+
load: (id: "ffmpeg-static"): AutoMovieFfmpegStaticPath =>
|
|
125
|
+
loadAutoMovieProductionModule<AutoMovieFfmpegStaticPath>(root, id),
|
|
126
|
+
});
|
|
127
|
+
const probe: ReturnType<typeof readAutoMovieVideoProbe> =
|
|
128
|
+
readAutoMovieVideoProbe(
|
|
129
|
+
await runAutoMovieFfmpeg(ffmpeg, [
|
|
130
|
+
"-hide_banner",
|
|
131
|
+
"-threads",
|
|
132
|
+
"1",
|
|
133
|
+
"-i",
|
|
134
|
+
file,
|
|
135
|
+
"-map",
|
|
136
|
+
"0:v:0",
|
|
137
|
+
"-vf",
|
|
138
|
+
"showinfo=checksum=0",
|
|
139
|
+
"-frames:v",
|
|
140
|
+
"1",
|
|
141
|
+
"-f",
|
|
142
|
+
"null",
|
|
143
|
+
"-",
|
|
144
|
+
]),
|
|
145
|
+
);
|
|
79
146
|
record = await render.runAutoMovieVideoCapture({
|
|
80
147
|
file,
|
|
81
148
|
subject: { name, ...probe },
|
|
82
149
|
request,
|
|
83
|
-
storage
|
|
150
|
+
storage,
|
|
84
151
|
root: folder,
|
|
85
152
|
run: async (args: readonly string[]): Promise<void> => {
|
|
86
153
|
await runAutoMovieFfmpeg(ffmpeg, args);
|
|
@@ -94,6 +161,7 @@ export async function captureAutoMovie(props: {
|
|
|
94
161
|
root,
|
|
95
162
|
module: options.module!,
|
|
96
163
|
backend: options.backend,
|
|
164
|
+
timeout: options.timeout,
|
|
97
165
|
env: props.env,
|
|
98
166
|
});
|
|
99
167
|
try {
|
|
@@ -105,7 +173,8 @@ export async function captureAutoMovie(props: {
|
|
|
105
173
|
: JSON.parse(
|
|
106
174
|
await fs.readFile(path.resolve(root, options.props), "utf8"),
|
|
107
175
|
),
|
|
108
|
-
...(options.out === null ? {} : { out: options.out }),
|
|
176
|
+
...(options.out === null ? { admitFolder } : { out: options.out }),
|
|
177
|
+
storage,
|
|
109
178
|
});
|
|
110
179
|
} finally {
|
|
111
180
|
await host.close();
|
|
@@ -144,7 +213,47 @@ export async function captureAutoMovie(props: {
|
|
|
144
213
|
? [`changed ${entry.current}: ${entry.changed} pixels`]
|
|
145
214
|
: [],
|
|
146
215
|
)),
|
|
216
|
+
...(record.comparison === null
|
|
217
|
+
? []
|
|
218
|
+
: describeFindings(record.comparison.findings)),
|
|
147
219
|
];
|
|
148
|
-
|
|
220
|
+
if (props.recorded !== undefined) {
|
|
221
|
+
if (recordText === undefined)
|
|
222
|
+
throw new Error("The capture completed without writing its record.");
|
|
223
|
+
props.recorded(recordPath(folder), recordText);
|
|
224
|
+
}
|
|
225
|
+
const output: string = `${lines.join("\n")}\n`;
|
|
226
|
+
if (props.write === undefined) process.stdout.write(output);
|
|
227
|
+
else props.write(output);
|
|
149
228
|
return failed.length === 0 ? 0 : 1;
|
|
150
229
|
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* The finding outcome, then each fixed, new, worse or unmatched finding, one
|
|
233
|
+
* per line.
|
|
234
|
+
*/
|
|
235
|
+
function describeFindings(diff: IAutoMovieCaptureFindingDiff): string[] {
|
|
236
|
+
if (diff.state === "omitted")
|
|
237
|
+
return [
|
|
238
|
+
`findings not compared: no diagnostics in ${diff.lacking
|
|
239
|
+
.map((side: "earlier" | "current"): string =>
|
|
240
|
+
side === "earlier" ? "the earlier round" : "this capture",
|
|
241
|
+
)
|
|
242
|
+
.join(" or ")}`,
|
|
243
|
+
];
|
|
244
|
+
return [
|
|
245
|
+
`findings ${diff.outcome}`,
|
|
246
|
+
...diff.entries.flatMap(
|
|
247
|
+
(entry: IAutoMovieCaptureFindingDiff.IEntry): string[] => {
|
|
248
|
+
const name: string = `${entry.category} ${entry.check} ${entry.code} ${entry.key} in ${entry.scope}`;
|
|
249
|
+
return entry.state === "unmatched"
|
|
250
|
+
? [`unmatched ${name}: ${entry.cause}`]
|
|
251
|
+
: entry.state === "carried"
|
|
252
|
+
? entry.change === "worse"
|
|
253
|
+
? [`worse ${name}`]
|
|
254
|
+
: []
|
|
255
|
+
: [`${entry.state} ${name}`];
|
|
256
|
+
},
|
|
257
|
+
),
|
|
258
|
+
];
|
|
259
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { IAutoMovieDeliveryContentAudit } from "@automovie/interface";
|
|
2
|
+
|
|
3
|
+
import type { createAutoMovieDeliveryAudioScan } from "./createAutoMovieDeliveryAudioScan";
|
|
4
|
+
|
|
5
|
+
type Observation = IAutoMovieDeliveryContentAudit.IObservation;
|
|
6
|
+
type Stream = IAutoMovieDeliveryContentAudit.Stream;
|
|
7
|
+
type Timestamp = IAutoMovieDeliveryContentAudit.ITimestamp;
|
|
8
|
+
type PcmEvidence = ReturnType<
|
|
9
|
+
ReturnType<typeof createAutoMovieDeliveryAudioScan>["finish"]
|
|
10
|
+
>;
|
|
11
|
+
|
|
12
|
+
/** The decoded sample rate and interleaved channel count. */
|
|
13
|
+
interface IAudioFormat {
|
|
14
|
+
sampleRate: number;
|
|
15
|
+
channels: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Accumulates exact decoded coverage from FFmpeg's audio frame log.
|
|
20
|
+
*
|
|
21
|
+
* The decoder returns whole codec frames, so the last one can extend past the
|
|
22
|
+
* presentation the container records. Samples beyond that end, all within the
|
|
23
|
+
* final decoded frame, are codec padding: they leave the stream's coverage and
|
|
24
|
+
* content and are reported as trailing padding. A longer overrun is kept, so
|
|
25
|
+
* the audit still sees the real duration.
|
|
26
|
+
*
|
|
27
|
+
* @returns A line consumer, the first decoded frame format and a completion
|
|
28
|
+
* operation that reconciles timing with the PCM byte stream and the
|
|
29
|
+
* container.
|
|
30
|
+
*/
|
|
31
|
+
export function createAutoMovieDeliveryAudioLog() {
|
|
32
|
+
let format: IAudioFormat | undefined;
|
|
33
|
+
let firstPts = 0;
|
|
34
|
+
let nextPts = 0;
|
|
35
|
+
let frames = 0;
|
|
36
|
+
let sampleFrames = 0;
|
|
37
|
+
let lastSamples = 0;
|
|
38
|
+
let malformed = false;
|
|
39
|
+
let continuous = true;
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
push(line: string): void {
|
|
43
|
+
const output = /^\[Parsed_ashowinfo_\d+ @ [^\]]+\]\s+(n:.*)$/u.exec(
|
|
44
|
+
line,
|
|
45
|
+
)?.[1];
|
|
46
|
+
if (output === undefined) return;
|
|
47
|
+
const row =
|
|
48
|
+
/^n:(\d+)\s+pts:(-?\d+)\s+pts_time:\S+\s+fmt:flt\s+channels:(\d+)\s+chlayout:.*?\s+rate:(\d+)\s+nb_samples:(\d+)\s/u.exec(
|
|
49
|
+
output,
|
|
50
|
+
);
|
|
51
|
+
const index = Number(row?.[1]);
|
|
52
|
+
const pts = Number(row?.[2]);
|
|
53
|
+
const channels = Number(row?.[3]);
|
|
54
|
+
const sampleRate = Number(row?.[4]);
|
|
55
|
+
const samples = Number(row?.[5]);
|
|
56
|
+
if (
|
|
57
|
+
![
|
|
58
|
+
index,
|
|
59
|
+
pts,
|
|
60
|
+
channels,
|
|
61
|
+
sampleRate,
|
|
62
|
+
samples,
|
|
63
|
+
pts + samples,
|
|
64
|
+
sampleFrames + samples,
|
|
65
|
+
].every(Number.isSafeInteger) ||
|
|
66
|
+
channels < 1 ||
|
|
67
|
+
sampleRate < 1 ||
|
|
68
|
+
samples < 1
|
|
69
|
+
) {
|
|
70
|
+
malformed = true;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (format === undefined) {
|
|
74
|
+
format = { channels, sampleRate };
|
|
75
|
+
firstPts = pts;
|
|
76
|
+
nextPts = pts;
|
|
77
|
+
} else if (
|
|
78
|
+
format.channels !== channels ||
|
|
79
|
+
format.sampleRate !== sampleRate
|
|
80
|
+
)
|
|
81
|
+
malformed = true;
|
|
82
|
+
|
|
83
|
+
continuous &&= index === frames && pts === nextPts;
|
|
84
|
+
frames++;
|
|
85
|
+
sampleFrames += samples;
|
|
86
|
+
lastSamples = samples;
|
|
87
|
+
nextPts = pts + samples;
|
|
88
|
+
},
|
|
89
|
+
format: (): IAudioFormat | undefined => format,
|
|
90
|
+
finish(
|
|
91
|
+
index: number,
|
|
92
|
+
pcm: PcmEvidence,
|
|
93
|
+
presented: { timescale: number; duration: number } | undefined,
|
|
94
|
+
): Stream {
|
|
95
|
+
if (malformed || format === undefined)
|
|
96
|
+
return {
|
|
97
|
+
status: "uncovered",
|
|
98
|
+
reason: "Incomplete or invalid audio frame evidence",
|
|
99
|
+
};
|
|
100
|
+
if (!pcm.valid || pcm.sampleFrames !== sampleFrames)
|
|
101
|
+
return {
|
|
102
|
+
status: "uncovered",
|
|
103
|
+
reason: "Decoded audio samples and frame evidence do not agree",
|
|
104
|
+
};
|
|
105
|
+
const sampleRate = format.sampleRate;
|
|
106
|
+
if (presented !== undefined && presented.timescale !== sampleRate)
|
|
107
|
+
return {
|
|
108
|
+
status: "uncovered",
|
|
109
|
+
reason: "The container and decoded audio clocks differ",
|
|
110
|
+
};
|
|
111
|
+
const overrun =
|
|
112
|
+
presented === undefined ? 0 : sampleFrames - presented.duration;
|
|
113
|
+
const padding = overrun > 0 && overrun < lastSamples ? overrun : 0;
|
|
114
|
+
const timestamp = (ticks: number): Timestamp => ({
|
|
115
|
+
ticks,
|
|
116
|
+
timeBase: [1, sampleRate],
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
status: "decoded",
|
|
120
|
+
index,
|
|
121
|
+
start: timestamp(firstPts),
|
|
122
|
+
end: timestamp(nextPts - padding),
|
|
123
|
+
sampleRate,
|
|
124
|
+
continuous,
|
|
125
|
+
...(padding === 0 ? {} : { trailingPadding: padding }),
|
|
126
|
+
...(pcm.loudness === undefined ? {} : { loudness: pcm.loudness }),
|
|
127
|
+
observations:
|
|
128
|
+
continuous && overrun < lastSamples
|
|
129
|
+
? pcm.silent.map(
|
|
130
|
+
(range): Observation => ({
|
|
131
|
+
detector: "silence",
|
|
132
|
+
start: timestamp(firstPts + range.start),
|
|
133
|
+
end:
|
|
134
|
+
range.end === null ? null : timestamp(firstPts + range.end),
|
|
135
|
+
}),
|
|
136
|
+
)
|
|
137
|
+
: [],
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IAutoMovieDeliveryContentAudit,
|
|
3
|
+
IAutoMovieLoudnessMeter,
|
|
4
|
+
} from "@automovie/interface";
|
|
5
|
+
|
|
6
|
+
/** A qualifying quiet run in sample frames; a null end runs to the stream end. */
|
|
7
|
+
interface ISampleRange {
|
|
8
|
+
start: number;
|
|
9
|
+
end: number | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Measures silence at exact sample frame boundaries in f32le PCM. Every channel
|
|
14
|
+
* must be within the amplitude limit. Separate pipe chunks can split a float or
|
|
15
|
+
* an interleaved sample frame. Sample frames from the presented count on are
|
|
16
|
+
* counted for coverage but not measured, and an interval still open there ends
|
|
17
|
+
* with the stream.
|
|
18
|
+
*
|
|
19
|
+
* When a loudness meter is supplied, the presented samples also feed it, so the
|
|
20
|
+
* decoded delivery's loudness and true peak exclude codec padding. The meter
|
|
21
|
+
* measures 48 kHz mono or stereo; other formats are not measured.
|
|
22
|
+
*
|
|
23
|
+
* @param format Decoded sample rate and interleaved channel count.
|
|
24
|
+
* @param settings Maximum normalized amplitude and minimum qualifying duration.
|
|
25
|
+
* @param presented Sample frames the container presents, after which decoded
|
|
26
|
+
* samples are padding.
|
|
27
|
+
* @param meter Creates the render's BS.1770-5 meter for the channel count, when
|
|
28
|
+
* loudness is measured.
|
|
29
|
+
* @returns A byte stream consumer and its complete sample, interval and
|
|
30
|
+
* loudness evidence.
|
|
31
|
+
*/
|
|
32
|
+
export function createAutoMovieDeliveryAudioScan(
|
|
33
|
+
format: { sampleRate: number; channels: number },
|
|
34
|
+
settings: IAutoMovieDeliveryContentAudit.IThresholds["silence"],
|
|
35
|
+
presented: number,
|
|
36
|
+
meter?: (channels: 1 | 2) => IAutoMovieLoudnessMeter,
|
|
37
|
+
) {
|
|
38
|
+
const floatBytes = 4;
|
|
39
|
+
const carry = Buffer.alloc(floatBytes);
|
|
40
|
+
let carryLength = 0;
|
|
41
|
+
let sampleFrames = 0;
|
|
42
|
+
let channel = 0;
|
|
43
|
+
let quiet = true;
|
|
44
|
+
let quietStart: number | undefined;
|
|
45
|
+
let valid = true;
|
|
46
|
+
const silent: ISampleRange[] = [];
|
|
47
|
+
|
|
48
|
+
const { maximumAmplitude, minimumDuration } = settings;
|
|
49
|
+
const [seconds, timeTicks] = minimumDuration.timeBase;
|
|
50
|
+
if (
|
|
51
|
+
![format.channels, format.sampleRate, seconds, timeTicks, presented].every(
|
|
52
|
+
(value) => Number.isSafeInteger(value) && value > 0,
|
|
53
|
+
) ||
|
|
54
|
+
!Number.isSafeInteger(minimumDuration.ticks) ||
|
|
55
|
+
minimumDuration.ticks < 0 ||
|
|
56
|
+
!Number.isFinite(maximumAmplitude) ||
|
|
57
|
+
maximumAmplitude < 0 ||
|
|
58
|
+
maximumAmplitude > 1
|
|
59
|
+
)
|
|
60
|
+
throw new Error("Invalid decoded audio format or silence thresholds");
|
|
61
|
+
|
|
62
|
+
const ticks = BigInt(timeTicks);
|
|
63
|
+
const rate = BigInt(format.sampleRate);
|
|
64
|
+
const minimumSamples = Number(
|
|
65
|
+
(BigInt(minimumDuration.ticks) * BigInt(seconds) * rate + ticks - 1n) /
|
|
66
|
+
ticks,
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// Presented samples reach the meter in batches of whole frames.
|
|
70
|
+
const loudness: IAutoMovieLoudnessMeter | undefined =
|
|
71
|
+
meter !== undefined &&
|
|
72
|
+
format.sampleRate === 48_000 &&
|
|
73
|
+
(format.channels === 1 || format.channels === 2)
|
|
74
|
+
? meter(format.channels)
|
|
75
|
+
: undefined;
|
|
76
|
+
const batch = new Float32Array(4096 * format.channels);
|
|
77
|
+
let batched = 0;
|
|
78
|
+
|
|
79
|
+
const flush = (end: number | null): void => {
|
|
80
|
+
if (
|
|
81
|
+
quietStart !== undefined &&
|
|
82
|
+
Math.min(sampleFrames, presented) - quietStart >= minimumSamples
|
|
83
|
+
)
|
|
84
|
+
silent.push({ start: quietStart, end });
|
|
85
|
+
quietStart = undefined;
|
|
86
|
+
};
|
|
87
|
+
const take = (sample: number): void => {
|
|
88
|
+
if (!Number.isFinite(sample)) valid = false;
|
|
89
|
+
quiet &&= Math.abs(sample) <= maximumAmplitude;
|
|
90
|
+
if (loudness !== undefined && sampleFrames < presented) {
|
|
91
|
+
batch[batched++] = sample;
|
|
92
|
+
if (batched === batch.length) {
|
|
93
|
+
loudness.push(batch);
|
|
94
|
+
batched = 0;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if (++channel !== format.channels) return;
|
|
98
|
+
if (sampleFrames < presented) {
|
|
99
|
+
if (quiet) quietStart ??= sampleFrames;
|
|
100
|
+
else flush(sampleFrames);
|
|
101
|
+
}
|
|
102
|
+
sampleFrames++;
|
|
103
|
+
channel = 0;
|
|
104
|
+
quiet = true;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
push(chunk: Buffer): void {
|
|
109
|
+
let offset = 0;
|
|
110
|
+
if (carryLength > 0) {
|
|
111
|
+
offset = Math.min(floatBytes - carryLength, chunk.length);
|
|
112
|
+
chunk.copy(carry, carryLength, 0, offset);
|
|
113
|
+
carryLength += offset;
|
|
114
|
+
if (carryLength !== floatBytes) return;
|
|
115
|
+
take(carry.readFloatLE(0));
|
|
116
|
+
}
|
|
117
|
+
for (; offset + floatBytes <= chunk.length; offset += floatBytes)
|
|
118
|
+
take(chunk.readFloatLE(offset));
|
|
119
|
+
carryLength = chunk.length - offset;
|
|
120
|
+
if (carryLength > 0) chunk.copy(carry, 0, offset);
|
|
121
|
+
},
|
|
122
|
+
finish(): {
|
|
123
|
+
sampleFrames: number;
|
|
124
|
+
valid: boolean;
|
|
125
|
+
silent: ISampleRange[];
|
|
126
|
+
loudness?: Omit<IAutoMovieLoudnessMeter.IMeasurement, "sampleFrames">;
|
|
127
|
+
} {
|
|
128
|
+
flush(null);
|
|
129
|
+
let measured: IAutoMovieLoudnessMeter.IMeasurement | undefined;
|
|
130
|
+
if (loudness !== undefined) {
|
|
131
|
+
loudness.push(batch.subarray(0, batched));
|
|
132
|
+
batched = 0;
|
|
133
|
+
measured = loudness.measure();
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
sampleFrames,
|
|
137
|
+
valid: valid && carryLength === 0 && channel === 0,
|
|
138
|
+
silent,
|
|
139
|
+
...(measured === undefined
|
|
140
|
+
? {}
|
|
141
|
+
: {
|
|
142
|
+
loudness: {
|
|
143
|
+
integratedLufs: measured.integratedLufs,
|
|
144
|
+
truePeakDbtp: measured.truePeakDbtp,
|
|
145
|
+
},
|
|
146
|
+
}),
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import * as fs from "node:fs/promises";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
|
|
6
|
+
import type { IAutoMovieVerification } from "./IAutoMovieVerification";
|
|
7
|
+
import { hashAutoMovieFile } from "./hashAutoMovieFile";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Resolve explicitly named verification inputs to files in the production or
|
|
11
|
+
* its Git checkout. Check the named path and the actual destination so a link
|
|
12
|
+
* cannot redirect the verifier beyond those boundaries. Discover the checkout
|
|
13
|
+
* only when a declared file or a legacy capture needs it.
|
|
14
|
+
*
|
|
15
|
+
* @param root The production directory.
|
|
16
|
+
* @returns Lazy production and checkout directories and an input resolver.
|
|
17
|
+
*/
|
|
18
|
+
export function createAutoMovieVerificationInputScope(root: string): {
|
|
19
|
+
/** Canonical production directory. */
|
|
20
|
+
readonly project: () => Promise<string>;
|
|
21
|
+
/** Canonical Git worktree containing the project, when there is one. */
|
|
22
|
+
readonly checkout: () => Promise<string | null>;
|
|
23
|
+
/** The normalized input name and its admitted filesystem location. */
|
|
24
|
+
readonly verifySources: (
|
|
25
|
+
sources: ReadonlyMap<string, string>,
|
|
26
|
+
) => Promise<void>;
|
|
27
|
+
readonly identify: (
|
|
28
|
+
check:
|
|
29
|
+
| IAutoMovieVerification.IMeasurement
|
|
30
|
+
| IAutoMovieVerification.ICapture,
|
|
31
|
+
sources?: (file: string | undefined) => ReadonlyMap<string, string>,
|
|
32
|
+
) => Promise<string>;
|
|
33
|
+
} {
|
|
34
|
+
let projectDirectory: Promise<string> | undefined;
|
|
35
|
+
let checkoutDirectory: Promise<string | null> | undefined;
|
|
36
|
+
const project = (): Promise<string> =>
|
|
37
|
+
(projectDirectory ??= fs.realpath(root));
|
|
38
|
+
const checkout = (): Promise<string | null> =>
|
|
39
|
+
(checkoutDirectory ??= project().then(findCheckout));
|
|
40
|
+
const admits = async (directory: string, file: string): Promise<boolean> => {
|
|
41
|
+
if (contains(directory, file)) return true;
|
|
42
|
+
const worktree: string | null = await checkout();
|
|
43
|
+
return worktree !== null && contains(worktree, file);
|
|
44
|
+
};
|
|
45
|
+
const resolve = async (
|
|
46
|
+
name: string,
|
|
47
|
+
): Promise<readonly [relative: string, actual: string]> => {
|
|
48
|
+
if (path.isAbsolute(name) || path.win32.parse(name).root !== "")
|
|
49
|
+
throw new Error(`Verification input must be project-relative: ${name}.`);
|
|
50
|
+
const directory: string = await project();
|
|
51
|
+
const file: string = path.resolve(directory, name);
|
|
52
|
+
if (!(await admits(directory, file)))
|
|
53
|
+
throw new Error(
|
|
54
|
+
`Verification input is outside the project and its Git checkout: ${name}.`,
|
|
55
|
+
);
|
|
56
|
+
const actual: string = await fs.realpath(file);
|
|
57
|
+
if (!(await admits(directory, actual)))
|
|
58
|
+
throw new Error(
|
|
59
|
+
`Verification input resolves outside the project and its Git checkout: ${name}.`,
|
|
60
|
+
);
|
|
61
|
+
return [path.relative(directory, file), actual];
|
|
62
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
project,
|
|
65
|
+
checkout,
|
|
66
|
+
verifySources: async (
|
|
67
|
+
sources: ReadonlyMap<string, string>,
|
|
68
|
+
): Promise<void> => {
|
|
69
|
+
for (const [name, loaded] of sources) {
|
|
70
|
+
const [relative, actual] = await resolve(name);
|
|
71
|
+
const current: string = await hashAutoMovieFile(actual);
|
|
72
|
+
if (current !== loaded) throw changedSource(relative);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
/**
|
|
76
|
+
* Hash a check definition and the exact named inputs without walking the
|
|
77
|
+
* project.
|
|
78
|
+
*/
|
|
79
|
+
identify: async (check, sources): Promise<string> => {
|
|
80
|
+
const names: readonly string[] = check.inputs ?? [];
|
|
81
|
+
const source: string | undefined =
|
|
82
|
+
check.kind === "measure" ? check.source : undefined;
|
|
83
|
+
const graph: ReadonlyMap<string, string> | undefined =
|
|
84
|
+
check.kind === "measure" && sources !== undefined
|
|
85
|
+
? sources(
|
|
86
|
+
source === undefined ? undefined : (await resolve(source))[1],
|
|
87
|
+
)
|
|
88
|
+
: undefined;
|
|
89
|
+
if (
|
|
90
|
+
!Array.isArray(names) ||
|
|
91
|
+
(names.length === 0 && source === undefined && graph === undefined)
|
|
92
|
+
)
|
|
93
|
+
throw new Error(
|
|
94
|
+
"Declare the scoped input files to establish result currentness.",
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const inputs: [string, string][] = [];
|
|
98
|
+
for (const name of new Set([
|
|
99
|
+
...names,
|
|
100
|
+
...(graph?.keys() ?? (source === undefined ? [] : [source])),
|
|
101
|
+
])) {
|
|
102
|
+
const [relative, actual] = await resolve(name);
|
|
103
|
+
const hash: string = await hashAutoMovieFile(actual);
|
|
104
|
+
const loaded: string | undefined = graph?.get(relative);
|
|
105
|
+
if (loaded !== undefined && hash !== loaded)
|
|
106
|
+
throw changedSource(relative);
|
|
107
|
+
inputs.push([relative, hash]);
|
|
108
|
+
}
|
|
109
|
+
return createHash("sha256")
|
|
110
|
+
.update(
|
|
111
|
+
JSON.stringify([
|
|
112
|
+
{ ...check, enabled: undefined },
|
|
113
|
+
check.kind === "measure" ? String(check.measure) : null,
|
|
114
|
+
inputs,
|
|
115
|
+
]),
|
|
116
|
+
)
|
|
117
|
+
.digest("hex");
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function changedSource(relative: string): Error {
|
|
123
|
+
return new Error(
|
|
124
|
+
`Verification source changed after it loaded: ${relative}. Run verify again.`,
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Locate the owning Git worktree without scanning its working files. */
|
|
129
|
+
async function findCheckout(project: string): Promise<string | null> {
|
|
130
|
+
try {
|
|
131
|
+
const top: string = execFileSync(
|
|
132
|
+
"git",
|
|
133
|
+
["-C", project, "rev-parse", "--show-toplevel"],
|
|
134
|
+
{
|
|
135
|
+
encoding: "utf8",
|
|
136
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
137
|
+
windowsHide: true,
|
|
138
|
+
},
|
|
139
|
+
).replace(/\r?\n$/u, "");
|
|
140
|
+
if (!path.isAbsolute(top)) return null;
|
|
141
|
+
const directory: string = await fs.realpath(top);
|
|
142
|
+
return contains(directory, project) ? directory : null;
|
|
143
|
+
} catch {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Resolve native case, separator and drive semantics through relative paths. */
|
|
149
|
+
function contains(directory: string, candidate: string): boolean {
|
|
150
|
+
const relative: string = path.relative(directory, candidate);
|
|
151
|
+
return (
|
|
152
|
+
!path.isAbsolute(relative) &&
|
|
153
|
+
relative !== ".." &&
|
|
154
|
+
!relative.startsWith(`..${path.sep}`)
|
|
155
|
+
);
|
|
156
|
+
}
|