libav-wasm 0.8.12 → 0.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,7 +22,10 @@ carry never costs you the file. Thumbnails have none of these limits: they decod
22
22
  pixels, so they work on files that cannot be remuxed at all.
23
23
 
24
24
  Timestamps are reported relative to the start of the content, so a format whose clock starts elsewhere
25
- (mpegts) still lines up with a player's timeline.
25
+ (mpegts) still lines up with a player's timeline. The fragments carry the same times plus 10 s, every track at its
26
+ own, at load and after every seek, with no edit list: the 10 s keeps a B-frame stream's first decode times and an
27
+ audio track's priming, which come before 0, from being negative, and `init()` hands back the `timestampOffset` that
28
+ takes it off again.
26
29
 
27
30
  ## Usage
28
31
 
@@ -41,9 +44,11 @@ const remuxer = await makeRemuxer({
41
44
  })
42
45
 
43
46
  // the mp4 init segment, plus every piece of metadata the file carries
44
- const { data, info, indexes, subtitles, attachments, chapters } = await remuxer.init()
47
+ const { data, info, indexes, subtitles, attachments, chapters, timestampOffset } = await remuxer.init()
45
48
  const codecs = [info.output.videoMimeType, info.output.audioMimeType].filter(Boolean).join(',')
46
49
  const mime = `video/mp4; codecs="${codecs}"`
50
+ // once, before the first append, and never again: every fragment, after any seek too, is written at its own time
51
+ sourceBuffer.timestampOffset = timestampOffset
47
52
 
48
53
  // { data, pts, duration, offset, finished }: data appends straight to a SourceBuffer
49
54
  const chunk = await remuxer.read()
@@ -80,6 +85,9 @@ cannot follow, and a thumbnailer has no muxer to damage.
80
85
  the library and the worker, and emits types. Only the last step re-runs when you touch C++, so the loop is
81
86
  about 25 seconds.
82
87
 
88
+ ffmpeg is built with every patch in [patches/](./patches) applied, each saying at its head what it changes and
89
+ why. Adding or editing one rebuilds ffmpeg on the next `npm run build`, which took 99 seconds here.
90
+
83
91
  ### Two builds, one source
84
92
 
85
93
  `make` emits **both** `libav.wasm` and `libav-jspi.wasm`, and the worker picks between them at runtime on
@@ -97,10 +105,10 @@ byte-identical output, not merely "it ran".
97
105
 
98
106
  ## Tests
99
107
 
100
- `npm test` runs a browser suite against fixtures it synthesizes with ffmpeg on first run. Nothing is
101
- committed and nothing is anyone's content, so there is no copyright question and no multi-megabyte blob in
102
- git history: what matters for a remuxer is a file's structure, and every fixture exists because a real bug
103
- needed exactly that structure to show up.
108
+ `npm test` runs a browser suite against fixtures it synthesizes with ffmpeg (and mkvmerge, for the files with
109
+ two chapter editions) on first run. Nothing is committed and nothing is anyone's content, so there is no
110
+ copyright question and no multi-megabyte blob in git history: what matters for a remuxer is a file's
111
+ structure, and every fixture exists because a real bug needed exactly that structure to show up.
104
112
 
105
113
  Each fixture encodes its own timestamp in the frame's colour, so a decoded thumbnail can be checked back to
106
114
  the second it came from. Without that the only available assertion is "some bytes came back", which is how
package/build/index.d.ts CHANGED
@@ -99,6 +99,7 @@ export declare const makeRemuxer: (options: MakeTransmuxerOptions) => Promise<{
99
99
  pos: number;
100
100
  }[];
101
101
  videoExtradata: ArrayBuffer;
102
+ timestampOffset: number;
102
103
  }>;
103
104
  destroy: () => Promise<void>;
104
105
  seek: (timestamp: number) => Promise<{
package/build/index.js CHANGED
@@ -1,7 +1,6 @@
1
- //#region \0/home/runner/work/libav-wasm/libav-wasm/node_modules/eventemitter3/index.js?commonjs-module
1
+ // \0/home/runner/work/libav-wasm/libav-wasm/node_modules/eventemitter3/index.js?commonjs-module
2
2
  var eventemitter3Exports = {};
3
- //#endregion
4
- //#region node_modules/eventemitter3/index.js
3
+ // node_modules/eventemitter3/index.js
5
4
  (function(module) {
6
5
  "use strict";
7
6
  var has = Object.prototype.hasOwnProperty, prefix = "~";
@@ -244,8 +243,7 @@ var eventemitter3Exports = {};
244
243
  }
245
244
  });
246
245
  var eventemitter3_default = eventemitter3Exports;
