@remotion/media-parser 4.0.277 → 4.0.279

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 (365) hide show
  1. package/dist/aac-codecprivate.js +13 -6
  2. package/dist/add-avc-profile-to-track.js +9 -5
  3. package/dist/check-if-done.d.ts +2 -0
  4. package/dist/check-if-done.js +34 -0
  5. package/dist/combine-uint8-arrays.js +5 -1
  6. package/dist/containers/aac/parse-aac.js +27 -18
  7. package/dist/containers/aac/types.js +2 -1
  8. package/dist/containers/avc/codec-string.js +5 -1
  9. package/dist/containers/avc/color.js +9 -3
  10. package/dist/containers/avc/create-sps-pps-data.js +9 -5
  11. package/dist/containers/avc/interpret-sps.js +13 -7
  12. package/dist/containers/avc/key.js +5 -1
  13. package/dist/containers/avc/parse-avc.js +7 -3
  14. package/dist/containers/avc/sps-and-pps.js +5 -1
  15. package/dist/containers/flac/get-block-size.d.ts +1 -1
  16. package/dist/containers/flac/get-block-size.js +5 -1
  17. package/dist/containers/flac/get-channel-count.d.ts +2 -2
  18. package/dist/containers/flac/get-channel-count.js +5 -1
  19. package/dist/containers/flac/get-duration-from-flac.js +5 -1
  20. package/dist/containers/flac/get-metadata-from-flac.js +5 -1
  21. package/dist/containers/flac/get-sample-rate.d.ts +1 -1
  22. package/dist/containers/flac/get-sample-rate.js +5 -1
  23. package/dist/containers/flac/parse-flac-frame.d.ts +1 -1
  24. package/dist/containers/flac/parse-flac-frame.js +33 -23
  25. package/dist/containers/flac/parse-flac.d.ts +1 -1
  26. package/dist/containers/flac/parse-flac.js +19 -15
  27. package/dist/containers/flac/parse-header.d.ts +1 -1
  28. package/dist/containers/flac/parse-header.js +5 -1
  29. package/dist/containers/flac/parse-metadata.d.ts +1 -1
  30. package/dist/containers/flac/parse-metadata.js +5 -1
  31. package/dist/containers/flac/parse-streaminfo.d.ts +1 -1
  32. package/dist/containers/flac/parse-streaminfo.js +7 -3
  33. package/dist/containers/flac/parse-unknown-block.d.ts +1 -1
  34. package/dist/containers/flac/parse-unknown-block.js +5 -1
  35. package/dist/containers/flac/types.js +2 -1
  36. package/dist/containers/iso-base-media/base-media-box.js +2 -1
  37. package/dist/containers/iso-base-media/base-type.js +2 -1
  38. package/dist/containers/iso-base-media/esds/decoder-specific-config.d.ts +1 -1
  39. package/dist/containers/iso-base-media/esds/decoder-specific-config.js +5 -1
  40. package/dist/containers/iso-base-media/esds/esds-descriptors.d.ts +1 -1
  41. package/dist/containers/iso-base-media/esds/esds-descriptors.js +10 -5
  42. package/dist/containers/iso-base-media/esds/esds.d.ts +1 -1
  43. package/dist/containers/iso-base-media/esds/esds.js +7 -3
  44. package/dist/containers/iso-base-media/ftyp.d.ts +1 -1
  45. package/dist/containers/iso-base-media/ftyp.js +5 -1
  46. package/dist/containers/iso-base-media/get-actual-number-of-channels.js +8 -4
  47. package/dist/containers/iso-base-media/get-children.js +7 -3
  48. package/dist/containers/iso-base-media/get-keyframes.js +11 -7
  49. package/dist/containers/iso-base-media/get-moov-atom.js +26 -16
  50. package/dist/containers/iso-base-media/get-sample-positions-from-track.js +24 -20
  51. package/dist/containers/iso-base-media/get-seeking-from-mp4.d.ts +5 -0
  52. package/dist/containers/iso-base-media/get-seeking-from-mp4.js +56 -0
  53. package/dist/containers/iso-base-media/get-video-codec-from-iso-track.js +7 -3
  54. package/dist/containers/iso-base-media/make-track.js +34 -30
  55. package/dist/containers/iso-base-media/mdat/mdat.js +47 -34
  56. package/dist/containers/iso-base-media/mdhd.d.ts +1 -1
  57. package/dist/containers/iso-base-media/mdhd.js +5 -1
  58. package/dist/containers/iso-base-media/meta/hdlr.d.ts +1 -1
  59. package/dist/containers/iso-base-media/meta/hdlr.js +5 -1
  60. package/dist/containers/iso-base-media/meta/ilst.d.ts +1 -1
  61. package/dist/containers/iso-base-media/meta/ilst.js +5 -1
  62. package/dist/containers/iso-base-media/moov/moov.js +7 -3
  63. package/dist/containers/iso-base-media/mvhd.d.ts +1 -1
  64. package/dist/containers/iso-base-media/mvhd.js +11 -7
  65. package/dist/containers/iso-base-media/parse-boxes.js +9 -5
  66. package/dist/containers/iso-base-media/parse-icc-profile.js +8 -4
  67. package/dist/containers/iso-base-media/process-box.js +67 -63
  68. package/dist/containers/iso-base-media/stsd/av1c.d.ts +1 -1
  69. package/dist/containers/iso-base-media/stsd/av1c.js +5 -1
  70. package/dist/containers/iso-base-media/stsd/avcc.d.ts +1 -1
  71. package/dist/containers/iso-base-media/stsd/avcc.js +5 -1
  72. package/dist/containers/iso-base-media/stsd/colr.d.ts +1 -1
  73. package/dist/containers/iso-base-media/stsd/colr.js +7 -3
  74. package/dist/containers/iso-base-media/stsd/ctts.d.ts +1 -1
  75. package/dist/containers/iso-base-media/stsd/ctts.js +5 -1
  76. package/dist/containers/iso-base-media/stsd/hvcc.d.ts +1 -1
  77. package/dist/containers/iso-base-media/stsd/hvcc.js +7 -3
  78. package/dist/containers/iso-base-media/stsd/keys.d.ts +1 -1
  79. package/dist/containers/iso-base-media/stsd/keys.js +5 -1
  80. package/dist/containers/iso-base-media/stsd/mebx.js +7 -3
  81. package/dist/containers/iso-base-media/stsd/pasp.d.ts +1 -1
  82. package/dist/containers/iso-base-media/stsd/pasp.js +5 -1
  83. package/dist/containers/iso-base-media/stsd/samples.js +13 -8
  84. package/dist/containers/iso-base-media/stsd/stco.d.ts +1 -1
  85. package/dist/containers/iso-base-media/stsd/stco.js +5 -1
  86. package/dist/containers/iso-base-media/stsd/stsc.d.ts +1 -1
  87. package/dist/containers/iso-base-media/stsd/stsc.js +5 -1
  88. package/dist/containers/iso-base-media/stsd/stsd.js +7 -3
  89. package/dist/containers/iso-base-media/stsd/stss.d.ts +1 -1
  90. package/dist/containers/iso-base-media/stsd/stss.js +5 -1
  91. package/dist/containers/iso-base-media/stsd/stsz.d.ts +1 -1
  92. package/dist/containers/iso-base-media/stsd/stsz.js +5 -1
  93. package/dist/containers/iso-base-media/stsd/stts.d.ts +1 -1
  94. package/dist/containers/iso-base-media/stsd/stts.js +5 -1
  95. package/dist/containers/iso-base-media/tfdt.d.ts +1 -1
  96. package/dist/containers/iso-base-media/tfdt.js +5 -1
  97. package/dist/containers/iso-base-media/tfhd.d.ts +1 -1
  98. package/dist/containers/iso-base-media/tfhd.js +5 -1
  99. package/dist/containers/iso-base-media/tkhd.d.ts +1 -1
  100. package/dist/containers/iso-base-media/tkhd.js +8 -4
  101. package/dist/containers/iso-base-media/to-date.js +5 -1
  102. package/dist/containers/iso-base-media/trak/trak.js +7 -3
  103. package/dist/containers/iso-base-media/traversal.js +57 -33
  104. package/dist/containers/iso-base-media/trun.d.ts +1 -1
  105. package/dist/containers/iso-base-media/trun.js +5 -1
  106. package/dist/containers/iso-base-media/void-box.js +2 -1
  107. package/dist/containers/m3u/after-manifest-fetch.js +15 -11
  108. package/dist/containers/m3u/fetch-m3u8-stream.js +7 -3
  109. package/dist/containers/m3u/get-chunks.js +5 -1
  110. package/dist/containers/m3u/get-duration-from-m3u.js +8 -4
  111. package/dist/containers/m3u/get-playlist.js +12 -6
  112. package/dist/containers/m3u/get-streams.js +9 -3
  113. package/dist/containers/m3u/iterate-over-segment-files.js +15 -11
  114. package/dist/containers/m3u/parse-directive.js +10 -6
  115. package/dist/containers/m3u/parse-m3u-manifest.d.ts +1 -1
  116. package/dist/containers/m3u/parse-m3u-manifest.js +7 -3
  117. package/dist/containers/m3u/parse-m3u-media-directive.js +10 -5
  118. package/dist/containers/m3u/parse-m3u.js +11 -7
  119. package/dist/containers/m3u/parse-m3u8-text.js +7 -3
  120. package/dist/containers/m3u/parse-stream-inf.js +7 -2
  121. package/dist/containers/m3u/run-over-m3u.js +13 -9
  122. package/dist/containers/m3u/sample-sorter.js +8 -4
  123. package/dist/containers/m3u/select-stream.js +11 -4
  124. package/dist/containers/m3u/types.js +2 -1
  125. package/dist/containers/mp3/get-duration.js +9 -5
  126. package/dist/containers/mp3/get-frame-length.js +7 -2
  127. package/dist/containers/mp3/get-metadata-from-mp3.js +5 -1
  128. package/dist/containers/mp3/id3-v1.d.ts +1 -1
  129. package/dist/containers/mp3/id3-v1.js +5 -1
  130. package/dist/containers/mp3/id3.js +5 -1
  131. package/dist/containers/mp3/parse-mp3.js +11 -7
  132. package/dist/containers/mp3/parse-mpeg-header.js +28 -19
  133. package/dist/containers/mp3/samples-per-mpeg-file.js +5 -1
  134. package/dist/containers/riff/expect-riff-box.js +15 -11
  135. package/dist/containers/riff/get-duration.js +12 -7
  136. package/dist/containers/riff/get-tracks-from-avi.js +28 -20
  137. package/dist/containers/riff/is-movi.d.ts +1 -1
  138. package/dist/containers/riff/is-movi.js +5 -1
  139. package/dist/containers/riff/parse-avih.d.ts +1 -1
  140. package/dist/containers/riff/parse-avih.js +5 -1
  141. package/dist/containers/riff/parse-isft.d.ts +1 -1
  142. package/dist/containers/riff/parse-isft.js +5 -1
  143. package/dist/containers/riff/parse-list-box.js +7 -3
  144. package/dist/containers/riff/parse-movi.js +45 -31
  145. package/dist/containers/riff/parse-riff-body.js +13 -9
  146. package/dist/containers/riff/parse-riff-box.js +13 -9
  147. package/dist/containers/riff/parse-riff-header.js +5 -1
  148. package/dist/containers/riff/parse-riff.js +9 -5
  149. package/dist/containers/riff/parse-strf.d.ts +1 -1
  150. package/dist/containers/riff/parse-strf.js +5 -1
  151. package/dist/containers/riff/parse-strh.d.ts +1 -1
  152. package/dist/containers/riff/parse-strh.js +7 -3
  153. package/dist/containers/riff/parse-video-section.js +11 -7
  154. package/dist/containers/riff/riff-box.js +2 -1
  155. package/dist/containers/riff/timescale.js +4 -1
  156. package/dist/containers/riff/traversal.js +15 -7
  157. package/dist/containers/transport-stream/adts-header.js +10 -6
  158. package/dist/containers/transport-stream/boxes.js +2 -1
  159. package/dist/containers/transport-stream/discard-rest-of-packet.d.ts +1 -1
  160. package/dist/containers/transport-stream/discard-rest-of-packet.js +7 -2
  161. package/dist/containers/transport-stream/find-separator.js +4 -1
  162. package/dist/containers/transport-stream/get-tracks.js +16 -10
  163. package/dist/containers/transport-stream/handle-aac-packet.js +21 -12
  164. package/dist/containers/transport-stream/handle-avc-packet.js +31 -22
  165. package/dist/containers/transport-stream/next-pes-header-store.js +5 -1
  166. package/dist/containers/transport-stream/parse-packet.js +17 -13
  167. package/dist/containers/transport-stream/parse-pat.d.ts +1 -1
  168. package/dist/containers/transport-stream/parse-pat.js +10 -5
  169. package/dist/containers/transport-stream/parse-pes.d.ts +1 -1
  170. package/dist/containers/transport-stream/parse-pes.js +5 -1
  171. package/dist/containers/transport-stream/parse-pmt.d.ts +1 -1
  172. package/dist/containers/transport-stream/parse-pmt.js +7 -3
  173. package/dist/containers/transport-stream/parse-stream-packet.js +17 -13
  174. package/dist/containers/transport-stream/parse-transport-stream.js +9 -5
  175. package/dist/containers/transport-stream/process-stream-buffers.js +17 -12
  176. package/dist/containers/transport-stream/traversal.js +10 -4
  177. package/dist/containers/wav/get-duration-from-wav.js +8 -3
  178. package/dist/containers/wav/get-metadata-from-wav.js +5 -1
  179. package/dist/containers/wav/parse-data.js +9 -5
  180. package/dist/containers/wav/parse-fmt.js +7 -3
  181. package/dist/containers/wav/parse-header.js +5 -1
  182. package/dist/containers/wav/parse-id3.js +5 -1
  183. package/dist/containers/wav/parse-list.js +5 -1
  184. package/dist/containers/wav/parse-video-section.js +21 -12
  185. package/dist/containers/wav/parse-wav.js +19 -15
  186. package/dist/containers/wav/types.js +2 -1
  187. package/dist/containers/webm/allowed-partial-segments.js +4 -1
  188. package/dist/containers/webm/av1-codec-private.js +7 -3
  189. package/dist/containers/webm/color.js +10 -6
  190. package/dist/containers/webm/description.js +10 -6
  191. package/dist/containers/webm/get-ready-tracks.js +18 -13
  192. package/dist/containers/webm/get-sample-from-block.js +16 -12
  193. package/dist/containers/webm/make-track.js +48 -43
  194. package/dist/containers/webm/parse-ebml.js +35 -17
  195. package/dist/containers/webm/parse-webm-header.js +7 -3
  196. package/dist/containers/webm/segments/all-segments.js +173 -168
  197. package/dist/containers/webm/segments/block-simple-block-flags.d.ts +1 -1
  198. package/dist/containers/webm/segments/block-simple-block-flags.js +8 -4
  199. package/dist/containers/webm/segments/track-entry.js +5 -1
  200. package/dist/containers/webm/segments.js +13 -9
  201. package/dist/containers/webm/traversal.js +67 -37
  202. package/dist/convert-audio-or-video-sample.js +5 -1
  203. package/dist/download-and-parse-media.js +14 -10
  204. package/dist/emit-all-info.d.ts +3 -0
  205. package/dist/emit-all-info.js +30 -0
  206. package/dist/emit-audio-sample.d.ts +12 -0
  207. package/dist/emit-audio-sample.js +14 -0
  208. package/dist/emit-available-info.d.ts +2 -7
  209. package/dist/emit-available-info.js +70 -63
  210. package/dist/emitter.js +5 -1
  211. package/dist/errors.js +15 -6
  212. package/dist/esm/index.mjs +1921 -1618
  213. package/dist/esm/worker-server-entry.mjs +840 -537
  214. package/dist/esm/worker-web-entry.mjs +840 -537
  215. package/dist/esm/worker.mjs +4 -5
  216. package/dist/fetch.js +17 -1
  217. package/dist/fields.d.ts +61 -0
  218. package/dist/fields.js +2 -0
  219. package/dist/file-types/bmp.js +7 -3
  220. package/dist/file-types/detect-file-type.js +38 -24
  221. package/dist/file-types/index.js +26 -22
  222. package/dist/file-types/jpeg.js +9 -4
  223. package/dist/file-types/pdf.js +7 -3
  224. package/dist/file-types/png.js +9 -4
  225. package/dist/file-types/webp.js +7 -3
  226. package/dist/forward-controller.js +5 -1
  227. package/dist/get-audio-codec.js +38 -25
  228. package/dist/get-container.js +10 -5
  229. package/dist/get-dimensions.js +13 -8
  230. package/dist/get-duration.js +34 -27
  231. package/dist/get-fields-from-callbacks.d.ts +2 -1
  232. package/dist/get-fields-from-callbacks.js +5 -1
  233. package/dist/get-fps.js +34 -24
  234. package/dist/get-is-hdr.js +10 -5
  235. package/dist/get-keyframes.js +11 -6
  236. package/dist/get-location.js +9 -4
  237. package/dist/get-number-of-audio-channels.js +7 -2
  238. package/dist/get-sample-aspect-ratio.js +30 -17
  239. package/dist/get-sample-positions-from-lpcm.js +9 -5
  240. package/dist/get-sample-positions.js +5 -1
  241. package/dist/get-sample-rate.js +7 -2
  242. package/dist/get-seeking-info.d.ts +4 -0
  243. package/dist/get-seeking-info.js +22 -0
  244. package/dist/get-tracks.js +40 -29
  245. package/dist/get-video-codec.js +34 -26
  246. package/dist/has-all-info.d.ts +3 -5
  247. package/dist/has-all-info.js +39 -35
  248. package/dist/index.d.ts +53 -14
  249. package/dist/index.js +47 -32
  250. package/dist/init-video.d.ts +1 -4
  251. package/dist/init-video.js +29 -24
  252. package/dist/internal-parse-media.js +40 -199
  253. package/dist/is-audio-structure.js +5 -1
  254. package/dist/{buffer-iterator.d.ts → iterator/buffer-iterator.d.ts} +12 -15
  255. package/dist/{buffer-iterator.js → iterator/buffer-iterator.js} +16 -119
  256. package/dist/iterator/buffer-manager.d.ts +18 -0
  257. package/dist/iterator/buffer-manager.js +87 -0
  258. package/dist/iterator/offset-counter.d.ts +10 -0
  259. package/dist/iterator/offset-counter.js +31 -0
  260. package/dist/log.js +12 -8
  261. package/dist/make-hvc1-codec-strings.d.ts +1 -1
  262. package/dist/make-hvc1-codec-strings.js +5 -1
  263. package/dist/make-progress-object.d.ts +6 -0
  264. package/dist/make-progress-object.js +13 -0
  265. package/dist/media-parser-controller.d.ts +3 -0
  266. package/dist/media-parser-controller.js +15 -7
  267. package/dist/metadata/get-metadata.js +22 -17
  268. package/dist/metadata/metadata-from-iso.js +17 -12
  269. package/dist/metadata/metadata-from-matroska.js +7 -3
  270. package/dist/metadata/metadata-from-riff.js +7 -3
  271. package/dist/node-writer.js +17 -1
  272. package/dist/node.js +17 -1
  273. package/dist/options.d.ts +1 -61
  274. package/dist/options.js +2 -1
  275. package/dist/parse-loop.d.ts +8 -0
  276. package/dist/parse-loop.js +93 -0
  277. package/dist/parse-media-on-worker-entry.d.ts +2 -1
  278. package/dist/parse-media-on-worker-entry.js +7 -3
  279. package/dist/parse-media.js +12 -8
  280. package/dist/parse-result.js +2 -1
  281. package/dist/pause-signal.js +5 -1
  282. package/dist/perform-seek.d.ts +2 -7
  283. package/dist/perform-seek.js +29 -26
  284. package/dist/print-timings.d.ts +2 -0
  285. package/dist/print-timings.js +12 -0
  286. package/dist/readers/fetch/get-body-and-reader.js +5 -1
  287. package/dist/readers/fetch/resolve-url.js +5 -1
  288. package/dist/readers/from-fetch.js +21 -14
  289. package/dist/readers/from-node.js +23 -17
  290. package/dist/readers/from-web-file.js +13 -7
  291. package/dist/readers/reader.js +2 -1
  292. package/dist/readers/universal.js +16 -13
  293. package/dist/readers/web.js +12 -9
  294. package/dist/register-track.js +18 -9
  295. package/dist/remotion-license-acknowledge.js +8 -4
  296. package/dist/run-parse-iteration.d.ts +1 -4
  297. package/dist/run-parse-iteration.js +25 -24
  298. package/dist/samples-from-moof.js +10 -6
  299. package/dist/seek-backwards.d.ts +2 -0
  300. package/dist/seek-backwards.js +26 -0
  301. package/dist/seek-forwards.d.ts +2 -0
  302. package/dist/seek-forwards.js +28 -0
  303. package/dist/seek-signal.d.ts +22 -0
  304. package/dist/seek-signal.js +26 -0
  305. package/dist/seeking-info.d.ts +8 -0
  306. package/dist/seeking-info.js +2 -0
  307. package/dist/skip.js +5 -1
  308. package/dist/state/aac-state.js +5 -1
  309. package/dist/state/can-skip-tracks.d.ts +2 -2
  310. package/dist/state/can-skip-tracks.js +12 -4
  311. package/dist/state/emitted-fields.d.ts +1 -1
  312. package/dist/state/emitted-fields.js +5 -1
  313. package/dist/state/flac-state.js +5 -1
  314. package/dist/state/has-tracks-section.d.ts +2 -1
  315. package/dist/state/has-tracks-section.js +7 -3
  316. package/dist/state/images.js +5 -1
  317. package/dist/state/iso-base-media/cached-sample-positions.js +13 -8
  318. package/dist/state/iso-base-media/iso-state.js +9 -5
  319. package/dist/state/iso-base-media/moov-box.js +5 -1
  320. package/dist/state/keyframes.js +5 -1
  321. package/dist/state/m3u-state.js +9 -5
  322. package/dist/state/may-skip-video-data.js +7 -3
  323. package/dist/state/mp3.js +5 -1
  324. package/dist/state/need-samples-for-fields.d.ts +1 -1
  325. package/dist/state/need-samples-for-fields.js +5 -1
  326. package/dist/state/parser-state.d.ts +38 -8
  327. package/dist/state/parser-state.js +59 -35
  328. package/dist/state/riff.js +5 -1
  329. package/dist/state/sample-callbacks.d.ts +8 -3
  330. package/dist/state/sample-callbacks.js +27 -10
  331. package/dist/state/slow-duration-fps.js +5 -1
  332. package/dist/state/structure.js +5 -1
  333. package/dist/state/timings.d.ts +8 -0
  334. package/dist/state/timings.js +13 -0
  335. package/dist/state/transport-stream.js +7 -3
  336. package/dist/state/video-section.d.ts +1 -1
  337. package/dist/state/video-section.js +5 -1
  338. package/dist/state/webm.d.ts +1 -1
  339. package/dist/state/webm.js +9 -5
  340. package/dist/throttled-progress.d.ts +2 -3
  341. package/dist/throttled-progress.js +5 -1
  342. package/dist/truthy.js +4 -1
  343. package/dist/universal.js +5 -1
  344. package/dist/version.d.ts +1 -1
  345. package/dist/version.js +4 -1
  346. package/dist/web.js +5 -1
  347. package/dist/webcodec-sample-types.js +2 -1
  348. package/dist/work-on-seek-request.d.ts +2 -0
  349. package/dist/work-on-seek-request.js +43 -0
  350. package/dist/worker/forward-controller.js +7 -3
  351. package/dist/worker/serialize-error.js +19 -14
  352. package/dist/worker/worker-types.d.ts +2 -1
  353. package/dist/worker/worker-types.js +2 -1
  354. package/dist/worker-server-entry.js +5 -3
  355. package/dist/worker-server.js +16 -12
  356. package/dist/worker-web-entry.js +5 -3
  357. package/dist/worker.d.ts +3 -2
  358. package/dist/worker.js +11 -2
  359. package/dist/writers/node.js +23 -16
  360. package/dist/writers/writer.js +2 -1
  361. package/package.json +10 -10
  362. package/dist/parse-media-on-server-worker.d.ts +0 -2
  363. package/dist/parse-media-on-server-worker.js +0 -4
  364. package/dist/parse-media-on-web-worker.d.ts +0 -2
  365. package/dist/parse-media-on-web-worker.js +0 -4
