@remotion/renderer 3.0.23 → 3.0.26
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/dist/abort.d.ts +7 -0
- package/dist/abort.js +20 -0
- package/dist/assets/download-and-map-assets-to-file.d.ts +21 -8
- package/dist/assets/download-and-map-assets-to-file.js +68 -42
- package/dist/assets/download-file.d.ts +10 -5
- package/dist/assets/download-file.js +18 -5
- package/dist/assets/ffmpeg-volume-expression.d.ts +1 -2
- package/dist/assets/ffmpeg-volume-expression.js +2 -3
- package/dist/browser/Browser.d.ts +10 -159
- package/dist/browser/Browser.js +7 -191
- package/dist/browser/BrowserConnector.d.ts +1 -8
- package/dist/browser/BrowserConnector.js +0 -32
- package/dist/browser/BrowserFetcher.d.ts +1 -1
- package/dist/browser/BrowserFetcher.js +8 -10
- package/dist/browser/BrowserRunner.d.ts +2 -2
- package/dist/browser/BrowserRunner.js +1 -1
- package/dist/browser/Connection.d.ts +4 -11
- package/dist/browser/Connection.js +5 -25
- package/dist/browser/ConsoleMessage.d.ts +4 -28
- package/dist/browser/ConsoleMessage.js +5 -32
- package/dist/browser/DOMWorld.d.ts +9 -7
- package/dist/browser/DOMWorld.js +12 -20
- package/dist/browser/EvalTypes.d.ts +1 -1
- package/dist/browser/EventEmitter.d.ts +1 -48
- package/dist/browser/EventEmitter.js +0 -49
- package/dist/browser/ExecutionContext.d.ts +7 -8
- package/dist/browser/ExecutionContext.js +0 -16
- package/dist/browser/FrameManager.d.ts +12 -15
- package/dist/browser/FrameManager.js +5 -21
- package/dist/browser/HTTPRequest.d.ts +4 -18
- package/dist/browser/HTTPRequest.js +3 -48
- package/dist/browser/HTTPResponse.d.ts +2 -81
- package/dist/browser/HTTPResponse.js +3 -173
- package/dist/browser/JSHandle.d.ts +4 -5
- package/dist/browser/JSHandle.js +0 -3
- package/dist/browser/LaunchOptions.d.ts +2 -81
- package/dist/browser/Launcher.d.ts +2 -2
- package/dist/browser/Launcher.js +21 -119
- package/dist/browser/LifecycleWatcher.d.ts +4 -4
- package/dist/browser/LifecycleWatcher.js +4 -17
- package/dist/browser/NetworkEventManager.d.ts +2 -4
- package/dist/browser/NetworkEventManager.js +0 -47
- package/dist/browser/NetworkManager.d.ts +1 -3
- package/dist/browser/NetworkManager.js +6 -42
- package/dist/browser/NodeWebSocketTransport.d.ts +8 -2
- package/dist/browser/NodeWebSocketTransport.js +1 -1
- package/dist/browser/{page.d.ts → Page.d.ts} +12 -16
- package/dist/browser/{page.js → Page.js} +20 -14
- package/dist/browser/PuppeteerNode.d.ts +7 -59
- package/dist/browser/PuppeteerNode.js +4 -66
- package/dist/browser/Target.d.ts +4 -4
- package/dist/browser/Target.js +1 -1
- package/dist/browser/assert.d.ts +0 -20
- package/dist/browser/assert.js +0 -20
- package/dist/browser/create-browser-fetcher.d.ts +1 -1
- package/dist/browser/create-browser-fetcher.js +4 -25
- package/dist/browser/util.d.ts +5 -4
- package/dist/browser/util.js +11 -3
- package/dist/browser-log.d.ts +1 -1
- package/dist/calculate-sar-dar-pixels.d.ts +9 -0
- package/dist/calculate-sar-dar-pixels.js +19 -0
- package/dist/cancel.d.ts +7 -0
- package/dist/cancel.js +25 -0
- package/dist/ensure-faststart.d.ts +1 -0
- package/dist/ensure-faststart.js +14 -0
- package/dist/error-handling/handle-javascript-exception.d.ts +1 -1
- package/dist/error-handling/handle-javascript-exception.js +2 -2
- package/dist/extract-frame-from-video.d.ts +2 -2
- package/dist/extract-frame-from-video.js +26 -14
- package/dist/faststart/atom.d.ts +35 -0
- package/dist/faststart/atom.js +138 -0
- package/dist/faststart/index.d.ts +0 -0
- package/dist/faststart/index.js +1 -0
- package/dist/faststart/options.d.ts +6 -0
- package/dist/faststart/options.js +2 -0
- package/dist/faststart/qt-faststart.d.ts +18 -0
- package/dist/faststart/qt-faststart.js +66 -0
- package/dist/faststart/update-chunk-offsets.d.ts +10 -0
- package/dist/faststart/update-chunk-offsets.js +114 -0
- package/dist/faststart/util.d.ts +9 -0
- package/dist/faststart/util.js +34 -0
- package/dist/get-browser-instance.d.ts +2 -1
- package/dist/get-compositions.d.ts +1 -1
- package/dist/get-compositions.js +3 -3
- package/dist/get-local-browser-executable.js +7 -5
- package/dist/get-port.js +5 -14
- package/dist/get-video-info.d.ts +8 -0
- package/dist/get-video-info.js +50 -0
- package/dist/index.d.ts +14 -6
- package/dist/index.js +3 -0
- package/dist/last-frame-from-video-cache.d.ts +3 -1
- package/dist/offthread/index.d.ts +0 -0
- package/dist/offthread/index.js +1 -0
- package/dist/offthread-video-server.js +2 -6
- package/dist/open-browser.d.ts +4 -2
- package/dist/open-browser.js +8 -8
- package/dist/prepare-server.js +5 -2
- package/dist/provide-screenshot.d.ts +4 -3
- package/dist/provide-screenshot.js +0 -1
- package/dist/puppeteer-evaluate.d.ts +1 -1
- package/dist/puppeteer-evaluate.js +3 -3
- package/dist/puppeteer-screenshot.d.ts +4 -2
- package/dist/puppeteer-screenshot.js +2 -4
- package/dist/render-frames.d.ts +2 -2
- package/dist/render-frames.js +50 -47
- package/dist/render-gif.d.ts +2 -0
- package/dist/render-gif.js +242 -0
- package/dist/render-media.d.ts +4 -3
- package/dist/render-media.js +8 -3
- package/dist/render-still.d.ts +1 -1
- package/dist/screenshot-dom-element.d.ts +6 -6
- package/dist/screenshot-dom-element.js +3 -6
- package/dist/screenshot-task.d.ts +3 -1
- package/dist/screenshot-task.js +3 -5
- package/dist/seek-to-frame.d.ts +2 -2
- package/dist/seek-to-frame.js +2 -2
- package/dist/set-props-and-env.d.ts +1 -1
- package/dist/set-props-and-env.js +3 -0
- package/dist/should-use-vp9-decoder.d.ts +0 -0
- package/dist/should-use-vp9-decoder.js +1 -0
- package/dist/stitch-frames-to-gif.d.ts +8 -0
- package/dist/stitch-frames-to-gif.js +128 -0
- package/dist/stitch-frames-to-video.d.ts +4 -3
- package/dist/stitch-frames-to-video.js +31 -13
- package/dist/stringify-ffmpeg-filter.d.ts +1 -1
- package/dist/stringify-ffmpeg-filter.js +9 -7
- package/dist/validate-offthreadvideo-image-format.d.ts +1 -0
- package/dist/validate-offthreadvideo-image-format.js +15 -0
- package/dist/wait-for-symbolication-error-to-be-done.d.ts +3 -0
- package/dist/wait-for-symbolication-error-to-be-done.js +34 -0
- package/package.json +9 -5
- package/dist/assets/calculate-asset-positions.d.ts.map +0 -1
- package/dist/assets/calculate-asset-positions.js.map +0 -1
- package/dist/assets/calculate-atempo.d.ts.map +0 -1
- package/dist/assets/calculate-atempo.js.map +0 -1
- package/dist/assets/convert-assets-to-file-urls.d.ts.map +0 -1
- package/dist/assets/convert-assets-to-file-urls.js.map +0 -1
- package/dist/assets/download-and-map-assets-to-file.d.ts.map +0 -1
- package/dist/assets/download-and-map-assets-to-file.js.map +0 -1
- package/dist/assets/download-file.d.ts.map +0 -1
- package/dist/assets/download-file.js.map +0 -1
- package/dist/assets/ffmpeg-volume-expression.d.ts.map +0 -1
- package/dist/assets/ffmpeg-volume-expression.js.map +0 -1
- package/dist/assets/flatten-volume-array.d.ts.map +0 -1
- package/dist/assets/flatten-volume-array.js.map +0 -1
- package/dist/assets/get-audio-channels.d.ts.map +0 -1
- package/dist/assets/get-audio-channels.js.map +0 -1
- package/dist/assets/read-file.d.ts.map +0 -1
- package/dist/assets/read-file.js.map +0 -1
- package/dist/assets/round-volume-to-avoid-stack-overflow.d.ts.map +0 -1
- package/dist/assets/round-volume-to-avoid-stack-overflow.js.map +0 -1
- package/dist/assets/sanitize-filename.d.ts.map +0 -1
- package/dist/assets/sanitize-filename.js.map +0 -1
- package/dist/assets/sanitize-filepath.d.ts.map +0 -1
- package/dist/assets/sanitize-filepath.js.map +0 -1
- package/dist/assets/truncate-utf8-bytes.d.ts.map +0 -1
- package/dist/assets/truncate-utf8-bytes.js.map +0 -1
- package/dist/assets/types.d.ts.map +0 -1
- package/dist/assets/types.js.map +0 -1
- package/dist/browser/Accessibility.d.ts +0 -175
- package/dist/browser/Accessibility.js +0 -423
- package/dist/browser/AriaQueryHandler.d.ts +0 -20
- package/dist/browser/AriaQueryHandler.js +0 -108
- package/dist/browser/Coverage.d.ts +0 -180
- package/dist/browser/Coverage.js +0 -371
- package/dist/browser/Debug.d.ts +0 -19
- package/dist/browser/Debug.js +0 -42
- package/dist/browser/DeviceDescriptors.d.ts +0 -40
- package/dist/browser/DeviceDescriptors.js +0 -1407
- package/dist/browser/FileChooser.d.ts +0 -56
- package/dist/browser/FileChooser.js +0 -86
- package/dist/browser/Input.d.ts +0 -355
- package/dist/browser/Input.js +0 -592
- package/dist/browser/NetworkConditions.d.ts +0 -26
- package/dist/browser/NetworkConditions.js +0 -33
- package/dist/browser/PDFOptions.d.ts +0 -165
- package/dist/browser/PDFOptions.js +0 -34
- package/dist/browser/PipeTransport.d.ts +0 -10
- package/dist/browser/PipeTransport.js +0 -86
- package/dist/browser/Puppeteer.d.ts +0 -35
- package/dist/browser/Puppeteer.js +0 -17
- package/dist/browser/QueryHandler.d.ts +0 -64
- package/dist/browser/QueryHandler.js +0 -183
- package/dist/browser/SecurityDetails.d.ts +0 -55
- package/dist/browser/SecurityDetails.js +0 -95
- package/dist/browser/Tracing.d.ts +0 -45
- package/dist/browser/Tracing.js +0 -136
- package/dist/browser/USKeyboardLayout.d.ts +0 -39
- package/dist/browser/USKeyboardLayout.js +0 -406
- package/dist/browser/WebWorker.d.ts +0 -96
- package/dist/browser/WebWorker.js +0 -122
- package/dist/browser/dialog.d.ts +0 -70
- package/dist/browser/dialog.js +0 -114
- package/dist/browser/fetch.d.ts +0 -16
- package/dist/browser/fetch.js +0 -46
- package/dist/browser/find-up.d.ts +0 -4
- package/dist/browser/find-up.js +0 -85
- package/dist/browser/pkg-dir.d.ts +0 -3
- package/dist/browser/pkg-dir.js +0 -13
- package/dist/browser-log.d.ts.map +0 -1
- package/dist/browser-log.js.map +0 -1
- package/dist/calculate-ffmpeg-filters.d.ts.map +0 -1
- package/dist/calculate-ffmpeg-filters.js.map +0 -1
- package/dist/can-use-parallel-encoding.d.ts.map +0 -1
- package/dist/can-use-parallel-encoding.js.map +0 -1
- package/dist/chunk.d.ts.map +0 -1
- package/dist/chunk.js.map +0 -1
- package/dist/combine-videos.d.ts.map +0 -1
- package/dist/combine-videos.js.map +0 -1
- package/dist/convert-to-pcm.d.ts.map +0 -1
- package/dist/convert-to-pcm.js.map +0 -1
- package/dist/create-ffmpeg-complex-filter.d.ts.map +0 -1
- package/dist/create-ffmpeg-complex-filter.js.map +0 -1
- package/dist/create-ffmpeg-merge-filter.d.ts.map +0 -1
- package/dist/create-ffmpeg-merge-filter.js.map +0 -1
- package/dist/create-silent-audio.d.ts.map +0 -1
- package/dist/create-silent-audio.js.map +0 -1
- package/dist/cycle-browser-tabs.d.ts.map +0 -1
- package/dist/cycle-browser-tabs.js.map +0 -1
- package/dist/delay-render-embedded-stack.d.ts.map +0 -1
- package/dist/delay-render-embedded-stack.js.map +0 -1
- package/dist/delete-directory.d.ts.map +0 -1
- package/dist/delete-directory.js.map +0 -1
- package/dist/ensure-frames-in-order.d.ts.map +0 -1
- package/dist/ensure-frames-in-order.js.map +0 -1
- package/dist/ensure-output-directory.d.ts.map +0 -1
- package/dist/ensure-output-directory.js.map +0 -1
- package/dist/error-handling/handle-javascript-exception.d.ts.map +0 -1
- package/dist/error-handling/handle-javascript-exception.js.map +0 -1
- package/dist/error-handling/symbolicate-error.d.ts.map +0 -1
- package/dist/error-handling/symbolicate-error.js.map +0 -1
- package/dist/error-handling/symbolicateable-error.d.ts.map +0 -1
- package/dist/error-handling/symbolicateable-error.js.map +0 -1
- package/dist/ffmpeg-filter-file.d.ts.map +0 -1
- package/dist/ffmpeg-filter-file.js.map +0 -1
- package/dist/ffmpeg-flags.d.ts.map +0 -1
- package/dist/ffmpeg-flags.js.map +0 -1
- package/dist/get-audio-codec-name.d.ts.map +0 -1
- package/dist/get-audio-codec-name.js.map +0 -1
- package/dist/get-browser-instance.d.ts.map +0 -1
- package/dist/get-browser-instance.js.map +0 -1
- package/dist/get-codec-name.d.ts.map +0 -1
- package/dist/get-codec-name.js.map +0 -1
- package/dist/get-compositions.d.ts.map +0 -1
- package/dist/get-compositions.js.map +0 -1
- package/dist/get-concurrency.d.ts.map +0 -1
- package/dist/get-concurrency.js.map +0 -1
- package/dist/get-duration-from-frame-range.d.ts.map +0 -1
- package/dist/get-duration-from-frame-range.js.map +0 -1
- package/dist/get-extension-from-codec.d.ts.map +0 -1
- package/dist/get-extension-from-codec.js.map +0 -1
- package/dist/get-frame-to-render.d.ts.map +0 -1
- package/dist/get-frame-to-render.js.map +0 -1
- package/dist/get-local-browser-executable.d.ts.map +0 -1
- package/dist/get-local-browser-executable.js.map +0 -1
- package/dist/get-port.d.ts.map +0 -1
- package/dist/get-port.js.map +0 -1
- package/dist/get-prores-profile-name.d.ts.map +0 -1
- package/dist/get-prores-profile-name.js.map +0 -1
- package/dist/image-format.d.ts.map +0 -1
- package/dist/image-format.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/is-serve-url.d.ts.map +0 -1
- package/dist/is-serve-url.js.map +0 -1
- package/dist/legacy-webpack-config.d.ts.map +0 -1
- package/dist/legacy-webpack-config.js.map +0 -1
- package/dist/make-assets-download-dir.d.ts.map +0 -1
- package/dist/make-assets-download-dir.js.map +0 -1
- package/dist/merge-audio-track.d.ts.map +0 -1
- package/dist/merge-audio-track.js.map +0 -1
- package/dist/normalize-serve-url.d.ts.map +0 -1
- package/dist/normalize-serve-url.js.map +0 -1
- package/dist/open-browser.d.ts.map +0 -1
- package/dist/open-browser.js.map +0 -1
- package/dist/p-limit.d.ts.map +0 -1
- package/dist/p-limit.js.map +0 -1
- package/dist/parse-browser-error-stack.d.ts.map +0 -1
- package/dist/parse-browser-error-stack.js.map +0 -1
- package/dist/parse-ffmpeg-progress.d.ts.map +0 -1
- package/dist/parse-ffmpeg-progress.js.map +0 -1
- package/dist/pool.d.ts.map +0 -1
- package/dist/pool.js.map +0 -1
- package/dist/prepare-server.d.ts.map +0 -1
- package/dist/prepare-server.js.map +0 -1
- package/dist/preprocess-audio-track.d.ts.map +0 -1
- package/dist/preprocess-audio-track.js.map +0 -1
- package/dist/prespawn-ffmpeg.d.ts.map +0 -1
- package/dist/prespawn-ffmpeg.js.map +0 -1
- package/dist/provide-screenshot.d.ts.map +0 -1
- package/dist/provide-screenshot.js.map +0 -1
- package/dist/puppeteer-evaluate.d.ts.map +0 -1
- package/dist/puppeteer-evaluate.js.map +0 -1
- package/dist/puppeteer-screenshot.d.ts.map +0 -1
- package/dist/puppeteer-screenshot.js.map +0 -1
- package/dist/render-frames.d.ts.map +0 -1
- package/dist/render-frames.js.map +0 -1
- package/dist/render-media.d.ts.map +0 -1
- package/dist/render-media.js.map +0 -1
- package/dist/render-still.d.ts.map +0 -1
- package/dist/render-still.js.map +0 -1
- package/dist/resolve-asset-src.d.ts.map +0 -1
- package/dist/resolve-asset-src.js.map +0 -1
- package/dist/sample-rate.d.ts.map +0 -1
- package/dist/sample-rate.js.map +0 -1
- package/dist/screenshot-dom-element.d.ts.map +0 -1
- package/dist/screenshot-dom-element.js.map +0 -1
- package/dist/screenshot-task.d.ts.map +0 -1
- package/dist/screenshot-task.js.map +0 -1
- package/dist/seek-to-frame.d.ts.map +0 -1
- package/dist/seek-to-frame.js.map +0 -1
- package/dist/serve-static.d.ts.map +0 -1
- package/dist/serve-static.js.map +0 -1
- package/dist/set-props-and-env.d.ts.map +0 -1
- package/dist/set-props-and-env.js.map +0 -1
- package/dist/stitch-frames-to-video.d.ts.map +0 -1
- package/dist/stitch-frames-to-video.js.map +0 -1
- package/dist/stringify-ffmpeg-filter.d.ts.map +0 -1
- package/dist/stringify-ffmpeg-filter.js.map +0 -1
- package/dist/symbolicate-stacktrace.d.ts.map +0 -1
- package/dist/symbolicate-stacktrace.js.map +0 -1
- package/dist/tmp-dir.d.ts.map +0 -1
- package/dist/tmp-dir.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/validate-even-dimensions-with-codec.d.ts.map +0 -1
- package/dist/validate-even-dimensions-with-codec.js.map +0 -1
- package/dist/validate-ffmpeg.d.ts.map +0 -1
- package/dist/validate-ffmpeg.js.map +0 -1
- package/dist/validate-puppeteer-timeout.d.ts.map +0 -1
- package/dist/validate-puppeteer-timeout.js.map +0 -1
- package/dist/validate-scale.d.ts.map +0 -1
- package/dist/validate-scale.js.map +0 -1
package/dist/browser/Target.d.ts
CHANGED
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Protocol } from 'devtools-protocol';
|
|
17
|
-
import { Browser, BrowserContext } from './Browser';
|
|
18
|
-
import { CDPSession } from './Connection';
|
|
16
|
+
import type { Protocol } from 'devtools-protocol';
|
|
17
|
+
import type { Browser, BrowserContext } from './Browser';
|
|
18
|
+
import type { CDPSession } from './Connection';
|
|
19
19
|
import { Page } from './Page';
|
|
20
|
-
import { Viewport } from './PuppeteerViewport';
|
|
20
|
+
import type { Viewport } from './PuppeteerViewport';
|
|
21
21
|
export declare class Target {
|
|
22
22
|
#private;
|
|
23
23
|
_initializedPromise: Promise<boolean>;
|
package/dist/browser/Target.js
CHANGED
|
@@ -84,7 +84,7 @@ class Target {
|
|
|
84
84
|
if (isPagetTarget(__classPrivateFieldGet(this, _Target_targetInfo, "f")) && !__classPrivateFieldGet(this, _Target_pagePromise, "f")) {
|
|
85
85
|
__classPrivateFieldSet(this, _Target_pagePromise, __classPrivateFieldGet(this, _Target_sessionFactory, "f").call(this).then((client) => {
|
|
86
86
|
var _a;
|
|
87
|
-
return Page_1.Page._create(client, this, (_a = __classPrivateFieldGet(this, _Target_defaultViewport, "f")) !== null && _a !== void 0 ? _a : null);
|
|
87
|
+
return Page_1.Page._create(client, this, (_a = __classPrivateFieldGet(this, _Target_defaultViewport, "f")) !== null && _a !== void 0 ? _a : null, this.browser());
|
|
88
88
|
}), "f");
|
|
89
89
|
}
|
|
90
90
|
return (_a = (await __classPrivateFieldGet(this, _Target_pagePromise, "f"))) !== null && _a !== void 0 ? _a : null;
|
package/dist/browser/assert.d.ts
CHANGED
|
@@ -1,21 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2020 Google Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Asserts that the given value is truthy.
|
|
18
|
-
* @param value - some conditional statement
|
|
19
|
-
* @param message - the error message to throw if the value is not truthy.
|
|
20
|
-
*/
|
|
21
1
|
export declare const assert: (value: unknown, message?: string) => asserts value;
|
package/dist/browser/assert.js
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2020 Google Inc. All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.assert = void 0;
|
|
19
|
-
/**
|
|
20
|
-
* Asserts that the given value is truthy.
|
|
21
|
-
* @param value - some conditional statement
|
|
22
|
-
* @param message - the error message to throw if the value is not truthy.
|
|
23
|
-
*/
|
|
24
4
|
const assert = (value, message) => {
|
|
25
5
|
if (!value) {
|
|
26
6
|
throw new Error(message);
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { Product } from './Product';
|
|
16
|
+
import type { Product } from './Product';
|
|
17
17
|
export declare function downloadBrowser(product: Product): Promise<void>;
|
|
@@ -20,7 +20,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.downloadBrowser = void 0;
|
|
22
22
|
const https_1 = __importDefault(require("https"));
|
|
23
|
-
const progress_1 = __importDefault(require("progress"));
|
|
24
23
|
const node_1 = require("./node");
|
|
25
24
|
const revisions_1 = require("./revisions");
|
|
26
25
|
const supportedProducts = {
|
|
@@ -55,11 +54,11 @@ async function downloadBrowser(product) {
|
|
|
55
54
|
const revisionInfo = browserFetcher.revisionInfo(_revision);
|
|
56
55
|
// Do nothing if the revision is already downloaded.
|
|
57
56
|
if (revisionInfo.local) {
|
|
58
|
-
|
|
57
|
+
console.log(`${supportedProducts[product]} is already in ${revisionInfo.folderPath}; skipping download.`);
|
|
59
58
|
return;
|
|
60
59
|
}
|
|
61
60
|
function onSuccess(localRevisions) {
|
|
62
|
-
|
|
61
|
+
console.log(`${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}`);
|
|
63
62
|
localRevisions = localRevisions.filter((__revision) => {
|
|
64
63
|
return __revision !== revisionInfo.revision;
|
|
65
64
|
});
|
|
@@ -73,20 +72,8 @@ async function downloadBrowser(product) {
|
|
|
73
72
|
console.error(error);
|
|
74
73
|
process.exit(1);
|
|
75
74
|
}
|
|
76
|
-
let progressBar = null;
|
|
77
|
-
let lastDownloadedBytes = 0;
|
|
78
75
|
function onProgress(downloadedBytes, totalBytes) {
|
|
79
|
-
|
|
80
|
-
progressBar = new progress_1.default(`Downloading ${supportedProducts[product]} r${_revision} - ${toMegabytes(totalBytes)} [:bar] :percent :etas `, {
|
|
81
|
-
complete: '=',
|
|
82
|
-
incomplete: ' ',
|
|
83
|
-
width: 20,
|
|
84
|
-
total: totalBytes,
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
const delta = downloadedBytes - lastDownloadedBytes;
|
|
88
|
-
lastDownloadedBytes = downloadedBytes;
|
|
89
|
-
progressBar.tick(delta);
|
|
76
|
+
console.log('Downloading', supportedProducts[product], toMegabytes(downloadedBytes) + '/' + toMegabytes(totalBytes));
|
|
90
77
|
}
|
|
91
78
|
return browserFetcher
|
|
92
79
|
.download(revisionInfo.revision, onProgress)
|
|
@@ -105,7 +92,7 @@ async function downloadBrowser(product) {
|
|
|
105
92
|
const requestOptions = {};
|
|
106
93
|
const promise = new Promise((resolve, reject) => {
|
|
107
94
|
let data = '';
|
|
108
|
-
|
|
95
|
+
console.log(`Requesting latest Firefox Nightly version from ${firefoxVersionsUrl}`);
|
|
109
96
|
https_1.default
|
|
110
97
|
.get(firefoxVersionsUrl, requestOptions, (r) => {
|
|
111
98
|
if (r.statusCode && r.statusCode >= 400) {
|
|
@@ -130,11 +117,3 @@ async function downloadBrowser(product) {
|
|
|
130
117
|
}
|
|
131
118
|
}
|
|
132
119
|
exports.downloadBrowser = downloadBrowser;
|
|
133
|
-
function logPolitely(toBeLogged) {
|
|
134
|
-
const logLevel = process.env.npm_config_loglevel || '';
|
|
135
|
-
const logLevelDisplay = ['silent', 'error', 'warn'].indexOf(logLevel) > -1;
|
|
136
|
-
// eslint-disable-next-line no-console
|
|
137
|
-
if (!logLevelDisplay) {
|
|
138
|
-
console.log(toBeLogged);
|
|
139
|
-
}
|
|
140
|
-
}
|
package/dist/browser/util.d.ts
CHANGED
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
/// <reference types="node" />
|
|
17
|
-
import { Protocol } from 'devtools-protocol';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
17
|
+
import type { Protocol } from 'devtools-protocol';
|
|
18
|
+
import type { Browser } from './Browser';
|
|
19
|
+
import type { CDPSession } from './Connection';
|
|
20
|
+
import type { CommonEventEmitter } from './EventEmitter';
|
|
20
21
|
export declare function getExceptionMessage(exceptionDetails: Protocol.Runtime.ExceptionDetails): string;
|
|
21
22
|
export declare function valueFromRemoteObject(remoteObject: Protocol.Runtime.RemoteObject): any;
|
|
22
23
|
export declare function releaseObject(client: CDPSession, remoteObject: Protocol.Runtime.RemoteObject): Promise<void>;
|
|
@@ -36,7 +37,7 @@ export declare function evaluationString(fun: Function | string, ...args: unknow
|
|
|
36
37
|
export declare function pageBindingDeliverResultString(name: string, seq: number, result: unknown): string;
|
|
37
38
|
export declare function pageBindingDeliverErrorString(name: string, seq: number, message: string, stack?: string): string;
|
|
38
39
|
export declare function pageBindingDeliverErrorValueString(name: string, seq: number, value: unknown): string;
|
|
39
|
-
export declare function waitWithTimeout<T>(promise: Promise<T>, taskName: string, timeout: number): Promise<T>;
|
|
40
|
+
export declare function waitWithTimeout<T>(promise: Promise<T>, taskName: string, timeout: number, browser: Browser): Promise<T>;
|
|
40
41
|
interface ErrorLike extends Error {
|
|
41
42
|
name: string;
|
|
42
43
|
message: string;
|
package/dist/browser/util.js
CHANGED
|
@@ -79,7 +79,7 @@ function addEventListener(emitter, eventName, handler) {
|
|
|
79
79
|
exports.addEventListener = addEventListener;
|
|
80
80
|
function removeEventListeners(listeners) {
|
|
81
81
|
for (const listener of listeners) {
|
|
82
|
-
listener.emitter.
|
|
82
|
+
listener.emitter.off(listener.eventName, listener.handler);
|
|
83
83
|
}
|
|
84
84
|
listeners.length = 0;
|
|
85
85
|
}
|
|
@@ -128,7 +128,7 @@ function pageBindingDeliverErrorValueString(name, seq, value) {
|
|
|
128
128
|
return evaluationString(deliverErrorValue, name, seq, value);
|
|
129
129
|
}
|
|
130
130
|
exports.pageBindingDeliverErrorValueString = pageBindingDeliverErrorValueString;
|
|
131
|
-
async function waitWithTimeout(promise, taskName, timeout) {
|
|
131
|
+
async function waitWithTimeout(promise, taskName, timeout, browser) {
|
|
132
132
|
let reject;
|
|
133
133
|
const timeoutError = new Errors_1.TimeoutError(`waiting for ${taskName} failed: timeout ${timeout}ms exceeded`);
|
|
134
134
|
const timeoutPromise = new Promise((_res, rej) => {
|
|
@@ -141,7 +141,15 @@ async function waitWithTimeout(promise, taskName, timeout) {
|
|
|
141
141
|
}, timeout);
|
|
142
142
|
}
|
|
143
143
|
try {
|
|
144
|
-
return await Promise.race([
|
|
144
|
+
return await Promise.race([
|
|
145
|
+
new Promise((_, rej) => {
|
|
146
|
+
browser.once("closed" /* BrowserEmittedEvents.Closed */, () => {
|
|
147
|
+
return rej();
|
|
148
|
+
});
|
|
149
|
+
}),
|
|
150
|
+
promise,
|
|
151
|
+
timeoutPromise,
|
|
152
|
+
]);
|
|
145
153
|
}
|
|
146
154
|
finally {
|
|
147
155
|
if (timeoutTimer) {
|
package/dist/browser-log.d.ts
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// https://superuser.com/questions/907933/correct-aspect-ratio-without-re-encoding-video-file
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.calculateDisplayVideoSize = void 0;
|
|
5
|
+
const calculateDisplayVideoSize = ({ darX, darY, x, y, }) => {
|
|
6
|
+
// We know two equations:
|
|
7
|
+
// newWidth / newHeight = darX / darY
|
|
8
|
+
// and:
|
|
9
|
+
// x * y = (newWidth * newHeight)
|
|
10
|
+
// I solved it then on pen and paper and simplified the formula:
|
|
11
|
+
const dimensions = x * y;
|
|
12
|
+
const newWidth = Math.sqrt(dimensions * (darX / darY));
|
|
13
|
+
const newHeight = dimensions / newWidth;
|
|
14
|
+
return {
|
|
15
|
+
height: Math.round(newHeight),
|
|
16
|
+
width: Math.round(newWidth),
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
exports.calculateDisplayVideoSize = calculateDisplayVideoSize;
|
package/dist/cancel.d.ts
ADDED
package/dist/cancel.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeCancelSignal = void 0;
|
|
4
|
+
const makeCancelSignal = () => {
|
|
5
|
+
const callbacks = [];
|
|
6
|
+
let cancelled = false;
|
|
7
|
+
return {
|
|
8
|
+
cancelSignal: (callback) => {
|
|
9
|
+
callbacks.push(callback);
|
|
10
|
+
if (cancelled) {
|
|
11
|
+
callback();
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
cancel: () => {
|
|
15
|
+
if (cancelled) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
callbacks.forEach((cb) => {
|
|
19
|
+
cb();
|
|
20
|
+
});
|
|
21
|
+
cancelled = true;
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.makeCancelSignal = makeCancelSignal;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ensureFastStart: () => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ensureFastStart = void 0;
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const qt_faststart_1 = __importDefault(require("./faststart/qt-faststart"));
|
|
9
|
+
const ensureFastStart = () => {
|
|
10
|
+
const buffer = (0, fs_1.readFileSync)('/Users/jonathanburger/remotion/packages/example/public/offthread2.mp4');
|
|
11
|
+
const newBuffer = (0, qt_faststart_1.default)(buffer);
|
|
12
|
+
(0, fs_1.writeFileSync)('/Users/jonathanburger/remotion/packages/example/public/offthread-faststart.mp4', newBuffer);
|
|
13
|
+
};
|
|
14
|
+
exports.ensureFastStart = ensureFastStart;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Page } from '
|
|
1
|
+
import type { Page } from '../browser/Page';
|
|
2
2
|
import type { SymbolicatedStackFrame } from '../symbolicate-stacktrace';
|
|
3
3
|
export declare class ErrorWithStackFrame extends Error {
|
|
4
4
|
symbolicatedStackFrames: SymbolicatedStackFrame[] | null;
|
|
@@ -41,8 +41,8 @@ const callFrameToStackFrame = (callFrame) => {
|
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
43
|
const handleJavascriptException = ({ page, onError, frame, }) => {
|
|
44
|
-
const client = page._client;
|
|
45
|
-
const handler =
|
|
44
|
+
const client = page._client();
|
|
45
|
+
const handler = (exception) => {
|
|
46
46
|
var _a, _b, _c;
|
|
47
47
|
const rawErrorMessage = (_a = exception.exceptionDetails.exception) === null || _a === void 0 ? void 0 : _a.description;
|
|
48
48
|
const cleanErrorMessage = cleanUpErrorMessage(exception);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import type { FfmpegExecutable, OffthreadVideoImageFormat } from 'remotion';
|
|
2
|
-
import type { SpecialVCodecForTransparency } from './is-vp9-video';
|
|
3
3
|
import type { LastFrameOptions } from './last-frame-from-video-cache';
|
|
4
|
-
export declare const
|
|
4
|
+
export declare const determineResizeParams: (needsResize: [number, number] | null) => string[];
|
|
5
5
|
export declare const getLastFrameOfVideo: (options: LastFrameOptions) => Promise<Buffer>;
|
|
6
6
|
declare type Options = {
|
|
7
7
|
time: number;
|
|
@@ -3,14 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.extractFrameFromVideo = exports.getLastFrameOfVideo = exports.
|
|
6
|
+
exports.extractFrameFromVideo = exports.getLastFrameOfVideo = exports.determineResizeParams = void 0;
|
|
7
7
|
const execa_1 = __importDefault(require("execa"));
|
|
8
8
|
const remotion_1 = require("remotion");
|
|
9
9
|
const get_audio_channels_1 = require("./assets/get-audio-channels");
|
|
10
10
|
const ensure_presentation_timestamp_1 = require("./ensure-presentation-timestamp");
|
|
11
11
|
const frame_to_ffmpeg_timestamp_1 = require("./frame-to-ffmpeg-timestamp");
|
|
12
|
+
const get_video_info_1 = require("./get-video-info");
|
|
12
13
|
const is_beyond_last_frame_1 = require("./is-beyond-last-frame");
|
|
13
|
-
const is_vp9_video_1 = require("./is-vp9-video");
|
|
14
14
|
const last_frame_from_video_cache_1 = require("./last-frame-from-video-cache");
|
|
15
15
|
const p_limit_1 = require("./p-limit");
|
|
16
16
|
const lastFrameLimit = (0, p_limit_1.pLimit)(1);
|
|
@@ -23,16 +23,22 @@ const determineVcodecFfmepgFlags = (vcodecFlag) => {
|
|
|
23
23
|
vcodecFlag === 'vp8' ? 'libvpx' : null,
|
|
24
24
|
].filter(remotion_1.Internals.truthy);
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
const determineResizeParams = (needsResize) => {
|
|
27
|
+
if (needsResize === null) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
return ['-s', `${needsResize[0]}x${needsResize[1]}`];
|
|
31
|
+
};
|
|
32
|
+
exports.determineResizeParams = determineResizeParams;
|
|
27
33
|
// Uses no seeking, therefore the whole video has to be decoded. This is a last resort and should only happen
|
|
28
34
|
// if the video is corrupted
|
|
29
|
-
const getFrameOfVideoSlow = async ({ src, timestamp, ffmpegExecutable, imageFormat, specialVCodecForTransparency, }) => {
|
|
35
|
+
const getFrameOfVideoSlow = async ({ src, timestamp, ffmpegExecutable, imageFormat, specialVCodecForTransparency, needsResize, }) => {
|
|
30
36
|
console.warn(`\nUsing a slow method to extract the frame at ${timestamp}ms of ${src}. See https://remotion.dev/docs/slow-method-to-extract-frame for advice`);
|
|
31
37
|
const actualOffset = `-${timestamp * 1000}ms`;
|
|
32
38
|
const command = [
|
|
33
39
|
'-itsoffset',
|
|
34
40
|
actualOffset,
|
|
35
|
-
...
|
|
41
|
+
...determineVcodecFfmepgFlags(specialVCodecForTransparency),
|
|
36
42
|
'-i',
|
|
37
43
|
src,
|
|
38
44
|
'-frames:v',
|
|
@@ -41,6 +47,7 @@ const getFrameOfVideoSlow = async ({ src, timestamp, ffmpegExecutable, imageForm
|
|
|
41
47
|
imageFormat === 'jpeg' ? 'mjpeg' : 'png',
|
|
42
48
|
'-f',
|
|
43
49
|
'image2pipe',
|
|
50
|
+
...(0, exports.determineResizeParams)(needsResize),
|
|
44
51
|
'-',
|
|
45
52
|
].filter(remotion_1.Internals.truthy);
|
|
46
53
|
const { stdout, stderr } = (0, execa_1.default)(ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : 'ffmpeg', command);
|
|
@@ -86,6 +93,7 @@ const getLastFrameOfVideoFastUnlimited = async (options) => {
|
|
|
86
93
|
src,
|
|
87
94
|
imageFormat: options.imageFormat,
|
|
88
95
|
specialVCodecForTransparency: options.specialVCodecForTransparency,
|
|
96
|
+
needsResize: options.needsResize,
|
|
89
97
|
});
|
|
90
98
|
return last;
|
|
91
99
|
}
|
|
@@ -93,7 +101,7 @@ const getLastFrameOfVideoFastUnlimited = async (options) => {
|
|
|
93
101
|
const { stdout, stderr } = (0, execa_1.default)(ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : 'ffmpeg', [
|
|
94
102
|
'-ss',
|
|
95
103
|
actualOffset,
|
|
96
|
-
...
|
|
104
|
+
...determineVcodecFfmepgFlags(options.specialVCodecForTransparency),
|
|
97
105
|
'-i',
|
|
98
106
|
src,
|
|
99
107
|
'-frames:v',
|
|
@@ -102,6 +110,7 @@ const getLastFrameOfVideoFastUnlimited = async (options) => {
|
|
|
102
110
|
options.imageFormat === 'jpeg' ? 'mjpeg' : 'png',
|
|
103
111
|
'-f',
|
|
104
112
|
'image2pipe',
|
|
113
|
+
...(0, exports.determineResizeParams)(options.needsResize),
|
|
105
114
|
'-',
|
|
106
115
|
].filter(remotion_1.Internals.truthy));
|
|
107
116
|
if (!stderr) {
|
|
@@ -138,6 +147,7 @@ const getLastFrameOfVideoFastUnlimited = async (options) => {
|
|
|
138
147
|
ffprobeExecutable,
|
|
139
148
|
imageFormat: options.imageFormat,
|
|
140
149
|
specialVCodecForTransparency: options.specialVCodecForTransparency,
|
|
150
|
+
needsResize: options.needsResize,
|
|
141
151
|
});
|
|
142
152
|
return unlimited;
|
|
143
153
|
}
|
|
@@ -151,16 +161,15 @@ const getLastFrameOfVideo = async (options) => {
|
|
|
151
161
|
exports.getLastFrameOfVideo = getLastFrameOfVideo;
|
|
152
162
|
const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, ffprobeExecutable, imageFormat, }) => {
|
|
153
163
|
await (0, ensure_presentation_timestamp_1.ensurePresentationTimestamps)(src);
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
: await (0, is_vp9_video_1.getSpecialVCodecForTransparency)(src, ffprobeExecutable);
|
|
157
|
-
if (specialVCodecForTransparency === 'vp8') {
|
|
164
|
+
const { specialVcodec, needsResize } = await (0, get_video_info_1.getVideoInfo)(src, ffprobeExecutable);
|
|
165
|
+
if (specialVcodec === 'vp8') {
|
|
158
166
|
return getFrameOfVideoSlow({
|
|
159
167
|
ffmpegExecutable,
|
|
160
168
|
imageFormat,
|
|
161
|
-
specialVCodecForTransparency,
|
|
169
|
+
specialVCodecForTransparency: specialVcodec,
|
|
162
170
|
src,
|
|
163
171
|
timestamp: time,
|
|
172
|
+
needsResize,
|
|
164
173
|
});
|
|
165
174
|
}
|
|
166
175
|
if ((0, is_beyond_last_frame_1.isBeyondLastFrame)(src, time)) {
|
|
@@ -170,7 +179,8 @@ const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, ffprobeExe
|
|
|
170
179
|
offset: 0,
|
|
171
180
|
src,
|
|
172
181
|
imageFormat,
|
|
173
|
-
specialVCodecForTransparency,
|
|
182
|
+
specialVCodecForTransparency: specialVcodec,
|
|
183
|
+
needsResize,
|
|
174
184
|
});
|
|
175
185
|
return lastFrame;
|
|
176
186
|
}
|
|
@@ -178,7 +188,7 @@ const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, ffprobeExe
|
|
|
178
188
|
const { stdout, stderr } = (0, execa_1.default)(ffmpegExecutable !== null && ffmpegExecutable !== void 0 ? ffmpegExecutable : 'ffmpeg', [
|
|
179
189
|
'-ss',
|
|
180
190
|
ffmpegTimestamp,
|
|
181
|
-
...
|
|
191
|
+
...determineVcodecFfmepgFlags(specialVcodec),
|
|
182
192
|
'-i',
|
|
183
193
|
src,
|
|
184
194
|
'-frames:v',
|
|
@@ -187,6 +197,7 @@ const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, ffprobeExe
|
|
|
187
197
|
'image2pipe',
|
|
188
198
|
'-vcodec',
|
|
189
199
|
imageFormat === 'jpeg' ? 'mjpeg' : 'png',
|
|
200
|
+
...(0, exports.determineResizeParams)(needsResize),
|
|
190
201
|
'-',
|
|
191
202
|
].filter(remotion_1.Internals.truthy), {
|
|
192
203
|
buffer: false,
|
|
@@ -221,7 +232,8 @@ const extractFrameFromVideoFn = async ({ time, src, ffmpegExecutable, ffprobeExe
|
|
|
221
232
|
offset: 0,
|
|
222
233
|
src,
|
|
223
234
|
imageFormat,
|
|
224
|
-
specialVCodecForTransparency,
|
|
235
|
+
specialVCodecForTransparency: specialVcodec,
|
|
236
|
+
needsResize,
|
|
225
237
|
});
|
|
226
238
|
return last;
|
|
227
239
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare const FREE_ATOM: number;
|
|
3
|
+
export declare const JUNK_ATOM: number;
|
|
4
|
+
export declare const MDAT_ATOM: number;
|
|
5
|
+
export declare const MOOV_ATOM: number;
|
|
6
|
+
export declare const PNOT_ATOM: number;
|
|
7
|
+
export declare const SKIP_ATOM: number;
|
|
8
|
+
export declare const WIDE_ATOM: number;
|
|
9
|
+
export declare const PICT_ATOM: number;
|
|
10
|
+
export declare const FTYP_ATOM: number;
|
|
11
|
+
export declare const UUID_ATOM: number;
|
|
12
|
+
export declare const CMOV_ATOM: number;
|
|
13
|
+
export declare const TRAK_ATOM: number;
|
|
14
|
+
export declare const MDIA_ATOM: number;
|
|
15
|
+
export declare const MINF_ATOM: number;
|
|
16
|
+
export declare const STBL_ATOM: number;
|
|
17
|
+
export declare const STCO_ATOM: number;
|
|
18
|
+
export declare const CO64_ATOM: number;
|
|
19
|
+
export declare const ATOM_PREAMBLE_SIZE: bigint;
|
|
20
|
+
export declare const MAX_FTYP_ATOM_SIZE: bigint;
|
|
21
|
+
export declare enum SizeKind {
|
|
22
|
+
U32 = 0,
|
|
23
|
+
U64 = 1
|
|
24
|
+
}
|
|
25
|
+
export interface QtAtom {
|
|
26
|
+
kind: string;
|
|
27
|
+
size: BigInt;
|
|
28
|
+
sizeKind: SizeKind;
|
|
29
|
+
data: QtAtom[] | Buffer;
|
|
30
|
+
}
|
|
31
|
+
export declare function parseAtoms(infile: Buffer, depth?: number, shallow?: boolean): QtAtom[];
|
|
32
|
+
export declare function recurseFlattenAtoms(atoms: QtAtom[], depth?: number): Buffer;
|
|
33
|
+
export declare function traverseAtoms(atoms: QtAtom[], callback: (atom: QtAtom) => void): void;
|
|
34
|
+
export declare function isQtAtom(atomType: number): boolean;
|
|
35
|
+
export declare function hasSubatoms(atomType: number): boolean;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasSubatoms = exports.isQtAtom = exports.traverseAtoms = exports.recurseFlattenAtoms = exports.parseAtoms = exports.SizeKind = exports.MAX_FTYP_ATOM_SIZE = exports.ATOM_PREAMBLE_SIZE = exports.CO64_ATOM = exports.STCO_ATOM = exports.STBL_ATOM = exports.MINF_ATOM = exports.MDIA_ATOM = exports.TRAK_ATOM = exports.CMOV_ATOM = exports.UUID_ATOM = exports.FTYP_ATOM = exports.PICT_ATOM = exports.WIDE_ATOM = exports.SKIP_ATOM = exports.PNOT_ATOM = exports.MOOV_ATOM = exports.MDAT_ATOM = exports.JUNK_ATOM = exports.FREE_ATOM = void 0;
|
|
4
|
+
/* eslint-disable no-bitwise */
|
|
5
|
+
const util_1 = require("./util");
|
|
6
|
+
exports.FREE_ATOM = (0, util_1.asciiToU32Be)('free');
|
|
7
|
+
exports.JUNK_ATOM = (0, util_1.asciiToU32Be)('junk');
|
|
8
|
+
exports.MDAT_ATOM = (0, util_1.asciiToU32Be)('mdat');
|
|
9
|
+
exports.MOOV_ATOM = (0, util_1.asciiToU32Be)('moov');
|
|
10
|
+
exports.PNOT_ATOM = (0, util_1.asciiToU32Be)('pnot');
|
|
11
|
+
exports.SKIP_ATOM = (0, util_1.asciiToU32Be)('skip');
|
|
12
|
+
exports.WIDE_ATOM = (0, util_1.asciiToU32Be)('wide');
|
|
13
|
+
exports.PICT_ATOM = (0, util_1.asciiToU32Be)('PICT');
|
|
14
|
+
exports.FTYP_ATOM = (0, util_1.asciiToU32Be)('ftyp');
|
|
15
|
+
exports.UUID_ATOM = (0, util_1.asciiToU32Be)('uuid');
|
|
16
|
+
exports.CMOV_ATOM = (0, util_1.asciiToU32Be)('cmov');
|
|
17
|
+
exports.TRAK_ATOM = (0, util_1.asciiToU32Be)('trak');
|
|
18
|
+
exports.MDIA_ATOM = (0, util_1.asciiToU32Be)('mdia');
|
|
19
|
+
exports.MINF_ATOM = (0, util_1.asciiToU32Be)('minf');
|
|
20
|
+
exports.STBL_ATOM = (0, util_1.asciiToU32Be)('stbl');
|
|
21
|
+
exports.STCO_ATOM = (0, util_1.asciiToU32Be)('stco');
|
|
22
|
+
exports.CO64_ATOM = (0, util_1.asciiToU32Be)('co64');
|
|
23
|
+
exports.ATOM_PREAMBLE_SIZE = BigInt(8);
|
|
24
|
+
exports.MAX_FTYP_ATOM_SIZE = BigInt(1048576);
|
|
25
|
+
var SizeKind;
|
|
26
|
+
(function (SizeKind) {
|
|
27
|
+
SizeKind[SizeKind["U32"] = 0] = "U32";
|
|
28
|
+
SizeKind[SizeKind["U64"] = 1] = "U64";
|
|
29
|
+
})(SizeKind = exports.SizeKind || (exports.SizeKind = {}));
|
|
30
|
+
function parseAtoms(infile, depth = 0, shallow = false) {
|
|
31
|
+
const atoms = [];
|
|
32
|
+
const cur = {
|
|
33
|
+
pos: BigInt(0),
|
|
34
|
+
};
|
|
35
|
+
const len = BigInt(infile.byteLength);
|
|
36
|
+
while (cur.pos < len) {
|
|
37
|
+
if (len - cur.pos < 8) {
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
let fwd; // forward-seek counter
|
|
41
|
+
let atomSize = BigInt((0, util_1.readU32)(cur, infile));
|
|
42
|
+
const atomType = (0, util_1.readU32)(cur, infile);
|
|
43
|
+
let sizeKind = SizeKind.U32;
|
|
44
|
+
if (atomSize === BigInt(1)) {
|
|
45
|
+
// 64-bit atom size
|
|
46
|
+
atomSize = (0, util_1.readU64)(cur, infile);
|
|
47
|
+
if (atomSize > BigInt(Number.MAX_SAFE_INTEGER)) {
|
|
48
|
+
throw new Error(`"${atomType}" atom size is larger than MAX_SAFE_INTEGER!`);
|
|
49
|
+
}
|
|
50
|
+
fwd = atomSize - exports.ATOM_PREAMBLE_SIZE * BigInt(2);
|
|
51
|
+
sizeKind = SizeKind.U64;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
fwd = atomSize - exports.ATOM_PREAMBLE_SIZE;
|
|
55
|
+
}
|
|
56
|
+
const endOfAtom = cur.pos + fwd;
|
|
57
|
+
const subatoms = Buffer.from(infile.slice(Number(cur.pos), Number(endOfAtom)));
|
|
58
|
+
const data = hasSubatoms(atomType) && depth < 10 && !shallow
|
|
59
|
+
? parseAtoms(subatoms, depth + 1)
|
|
60
|
+
: subatoms;
|
|
61
|
+
cur.pos = endOfAtom;
|
|
62
|
+
if (depth === 0 && !isQtAtom(atomType)) {
|
|
63
|
+
throw new Error(`Non-QT top-level atom found: ${(0, util_1.u32BeToAscii)(atomType)}`);
|
|
64
|
+
}
|
|
65
|
+
atoms.push({
|
|
66
|
+
kind: (0, util_1.u32BeToAscii)(atomType),
|
|
67
|
+
size: atomSize,
|
|
68
|
+
sizeKind,
|
|
69
|
+
data,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return atoms;
|
|
73
|
+
}
|
|
74
|
+
exports.parseAtoms = parseAtoms;
|
|
75
|
+
function recurseFlattenAtoms(atoms, depth = 0) {
|
|
76
|
+
const buffers = [];
|
|
77
|
+
for (const atom of atoms) {
|
|
78
|
+
if (!Buffer.isBuffer(atom.data)) {
|
|
79
|
+
atom.data = recurseFlattenAtoms(atom.data, depth + 1);
|
|
80
|
+
}
|
|
81
|
+
let header;
|
|
82
|
+
const u64Size = Number(exports.ATOM_PREAMBLE_SIZE) + atom.data.byteLength > 2 ** 32 - 1;
|
|
83
|
+
if (u64Size) {
|
|
84
|
+
const u64Preamble = Number(exports.ATOM_PREAMBLE_SIZE) * 2;
|
|
85
|
+
header = Buffer.alloc(u64Preamble);
|
|
86
|
+
header.writeUInt32BE(1, 0);
|
|
87
|
+
header.writeUInt32BE((0, util_1.asciiToU32Be)(atom.kind), 4);
|
|
88
|
+
const newSize = u64Preamble + atom.data.byteLength;
|
|
89
|
+
header.writeUInt32BE((newSize >> 32) & 0xffffffff, 8);
|
|
90
|
+
header.writeUInt32BE(newSize & 0xffffffff, 12);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
header = Buffer.alloc(Number(exports.ATOM_PREAMBLE_SIZE));
|
|
94
|
+
const newSize = Number(exports.ATOM_PREAMBLE_SIZE) + atom.data.byteLength;
|
|
95
|
+
header.writeUInt32BE(newSize, 0);
|
|
96
|
+
header.writeUInt32BE((0, util_1.asciiToU32Be)(atom.kind), 4);
|
|
97
|
+
}
|
|
98
|
+
const buf = Buffer.concat([header, atom.data]);
|
|
99
|
+
buffers.push(buf);
|
|
100
|
+
}
|
|
101
|
+
return Buffer.concat(buffers);
|
|
102
|
+
}
|
|
103
|
+
exports.recurseFlattenAtoms = recurseFlattenAtoms;
|
|
104
|
+
function traverseAtoms(atoms, callback) {
|
|
105
|
+
for (const atom of atoms) {
|
|
106
|
+
if (!Buffer.isBuffer(atom.data)) {
|
|
107
|
+
traverseAtoms(atom.data, callback);
|
|
108
|
+
}
|
|
109
|
+
callback(atom);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.traverseAtoms = traverseAtoms;
|
|
113
|
+
function isQtAtom(atomType) {
|
|
114
|
+
return [
|
|
115
|
+
exports.FREE_ATOM,
|
|
116
|
+
exports.JUNK_ATOM,
|
|
117
|
+
exports.MDAT_ATOM,
|
|
118
|
+
exports.MOOV_ATOM,
|
|
119
|
+
exports.PNOT_ATOM,
|
|
120
|
+
exports.SKIP_ATOM,
|
|
121
|
+
exports.WIDE_ATOM,
|
|
122
|
+
exports.PICT_ATOM,
|
|
123
|
+
exports.FTYP_ATOM,
|
|
124
|
+
exports.UUID_ATOM,
|
|
125
|
+
exports.CMOV_ATOM,
|
|
126
|
+
exports.TRAK_ATOM,
|
|
127
|
+
exports.MDIA_ATOM,
|
|
128
|
+
exports.MINF_ATOM,
|
|
129
|
+
exports.STBL_ATOM,
|
|
130
|
+
exports.STCO_ATOM,
|
|
131
|
+
exports.CO64_ATOM,
|
|
132
|
+
].includes(atomType);
|
|
133
|
+
}
|
|
134
|
+
exports.isQtAtom = isQtAtom;
|
|
135
|
+
function hasSubatoms(atomType) {
|
|
136
|
+
return [exports.MOOV_ATOM, exports.TRAK_ATOM, exports.MDIA_ATOM, exports.MINF_ATOM, exports.STBL_ATOM].includes(atomType);
|
|
137
|
+
}
|
|
138
|
+
exports.hasSubatoms = hasSubatoms;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|