mattebox 0.18.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/README.md +17 -0
  2. package/dist/cdn/mattebox.dash-drm.min.js +3 -3
  3. package/dist/cdn/mattebox.dash-ll.min.js +3 -3
  4. package/dist/cdn/mattebox.dash.min.js +2 -2
  5. package/dist/cdn/mattebox.dual-drm.min.js +3 -3
  6. package/dist/cdn/mattebox.dual-ll.min.js +3 -3
  7. package/dist/cdn/mattebox.dual-ts-drm.min.js +3 -3
  8. package/dist/cdn/mattebox.dual-ts.min.js +3 -3
  9. package/dist/cdn/mattebox.dual.min.js +3 -3
  10. package/dist/cdn/mattebox.hls-drm.min.js +3 -3
  11. package/dist/cdn/mattebox.hls-ll.min.js +3 -3
  12. package/dist/cdn/mattebox.hls-ts-drm.min.js +3 -3
  13. package/dist/cdn/mattebox.hls-ts.min.js +3 -3
  14. package/dist/cdn/mattebox.hls.min.js +3 -3
  15. package/dist/cdn/mattebox.kernel.min.js +1 -1
  16. package/dist/cdn/mattebox.min.js +5 -5
  17. package/dist/containers/projection.d.ts +56 -0
  18. package/dist/containers/projection.d.ts.map +1 -0
  19. package/dist/containers/projection.js +105 -0
  20. package/dist/containers/projection.js.map +1 -0
  21. package/dist/containers/webm/cues.d.ts +59 -0
  22. package/dist/containers/webm/cues.d.ts.map +1 -0
  23. package/dist/containers/webm/cues.js +218 -0
  24. package/dist/containers/webm/cues.js.map +1 -0
  25. package/dist/containers/webm/index.d.ts +36 -0
  26. package/dist/containers/webm/index.d.ts.map +1 -0
  27. package/dist/containers/webm/index.js +271 -0
  28. package/dist/containers/webm/index.js.map +1 -0
  29. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/asyncToGenerator.js +1 -1
  30. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/defineProperty.js +1 -1
  31. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/objectSpread2.js +1 -1
  32. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/objectWithoutProperties.js +1 -1
  33. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/objectWithoutPropertiesLoose.js +1 -1
  34. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/toPrimitive.js +1 -1
  35. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/toPropertyKey.js +1 -1
  36. package/dist/es2015/_virtual/{_@oxc-project_runtime@0.158.0 → _@oxc-project_runtime@0.159.0}/helpers/esm/typeof.js +1 -1
  37. package/dist/es2015/containers/emsg.js +2 -2
  38. package/dist/es2015/containers/fmp4/fit.js +1 -1
  39. package/dist/es2015/containers/fmp4/writer.js +1 -1
  40. package/dist/es2015/containers/id3.js +1 -1
  41. package/dist/es2015/containers/mp4-box/index.js +2 -2
  42. package/dist/es2015/containers/projection.js +107 -0
  43. package/dist/es2015/containers/scte35.js +1 -1
  44. package/dist/es2015/containers/sei.js +1 -1
  45. package/dist/es2015/containers/ts-transmux/demux.js +1 -1
  46. package/dist/es2015/containers/ts-transmux/h264.js +1 -1
  47. package/dist/es2015/containers/ts-transmux/h265.js +1 -1
  48. package/dist/es2015/containers/ts-transmux/index.js +1 -1
  49. package/dist/es2015/containers/ts-transmux/runner.js +2 -2
  50. package/dist/es2015/containers/ts-transmux/transmux.js +1 -1
  51. package/dist/es2015/containers/webm/cues.js +197 -0
  52. package/dist/es2015/containers/webm/index.js +255 -0
  53. package/dist/es2015/containers/webvtt.js +1 -1
  54. package/dist/es2015/containers/wvtt.js +1 -1
  55. package/dist/es2015/eme/index.js +3 -3
  56. package/dist/es2015/index.js +2 -2
  57. package/dist/es2015/kernel/append-queue.js +1 -1
  58. package/dist/es2015/kernel/dry-run.js +1 -1
  59. package/dist/es2015/kernel/mse.js +1 -1
  60. package/dist/es2015/kernel/prepare.js +2 -2
  61. package/dist/es2015/kernel/reducer.js +53 -4
  62. package/dist/es2015/kernel/refresh.js +1 -1
  63. package/dist/es2015/kernel/rendition-select.js +2 -2
  64. package/dist/es2015/kernel/scheduler.js +1 -1
  65. package/dist/es2015/kernel/timeline.js +1 -1
  66. package/dist/es2015/kernel/trace.js +2 -2
  67. package/dist/es2015/kernel/transport.js +2 -2
  68. package/dist/es2015/presets/define.js +2 -2
  69. package/dist/es2015/presets/full/index.js +6 -3
  70. package/dist/es2015/presets/tiers/dash-ll.js +2 -1
  71. package/dist/es2015/presets/tiers/dash.js +7 -2
  72. package/dist/es2015/protocols/dash-cmaf/index.js +12 -6
  73. package/dist/es2015/protocols/dash-cmaf/parse.js +102 -50
  74. package/dist/es2015/protocols/dash-cmaf/periods-runtime.js +1 -1
  75. package/dist/es2015/protocols/dash-cmaf/periods.js +1 -1
  76. package/dist/es2015/protocols/dash-live/index.js +9 -6
  77. package/dist/es2015/protocols/dash-ll/index.js +3 -2
  78. package/dist/es2015/protocols/hls-cmaf/index.js +1 -1
  79. package/dist/es2015/protocols/hls-cmaf/parse.js +1 -1
  80. package/dist/es2015/protocols/hls-cmaf/unavailable.js +1 -1
  81. package/dist/es2015/protocols/hls-live/index.js +1 -1
  82. package/dist/es2015/protocols/hls-ll/parse.js +1 -1
  83. package/dist/es2015/stages/abr/index.js +1 -1
  84. package/dist/es2015/stages/aes-128/index.js +1 -1
  85. package/dist/es2015/stages/chapters/index.js +2 -2
  86. package/dist/es2015/stages/chapters/parse.js +2 -2
  87. package/dist/es2015/stages/cmcd/index.js +1 -2
  88. package/dist/es2015/stages/codec-probe/index.js +1 -1
  89. package/dist/es2015/stages/content-steering/index.js +1 -1
  90. package/dist/es2015/stages/eme-core/index.js +2 -2
  91. package/dist/es2015/stages/eme-fairplay/index.js +1 -1
  92. package/dist/es2015/stages/hdr/index.js +1 -1
  93. package/dist/es2015/stages/interstitials/breaks.js +1 -1
  94. package/dist/es2015/stages/interstitials/index.js +2 -2
  95. package/dist/es2015/stages/projection/index.js +51 -0
  96. package/dist/es2015/stages/qoe/index.js +1 -1
  97. package/dist/es2015/stages/recovery/index.js +1 -1
  98. package/dist/es2015/stages/rendition-names/index.js +1 -1
  99. package/dist/es2015/stages/text-cea608/decode.js +1 -1
  100. package/dist/es2015/stages/text-cea708/decode.js +2 -2
  101. package/dist/es2015/stages/text-cea708/index.js +1 -1
  102. package/dist/es2015/stages/text-ttml/index.js +1 -1
  103. package/dist/es2015/stages/text-ttml/parse.js +1 -1
  104. package/dist/es2015/stages/thumbnails/index.js +1 -1
  105. package/dist/es2015/stages/timed-metadata/index.js +1 -1
  106. package/dist/es2015/stages/trick-play/index.js +1 -1
  107. package/dist/kernel/reducer.d.ts.map +1 -1
  108. package/dist/kernel/reducer.js +69 -1
  109. package/dist/kernel/reducer.js.map +1 -1
  110. package/dist/presets/full/index.d.ts.map +1 -1
  111. package/dist/presets/full/index.js +5 -2
  112. package/dist/presets/full/index.js.map +1 -1
  113. package/dist/presets/tiers/dash-ll.d.ts.map +1 -1
  114. package/dist/presets/tiers/dash-ll.js +2 -1
  115. package/dist/presets/tiers/dash-ll.js.map +1 -1
  116. package/dist/presets/tiers/dash.d.ts +7 -1
  117. package/dist/presets/tiers/dash.d.ts.map +1 -1
  118. package/dist/presets/tiers/dash.js +3 -2
  119. package/dist/presets/tiers/dash.js.map +1 -1
  120. package/dist/protocols/dash-cmaf/index.d.ts +8 -3
  121. package/dist/protocols/dash-cmaf/index.d.ts.map +1 -1
  122. package/dist/protocols/dash-cmaf/index.js +12 -5
  123. package/dist/protocols/dash-cmaf/index.js.map +1 -1
  124. package/dist/protocols/dash-cmaf/parse.d.ts +6 -1
  125. package/dist/protocols/dash-cmaf/parse.d.ts.map +1 -1
  126. package/dist/protocols/dash-cmaf/parse.js +87 -7
  127. package/dist/protocols/dash-cmaf/parse.js.map +1 -1
  128. package/dist/protocols/dash-live/index.d.ts +6 -3
  129. package/dist/protocols/dash-live/index.d.ts.map +1 -1
  130. package/dist/protocols/dash-live/index.js +7 -4
  131. package/dist/protocols/dash-live/index.js.map +1 -1
  132. package/dist/protocols/dash-ll/index.d.ts.map +1 -1
  133. package/dist/protocols/dash-ll/index.js +3 -2
  134. package/dist/protocols/dash-ll/index.js.map +1 -1
  135. package/dist/stages/eme-wiseplay/index.d.ts +3 -2
  136. package/dist/stages/eme-wiseplay/index.d.ts.map +1 -1
  137. package/dist/stages/eme-wiseplay/index.js.map +1 -1
  138. package/dist/stages/projection/index.d.ts +3 -0
  139. package/dist/stages/projection/index.d.ts.map +1 -0
  140. package/dist/stages/projection/index.js +57 -0
  141. package/dist/stages/projection/index.js.map +1 -0
  142. package/dist/types/ir.d.ts +16 -1
  143. package/dist/types/ir.d.ts.map +1 -1
  144. package/dist/types/kernel.d.ts +5 -1
  145. package/dist/types/kernel.d.ts.map +1 -1
  146. package/dist/types/kernel.js.map +1 -1
  147. package/dist/types/messages.d.ts +23 -1
  148. package/dist/types/messages.d.ts.map +1 -1
  149. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  import { scheduled } from "../../kernel/effects.js";