@@ -1,8 +1,11 @@
1
- import { registerAudioTrack, registerVideoTrackWhenProfileIsAvailable, } from '../../register-track';
2
- import { makeAviAudioTrack, makeAviVideoTrack } from './get-tracks-from-avi';
3
- import { isMoviAtom } from './is-movi';
4
- import { parseRiffBox } from './parse-riff-box';
5
- export const expectRiffBox = async (state) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.expectRiffBox = void 0;
4
+ const register_track_1 = require("../../register-track");
5
+ const get_tracks_from_avi_1 = require("./get-tracks-from-avi");
6
+ const is_movi_1 = require("./is-movi");
7
+ const parse_riff_box_1 = require("./parse-riff-box");
8
+ const expectRiffBox = async (state) => {
6
9
  const { iterator } = state;
7
10
  // Need at least 16 bytes to read LIST,size,movi,size
8
11
  if (state.iterator.bytesRemaining() < 16) {
@@ -11,7 +14,7 @@ export const expectRiffBox = async (state) => {
11
14
  const checkpoint = iterator.startCheckpoint();
12
15
  const ckId = iterator.getByteString(4, false);
13
16
  const ckSize = iterator.getUint32Le();
14
- if (isMoviAtom(iterator, ckId)) {
17
+ if ((0, is_movi_1.isMoviAtom)(iterator, ckId)) {
15
18
  iterator.discard(4);
16
19
  state.videoSection.setVideoSection({
17
20
  start: iterator.counter.getOffset(),
@@ -23,30 +26,30 @@ export const expectRiffBox = async (state) => {
23
26
  checkpoint.returnToCheckpoint();
24
27
  return null;
25
28
  }
26
- const box = await parseRiffBox({
29
+ const box = await (0, parse_riff_box_1.parseRiffBox)({
27
30
  id: ckId,
28
31
  size: ckSize,
29
32
  state,
30
33
  });
31
34
  if (box.type === 'strh-box') {
32
35
  if (box.strf.type === 'strf-box-audio' && state.onAudioTrack) {
33
- const audioTrack = makeAviAudioTrack({
36
+ const audioTrack = (0, get_tracks_from_avi_1.makeAviAudioTrack)({
34
37
  index: state.riff.getNextTrackIndex(),
35
38
  strf: box.strf,
36
39
  });
37
- await registerAudioTrack({
40
+ await (0, register_track_1.registerAudioTrack)({
38
41
  state,
39
42
  track: audioTrack,
40
43
  container: 'avi',
41
44
  });
42
45
  }
43
46
  if (state.onVideoTrack && box.strf.type === 'strf-box-video') {
44
- const videoTrack = makeAviVideoTrack({
47
+ const videoTrack = (0, get_tracks_from_avi_1.makeAviVideoTrack)({
45
48
  strh: box,
46
49
  index: state.riff.getNextTrackIndex(),
47
50
  strf: box.strf,
48
51
  });
49
- registerVideoTrackWhenProfileIsAvailable({
52
+ (0, register_track_1.registerVideoTrackWhenProfileIsAvailable)({
50
53
  state,
51
54
  track: videoTrack,
52
55
  container: 'avi',
@@ -56,3 +59,4 @@ export const expectRiffBox = async (state) => {
56
59
  }
57
60
  return box;
58
61
  };
62
+ exports.expectRiffBox = expectRiffBox;
@@ -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,2 +1,2 @@
1
- import type { BufferIterator } from '../../buffer-iterator';
1
+ import type { BufferIterator } from '../../iterator/buffer-iterator';
2
2
  export declare const isMoviAtom: (iterator: BufferIterator, ckId: string) => boolean;
@@ -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,4 @@
1
- import type { BufferIterator } from '../../buffer-iterator';
1
+ import type { BufferIterator } from '../../iterator/buffer-iterator';
2
2
  import type { RiffBox } from './riff-box';
3
3
  export declare const parseAvih: ({ iterator, size, }: {
4
4
  iterator: BufferIterator;
@@ -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,4 @@
1
- import type { BufferIterator } from '../../buffer-iterator';
1
+ import type { BufferIterator } from '../../iterator/buffer-iterator';
2
2
  import type { IsftBox } from './riff-box';
3
3
  export declare const parseIsft: ({ iterator, size, }: {
4
4
  iterator: BufferIterator;
@@ -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,24 @@
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 emit_audio_sample_1 = require("../../emit-audio-sample");
6
+ const key_1 = require("../avc/key");
7
+ const parse_avc_1 = require("../avc/parse-avc");
8
+ const traversal_1 = require("./traversal");
5
9
  const getStrhForIndex = (structure, trackId) => {
6
- const boxes = getStrlBoxes(structure);
10
+ const boxes = (0, traversal_1.getStrlBoxes)(structure);
7
11
  const box = boxes[trackId];
8
12
  if (!box) {
9
13
  throw new Error('Expected box');
10
14
  }
11
- const strh = getStrhBox(box.children);
15
+ const strh = (0, traversal_1.getStrhBox)(box.children);
12
16
  if (!strh) {
13
17
  throw new Error('strh');
14
18
  }
15
19
  return strh;
16
20
  };
17
- export const handleChunk = async ({ state, ckId, ckSize, }) => {
21
+ const handleChunk = async ({ state, ckId, ckSize, }) => {
18
22
  const { iterator } = state;
19
23
  const offset = iterator.counter.getOffset();
20
24
  const videoChunk = ckId.match(/^([0-9]{2})dc$/);
@@ -26,8 +30,8 @@ export const handleChunk = async ({ state, ckId, ckSize, }) => {
26
30
  const timeInSec = nthSample / samplesPerSecond;
27
31
  const timestamp = timeInSec;
28
32
  const data = iterator.getSlice(ckSize);
29
- const infos = parseAvc(data);
30
- const keyOrDelta = getKeyFrameOrDeltaFromAvcInfo(infos);
33
+ const infos = (0, parse_avc_1.parseAvc)(data);
34
+ const keyOrDelta = (0, key_1.getKeyFrameOrDeltaFromAvcInfo)(infos);
31
35
  const avcProfile = infos.find((i) => i.type === 'avc-profile');
32
36
  const ppsProfile = infos.find((i) => i.type === 'avc-pps');
33
37
  if (avcProfile && ppsProfile && !state.riff.getAvcProfile()) {
@@ -37,17 +41,21 @@ export const handleChunk = async ({ state, ckId, ckSize, }) => {
37
41
  // We must also NOT pass a duration because if the the next sample is 0,
38
42
  // this sample would be longer. Chrome will pad it with silence.
39
43
  // 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({
41
- cts: timestamp,
42
- dts: timestamp,
43
- data,
44
- duration: undefined,
45
- timestamp,
44
+ await (0, emit_audio_sample_1.emitVideoSample)({
46
45
  trackId,
47
- type: keyOrDelta,
48
- offset,
49
- timescale: samplesPerSecond,
50
- }, 1));
46
+ videoSample: (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
47
+ cts: timestamp,
48
+ dts: timestamp,
49
+ data,
50
+ duration: undefined,
51
+ timestamp,
52
+ trackId,
53
+ type: keyOrDelta,
54
+ offset,
55
+ timescale: samplesPerSecond,
56
+ }, 1),
57
+ state,
58
+ });
51
59
  return;
52
60
  }
53
61
  const audioChunk = ckId.match(/^([0-9]{2})wb$/);
@@ -64,20 +72,25 @@ export const handleChunk = async ({ state, ckId, ckSize, }) => {
64
72
  // We must also NOT pass a duration because if the the next sample is 0,
65
73
  // this sample would be longer. Chrome will pad it with silence.
66
74
  // 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({
68
- cts: timestamp,
69
- dts: timestamp,
70
- data,
71
- duration: undefined,
72
- timestamp,
75
+ await (0, emit_audio_sample_1.emitAudioSample)({
73
76
  trackId,
74
- type: 'key',
75
- offset,
76
- timescale: samplesPerSecond,
77
- }, 1));
77
+ audioSample: (0, convert_audio_or_video_sample_1.convertAudioOrVideoSampleToWebCodecsTimestamps)({
78
+ cts: timestamp,
79
+ dts: timestamp,
80
+ data,
81
+ duration: undefined,
82
+ timestamp,
83
+ trackId,
84
+ type: 'key',
85
+ offset,
86
+ timescale: samplesPerSecond,
87
+ }, 1),
88
+ state,
89
+ });
78
90
  }
79
91
  };
80
- export const parseMovi = async ({ state, }) => {
92
+ exports.handleChunk = handleChunk;
93
+ const parseMovi = async ({ state, }) => {
81
94
  const { iterator } = state;
82
95
  if (iterator.bytesRemaining() < 8) {
83
96
  return Promise.resolve();
@@ -89,7 +102,7 @@ export const parseMovi = async ({ state, }) => {
89
102
  checkpoint.returnToCheckpoint();
90
103
  return Promise.resolve();
91
104
  }
92
- await handleChunk({ state, ckId, ckSize });
105
+ await (0, exports.handleChunk)({ state, ckId, ckSize });
93
106
  const videoSection = state.videoSection.getVideoSection();
94
107
  const maxOffset = videoSection.start + videoSection.size;
95
108
  // Discard added zeroes
@@ -101,3 +114,4 @@ export const parseMovi = async ({ state, }) => {
101
114
  }
102
115
  }
103
116
  };
117
+ 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,4 +1,4 @@
1
- import type { BufferIterator } from '../../buffer-iterator';
1
+ import type { BufferIterator } from '../../iterator/buffer-iterator';
2
2
  import type { FccType, StrfBoxAudio, StrfBoxVideo } from './riff-box';
3
3
  export declare const parseStrf: ({ iterator, size, fccType, }: {
4
4
  iterator: BufferIterator;
@@ -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,4 +1,4 @@
1
- import type { BufferIterator } from '../../buffer-iterator';
1
+ import type { BufferIterator } from '../../iterator/buffer-iterator';
2
2
  import type { RiffBox } from './riff-box';
3
3
  export declare const parseStrh: ({ iterator, size, }: {
4
4
  iterator: BufferIterator;
@@ -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;