@remotion/media-parser 4.0.277 → 4.0.278

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 (260) hide show
  1. package/dist/aac-codecprivate.js +13 -6
  2. package/dist/add-avc-profile-to-track.js +9 -5
  3. package/dist/buffer-iterator.js +13 -8
  4. package/dist/combine-uint8-arrays.js +5 -1
  5. package/dist/containers/aac/parse-aac.js +13 -9
  6. package/dist/containers/aac/types.js +2 -1
  7. package/dist/containers/avc/codec-string.js +5 -1
  8. package/dist/containers/avc/color.js +9 -3
  9. package/dist/containers/avc/create-sps-pps-data.js +9 -5
  10. package/dist/containers/avc/interpret-sps.js +13 -7
  11. package/dist/containers/avc/key.js +5 -1
  12. package/dist/containers/avc/parse-avc.js +7 -3
  13. package/dist/containers/avc/sps-and-pps.js +5 -1
  14. package/dist/containers/flac/get-block-size.js +5 -1
  15. package/dist/containers/flac/get-channel-count.js +5 -1
  16. package/dist/containers/flac/get-duration-from-flac.js +5 -1
  17. package/dist/containers/flac/get-metadata-from-flac.js +5 -1
  18. package/dist/containers/flac/get-sample-rate.js +5 -1
  19. package/dist/containers/flac/parse-flac-frame.js +19 -14
  20. package/dist/containers/flac/parse-flac.js +19 -15
  21. package/dist/containers/flac/parse-header.js +5 -1
  22. package/dist/containers/flac/parse-metadata.js +5 -1
  23. package/dist/containers/flac/parse-streaminfo.js +7 -3
  24. package/dist/containers/flac/parse-unknown-block.js +5 -1
  25. package/dist/containers/flac/types.js +2 -1
  26. package/dist/containers/iso-base-media/base-media-box.js +2 -1
  27. package/dist/containers/iso-base-media/base-type.js +2 -1
  28. package/dist/containers/iso-base-media/esds/decoder-specific-config.js +5 -1
  29. package/dist/containers/iso-base-media/esds/esds-descriptors.js +10 -5
  30. package/dist/containers/iso-base-media/esds/esds.js +7 -3
  31. package/dist/containers/iso-base-media/ftyp.js +5 -1
  32. package/dist/containers/iso-base-media/get-actual-number-of-channels.js +8 -4
  33. package/dist/containers/iso-base-media/get-children.js +7 -3
  34. package/dist/containers/iso-base-media/get-keyframes.js +11 -7
  35. package/dist/containers/iso-base-media/get-moov-atom.js +17 -13
  36. package/dist/containers/iso-base-media/get-sample-positions-from-track.js +24 -20
  37. package/dist/containers/iso-base-media/get-video-codec-from-iso-track.js +7 -3
  38. package/dist/containers/iso-base-media/make-track.js +34 -30
  39. package/dist/containers/iso-base-media/mdat/mdat.js +20 -16
  40. package/dist/containers/iso-base-media/mdhd.js +5 -1
  41. package/dist/containers/iso-base-media/meta/hdlr.js +5 -1
  42. package/dist/containers/iso-base-media/meta/ilst.js +5 -1
  43. package/dist/containers/iso-base-media/moov/moov.js +7 -3
  44. package/dist/containers/iso-base-media/mvhd.js +11 -7
  45. package/dist/containers/iso-base-media/parse-boxes.js +9 -5
  46. package/dist/containers/iso-base-media/parse-icc-profile.js +8 -4
  47. package/dist/containers/iso-base-media/process-box.js +67 -63
  48. package/dist/containers/iso-base-media/stsd/av1c.js +5 -1
  49. package/dist/containers/iso-base-media/stsd/avcc.js +5 -1
  50. package/dist/containers/iso-base-media/stsd/colr.js +7 -3
  51. package/dist/containers/iso-base-media/stsd/ctts.js +5 -1
  52. package/dist/containers/iso-base-media/stsd/hvcc.js +7 -3
  53. package/dist/containers/iso-base-media/stsd/keys.js +5 -1
  54. package/dist/containers/iso-base-media/stsd/mebx.js +7 -3
  55. package/dist/containers/iso-base-media/stsd/pasp.js +5 -1
  56. package/dist/containers/iso-base-media/stsd/samples.js +13 -8
  57. package/dist/containers/iso-base-media/stsd/stco.js +5 -1
  58. package/dist/containers/iso-base-media/stsd/stsc.js +5 -1
  59. package/dist/containers/iso-base-media/stsd/stsd.js +7 -3
  60. package/dist/containers/iso-base-media/stsd/stss.js +5 -1
  61. package/dist/containers/iso-base-media/stsd/stsz.js +5 -1
  62. package/dist/containers/iso-base-media/stsd/stts.js +5 -1
  63. package/dist/containers/iso-base-media/tfdt.js +5 -1
  64. package/dist/containers/iso-base-media/tfhd.js +5 -1
  65. package/dist/containers/iso-base-media/tkhd.js +8 -4
  66. package/dist/containers/iso-base-media/to-date.js +5 -1
  67. package/dist/containers/iso-base-media/trak/trak.js +7 -3
  68. package/dist/containers/iso-base-media/traversal.js +57 -33
  69. package/dist/containers/iso-base-media/trun.js +5 -1
  70. package/dist/containers/iso-base-media/void-box.js +2 -1
  71. package/dist/containers/m3u/after-manifest-fetch.js +15 -11
  72. package/dist/containers/m3u/fetch-m3u8-stream.js +7 -3
  73. package/dist/containers/m3u/get-chunks.js +5 -1
  74. package/dist/containers/m3u/get-duration-from-m3u.js +8 -4
  75. package/dist/containers/m3u/get-playlist.js +12 -6
  76. package/dist/containers/m3u/get-streams.js +9 -3
  77. package/dist/containers/m3u/iterate-over-segment-files.js +15 -11
  78. package/dist/containers/m3u/parse-directive.js +10 -6
  79. package/dist/containers/m3u/parse-m3u-manifest.js +7 -3
  80. package/dist/containers/m3u/parse-m3u-media-directive.js +10 -5
  81. package/dist/containers/m3u/parse-m3u.js +11 -7
  82. package/dist/containers/m3u/parse-m3u8-text.js +7 -3
  83. package/dist/containers/m3u/parse-stream-inf.js +7 -2
  84. package/dist/containers/m3u/run-over-m3u.js +13 -9
  85. package/dist/containers/m3u/sample-sorter.js +8 -4
  86. package/dist/containers/m3u/select-stream.js +11 -4
  87. package/dist/containers/m3u/types.js +2 -1
  88. package/dist/containers/mp3/get-duration.js +9 -5
  89. package/dist/containers/mp3/get-frame-length.js +7 -2
  90. package/dist/containers/mp3/get-metadata-from-mp3.js +5 -1
  91. package/dist/containers/mp3/id3-v1.js +5 -1
  92. package/dist/containers/mp3/id3.js +5 -1
  93. package/dist/containers/mp3/parse-mp3.js +11 -7
  94. package/dist/containers/mp3/parse-mpeg-header.js +14 -10
  95. package/dist/containers/mp3/samples-per-mpeg-file.js +5 -1
  96. package/dist/containers/riff/expect-riff-box.js +15 -11
  97. package/dist/containers/riff/get-duration.js +12 -7
  98. package/dist/containers/riff/get-tracks-from-avi.js +28 -20
  99. package/dist/containers/riff/is-movi.js +5 -1
  100. package/dist/containers/riff/parse-avih.js +5 -1
  101. package/dist/containers/riff/parse-isft.js +5 -1
  102. package/dist/containers/riff/parse-list-box.js +7 -3
  103. package/dist/containers/riff/parse-movi.js +18 -13
  104. package/dist/containers/riff/parse-riff-body.js +13 -9
  105. package/dist/containers/riff/parse-riff-box.js +13 -9
  106. package/dist/containers/riff/parse-riff-header.js +5 -1
  107. package/dist/containers/riff/parse-riff.js +9 -5
  108. package/dist/containers/riff/parse-strf.js +5 -1
  109. package/dist/containers/riff/parse-strh.js +7 -3
  110. package/dist/containers/riff/parse-video-section.js +11 -7
  111. package/dist/containers/riff/riff-box.js +2 -1
  112. package/dist/containers/riff/timescale.js +4 -1
  113. package/dist/containers/riff/traversal.js +15 -7
  114. package/dist/containers/transport-stream/adts-header.js +10 -6
  115. package/dist/containers/transport-stream/boxes.js +2 -1
  116. package/dist/containers/transport-stream/discard-rest-of-packet.js +7 -2
  117. package/dist/containers/transport-stream/find-separator.js +4 -1
  118. package/dist/containers/transport-stream/get-tracks.js +16 -10
  119. package/dist/containers/transport-stream/handle-aac-packet.js +16 -12
  120. package/dist/containers/transport-stream/handle-avc-packet.js +26 -22
  121. package/dist/containers/transport-stream/next-pes-header-store.js +5 -1
  122. package/dist/containers/transport-stream/parse-packet.js +17 -13
  123. package/dist/containers/transport-stream/parse-pat.js +10 -5
  124. package/dist/containers/transport-stream/parse-pes.js +5 -1
  125. package/dist/containers/transport-stream/parse-pmt.js +7 -3
  126. package/dist/containers/transport-stream/parse-stream-packet.js +17 -13
  127. package/dist/containers/transport-stream/parse-transport-stream.js +9 -5
  128. package/dist/containers/transport-stream/process-stream-buffers.js +17 -12
  129. package/dist/containers/transport-stream/traversal.js +10 -4
  130. package/dist/containers/wav/get-duration-from-wav.js +8 -3
  131. package/dist/containers/wav/get-metadata-from-wav.js +5 -1
  132. package/dist/containers/wav/parse-data.js +9 -5
  133. package/dist/containers/wav/parse-fmt.js +7 -3
  134. package/dist/containers/wav/parse-header.js +5 -1
  135. package/dist/containers/wav/parse-id3.js +5 -1
  136. package/dist/containers/wav/parse-list.js +5 -1
  137. package/dist/containers/wav/parse-video-section.js +7 -3
  138. package/dist/containers/wav/parse-wav.js +19 -15
  139. package/dist/containers/wav/types.js +2 -1
  140. package/dist/containers/webm/allowed-partial-segments.js +4 -1
  141. package/dist/containers/webm/av1-codec-private.js +7 -3
  142. package/dist/containers/webm/color.js +10 -6
  143. package/dist/containers/webm/description.js +10 -6
  144. package/dist/containers/webm/get-ready-tracks.js +18 -13
  145. package/dist/containers/webm/get-sample-from-block.js +16 -12
  146. package/dist/containers/webm/make-track.js +48 -43
  147. package/dist/containers/webm/parse-ebml.js +19 -14
  148. package/dist/containers/webm/parse-webm-header.js +7 -3
  149. package/dist/containers/webm/segments/all-segments.js +173 -168
  150. package/dist/containers/webm/segments/block-simple-block-flags.js +8 -4
  151. package/dist/containers/webm/segments/track-entry.js +5 -1
  152. package/dist/containers/webm/segments.js +13 -9
  153. package/dist/containers/webm/traversal.js +67 -37
  154. package/dist/convert-audio-or-video-sample.js +5 -1
  155. package/dist/download-and-parse-media.js +14 -10
  156. package/dist/emit-available-info.js +38 -34
  157. package/dist/emitter.js +5 -1
  158. package/dist/errors.js +15 -6
  159. package/dist/esm/index.mjs +1 -1
  160. package/dist/esm/worker.mjs +4 -5
  161. package/dist/fetch.js +17 -1
  162. package/dist/file-types/bmp.js +7 -3
  163. package/dist/file-types/detect-file-type.js +38 -24
  164. package/dist/file-types/index.js +26 -22
  165. package/dist/file-types/jpeg.js +9 -4
  166. package/dist/file-types/pdf.js +7 -3
  167. package/dist/file-types/png.js +9 -4
  168. package/dist/file-types/webp.js +7 -3
  169. package/dist/forward-controller.js +5 -1
  170. package/dist/get-audio-codec.js +38 -25
  171. package/dist/get-container.js +10 -5
  172. package/dist/get-dimensions.js +13 -8
  173. package/dist/get-duration.js +34 -27
  174. package/dist/get-fields-from-callbacks.js +5 -1
  175. package/dist/get-fps.js +34 -24
  176. package/dist/get-is-hdr.js +10 -5
  177. package/dist/get-keyframes.js +11 -6
  178. package/dist/get-location.js +9 -4
  179. package/dist/get-number-of-audio-channels.js +7 -2
  180. package/dist/get-sample-aspect-ratio.js +30 -17
  181. package/dist/get-sample-positions-from-lpcm.js +9 -5
  182. package/dist/get-sample-positions.js +5 -1
  183. package/dist/get-sample-rate.js +7 -2
  184. package/dist/get-tracks.js +40 -29
  185. package/dist/get-video-codec.js +34 -26
  186. package/dist/has-all-info.js +38 -33
  187. package/dist/index.js +47 -32
  188. package/dist/init-video.js +28 -24
  189. package/dist/internal-parse-media.js +39 -35
  190. package/dist/is-audio-structure.js +5 -1
  191. package/dist/log.js +12 -8
  192. package/dist/make-hvc1-codec-strings.js +5 -1
  193. package/dist/media-parser-controller.js +11 -7
  194. package/dist/metadata/get-metadata.js +22 -17
  195. package/dist/metadata/metadata-from-iso.js +17 -12
  196. package/dist/metadata/metadata-from-matroska.js +7 -3
  197. package/dist/metadata/metadata-from-riff.js +7 -3
  198. package/dist/node-writer.js +17 -1
  199. package/dist/node.js +17 -1
  200. package/dist/options.js +2 -1
  201. package/dist/parse-media-on-worker-entry.js +7 -3
  202. package/dist/parse-media.js +12 -8
  203. package/dist/parse-result.js +2 -1
  204. package/dist/pause-signal.js +5 -1
  205. package/dist/perform-seek.js +10 -6
  206. package/dist/readers/fetch/get-body-and-reader.js +5 -1
  207. package/dist/readers/fetch/resolve-url.js +5 -1
  208. package/dist/readers/from-fetch.js +21 -14
  209. package/dist/readers/from-node.js +23 -17
  210. package/dist/readers/from-web-file.js +13 -7
  211. package/dist/readers/reader.js +2 -1
  212. package/dist/readers/universal.js +16 -13
  213. package/dist/readers/web.js +12 -9
  214. package/dist/register-track.js +15 -9
  215. package/dist/remotion-license-acknowledge.js +8 -4
  216. package/dist/run-parse-iteration.js +25 -21
  217. package/dist/samples-from-moof.js +10 -6
  218. package/dist/skip.js +5 -1
  219. package/dist/state/aac-state.js +5 -1
  220. package/dist/state/can-skip-tracks.js +8 -3
  221. package/dist/state/emitted-fields.js +5 -1
  222. package/dist/state/flac-state.js +5 -1
  223. package/dist/state/has-tracks-section.js +7 -3
  224. package/dist/state/images.js +5 -1
  225. package/dist/state/iso-base-media/cached-sample-positions.js +13 -8
  226. package/dist/state/iso-base-media/iso-state.js +9 -5
  227. package/dist/state/iso-base-media/moov-box.js +5 -1
  228. package/dist/state/keyframes.js +5 -1
  229. package/dist/state/m3u-state.js +9 -5
  230. package/dist/state/may-skip-video-data.js +7 -3
  231. package/dist/state/mp3.js +5 -1
  232. package/dist/state/need-samples-for-fields.js +5 -1
  233. package/dist/state/parser-state.js +39 -35
  234. package/dist/state/riff.js +5 -1
  235. package/dist/state/sample-callbacks.js +12 -8
  236. package/dist/state/slow-duration-fps.js +5 -1
  237. package/dist/state/structure.js +5 -1
  238. package/dist/state/transport-stream.js +7 -3
  239. package/dist/state/video-section.js +5 -1
  240. package/dist/state/webm.js +9 -5
  241. package/dist/throttled-progress.js +5 -1
  242. package/dist/truthy.js +4 -1
  243. package/dist/universal.js +5 -1
  244. package/dist/version.d.ts +1 -1
  245. package/dist/version.js +4 -1
  246. package/dist/web.js +5 -1
  247. package/dist/webcodec-sample-types.js +2 -1
  248. package/dist/worker/forward-controller.js +7 -3
  249. package/dist/worker/serialize-error.js +19 -14
  250. package/dist/worker/worker-types.js +2 -1
  251. package/dist/worker-server-entry.js +5 -3
  252. package/dist/worker-server.js +16 -12
  253. package/dist/worker-web-entry.js +5 -3
  254. package/dist/worker.d.ts +3 -2
  255. package/dist/worker.js +11 -2
  256. package/dist/worker.module.d.ts +4 -0
  257. package/dist/worker.module.js +16 -0
  258. package/dist/writers/node.js +23 -16
  259. package/dist/writers/writer.js +2 -1
  260. package/package.json +3 -3
