@remotion/media-parser 4.0.240 → 4.0.242
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add-avc-profile-to-track.js +2 -2
- package/dist/boxes/avc/codec-private.d.ts +1 -1
- package/dist/boxes/avc/codec-private.js +2 -2
- package/dist/boxes/avc/create-sps-pps-data.d.ts +2 -0
- package/dist/boxes/avc/create-sps-pps-data.js +28 -0
- package/dist/boxes/iso-base-media/get-keyframes.d.ts +3 -0
- package/dist/boxes/iso-base-media/get-keyframes.js +30 -0
- package/dist/boxes/iso-base-media/mdat/mdat.d.ts +3 -3
- package/dist/boxes/iso-base-media/mdat/mdat.js +9 -5
- package/dist/boxes/iso-base-media/moov/moov.d.ts +3 -3
- package/dist/boxes/iso-base-media/moov/moov.js +5 -4
- package/dist/boxes/iso-base-media/process-box.d.ts +9 -9
- package/dist/boxes/iso-base-media/process-box.js +48 -56
- package/dist/boxes/iso-base-media/stsd/mebx.d.ts +3 -3
- package/dist/boxes/iso-base-media/stsd/mebx.js +5 -4
- package/dist/boxes/iso-base-media/stsd/samples.d.ts +5 -5
- package/dist/boxes/iso-base-media/stsd/samples.js +19 -16
- package/dist/boxes/iso-base-media/stsd/stsd.d.ts +3 -3
- package/dist/boxes/iso-base-media/stsd/stsd.js +2 -2
- package/dist/boxes/iso-base-media/trak/trak.d.ts +3 -3
- package/dist/boxes/iso-base-media/trak/trak.js +7 -6
- package/dist/boxes/riff/expect-riff-box.d.ts +3 -3
- package/dist/boxes/riff/expect-riff-box.js +5 -5
- package/dist/boxes/riff/get-tracks-from-avi.js +1 -1
- package/dist/boxes/riff/parse-box.d.ts +7 -7
- package/dist/boxes/riff/parse-box.js +29 -24
- package/dist/boxes/riff/parse-list-box.d.ts +3 -3
- package/dist/boxes/riff/parse-list-box.js +2 -2
- package/dist/boxes/riff/parse-movi.d.ts +5 -5
- package/dist/boxes/riff/parse-movi.js +35 -20
- package/dist/boxes/riff/parse-riff-box.d.ts +3 -3
- package/dist/boxes/riff/parse-riff-box.js +2 -2
- package/dist/boxes/transport-stream/adts-header.d.ts +1 -1
- package/dist/boxes/transport-stream/discard-rest-of-packet.d.ts +1 -1
- package/dist/boxes/transport-stream/get-tracks.js +1 -1
- package/dist/boxes/transport-stream/handle-aac-packet.d.ts +4 -3
- package/dist/boxes/transport-stream/handle-aac-packet.js +6 -4
- package/dist/boxes/transport-stream/handle-avc-packet.d.ts +4 -3
- package/dist/boxes/transport-stream/handle-avc-packet.js +8 -6
- package/dist/boxes/transport-stream/parse-packet.d.ts +3 -3
- package/dist/boxes/transport-stream/parse-packet.js +2 -2
- package/dist/boxes/transport-stream/parse-stream-packet.d.ts +3 -3
- package/dist/boxes/transport-stream/parse-stream-packet.js +14 -7
- package/dist/boxes/transport-stream/parse-transport-stream.d.ts +5 -6
- package/dist/boxes/transport-stream/parse-transport-stream.js +10 -9
- package/dist/boxes/transport-stream/process-stream-buffers.d.ts +6 -5
- package/dist/boxes/transport-stream/process-stream-buffers.js +18 -8
- package/dist/boxes/webm/ebml.d.ts +1 -1
- package/dist/boxes/webm/get-sample-from-block.d.ts +2 -2
- package/dist/boxes/webm/get-sample-from-block.js +8 -4
- package/dist/boxes/webm/make-header.d.ts +3 -3
- package/dist/boxes/webm/parse-ebml.d.ts +4 -4
- package/dist/boxes/webm/parse-ebml.js +18 -18
- package/dist/boxes/webm/parse-webm-header.d.ts +5 -5
- package/dist/boxes/webm/parse-webm-header.js +6 -5
- package/dist/boxes/webm/segments/parse-children.d.ts +5 -5
- package/dist/boxes/webm/segments/parse-children.js +12 -13
- package/dist/boxes/webm/segments.d.ts +3 -3
- package/dist/boxes/webm/segments.js +13 -13
- package/dist/buffer-iterator.d.ts +2 -6
- package/dist/buffer-iterator.js +4 -29
- package/dist/convert-audio-or-video-sample.js +2 -0
- package/dist/create/iso-base-media/codec-specific/avc1.d.ts +1 -1
- package/dist/create/iso-base-media/codec-specific/create-codec-specific-data.d.ts +1 -1
- package/dist/create/iso-base-media/codec-specific/mp4a.d.ts +1 -1
- package/dist/create/iso-base-media/create-colr.d.ts +1 -1
- package/dist/create/iso-base-media/create-ftyp.d.ts +2 -2
- package/dist/create/iso-base-media/create-ilst.d.ts +1 -1
- package/dist/create/iso-base-media/create-mdia.d.ts +1 -1
- package/dist/create/iso-base-media/create-moov.d.ts +1 -1
- package/dist/create/iso-base-media/create-mvhd.d.ts +1 -1
- package/dist/create/iso-base-media/create-trak.d.ts +1 -1
- package/dist/create/iso-base-media/create-udta.d.ts +1 -1
- package/dist/create/iso-base-media/create-url.d.ts +1 -1
- package/dist/create/iso-base-media/ilst/create-cmt.d.ts +1 -1
- package/dist/create/iso-base-media/ilst/create-too.d.ts +1 -1
- package/dist/create/iso-base-media/mdia/create-mdhd.d.ts +1 -1
- package/dist/create/iso-base-media/mp4-header.d.ts +1 -1
- package/dist/create/iso-base-media/primitives.d.ts +13 -13
- package/dist/create/iso-base-media/serialize-track.d.ts +1 -1
- package/dist/create/iso-base-media/trak/create-tkhd.d.ts +2 -2
- package/dist/create/iso-base-media/trak/mdia/create-minf.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/create-dinf.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/create-smhd.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/create-stbl.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/create-vmhd.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-ctts.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-stco.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-stsc.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-stss.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-stsz.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/stbl/create-stts.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/stbl/stsd/create-avc1.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/stbl/stsd/create-avcc.d.ts +1 -1
- package/dist/create/iso-base-media/trak/mdia/minf/stbl/stsd/create-pasp.d.ts +1 -1
- package/dist/create/iso-base-media/udta/create-meta.d.ts +1 -1
- package/dist/create/iso-base-media/udta/meta/create-hdlr.d.ts +1 -1
- package/dist/create/matroska/cluster-segment.d.ts +1 -1
- package/dist/emit-available-info.d.ts +6 -4
- package/dist/emit-available-info.js +231 -79
- package/dist/errors/detect-file-type.d.ts +1 -0
- package/dist/errors/detect-file-type.js +88 -0
- package/dist/errors/file-types.d.ts +1 -0
- package/dist/errors/file-types.js +88 -0
- package/dist/errors.d.ts +68 -0
- package/dist/errors.js +71 -0
- package/dist/esm/from-fetch.mjs +1 -0
- package/dist/esm/from-node.mjs +1 -0
- package/dist/esm/from-web-file.mjs +2 -1
- package/dist/esm/index.mjs +1457 -542
- package/dist/file-types/bmp.d.ts +6 -0
- package/dist/file-types/bmp.js +23 -0
- package/dist/file-types/detect-file-type.d.ts +42 -0
- package/dist/file-types/detect-file-type.js +59 -0
- package/dist/file-types/get-jpeg-dimensions.d.ts +4 -0
- package/dist/file-types/get-jpeg-dimensions.js +32 -0
- package/dist/file-types/index.d.ts +2 -0
- package/dist/file-types/index.js +57 -0
- package/dist/file-types/jpeg.d.ts +12 -0
- package/dist/file-types/jpeg.js +44 -0
- package/dist/file-types/pdf.d.ts +4 -0
- package/dist/file-types/pdf.js +12 -0
- package/dist/file-types/png.d.ts +10 -0
- package/dist/file-types/png.js +32 -0
- package/dist/file-types/webp.d.ts +6 -0
- package/dist/file-types/webp.js +69 -0
- package/dist/file-types.d.ts +1 -0
- package/dist/file-types.js +88 -0
- package/dist/get-audio-codec.d.ts +1 -1
- package/dist/get-duration.d.ts +1 -0
- package/dist/get-duration.js +14 -1
- package/dist/get-fields-from-callbacks.d.ts +5 -0
- package/dist/get-fields-from-callbacks.js +32 -0
- package/dist/get-fps.d.ts +1 -0
- package/dist/get-fps.js +17 -12
- package/dist/get-keyframes.d.ts +5 -0
- package/dist/get-keyframes.js +20 -0
- package/dist/get-tracks.d.ts +7 -1
- package/dist/get-tracks.js +15 -10
- package/dist/has-all-info.d.ts +5 -4
- package/dist/has-all-info.js +31 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -1
- package/dist/may-skip-video-data/may-skip-video-data.d.ts +4 -0
- package/dist/may-skip-video-data/may-skip-video-data.js +14 -0
- package/dist/may-skip-video-data/need-samples-for-fields.d.ts +5 -0
- package/dist/may-skip-video-data/need-samples-for-fields.js +33 -0
- package/dist/options.d.ts +68 -53
- package/dist/parse-media.js +42 -31
- package/dist/parse-result.d.ts +2 -4
- package/dist/parse-video.d.ts +8 -5
- package/dist/parse-video.js +94 -17
- package/dist/probing/detect-file-type.d.ts +1 -0
- package/dist/probing/detect-file-type.js +88 -0
- package/dist/probing/get-jpeg-dimensions.d.ts +4 -0
- package/dist/probing/get-jpeg-dimensions.js +32 -0
- package/dist/readers/from-fetch.js +1 -0
- package/dist/readers/from-node.js +1 -0
- package/dist/readers/from-web-file.js +1 -0
- package/dist/readers/reader.d.ts +1 -0
- package/dist/register-track.d.ts +5 -5
- package/dist/register-track.js +12 -12
- package/dist/state/can-skip-tracks.js +6 -0
- package/dist/state/emitted-fields.d.ts +2 -0
- package/dist/state/emitted-fields.js +31 -0
- package/dist/state/has-tracks-section.d.ts +1 -0
- package/dist/state/keyframes.d.ts +6 -0
- package/dist/state/keyframes.js +15 -0
- package/dist/state/parser-state.d.ts +60 -29
- package/dist/state/parser-state.js +32 -150
- package/dist/state/riff.d.ts +10 -0
- package/dist/state/riff.js +32 -0
- package/dist/state/sample-callbacks.d.ts +31 -0
- package/dist/state/sample-callbacks.js +96 -0
- package/dist/state/slow-duration-fps.d.ts +8 -0
- package/dist/state/slow-duration-fps.js +36 -0
- package/dist/state/structure.d.ts +7 -0
- package/dist/state/structure.js +21 -0
- package/dist/state/tracks-and-samples.d.ts +0 -0
- package/dist/state/tracks-and-samples.js +1 -0
- package/dist/state/webm.d.ts +11 -0
- package/dist/state/webm.js +67 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/webcodec-sample-types.d.ts +2 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createUdta: (children: Uint8Array) => Uint8Array
|
|
1
|
+
export declare const createUdta: (children: Uint8Array) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createUrlAtom: () => Uint8Array
|
|
1
|
+
export declare const createUrlAtom: () => Uint8Array<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createCmt: (comment: string) => Uint8Array
|
|
1
|
+
export declare const createCmt: (comment: string) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createToo: (value: string) => Uint8Array
|
|
1
|
+
export declare const createToo: (value: string) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import type { ThreeDMatrix } from '../../boxes/iso-base-media/mvhd';
|
|
2
|
-
export declare const stringsToUint8Array: (str: string) => Uint8Array
|
|
3
|
-
export declare const numberTo32BitUIntOrInt: (num: number) => Uint8Array
|
|
4
|
-
export declare const numberTo32BitUIntOrIntLeading128: (num: number) => Uint8Array
|
|
5
|
-
export declare const numberTo16BitUIntOrInt: (num: number) => Uint8Array
|
|
6
|
-
export declare const setFixedPointSignedOrUnsigned1616Number: (num: number) => Uint8Array
|
|
7
|
-
export declare const setFixedPointSigned230Number: (num: number) => Uint8Array
|
|
8
|
-
export declare const addSize: (arr: Uint8Array) => Uint8Array
|
|
9
|
-
export declare const addLeading128Size: (arr: Uint8Array) => Uint8Array
|
|
10
|
-
export declare const floatTo16Point1632Bit: (number: number) => Uint8Array
|
|
11
|
-
export declare const floatTo16Point16_16Bit: (number: number) => Uint8Array
|
|
12
|
-
export declare const serializeMatrix: (matrix: number[]) => Uint8Array
|
|
13
|
-
export declare const stringToPascalString: (str: string) => Uint8Array
|
|
14
|
-
export declare const padIsoBaseMediaBytes: (data: Uint8Array, totalLength: number) => Uint8Array
|
|
2
|
+
export declare const stringsToUint8Array: (str: string) => Uint8Array<ArrayBufferLike>;
|
|
3
|
+
export declare const numberTo32BitUIntOrInt: (num: number) => Uint8Array<ArrayBuffer>;
|
|
4
|
+
export declare const numberTo32BitUIntOrIntLeading128: (num: number) => Uint8Array<ArrayBuffer>;
|
|
5
|
+
export declare const numberTo16BitUIntOrInt: (num: number) => Uint8Array<ArrayBuffer>;
|
|
6
|
+
export declare const setFixedPointSignedOrUnsigned1616Number: (num: number) => Uint8Array<ArrayBuffer>;
|
|
7
|
+
export declare const setFixedPointSigned230Number: (num: number) => Uint8Array<ArrayBuffer>;
|
|
8
|
+
export declare const addSize: (arr: Uint8Array) => Uint8Array<ArrayBufferLike>;
|
|
9
|
+
export declare const addLeading128Size: (arr: Uint8Array) => Uint8Array<ArrayBufferLike>;
|
|
10
|
+
export declare const floatTo16Point1632Bit: (number: number) => Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare const floatTo16Point16_16Bit: (number: number) => Uint8Array<ArrayBuffer>;
|
|
12
|
+
export declare const serializeMatrix: (matrix: number[]) => Uint8Array<ArrayBufferLike>;
|
|
13
|
+
export declare const stringToPascalString: (str: string) => Uint8Array<ArrayBuffer>;
|
|
14
|
+
export declare const padIsoBaseMediaBytes: (data: Uint8Array, totalLength: number) => Uint8Array<ArrayBufferLike>;
|
|
15
15
|
export declare const IDENTITY_MATRIX: ThreeDMatrix;
|
|
@@ -6,4 +6,4 @@ export type IsoBaseMediaTrackData = {
|
|
|
6
6
|
samplePositions: SamplePosition[];
|
|
7
7
|
timescale: number;
|
|
8
8
|
};
|
|
9
|
-
export declare const serializeTrack: ({ track, durationInUnits, samplePositions, timescale, }: IsoBaseMediaTrackData) => Uint8Array
|
|
9
|
+
export declare const serializeTrack: ({ track, durationInUnits, samplePositions, timescale, }: IsoBaseMediaTrackData) => Uint8Array<ArrayBufferLike>;
|
|
@@ -12,7 +12,7 @@ export declare const createTkhdForAudio: ({ creationTime, modificationTime, flag
|
|
|
12
12
|
duration: number;
|
|
13
13
|
volume: number;
|
|
14
14
|
timescale: number;
|
|
15
|
-
}) => Uint8Array
|
|
15
|
+
}) => Uint8Array<ArrayBufferLike>;
|
|
16
16
|
export declare const createTkhdForVideo: ({ creationTime, modificationTime, duration, trackId, volume, matrix, width, height, flags, timescale, }: {
|
|
17
17
|
creationTime: number | null;
|
|
18
18
|
modificationTime: number | null;
|
|
@@ -24,4 +24,4 @@ export declare const createTkhdForVideo: ({ creationTime, modificationTime, dura
|
|
|
24
24
|
height: number;
|
|
25
25
|
flags: number;
|
|
26
26
|
timescale: number;
|
|
27
|
-
}) => Uint8Array
|
|
27
|
+
}) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createDinf: () => Uint8Array
|
|
1
|
+
export declare const createDinf: () => Uint8Array<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createSmhd: () => Uint8Array
|
|
1
|
+
export declare const createSmhd: () => Uint8Array<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createVmhd: () => Uint8Array
|
|
1
|
+
export declare const createVmhd: () => Uint8Array<ArrayBufferLike>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SamplePosition } from '../../../../../../get-sample-positions';
|
|
2
|
-
export declare const createCttsBox: (samplePositions: SamplePosition[]) => Uint8Array | null;
|
|
2
|
+
export declare const createCttsBox: (samplePositions: SamplePosition[]) => Uint8Array<ArrayBufferLike> | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SamplePosition } from '../../../../../../get-sample-positions';
|
|
2
|
-
export declare const createStcoAtom: (samplePositions: SamplePosition[]) => Uint8Array
|
|
2
|
+
export declare const createStcoAtom: (samplePositions: SamplePosition[]) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SamplePosition } from '../../../../../../get-sample-positions';
|
|
2
|
-
export declare const createStsc: (samplePositions: SamplePosition[]) => Uint8Array
|
|
2
|
+
export declare const createStsc: (samplePositions: SamplePosition[]) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SamplePosition } from '../../../../../../get-sample-positions';
|
|
2
|
-
export declare const createStss: (samplePositions: SamplePosition[]) => Uint8Array
|
|
2
|
+
export declare const createStss: (samplePositions: SamplePosition[]) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SamplePosition } from '../../../../../../get-sample-positions';
|
|
2
|
-
export declare const createStsz: (samplePositions: SamplePosition[]) => Uint8Array
|
|
2
|
+
export declare const createStsz: (samplePositions: SamplePosition[]) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { SamplePosition } from '../../../../../../get-sample-positions';
|
|
2
|
-
export declare const createSttsAtom: (samplePositions: SamplePosition[]) => Uint8Array
|
|
2
|
+
export declare const createSttsAtom: (samplePositions: SamplePosition[]) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createStsdData: (codecSpecificData: Uint8Array) => Uint8Array
|
|
1
|
+
export declare const createStsdData: (codecSpecificData: Uint8Array) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createAvccBox: (privateData: Uint8Array | null) => Uint8Array
|
|
1
|
+
export declare const createAvccBox: (privateData: Uint8Array | null) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createPasp: (x: number, y: number) => Uint8Array
|
|
1
|
+
export declare const createPasp: (x: number, y: number) => Uint8Array<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createHdlr: (type: "video" | "audio" | "mdir") => Uint8Array
|
|
1
|
+
export declare const createHdlr: (type: "video" | "audio" | "mdir") => Uint8Array<ArrayBufferLike>;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { AllParseMediaFields, Options, ParseMediaCallbacks, ParseMediaFields, ParseMediaResult } from './options';
|
|
2
|
-
import type { ParseResult
|
|
2
|
+
import type { ParseResult } from './parse-result';
|
|
3
3
|
import type { ParserState } from './state/parser-state';
|
|
4
|
-
export declare const emitAvailableInfo: ({ hasInfo, parseResult,
|
|
4
|
+
export declare const emitAvailableInfo: ({ hasInfo, parseResult, callbacks, state, returnValue, contentLength, name, mimeType, fieldsInReturnValue, }: {
|
|
5
5
|
hasInfo: Record<keyof Options<ParseMediaFields>, boolean>;
|
|
6
|
-
parseResult: ParseResult
|
|
7
|
-
|
|
6
|
+
parseResult: ParseResult | null;
|
|
7
|
+
callbacks: ParseMediaCallbacks;
|
|
8
|
+
fieldsInReturnValue: Options<ParseMediaFields>;
|
|
8
9
|
state: ParserState;
|
|
9
10
|
returnValue: ParseMediaResult<AllParseMediaFields>;
|
|
10
11
|
contentLength: number | null;
|
|
12
|
+
mimeType: string | null;
|
|
11
13
|
name: string;
|
|
12
14
|
}) => void;
|
|
@@ -7,109 +7,192 @@ const get_dimensions_1 = require("./get-dimensions");
|
|
|
7
7
|
const get_duration_1 = require("./get-duration");
|
|
8
8
|
const get_fps_1 = require("./get-fps");
|
|
9
9
|
const get_is_hdr_1 = require("./get-is-hdr");
|
|
10
|
+
const get_keyframes_1 = require("./get-keyframes");
|
|
10
11
|
const get_location_1 = require("./get-location");
|
|
11
12
|
const get_tracks_1 = require("./get-tracks");
|
|
12
13
|
const get_video_codec_1 = require("./get-video-codec");
|
|
13
14
|
const get_metadata_1 = require("./metadata/get-metadata");
|
|
14
|
-
const emitAvailableInfo = ({ hasInfo, parseResult,
|
|
15
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
15
|
+
const emitAvailableInfo = ({ hasInfo, parseResult, callbacks, state, returnValue, contentLength, name, mimeType, fieldsInReturnValue, }) => {
|
|
16
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
16
17
|
const keys = Object.keys(hasInfo);
|
|
18
|
+
const segments = state.structure.getStructureOrNull();
|
|
19
|
+
const { emittedFields } = state;
|
|
17
20
|
for (const key of keys) {
|
|
18
21
|
if (key === 'structure') {
|
|
19
22
|
if (parseResult &&
|
|
20
23
|
hasInfo.structure &&
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
!emittedFields.structure &&
|
|
25
|
+
segments) {
|
|
26
|
+
(_a = callbacks.onStructure) === null || _a === void 0 ? void 0 : _a.call(callbacks, segments);
|
|
27
|
+
if (fieldsInReturnValue.structure) {
|
|
28
|
+
returnValue.structure = segments;
|
|
29
|
+
}
|
|
30
|
+
emittedFields.structure = true;
|
|
24
31
|
}
|
|
25
32
|
continue;
|
|
26
33
|
}
|
|
27
34
|
if (key === 'durationInSeconds') {
|
|
28
|
-
if (hasInfo.durationInSeconds &&
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
if (hasInfo.durationInSeconds && parseResult && segments) {
|
|
36
|
+
if (!emittedFields.durationInSeconds) {
|
|
37
|
+
const durationInSeconds = (0, get_duration_1.getDuration)(segments, state);
|
|
38
|
+
(_b = callbacks.onDurationInSeconds) === null || _b === void 0 ? void 0 : _b.call(callbacks, durationInSeconds);
|
|
39
|
+
if (fieldsInReturnValue.durationInSeconds) {
|
|
40
|
+
returnValue.durationInSeconds = durationInSeconds;
|
|
41
|
+
}
|
|
42
|
+
emittedFields.durationInSeconds = true;
|
|
43
|
+
}
|
|
44
|
+
if (!emittedFields.slowDurationInSeconds) {
|
|
45
|
+
const durationInSeconds = (0, get_duration_1.getDuration)(segments, state);
|
|
46
|
+
if (durationInSeconds !== null) {
|
|
47
|
+
(_c = callbacks.onSlowDurationInSeconds) === null || _c === void 0 ? void 0 : _c.call(callbacks, durationInSeconds);
|
|
48
|
+
if (fieldsInReturnValue.slowDurationInSeconds) {
|
|
49
|
+
returnValue.slowDurationInSeconds = durationInSeconds;
|
|
50
|
+
}
|
|
51
|
+
emittedFields.slowDurationInSeconds = true;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (key === 'slowDurationInSeconds') {
|
|
58
|
+
if (hasInfo.slowDurationInSeconds &&
|
|
59
|
+
!emittedFields.slowDurationInSeconds &&
|
|
60
|
+
parseResult &&
|
|
61
|
+
segments) {
|
|
62
|
+
const slowDurationInSeconds = state.slowDurationAndFps.getSlowDurationInSeconds();
|
|
63
|
+
(_d = callbacks.onSlowDurationInSeconds) === null || _d === void 0 ? void 0 : _d.call(callbacks, slowDurationInSeconds);
|
|
64
|
+
if (fieldsInReturnValue.slowDurationInSeconds) {
|
|
65
|
+
returnValue.slowDurationInSeconds = slowDurationInSeconds;
|
|
66
|
+
}
|
|
67
|
+
emittedFields.slowDurationInSeconds = true;
|
|
68
|
+
}
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (key === 'fps') {
|
|
72
|
+
if (hasInfo.fps && parseResult && segments) {
|
|
73
|
+
if (!emittedFields.fps) {
|
|
74
|
+
const fps = (0, get_fps_1.getFps)(segments);
|
|
75
|
+
(_e = callbacks.onFps) === null || _e === void 0 ? void 0 : _e.call(callbacks, fps);
|
|
76
|
+
if (fieldsInReturnValue.fps) {
|
|
77
|
+
returnValue.fps = fps;
|
|
78
|
+
}
|
|
79
|
+
emittedFields.fps = true;
|
|
80
|
+
}
|
|
81
|
+
if (!emittedFields.slowFps) {
|
|
82
|
+
const fps = (0, get_fps_1.getFps)(segments);
|
|
83
|
+
if (fps) {
|
|
84
|
+
(_f = callbacks.onSlowFps) === null || _f === void 0 ? void 0 : _f.call(callbacks, fps);
|
|
85
|
+
if (fieldsInReturnValue.slowFps) {
|
|
86
|
+
returnValue.slowFps = fps;
|
|
87
|
+
}
|
|
88
|
+
emittedFields.slowFps = true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
// must be handled after fps
|
|
95
|
+
if (key === 'slowFps') {
|
|
96
|
+
if (hasInfo.slowFps &&
|
|
97
|
+
!emittedFields.slowFps &&
|
|
98
|
+
parseResult &&
|
|
99
|
+
segments) {
|
|
100
|
+
const slowFps = state.slowDurationAndFps.getFps();
|
|
101
|
+
(_g = callbacks.onSlowFps) === null || _g === void 0 ? void 0 : _g.call(callbacks, slowFps);
|
|
102
|
+
if (fieldsInReturnValue.slowFps) {
|
|
103
|
+
returnValue.slowFps = slowFps;
|
|
104
|
+
}
|
|
105
|
+
emittedFields.slowFps = true;
|
|
34
106
|
}
|
|
35
107
|
continue;
|
|
36
108
|
}
|
|
37
109
|
if (key === 'dimensions') {
|
|
38
110
|
if (hasInfo.dimensions &&
|
|
39
|
-
|
|
40
|
-
parseResult
|
|
41
|
-
|
|
111
|
+
!emittedFields.dimensions &&
|
|
112
|
+
parseResult &&
|
|
113
|
+
segments) {
|
|
114
|
+
const dimensionsQueried = (0, get_dimensions_1.getDimensions)(segments, state);
|
|
42
115
|
const dimensions = {
|
|
43
116
|
height: dimensionsQueried.height,
|
|
44
117
|
width: dimensionsQueried.width,
|
|
45
118
|
};
|
|
46
|
-
(
|
|
47
|
-
|
|
119
|
+
(_h = callbacks.onDimensions) === null || _h === void 0 ? void 0 : _h.call(callbacks, dimensions);
|
|
120
|
+
if (fieldsInReturnValue.dimensions) {
|
|
121
|
+
returnValue.dimensions = dimensions;
|
|
122
|
+
}
|
|
123
|
+
emittedFields.dimensions = true;
|
|
48
124
|
}
|
|
49
125
|
continue;
|
|
50
126
|
}
|
|
51
127
|
if (key === 'unrotatedDimensions') {
|
|
52
|
-
if (
|
|
53
|
-
|
|
54
|
-
parseResult
|
|
55
|
-
|
|
128
|
+
if (hasInfo.unrotatedDimensions &&
|
|
129
|
+
!emittedFields.unrotatedDimensions &&
|
|
130
|
+
parseResult &&
|
|
131
|
+
segments) {
|
|
132
|
+
const dimensionsQueried = (0, get_dimensions_1.getDimensions)(segments, state);
|
|
56
133
|
const unrotatedDimensions = {
|
|
57
134
|
height: dimensionsQueried.unrotatedHeight,
|
|
58
135
|
width: dimensionsQueried.unrotatedWidth,
|
|
59
136
|
};
|
|
60
|
-
(
|
|
61
|
-
|
|
137
|
+
(_j = callbacks.onUnrotatedDimensions) === null || _j === void 0 ? void 0 : _j.call(callbacks, unrotatedDimensions);
|
|
138
|
+
if (fieldsInReturnValue.unrotatedDimensions) {
|
|
139
|
+
returnValue.unrotatedDimensions = unrotatedDimensions;
|
|
140
|
+
}
|
|
141
|
+
emittedFields.unrotatedDimensions = true;
|
|
62
142
|
}
|
|
63
143
|
continue;
|
|
64
144
|
}
|
|
65
145
|
if (key === 'rotation') {
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
parseResult
|
|
69
|
-
|
|
146
|
+
if (hasInfo.rotation &&
|
|
147
|
+
!emittedFields.rotation &&
|
|
148
|
+
parseResult &&
|
|
149
|
+
segments) {
|
|
150
|
+
const dimensionsQueried = (0, get_dimensions_1.getDimensions)(segments, state);
|
|
70
151
|
const { rotation } = dimensionsQueried;
|
|
71
|
-
(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (key === 'fps') {
|
|
77
|
-
if (returnValue.fps === undefined && hasInfo.fps && parseResult) {
|
|
78
|
-
const fps = (0, get_fps_1.getFps)(parseResult.segments);
|
|
79
|
-
(_f = moreFields.onFps) === null || _f === void 0 ? void 0 : _f.call(moreFields, fps);
|
|
80
|
-
returnValue.fps = fps;
|
|
152
|
+
(_k = callbacks.onRotation) === null || _k === void 0 ? void 0 : _k.call(callbacks, rotation);
|
|
153
|
+
if (fieldsInReturnValue.rotation) {
|
|
154
|
+
returnValue.rotation = rotation;
|
|
155
|
+
}
|
|
156
|
+
emittedFields.rotation = true;
|
|
81
157
|
}
|
|
82
158
|
continue;
|
|
83
159
|
}
|
|
84
160
|
if (key === 'videoCodec') {
|
|
85
|
-
if (
|
|
161
|
+
if (!emittedFields.videoCodec &&
|
|
86
162
|
hasInfo.videoCodec &&
|
|
87
|
-
parseResult
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
163
|
+
parseResult &&
|
|
164
|
+
segments) {
|
|
165
|
+
const videoCodec = (0, get_video_codec_1.getVideoCodec)(segments, state);
|
|
166
|
+
(_l = callbacks.onVideoCodec) === null || _l === void 0 ? void 0 : _l.call(callbacks, videoCodec);
|
|
167
|
+
if (fieldsInReturnValue.videoCodec) {
|
|
168
|
+
returnValue.videoCodec = videoCodec;
|
|
169
|
+
}
|
|
170
|
+
emittedFields.videoCodec = true;
|
|
91
171
|
}
|
|
92
172
|
continue;
|
|
93
173
|
}
|
|
94
174
|
if (key === 'audioCodec') {
|
|
95
|
-
if (
|
|
175
|
+
if (!emittedFields.audioCodec &&
|
|
96
176
|
hasInfo.audioCodec &&
|
|
97
|
-
parseResult
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
177
|
+
parseResult &&
|
|
178
|
+
segments) {
|
|
179
|
+
const audioCodec = (0, get_audio_codec_1.getAudioCodec)(segments, state);
|
|
180
|
+
(_m = callbacks.onAudioCodec) === null || _m === void 0 ? void 0 : _m.call(callbacks, audioCodec);
|
|
181
|
+
if (fieldsInReturnValue.audioCodec) {
|
|
182
|
+
returnValue.audioCodec = audioCodec;
|
|
183
|
+
}
|
|
184
|
+
emittedFields.audioCodec = true;
|
|
101
185
|
}
|
|
102
186
|
continue;
|
|
103
187
|
}
|
|
104
188
|
if (key === 'tracks') {
|
|
105
|
-
if (hasInfo.tracks &&
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
returnValue.audioTracks = audioTracks;
|
|
189
|
+
if (!emittedFields.tracks && hasInfo.tracks && parseResult && segments) {
|
|
190
|
+
const { videoTracks, audioTracks } = (0, get_tracks_1.getTracks)(segments, state);
|
|
191
|
+
(_o = callbacks.onTracks) === null || _o === void 0 ? void 0 : _o.call(callbacks, { videoTracks, audioTracks });
|
|
192
|
+
if (fieldsInReturnValue.tracks) {
|
|
193
|
+
returnValue.tracks = { videoTracks, audioTracks };
|
|
194
|
+
}
|
|
195
|
+
emittedFields.tracks = true;
|
|
113
196
|
}
|
|
114
197
|
continue;
|
|
115
198
|
}
|
|
@@ -117,59 +200,128 @@ const emitAvailableInfo = ({ hasInfo, parseResult, moreFields, state, returnValu
|
|
|
117
200
|
// Special case: Always emitting internal stats at the end
|
|
118
201
|
if (hasInfo.internalStats) {
|
|
119
202
|
const internalStats = state.getInternalStats();
|
|
120
|
-
|
|
203
|
+
if (fieldsInReturnValue.internalStats) {
|
|
204
|
+
returnValue.internalStats = internalStats;
|
|
205
|
+
}
|
|
206
|
+
emittedFields.internalStats = true;
|
|
121
207
|
}
|
|
122
208
|
continue;
|
|
123
209
|
}
|
|
124
210
|
if (key === 'size') {
|
|
125
|
-
if (
|
|
126
|
-
(
|
|
127
|
-
|
|
211
|
+
if (!emittedFields.size && hasInfo.size) {
|
|
212
|
+
(_p = callbacks.onSize) === null || _p === void 0 ? void 0 : _p.call(callbacks, contentLength);
|
|
213
|
+
if (fieldsInReturnValue.size) {
|
|
214
|
+
returnValue.size = contentLength;
|
|
215
|
+
}
|
|
216
|
+
emittedFields.size = true;
|
|
217
|
+
}
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
if (key === 'mimeType') {
|
|
221
|
+
if (!emittedFields.mimeType && hasInfo.mimeType) {
|
|
222
|
+
(_q = callbacks.onMimeType) === null || _q === void 0 ? void 0 : _q.call(callbacks, mimeType);
|
|
223
|
+
if (fieldsInReturnValue.mimeType) {
|
|
224
|
+
returnValue.mimeType = mimeType;
|
|
225
|
+
}
|
|
226
|
+
emittedFields.mimeType = true;
|
|
128
227
|
}
|
|
129
228
|
continue;
|
|
130
229
|
}
|
|
131
230
|
if (key === 'name') {
|
|
132
|
-
if (
|
|
133
|
-
(
|
|
134
|
-
|
|
231
|
+
if (!emittedFields.name && hasInfo.name) {
|
|
232
|
+
(_r = callbacks.onName) === null || _r === void 0 ? void 0 : _r.call(callbacks, name);
|
|
233
|
+
if (fieldsInReturnValue.name) {
|
|
234
|
+
returnValue.name = name;
|
|
235
|
+
}
|
|
236
|
+
emittedFields.name = true;
|
|
135
237
|
}
|
|
136
238
|
continue;
|
|
137
239
|
}
|
|
138
240
|
if (key === 'isHdr') {
|
|
139
|
-
if (returnValue.isHdr
|
|
140
|
-
const isHdr = (0, get_is_hdr_1.getIsHdr)(
|
|
141
|
-
(
|
|
142
|
-
|
|
241
|
+
if (!returnValue.isHdr && hasInfo.isHdr && parseResult && segments) {
|
|
242
|
+
const isHdr = (0, get_is_hdr_1.getIsHdr)(segments, state);
|
|
243
|
+
(_s = callbacks.onIsHdr) === null || _s === void 0 ? void 0 : _s.call(callbacks, isHdr);
|
|
244
|
+
if (fieldsInReturnValue.isHdr) {
|
|
245
|
+
returnValue.isHdr = isHdr;
|
|
246
|
+
}
|
|
247
|
+
emittedFields.isHdr = true;
|
|
143
248
|
}
|
|
144
249
|
continue;
|
|
145
250
|
}
|
|
146
251
|
if (key === 'container') {
|
|
147
|
-
if (returnValue.container
|
|
252
|
+
if (!returnValue.container &&
|
|
148
253
|
hasInfo.container &&
|
|
149
|
-
parseResult
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
254
|
+
parseResult &&
|
|
255
|
+
segments) {
|
|
256
|
+
const container = (0, get_container_1.getContainer)(segments);
|
|
257
|
+
(_t = callbacks.onContainer) === null || _t === void 0 ? void 0 : _t.call(callbacks, container);
|
|
258
|
+
if (fieldsInReturnValue.container) {
|
|
259
|
+
returnValue.container = container;
|
|
260
|
+
}
|
|
261
|
+
emittedFields.container = true;
|
|
153
262
|
}
|
|
154
263
|
continue;
|
|
155
264
|
}
|
|
156
265
|
if (key === 'metadata') {
|
|
157
|
-
if (
|
|
266
|
+
if (!emittedFields.metadata &&
|
|
158
267
|
hasInfo.metadata &&
|
|
159
|
-
parseResult
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
268
|
+
parseResult &&
|
|
269
|
+
segments) {
|
|
270
|
+
const metadata = (0, get_metadata_1.getMetadata)(segments);
|
|
271
|
+
(_u = callbacks.onMetadata) === null || _u === void 0 ? void 0 : _u.call(callbacks, metadata);
|
|
272
|
+
if (fieldsInReturnValue.metadata) {
|
|
273
|
+
returnValue.metadata = metadata;
|
|
274
|
+
}
|
|
275
|
+
emittedFields.metadata = true;
|
|
163
276
|
}
|
|
164
277
|
continue;
|
|
165
278
|
}
|
|
166
279
|
if (key === 'location') {
|
|
167
|
-
if (
|
|
280
|
+
if (!emittedFields.location &&
|
|
168
281
|
hasInfo.location &&
|
|
282
|
+
parseResult &&
|
|
283
|
+
segments) {
|
|
284
|
+
const location = (0, get_location_1.getLocation)(segments);
|
|
285
|
+
(_v = callbacks.onLocation) === null || _v === void 0 ? void 0 : _v.call(callbacks, location);
|
|
286
|
+
if (fieldsInReturnValue.location) {
|
|
287
|
+
returnValue.location = location;
|
|
288
|
+
}
|
|
289
|
+
emittedFields.location = true;
|
|
290
|
+
}
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (key === 'slowKeyframes') {
|
|
294
|
+
if (!emittedFields.slowKeyframes &&
|
|
295
|
+
hasInfo.slowKeyframes &&
|
|
169
296
|
parseResult) {
|
|
170
|
-
|
|
171
|
-
(
|
|
172
|
-
|
|
297
|
+
(_w = callbacks.onSlowKeyframes) === null || _w === void 0 ? void 0 : _w.call(callbacks, state.keyframes.getKeyframes());
|
|
298
|
+
if (fieldsInReturnValue.slowKeyframes) {
|
|
299
|
+
returnValue.slowKeyframes = state.keyframes.getKeyframes();
|
|
300
|
+
}
|
|
301
|
+
emittedFields.slowKeyframes = true;
|
|
302
|
+
}
|
|
303
|
+
continue;
|
|
304
|
+
}
|
|
305
|
+
if (key === 'slowNumberOfFrames') {
|
|
306
|
+
if (!emittedFields.slowNumberOfFrames &&
|
|
307
|
+
hasInfo.slowNumberOfFrames &&
|
|
308
|
+
parseResult) {
|
|
309
|
+
(_x = callbacks.onSlowNumberOfFrames) === null || _x === void 0 ? void 0 : _x.call(callbacks, state.slowDurationAndFps.getSlowNumberOfFrames());
|
|
310
|
+
if (fieldsInReturnValue.slowNumberOfFrames) {
|
|
311
|
+
returnValue.slowNumberOfFrames =
|
|
312
|
+
state.slowDurationAndFps.getSlowNumberOfFrames();
|
|
313
|
+
}
|
|
314
|
+
emittedFields.slowNumberOfFrames = true;
|
|
315
|
+
}
|
|
316
|
+
continue;
|
|
317
|
+
}
|
|
318
|
+
if (key === 'keyframes') {
|
|
319
|
+
if (!emittedFields.keyframes && hasInfo.keyframes && parseResult) {
|
|
320
|
+
(_y = callbacks.onKeyframes) === null || _y === void 0 ? void 0 : _y.call(callbacks, (0, get_keyframes_1.getKeyframes)(state.structure.getStructure()));
|
|
321
|
+
if (fieldsInReturnValue.keyframes) {
|
|
322
|
+
returnValue.keyframes = (0, get_keyframes_1.getKeyframes)(state.structure.getStructure());
|
|
323
|
+
}
|
|
324
|
+
emittedFields.keyframes = true;
|
|
173
325
|
}
|
|
174
326
|
continue;
|
|
175
327
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const detectFileType: (data: Uint8Array) => "webp" | "riff" | "webm" | "iso-base-media" | "transport-stream" | "mp3" | "gif" | "png" | "bmp" | "jpeg" | "unknown";
|