@amazon/vinyl-util 1.2.1 → 1.2.2
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/types/current/tsconfig.tsbuildinfo +1 -1
- package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/dist/types/current/util/async/poll.d.ts +0 -34
- package/dist/types/current/util/async/poll.d.ts.map +0 -1
- package/dist/types/current/util/async/poll.js +0 -31
- package/dist/types/current/util/webm/parseWebm.d.ts +0 -43
- package/dist/types/current/util/webm/parseWebm.d.ts.map +0 -1
- package/dist/types/current/util/webm/parseWebm.js +0 -166
- package/dist/types/ts3.7/util/async/poll.d.ts +0 -34
- package/dist/types/ts3.7/util/webm/parseWebm.d.ts +0 -43
- package/dist/types/ts4.1/util/async/poll.d.ts +0 -34
- package/dist/types/ts4.1/util/webm/parseWebm.d.ts +0 -43
- package/dist/types/ts4.7/util/async/poll.d.ts +0 -34
- package/dist/types/ts4.7/util/webm/parseWebm.d.ts +0 -43
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/** The default `TimecodeScale` (1ms in nanoseconds) when none is present. */
|
|
2
|
-
export declare const DEFAULT_WEBM_TIMECODE_SCALE = 1000000;
|
|
3
|
-
export interface WebmInitInfo {
|
|
4
|
-
/**
|
|
5
|
-
* The absolute byte offset (in the file) where the `Segment` element's
|
|
6
|
-
* content begins. `CueClusterPosition` values are relative to this.
|
|
7
|
-
*/
|
|
8
|
-
readonly segmentDataStart: number;
|
|
9
|
-
/**
|
|
10
|
-
* The `Segment` content size in bytes, or `null` if encoded as unknown.
|
|
11
|
-
*/
|
|
12
|
-
readonly segmentSize: number | null;
|
|
13
|
-
/**
|
|
14
|
-
* The `TimecodeScale` in nanoseconds per tick (cue times are in these ticks).
|
|
15
|
-
*/
|
|
16
|
-
readonly timecodeScale: number;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Parses a WebM initialization segment for the `Segment` data offset and
|
|
20
|
-
* `TimecodeScale`. The init segment is everything before the first `Cluster`
|
|
21
|
-
* (EBML header, `Segment` header, `SeekHead`, `Info`, `Tracks`).
|
|
22
|
-
*/
|
|
23
|
-
export declare function parseWebmInit(buffer: ArrayBuffer): WebmInitInfo;
|
|
24
|
-
/**
|
|
25
|
-
* A single WebM cue point: a cluster's start time and its byte offset relative
|
|
26
|
-
* to the `Segment` data start.
|
|
27
|
-
*/
|
|
28
|
-
export interface WebmCuePoint {
|
|
29
|
-
/**
|
|
30
|
-
* The cluster's start time, in `TimecodeScale` ticks.
|
|
31
|
-
*/
|
|
32
|
-
readonly time: number;
|
|
33
|
-
/**
|
|
34
|
-
* The cluster's byte offset relative to the `Segment` data start.
|
|
35
|
-
*/
|
|
36
|
-
readonly clusterPosition: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Parses a WebM `Cues` element (as located by a DASH `SegmentBase@indexRange`)
|
|
40
|
-
* into its cue points, in order.
|
|
41
|
-
*/
|
|
42
|
-
export declare function parseWebmCues(buffer: ArrayBuffer): readonly WebmCuePoint[];
|
|
43
|
-
//# sourceMappingURL=parseWebm.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseWebm.d.ts","sourceRoot":"","sources":["../../../../../src/util/webm/parseWebm.ts"],"names":[],"mappings":"AA6BA,6EAA6E;AAC7E,eAAO,MAAM,2BAA2B,UAAY,CAAA;AAmGpD,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;IAEjC;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAEnC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CACjC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,YAAY,CAsB/D;AAcD;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IAErB;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAA;CACnC;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,YAAY,EAAE,CAiB1E"}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { ValidationError } from '../../error/ValidationError';
|
|
6
|
-
import { ErrorOrigin } from '../../error/ErrorOrigin';
|
|
7
|
-
/**
|
|
8
|
-
* A minimal EBML/Matroska (WebM) parser: just enough to index a DASH
|
|
9
|
-
* `SegmentBase` WebM stream — the `Segment` data offset and `TimecodeScale`
|
|
10
|
-
* from the initialization segment, and the `CuePoint`s from the `Cues` element
|
|
11
|
-
* (the WebM equivalent of an ISO-BMFF `sidx`).
|
|
12
|
-
*
|
|
13
|
-
* @module
|
|
14
|
-
*/
|
|
15
|
-
/** EBML element IDs (with their length-descriptor marker bits intact). */
|
|
16
|
-
const EBML_ID = {
|
|
17
|
-
Segment: 0x18538067,
|
|
18
|
-
Info: 0x1549a966,
|
|
19
|
-
TimecodeScale: 0x2ad7b1,
|
|
20
|
-
Cues: 0x1c53bb6b,
|
|
21
|
-
CuePoint: 0xbb,
|
|
22
|
-
CueTime: 0xb3,
|
|
23
|
-
CueTrackPositions: 0xb7,
|
|
24
|
-
CueClusterPosition: 0xf1,
|
|
25
|
-
};
|
|
26
|
-
/** The default `TimecodeScale` (1ms in nanoseconds) when none is present. */
|
|
27
|
-
export const DEFAULT_WEBM_TIMECODE_SCALE = 1_000_000;
|
|
28
|
-
/**
|
|
29
|
-
* Reads an EBML variable-length integer at `pos`.
|
|
30
|
-
*
|
|
31
|
-
* @param keepMarker When true (element ids), the leading length-descriptor
|
|
32
|
-
* marker bit is retained; when false (sizes/uints), it is stripped to yield the
|
|
33
|
-
* numeric value, and an all-ones value ("unknown size") yields `null`.
|
|
34
|
-
*/
|
|
35
|
-
function readVint(view, pos, keepMarker) {
|
|
36
|
-
const first = view.getUint8(pos);
|
|
37
|
-
let mask = 0x80;
|
|
38
|
-
let length = 1;
|
|
39
|
-
while (length <= 8 && (first & mask) === 0) {
|
|
40
|
-
mask >>= 1;
|
|
41
|
-
length++;
|
|
42
|
-
}
|
|
43
|
-
if (length > 8)
|
|
44
|
-
throw new ValidationError('invalid EBML variable-length integer', ErrorOrigin.MEDIA);
|
|
45
|
-
let value = keepMarker ? first : first & (mask - 1);
|
|
46
|
-
let allOnes = (first & (mask - 1)) === mask - 1;
|
|
47
|
-
for (let i = 1; i < length; i++) {
|
|
48
|
-
const byte = view.getUint8(pos + i);
|
|
49
|
-
allOnes = allOnes && byte === 0xff;
|
|
50
|
-
// Multiply (not shift) to stay correct beyond 32 bits.
|
|
51
|
-
value = value * 256 + byte;
|
|
52
|
-
}
|
|
53
|
-
return { value: !keepMarker && allOnes ? null : value, length };
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Reads the EBML element header at `pos`.
|
|
57
|
-
*/
|
|
58
|
-
function readElementHeader(view, pos) {
|
|
59
|
-
const { value: id, length: idLength } = readVint(view, pos, true);
|
|
60
|
-
const { value: size, length: sizeLength } = readVint(view, pos + idLength, false);
|
|
61
|
-
const contentStart = pos + idLength + sizeLength;
|
|
62
|
-
return {
|
|
63
|
-
id: id,
|
|
64
|
-
contentStart,
|
|
65
|
-
size,
|
|
66
|
-
end: size == null ? null : contentStart + size,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Reads the child element headers in `[start, end)`. An unknown-size element
|
|
71
|
-
* (no bounded end) terminates the list.
|
|
72
|
-
*/
|
|
73
|
-
function childHeaders(view, start, end) {
|
|
74
|
-
const out = [];
|
|
75
|
-
let pos = start;
|
|
76
|
-
while (pos < end) {
|
|
77
|
-
const el = readElementHeader(view, pos);
|
|
78
|
-
out.push(el);
|
|
79
|
-
if (el.end == null)
|
|
80
|
-
break;
|
|
81
|
-
pos = el.end;
|
|
82
|
-
}
|
|
83
|
-
return out;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Reads a big-endian unsigned integer of `length` bytes at `pos`.
|
|
87
|
-
*/
|
|
88
|
-
function readUint(view, pos, length) {
|
|
89
|
-
let value = 0;
|
|
90
|
-
for (let i = 0; i < length; i++)
|
|
91
|
-
value = value * 256 + view.getUint8(pos + i);
|
|
92
|
-
return value;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Parses a WebM initialization segment for the `Segment` data offset and
|
|
96
|
-
* `TimecodeScale`. The init segment is everything before the first `Cluster`
|
|
97
|
-
* (EBML header, `Segment` header, `SeekHead`, `Info`, `Tracks`).
|
|
98
|
-
*/
|
|
99
|
-
export function parseWebmInit(buffer) {
|
|
100
|
-
const view = new DataView(buffer);
|
|
101
|
-
const segment = childHeaders(view, 0, view.byteLength).find((el) => el.id === EBML_ID.Segment);
|
|
102
|
-
if (!segment)
|
|
103
|
-
throw new ValidationError('WebM init segment missing Segment element', ErrorOrigin.MEDIA);
|
|
104
|
-
const segmentEnd = Math.min(segment.end ?? view.byteLength, view.byteLength);
|
|
105
|
-
const info = childHeaders(view, segment.contentStart, segmentEnd).find((el) => el.id === EBML_ID.Info && el.size != null);
|
|
106
|
-
return {
|
|
107
|
-
segmentDataStart: segment.contentStart,
|
|
108
|
-
segmentSize: segment.size,
|
|
109
|
-
timecodeScale: info
|
|
110
|
-
? readTimecodeScale(view, info.contentStart, info.end)
|
|
111
|
-
: DEFAULT_WEBM_TIMECODE_SCALE,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Reads `Info > TimecodeScale`, defaulting when absent.
|
|
116
|
-
*/
|
|
117
|
-
function readTimecodeScale(view, start, end) {
|
|
118
|
-
const el = childHeaders(view, start, end).find((child) => child.id === EBML_ID.TimecodeScale && child.size);
|
|
119
|
-
return el
|
|
120
|
-
? readUint(view, el.contentStart, el.size)
|
|
121
|
-
: DEFAULT_WEBM_TIMECODE_SCALE;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Parses a WebM `Cues` element (as located by a DASH `SegmentBase@indexRange`)
|
|
125
|
-
* into its cue points, in order.
|
|
126
|
-
*/
|
|
127
|
-
export function parseWebmCues(buffer) {
|
|
128
|
-
const view = new DataView(buffer);
|
|
129
|
-
const cues = readElementHeader(view, 0);
|
|
130
|
-
if (cues.id !== EBML_ID.Cues)
|
|
131
|
-
throw new ValidationError(`expected WebM 'Cues' element but had id: 0x${cues.id.toString(16)}`, ErrorOrigin.MEDIA);
|
|
132
|
-
const cuesEnd = Math.min(cues.end ?? view.byteLength, view.byteLength);
|
|
133
|
-
const cuePoints = [];
|
|
134
|
-
for (const el of childHeaders(view, cues.contentStart, cuesEnd)) {
|
|
135
|
-
if (el.id !== EBML_ID.CuePoint || el.size == null)
|
|
136
|
-
continue;
|
|
137
|
-
const cuePoint = parseCuePoint(view, el.contentStart, el.end);
|
|
138
|
-
if (cuePoint)
|
|
139
|
-
cuePoints.push(cuePoint);
|
|
140
|
-
}
|
|
141
|
-
return cuePoints;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Parses a single `CuePoint` (its `CueTime` and first
|
|
145
|
-
* `CueTrackPositions > CueClusterPosition`).
|
|
146
|
-
*/
|
|
147
|
-
function parseCuePoint(view, start, end) {
|
|
148
|
-
let time = null;
|
|
149
|
-
let clusterPosition = null;
|
|
150
|
-
for (const el of childHeaders(view, start, end)) {
|
|
151
|
-
if (el.id === EBML_ID.CueTime && el.size)
|
|
152
|
-
time = readUint(view, el.contentStart, el.size);
|
|
153
|
-
else if (el.id === EBML_ID.CueTrackPositions && el.size != null)
|
|
154
|
-
clusterPosition = readCueClusterPosition(view, el.contentStart, el.end);
|
|
155
|
-
}
|
|
156
|
-
return time != null && clusterPosition != null
|
|
157
|
-
? { time, clusterPosition }
|
|
158
|
-
: null;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Reads `CueTrackPositions > CueClusterPosition`.
|
|
162
|
-
*/
|
|
163
|
-
function readCueClusterPosition(view, start, end) {
|
|
164
|
-
const el = childHeaders(view, start, end).find((child) => child.id === EBML_ID.CueClusterPosition && child.size);
|
|
165
|
-
return el ? readUint(view, el.contentStart, el.size) : null;
|
|
166
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { ReadonlyAbort } from './Abort';
|
|
2
|
-
import { Maybe } from '../type';
|
|
3
|
-
export interface PollOptions {
|
|
4
|
-
/**
|
|
5
|
-
* How long to keep polling before giving up, in seconds. If omitted,
|
|
6
|
-
* polling continues indefinitely until the predicate returns `true` (or the
|
|
7
|
-
* signal aborts).
|
|
8
|
-
*/
|
|
9
|
-
readonly timeout?: number;
|
|
10
|
-
/**
|
|
11
|
-
* If provided, aborting rejects the returned promise with the signal's
|
|
12
|
-
* abort reason, cancelling the poll.
|
|
13
|
-
*/
|
|
14
|
-
readonly abort?: Maybe<ReadonlyAbort>;
|
|
15
|
-
/**
|
|
16
|
-
* How often to re-evaluate the predicate, in seconds. Defaults to `0.05`
|
|
17
|
-
* (50ms).
|
|
18
|
-
*/
|
|
19
|
-
readonly pollInterval?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Repeatedly evaluates `predicate` until it returns `true` or the timeout
|
|
23
|
-
* elapses, resolving to the predicate's final value. Useful for waiting on
|
|
24
|
-
* asynchronous state to settle without wiring up an event subscription.
|
|
25
|
-
*
|
|
26
|
-
* @param predicate Evaluated immediately and then every `pollInterval` seconds.
|
|
27
|
-
* Polling stops as soon as it returns `true`.
|
|
28
|
-
* @param options Optional {@link PollOptions}. With no `timeout`, polling
|
|
29
|
-
* continues indefinitely until the predicate is `true` or `abort` fires.
|
|
30
|
-
* @returns `true` if the predicate became true within the timeout, otherwise
|
|
31
|
-
* `false`.
|
|
32
|
-
*/
|
|
33
|
-
export declare function poll(predicate: () => boolean, options?: PollOptions): Promise<boolean>;
|
|
34
|
-
//# sourceMappingURL=poll.d.ts.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/** The default `TimecodeScale` (1ms in nanoseconds) when none is present. */
|
|
2
|
-
export declare const DEFAULT_WEBM_TIMECODE_SCALE = 1000000;
|
|
3
|
-
export interface WebmInitInfo {
|
|
4
|
-
/**
|
|
5
|
-
* The absolute byte offset (in the file) where the `Segment` element's
|
|
6
|
-
* content begins. `CueClusterPosition` values are relative to this.
|
|
7
|
-
*/
|
|
8
|
-
readonly segmentDataStart: number;
|
|
9
|
-
/**
|
|
10
|
-
* The `Segment` content size in bytes, or `null` if encoded as unknown.
|
|
11
|
-
*/
|
|
12
|
-
readonly segmentSize: number | null;
|
|
13
|
-
/**
|
|
14
|
-
* The `TimecodeScale` in nanoseconds per tick (cue times are in these ticks).
|
|
15
|
-
*/
|
|
16
|
-
readonly timecodeScale: number;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Parses a WebM initialization segment for the `Segment` data offset and
|
|
20
|
-
* `TimecodeScale`. The init segment is everything before the first `Cluster`
|
|
21
|
-
* (EBML header, `Segment` header, `SeekHead`, `Info`, `Tracks`).
|
|
22
|
-
*/
|
|
23
|
-
export declare function parseWebmInit(buffer: ArrayBuffer): WebmInitInfo;
|
|
24
|
-
/**
|
|
25
|
-
* A single WebM cue point: a cluster's start time and its byte offset relative
|
|
26
|
-
* to the `Segment` data start.
|
|
27
|
-
*/
|
|
28
|
-
export interface WebmCuePoint {
|
|
29
|
-
/**
|
|
30
|
-
* The cluster's start time, in `TimecodeScale` ticks.
|
|
31
|
-
*/
|
|
32
|
-
readonly time: number;
|
|
33
|
-
/**
|
|
34
|
-
* The cluster's byte offset relative to the `Segment` data start.
|
|
35
|
-
*/
|
|
36
|
-
readonly clusterPosition: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Parses a WebM `Cues` element (as located by a DASH `SegmentBase@indexRange`)
|
|
40
|
-
* into its cue points, in order.
|
|
41
|
-
*/
|
|
42
|
-
export declare function parseWebmCues(buffer: ArrayBuffer): readonly WebmCuePoint[];
|
|
43
|
-
//# sourceMappingURL=parseWebm.d.ts.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ReadonlyAbort } from './Abort';
|
|
2
|
-
import type { Maybe } from '../type';
|
|
3
|
-
export interface PollOptions {
|
|
4
|
-
/**
|
|
5
|
-
* How long to keep polling before giving up, in seconds. If omitted,
|
|
6
|
-
* polling continues indefinitely until the predicate returns `true` (or the
|
|
7
|
-
* signal aborts).
|
|
8
|
-
*/
|
|
9
|
-
readonly timeout?: number;
|
|
10
|
-
/**
|
|
11
|
-
* If provided, aborting rejects the returned promise with the signal's
|
|
12
|
-
* abort reason, cancelling the poll.
|
|
13
|
-
*/
|
|
14
|
-
readonly abort?: Maybe<ReadonlyAbort>;
|
|
15
|
-
/**
|
|
16
|
-
* How often to re-evaluate the predicate, in seconds. Defaults to `0.05`
|
|
17
|
-
* (50ms).
|
|
18
|
-
*/
|
|
19
|
-
readonly pollInterval?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Repeatedly evaluates `predicate` until it returns `true` or the timeout
|
|
23
|
-
* elapses, resolving to the predicate's final value. Useful for waiting on
|
|
24
|
-
* asynchronous state to settle without wiring up an event subscription.
|
|
25
|
-
*
|
|
26
|
-
* @param predicate Evaluated immediately and then every `pollInterval` seconds.
|
|
27
|
-
* Polling stops as soon as it returns `true`.
|
|
28
|
-
* @param options Optional {@link PollOptions}. With no `timeout`, polling
|
|
29
|
-
* continues indefinitely until the predicate is `true` or `abort` fires.
|
|
30
|
-
* @returns `true` if the predicate became true within the timeout, otherwise
|
|
31
|
-
* `false`.
|
|
32
|
-
*/
|
|
33
|
-
export declare function poll(predicate: () => boolean, options?: PollOptions): Promise<boolean>;
|
|
34
|
-
//# sourceMappingURL=poll.d.ts.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/** The default `TimecodeScale` (1ms in nanoseconds) when none is present. */
|
|
2
|
-
export declare const DEFAULT_WEBM_TIMECODE_SCALE = 1000000;
|
|
3
|
-
export interface WebmInitInfo {
|
|
4
|
-
/**
|
|
5
|
-
* The absolute byte offset (in the file) where the `Segment` element's
|
|
6
|
-
* content begins. `CueClusterPosition` values are relative to this.
|
|
7
|
-
*/
|
|
8
|
-
readonly segmentDataStart: number;
|
|
9
|
-
/**
|
|
10
|
-
* The `Segment` content size in bytes, or `null` if encoded as unknown.
|
|
11
|
-
*/
|
|
12
|
-
readonly segmentSize: number | null;
|
|
13
|
-
/**
|
|
14
|
-
* The `TimecodeScale` in nanoseconds per tick (cue times are in these ticks).
|
|
15
|
-
*/
|
|
16
|
-
readonly timecodeScale: number;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Parses a WebM initialization segment for the `Segment` data offset and
|
|
20
|
-
* `TimecodeScale`. The init segment is everything before the first `Cluster`
|
|
21
|
-
* (EBML header, `Segment` header, `SeekHead`, `Info`, `Tracks`).
|
|
22
|
-
*/
|
|
23
|
-
export declare function parseWebmInit(buffer: ArrayBuffer): WebmInitInfo;
|
|
24
|
-
/**
|
|
25
|
-
* A single WebM cue point: a cluster's start time and its byte offset relative
|
|
26
|
-
* to the `Segment` data start.
|
|
27
|
-
*/
|
|
28
|
-
export interface WebmCuePoint {
|
|
29
|
-
/**
|
|
30
|
-
* The cluster's start time, in `TimecodeScale` ticks.
|
|
31
|
-
*/
|
|
32
|
-
readonly time: number;
|
|
33
|
-
/**
|
|
34
|
-
* The cluster's byte offset relative to the `Segment` data start.
|
|
35
|
-
*/
|
|
36
|
-
readonly clusterPosition: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Parses a WebM `Cues` element (as located by a DASH `SegmentBase@indexRange`)
|
|
40
|
-
* into its cue points, in order.
|
|
41
|
-
*/
|
|
42
|
-
export declare function parseWebmCues(buffer: ArrayBuffer): readonly WebmCuePoint[];
|
|
43
|
-
//# sourceMappingURL=parseWebm.d.ts.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { ReadonlyAbort } from './Abort';
|
|
2
|
-
import type { Maybe } from '../type';
|
|
3
|
-
export interface PollOptions {
|
|
4
|
-
/**
|
|
5
|
-
* How long to keep polling before giving up, in seconds. If omitted,
|
|
6
|
-
* polling continues indefinitely until the predicate returns `true` (or the
|
|
7
|
-
* signal aborts).
|
|
8
|
-
*/
|
|
9
|
-
readonly timeout?: number;
|
|
10
|
-
/**
|
|
11
|
-
* If provided, aborting rejects the returned promise with the signal's
|
|
12
|
-
* abort reason, cancelling the poll.
|
|
13
|
-
*/
|
|
14
|
-
readonly abort?: Maybe<ReadonlyAbort>;
|
|
15
|
-
/**
|
|
16
|
-
* How often to re-evaluate the predicate, in seconds. Defaults to `0.05`
|
|
17
|
-
* (50ms).
|
|
18
|
-
*/
|
|
19
|
-
readonly pollInterval?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Repeatedly evaluates `predicate` until it returns `true` or the timeout
|
|
23
|
-
* elapses, resolving to the predicate's final value. Useful for waiting on
|
|
24
|
-
* asynchronous state to settle without wiring up an event subscription.
|
|
25
|
-
*
|
|
26
|
-
* @param predicate Evaluated immediately and then every `pollInterval` seconds.
|
|
27
|
-
* Polling stops as soon as it returns `true`.
|
|
28
|
-
* @param options Optional {@link PollOptions}. With no `timeout`, polling
|
|
29
|
-
* continues indefinitely until the predicate is `true` or `abort` fires.
|
|
30
|
-
* @returns `true` if the predicate became true within the timeout, otherwise
|
|
31
|
-
* `false`.
|
|
32
|
-
*/
|
|
33
|
-
export declare function poll(predicate: () => boolean, options?: PollOptions): Promise<boolean>;
|
|
34
|
-
//# sourceMappingURL=poll.d.ts.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/** The default `TimecodeScale` (1ms in nanoseconds) when none is present. */
|
|
2
|
-
export declare const DEFAULT_WEBM_TIMECODE_SCALE = 1000000;
|
|
3
|
-
export interface WebmInitInfo {
|
|
4
|
-
/**
|
|
5
|
-
* The absolute byte offset (in the file) where the `Segment` element's
|
|
6
|
-
* content begins. `CueClusterPosition` values are relative to this.
|
|
7
|
-
*/
|
|
8
|
-
readonly segmentDataStart: number;
|
|
9
|
-
/**
|
|
10
|
-
* The `Segment` content size in bytes, or `null` if encoded as unknown.
|
|
11
|
-
*/
|
|
12
|
-
readonly segmentSize: number | null;
|
|
13
|
-
/**
|
|
14
|
-
* The `TimecodeScale` in nanoseconds per tick (cue times are in these ticks).
|
|
15
|
-
*/
|
|
16
|
-
readonly timecodeScale: number;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Parses a WebM initialization segment for the `Segment` data offset and
|
|
20
|
-
* `TimecodeScale`. The init segment is everything before the first `Cluster`
|
|
21
|
-
* (EBML header, `Segment` header, `SeekHead`, `Info`, `Tracks`).
|
|
22
|
-
*/
|
|
23
|
-
export declare function parseWebmInit(buffer: ArrayBuffer): WebmInitInfo;
|
|
24
|
-
/**
|
|
25
|
-
* A single WebM cue point: a cluster's start time and its byte offset relative
|
|
26
|
-
* to the `Segment` data start.
|
|
27
|
-
*/
|
|
28
|
-
export interface WebmCuePoint {
|
|
29
|
-
/**
|
|
30
|
-
* The cluster's start time, in `TimecodeScale` ticks.
|
|
31
|
-
*/
|
|
32
|
-
readonly time: number;
|
|
33
|
-
/**
|
|
34
|
-
* The cluster's byte offset relative to the `Segment` data start.
|
|
35
|
-
*/
|
|
36
|
-
readonly clusterPosition: number;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Parses a WebM `Cues` element (as located by a DASH `SegmentBase@indexRange`)
|
|
40
|
-
* into its cue points, in order.
|
|
41
|
-
*/
|
|
42
|
-
export declare function parseWebmCues(buffer: ArrayBuffer): readonly WebmCuePoint[];
|
|
43
|
-
//# sourceMappingURL=parseWebm.d.ts.map
|