2
2
  import { findRendition, isTrick } from "../../kernel/presentation.js";
3
3
  import { canSwitchTo } from "../../kernel/rendition-select.js";
4
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
4
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
5
5
  // src/stages/abr/index.ts
6
6
  /**
7
7
  * Adaptive bitrate as a stage, not kernel. It registers one chooser
@@ -1,5 +1,5 @@
1
1
  import { findRendition } from "../../kernel/presentation.js";
2
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/asyncToGenerator.js";
2
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
3
3
  // src/stages/aes-128/index.ts
4
4
  /**
5
5
  * aes-128 as a stage: full-segment AES-CBC decryption for HLS EXT-X-KEY
@@ -1,7 +1,7 @@
1
1
  import { findTrackSite } from "../../kernel/presentation.js";
2
2
  import { chaptersFromInput, parseAppleChapters, parseChapterTrack } from "./parse.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
4
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/asyncToGenerator.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
5
5
  // src/stages/chapters/index.ts
6
6
  /**
7
7
  * Chapters: named spans of the presentation, answered through
@@ -1,7 +1,7 @@
1
1
  import { parseVtt } from "../../containers/webvtt.js";
2
2
  import { resolveUrl } from "../../kernel/url.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
4
- import _objectWithoutProperties from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectWithoutProperties.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
+ import _objectWithoutProperties from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectWithoutProperties.js";
5
5
  // src/stages/chapters/parse.ts
6
6
  /**
7
7
  * Chapter files into one record shape. Pure. A WebVTT file serves two
@@ -88,8 +88,7 @@ function cmcd(options = {}) {
88
88
  if (active !== null) keys.br = Math.round(active.rendition.bitrate / 1e3);
89
89
  const mtp = state.stats.throughputEwma;
90
90
  if (mtp > 0) keys.mtp = Math.round(mtp / 1e3 / 100) * 100;
91
- const el = ctx.element;
92
- const ahead = bufferAhead(el);
91
+ const ahead = bufferAhead(ctx.element);
93
92
  if (ahead !== null) keys.bl = Math.round(ahead * 1e3 / 100) * 100;
94
93
  if (ahead !== null && ahead < 1) keys.su = true;
95
94
  const request = state.scheduling.inflight.get(req.token);
@@ -1,6 +1,6 @@
1
1
  import { codecMismatch, probeInitSegment } from "../../containers/codec-probe/index.js";
2
2
  import { findRendition } from "../../kernel/presentation.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
4
  // src/stages/codec-probe/index.ts
5
5
  /**
6
6
  * codec-probe as a loadable stage. The derivation itself lives in the
@@ -1,5 +1,5 @@
1
1
  import { scheduled, tickAfter } from "../../kernel/effects.js";
2
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
2
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
3
3
  // src/stages/content-steering/index.ts
4
4
  /**
5
5
  * Content steering: pathway switching from a steering manifest, plus
@@ -1,7 +1,7 @@
1
1
  import { bytesToBase64 } from "../../kernel/base64.js";
2
2
  import { keySystemHandlers, normalizeSystemId } from "../drm-shared.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
4
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/asyncToGenerator.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
5
5
  // src/stages/eme-core/index.ts
6
6
  /**
7
7
  * The generic EME handshake, entanglement #3 resolved: DRM lands without
@@ -1,6 +1,6 @@
1
1
  import { base64ToBytes, bytesToBase64 } from "../../kernel/base64.js";
2
2
  import { registerKeySystem } from "../drm-shared.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
4
  // src/stages/eme-fairplay/index.ts
5
5
  /**
6
6
  * FairPlay Streaming: the non-standard SPC/CKC flow. Safari only, and it
@@ -1,4 +1,4 @@
1
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/asyncToGenerator.js";
1
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
2
2
  // src/stages/hdr/index.ts
3
3
  const SOURCE = "hdr";
4
4
  /** The display's answer, or null when the browser does not know `dynamic-range`. */
