@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,6 +1,9 @@
1
- import { matroskaElements } from './all-segments';
2
- export const parseBlockFlags = (iterator, type) => {
3
- if (type === matroskaElements.Block) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseBlockFlags = void 0;
4
+ const all_segments_1 = require("./all-segments");
5
+ const parseBlockFlags = (iterator, type) => {
6
+ if (type === all_segments_1.matroskaElements.Block) {
4
7
  iterator.startReadingBits();
5
8
  // Reserved
6
9
  iterator.getBits(4);
@@ -15,7 +18,7 @@ export const parseBlockFlags = (iterator, type) => {
15
18
  keyframe: null,
16
19
  };
17
20
  }
18
- if (type === matroskaElements.SimpleBlock) {
21
+ if (type === all_segments_1.matroskaElements.SimpleBlock) {
19
22
  iterator.startReadingBits();
20
23
  const keyframe = Boolean(iterator.getBits(1));
21
24
  // Reserved
@@ -32,3 +35,4 @@ export const parseBlockFlags = (iterator, type) => {
32
35
  }
33
36
  throw new Error('Unexpected type');
34
37
  };
38
+ exports.parseBlockFlags = parseBlockFlags;
@@ -1,4 +1,7 @@
1
- export const trackTypeToString = (trackType) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.trackTypeToString = void 0;
4
+ const trackTypeToString = (trackType) => {
2
5
  switch (trackType) {
3
6
  case 1:
4
7
  return 'video';
@@ -18,3 +21,4 @@ export const trackTypeToString = (trackType) => {
18
21
  throw new Error(`Unknown track type: ${trackType}`);
19
22
  }
20
23
  };
24
+ exports.trackTypeToString = trackTypeToString;
@@ -1,8 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.expectSegment = void 0;
1
4
  /* eslint-disable @typescript-eslint/no-use-before-define */
2
- import { Log } from '../../log';
3
- import { parseEbml, postprocessEbml } from './parse-ebml';
4
- import { ebmlMap, matroskaElements, } from './segments/all-segments';
5
- export const expectSegment = async ({ state, isInsideSegment, }) => {
5
+ const log_1 = require("../../log");
6
+ const parse_ebml_1 = require("./parse-ebml");
7
+ const all_segments_1 = require("./segments/all-segments");
8
+ const expectSegment = async ({ state, isInsideSegment, }) => {
6
9
  var _a;
7
10
  const { iterator } = state;
8
11
  if (iterator.bytesRemaining() === 0) {
@@ -23,8 +26,8 @@ export const expectSegment = async ({ state, isInsideSegment, }) => {
23
26
  return null;
24
27
  }
25
28
  const bytesRemainingNow = iterator.bytesRemaining();
26
- Log.trace(state.logLevel, 'Segment ID:', (_a = ebmlMap[segmentId]) === null || _a === void 0 ? void 0 : _a.name, 'Size:' + size, bytesRemainingNow);
27
- if (segmentId === matroskaElements.Segment) {
29
+ log_1.Log.trace(state.logLevel, 'Segment ID:', (_a = all_segments_1.ebmlMap[segmentId]) === null || _a === void 0 ? void 0 : _a.name, 'Size:' + size, bytesRemainingNow);
30
+ if (segmentId === all_segments_1.matroskaElements.Segment) {
28
31
  state.webm.addSegment({
29
32
  start: offset,
30
33
  size,
@@ -36,7 +39,7 @@ export const expectSegment = async ({ state, isInsideSegment, }) => {
36
39
  };
37
40
  return newSegment;
38
41
  }
39
- if (segmentId === matroskaElements.Cluster) {
42
+ if (segmentId === all_segments_1.matroskaElements.Cluster) {
40
43
  if (isInsideSegment === null) {
41
44
  throw new Error('Expected to be inside segment');
42
45
  }
@@ -64,13 +67,14 @@ export const expectSegment = async ({ state, isInsideSegment, }) => {
64
67
  });
65
68
  return segment;
66
69
  };
70
+ exports.expectSegment = expectSegment;
67
71
  const parseSegment = async ({ segmentId, length, state, headerReadSoFar, }) => {
68
72
  if (length < 0) {
69
73
  throw new Error(`Expected length of ${segmentId} to be greater or equal 0`);
70
74
  }
71
75
  state.iterator.counter.decrement(headerReadSoFar);
72
76
  const offset = state.iterator.counter.getOffset();
73
- const ebml = await parseEbml(state);
74
- const remapped = await postprocessEbml({ offset, ebml, state });
77
+ const ebml = await (0, parse_ebml_1.parseEbml)(state);
78
+ const remapped = await (0, parse_ebml_1.postprocessEbml)({ offset, ebml, state });
75
79
  return remapped;
76
80
  };
@@ -1,16 +1,22 @@
1
- export const getMainSegment = (segments) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getClusterSegment = exports.getPrivateData = exports.getBitDepth = exports.getNumberOfChannels = exports.getSampleRate = exports.getAudioSegment = exports.getVideoSegment = exports.getTimescaleSegment = exports.getTrackWithUid = exports.getTracksSegment = exports.getDisplayWidthSegment = exports.getHeightSegment = exports.getWidthSegment = exports.getTrackTypeSegment = exports.getDisplayHeightSegment = exports.getRangeSegment = exports.getPrimariesSegment = exports.getMatrixCoefficientsSegment = exports.getTransferCharacteristicsSegment = exports.getColourSegment = exports.getCodecSegment = exports.getTrackId = exports.getTrackByNumber = exports.getTrackTimestampScale = exports.getTrackCodec = exports.getTrackNumber = exports.getMainSegment = void 0;
4
+ const getMainSegment = (segments) => {
2
5
  return segments.find((s) => s.type === 'Segment');
3
6
  };
4
- export const getTrackNumber = (track) => {
7
+ exports.getMainSegment = getMainSegment;
8
+ const getTrackNumber = (track) => {
5
9
  var _a;
6
10
  const child = track.value.find((b) => b.type === 'TrackNumber');
7
11
  return (_a = child === null || child === void 0 ? void 0 : child.value) !== null && _a !== void 0 ? _a : null;
8
12
  };
9
- export const getTrackCodec = (track) => {
13
+ exports.getTrackNumber = getTrackNumber;
14
+ const getTrackCodec = (track) => {
10
15
  const child = track.value.find((b) => b.type === 'CodecID');
11
16
  return child !== null && child !== void 0 ? child : null;
12
17
  };
13
- export const getTrackTimestampScale = (track) => {
18
+ exports.getTrackCodec = getTrackCodec;
19
+ const getTrackTimestampScale = (track) => {
14
20
  const child = track.value.find((b) => b.type === 'TrackTimestampScale');
15
21
  if (!child) {
16
22
  return null;
@@ -20,28 +26,32 @@ export const getTrackTimestampScale = (track) => {
20
26
  }
21
27
  return child.value;
22
28
  };
23
- export const getTrackByNumber = (tracks, id) => {
29
+ exports.getTrackTimestampScale = getTrackTimestampScale;
30
+ const getTrackByNumber = (tracks, id) => {
24
31
  return tracks.find((track) => {
25
- const trackNumber = getTrackNumber(track);
32
+ const trackNumber = (0, exports.getTrackNumber)(track);
26
33
  return (trackNumber === null || trackNumber === void 0 ? void 0 : trackNumber.value) === id;
27
34
  });
28
35
  };
29
- export const getTrackId = (track) => {
36
+ exports.getTrackByNumber = getTrackByNumber;
37
+ const getTrackId = (track) => {
30
38
  const trackId = track.value.find((b) => b.type === 'TrackNumber');
31
39
  if (!trackId || trackId.type !== 'TrackNumber') {
32
40
  throw new Error('Expected track number segment');
33
41
  }
34
42
  return trackId.value.value;
35
43
  };
36
- export const getCodecSegment = (track) => {
44
+ exports.getTrackId = getTrackId;
45
+ const getCodecSegment = (track) => {
37
46
  const codec = track.value.find((b) => b.type === 'CodecID');
38
47
  if (!codec || codec.type !== 'CodecID') {
39
48
  return null;
40
49
  }
41
50
  return codec;
42
51
  };
43
- export const getColourSegment = (track) => {
44
- const videoSegment = getVideoSegment(track);
52
+ exports.getCodecSegment = getCodecSegment;
53
+ const getColourSegment = (track) => {
54
+ const videoSegment = (0, exports.getVideoSegment)(track);
45
55
  if (!videoSegment) {
46
56
  return null;
47
57
  }
@@ -51,7 +61,8 @@ export const getColourSegment = (track) => {
51
61
  }
52
62
  return colour;
53
63
  };
54
- export const getTransferCharacteristicsSegment = (color) => {
64
+ exports.getColourSegment = getColourSegment;
65
+ const getTransferCharacteristicsSegment = (color) => {
55
66
  if (!color || color.type !== 'Colour') {
56
67
  return null;
57
68
  }
@@ -61,7 +72,8 @@ export const getTransferCharacteristicsSegment = (color) => {
61
72
  }
62
73
  return box;
63
74
  };
64
- export const getMatrixCoefficientsSegment = (color) => {
75
+ exports.getTransferCharacteristicsSegment = getTransferCharacteristicsSegment;
76
+ const getMatrixCoefficientsSegment = (color) => {
65
77
  if (!color || color.type !== 'Colour') {
66
78
  return null;
67
79
  }
@@ -71,7 +83,8 @@ export const getMatrixCoefficientsSegment = (color) => {
71
83
  }
72
84
  return box;
73
85
  };
74
- export const getPrimariesSegment = (color) => {
86
+ exports.getMatrixCoefficientsSegment = getMatrixCoefficientsSegment;
87
+ const getPrimariesSegment = (color) => {
75
88
  if (!color || color.type !== 'Colour') {
76
89
  return null;
77
90
  }
@@ -81,7 +94,8 @@ export const getPrimariesSegment = (color) => {
81
94
  }
82
95
  return box;
83
96
  };
84
- export const getRangeSegment = (color) => {
97
+ exports.getPrimariesSegment = getPrimariesSegment;
98
+ const getRangeSegment = (color) => {
85
99
  if (!color || color.type !== 'Colour') {
86
100
  return null;
87
101
  }
@@ -91,8 +105,9 @@ export const getRangeSegment = (color) => {
91
105
  }
92
106
  return box;
93
107
  };
94
- export const getDisplayHeightSegment = (track) => {
95
- const videoSegment = getVideoSegment(track);
108
+ exports.getRangeSegment = getRangeSegment;
109
+ const getDisplayHeightSegment = (track) => {
110
+ const videoSegment = (0, exports.getVideoSegment)(track);
96
111
  if (!videoSegment) {
97
112
  return null;
98
113
  }
@@ -102,15 +117,17 @@ export const getDisplayHeightSegment = (track) => {
102
117
  }
103
118
  return displayHeight;
104
119
  };
105
- export const getTrackTypeSegment = (track) => {
120
+ exports.getDisplayHeightSegment = getDisplayHeightSegment;
121
+ const getTrackTypeSegment = (track) => {
106
122
  const trackType = track.value.find((b) => b.type === 'TrackType');
107
123
  if (!trackType || trackType.type !== 'TrackType') {
108
124
  return null;
109
125
  }
110
126
  return trackType;
111
127
  };
112
- export const getWidthSegment = (track) => {
113
- const videoSegment = getVideoSegment(track);
128
+ exports.getTrackTypeSegment = getTrackTypeSegment;
129
+ const getWidthSegment = (track) => {
130
+ const videoSegment = (0, exports.getVideoSegment)(track);
114
131
  if (!videoSegment) {
115
132
  return null;
116
133
  }
@@ -120,8 +137,9 @@ export const getWidthSegment = (track) => {
120
137
  }
121
138
  return width;
122
139
  };
123
- export const getHeightSegment = (track) => {
124
- const videoSegment = getVideoSegment(track);
140
+ exports.getWidthSegment = getWidthSegment;
141
+ const getHeightSegment = (track) => {
142
+ const videoSegment = (0, exports.getVideoSegment)(track);
125
143
  if (!videoSegment) {
126
144
  return null;
127
145
  }
@@ -131,8 +149,9 @@ export const getHeightSegment = (track) => {
131
149
  }
132
150
  return height;
133
151
  };
134
- export const getDisplayWidthSegment = (track) => {
135
- const videoSegment = getVideoSegment(track);
152
+ exports.getHeightSegment = getHeightSegment;
153
+ const getDisplayWidthSegment = (track) => {
154
+ const videoSegment = (0, exports.getVideoSegment)(track);
136
155
  if (!videoSegment) {
137
156
  return null;
138
157
  }
@@ -142,16 +161,18 @@ export const getDisplayWidthSegment = (track) => {
142
161
  }
143
162
  return displayWidth;
144
163
  };
145
- export const getTracksSegment = (segment) => {
164
+ exports.getDisplayWidthSegment = getDisplayWidthSegment;
165
+ const getTracksSegment = (segment) => {
146
166
  const tracksSegment = segment.value.find((b) => b.type === 'Tracks');
147
167
  if (!tracksSegment) {
148
168
  return null;
149
169
  }
150
170
  return tracksSegment;
151
171
  };
152
- export const getTrackWithUid = (segment, trackUid) => {
172
+ exports.getTracksSegment = getTracksSegment;
173
+ const getTrackWithUid = (segment, trackUid) => {
153
174
  var _a, _b;
154
- const tracksSegment = getTracksSegment(segment);
175
+ const tracksSegment = (0, exports.getTracksSegment)(segment);
155
176
  if (!tracksSegment) {
156
177
  return null;
157
178
  }
@@ -164,7 +185,8 @@ export const getTrackWithUid = (segment, trackUid) => {
164
185
  }
165
186
  return ((_b = (_a = trackEntry.value.find((t) => t.type === 'TrackNumber')) === null || _a === void 0 ? void 0 : _a.value.value) !== null && _b !== void 0 ? _b : null);
166
187
  };
167
- export const getTimescaleSegment = (segment) => {
188
+ exports.getTrackWithUid = getTrackWithUid;
189
+ const getTimescaleSegment = (segment) => {
168
190
  const infoSegment = segment.value.find((b) => b.type === 'Info');
169
191
  if (!infoSegment || infoSegment.type !== 'Info') {
170
192
  return null;
@@ -175,22 +197,25 @@ export const getTimescaleSegment = (segment) => {
175
197
  }
176
198
  return timescale;
177
199
  };
178
- export const getVideoSegment = (track) => {
200
+ exports.getTimescaleSegment = getTimescaleSegment;
201
+ const getVideoSegment = (track) => {
179
202
  const videoSegment = track.value.find((b) => b.type === 'Video');
180
203
  if (!videoSegment || videoSegment.type !== 'Video') {
181
204
  return null;
182
205
  }
183
206
  return videoSegment !== null && videoSegment !== void 0 ? videoSegment : null;
184
207
  };
185
- export const getAudioSegment = (track) => {
208
+ exports.getVideoSegment = getVideoSegment;
209
+ const getAudioSegment = (track) => {
186
210
  const audioSegment = track.value.find((b) => b.type === 'Audio');
187
211
  if (!audioSegment || audioSegment.type !== 'Audio') {
188
212
  return null;
189
213
  }
190
214
  return audioSegment !== null && audioSegment !== void 0 ? audioSegment : null;
191
215
  };
192
- export const getSampleRate = (track) => {
193
- const audioSegment = getAudioSegment(track);
216
+ exports.getAudioSegment = getAudioSegment;
217
+ const getSampleRate = (track) => {
218
+ const audioSegment = (0, exports.getAudioSegment)(track);
194
219
  if (!audioSegment) {
195
220
  return null;
196
221
  }
@@ -200,8 +225,9 @@ export const getSampleRate = (track) => {
200
225
  }
201
226
  return samplingFrequency.value.value;
202
227
  };
203
- export const getNumberOfChannels = (track) => {
204
- const audioSegment = getAudioSegment(track);
228
+ exports.getSampleRate = getSampleRate;
229
+ const getNumberOfChannels = (track) => {
230
+ const audioSegment = (0, exports.getAudioSegment)(track);
205
231
  if (!audioSegment) {
206
232
  throw new Error('Could not find audio segment');
207
233
  }
@@ -211,8 +237,9 @@ export const getNumberOfChannels = (track) => {
211
237
  }
212
238
  return channels.value.value;
213
239
  };
214
- export const getBitDepth = (track) => {
215
- const audioSegment = getAudioSegment(track);
240
+ exports.getNumberOfChannels = getNumberOfChannels;
241
+ const getBitDepth = (track) => {
242
+ const audioSegment = (0, exports.getAudioSegment)(track);
216
243
  if (!audioSegment) {
217
244
  return null;
218
245
  }
@@ -222,14 +249,17 @@ export const getBitDepth = (track) => {
222
249
  }
223
250
  return bitDepth.value.value;
224
251
  };
225
- export const getPrivateData = (track) => {
252
+ exports.getBitDepth = getBitDepth;
253
+ const getPrivateData = (track) => {
226
254
  const privateData = track.value.find((b) => b.type === 'CodecPrivate');
227
255
  if (!privateData || privateData.type !== 'CodecPrivate') {
228
256
  return null;
229
257
  }
230
258
  return privateData.value;
231
259
  };
232
- export const getClusterSegment = (segment) => {
260
+ exports.getPrivateData = getPrivateData;
261
+ const getClusterSegment = (segment) => {
233
262
  const clusterSegment = segment.value.find((b) => b.type === 'Cluster');
234
263
  return clusterSegment !== null && clusterSegment !== void 0 ? clusterSegment : null;
235
264
  };
265
+ exports.getClusterSegment = getClusterSegment;
@@ -1,4 +1,7 @@
1
- export const convertAudioOrVideoSampleToWebCodecsTimestamps = (sample, timescale) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.convertAudioOrVideoSampleToWebCodecsTimestamps = void 0;
4
+ const convertAudioOrVideoSampleToWebCodecsTimestamps = (sample, timescale) => {
2
5
  const { cts, dts, timestamp } = sample;
3
6
  return {
4
7
  cts: (cts * 1000000) / timescale,
@@ -14,3 +17,4 @@ export const convertAudioOrVideoSampleToWebCodecsTimestamps = (sample, timescale
14
17
  timescale: 1000000,
15
18
  };
16
19
  };
20
+ exports.convertAudioOrVideoSampleToWebCodecsTimestamps = convertAudioOrVideoSampleToWebCodecsTimestamps;
@@ -1,8 +1,11 @@
1
- import { defaultSelectM3uAssociatedPlaylists, defaultSelectM3uStreamFn, } from './containers/m3u/select-stream';
2
- import { internalParseMedia } from './internal-parse-media';
3
- import { Log } from './log';
4
- import { webReader } from './web';
5
- export const downloadAndParseMedia = async (options) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.downloadAndParseMedia = void 0;
4
+ const select_stream_1 = require("./containers/m3u/select-stream");
5
+ const internal_parse_media_1 = require("./internal-parse-media");
6
+ const log_1 = require("./log");
7
+ const web_1 = require("./web");
8
+ const downloadAndParseMedia = async (options) => {
6
9
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14;
7
10
  const logLevel = (_a = options.logLevel) !== null && _a !== void 0 ? _a : 'info';
8
11
  const content = await options.writer.createContent({
@@ -10,7 +13,7 @@ export const downloadAndParseMedia = async (options) => {
10
13
  mimeType: 'shouldnotmatter',
11
14
  logLevel,
12
15
  });
13
- const returnValue = await internalParseMedia({
16
+ const returnValue = await (0, internal_parse_media_1.internalParseMedia)({
14
17
  fields: (_b = options.fields) !== null && _b !== void 0 ? _b : null,
15
18
  logLevel,
16
19
  mode: 'download',
@@ -18,8 +21,8 @@ export const downloadAndParseMedia = async (options) => {
18
21
  onAudioTrack: (_d = options.onAudioTrack) !== null && _d !== void 0 ? _d : null,
19
22
  onContainer: (_e = options.onContainer) !== null && _e !== void 0 ? _e : null,
20
23
  onDimensions: (_f = options.onDimensions) !== null && _f !== void 0 ? _f : null,
21
- selectM3uStream: (_g = options.selectM3uStream) !== null && _g !== void 0 ? _g : defaultSelectM3uStreamFn,
22
- selectM3uAssociatedPlaylists: (_h = options.selectM3uAssociatedPlaylists) !== null && _h !== void 0 ? _h : defaultSelectM3uAssociatedPlaylists,
24
+ selectM3uStream: (_g = options.selectM3uStream) !== null && _g !== void 0 ? _g : select_stream_1.defaultSelectM3uStreamFn,
25
+ selectM3uAssociatedPlaylists: (_h = options.selectM3uAssociatedPlaylists) !== null && _h !== void 0 ? _h : select_stream_1.defaultSelectM3uAssociatedPlaylists,
23
26
  mp4HeaderSegment: (_j = options.mp4HeaderSegment) !== null && _j !== void 0 ? _j : null,
24
27
  onDiscardedData: async (data) => {
25
28
  await content.write(data);
@@ -52,14 +55,14 @@ export const downloadAndParseMedia = async (options) => {
52
55
  onVideoCodec: (_10 = options.onVideoCodec) !== null && _10 !== void 0 ? _10 : null,
53
56
  onVideoTrack: (_11 = options.onVideoTrack) !== null && _11 !== void 0 ? _11 : null,
54
57
  progressIntervalInMs: (_12 = options.progressIntervalInMs) !== null && _12 !== void 0 ? _12 : null,
55
- reader: (_13 = options.reader) !== null && _13 !== void 0 ? _13 : webReader,
58
+ reader: (_13 = options.reader) !== null && _13 !== void 0 ? _13 : web_1.webReader,
56
59
  controller: (_14 = options.controller) !== null && _14 !== void 0 ? _14 : undefined,
57
60
  src: options.src,
58
61
  onError: async (err) => {
59
62
  var _a, _b;
60
63
  const action = (_b = (await ((_a = options.onError) === null || _a === void 0 ? void 0 : _a.call(options, err)))) !== null && _b !== void 0 ? _b : { action: 'fail' };
61
64
  if (action.action === 'fail') {
62
- Log.verbose(logLevel, 'Removing content');
65
+ log_1.Log.verbose(logLevel, 'Removing content');
63
66
  await content.finish();
64
67
  await content.remove();
65
68
  }
@@ -71,3 +74,4 @@ export const downloadAndParseMedia = async (options) => {
71
74
  await content.finish();
72
75
  return returnValue;
73
76
  };
77
+ exports.downloadAndParseMedia = downloadAndParseMedia;
@@ -1,18 +1,21 @@
1
- import { getM3uStreams } from './containers/m3u/get-streams';
2
- import { getAudioCodec } from './get-audio-codec';
3
- import { getContainer } from './get-container';
4
- import { getDimensions } from './get-dimensions';
5
- import { getDuration } from './get-duration';
6
- import { getFps } from './get-fps';
7
- import { getIsHdr } from './get-is-hdr';
8
- import { getKeyframes } from './get-keyframes';
9
- import { getLocation } from './get-location';
10
- import { getNumberOfAudioChannels } from './get-number-of-audio-channels';
11
- import { getSampleRate } from './get-sample-rate';
12
- import { getTracks } from './get-tracks';
13
- import { getVideoCodec } from './get-video-codec';
14
- import { getMetadata } from './metadata/get-metadata';
15
- export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue, name, mimeType, fieldsInReturnValue, }) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.emitAvailableInfo = void 0;
4
+ const get_streams_1 = require("./containers/m3u/get-streams");
5
+ const get_audio_codec_1 = require("./get-audio-codec");
6
+ const get_container_1 = require("./get-container");
7
+ const get_dimensions_1 = require("./get-dimensions");
8
+ const get_duration_1 = require("./get-duration");
9
+ const get_fps_1 = require("./get-fps");
10
+ const get_is_hdr_1 = require("./get-is-hdr");
11
+ const get_keyframes_1 = require("./get-keyframes");
12
+ const get_location_1 = require("./get-location");
13
+ const get_number_of_audio_channels_1 = require("./get-number-of-audio-channels");
14
+ const get_sample_rate_1 = require("./get-sample-rate");
15
+ const get_tracks_1 = require("./get-tracks");
16
+ const get_video_codec_1 = require("./get-video-codec");
17
+ const get_metadata_1 = require("./metadata/get-metadata");
18
+ const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue, name, mimeType, fieldsInReturnValue, }) => {
16
19
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
17
20
  const keys = Object.keys(hasInfo);
18
21
  const { emittedFields } = state;
@@ -30,7 +33,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
30
33
  if (key === 'durationInSeconds') {
31
34
  if (hasInfo.durationInSeconds) {
32
35
  if (!emittedFields.durationInSeconds) {
33
- const durationInSeconds = getDuration(state);
36
+ const durationInSeconds = (0, get_duration_1.getDuration)(state);
34
37
  await ((_b = callbacks.onDurationInSeconds) === null || _b === void 0 ? void 0 : _b.call(callbacks, durationInSeconds));
35
38
  if (fieldsInReturnValue.durationInSeconds) {
36
39
  returnValue.durationInSeconds = durationInSeconds;
@@ -43,7 +46,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
43
46
  if (key === 'slowDurationInSeconds') {
44
47
  if (hasInfo.slowDurationInSeconds &&
45
48
  !emittedFields.slowDurationInSeconds) {
46
- const slowDurationInSeconds = (_c = getDuration(state)) !== null && _c !== void 0 ? _c : state.slowDurationAndFps.getSlowDurationInSeconds();
49
+ const slowDurationInSeconds = (_c = (0, get_duration_1.getDuration)(state)) !== null && _c !== void 0 ? _c : state.slowDurationAndFps.getSlowDurationInSeconds();
47
50
  await ((_d = callbacks.onSlowDurationInSeconds) === null || _d === void 0 ? void 0 : _d.call(callbacks, slowDurationInSeconds));
48
51
  if (fieldsInReturnValue.slowDurationInSeconds) {
49
52
  returnValue.slowDurationInSeconds = slowDurationInSeconds;
@@ -55,7 +58,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
55
58
  if (key === 'fps') {
56
59
  if (hasInfo.fps) {
57
60
  if (!emittedFields.fps) {
58
- const fps = getFps(state);
61
+ const fps = (0, get_fps_1.getFps)(state);
59
62
  await ((_e = callbacks.onFps) === null || _e === void 0 ? void 0 : _e.call(callbacks, fps));
60
63
  if (fieldsInReturnValue.fps) {
61
64
  returnValue.fps = fps;
@@ -63,7 +66,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
63
66
  emittedFields.fps = true;
64
67
  }
65
68
  if (!emittedFields.slowFps) {
66
- const fps = getFps(state);
69
+ const fps = (0, get_fps_1.getFps)(state);
67
70
  if (fps) {
68
71
  await ((_f = callbacks.onSlowFps) === null || _f === void 0 ? void 0 : _f.call(callbacks, fps));
69
72
  if (fieldsInReturnValue.slowFps) {
@@ -89,7 +92,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
89
92
  }
90
93
  if (key === 'dimensions') {
91
94
  if (hasInfo.dimensions && !emittedFields.dimensions) {
92
- const dimensionsQueried = getDimensions(state);
95
+ const dimensionsQueried = (0, get_dimensions_1.getDimensions)(state);
93
96
  const dimensions = dimensionsQueried === null
94
97
  ? null
95
98
  : {
@@ -106,7 +109,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
106
109
  }
107
110
  if (key === 'unrotatedDimensions') {
108
111
  if (hasInfo.unrotatedDimensions && !emittedFields.unrotatedDimensions) {
109
- const dimensionsQueried = getDimensions(state);
112
+ const dimensionsQueried = (0, get_dimensions_1.getDimensions)(state);
110
113
  const unrotatedDimensions = dimensionsQueried === null
111
114
  ? null
112
115
  : {
@@ -123,7 +126,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
123
126
  }
124
127
  if (key === 'rotation') {
125
128
  if (hasInfo.rotation && !emittedFields.rotation) {
126
- const dimensionsQueried = getDimensions(state);
129
+ const dimensionsQueried = (0, get_dimensions_1.getDimensions)(state);
127
130
  const rotation = (_k = dimensionsQueried === null || dimensionsQueried === void 0 ? void 0 : dimensionsQueried.rotation) !== null && _k !== void 0 ? _k : 0;
128
131
  await ((_l = callbacks.onRotation) === null || _l === void 0 ? void 0 : _l.call(callbacks, rotation));
129
132
  if (fieldsInReturnValue.rotation) {
@@ -135,7 +138,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
135
138
  }
136
139
  if (key === 'videoCodec') {
137
140
  if (!emittedFields.videoCodec && hasInfo.videoCodec) {
138
- const videoCodec = getVideoCodec(state);
141
+ const videoCodec = (0, get_video_codec_1.getVideoCodec)(state);
139
142
  await ((_m = callbacks.onVideoCodec) === null || _m === void 0 ? void 0 : _m.call(callbacks, videoCodec));
140
143
  if (fieldsInReturnValue.videoCodec) {
141
144
  returnValue.videoCodec = videoCodec;
@@ -146,7 +149,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
146
149
  }
147
150
  if (key === 'audioCodec') {
148
151
  if (!emittedFields.audioCodec && hasInfo.audioCodec) {
149
- const audioCodec = getAudioCodec(state);
152
+ const audioCodec = (0, get_audio_codec_1.getAudioCodec)(state);
150
153
  await ((_o = callbacks.onAudioCodec) === null || _o === void 0 ? void 0 : _o.call(callbacks, audioCodec));
151
154
  if (fieldsInReturnValue.audioCodec) {
152
155
  returnValue.audioCodec = audioCodec;
@@ -157,7 +160,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
157
160
  }
158
161
  if (key === 'tracks') {
159
162
  if (!emittedFields.tracks && hasInfo.tracks) {
160
- const { videoTracks, audioTracks } = getTracks(state);
163
+ const { videoTracks, audioTracks } = (0, get_tracks_1.getTracks)(state);
161
164
  await ((_p = callbacks.onTracks) === null || _p === void 0 ? void 0 : _p.call(callbacks, { videoTracks, audioTracks }));
162
165
  if (fieldsInReturnValue.tracks) {
163
166
  returnValue.tracks = { videoTracks, audioTracks };
@@ -209,7 +212,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
209
212
  }
210
213
  if (key === 'isHdr') {
211
214
  if (!returnValue.isHdr && hasInfo.isHdr) {
212
- const isHdr = getIsHdr(state);
215
+ const isHdr = (0, get_is_hdr_1.getIsHdr)(state);
213
216
  await ((_t = callbacks.onIsHdr) === null || _t === void 0 ? void 0 : _t.call(callbacks, isHdr));
214
217
  if (fieldsInReturnValue.isHdr) {
215
218
  returnValue.isHdr = isHdr;
@@ -220,7 +223,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
220
223
  }
221
224
  if (key === 'container') {
222
225
  if (!returnValue.container && hasInfo.container) {
223
- const container = getContainer(state.getStructure());
226
+ const container = (0, get_container_1.getContainer)(state.getStructure());
224
227
  await ((_u = callbacks.onContainer) === null || _u === void 0 ? void 0 : _u.call(callbacks, container));
225
228
  if (fieldsInReturnValue.container) {
226
229
  returnValue.container = container;
@@ -231,7 +234,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
231
234
  }
232
235
  if (key === 'metadata') {
233
236
  if (!emittedFields.metadata && hasInfo.metadata) {
234
- const metadata = getMetadata(state);
237
+ const metadata = (0, get_metadata_1.getMetadata)(state);
235
238
  await ((_v = callbacks.onMetadata) === null || _v === void 0 ? void 0 : _v.call(callbacks, metadata));
236
239
  if (fieldsInReturnValue.metadata) {
237
240
  returnValue.metadata = metadata;
@@ -242,7 +245,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
242
245
  }
243
246
  if (key === 'location') {
244
247
  if (!emittedFields.location && hasInfo.location) {
245
- const location = getLocation(state);
248
+ const location = (0, get_location_1.getLocation)(state);
246
249
  await ((_w = callbacks.onLocation) === null || _w === void 0 ? void 0 : _w.call(callbacks, location));
247
250
  if (fieldsInReturnValue.location) {
248
251
  returnValue.location = location;
@@ -296,9 +299,9 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
296
299
  }
297
300
  if (key === 'keyframes') {
298
301
  if (!emittedFields.keyframes && hasInfo.keyframes) {
299
- await ((_1 = callbacks.onKeyframes) === null || _1 === void 0 ? void 0 : _1.call(callbacks, getKeyframes(state)));
302
+ await ((_1 = callbacks.onKeyframes) === null || _1 === void 0 ? void 0 : _1.call(callbacks, (0, get_keyframes_1.getKeyframes)(state)));
300
303
  if (fieldsInReturnValue.keyframes) {
301
- returnValue.keyframes = getKeyframes(state);
304
+ returnValue.keyframes = (0, get_keyframes_1.getKeyframes)(state);
302
305
  }
303
306
  emittedFields.keyframes = true;
304
307
  }
@@ -316,7 +319,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
316
319
  }
317
320
  if (key === 'sampleRate') {
318
321
  if (!emittedFields.sampleRate && hasInfo.sampleRate) {
319
- const sampleRate = getSampleRate(state);
322
+ const sampleRate = (0, get_sample_rate_1.getSampleRate)(state);
320
323
  await ((_3 = callbacks.onSampleRate) === null || _3 === void 0 ? void 0 : _3.call(callbacks, sampleRate));
321
324
  if (fieldsInReturnValue.sampleRate) {
322
325
  returnValue.sampleRate = sampleRate;
@@ -328,7 +331,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
328
331
  if (key === 'numberOfAudioChannels') {
329
332
  if (!emittedFields.numberOfAudioChannels &&
330
333
  hasInfo.numberOfAudioChannels) {
331
- const numberOfAudioChannels = getNumberOfAudioChannels(state);
334
+ const numberOfAudioChannels = (0, get_number_of_audio_channels_1.getNumberOfAudioChannels)(state);
332
335
  await ((_4 = callbacks.onNumberOfAudioChannels) === null || _4 === void 0 ? void 0 : _4.call(callbacks, numberOfAudioChannels));
333
336
  if (fieldsInReturnValue.numberOfAudioChannels) {
334
337
  returnValue.numberOfAudioChannels = numberOfAudioChannels;
@@ -339,7 +342,7 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
339
342
  }
340
343
  if (key === 'm3uStreams') {
341
344
  if (!emittedFields.m3uStreams && hasInfo.m3uStreams) {
342
- const streams = getM3uStreams({
345
+ const streams = (0, get_streams_1.getM3uStreams)({
343
346
  structure: state.getStructureOrNull(),
344
347
  originalSrc: state.src,
345
348
  readerInterface: state.readerInterface,
@@ -355,3 +358,4 @@ export const emitAvailableInfo = async ({ hasInfo, callbacks, state, returnValue
355
358
  throw new Error(`Unhandled key: ${key}`);
356
359
  }
357
360
  };
361
+ exports.emitAvailableInfo = emitAvailableInfo;
package/dist/emitter.js CHANGED
@@ -1,4 +1,7 @@
1
- export class MediaParserEmitter {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MediaParserEmitter = void 0;
4
+ class MediaParserEmitter {
2
5
  constructor() {
3
6
  this.listeners = {
4
7
  pause: [],
@@ -27,3 +30,4 @@ export class MediaParserEmitter {
27
30
  });
28
31
  }
29
32
  }
33
+ exports.MediaParserEmitter = MediaParserEmitter;