hyperframes 0.8.79 → 0.8.80

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.
@@ -54099,7 +54099,20 @@ function quantizeSeekTime(timeSeconds, fps, subFrameDivisions) {
54099
54099
  const grid = safeFps(fps) * divisions;
54100
54100
  return Math.round(safeTime(timeSeconds) * grid) / grid;
54101
54101
  }
54102
- var MEDIA_VISUAL_STYLE_PROPERTIES;
54102
+ function snapTimeToFrameBoundary(timeSeconds, fps) {
54103
+ const grid = safeFps(fps);
54104
+ const time = safeTime(timeSeconds);
54105
+ const framePosition = time * grid;
54106
+ const nearestFrame = Math.round(framePosition);
54107
+ return Math.abs(framePosition - nearestFrame) <= FRAME_BOUNDARY_EPSILON ? nearestFrame / grid : time;
54108
+ }
54109
+ function exportClipWindow(start, end, fps) {
54110
+ return {
54111
+ start: snapTimeToFrameBoundary(start, fps),
54112
+ end: Number.isFinite(end) ? snapTimeToFrameBoundary(end, fps) : end
54113
+ };
54114
+ }
54115
+ var MEDIA_VISUAL_STYLE_PROPERTIES, FRAME_BOUNDARY_EPSILON;
54103
54116
  var init_parityContract = __esm({
54104
54117
  "../core/dist/inline-scripts/parityContract.js"() {
54105
54118
  "use strict";
@@ -54134,6 +54147,7 @@ var init_parityContract = __esm({
54134
54147
  "scale",
54135
54148
  "box-sizing"
54136
54149
  ];
54150
+ FRAME_BOUNDARY_EPSILON = 1e-3;
54137
54151
  }
54138
54152
  });
54139
54153
 
@@ -54443,10 +54457,28 @@ var init_startResolver = __esm({
54443
54457
  }
54444
54458
  });
54445
54459
 
54460
+ // ../core/dist/clipFacts.js
54461
+ function sameInstant(a, b) {
54462
+ if (!Number.isFinite(a) || !Number.isFinite(b))
54463
+ return a === b;
54464
+ return Math.abs(a - b) <= instantTolerance(Math.max(Math.abs(a), Math.abs(b)));
54465
+ }
54466
+ var instantTolerance;
54467
+ var init_clipFacts = __esm({
54468
+ "../core/dist/clipFacts.js"() {
54469
+ "use strict";
54470
+ instantTolerance = (time) => 4 * Number.EPSILON * Math.max(1, Math.abs(time));
54471
+ }
54472
+ });
54473
+
54446
54474
  // ../core/dist/runtime/clipWindow.js
54475
+ var hasClipStarted, isInClipWindow;
54447
54476
  var init_clipWindow = __esm({
54448
54477
  "../core/dist/runtime/clipWindow.js"() {
54449
54478
  "use strict";
54479
+ init_clipFacts();
54480
+ hasClipStarted = (time, start) => time >= start || sameInstant(time, start);
54481
+ isInClipWindow = (time, start, end) => hasClipStarted(time, start) && time < end && !sameInstant(time, end);
54450
54482
  }
54451
54483
  });
54452
54484
 
@@ -79184,6 +79216,7 @@ var init_inlineSubCompositions = __esm({
79184
79216
  });
79185
79217
 
79186
79218
  // ../core/dist/compiler/htmlBundler.js
79219
+ import { AsyncLocalStorage } from "async_hooks";
79187
79220
  import { transformSync } from "esbuild";
79188
79221
  function cssAttributeSelector(attr, value) {
79189
79222
  const escaped = value.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/</g, "\\3c ");
@@ -79360,7 +79393,7 @@ function declarerVariableRules(document2, layerFor) {
79360
79393
  }
79361
79394
  return rules;
79362
79395
  }
79363
- var MAX_INLINE_ASSET_BYTES;
79396
+ var bundleReads, MAX_INLINE_ASSET_BYTES;
79364
79397
  var init_htmlBundler = __esm({
79365
79398
  "../core/dist/compiler/htmlBundler.js"() {
79366
79399
  "use strict";
@@ -79384,6 +79417,7 @@ var init_htmlBundler = __esm({
79384
79417
  init_cssSelector();
79385
79418
  init_safePath();
79386
79419
  init_colorGrading();
79420
+ bundleReads = new AsyncLocalStorage();
79387
79421
  MAX_INLINE_ASSET_BYTES = 2 * 1024 * 1024;
79388
79422
  }
79389
79423
  });
@@ -81081,8 +81115,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
81081
81115
  };
81082
81116
  }