@@ -1,6 +1,6 @@
1
1
  import { scte35Summary } from "../../containers/scte35.js";
2
2
  import { resolveUrl } from "../../kernel/url.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
4
  // src/stages/interstitials/breaks.ts
5
5
  /**
6
6
  * Breaks from what the stream signals, as plain data. HLS interstitials
@@ -2,8 +2,8 @@ import { placeEmsg } from "../../containers/emsg.js";
2
2
  import { findBox, trackTimescales } from "../../containers/mp4-box/index.js";
3
3
  import { bytesToBase64 } from "../../kernel/base64.js";
4
4
  import { assetsOf, breaksOf, fromEvent } from "./breaks.js";
5
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
6
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/asyncToGenerator.js";
5
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
6
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
7
7
  // src/stages/interstitials/index.ts
8
8
  /**
9
9
  * Plays breaks: HLS interstitials, DASH alternative MPD events, and the
@@ -0,0 +1,51 @@
1
+ import { readFramePacking, readProjection } from "../../containers/projection.js";
2
+ import { findRendition } from "../../kernel/presentation.js";
3
+ // src/stages/projection/index.ts
4
+ /**
5
+ * projection as a loadable stage: a 360° video's projection from its init
6
+ * segment, for a rendition whose manifest states none. The boxes it reads
7
+ * are in `containers/projection`. It hands what it finds to the kernel with
8
+ * SET_PROJECTION, so the rendition carries `projection` as if the manifest
9
+ * had said it, and a player reads one field whatever the source.
10
+ *
11
+ * The init segment arrives before the video has its first frame, so the
12
+ * rendition carries the projection by the time the element fires
13
+ * `loadedmetadata`. A projection the manifest states wins: the stage reads
14
+ * nothing for that rendition.
15
+ *
16
+ * The same boxes say how a frame holds a picture for each eye, and the
17
+ * stage hands that over with SET_FRAME_PACKING, under the same rules.
18
+ */
19
+ function projection() {
20
+ return {
21
+ name: "projection",
22
+ provides: ["projection"],
23
+ requires: ["mp4-box"],
24
+ install(ctx) {
25
+ ctx.registerTransform({
26
+ name: "projection",
27
+ order: 5,
28
+ transform(data, meta) {
29
+ if (meta.contentType !== "video" || !meta.isInit) return data;
30
+ const site = findRendition(ctx.getState().presentation, meta.renditionId);
31
+ if (site === null) return data;
32
+ const { projection, framePacking } = site.rendition;
33
+ const found = projection === void 0 ? readProjection(data) : null;
34
+ if (found !== null) ctx.dispatch({
35
+ type: "SET_PROJECTION",
36
+ renditionId: meta.renditionId,
37
+ projection: found
38
+ });
39
+ const packing = framePacking === void 0 ? readFramePacking(data) : null;
40
+ if (packing !== null) ctx.dispatch({
41
+ type: "SET_FRAME_PACKING",
42
+ renditionId: meta.renditionId,
43
+ framePacking: packing
44
+ });
45
+ return data;
46
+ }
47
+ });
48
+ }
49
+ };
50
+ }
51
+ export { projection as default };
@@ -1,4 +1,4 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
2
2
  // src/stages/qoe/index.ts