@@ -1,9 +1,12 @@
1
- import { getStrhBox, getStrlBoxes } from './traversal';
2
- export const getDurationFromAvi = (structure) => {
3
- const strl = getStrlBoxes(structure);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSampleRateFromAvi = exports.getDurationFromAvi = void 0;
4
+ const traversal_1 = require("./traversal");
5
+ const getDurationFromAvi = (structure) => {
6
+ const strl = (0, traversal_1.getStrlBoxes)(structure);
4
7
  const lengths = [];
5
8
  for (const s of strl) {
6
- const strh = getStrhBox(s.children);
9
+ const strh = (0, traversal_1.getStrhBox)(s.children);
7
10
  if (!strh) {
8
11
  throw new Error('No strh box');
9
12
  }
@@ -13,10 +16,11 @@ export const getDurationFromAvi = (structure) => {
13
16
  }
14
17
  return Math.max(...lengths);
15
18
  };
16
- export const getSampleRateFromAvi = (structure) => {
17
- const strl = getStrlBoxes(structure);
19
+ exports.getDurationFromAvi = getDurationFromAvi;
20
+ const getSampleRateFromAvi = (structure) => {
21
+ const strl = (0, traversal_1.getStrlBoxes)(structure);
18
22
  for (const s of strl) {
19
- const strh = getStrhBox(s.children);
23
+ const strh = (0, traversal_1.getStrhBox)(s.children);
20
24
  if (!strh) {
21
25
  throw new Error('No strh box');
22
26
  }
@@ -26,3 +30,4 @@ export const getSampleRateFromAvi = (structure) => {
26
30
  }
27
31
  return null;
28
32
  };
33
+ exports.getSampleRateFromAvi = getSampleRateFromAvi;
@@ -1,15 +1,19 @@
1
- import { addAvcProfileToTrack } from '../../add-avc-profile-to-track';
2
- import { MEDIA_PARSER_RIFF_TIMESCALE } from './timescale';
3
- import { getAvihBox, getStrhBox, getStrlBoxes } from './traversal';
4
- export const TO_BE_OVERRIDDEN_LATER = 'to-be-overriden-later';
5
- export const getNumberOfTracks = (structure) => {
6
- const avihBox = getAvihBox(structure);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasAllTracksFromAvi = exports.getTracksFromAvi = exports.makeAviVideoTrack = exports.makeAviAudioTrack = exports.getNumberOfTracks = exports.TO_BE_OVERRIDDEN_LATER = void 0;
4
+ const add_avc_profile_to_track_1 = require("../../add-avc-profile-to-track");
5
+ const timescale_1 = require("./timescale");
6
+ const traversal_1 = require("./traversal");
7
+ exports.TO_BE_OVERRIDDEN_LATER = 'to-be-overriden-later';
8
+ const getNumberOfTracks = (structure) => {
9
+ const avihBox = (0, traversal_1.getAvihBox)(structure);
7
10
  if (avihBox) {
8
11
  return avihBox.streams;
9
12
  }
10
13
  throw new Error('No avih box found');
11
14
  };
12
- export const makeAviAudioTrack = ({ strf, index, }) => {
15
+ exports.getNumberOfTracks = getNumberOfTracks;
16
+ const makeAviAudioTrack = ({ strf, index, }) => {
13
17
  // 255 = AAC
14
18
  if (strf.formatTag !== 255) {
15
19
  throw new Error(`Unsupported audio format ${strf.formatTag}`);
@@ -22,18 +26,19 @@ export const makeAviAudioTrack = ({ strf, index, }) => {
22
26
  description: new Uint8Array([18, 16]),
23
27
  numberOfChannels: strf.numberOfChannels,
24
28
  sampleRate: strf.sampleRate,
25
- timescale: MEDIA_PARSER_RIFF_TIMESCALE,
29
+ timescale: timescale_1.MEDIA_PARSER_RIFF_TIMESCALE,
26
30
  trackId: index,
27
31
  trakBox: null,
28
32
  };
29
33
  };
30
- export const makeAviVideoTrack = ({ strh, strf, index, }) => {
34
+ exports.makeAviAudioTrack = makeAviAudioTrack;
35
+ const makeAviVideoTrack = ({ strh, strf, index, }) => {
31
36
  if (strh.handler !== 'H264') {
32
37
  throw new Error(`Unsupported video codec ${strh.handler}`);
33
38
  }
34
39
  return {
35
40
  codecPrivate: null,
36
- codec: TO_BE_OVERRIDDEN_LATER,
41
+ codec: exports.TO_BE_OVERRIDDEN_LATER,
37
42
  codecWithoutConfig: 'h264',
38
43
  codedHeight: strf.height,
39
44
  codedWidth: strf.width,
@@ -41,7 +46,7 @@ export const makeAviVideoTrack = ({ strh, strf, index, }) => {
41
46
  height: strf.height,
42
47
  type: 'video',
43
48
  displayAspectHeight: strf.height,
44
- timescale: MEDIA_PARSER_RIFF_TIMESCALE,
49
+ timescale: timescale_1.MEDIA_PARSER_RIFF_TIMESCALE,
45
50
  description: undefined,
46
51
  m3uStreamFormat: null,
47
52
  trackId: index,
@@ -61,23 +66,24 @@ export const makeAviVideoTrack = ({ strh, strf, index, }) => {
61
66
  fps: strh.rate / strh.scale,
62
67
  };
63
68
  };
64
- export const getTracksFromAvi = (structure, state) => {
69
+ exports.makeAviVideoTrack = makeAviVideoTrack;
70
+ const getTracksFromAvi = (structure, state) => {
65
71
  const videoTracks = [];
66
72
  const audioTracks = [];
67
73
  const otherTracks = [];
68
- const boxes = getStrlBoxes(structure);
74
+ const boxes = (0, traversal_1.getStrlBoxes)(structure);
69
75
  let i = 0;
70
76
  for (const box of boxes) {
71
- const strh = getStrhBox(box.children);
77
+ const strh = (0, traversal_1.getStrhBox)(box.children);
72
78
  if (!strh) {
73
79
  continue;
74
80
  }
75
81
  const { strf } = strh;
76
82
  if (strf.type === 'strf-box-video') {
77
- videoTracks.push(addAvcProfileToTrack(makeAviVideoTrack({ strh, strf, index: i }), state.riff.getAvcProfile()));
83
+ videoTracks.push((0, add_avc_profile_to_track_1.addAvcProfileToTrack)((0, exports.makeAviVideoTrack)({ strh, strf, index: i }), state.riff.getAvcProfile()));
78
84
  }
79
85
  else if (strh.fccType === 'auds') {
80
- audioTracks.push(makeAviAudioTrack({ strf, index: i }));
86
+ audioTracks.push((0, exports.makeAviAudioTrack)({ strf, index: i }));
81
87
  }
82
88
  else {
83
89
  throw new Error(`Unsupported track type ${strh.fccType}`);
@@ -86,18 +92,20 @@ export const getTracksFromAvi = (structure, state) => {
86
92
  }
87
93
  return { audioTracks, otherTracks, videoTracks };
88
94
  };
89
- export const hasAllTracksFromAvi = (state) => {
95
+ exports.getTracksFromAvi = getTracksFromAvi;
96
+ const hasAllTracksFromAvi = (state) => {
90
97
  try {
91
98
  const structure = state.getRiffStructure();
92
- const numberOfTracks = getNumberOfTracks(structure);
93
- const tracks = getTracksFromAvi(structure, state);
99
+ const numberOfTracks = (0, exports.getNumberOfTracks)(structure);
100
+ const tracks = (0, exports.getTracksFromAvi)(structure, state);
94
101
  return (tracks.videoTracks.length +
95
102
  tracks.audioTracks.length +
96
103
  tracks.otherTracks.length ===
97
104
  numberOfTracks &&
98
- !tracks.videoTracks.find((t) => t.codec === TO_BE_OVERRIDDEN_LATER));
105
+ !tracks.videoTracks.find((t) => t.codec === exports.TO_BE_OVERRIDDEN_LATER));
99
106
  }
100
107
  catch (_a) {
101
108
  return false;
102
109
  }
103
110
  };
111
+ exports.hasAllTracksFromAvi = hasAllTracksFromAvi;
@@ -1,4 +1,7 @@
1
- export const isMoviAtom = (iterator, ckId) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isMoviAtom = void 0;
4
+ const isMoviAtom = (iterator, ckId) => {
2
5
  if (ckId !== 'LIST') {
3
6
  return false;
4
7
  }
@@ -6,3 +9,4 @@ export const isMoviAtom = (iterator, ckId) => {
6
9
  iterator.counter.decrement(4);
7
10
  return listType === 'movi';
8
11
  };
12
+ exports.isMoviAtom = isMoviAtom;
@@ -1,4 +1,7 @@
1
- export const parseAvih = ({ iterator, size, }) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseAvih = void 0;
4
+ const parseAvih = ({ iterator, size, }) => {
2
5
  const { expectNoMoreBytes } = iterator.startBox(size);
3
6
  const dwMicroSecPerFrame = iterator.getUint32Le();
4
7
  const dwMaxBytesPerSec = iterator.getUint32Le();
@@ -26,3 +29,4 @@ export const parseAvih = ({ iterator, size, }) => {
26
29
  width,
27
30
  };
28
31
  };
32
+ exports.parseAvih = parseAvih;
@@ -1,4 +1,7 @@
1
- export const parseIsft = ({ iterator, size, }) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseIsft = void 0;
4
+ const parseIsft = ({ iterator, size, }) => {
2
5
  const { expectNoMoreBytes } = iterator.startBox(size);
3
6
  const software = iterator.getByteString(size - 1, false);
4
7
  const last = iterator.getUint8();
@@ -11,3 +14,4 @@ export const parseIsft = ({ iterator, size, }) => {
11
14
  software,
12
15
  };
13
16
  };
17
+ exports.parseIsft = parseIsft;
@@ -1,5 +1,8 @@
1
- import { expectRiffBox } from './expect-riff-box';
2
- export const parseListBox = async ({ size, state, }) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseListBox = void 0;
4
+ const expect_riff_box_1 = require("./expect-riff-box");
5
+ const parseListBox = async ({ size, state, }) => {
3
6
  const { iterator } = state;
4
7
  const counter = iterator.counter.getOffset();
5
8
  const listType = iterator.getByteString(4, false);
@@ -9,7 +12,7 @@ export const parseListBox = async ({ size, state, }) => {
9
12
  const boxes = [];
10
13
  const maxOffset = counter + size;
11
14
  while (iterator.counter.getOffset() < maxOffset) {
12
- const box = await expectRiffBox(state);
15
+ const box = await (0, expect_riff_box_1.expectRiffBox)(state);
13
16
  if (box === null) {
14
17
  throw new Error('Unexpected result');
15
18
  }
@@ -21,3 +24,4 @@ export const parseListBox = async ({ size, state, }) => {
21
24
  children: boxes,
22
25
  };
23
26
  };
27
+ exports.parseListBox = parseListBox;
@@ -1,20 +1,23 @@
1
- import { convertAudioOrVideoSampleToWebCodecsTimestamps } from '../../convert-audio-or-video-sample';
2
- import { getKeyFrameOrDeltaFromAvcInfo } from '../avc/key';
3
- import { parseAvc } from '../avc/parse-avc';
4
- import { getStrhBox, getStrlBoxes } from './traversal';
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseMovi = exports.handleChunk = void 0;
4
+ const convert_audio_or_video_sample_1 = require("../../convert-audio-or-video-sample");
5
+ const key_1 = require("../avc/key");
6
+ const parse_avc_1 = require("../avc/parse-avc");
7
+ const traversal_1 = require("./traversal");
5
8
  const getStrhForIndex = (structure, trackId) => {
6
- const boxes = getStrlBoxes(structure);
9
+ const boxes = (0, traversal_1.getStrlBoxes)(structure);
7
10
  const box = boxes[trackId];
8
11
  if (!box) {
9
12
  throw new Error('Expected box');
10
13
  }
11
- const strh = getStrhBox(box.children);
14
+ const strh = (0, traversal_1.getStrhBox)(box.children);
12
15
  if (!strh) {
13
16
  throw new Error('strh');
14
17
  }
15
18
  return strh;
16
19
  };
17
- export const handleChunk = async ({ state, ckId, ckSize, }) => {
20
+ const handleChunk = async ({ state, ckId, ckSize, }) => {
18
21
  const { iterator } = state;
19
22
  const offset = iterator.counter.getOffset();
20
23
  const videoChunk = ckId.match(/^([0-9]{2})dc$/);
@@ -26,8 +29,8 @@ export const handleChunk = async ({ state, ckId, ckSize, }) => {
26
29
  const timeInSec = nthSample / samplesPerSecond;
27
30
  const timestamp = timeInSec;
28
31
  const data = iterator.getSlice(ckSize);
29
- const infos = parseAvc(data);
30
- const keyOrDelta = getKeyFrameOrDeltaFromAvcInfo(infos);
32
+ const infos = (0, parse_avc_1.parseAvc)(data);
33
+ const keyOrDelta = (0, key_1.getKeyFrameOrDeltaFromAvcInfo)(infos);
31
34
  const avcProfile = infos.find((i) => i.type === 'avc-profile');
32
35
  const ppsProfile = infos.find((i) => i.type === 'avc-pps');
33
36
  if (avcProfile && ppsProfile && !state.riff.getAvcProfile()) {
@@ -37,7 +40,7 @@ export const handleChunk = async ({ state, ckId, ckSize, }) => {
37
40
  // We must also NOT pass a duration because if the the next sample is 0,
38
41
  // this sample would be longer. Chrome will pad it with silence.
39
42
  // If we'd pass a duration instead, it would shift the audio and we think that audio is not finished
40
- await state.callbacks.onVideoSample(trackId, convertAudioOrVideoSampleToWebCodecsTimestamps({
43
+ await state.callbacks.onVideoSample(trackId, (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
41
44
  cts: timestamp,
42
45
  dts: timestamp,
43
46
  data,
@@ -64,7 +67,7 @@ export const handleChunk = async ({ state, ckId, ckSize, }) => {
64
67
  // We must also NOT pass a duration because if the the next sample is 0,
65
68
  // this sample would be longer. Chrome will pad it with silence.
66
69
  // If we'd pass a duration instead, it would shift the audio and we think that audio is not finished
67
- await state.callbacks.onAudioSample(trackId, convertAudioOrVideoSampleToWebCodecsTimestamps({
70
+ await state.callbacks.onAudioSample(trackId, (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
68
71
  cts: timestamp,
69
72
  dts: timestamp,
70
73
  data,
@@ -77,7 +80,8 @@ export const handleChunk = async ({ state, ckId, ckSize, }) => {
77
80
  }, 1));
78
81
  }
79
82
  };
80
- export const parseMovi = async ({ state, }) => {
83
+ exports.handleChunk = handleChunk;
84
+ const parseMovi = async ({ state, }) => {
81
85
  const { iterator } = state;
82
86
  if (iterator.bytesRemaining() < 8) {
83
87
  return Promise.resolve();
@@ -89,7 +93,7 @@ export const parseMovi = async ({ state, }) => {
89
93
  checkpoint.returnToCheckpoint();
90
94
  return Promise.resolve();
91
95
  }
92
- await handleChunk({ state, ckId, ckSize });
96
+ await (0, exports.handleChunk)({ state, ckId, ckSize });
93
97
  const videoSection = state.videoSection.getVideoSection();
94
98
  const maxOffset = videoSection.start + videoSection.size;
95
99
  // Discard added zeroes
@@ -101,3 +105,4 @@ export const parseMovi = async ({ state, }) => {
101
105
  }
102
106
  }
103
107
  };
108
+ exports.parseMovi = parseMovi;
@@ -1,24 +1,28 @@
1
- import { makeSkip } from '../../skip';
2
- import { maySkipVideoData } from '../../state/may-skip-video-data';
3
- import { expectRiffBox } from './expect-riff-box';
4
- import { parseVideoSection } from './parse-video-section';
5
- export const parseRiffBody = async (state) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseRiffBody = void 0;
4
+ const skip_1 = require("../../skip");
5
+ const may_skip_video_data_1 = require("../../state/may-skip-video-data");
6
+ const expect_riff_box_1 = require("./expect-riff-box");
7
+ const parse_video_section_1 = require("./parse-video-section");
8
+ const parseRiffBody = async (state) => {
6
9
  if (state.videoSection.isInVideoSectionState(state.iterator) === 'in-section') {
7
- if (maySkipVideoData({
10
+ if ((0, may_skip_video_data_1.maySkipVideoData)({
8
11
  state,
9
12
  }) &&
10
13
  state.riff.getAvcProfile()) {
11
14
  const videoSection = state.videoSection.getVideoSection();
12
15
  // only skipping forward in query mode
13
- return Promise.resolve(makeSkip(videoSection.start + videoSection.size));
16
+ return Promise.resolve((0, skip_1.makeSkip)(videoSection.start + videoSection.size));
14
17
  }
15
- await parseVideoSection(state);
18
+ await (0, parse_video_section_1.parseVideoSection)(state);
16
19
  return null;
17
20
  }
18
- const box = await expectRiffBox(state);
21
+ const box = await (0, expect_riff_box_1.expectRiffBox)(state);
19
22
  if (box !== null) {
20
23
  const structure = state.getRiffStructure();
21
24
  structure.boxes.push(box);
22
25
  }
23
26
  return null;
24
27
  };
28
+ exports.parseRiffBody = parseRiffBody;
@@ -1,20 +1,23 @@
1
- import { parseAvih } from './parse-avih';
2
- import { parseIsft } from './parse-isft';
3
- import { parseListBox } from './parse-list-box';
4
- import { parseStrh } from './parse-strh';
5
- export const parseRiffBox = ({ size, id, state, }) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseRiffBox = void 0;
4
+ const parse_avih_1 = require("./parse-avih");
5
+ const parse_isft_1 = require("./parse-isft");
6
+ const parse_list_box_1 = require("./parse-list-box");
7
+ const parse_strh_1 = require("./parse-strh");
8
+ const parseRiffBox = ({ size, id, state, }) => {
6
9
  const { iterator } = state;
7
10
  if (id === 'LIST') {
8
- return parseListBox({ size, state });
11
+ return (0, parse_list_box_1.parseListBox)({ size, state });
9
12
  }
10
13
  if (id === 'ISFT') {
11
- return Promise.resolve(parseIsft({ iterator, size }));
14
+ return Promise.resolve((0, parse_isft_1.parseIsft)({ iterator, size }));
12
15
  }
13
16
  if (id === 'avih') {
14
- return Promise.resolve(parseAvih({ iterator, size }));
17
+ return Promise.resolve((0, parse_avih_1.parseAvih)({ iterator, size }));
15
18
  }
16
19
  if (id === 'strh') {
17
- return Promise.resolve(parseStrh({ iterator, size }));
20
+ return Promise.resolve((0, parse_strh_1.parseStrh)({ iterator, size }));
18
21
  }
19
22
  iterator.discard(size);
20
23
  const box = {
@@ -24,3 +27,4 @@ export const parseRiffBox = ({ size, id, state, }) => {
24
27
  };
25
28
  return Promise.resolve(box);
26
29
  };
30
+ exports.parseRiffBox = parseRiffBox;
@@ -1,4 +1,7 @@
1
- export const parseRiffHeader = (state) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseRiffHeader = void 0;
4
+ const parseRiffHeader = (state) => {
2
5
  const riff = state.iterator.getByteString(4, false);
3
6
  if (riff !== 'RIFF') {
4
7
  throw new Error('Not a RIFF file');
@@ -12,3 +15,4 @@ export const parseRiffHeader = (state) => {
12
15
  structure.boxes.push({ type: 'riff-header', fileSize: size, fileType });
13
16
  return null;
14
17
  };
18
+ exports.parseRiffHeader = parseRiffHeader;
@@ -1,8 +1,12 @@
1
- import { parseRiffBody } from './parse-riff-body';
2
- import { parseRiffHeader } from './parse-riff-header';
3
- export const parseRiff = (state) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseRiff = void 0;
4
+ const parse_riff_body_1 = require("./parse-riff-body");
5
+ const parse_riff_header_1 = require("./parse-riff-header");
6
+ const parseRiff = (state) => {
4
7
  if (state.iterator.counter.getOffset() === 0) {
5
- return Promise.resolve(parseRiffHeader(state));
8
+ return Promise.resolve((0, parse_riff_header_1.parseRiffHeader)(state));
6
9
  }
7
- return parseRiffBody(state);
10
+ return (0, parse_riff_body_1.parseRiffBody)(state);
8
11
  };
12
+ exports.parseRiff = parseRiff;
@@ -1,3 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseStrf = void 0;
1
4
  const parseStrfAudio = ({ iterator, size, }) => {
2
5
  const box = iterator.startBox(size);
3
6
  const formatTag = iterator.getUint16Le();
@@ -48,7 +51,7 @@ const parseStrfVideo = ({ iterator, size, }) => {
48
51
  yPelsPerMeter,
49
52
  };
50
53
  };
51
- export const parseStrf = ({ iterator, size, fccType, }) => {
54
+ const parseStrf = ({ iterator, size, fccType, }) => {
52
55
  if (fccType === 'vids') {
53
56
  return parseStrfVideo({ iterator, size });
54
57
  }
@@ -57,3 +60,4 @@ export const parseStrf = ({ iterator, size, fccType, }) => {
57
60
  }
58
61
  throw new Error(`Unsupported fccType: ${fccType}`);
59
62
  };
63
+ exports.parseStrf = parseStrf;
@@ -1,5 +1,8 @@
1
- import { parseStrf } from './parse-strf';
2
- export const parseStrh = ({ iterator, size, }) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseStrh = void 0;
4
+ const parse_strf_1 = require("./parse-strf");
5
+ const parseStrh = ({ iterator, size, }) => {
3
6
  const box = iterator.startBox(size);
4
7
  const fccType = iterator.getByteString(4, false);
5
8
  if (fccType !== 'vids' && fccType !== 'auds') {
@@ -34,7 +37,7 @@ export const parseStrh = ({ iterator, size, }) => {
34
37
  if (iterator.bytesRemaining() < ckSize) {
35
38
  throw new Error('Expected strf to be complete');
36
39
  }
37
- const strf = parseStrf({ iterator, size: ckSize, fccType });
40
+ const strf = (0, parse_strf_1.parseStrf)({ iterator, size: ckSize, fccType });
38
41
  return {
39
42
  type: 'strh-box',
40
43
  fccType,
@@ -53,3 +56,4 @@ export const parseStrh = ({ iterator, size, }) => {
53
56
  strf,
54
57
  };
55
58
  };
59
+ exports.parseStrh = parseStrh;
@@ -1,13 +1,17 @@
1
- import { getTracks } from '../../get-tracks';
2
- import { TO_BE_OVERRIDDEN_LATER } from './get-tracks-from-avi';
3
- import { parseMovi } from './parse-movi';
4
- export const parseVideoSection = async (state) => {
5
- await parseMovi({
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseVideoSection = void 0;
4
+ const get_tracks_1 = require("../../get-tracks");
5
+ const get_tracks_from_avi_1 = require("./get-tracks-from-avi");
6
+ const parse_movi_1 = require("./parse-movi");
7
+ const parseVideoSection = async (state) => {
8
+ await (0, parse_movi_1.parseMovi)({
6
9
  state,
7
10
  });
8
- const tracks = getTracks(state);
9
- if (!tracks.videoTracks.some((t) => t.codec === TO_BE_OVERRIDDEN_LATER) &&
11
+ const tracks = (0, get_tracks_1.getTracks)(state);
12
+ if (!tracks.videoTracks.some((t) => t.codec === get_tracks_from_avi_1.TO_BE_OVERRIDDEN_LATER) &&
10
13
  !state.callbacks.tracks.getIsDone()) {
11
14
  state.callbacks.tracks.setIsDone(state.logLevel);
12
15
  }
13
16
  };
17
+ exports.parseVideoSection = parseVideoSection;
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +1,4 @@
1
- export const MEDIA_PARSER_RIFF_TIMESCALE = 1000000;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MEDIA_PARSER_RIFF_TIMESCALE = void 0;
4
+ exports.MEDIA_PARSER_RIFF_TIMESCALE = 1000000;
@@ -1,23 +1,31 @@
1
- export const isRiffAvi = (structure) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStrhBox = exports.getStrlBoxes = exports.getAvihBox = exports.getHdlrBox = exports.isRiffAvi = void 0;
4
+ const isRiffAvi = (structure) => {
2
5
  return structure.boxes.some((box) => box.type === 'riff-header' && box.fileType === 'AVI');
3
6
  };
4
- export const getHdlrBox = (structure) => {
7
+ exports.isRiffAvi = isRiffAvi;
8
+ const getHdlrBox = (structure) => {
5
9
  return structure.boxes.find((box) => box.type === 'list-box' && box.listType === 'hdrl');
6
10
  };
7
- export const getAvihBox = (structure) => {
8
- const hdlrBox = getHdlrBox(structure);
11
+ exports.getHdlrBox = getHdlrBox;
12
+ const getAvihBox = (structure) => {
13
+ const hdlrBox = (0, exports.getHdlrBox)(structure);
9
14
  if (!hdlrBox) {
10
15
  return null;
11
16
  }
12
17
  return hdlrBox.children.find((box) => box.type === 'avih-box');
13
18
  };
14
- export const getStrlBoxes = (structure) => {
15
- const hdlrBox = getHdlrBox(structure);
19
+ exports.getAvihBox = getAvihBox;
20
+ const getStrlBoxes = (structure) => {
21
+ const hdlrBox = (0, exports.getHdlrBox)(structure);
16
22
  if (!hdlrBox) {
17
23
  return [];
18
24
  }
19
25
  return hdlrBox.children.filter((box) => box.type === 'list-box' && box.listType === 'strl');
20
26
  };
21
- export const getStrhBox = (strlBoxChildren) => {
27
+ exports.getStrlBoxes = getStrlBoxes;
28
+ const getStrhBox = (strlBoxChildren) => {
22
29
  return strlBoxChildren.find((box) => box.type === 'strh-box');
23
30
  };
31
+ exports.getStrhBox = getStrhBox;
@@ -1,10 +1,13 @@
1
- import { createAacCodecPrivate, getSampleRateFromSampleFrequencyIndex, } from '../../aac-codecprivate';
2
- import { getArrayBufferIterator } from '../../buffer-iterator';
3
- export const readAdtsHeader = (buffer) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readAdtsHeader = void 0;
4
+ const aac_codecprivate_1 = require("../../aac-codecprivate");
5
+ const buffer_iterator_1 = require("../../buffer-iterator");
6
+ const readAdtsHeader = (buffer) => {
4
7
  if (buffer.byteLength < 9) {
5
8
  return null;
6
9
  }
7
- const iterator = getArrayBufferIterator(buffer, buffer.byteLength);
10
+ const iterator = (0, buffer_iterator_1.getArrayBufferIterator)(buffer, buffer.byteLength);
8
11
  iterator.startReadingBits();
9
12
  const bits = iterator.getBits(12);
10
13
  if (bits !== 0xfff) {
@@ -22,10 +25,10 @@ export const readAdtsHeader = (buffer) => {
22
25
  const protectionAbsent = iterator.getBits(1); // protection absent
23
26
  const audioObjectType = iterator.getBits(2); // 1 = 'AAC-LC'
24
27
  const samplingFrequencyIndex = iterator.getBits(4);
25
- const sampleRate = getSampleRateFromSampleFrequencyIndex(samplingFrequencyIndex);
28
+ const sampleRate = (0, aac_codecprivate_1.getSampleRateFromSampleFrequencyIndex)(samplingFrequencyIndex);
26
29
  iterator.getBits(1); // private bit
27
30
  const channelConfiguration = iterator.getBits(3);
28
- const codecPrivate = createAacCodecPrivate({
31
+ const codecPrivate = (0, aac_codecprivate_1.createAacCodecPrivate)({
29
32
  audioObjectType,
30
33
  sampleRate,
31
34
  channelConfiguration,
@@ -51,3 +54,4 @@ export const readAdtsHeader = (buffer) => {
51
54
  audioObjectType,
52
55
  };
53
56
  };
57
+ exports.readAdtsHeader = readAdtsHeader;
@@ -1 +1,2 @@
1
- export {};
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,8 +1,13 @@
1
- export const discardRestOfPacket = (iterator) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRestOfPacket = exports.discardRestOfPacket = void 0;
4
+ const discardRestOfPacket = (iterator) => {
2
5
  const next188 = 188 - (iterator.counter.getOffset() % 188);
3
6
  iterator.discard(next188);
4
7
  };
5
- export const getRestOfPacket = (iterator) => {
8
+ exports.discardRestOfPacket = discardRestOfPacket;
9
+ const getRestOfPacket = (iterator) => {
6
10
  const next188 = 188 - (iterator.counter.getOffset() % 188);
7
11
  return iterator.getSlice(next188);
8
12
  };
13
+ exports.getRestOfPacket = getRestOfPacket;
@@ -1,4 +1,7 @@
1
- export function findNthSubarrayIndex(array, subarray, n) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findNthSubarrayIndex = findNthSubarrayIndex;
4
+ function findNthSubarrayIndex(array, subarray, n) {
2
5
  const subarrayLength = subarray.length;
3
6
  const arrayLength = array.length;
4
7
  let count = 0;