247
- //#endregion
248
- //#region node_modules/p-timeout/index.js
246
+ // node_modules/p-timeout/index.js
249
247
  var TimeoutError = class extends Error {
250
248
  constructor(message) {
251
249
  super(message);
@@ -326,8 +324,7 @@ function pTimeout(promise, milliseconds, fallback, options) {
326
324
  };
327
325
  return cancelablePromise;
328
326
  }
329
- //#endregion
330
- //#region node_modules/p-queue/dist/lower-bound.js
327
+ // node_modules/p-queue/dist/lower-bound.js
331
328
  function lowerBound(array, value, comparator) {
332
329
  let first = 0;
333
330
  let count = array.length;
@@ -341,8 +338,7 @@ function lowerBound(array, value, comparator) {
341
338
  }
342
339
  return first;
343
340
  }
344
- //#endregion
345
- //#region node_modules/p-queue/dist/priority-queue.js
341
+ // node_modules/p-queue/dist/priority-queue.js
346
342
  var __classPrivateFieldGet$1 = function(receiver, state, kind, f) {
347
343
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
348
344
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
@@ -381,8 +377,7 @@ var PriorityQueue = class {
381
377
  }
382
378
  };
383
379
  _PriorityQueue_queue = /* @__PURE__ */ new WeakMap();
384
- //#endregion
385
- //#region node_modules/p-queue/dist/index.js
380
+ // node_modules/p-queue/dist/index.js
386
381
  var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
387
382
  if (kind === "m") throw new TypeError("Private method is not writable");
388
383
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -677,8 +672,7 @@ _PQueue_carryoverConcurrencyCount = /* @__PURE__ */ new WeakMap(), _PQueue_isInt
677
672
  this.on(event, listener);
678
673
  });
679
674
  };
680
- //#endregion
681
- //#region node_modules/osra/build/index.js
675
+ // node_modules/osra/build/index.js
682
676
  var e = Object.defineProperty;
683
677
  var t = (t, n) => {
684
678
  let r = {};
@@ -2778,8 +2772,7 @@ var ai = (e, { transport: t, name: i, remoteName: a, key: o = r, origin: s = "*"
2778
2772
  return $r(b, y, h);
2779
2773
  };
2780
2774
  var oi = (e, t) => ai(e, t);
2781
- //#endregion
2782
- //#region src/utils.ts
2775
+ // src/utils.ts
2783
2776
  function debounceImmediateAndLatest(wait, func) {
2784
2777
  let timeoutId = null;
2785
2778
  let lastArgs = null;
@@ -2849,8 +2842,7 @@ var queuedThrottleWithLastCall = (time, func) => {
2849
2842
  } else return lastCall;
2850
2843
  };
2851
2844
  };
2852
- //#endregion
2853
- //#region src/index.ts
2845
+ // src/index.ts
2854
2846
  /**
2855
2847
  * The codecs a browser might take in an mp4, and the string to ask about each one by.
2856
2848
  *
@@ -3014,5 +3006,4 @@ var makeThumbnailer = async (options) => {
3014
3006
  destroy
3015
3007
  };
3016
3008
  };
3017
- //#endregion
3018
3009
  export { debounceImmediateAndLatest, makeRemuxer, makeThumbnailer, queuedThrottleWithLastCall, supportedAudioCodecs };
Binary file
package/build/libav.wasm CHANGED
Binary file
package/build/worker.d.ts CHANGED
@@ -120,6 +120,7 @@ export interface RemuxerInstance {
120
120
  };
121
121
  };
122
122
  videoExtradata: WASMVector<number>;
123
+ timestampOffset: number;
123
124
  }>;
124
125
  destroy: () => void;
125
126
  seek: (read: WASMReadFunction, timestamp: number) => Promise<{
@@ -177,6 +178,11 @@ export type Remuxer = {
177
178
  chapters: Chapter[];
178
179
  indexes: Index[];
179
180
  videoExtradata: ArrayBuffer;
181
+ /**
182
+ * What the SourceBuffer's timestampOffset is set to, once, before the first append: every fragment, at load and
183
+ * after any seek, carries each track's content time minus this.
184
+ */
185
+ timestampOffset: number;
180
186
  }>;
181
187
  destroy: () => void;