3
3
  function qoe() {
4
4
  return {
@@ -1,7 +1,7 @@
1
1
  import { scheduled, tickAfter } from "../../kernel/effects.js";
2
2
  import { findRendition, findTrackSite } from "../../kernel/presentation.js";
3
3
  import { segmentAt as segmentAt$1, segmentAtTime } from "../../kernel/timeline.js";
4
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
4
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
5
5
  // src/stages/recovery/index.ts
6
6
  /**
7
7
  * Recovery as a stage: the kernel keeps its circuit breakers as the last
@@ -1,4 +1,4 @@
1
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
1
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
2
2
  // src/stages/rendition-names/index.ts
3
3
  const DATA_ID = "_hls.localized-rendition-names";
4
4
  const FETCH_TOKEN = "rendition-names:dictionary";
@@ -1,4 +1,4 @@
1
- import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.js";
1
+ import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/defineProperty.js";
2
2
  // src/stages/text-cea608/decode.ts
3
3
  const ROWS = 15;
4
4
  /** The basic CEA-608 character set: ASCII with a handful of substitutions. */
@@ -1,6 +1,6 @@
1
1
  import { escapeCueText } from "../../containers/webvtt.js";
2
- import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/defineProperty.js";
3
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
2
+ import _defineProperty from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/defineProperty.js";
3
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
4
4
  // src/stages/text-cea708/decode.ts
5
5
  /**
6
6
  * A CEA-708 caption decoder (CTA-708-E): DTVCC packets to cue text per
@@ -1,7 +1,7 @@
1
1
  import { registerCaptionConsumer } from "../../containers/captions.js";
2
2
  import { inbandCaptions, vttCue } from "../../kernel/sinks/caption-tracks.js";
3
3
  import { Dtvcc } from "./decode.js";
4
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
4
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
5
5
  // src/stages/text-cea708/index.ts
6
6
  /**
7
7
  * CEA-708 in-band captions as a stage. It registers a caption consumer
@@ -4,7 +4,7 @@ import { joinTextSink } from "../../kernel/sinks/text-formats.js";
4
4
  import { segmentAt } from "../../kernel/timeline.js";
5
5
  import { showImages } from "./images.js";
6
6
  import { parseTtml } from "./parse.js";
7
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
7
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
8
8
  // src/stages/text-ttml/index.ts
9
9
  /**
10
10
  * TTML subtitles as a stage, for the IMSC1 Text Profile and EBU-TT-D. It
@@ -1,5 +1,5 @@
1
1
  import { escapeCueText } from "../../containers/webvtt.js";
2
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
2
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
3
3
  // src/stages/text-ttml/parse.ts
4
4
  /**
5
5
  * TTML to cues, for the IMSC1 Text Profile (W3C IMSC 1.0.1 to 1.2), which
@@ -2,7 +2,7 @@ import { parseVtt } from "../../containers/webvtt.js";
2
2
  import { scheduled } from "../../kernel/effects.js";
3
3
  import { isIndexed, segmentAt, segmentAtTime } from "../../kernel/timeline.js";
4
4
  import { resolveUrl } from "../../kernel/url.js";
5
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/asyncToGenerator.js";
5
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
6
6
  // src/stages/thumbnails/index.ts
7
7
  /**
8
8
  * Thumbnails: the trick-play images a scrubbing UI shows, answered through
@@ -5,7 +5,7 @@ import { findBox, trackTimescales } from "../../containers/mp4-box/index.js";
5
5
  import { scte35Summary } from "../../containers/scte35.js";
6
6
  import { bytesToHex } from "../../kernel/base64.js";
7
7
  import { adoptTextTrack, emptyTextTrack } from "../../kernel/sinks/text-track-sink.js";
8
- import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/objectSpread2.js";
8
+ import _objectSpread2 from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/objectSpread2.js";
9
9
  // src/stages/timed-metadata/index.ts
10
10
  /**
11
11
  * Timed metadata from every source in one list, one API, and one native
@@ -5,7 +5,7 @@ import { programTables } from "../../containers/ts-transmux/demux.js";
5
5
  import { findRendition, findTrackSite, isTrick } from "../../kernel/presentation.js";
6
6
  import { isUnresolved, segmentAtTime } from "../../kernel/timeline.js";
7
7
  import { looksLikeTransportStream } from "../../containers/ts-transmux/sniff.js";
8
- import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.158.0/helpers/esm/asyncToGenerator.js";
8
+ import _asyncToGenerator from "../../_virtual/_@oxc-project_runtime@0.159.0/helpers/esm/asyncToGenerator.js";
9
9
  // src/stages/trick-play/index.ts
10
10
  /**
11
11
  * Trick play: fast forward and rewind through the presentation's I-frame
@@ -1 +1 @@
1
- {"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/kernel/reducer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,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AAQ,CAAC,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7C;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAC/C;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;CAC5C;AA6VD,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,OAAO,CAEtD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,MAAM,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,EAClD,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,EAC9B,MAAM,GAAE,YAAiB,GACxB,OAAO,CAkGT"}
@@ -730,8 +730,74 @@ function reduceCommand(state, msg, cfg, hooks) {
730
730
  [{ kind: 'emit', event: 'tracks:changed', payload: { available } }],
731
731
  ];
732
732
  }
733
+ case 'SET_PROJECTION': {
734
+ if (state.presentation === null) {
735
+ return reject(state, msg.type, 'no source');
736
+ }
737
+ const site = findRendition(state.presentation, msg.renditionId);
738
+ if (site === null) {
739
+ return reject(state, msg.type, `unknown rendition: ${msg.renditionId}`);
740
+ }
741
+ if (site.rendition.projection !== undefined) {
742
+ return reject(state, msg.type, `projection exists: ${msg.renditionId}`);
743
+ }
744
+ const projections = new Map(state.tracks.projections).set(msg.renditionId, msg.projection);
745
+ const presentation = withStated(state.presentation, projections, undefined);
746
+ return [
747
+ { ...state, presentation, tracks: { ...state.tracks, projections } },
748
+ [{ kind: 'emit', event: 'presentation:changed', payload: { id: presentation.id } }],
749
+ ];
750
+ }
751
+ case 'SET_FRAME_PACKING': {
752
+ if (state.presentation === null) {
753
+ return reject(state, msg.type, 'no source');
754
+ }
755
+ const site = findRendition(state.presentation, msg.renditionId);
756
+ if (site === null) {
757
+ return reject(state, msg.type, `unknown rendition: ${msg.renditionId}`);
758
+ }
759
+ if (site.rendition.framePacking !== undefined) {
760
+ return reject(state, msg.type, `frame packing exists: ${msg.renditionId}`);
761
+ }
762
+ const framePackings = new Map(state.tracks.framePackings).set(msg.renditionId, msg.framePacking);
763
+ const presentation = withStated(state.presentation, undefined, framePackings);
764
+ return [
765
+ { ...state, presentation, tracks: { ...state.tracks, framePackings } },
766
+ [{ kind: 'emit', event: 'presentation:changed', payload: { id: presentation.id } }],
767
+ ];
768
+ }
733
769
  }
734
770
  }
771
+ /**
772
+ * Gives every rendition SET_PROJECTION or SET_FRAME_PACKING named what the
773
+ * command stated, where the presentation states none. A playlist merge
774
+ * hands the reducer the adapter's presentation, which knows nothing of them.
775
+ */
776
+ function withStated(presentation, projections, framePackings) {
777
+ if (!projections?.size && !framePackings?.size)
778
+ return presentation;
779
+ return {
780
+ ...presentation,
781
+ periods: presentation.periods.map((period) => ({
782
+ ...period,
783
+ tracks: period.tracks.map((track) => ({
784
+ ...track,
785
+ renditions: track.renditions.map((rendition) => {
786
+ const projection = rendition.projection ?? projections?.get(rendition.id);
787
+ const framePacking = rendition.framePacking ?? framePackings?.get(rendition.id);
788
+ if (projection === rendition.projection && framePacking === rendition.framePacking) {
789
+ return rendition;
790
+ }
791
+ return {
792
+ ...rendition,
793
+ ...(projection === undefined ? {} : { projection }),
794
+ ...(framePacking === undefined ? {} : { framePacking }),
795
+ };
796
+ }),
797
+ })),
798
+ })),
799
+ };
800
+ }
735
801
  /**
736
802
  * Joins the tracks ADD_TRACK added to every period that lacks them. A
737
803
  * playlist merge hands the reducer the adapter's presentation, which knows
@@ -796,7 +862,7 @@ function behindTrick(tracks, track, previous) {
796
862
  * merged into it. Activates default tracks and reports what changed.
797
863
  */
798
864
  function loadPresentation(state, merged, undecodableIds = new Set()) {
799
- const presentation = withAdded(merged, state.tracks.added);
865
+ const presentation = withStated(withAdded(merged, state.tracks.added), state.tracks.projections, state.tracks.framePackings);
800
866
  const available = [];
801
867
  for (const period of presentation.periods) {
802
868
  for (const track of period.tracks)
@@ -1827,6 +1893,8 @@ const COMMAND_TYPES = {
1827
1893
  RESOLVE_RENDITION: true,
1828
1894
  ABORT_INFLIGHT: true,
1829
1895
  ADD_TRACK: true,
1896
+ SET_PROJECTION: true,
1897
+ SET_FRAME_PACKING: true,
1830
1898
  };
1831
1899
  export function isCommand(msg) {
1832
1900
  return msg.type in COMMAND_TYPES;