81083
81117
  function getFrameIndexAtTime(extracted, globalTime, videoStart, loop = false, mediaStart = 0, holdLastFrame = false, playbackRate = 1) {
81084
- let localTime = globalTime - videoStart;
81085
- if (localTime < 0) return null;
81118
+ let localTime = Math.max(0, globalTime - videoStart);
81086
81119
  const normalizedPlaybackRate = normalizeRateSpec(playbackRate);
81087
81120
  const loopDuration = timeAtSourceTime(
81088
81121
  normalizedPlaybackRate,
@@ -81104,6 +81137,7 @@ function getFrameIndexAtTime(extracted, globalTime, videoStart, loop = false, me
81104
81137
  return frameIndex;
81105
81138
  }
81106
81139
  function getFrameAtTime(extracted, globalTime, videoStart, loop = false, mediaStart = 0) {
81140
+ if (!hasClipStarted(globalTime, videoStart)) return null;
81107
81141
  const frameIndex = getFrameIndexAtTime(extracted, globalTime, videoStart, loop, mediaStart);
81108
81142
  return frameIndex == null ? null : extracted.framePaths.get(frameIndex) || null;
81109
81143
  }
@@ -81116,8 +81150,8 @@ function analyzeClipMediaFit(params) {
81116
81150
  if (shortfallSeconds <= toleranceSeconds) return null;
81117
81151
  return { shortfallSeconds, toleranceSeconds };
81118
81152
  }
81119
- function createFrameLookupTable(videos, extracted) {
81120
- const table = new FrameLookupTable();
81153
+ function createFrameLookupTable(videos, extracted, fps) {
81154
+ const table = new FrameLookupTable(fps);
81121
81155
  const extractedMap = /* @__PURE__ */ new Map();
81122
81156
  for (const ext of extracted) extractedMap.set(ext.videoId, ext);
81123
81157
  for (const video of videos) {
@@ -81168,6 +81202,11 @@ var init_videoFrameExtractor = __esm({
81168
81202
  FINAL_FRAME_LOGICAL_DURATION_SECONDS = 1e-6;
81169
81203
  ALPHA_CAPABLE_CODECS = /* @__PURE__ */ new Set(["vp9", "vp8", "prores"]);
81170
81204
  FrameLookupTable = class {
81205
+ /** The render's `fps`, so a clip shows in exactly export visibility's frames; omit for authored times. */
81206
+ constructor(fps) {
81207
+ this.fps = fps;
81208
+ }
81209
+ fps;
81171
81210
  videos = /* @__PURE__ */ new Map();
81172
81211
  orderedVideos = [];
81173
81212
  activeVideoIds = /* @__PURE__ */ new Set();
@@ -81177,18 +81216,18 @@ var init_videoFrameExtractor = __esm({
81177
81216
  this.videos.set(extracted.videoId, {
81178
81217
  extracted,
81179
81218
  start,
81180
- end,
81219
+ clipWindow: this.fps ? exportClipWindow(start, end, this.fps) : { start, end },
81181
81220
  mediaStart,
81182
81221
  loop,
81183
81222
  playbackRate: normalizeRateSpec(playbackRate)
81184
81223
  });
81185
- this.orderedVideos = Array.from(this.videos.entries()).map(([videoId, video]) => ({ videoId, ...video })).sort((a, b) => a.start - b.start);
81224
+ this.orderedVideos = Array.from(this.videos.entries()).map(([videoId, video]) => ({ videoId, ...video })).sort((a, b) => a.clipWindow.start - b.clipWindow.start);
81186
81225
  this.resetActiveState();
81187
81226
  }
81188
81227
  getFrame(videoId, globalTime) {
81189
81228
  const video = this.videos.get(videoId);
81190
81229
  if (!video) return null;
81191
- if (globalTime < video.start || globalTime > video.end) return null;
81230
+ if (!isInClipWindow(globalTime, video.clipWindow.start, video.clipWindow.end)) return null;
81192
81231
  const frameIndex = getFrameIndexAtTime(
81193
81232
  video.extracted,
81194
81233
  globalTime,
@@ -81210,14 +81249,11 @@ var init_videoFrameExtractor = __esm({
81210
81249
  this.activeVideoIds.clear();
81211
81250
  this.startCursor = 0;
81212
81251
  for (const entry of this.orderedVideos) {
81213
- if (entry.start <= globalTime && globalTime <= entry.end) {
81252
+ if (!hasClipStarted(globalTime, entry.clipWindow.start)) break;
81253
+ if (isInClipWindow(globalTime, entry.clipWindow.start, entry.clipWindow.end)) {
81214
81254
  this.activeVideoIds.add(entry.videoId);
81215
81255
  }
81216
- if (entry.start <= globalTime) {
81217
- this.startCursor += 1;
81218
- } else {
81219
- break;
81220
- }
81256
+ this.startCursor += 1;
81221
81257
  }
81222
81258
  this.lastTime = globalTime;
81223
81259
  return;
@@ -81225,17 +81261,17 @@ var init_videoFrameExtractor = __esm({
81225
81261
  while (this.startCursor < this.orderedVideos.length) {
81226
81262
  const candidate = this.orderedVideos[this.startCursor];
81227
81263
  if (!candidate) break;
81228
- if (candidate.start > globalTime) {
81264
+ if (!hasClipStarted(globalTime, candidate.clipWindow.start)) {
81229
81265
  break;
81230
81266
  }
81231
- if (globalTime <= candidate.end) {
81267
+ if (isInClipWindow(globalTime, candidate.clipWindow.start, candidate.clipWindow.end)) {
81232
81268
  this.activeVideoIds.add(candidate.videoId);
81233
81269
  }
81234
81270
  this.startCursor += 1;
81235
81271
  }
81236
81272
  for (const videoId of Array.from(this.activeVideoIds)) {
81237
81273
  const video = this.videos.get(videoId);
81238
- if (!video || globalTime < video.start || globalTime > video.end) {
81274
+ if (!video || !isInClipWindow(globalTime, video.clipWindow.start, video.clipWindow.end)) {
81239
81275
  this.activeVideoIds.delete(videoId);
81240
81276
  }
81241
81277
  }
@@ -97587,11 +97623,11 @@ function resolveCaptureImageFormat(input) {
97587
97623
  }
97588
97624
 
97589
97625
  // ../producer/src/services/render/stages/probeStage.ts
97590
- var FRAME_BOUNDARY_EPSILON = 1e-3;
97626
+ var FRAME_BOUNDARY_EPSILON2 = 1e-3;
97591
97627
  function durationToFrameCount(duration, fps) {
97592
97628
  const rawFrameCount = duration * fps;
97593
97629
  const nearestFrame = Math.round(rawFrameCount);
97594
- return Math.abs(rawFrameCount - nearestFrame) <= FRAME_BOUNDARY_EPSILON ? nearestFrame : Math.ceil(rawFrameCount);
97630
+ return Math.abs(rawFrameCount - nearestFrame) <= FRAME_BOUNDARY_EPSILON2 ? nearestFrame : Math.ceil(rawFrameCount);
97595
97631
  }
97596
97632
  function hasScriptedAudioVolumeAutomation(html, audioCount) {
97597
97633
  if (audioCount <= 0) return false;
@@ -98471,7 +98507,11 @@ async function runExtractVideosStage(input) {
98471
98507
  materializeSymlinks
98472
98508
  });
98473
98509
  if (extractionResult.extracted.length > 0) {
98474
- frameLookup = createFrameLookupTable(composition.videos, extractionResult.extracted);
98510
+ frameLookup = createFrameLookupTable(
98511
+ composition.videos,
98512
+ extractionResult.extracted,
98513
+ resolveRenderFpsConfig(job.config.fps).value
98514
+ );
98475
98515
  }
98476
98516
  videoReadinessSkipIds = collectVideoReadinessSkipIds(
98477
98517
  nativeHdrVideoIds,
@@ -104579,8 +104619,8 @@ async function runFontLocalize(io, localize) {
104579
104619
  }
104580
104620
 
104581
104621
  // src/version.ts
104582
- var VERSION = true ? "0.8.79" : "0.0.0-dev";
104583
- var PRODUCER_VERSION = true ? "0.8.79" : "0.0.0-dev";
104622
+ var VERSION = true ? "0.8.80" : "0.0.0-dev";
104623
+ var PRODUCER_VERSION = true ? "0.8.80" : "0.0.0-dev";
104584
104624
 
104585
104625
  // src/fontLocalizeCli.ts
104586
104626
  async function readStdin() {