182
188
  seek: (read: WASMReadFunction, timestamp: number) => Promise<{
@@ -253,6 +259,11 @@ declare const resolvers: {
253
259
  chapters: Chapter[];
254
260
  indexes: Index[];
255
261
  videoExtradata: ArrayBuffer;
262
+ /**
263
+ * What the SourceBuffer's timestampOffset is set to, once, before the first append: every fragment, at load and
264
+ * after any seek, carries each track's content time minus this.
265
+ */
266
+ timestampOffset: number;
256
267
  }>;
257
268
  initThumbnail: (read: ReadFunction) => Promise<{
258
269
  duration: number;
package/build/worker.js CHANGED
@@ -1,4 +1,4 @@
1
- //#region node_modules/osra/build/index.js
1
+ // node_modules/osra/build/index.js
2
2
  var e = Object.defineProperty, t = (t, n) => {
3
3
  let r = {};
4
4
  for (var i in t) e(r, i, {
@@ -462,24 +462,23 @@ var e = Object.defineProperty, t = (t, n) => {
462
462
  mt.set(e, t), e.eventTarget.addEventListener("message", ({ detail: n }) => {
463
463
  if (n.type !== "message" && n.type !== "message-port-close" || t.tombstones.has(n.portId)) return;
464
464
  let r = t.ports.get(n.portId);
465
- if (n.seq === void 0) {
466
- r?.handler?.(n);
467
- return;
468
- }
469
- if (!r) {
470
- if (t.pendingPorts >= pt) return;
471
- r = gt(t, n.portId);
472
- }
473
- if (!(n.seq < r.nextSeq)) {
474
- if (r.buffer.size >= ft && !(n.seq === r.nextSeq && r.handler)) {
475
- r.buffer.clear(), _t(t, n.portId), r.handler?.({
476
- type: "message-port-close",
477
- remoteUuid: e.remoteUuid,
478
- portId: n.portId
479
- });
480
- return;
465
+ if (n.seq === void 0) r?.handler?.(n);
466
+ else {
467
+ if (!r) {
468
+ if (t.pendingPorts >= pt) return;
469
+ r = gt(t, n.portId);
470
+ }
471
+ if (!(n.seq < r.nextSeq)) {
472
+ if (r.buffer.size >= ft && !(n.seq === r.nextSeq && r.handler)) {
473
+ r.buffer.clear(), _t(t, n.portId), r.handler?.({
474
+ type: "message-port-close",
475
+ remoteUuid: e.remoteUuid,
476
+ portId: n.portId
477
+ });
478
+ return;
479
+ }
480
+ r.buffer.set(n.seq, n), vt(r);
481
481
  }
482
- r.buffer.set(n.seq, n), vt(r);
483
482
  }
484
483
  }), Je(e, () => {
485
484
  for (let [n, r] of [...t.ports]) r.handler?.({
@@ -538,11 +537,7 @@ var e = Object.defineProperty, t = (t, n) => {
538
537
  let t = s.deref();
539
538
  t?.removeEventListener("message", p), t instanceof R && (t._onClose = void 0);
540
539
  }, f = (e) => {
541
- if (e.type === "message-port-close") {
542
- d(), a.dispatchEvent(new Event("close")), a.close();
543
- return;
544
- }
545
- Tt(e.data, t, (e) => wt(a, e, !1), () => {});
540
+ e.type === "message-port-close" ? (d(), a.dispatchEvent(new Event("close")), a.close()) : Tt(e.data, t, (e) => wt(a, e, !1), () => {});
546
541
  };
547
542
  function p({ data: e }) {
548
543
  t.sendMessage({
@@ -582,21 +577,13 @@ var e = Object.defineProperty, t = (t, n) => {
582
577
  let a = nt(() => Z(r, t)), o = ct(a), s = Array.isArray(i) ? i : [], c = s.length ? [...o, ...s] : o, l = () => {
583
578
  e.postMessage(a, c), H(c);
584
579
  };
585
- if (n && !n.shipped) {
586
- n.pending.push(l);
587
- return;
588
- }
589
- l();
580
+ n && !n.shipped ? n.pending.push(l) : l();
590
581
  }, r.start = () => e.start();
591
582
  let s = () => {
592
583
  e.removeEventListener("message", i), e.removeEventListener("messageerror", a), e.removeEventListener("close", o), e.close();
593
584
  };
594
585
  return r.close = () => {
595
- if (n && !n.shipped) {
596
- n.pending.push(s);
597
- return;
598
- }
599
- s();
586
+ n && !n.shipped ? n.pending.push(s) : s();
600
587
  }, r;
601
588
  }, Ft = (e) => {
602
589
  if (O(e.transport)) {
@@ -681,15 +668,11 @@ var e = Object.defineProperty, t = (t, n) => {
681
668
  let a, o = () => {
682
669
  n.close(), Bt.delete(n), a?.();
683
670
  };
684
- if (r && Ye(t)) {
685
- i(/* @__PURE__ */ Error("osra: connection closed")), o();
686
- return;
687
- }
688
- a = r ? Je(t, () => {
671
+ r && Ye(t) ? (i(/* @__PURE__ */ Error("osra: connection closed")), o()) : (a = r ? Je(t, () => {
689
672
  i(/* @__PURE__ */ Error("osra: connection closed")), o();
690
673
  }) : void 0, n.addEventListener("message", ({ data: t }) => {
691
674
  t.type === "resolve" ? e(t.data) : i(t.error), o();
692
- }, { once: !0 }), n.start();
675
+ }, { once: !0 }), n.start());
693
676
  });
694
677
  }, Ut = /* @__PURE__ */ t({
695
678
  box: () => Jt,
@@ -1478,11 +1461,7 @@ var e = Object.defineProperty, t = (t, n) => {
1478
1461
  revive: (e, t) => ({})
1479
1462
  }
1480
1463
  ], Ar = (e, t) => t.find((t) => t.type === e.type), jr = (e) => !!e && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype, Mr = (e, t) => Array.isArray(e) ? e.map((e) => t(e)) : jr(e) ? Object.fromEntries(Object.entries(e).map(([e, n]) => [e, t(n)])) : e, Nr = /* @__PURE__ */ new WeakSet(), Pr = /* @__PURE__ */ new WeakSet(), Fr = 0, Ir = [], Lr = (e, t) => {
1481
- if (Fr === 0) {
1482
- e();
1483
- return;
1484
- }
1485
- Ir.push({
1464
+ Fr === 0 ? e() : Ir.push({
1486
1465
  commit: e,
1487
1466
  rollback: t
1488
1467
  });
@@ -1681,14 +1660,10 @@ var e = Object.defineProperty, t = (t, n) => {
1681
1660
  }
1682
1661
  for (let e of t) {
1683
1662
  let t = e.wake;
1684
- if (t) {
1685
- e.wake = void 0, t({
1686
- value: r,
1687
- done: !1
1688
- });
1689
- continue;
1690
- }
1691
- e.buffered.push(r);
1663
+ t ? (e.wake = void 0, t({
1664
+ value: r,
1665
+ done: !1
1666
+ })) : e.buffered.push(r);
1692
1667
  }
1693
1668
  }
1694
1669
  },
@@ -1780,14 +1755,10 @@ var e = Object.defineProperty, t = (t, n) => {
1780
1755
  rejectRemoteValue: S,
1781
1756
  abortConnection: (e) => {
1782
1757
  let t = _.get(e);
1783
- if (!t) {
1784
- v.add(e);
1785
- return;
1786
- }
1787
- _.delete(e), w({
1758
+ t ? (_.delete(e), w({
1788
1759
  type: "close",
1789
1760
  remoteUuid: e
1790
- }), Xe(t.connection.revivableContext), S(/* @__PURE__ */ Error("osra: connection aborted"));
1761
+ }), Xe(t.connection.revivableContext), S(/* @__PURE__ */ Error("osra: connection aborted"))) : v.add(e);
1791
1762
  },
1792
1763
  claimPendingAbort: (e) => v.delete(e),
1793
1764
  addConnection: (e, t) => {
@@ -1828,8 +1799,7 @@ var e = Object.defineProperty, t = (t, n) => {
1828
1799
  for (let e of $r) e.init(te);
1829
1800
  return Xr(b, y, h);
1830
1801
  }, ti = (e, t) => ei(e, t), ni = {};
1831
- //#endregion
1832
- //#region dist/libav.js
1802
+ // dist/libav.js
1833
1803
  (function(e, t) {
1834
1804
  var n = (() => {
1835
1805
  var e = typeof document < "u" ? document.currentScript?.src : void 0;
@@ -1951,20 +1921,18 @@ var e = Object.defineProperty, t = (t, n) => {
1951
1921
  if (i - t > 16 && e.buffer && Te) return Te.decode(e.subarray(t, i));
1952
1922
  for (var a = ""; t < i;) {
1953
1923
  var o = e[t++];
1954
- if (!(o & 128)) {
1955
- a += String.fromCharCode(o);
1956
- continue;
1957
- }
1958
- var s = e[t++] & 63;
1959
- if ((o & 224) == 192) {
1960
- a += String.fromCharCode((o & 31) << 6 | s);
1961
- continue;
1962
- }
1963
- var c = e[t++] & 63;
1964
- if (o = (o & 240) == 224 ? (o & 15) << 12 | s << 6 | c : (o & 7) << 18 | s << 12 | c << 6 | e[t++] & 63, o < 65536) a += String.fromCharCode(o);
1924
+ if (!(o & 128)) a += String.fromCharCode(o);
1965
1925
  else {
1966
- var l = o - 65536;
1967
- a += String.fromCharCode(55296 | l >> 10, 56320 | l & 1023);
1926
+ var s = e[t++] & 63;
1927
+ if ((o & 224) == 192) a += String.fromCharCode((o & 31) << 6 | s);
1928
+ else {
1929
+ var c = e[t++] & 63;
1930
+ if (o = (o & 240) == 224 ? (o & 15) << 12 | s << 6 | c : (o & 7) << 18 | s << 12 | c << 6 | e[t++] & 63, o < 65536) a += String.fromCharCode(o);
1931
+ else {
1932
+ var l = o - 65536;
1933
+ a += String.fromCharCode(55296 | l >> 10, 56320 | l & 1023);
1934
+ }
1935
+ }
1968
1936
  }
1969
1937
  }
1970
1938
  return a;
@@ -2209,7 +2177,7 @@ var e = Object.defineProperty, t = (t, n) => {
2209
2177
  }, xt = {}, St = {}, Ct = (e, t) => {
2210
2178
  for (t === void 0 && z("ptr should not be undefined"); e.baseClass;) t = e.upcast(t), e = e.baseClass;
2211
2179
  return t;
2212
- }, wt = (e, t) => (t = Ct(e, t), St[t]), Tt = (e, t) => ((!t.ptrType || !t.ptr) && rt("makeClassHandle requires ptr and ptrType"), !!t.smartPtrType != !!t.smartPtr && rt("Both smartPtrType and smartPtr must be specified"), t.count = { value: 1 }, Dt(Object.create(e, { $$: {
2180
+ }, wt = (e, t) => (t = Ct(e, t), St[t]), Tt = (e, t) => (t.ptrType && t.ptr || rt("makeClassHandle requires ptr and ptrType"), !!t.smartPtrType != !!t.smartPtr && rt("Both smartPtrType and smartPtr must be specified"), t.count = { value: 1 }, Dt(Object.create(e, { $$: {
2213
2181
  value: t,
2214
2182
  writable: !0
2215
2183
  } })));
@@ -2317,7 +2285,7 @@ var e = Object.defineProperty, t = (t, n) => {
2317
2285
  function U(e, t) {
2318
2286
  var n;
2319
2287
  if (t === null) return this.isReference && z(`null is not a valid ${this.name}`), this.isSmartPointer ? (n = this.rawConstructor(), e !== null && e.push(this.rawDestructor, n), n) : 0;
2320
- (!t || !t.$$) && z(`Cannot pass "${ot(t)}" as a ${this.name}`), t.$$.ptr || z(`Cannot pass deleted object as a pointer of type ${this.name}`), !this.isConst && t.$$.ptrType.isConst && z(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);
2288
+ t && t.$$ || z(`Cannot pass "${ot(t)}" as a ${this.name}`), t.$$.ptr || z(`Cannot pass deleted object as a pointer of type ${this.name}`), !this.isConst && t.$$.ptrType.isConst && z(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);
2321
2289
  var r = t.$$.ptrType.registeredClass;
2322
2290
  if (n = zt(t.$$.ptr, r, this.registeredClass), this.isSmartPointer) switch (t.$$.smartPtr === void 0 && z("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) {
2323
2291
  case 0:
@@ -2387,13 +2355,7 @@ var e = Object.defineProperty, t = (t, n) => {
2387
2355
  }, Zt = (e, t) => {
2388
2356
  var n = [], r = {};
2389
2357
  function i(e) {
2390
- if (!r[e] && !L[e]) {
2391
- if (tt[e]) {
2392
- tt[e].forEach(i);
2393
- return;
2394
- }
2395
- n.push(e), r[e] = !0;
2396
- }
2358
+ r[e] || L[e] || (tt[e] ? tt[e].forEach(i) : (n.push(e), r[e] = !0));
2397
2359
  }
2398
2360
  throw t.forEach(i), new Yt(`${e}: ` + n.map(Xt).join([", "]));
2399
2361
  }, Qt = (e, t, n, r, i, a, o, s, c, l, u, d, f) => {
@@ -3080,7 +3042,7 @@ var e = Object.defineProperty, t = (t, n) => {
3080
3042
  l: Ln,
3081
3043
  za: Rn,
3082
3044
  ka: zn,
3083
- w: Hn,
3045
+ x: Hn,
3084
3046
  oa: Un,
3085
3047
  I: Gn,
3086
3048
  va: gn,
@@ -3101,7 +3063,7 @@ var e = Object.defineProperty, t = (t, n) => {
3101
3063
  N: Sr,
3102
3064
  $: Dr,
3103
3065
  aa: Or,
3104
- v: kr,
3066
+ w: kr,
3105
3067
  _: Ar,
3106
3068
  G: jr,
3107
3069
  Z: Mr,
@@ -3112,7 +3074,7 @@ var e = Object.defineProperty, t = (t, n) => {
3112
3074
  K: Ei,
3113
3075
  b: bi,
3114
3076
  d: vi,
3115
- x: Ci,
3077
+ v: Ci,
3116
3078
  wa: ki,
3117
3079
  xa: Oi,
3118
3080
  A: Si,
@@ -3143,13 +3105,13 @@ var e = Object.defineProperty, t = (t, n) => {
3143
3105
  var oi = r.dynCall_iiiji = Y.Vb;
3144
3106
  r.dynCall_iiijjji = Y.Wb, r.dynCall_jiiij = Y.Xb, r.dynCall_iiiiij = Y.Yb, r.dynCall_iiiiiij = Y.Zb, r.dynCall_jiiji = Y._b;
3145
3107
  var si = r.dynCall_viiid = Y.$b, ci = r.dynCall_viiidii = Y.ac;
3146
- r.dynCall_viif = Y.bc, r.dynCall_dii = Y.cc, r.dynCall_viid = Y.dc, r.dynCall_diji = Y.ec, r.dynCall_iiiid = Y.fc;
3147
- var li = r.dynCall_iid = Y.gc, ui = r.dynCall_iiiiiiiiiii = Y.hc;
3148
- r.dynCall_iiiidii = Y.ic;
3149
- var di = r.dynCall_di = Y.jc, fi = r.dynCall_vid = Y.kc, pi = r.dynCall_vij = Y.lc;
3150
- r.dynCall_diiii = Y.mc, r.dynCall_iidiiii = Y.nc;
3151
- var mi = Y.oc, hi = Y.pc, gi = Y.qc, _i = Y.rc;
3152
- r._ff_h264_cabac_tables = 1216105;
3108
+ r.dynCall_dii = Y.bc, r.dynCall_viid = Y.cc, r.dynCall_diji = Y.dc, r.dynCall_iiiid = Y.ec;
3109
+ var li = r.dynCall_iid = Y.fc, ui = r.dynCall_iiiiiiiiiii = Y.gc;
3110
+ r.dynCall_iiiidii = Y.hc;
3111
+ var di = r.dynCall_di = Y.ic, fi = r.dynCall_vid = Y.jc, pi = r.dynCall_vij = Y.kc;
3112
+ r.dynCall_diiii = Y.lc, r.dynCall_iidiiii = Y.mc;
3113
+ var mi = Y.nc, hi = Y.oc, gi = Y.pc, _i = Y.qc;
3114
+ r._ff_h264_cabac_tables = 1216169;
3153
3115
  function vi(e, t, n, r) {
3154
3116
  var i = j();
3155
3117
  try {
@@ -3332,11 +3294,7 @@ var e = Object.defineProperty, t = (t, n) => {
3332
3294
  }
3333
3295
  r.getExceptionMessage = Rr;
3334
3296
  function Ri() {
3335
- if (D > 0) {
3336
- ce = Ri;
3337
- return;
3338
- }
3339
- if (ae(), D > 0) {
3297
+ if (D > 0 || (ae(), D > 0)) {
3340
3298
  ce = Ri;
3341
3299
  return;
3342
3300
  }
@@ -3361,8 +3319,7 @@ var e = Object.defineProperty, t = (t, n) => {
3361
3319
  }
3362
3320
  }, ni);
3363
3321
  var ri = ni, ii = {};
3364
- //#endregion
3365
- //#region dist/libav-jspi.js
3322
+ // dist/libav-jspi.js
3366
3323
  (function(e, t) {
3367
3324
  var n = (() => {
3368
3325
  var e = typeof document < "u" ? document.currentScript?.src : void 0;
@@ -3481,20 +3438,18 @@ var ri = ni, ii = {};
3481
3438
  if (i - t > 16 && e.buffer && Se) return Se.decode(e.subarray(t, i));
3482
3439
  for (var a = ""; t < i;) {
3483
3440
  var o = e[t++];
3484
- if (!(o & 128)) {
3485
- a += String.fromCharCode(o);
3486
- continue;
3487
- }
3488
- var s = e[t++] & 63;
3489
- if ((o & 224) == 192) {
3490
- a += String.fromCharCode((o & 31) << 6 | s);
3491
- continue;
3492
- }
3493
- var c = e[t++] & 63;
3494
- if (o = (o & 240) == 224 ? (o & 15) << 12 | s << 6 | c : (o & 7) << 18 | s << 12 | c << 6 | e[t++] & 63, o < 65536) a += String.fromCharCode(o);
3441
+ if (!(o & 128)) a += String.fromCharCode(o);
3495
3442
  else {
3496
- var l = o - 65536;
3497
- a += String.fromCharCode(55296 | l >> 10, 56320 | l & 1023);
3443
+ var s = e[t++] & 63;
3444
+ if ((o & 224) == 192) a += String.fromCharCode((o & 31) << 6 | s);
3445
+ else {
3446
+ var c = e[t++] & 63;
3447
+ if (o = (o & 240) == 224 ? (o & 15) << 12 | s << 6 | c : (o & 7) << 18 | s << 12 | c << 6 | e[t++] & 63, o < 65536) a += String.fromCharCode(o);
3448
+ else {
3449
+ var l = o - 65536;
3450
+ a += String.fromCharCode(55296 | l >> 10, 56320 | l & 1023);
3451
+ }
3452
+ }
3498
3453
  }
3499
3454
  }
3500
3455
  return a;
@@ -3681,7 +3636,7 @@ var ri = ni, ii = {};
3681
3636
  }, R = {}, lt = {}, z = (e, t) => {
3682
3637
  for (t === void 0 && P("ptr should not be undefined"); e.baseClass;) t = e.upcast(t), e = e.baseClass;
3683
3638
  return t;
3684
- }, ut = (e, t) => (t = z(e, t), lt[t]), B = (e, t) => ((!t.ptrType || !t.ptr) && Ke("makeClassHandle requires ptr and ptrType"), !!t.smartPtrType != !!t.smartPtr && Ke("Both smartPtrType and smartPtr must be specified"), t.count = { value: 1 }, ft(Object.create(e, { $$: {
3639
+ }, ut = (e, t) => (t = z(e, t), lt[t]), B = (e, t) => (t.ptrType && t.ptr || Ke("makeClassHandle requires ptr and ptrType"), !!t.smartPtrType != !!t.smartPtr && Ke("Both smartPtrType and smartPtr must be specified"), t.count = { value: 1 }, ft(Object.create(e, { $$: {
3685
3640
  value: t,
3686
3641
  writable: !0
3687
3642
  } })));
@@ -3789,7 +3744,7 @@ var ri = ni, ii = {};
3789
3744
  function Et(e, t) {
3790
3745
  var n;
3791
3746
  if (t === null) return this.isReference && P(`null is not a valid ${this.name}`), this.isSmartPointer ? (n = this.rawConstructor(), e !== null && e.push(this.rawDestructor, n), n) : 0;
3792
- (!t || !t.$$) && P(`Cannot pass "${Ye(t)}" as a ${this.name}`), t.$$.ptr || P(`Cannot pass deleted object as a pointer of type ${this.name}`), !this.isConst && t.$$.ptrType.isConst && P(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);
3747
+ t && t.$$ || P(`Cannot pass "${Ye(t)}" as a ${this.name}`), t.$$.ptr || P(`Cannot pass deleted object as a pointer of type ${this.name}`), !this.isConst && t.$$.ptrType.isConst && P(`Cannot convert argument of type ${t.$$.smartPtrType ? t.$$.smartPtrType.name : t.$$.ptrType.name} to parameter type ${this.name}`);
3793
3748
  var r = t.$$.ptrType.registeredClass;
3794
3749
  if (n = wt(t.$$.ptr, r, this.registeredClass), this.isSmartPointer) switch (t.$$.smartPtr === void 0 && P("Passing raw pointer to smart pointer is illegal"), this.sharingPolicy) {
3795
3750
  case 0:
@@ -3858,13 +3813,7 @@ var ri = ni, ii = {};
3858
3813
  }, Lt = (e, t) => {
3859
3814
  var n = [], r = {};
3860
3815
  function i(e) {
3861
- if (!r[e] && !M[e]) {
3862
- if (We[e]) {
3863
- We[e].forEach(i);
3864
- return;
3865
- }
3866
- n.push(e), r[e] = !0;
3867
- }
3816
+ r[e] || M[e] || (We[e] ? We[e].forEach(i) : (n.push(e), r[e] = !0));
3868
3817
  }
3869
3818
  throw t.forEach(i), new Ft(`${e}: ` + n.map(It).join([", "]));
3870
3819
  }, Rt = (e, t, n, r, i, a, o, s, c, l, u, d, f) => {
@@ -4481,13 +4430,9 @@ var ri = ni, ii = {};
4481
4430
  }, J = await _e();
4482
4431
  J.__wasm_call_ctors;
4483
4432
  var br = J.__getTypeName, xr = J.free, Sr = J.malloc, Cr = J.__trap, wr = J._emscripten_stack_restore, Tr = J._emscripten_stack_alloc, Er = J.emscripten_stack_get_current, Dr = J.__cxa_decrement_exception_refcount, Or = J.__cxa_increment_exception_refcount, kr = J.__thrown_object_from_unwind_exception, Ar = J.__get_exception_message;
4484
- r._ff_h264_cabac_tables = 1216265, r.getExceptionMessage = vr;
4433
+ r._ff_h264_cabac_tables = 1216329, r.getExceptionMessage = vr;
4485
4434
  function jr() {
4486
- if (se > 0) {
4487
- D = jr;
4488
- return;
4489
- }
4490
- if (ie(), se > 0) {
4435
+ if (se > 0 || (ie(), se > 0)) {
4491
4436
  D = jr;
4492
4437
  return;
4493
4438
  }
@@ -4560,6 +4505,7 @@ ti({ makeRemuxer: async ({ publicPath: e, length: t, bufferSize: n, audioStreamI
4560
4505
  let t = new Uint8Array(e.data.byteLength);
4561
4506
  return t.set(e.data), {
4562
4507
  data: t.buffer,
4508
+ timestampOffset: e.timestampOffset,
4563
4509
  videoExtradata: new Uint8Array(ci(e.videoExtradata)).buffer,
4564
4510
  attachments: ci(e.attachments).map((e) => {
4565
4511
  let t = new Uint8Array(a.HEAPU8.buffer, e.ptr, e.size), n = new Uint8Array(t);
@@ -4729,7 +4675,7 @@ ti({ makeRemuxer: async ({ publicPath: e, length: t, bufferSize: n, audioStreamI
4729
4675
  }
4730
4676
  let n = await s.readKeyframe(c(e), t);
4731
4677
  if (!n.data?.byteLength) throw Error("empty keyframe data");
4732
- if ((!h || h.state === "closed") && (h = m()), h.state === "unconfigured") {
4678
+ if (h && h.state !== "closed" || (h = m()), h.state === "unconfigured") {
4733
4679
  if (!d) throw Error("decoder not configured");
4734
4680
  h.configure(d);
4735
4681
  }
@@ -4747,4 +4693,3 @@ ti({ makeRemuxer: async ({ publicPath: e, length: t, bufferSize: n, audioStreamI
4747
4693
  }
4748
4694
  };
4749
4695
  } }, { transport: globalThis });
4750
- //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libav-wasm",
3
- "version": "0.8.12",
3
+ "version": "0.8.14",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/banou26/libav-wasm.git"
@@ -16,7 +16,7 @@
16
16
  "dev-wasm-cmd": "nodemon -e cpp --exec \"npm run make-docker-debug\"",
17
17
  "dev-wasm": "concurrently \"nodemon -e cpp --exec \\\"npm run make-docker-debug\\\"\"",
18
18
  "build-worker": "vp build --config vite-worker.config.ts",
19
- "make-docker": "docker compose run --rm libav-wasm make",
19
+ "make-docker": "docker compose run --build --rm libav-wasm make",
20
20
  "docker-clean": "docker compose up --remove-orphans",
21
21
  "dev-web": "vp dev --port 1234",
22
22
  "vite-build": "vp build",
@@ -27,7 +27,7 @@
27
27
  "types": "tsc",
28
28
  "copy-wasm": "copyfiles -u 1 dist/libav.wasm dist/libav-jspi.wasm build && shx mv ./build/worker/index.d.ts ./build/worker.d.ts && shx rm -rf ./build/worker",
29
29
  "preview": "vp preview",
30
- "make-docker-debug": "docker compose run --rm libav-wasm make DEBUG=1",
30
+ "make-docker-debug": "docker compose run --build --rm libav-wasm make DEBUG=1",
31
31
  "fixtures": "node scripts/fixtures.mjs",
32
32
  "test": "playwright test",
33
33
  "test:large": "LIBAV_LARGE_FIXTURE=1 playwright test"
@@ -38,16 +38,16 @@
38
38
  "@types/emscripten": "^1.40.0",
39
39
  "concurrently": "^7.6.0",
40
40
  "copyfiles": "^2.4.1",
41
- "nodemon": "^2.0.22",
41
+ "nodemon": "^3.1.14",
42
42
  "osra": "^0.6.12",
43
43
  "p-queue": "^7.3.0",
44
44
  "shx": "^0.3.4",
45
45
  "typescript": "^7.0.2",
46
- "vite": "npm:@voidzero-dev/vite-plus-core@0.3.3",
47
- "vite-plus": "0.3.3"
46
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
47
+ "vite-plus": "1.4.0"
48
48
  },
49
49
  "overrides": {
50
- "vite": "npm:@voidzero-dev/vite-plus-core@0.3.3",
51
- "vitest": "4.1.11"
50
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
51
+ "vitest": "5.0.5"
52
52
  }
53
53
  }