@remotion/renderer 4.0.535 → 4.0.536

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.
@@ -3620,13 +3620,13 @@ class Page extends EventEmitter {
3620
3620
  mobile: false,
3621
3621
  width: viewport.width,
3622
3622
  height: viewport.height,
3623
- deviceScaleFactor: 1,
3623
+ deviceScaleFactor: viewport.deviceScaleFactor,
3624
3624
  screenHeight: viewport.height,
3625
3625
  screenWidth: viewport.width,
3626
- scale: viewport.deviceScaleFactor,
3626
+ scale: 1,
3627
3627
  viewport: {
3628
- height: viewport.height * viewport.deviceScaleFactor,
3629
- width: viewport.width * viewport.deviceScaleFactor,
3628
+ height: viewport.height,
3629
+ width: viewport.width,
3630
3630
  scale: 1,
3631
3631
  x: 0,
3632
3632
  y: 0
@@ -14762,6 +14762,11 @@ var mimeDb = {
14762
14762
  compressible: false,
14763
14763
  extensions: ["jpx", "jpf"]
14764
14764
  },
14765
+ "image/jxl": {
14766
+ source: "iana",
14767
+ compressible: false,
14768
+ extensions: ["jxl"]
14769
+ },
14765
14770
  "image/jxr": {
14766
14771
  source: "iana",
14767
14772
  extensions: ["jxr"]
@@ -24204,10 +24209,12 @@ var stringifyFfmpegFilter = ({
24204
24209
  }
24205
24210
  const { toneFrequency, startInVideo } = asset;
24206
24211
  const startInVideoSeconds = startInVideo / fps;
24212
+ const assetTrimLeftOffset = startInVideo === 0 ? trimLeftOffset : 0;
24213
+ const startInChunkSeconds = startInVideo === 0 ? 0 : startInVideoSeconds - trimLeftOffset;
24207
24214
  const { trimLeft, maxTrim } = getActualTrimLeft({
24208
24215
  trimLeft: asset.trimLeft,
24209
24216
  fps,
24210
- trimLeftOffset,
24217
+ trimLeftOffset: assetTrimLeftOffset,
24211
24218
  seamless: forSeamlessAacConcatenation,
24212
24219
  assetDuration,
24213
24220
  audioStartFrame: asset.audioStartFrame,
@@ -24225,7 +24232,7 @@ var stringifyFfmpegFilter = ({
24225
24232
  filter: trimAndTempoFilter
24226
24233
  } = trimAndSetTempo({
24227
24234
  assetDuration,
24228
- trimLeftOffset,
24235
+ trimLeftOffset: assetTrimLeftOffset,
24229
24236
  trimRightOffset,
24230
24237
  asset,
24231
24238
  fps,
@@ -24237,8 +24244,8 @@ var stringifyFfmpegFilter = ({
24237
24244
  fps,
24238
24245
  trimLeft: actualTrimLeft
24239
24246
  });
24240
- const padAtEnd = chunkLengthInSeconds - audibleDuration - startInVideoSeconds;
24241
- const padStart = startInVideoSeconds + (asset.trimLeft === 0 ? presentationTimeOffsetInSeconds : 0);
24247
+ const padAtEnd = chunkLengthInSeconds - audibleDuration - startInChunkSeconds;
24248
+ const padStart = startInChunkSeconds + (asset.trimLeft === 0 ? presentationTimeOffsetInSeconds : 0);
24242
24249
  return {
24243
24250
  filter: "[0:a]" + [
24244
24251
  `aformat=sample_fmts=s16:sample_rates=${sampleRate}`,
package/dist/mime-db.js CHANGED
@@ -7222,6 +7222,11 @@ exports.mimeDb = {
7222
7222
  compressible: false,
7223
7223
  extensions: ['jpx', 'jpf'],
7224
7224
  },
7225
+ 'image/jxl': {
7226
+ source: 'iana',
7227
+ compressible: false,
7228
+ extensions: ['jxl'],
7229
+ },
7225
7230
  'image/jxr': {
7226
7231
  source: 'iana',
7227
7232
  extensions: ['jxr'],
@@ -1,5 +1,24 @@
1
1
  import type { AnyRemotionOption } from './option';
2
2
  export declare const allOptions: {
3
+ showLayerFrameNumbersOption: {
4
+ name: string;
5
+ addedIn: string;
6
+ cliFlag: "show-layer-frame-numbers";
7
+ id: "show-layer-frame-numbers";
8
+ description: () => import("react/jsx-runtime").JSX.Element;
9
+ ssrName: null;
10
+ docLink: string;
11
+ type: boolean;
12
+ getValue: ({ commandLine }: {
13
+ commandLine: Record<string, unknown>;
14
+ }) => {
15
+ value: boolean;
16
+ source: string;
17
+ };
18
+ setConfig(value: boolean): void;
19
+ getConfigValue: () => boolean | null;
20
+ reset: () => void;
21
+ };
3
22
  showPremountingOption: {
4
23
  name: string;
5
24
  addedIn: string;
@@ -1387,49 +1406,11 @@ export declare const allOptions: {
1387
1406
  setConfig(value: boolean): void;
1388
1407
  id: "experimental-keep-audio-context-alive";
1389
1408
  };
1390
- experimentalTracksOption: {
1391
- name: string;
1392
- addedIn: string;
1393
- cliFlag: "experimental-tracks";
1394
- description: () => import("react/jsx-runtime").JSX.Element;
1395
- ssrName: null;
1396
- docLink: string;
1397
- type: boolean;
1398
- getValue: ({ commandLine }: {
1399
- commandLine: Record<string, unknown>;
1400
- }) => {
1401
- value: boolean;
1402
- source: string;
1403
- };
1404
- setConfig(value: boolean): void;
1405
- getConfigValue: () => boolean | null;
1406
- reset: () => void;
1407
- id: "experimental-tracks";
1408
- };
1409
- experimentalSequenceActivityOption: {
1410
- name: string;
1411
- addedIn: string;
1412
- cliFlag: "experimental-sequence-activity";
1413
- description: () => import("react/jsx-runtime").JSX.Element;
1414
- ssrName: null;
1415
- docLink: string;
1416
- type: boolean;
1417
- getValue: ({ commandLine }: {
1418
- commandLine: Record<string, unknown>;
1419
- }) => {
1420
- value: boolean;
1421
- source: string;
1422
- };
1423
- setConfig(value: boolean): void;
1424
- getConfigValue: () => boolean | null;
1425
- reset: () => void;
1426
- id: "experimental-sequence-activity";
1427
- };
1428
- experimentalSequenceActivityLimitOption: {
1409
+ sequenceActivityLimitOption: {
1429
1410
  name: string;
1430
1411
  addedIn: string;
1431
- cliFlag: "experimental-sequence-activity-limit";
1432
- id: "experimental-sequence-activity-limit";
1412
+ cliFlag: "sequence-activity-limit";
1413
+ id: "sequence-activity-limit";
1433
1414
  description: () => import("react/jsx-runtime").JSX.Element;
1434
1415
  ssrName: null;
1435
1416
  docLink: string;
@@ -37,9 +37,6 @@ const enforce_audio_1 = require("./enforce-audio");
37
37
  const env_file_1 = require("./env-file");
38
38
  const every_nth_frame_1 = require("./every-nth-frame");
39
39
  const experimental_keep_audio_context_alive_1 = require("./experimental-keep-audio-context-alive");
40
- const experimental_sequence_activity_1 = require("./experimental-sequence-activity");
41
- const experimental_sequence_activity_limit_1 = require("./experimental-sequence-activity-limit");
42
- const experimental_tracks_1 = require("./experimental-tracks");
43
40
  const folder_expiry_1 = require("./folder-expiry");
44
41
  const for_seamless_aac_concatenation_1 = require("./for-seamless-aac-concatenation");
45
42
  const force_new_studio_1 = require("./force-new-studio");
@@ -89,6 +86,8 @@ const runs_1 = require("./runs");
89
86
  const sample_rate_1 = require("./sample-rate");
90
87
  const scale_1 = require("./scale");
91
88
  const separate_audio_1 = require("./separate-audio");
89
+ const sequence_activity_limit_1 = require("./sequence-activity-limit");
90
+ const show_layer_frame_numbers_1 = require("./show-layer-frame-numbers");
92
91
  const show_premounting_1 = require("./show-premounting");
93
92
  const skip_skills_1 = require("./skip-skills");
94
93
  const still_frame_1 = require("./still-frame");
@@ -105,6 +104,7 @@ const webhook_custom_data_1 = require("./webhook-custom-data");
105
104
  const webpack_poll_1 = require("./webpack-poll");
106
105
  const x264_preset_1 = require("./x264-preset");
107
106
  exports.allOptions = {
107
+ showLayerFrameNumbersOption: show_layer_frame_numbers_1.showLayerFrameNumbersOption,
108
108
  showPremountingOption: show_premounting_1.showPremountingOption,
109
109
  allowHtmlInCanvasOption: allow_html_in_canvas_1.allowHtmlInCanvasOption,
110
110
  audioCodecOption: audio_codec_1.audioCodecOption,
@@ -181,9 +181,7 @@ exports.allOptions = {
181
181
  framesOption: frames_1.framesOption,
182
182
  forceNewStudioOption: force_new_studio_1.forceNewStudioOption,
183
183
  experimentalKeepAudioContextAliveOption: experimental_keep_audio_context_alive_1.experimentalKeepAudioContextAliveOption,
184
- experimentalTracksOption: experimental_tracks_1.experimentalTracksOption,
185
- experimentalSequenceActivityOption: experimental_sequence_activity_1.experimentalSequenceActivityOption,
186
- experimentalSequenceActivityLimitOption: experimental_sequence_activity_limit_1.experimentalSequenceActivityLimitOption,
184
+ sequenceActivityLimitOption: sequence_activity_limit_1.sequenceActivityLimitOption,
187
185
  numberOfSharedAudioTagsOption: number_of_shared_audio_tags_1.numberOfSharedAudioTagsOption,
188
186
  ipv4Option: ipv4_1.ipv4Option,
189
187
  stillImageFormatOption: still_image_format_1.stillImageFormatOption,
@@ -0,0 +1,19 @@
1
+ export declare const sequenceActivityLimitOption: {
2
+ name: string;
3
+ addedIn: string;
4
+ cliFlag: "sequence-activity-limit";
5
+ id: "sequence-activity-limit";
6
+ description: () => import("react/jsx-runtime").JSX.Element;
7
+ ssrName: null;
8
+ docLink: string;
9
+ type: number;
10
+ getValue: ({ commandLine }: {
11
+ commandLine: Record<string, unknown>;
12
+ }) => {
13
+ value: number;
14
+ source: string;
15
+ };
16
+ setConfig(value: number): void;
17
+ getConfigValue: () => number | null;
18
+ reset: () => void;
19
+ };
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sequenceActivityLimitOption = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const no_react_1 = require("remotion/no-react");
6
+ let configuredLimit = null;
7
+ const cliFlag = 'sequence-activity-limit';
8
+ exports.sequenceActivityLimitOption = {
9
+ name: 'Sequence Activity limit',
10
+ addedIn: '4.0.536',
11
+ cliFlag,
12
+ id: cliFlag,
13
+ description: () => (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: ["Limit hidden scenes discovered by Sequence Activity in the Remotion Studio, including nested sequences and their ancestors. Visible, premounted, and postmounted scenes always render. Defaults to", ' ', jsx_runtime_1.jsx("code", { children: "Infinity" }),
14
+ " for unlimited discovery without admission delays. Must be a non-negative safe integer or ",
15
+ jsx_runtime_1.jsx("code", { children: "Infinity" }),
16
+ ". Set to 0 to disable Sequence Activity. Finite limits prioritize nearby scenes. Does not affect rendering."] })),
17
+ ssrName: null,
18
+ docLink: 'https://www.remotion.dev/docs/options/sequence-activity-limit',
19
+ type: 0,
20
+ getValue: ({ commandLine }) => {
21
+ if (commandLine[cliFlag] !== undefined) {
22
+ const value = commandLine[cliFlag] === 'Infinity' ? Infinity : commandLine[cliFlag];
23
+ if (value !== Infinity &&
24
+ (!Number.isSafeInteger(value) || value < 0)) {
25
+ throw new Error('Sequence Activity limit must be a non-negative safe integer or Infinity.');
26
+ }
27
+ return { value: value, source: 'cli' };
28
+ }
29
+ return {
30
+ value: configuredLimit !== null && configuredLimit !== void 0 ? configuredLimit : no_react_1.NoReactInternals.DEFAULT_SEQUENCE_ACTIVITY_LIMIT,
31
+ source: 'config',
32
+ };
33
+ },
34
+ setConfig(value) {
35
+ if (value !== Infinity && (!Number.isSafeInteger(value) || value < 0)) {
36
+ throw new Error('Sequence Activity limit must be a non-negative safe integer or Infinity.');
37
+ }
38
+ configuredLimit = value;
39
+ },
40
+ getConfigValue: () => configuredLimit,
41
+ reset: () => {
42
+ configuredLimit = null;
43
+ },
44
+ };
@@ -1,6 +1,8 @@
1
- export declare const experimentalClientSideRenderingOption: {
1
+ export declare const showLayerFrameNumbersOption: {
2
2
  name: string;
3
- cliFlag: "enable-experimental-client-side-rendering";
3
+ addedIn: string;
4
+ cliFlag: "show-layer-frame-numbers";
5
+ id: "show-layer-frame-numbers";
4
6
  description: () => import("react/jsx-runtime").JSX.Element;
5
7
  ssrName: null;
6
8
  docLink: string;
@@ -12,5 +14,6 @@ export declare const experimentalClientSideRenderingOption: {
12
14
  source: string;
13
15
  };
14
16
  setConfig(value: boolean): void;
15
- id: "enable-experimental-client-side-rendering";
17
+ getConfigValue: () => boolean | null;
18
+ reset: () => void;
16
19
  };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.showLayerFrameNumbersOption = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ let configuredShowLayerFrameNumbers = null;
6
+ const cliFlag = 'show-layer-frame-numbers';
7
+ exports.showLayerFrameNumbersOption = {
8
+ name: 'Show frame numbers of layer',
9
+ addedIn: '4.0.535',
10
+ cliFlag,
11
+ id: cliFlag,
12
+ description: () => (jsx_runtime_1.jsxs(jsx_runtime_1.Fragment, { children: ["Show the current frame number inside sequence layers in the Studio timeline. Defaults to ",
13
+ jsx_runtime_1.jsx("code", { children: "false" }),
14
+ "."] })),
15
+ ssrName: null,
16
+ docLink: 'https://www.remotion.dev/docs/options/show-layer-frame-numbers',
17
+ type: false,
18
+ getValue: ({ commandLine }) => {
19
+ if (commandLine[cliFlag] !== undefined && commandLine[cliFlag] !== null) {
20
+ return { value: commandLine[cliFlag], source: 'cli' };
21
+ }
22
+ return { value: configuredShowLayerFrameNumbers !== null && configuredShowLayerFrameNumbers !== void 0 ? configuredShowLayerFrameNumbers : false, source: 'config' };
23
+ },
24
+ setConfig(value) {
25
+ if (typeof value !== 'boolean') {
26
+ throw new Error('Config.setShowLayerFrameNumbers() expects a boolean');
27
+ }
28
+ configuredShowLayerFrameNumbers = value;
29
+ },
30
+ getConfigValue: () => configuredShowLayerFrameNumbers,
31
+ reset: () => {
32
+ configuredShowLayerFrameNumbers = null;
33
+ },
34
+ };
@@ -67,10 +67,14 @@ const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLeng
67
67
  }
68
68
  const { toneFrequency, startInVideo } = asset;
69
69
  const startInVideoSeconds = startInVideo / fps;
70
+ // A chunk's leading trim only cuts into assets already playing at its start.
71
+ // For later assets, remove that time from the silence before the asset instead.
72
+ const assetTrimLeftOffset = startInVideo === 0 ? trimLeftOffset : 0;
73
+ const startInChunkSeconds = startInVideo === 0 ? 0 : startInVideoSeconds - trimLeftOffset;
70
74
  const { trimLeft, maxTrim } = (0, seamless_aac_trim_1.getActualTrimLeft)({
71
75
  trimLeft: asset.trimLeft,
72
76
  fps,
73
- trimLeftOffset,
77
+ trimLeftOffset: assetTrimLeftOffset,
74
78
  seamless: forSeamlessAacConcatenation,
75
79
  assetDuration,
76
80
  audioStartFrame: asset.audioStartFrame,
@@ -84,7 +88,7 @@ const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLeng
84
88
  }
85
89
  const { actualTrimLeft, audibleDuration, filter: trimAndTempoFilter, } = trimAndSetTempo({
86
90
  assetDuration,
87
- trimLeftOffset,
91
+ trimLeftOffset: assetTrimLeftOffset,
88
92
  trimRightOffset,
89
93
  asset,
90
94
  fps,
@@ -96,8 +100,8 @@ const stringifyFfmpegFilter = ({ channels, volume, fps, assetDuration, chunkLeng
96
100
  fps,
97
101
  trimLeft: actualTrimLeft,
98
102
  });
99
- const padAtEnd = chunkLengthInSeconds - audibleDuration - startInVideoSeconds;
100
- const padStart = startInVideoSeconds +
103
+ const padAtEnd = chunkLengthInSeconds - audibleDuration - startInChunkSeconds;
104
+ const padStart = startInChunkSeconds +
101
105
  (asset.trimLeft === 0 ? presentationTimeOffsetInSeconds : 0);
102
106
  // Set as few filters as possible, as combining them can create noise
103
107
  return {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/renderer"
4
4
  },
5
5
  "name": "@remotion/renderer",
6
- "version": "4.0.535",
6
+ "version": "4.0.536",
7
7
  "description": "Render Remotion videos using Node.js or Bun",
8
8
  "main": "dist/index.js",
9
9
  "types": "dist/index.d.ts",
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "execa": "5.1.1",
25
- "remotion": "4.0.535",
26
- "@remotion/streaming": "4.0.535",
25
+ "remotion": "4.0.536",
26
+ "@remotion/streaming": "4.0.536",
27
27
  "source-map": "0.8.0",
28
28
  "ws": "8.21.0",
29
- "@remotion/licensing": "4.0.535"
29
+ "@remotion/licensing": "4.0.536"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "react": ">=16.8.0",
@@ -40,19 +40,21 @@
40
40
  "react-dom": "19.2.3",
41
41
  "@typescript/native-preview": "7.0.0-dev.20260217.1",
42
42
  "@types/ws": "8.5.10",
43
- "@remotion/example-videos": "4.0.535",
44
- "@remotion/eslint-config-internal": "4.0.535",
43
+ "@remotion/example-videos": "4.0.536",
44
+ "@remotion/eslint-config-internal": "4.0.536",
45
45
  "eslint": "9.19.0",
46
- "@types/node": "20.12.14"
46
+ "@types/node": "20.12.14",
47
+ "@types/pngjs": "6.0.5",
48
+ "pngjs": "7.0.0"
47
49
  },
48
50
  "optionalDependencies": {
49
- "@remotion/compositor-darwin-arm64": "4.0.535",
50
- "@remotion/compositor-darwin-x64": "4.0.535",
51
- "@remotion/compositor-linux-arm64-gnu": "4.0.535",
52
- "@remotion/compositor-linux-arm64-musl": "4.0.535",
53
- "@remotion/compositor-linux-x64-gnu": "4.0.535",
54
- "@remotion/compositor-linux-x64-musl": "4.0.535",
55
- "@remotion/compositor-win32-x64-msvc": "4.0.535"
51
+ "@remotion/compositor-darwin-arm64": "4.0.536",
52
+ "@remotion/compositor-darwin-x64": "4.0.536",
53
+ "@remotion/compositor-linux-arm64-gnu": "4.0.536",
54
+ "@remotion/compositor-linux-arm64-musl": "4.0.536",
55
+ "@remotion/compositor-linux-x64-gnu": "4.0.536",
56
+ "@remotion/compositor-linux-x64-musl": "4.0.536",
57
+ "@remotion/compositor-win32-x64-msvc": "4.0.536"
56
58
  },
57
59
  "keywords": [
58
60
  "remotion",
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.experimentalClientSideRenderingOption = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- let experimentalClientSideRenderingEnabled = false;
6
- const cliFlag = 'enable-experimental-client-side-rendering';
7
- exports.experimentalClientSideRenderingOption = {
8
- name: 'Enable Experimental Client-Side Rendering',
9
- cliFlag,
10
- description: () => (jsx_runtime_1.jsx(jsx_runtime_1.Fragment, { children: "Enable WIP client-side rendering in the Remotion Studio. See https://www.remotion.dev/docs/client-side-rendering/ for notes." })),
11
- ssrName: null,
12
- docLink: 'https://www.remotion.dev/docs/client-side-rendering',
13
- type: false,
14
- getValue: ({ commandLine }) => {
15
- if (commandLine[cliFlag] !== null) {
16
- return {
17
- value: commandLine[cliFlag],
18
- source: 'cli',
19
- };
20
- }
21
- return {
22
- value: experimentalClientSideRenderingEnabled,
23
- source: 'config',
24
- };
25
- },
26
- setConfig(value) {
27
- experimentalClientSideRenderingEnabled = value;
28
- },
29
- id: cliFlag,
30
- };
@@ -1,13 +0,0 @@
1
- export declare const hasEnoughMemoryForParallelEncoding: ({ freeMemory, estimatedUsage, }: {
2
- freeMemory: number;
3
- estimatedUsage: number;
4
- }) => boolean;
5
- export declare const shouldUseParallelEncoding: ({ width, height, logLevel, }: {
6
- width: number;
7
- height: number;
8
- logLevel: "error" | "info" | "trace" | "verbose" | "warn";
9
- }) => {
10
- hasEnoughMemory: boolean;
11
- freeMemory: number;
12
- estimatedUsage: number;
13
- };
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shouldUseParallelEncoding = exports.hasEnoughMemoryForParallelEncoding = void 0;
4
- const get_available_memory_1 = require("./memory/get-available-memory");
5
- const MINIMUM_MEMORY_LEFT = 2000000000;
6
- const hasEnoughMemoryForParallelEncoding = ({ freeMemory, estimatedUsage, }) => {
7
- return freeMemory - estimatedUsage > MINIMUM_MEMORY_LEFT;
8
- };
9
- exports.hasEnoughMemoryForParallelEncoding = hasEnoughMemoryForParallelEncoding;
10
- const estimateMemoryUsageForPrestitcher = ({ width, height, }) => {
11
- // Empirically we detected that per 1 million pixels, FFMPEG uses around 1GB of memory, relatively independent of
12
- // the duration of the video.
13
- const memoryUsageFor4K = 1000000000;
14
- const memoryUsageOfPixel = memoryUsageFor4K / 1000000;
15
- return memoryUsageOfPixel * width * height;
16
- };
17
- const shouldUseParallelEncoding = ({ width, height, logLevel, }) => {
18
- const freeMemory = (0, get_available_memory_1.getAvailableMemory)(logLevel);
19
- const estimatedUsage = estimateMemoryUsageForPrestitcher({
20
- height,
21
- width,
22
- });
23
- const hasEnoughMemory = (0, exports.hasEnoughMemoryForParallelEncoding)({
24
- estimatedUsage,
25
- freeMemory,
26
- });
27
- return {
28
- hasEnoughMemory,
29
- freeMemory,
30
- estimatedUsage,
31
- };
32
- };
33
- exports.shouldUseParallelEncoding = shouldUseParallelEncoding;
@@ -1,7 +0,0 @@
1
- export declare const renderPartitions: ({ frames, concurrency, }: {
2
- frames: number[];
3
- concurrency: number;
4
- }) => {
5
- partitions: number[][];
6
- getNextFrame: (pageIndex: number) => number;
7
- };
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderPartitions = void 0;
4
- const renderPartitions = ({ frames, concurrency, }) => {
5
- const partitions = [];
6
- let start = 0;
7
- for (let i = 0; i < concurrency; i++) {
8
- const end = start + Math.ceil((frames.length - start) / (concurrency - i));
9
- partitions.push(frames.slice(start, end));
10
- start = end;
11
- }
12
- return {
13
- partitions,
14
- getNextFrame: (pageIndex) => {
15
- if (partitions[pageIndex].length === 0) {
16
- const partitionLengths = partitions.map((p) => p.length);
17
- if (partitionLengths.every((p) => p === 0)) {
18
- throw new Error('No more frames to render');
19
- }
20
- let longestRemainingPartitionIndex = -1;
21
- for (let i = 0; i < partitions.length; i++) {
22
- if (longestRemainingPartitionIndex === -1) {
23
- longestRemainingPartitionIndex = i;
24
- continue;
25
- }
26
- if (partitions[i].length >
27
- partitions[longestRemainingPartitionIndex].length) {
28
- longestRemainingPartitionIndex = i;
29
- }
30
- }
31
- if (longestRemainingPartitionIndex === -1) {
32
- throw new Error('No more frames to render');
33
- }
34
- // Round up - let's say only one frame is left to render, we should take this one
35
- const slicePoint = Math.ceil(partitions[longestRemainingPartitionIndex].length / 2) -
36
- // but don't forget it's zero indexed :)
37
- 1;
38
- partitions[pageIndex] =
39
- partitions[longestRemainingPartitionIndex].slice(slicePoint);
40
- partitions[longestRemainingPartitionIndex] = partitions[longestRemainingPartitionIndex].slice(0, slicePoint);
41
- }
42
- const value = partitions[pageIndex].shift();
43
- if (value === undefined) {
44
- throw new Error('No more frames to render');
45
- }
46
- return value;
47
- },
48
- };
49
- };
50
- exports.renderPartitions = renderPartitions;