moqtail 0.15.0 → 0.16.0
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/README.md +153 -473
- package/dist/{client-BviQ20Lc.cjs → client-DQ5aGbLR.cjs} +1089 -1074
- package/dist/client-DUzLw_Y8.d.cts +1932 -0
- package/dist/{client-zi0lmuIL.mjs → client-DVi4Nh1J.mjs} +930 -921
- package/dist/client-epHqMdHm.d.mts +1932 -0
- package/dist/client.cjs +121 -4
- package/dist/client.d.cts +23 -1944
- package/dist/client.d.mts +23 -1944
- package/dist/client.mjs +117 -2
- package/dist/emitter-UbeRcbuf.mjs +109 -0
- package/dist/{logger-c2NoQqtx.cjs → emitter-qNJYD3yQ.cjs} +61 -2
- package/dist/index-B-BMK-b6.d.mts +2090 -0
- package/dist/index-BtemTtwe.d.cts +2090 -0
- package/dist/{index-BY6e1obL.d.cts → index-CNn9BgO6.d.mts} +119 -324
- package/dist/index.cjs +38 -34
- package/dist/index.d.cts +20 -4
- package/dist/index.d.mts +20 -4
- package/dist/index.mjs +5 -4
- package/dist/logger-B8IYkljn.d.cts +64 -0
- package/dist/logger-B8IYkljn.d.mts +64 -0
- package/dist/model.cjs +122 -340
- package/dist/model.d.cts +2896 -2
- package/dist/model.d.mts +17 -2
- package/dist/model.mjs +122 -340
- package/dist/player/component.cjs +317 -0
- package/dist/player/component.d.cts +50 -0
- package/dist/player/component.d.mts +50 -0
- package/dist/player/component.mjs +315 -0
- package/dist/player-CJayEzwt.cjs +6750 -0
- package/dist/player-DcctWhyM.mjs +6599 -0
- package/dist/player.cjs +27 -0
- package/dist/player.d.cts +17 -0
- package/dist/player.d.mts +17 -0
- package/dist/player.mjs +1 -0
- package/dist/rolldown-runtime-CmQyd0Gu.cjs +27 -0
- package/dist/util.cjs +9 -10
- package/dist/util.d.cts +20 -13
- package/dist/util.d.mts +20 -13
- package/dist/util.mjs +4 -6
- package/package.json +45 -5
- package/dist/index-BY6e1obL.d.mts +0 -3087
- package/dist/logger-ByDB8lYF.mjs +0 -56
- package/dist/logger-dEoueCj7.d.cts +0 -35
- package/dist/logger-dEoueCj7.d.mts +0 -35
package/dist/model.d.cts
CHANGED
|
@@ -1,2 +1,2896 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 The MOQtail Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @public
|
|
18
|
+
* Represents a key-value pair for MOQT protocol parameters.
|
|
19
|
+
*
|
|
20
|
+
* - If `typeValue` is **even**, the value is a varint (`bigint`).
|
|
21
|
+
* - If `typeValue` is **odd**, the value is a binary blob (`Uint8Array`) with a maximum length of 65535 bytes.
|
|
22
|
+
*
|
|
23
|
+
* Use {@link KeyValuePair.tryNewVarInt} for varint pairs and {@link KeyValuePair.tryNewBytes} for blob pairs.
|
|
24
|
+
* A Type whose own namespace fixes the value encoding overrides the parity rule; see
|
|
25
|
+
* {@link KeyValuePair.newBytes}.
|
|
26
|
+
*/
|
|
27
|
+
export declare class KeyValuePair {
|
|
28
|
+
/**
|
|
29
|
+
* The key/type identifier for this pair.
|
|
30
|
+
* - Even: value is a varint.
|
|
31
|
+
* - Odd: value is a blob.
|
|
32
|
+
*/
|
|
33
|
+
readonly typeValue: bigint;
|
|
34
|
+
/**
|
|
35
|
+
* The value for this pair.
|
|
36
|
+
* - If `typeValue` is even: a varint (`bigint`).
|
|
37
|
+
* - If `typeValue` is odd: a binary blob (`Uint8Array`).
|
|
38
|
+
*/
|
|
39
|
+
readonly value: bigint | Uint8Array;
|
|
40
|
+
/**
|
|
41
|
+
* Constructs a new KeyValuePair.
|
|
42
|
+
* @param typeValue - The key/type identifier.
|
|
43
|
+
* @param value - The value (varint or blob).
|
|
44
|
+
* @internal Use static factory methods instead.
|
|
45
|
+
*/
|
|
46
|
+
private constructor();
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new varint KeyValuePair.
|
|
49
|
+
* @param typeValue - Must be even.
|
|
50
|
+
* @param value - The varint value.
|
|
51
|
+
* @returns A KeyValuePair with varint value.
|
|
52
|
+
* @throws KeyValueFormattingError if typeValue is not even.
|
|
53
|
+
*/
|
|
54
|
+
static tryNewVarInt(typeValue: bigint | number, value: bigint | number): KeyValuePair;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a varint KeyValuePair for a Type whose namespace defines a numeric value
|
|
57
|
+
* regardless of parity. Prefer {@link KeyValuePair.tryNewVarInt}.
|
|
58
|
+
* @param typeValue - The key/type identifier; parity is not checked.
|
|
59
|
+
* @param value - The varint value.
|
|
60
|
+
*/
|
|
61
|
+
static newVarInt(typeValue: bigint | number, value: bigint | number): KeyValuePair;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new blob KeyValuePair.
|
|
64
|
+
* @param typeValue - Must be odd.
|
|
65
|
+
* @param value - The binary blob value.
|
|
66
|
+
* @returns A KeyValuePair with blob value.
|
|
67
|
+
* @throws KeyValueFormattingError if typeValue is not odd.
|
|
68
|
+
* @throws LengthExceedsMaxError if value length exceeds 65535 bytes.
|
|
69
|
+
*/
|
|
70
|
+
static tryNewBytes(typeValue: bigint | number, value: Uint8Array): KeyValuePair;
|
|
71
|
+
/**
|
|
72
|
+
* Creates a blob KeyValuePair for a Type whose namespace defines a byte-string
|
|
73
|
+
* value regardless of parity. Prefer {@link KeyValuePair.tryNewBytes}.
|
|
74
|
+
* @param typeValue - The key/type identifier; parity is not checked.
|
|
75
|
+
* @param value - The binary blob value.
|
|
76
|
+
* @throws LengthExceedsMaxError if value length exceeds 65535 bytes.
|
|
77
|
+
*/
|
|
78
|
+
static newBytes(typeValue: bigint | number, value: Uint8Array): KeyValuePair;
|
|
79
|
+
/**
|
|
80
|
+
* Serializes this key-value pair to a frozen byte buffer.
|
|
81
|
+
* Equivalent to {@link KeyValuePair.serializeDelta} with `prevType = 0n`.
|
|
82
|
+
* @returns The serialized buffer.
|
|
83
|
+
*/
|
|
84
|
+
serialize(): FrozenByteBuffer;
|
|
85
|
+
/**
|
|
86
|
+
* Serializes this pair's wire form, encoding the Type as a delta from
|
|
87
|
+
* `prevType` (the type of the previous KVP in the same list, or 0n if this
|
|
88
|
+
* is the first entry).
|
|
89
|
+
* @param prevType - The type of the previous KVP in the same list.
|
|
90
|
+
* @throws ProtocolViolationError if this pair's type is less than prevType
|
|
91
|
+
* (Delta Type is an unsigned varint, so the list must be sorted ascending).
|
|
92
|
+
*/
|
|
93
|
+
serializeDelta(prevType: bigint): FrozenByteBuffer;
|
|
94
|
+
/**
|
|
95
|
+
* Deserializes a KeyValuePair from a buffer.
|
|
96
|
+
* Equivalent to {@link KeyValuePair.deserializeDelta} with `prevType = 0n`.
|
|
97
|
+
* @param buf - The buffer to read from.
|
|
98
|
+
* @returns The deserialized KeyValuePair.
|
|
99
|
+
* @throws LengthExceedsMaxError if blob length exceeds 65535 bytes.
|
|
100
|
+
* @throws NotEnoughBytesError if buffer does not contain enough bytes.
|
|
101
|
+
*/
|
|
102
|
+
static deserialize(buf: BaseByteBuffer): KeyValuePair;
|
|
103
|
+
/**
|
|
104
|
+
* Deserializes a wire-form KVP whose Type field is a delta from `prevType`
|
|
105
|
+
* (the type of the previous KVP in the same list, or 0n if this is the
|
|
106
|
+
* first entry).
|
|
107
|
+
* @param buf - The buffer to read from.
|
|
108
|
+
* @param prevType - The type of the previous KVP in the same list.
|
|
109
|
+
* @throws ProtocolViolationError if prevType + delta exceeds 2^64 - 1.
|
|
110
|
+
*/
|
|
111
|
+
static deserializeDelta(buf: BaseByteBuffer, prevType: bigint): KeyValuePair;
|
|
112
|
+
/**
|
|
113
|
+
* Reads a value whose Type has already been decoded, applying the parity
|
|
114
|
+
* rule. Callers in a type namespace where a Type uses a different encoding
|
|
115
|
+
* read that value themselves and do not call this.
|
|
116
|
+
* @param buf - The buffer to read from.
|
|
117
|
+
* @param typeValue - The already-decoded Type.
|
|
118
|
+
*/
|
|
119
|
+
static deserializeValue(buf: BaseByteBuffer, typeValue: bigint): KeyValuePair;
|
|
120
|
+
/**
|
|
121
|
+
* Reads a length-prefixed byte-string Value, independent of Type parity.
|
|
122
|
+
* @param buf - The buffer to read from.
|
|
123
|
+
* @param typeValue - The already-decoded Type.
|
|
124
|
+
* @throws LengthExceedsMaxError if the length exceeds 65535 bytes.
|
|
125
|
+
*/
|
|
126
|
+
static deserializeBytesValue(buf: BaseByteBuffer, typeValue: bigint): KeyValuePair;
|
|
127
|
+
/**
|
|
128
|
+
* Checks if this pair is equal to another.
|
|
129
|
+
* @param other - The other KeyValuePair.
|
|
130
|
+
* @returns True if both type and value are equal.
|
|
131
|
+
*/
|
|
132
|
+
equals(other: KeyValuePair): boolean;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Delta-encodes and serializes a list of Key-Value-Pairs to wire bytes.
|
|
136
|
+
* The list is sorted by ascending type first, since Delta Type is an
|
|
137
|
+
* unsigned varint and cannot represent a type decrease.
|
|
138
|
+
*/
|
|
139
|
+
export declare function serializeKvpList(items: KeyValuePair[]): FrozenByteBuffer;
|
|
140
|
+
/**
|
|
141
|
+
* Reads exactly `count` delta-encoded Key-Value-Pairs from `buf`.
|
|
142
|
+
*/
|
|
143
|
+
export declare function deserializeKvpList(buf: BaseByteBuffer, count: number | bigint): KeyValuePair[];
|
|
144
|
+
/**
|
|
145
|
+
* Reads delta-encoded Key-Value-Pairs from `buf` until it is exhausted.
|
|
146
|
+
*/
|
|
147
|
+
export declare function deserializeKvpListUntilEmpty(buf: BaseByteBuffer): KeyValuePair[];
|
|
148
|
+
/**
|
|
149
|
+
* Checks if the KeyValuePair carries a varint value.
|
|
150
|
+
* @param pair - The KeyValuePair to check.
|
|
151
|
+
* @returns True if value is a varint.
|
|
152
|
+
*/
|
|
153
|
+
export declare function isVarInt(pair: KeyValuePair): pair is KeyValuePair & {
|
|
154
|
+
value: bigint;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Checks if the KeyValuePair carries a blob value.
|
|
158
|
+
* @param pair - The KeyValuePair to check.
|
|
159
|
+
* @returns True if value is a Uint8Array.
|
|
160
|
+
*/
|
|
161
|
+
export declare function isBytes(pair: KeyValuePair): pair is KeyValuePair & {
|
|
162
|
+
value: Uint8Array;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* @public
|
|
166
|
+
* Represents a position in a MOQT track, consisting of a group and object index.
|
|
167
|
+
*
|
|
168
|
+
* Used for specifying start/end positions in subscription and fetch requests.
|
|
169
|
+
* - `group`: The group index (e.g. segment, GOP, or logical group).
|
|
170
|
+
* - `object`: The object index within the group (e.g. frame, chunk).
|
|
171
|
+
*/
|
|
172
|
+
export declare class Location {
|
|
173
|
+
/**
|
|
174
|
+
* The group index for this location.
|
|
175
|
+
*/
|
|
176
|
+
readonly group: bigint;
|
|
177
|
+
/**
|
|
178
|
+
* The object index within the group for this location.
|
|
179
|
+
*/
|
|
180
|
+
readonly object: bigint;
|
|
181
|
+
/**
|
|
182
|
+
* Constructs a new Location.
|
|
183
|
+
* @param group - The group index (number or bigint).
|
|
184
|
+
* @param object - The object index (number or bigint).
|
|
185
|
+
*/
|
|
186
|
+
constructor(group: bigint | number, object: bigint | number);
|
|
187
|
+
/**
|
|
188
|
+
* Serializes this Location to a FrozenByteBuffer.
|
|
189
|
+
* @returns The serialized buffer.
|
|
190
|
+
* @throws CastingError if group or object is negative.
|
|
191
|
+
* @throws VarIntOverflowError if group or object exceeds varint encoding limits.
|
|
192
|
+
*/
|
|
193
|
+
serialize(): FrozenByteBuffer;
|
|
194
|
+
/**
|
|
195
|
+
* Deserializes a Location from a buffer.
|
|
196
|
+
* @param buf - The buffer to read from.
|
|
197
|
+
* @returns The deserialized Location.
|
|
198
|
+
* @throws NotEnoughBytesError if buffer does not contain enough bytes.
|
|
199
|
+
*/
|
|
200
|
+
static deserialize(buf: BaseByteBuffer): Location;
|
|
201
|
+
/**
|
|
202
|
+
* Checks if this Location is equal to another.
|
|
203
|
+
* @param other - The other Location to compare.
|
|
204
|
+
* @returns True if both group and object are equal.
|
|
205
|
+
*/
|
|
206
|
+
equals(other: Location): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Compares this Location to another for ordering.
|
|
209
|
+
* @param other - The other Location to compare.
|
|
210
|
+
* @returns -1 if this \< other, 1 if this \> other, 0 if equal.
|
|
211
|
+
*/
|
|
212
|
+
compare(other: Location): number;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* @public
|
|
216
|
+
* Represents a single field in a Tuple, storing a value as a UTF-8 encoded byte array.
|
|
217
|
+
*
|
|
218
|
+
* Used for path segments or protocol fields in MOQT.
|
|
219
|
+
*/
|
|
220
|
+
export declare class TupleField {
|
|
221
|
+
readonly value: Uint8Array;
|
|
222
|
+
/**
|
|
223
|
+
* The raw value of the field as a byte array.
|
|
224
|
+
*/
|
|
225
|
+
constructor(value: Uint8Array);
|
|
226
|
+
/**
|
|
227
|
+
* Creates a TupleField from a UTF-8 string.
|
|
228
|
+
* @param str - The string to encode.
|
|
229
|
+
* @returns A new TupleField containing the encoded value.
|
|
230
|
+
*/
|
|
231
|
+
static fromUtf8(str: string): TupleField;
|
|
232
|
+
/**
|
|
233
|
+
* Decodes the field value to a UTF-8 string.
|
|
234
|
+
* @returns The decoded string.
|
|
235
|
+
*/
|
|
236
|
+
toUtf8(): string;
|
|
237
|
+
/**
|
|
238
|
+
* Serializes this field to a length-prefixed byte array.
|
|
239
|
+
* @returns The serialized bytes.
|
|
240
|
+
*/
|
|
241
|
+
serialize(): Uint8Array;
|
|
242
|
+
/**
|
|
243
|
+
* Deserializes a TupleField from a buffer.
|
|
244
|
+
* @param buf - The buffer to read from.
|
|
245
|
+
* @returns The deserialized TupleField.
|
|
246
|
+
* @throws CastingError if the length cannot be safely cast to number.
|
|
247
|
+
* @throws NotEnoughBytesError if buffer does not contain enough bytes.
|
|
248
|
+
*/
|
|
249
|
+
static deserialize(buf: BaseByteBuffer): TupleField;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* @public
|
|
253
|
+
* Represents a sequence of TupleFields, typically used for hierarchical paths or protocol tuples in MOQT.
|
|
254
|
+
*/
|
|
255
|
+
export declare class Tuple {
|
|
256
|
+
readonly fields: TupleField[];
|
|
257
|
+
/**
|
|
258
|
+
* The ordered list of fields in this tuple.
|
|
259
|
+
*/
|
|
260
|
+
constructor(fields?: TupleField[]);
|
|
261
|
+
/**
|
|
262
|
+
* Creates a Tuple from a path string, splitting on '/'.
|
|
263
|
+
* @param path - The path string (e.g. '/foo/bar').
|
|
264
|
+
* @returns A Tuple with each segment as a field.
|
|
265
|
+
*/
|
|
266
|
+
static fromUtf8Path(path: string): Tuple;
|
|
267
|
+
/**
|
|
268
|
+
* Converts the tuple to a path string, joining fields with '/'.
|
|
269
|
+
* @returns The path string (e.g. '/foo/bar').
|
|
270
|
+
*/
|
|
271
|
+
toUtf8Path(): string;
|
|
272
|
+
/**
|
|
273
|
+
* Adds a field to the tuple.
|
|
274
|
+
* @param field - The TupleField to add.
|
|
275
|
+
*/
|
|
276
|
+
add(field: TupleField): void;
|
|
277
|
+
/**
|
|
278
|
+
* Gets the field at the specified index.
|
|
279
|
+
* @param index - The field index.
|
|
280
|
+
* @returns The TupleField at the index.
|
|
281
|
+
* @throws Error if no field exists at the index.
|
|
282
|
+
*/
|
|
283
|
+
get(index: number): TupleField;
|
|
284
|
+
/**
|
|
285
|
+
* Sets the field at the specified index.
|
|
286
|
+
* @param index - The field index.
|
|
287
|
+
* @param field - The TupleField to set.
|
|
288
|
+
*/
|
|
289
|
+
set(index: number, field: TupleField): void;
|
|
290
|
+
/**
|
|
291
|
+
* Clears all fields from the tuple.
|
|
292
|
+
*/
|
|
293
|
+
clear(): void;
|
|
294
|
+
/**
|
|
295
|
+
* Serializes the tuple to a FrozenByteBuffer.
|
|
296
|
+
* @returns The serialized buffer.
|
|
297
|
+
*/
|
|
298
|
+
serialize(): FrozenByteBuffer;
|
|
299
|
+
/**
|
|
300
|
+
* Deserializes a Tuple from a buffer.
|
|
301
|
+
* @param buf - The buffer to read from.
|
|
302
|
+
* @returns The deserialized Tuple.
|
|
303
|
+
* @throws CastingError if the count cannot be safely cast to number.
|
|
304
|
+
* @throws NotEnoughBytesError if buffer does not contain enough bytes.
|
|
305
|
+
*/
|
|
306
|
+
static deserialize(buf: BaseByteBuffer): Tuple;
|
|
307
|
+
/**
|
|
308
|
+
* Checks if this tuple is equal to another.
|
|
309
|
+
* @param other - The other Tuple to compare.
|
|
310
|
+
* @returns True if all fields are equal.
|
|
311
|
+
*/
|
|
312
|
+
equals(other: Tuple): boolean;
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* The maximum allowed length (in bytes) for a ReasonPhrase.
|
|
316
|
+
* @public
|
|
317
|
+
*/
|
|
318
|
+
export declare const MAX_REASON_PHRASE_LEN = 1024;
|
|
319
|
+
/**
|
|
320
|
+
* Represents a protocol ReasonPhrase, a short UTF-8 string used for error or status reporting.
|
|
321
|
+
* Enforces a maximum byte length and validates encoding.
|
|
322
|
+
*
|
|
323
|
+
* @public
|
|
324
|
+
*/
|
|
325
|
+
export declare class ReasonPhrase {
|
|
326
|
+
#private;
|
|
327
|
+
/**
|
|
328
|
+
* Constructs a ReasonPhrase, validating UTF-8 encoding and length.
|
|
329
|
+
*
|
|
330
|
+
* @param phrase - The string to use as the reason phrase.
|
|
331
|
+
* @throws {@link InvalidUTF8Error} if encoding fails.
|
|
332
|
+
* @throws {@link LengthExceedsMaxError} if the encoded phrase exceeds {@link MAX_REASON_PHRASE_LEN} bytes.
|
|
333
|
+
* @public
|
|
334
|
+
*/
|
|
335
|
+
constructor(phrase: string);
|
|
336
|
+
/**
|
|
337
|
+
* Returns the phrase string.
|
|
338
|
+
* @public
|
|
339
|
+
*/
|
|
340
|
+
get phrase(): string;
|
|
341
|
+
/**
|
|
342
|
+
* Serializes the ReasonPhrase into a {@link FrozenByteBuffer} containing:
|
|
343
|
+
* varint(length_of_phrase_bytes) || phrase_bytes
|
|
344
|
+
*
|
|
345
|
+
* @returns The serialized buffer.
|
|
346
|
+
* @public
|
|
347
|
+
*/
|
|
348
|
+
serialize(): FrozenByteBuffer;
|
|
349
|
+
/**
|
|
350
|
+
* Deserializes a ReasonPhrase from the given buffer.
|
|
351
|
+
* Reads varint(length) || utf8‑bytes.
|
|
352
|
+
*
|
|
353
|
+
* @param buf - The buffer to read from.
|
|
354
|
+
* @returns The deserialized ReasonPhrase.
|
|
355
|
+
* @throws :{@link CastingError} if the length cannot be safely cast to a number.
|
|
356
|
+
* @throws :{@link LengthExceedsMaxError} if the length exceeds {@link MAX_REASON_PHRASE_LEN}.
|
|
357
|
+
* @throws :{@link NotEnoughBytesError} if the buffer does not contain enough bytes.
|
|
358
|
+
* @throws :{@link InvalidUTF8Error} if decoding fails.
|
|
359
|
+
* @public
|
|
360
|
+
*/
|
|
361
|
+
static deserialize(buf: BaseByteBuffer): ReasonPhrase;
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Copyright 2025 The MOQtail Authors
|
|
365
|
+
*
|
|
366
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
367
|
+
* you may not use this file except in compliance with the License.
|
|
368
|
+
* You may obtain a copy of the License at
|
|
369
|
+
*
|
|
370
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
371
|
+
*
|
|
372
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
373
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
374
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
375
|
+
* See the License for the specific language governing permissions and
|
|
376
|
+
* limitations under the License.
|
|
377
|
+
*/
|
|
378
|
+
/**
|
|
379
|
+
* @public
|
|
380
|
+
* Object datagram types for MOQT objects.
|
|
381
|
+
*
|
|
382
|
+
* Type bit layout (form 0b00X0XXXX):
|
|
383
|
+
* - Bit 0 (0x01): PROPERTIES - Properties field present
|
|
384
|
+
* - Bit 1 (0x02): END_OF_GROUP - Last object in group
|
|
385
|
+
* - Bit 2 (0x04): ZERO_OBJECT_ID - Object ID omitted (assumed 0)
|
|
386
|
+
* - Bit 3 (0x08): DEFAULT_PRIORITY - Publisher Priority omitted (inherited)
|
|
387
|
+
* - Bit 5 (0x20): STATUS - Object Status replaces Object Payload
|
|
388
|
+
*
|
|
389
|
+
* Invalid combinations:
|
|
390
|
+
* - STATUS (0x20) + END_OF_GROUP (0x02) together is a PROTOCOL_VIOLATION
|
|
391
|
+
* - Types outside the form 0b00X0XXXX are invalid
|
|
392
|
+
*/
|
|
393
|
+
export declare enum ObjectDatagramType {
|
|
394
|
+
Type0x00 = 0,
|
|
395
|
+
Type0x01 = 1,
|
|
396
|
+
Type0x02 = 2,
|
|
397
|
+
Type0x03 = 3,
|
|
398
|
+
Type0x04 = 4,
|
|
399
|
+
Type0x05 = 5,
|
|
400
|
+
Type0x06 = 6,
|
|
401
|
+
Type0x07 = 7,
|
|
402
|
+
Type0x08 = 8,
|
|
403
|
+
Type0x09 = 9,
|
|
404
|
+
Type0x0A = 10,
|
|
405
|
+
Type0x0B = 11,
|
|
406
|
+
Type0x0C = 12,
|
|
407
|
+
Type0x0D = 13,
|
|
408
|
+
Type0x0E = 14,
|
|
409
|
+
Type0x0F = 15,
|
|
410
|
+
Type0x20 = 32,
|
|
411
|
+
Type0x21 = 33,
|
|
412
|
+
Type0x24 = 36,
|
|
413
|
+
Type0x25 = 37,
|
|
414
|
+
Type0x28 = 40,
|
|
415
|
+
Type0x29 = 41,
|
|
416
|
+
Type0x2C = 44,
|
|
417
|
+
Type0x2D = 45
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* @public
|
|
421
|
+
* Namespace for ObjectDatagramType utilities.
|
|
422
|
+
*/
|
|
423
|
+
export declare namespace ObjectDatagramType {
|
|
424
|
+
/** Properties field present (bit 0). */
|
|
425
|
+
const PROPERTIES = 1;
|
|
426
|
+
/** Last object in the group (bit 1). */
|
|
427
|
+
const END_OF_GROUP = 2;
|
|
428
|
+
/** Object ID omitted, taken as 0 (bit 2). */
|
|
429
|
+
const ZERO_OBJECT_ID = 4;
|
|
430
|
+
/** Publisher Priority omitted, taken from the subscription (bit 3). */
|
|
431
|
+
const DEFAULT_PRIORITY = 8;
|
|
432
|
+
/** Carries an object status rather than a payload (bit 5). */
|
|
433
|
+
const STATUS = 32;
|
|
434
|
+
/** Mask for bits that must be zero: bits 4, 6, 7 (form `0b00X0XXXX`). */
|
|
435
|
+
const INVALID_BITS_MASK = 208;
|
|
436
|
+
/**
|
|
437
|
+
* Converts a number or bigint to ObjectDatagramType.
|
|
438
|
+
* Validates using bitmask: must match form 0b00X0XXXX,
|
|
439
|
+
* and STATUS + END_OF_GROUP cannot both be set.
|
|
440
|
+
* @param value - The value to convert.
|
|
441
|
+
* @returns The corresponding ObjectDatagramType.
|
|
442
|
+
* @throws Error if the value is not valid.
|
|
443
|
+
*/
|
|
444
|
+
function tryFrom(value: number | bigint): ObjectDatagramType;
|
|
445
|
+
/**
|
|
446
|
+
* Returns true if the type has properties (bit 0 set).
|
|
447
|
+
* @param t - The ObjectDatagramType.
|
|
448
|
+
*/
|
|
449
|
+
function hasProperties(t: ObjectDatagramType): boolean;
|
|
450
|
+
/**
|
|
451
|
+
* Returns true if the type indicates End of Group (bit 1 set).
|
|
452
|
+
* @param t - The ObjectDatagramType.
|
|
453
|
+
*/
|
|
454
|
+
function isEndOfGroup(t: ObjectDatagramType): boolean;
|
|
455
|
+
/**
|
|
456
|
+
* Returns true if Object ID is absent (bit 2 set).
|
|
457
|
+
* When true, Object ID is omitted and assumed to be 0.
|
|
458
|
+
* @param t - The ObjectDatagramType.
|
|
459
|
+
*/
|
|
460
|
+
function isZeroObjectId(t: ObjectDatagramType): boolean;
|
|
461
|
+
/**
|
|
462
|
+
* Returns true if Publisher Priority is omitted (bit 3 set).
|
|
463
|
+
* When true, the priority is inherited from the control message.
|
|
464
|
+
* @param t - The ObjectDatagramType.
|
|
465
|
+
*/
|
|
466
|
+
function hasDefaultPriority(t: ObjectDatagramType): boolean;
|
|
467
|
+
/**
|
|
468
|
+
* Returns true if the datagram carries Object Status instead of payload (bit 5 set).
|
|
469
|
+
* @param t - The ObjectDatagramType.
|
|
470
|
+
*/
|
|
471
|
+
function isStatus(t: ObjectDatagramType): boolean;
|
|
472
|
+
/**
|
|
473
|
+
* Determines the appropriate type for given properties.
|
|
474
|
+
* @param hasProperties - Whether properties are present.
|
|
475
|
+
* @param endOfGroup - Whether this is the last object in the group.
|
|
476
|
+
* @param objectIdIsZero - Whether the objectId is 0.
|
|
477
|
+
* @param defaultPriority - Whether publisher priority is inherited (omitted).
|
|
478
|
+
* @param isStatus - Whether the datagram carries status instead of payload.
|
|
479
|
+
* @throws Error if STATUS and END_OF_GROUP are both true (PROTOCOL_VIOLATION).
|
|
480
|
+
*/
|
|
481
|
+
function fromProperties(hasProperties: boolean, endOfGroup: boolean, objectIdIsZero: boolean, defaultPriority: boolean, isStatus: boolean): ObjectDatagramType;
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* @public
|
|
485
|
+
* Fetch header types for MOQT fetch requests.
|
|
486
|
+
*/
|
|
487
|
+
export declare enum FetchHeaderType {
|
|
488
|
+
Type0x05 = 5
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Namespace for FetchHeaderType utilities.
|
|
492
|
+
*/
|
|
493
|
+
export declare namespace FetchHeaderType {
|
|
494
|
+
/**
|
|
495
|
+
* Converts a number or bigint to FetchHeaderType.
|
|
496
|
+
* @param value - The value to convert.
|
|
497
|
+
* @returns The corresponding FetchHeaderType.
|
|
498
|
+
* @throws Error if the value is not valid.
|
|
499
|
+
*/
|
|
500
|
+
function tryFrom(value: number | bigint): FetchHeaderType;
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* @public
|
|
504
|
+
* Subgroup header types for MOQT subgroups.
|
|
505
|
+
*
|
|
506
|
+
* Type bit layout (0b0XX1XXXX):
|
|
507
|
+
* - Bit 0 (0x01): PROPERTIES - Properties present in all objects
|
|
508
|
+
* - Bits 1-2 (0x06): SUBGROUP_ID_MODE - How subgroup ID is encoded (0b00=zero, 0b01=firstObjId, 0b10=explicit, 0b11=invalid)
|
|
509
|
+
* - Bit 3 (0x08): END_OF_GROUP - This subgroup contains the final object in the group
|
|
510
|
+
* - Bit 4 (0x10): Always set (distinguishes subgroup from other header types)
|
|
511
|
+
* - Bit 5 (0x20): DEFAULT_PRIORITY - Publisher priority field omitted, inherited from subscription
|
|
512
|
+
* - Bit 6 (0x40): FIRST_OBJECT - The first object on this stream is the first the original
|
|
513
|
+
* publisher published in the subgroup
|
|
514
|
+
* - Bit 7 (0x80): Must be zero
|
|
515
|
+
*
|
|
516
|
+
* Valid ranges: 0x10-0x15, 0x18-0x1D, 0x30-0x35, 0x38-0x3D, 0x50-0x55, 0x58-0x5D, 0x70-0x75, 0x78-0x7D
|
|
517
|
+
* Invalid: 0x16, 0x17, 0x1E, 0x1F, 0x36, 0x37, 0x3E, 0x3F, 0x56, 0x57, 0x5E, 0x5F, 0x76, 0x77, 0x7E,
|
|
518
|
+
* 0x7F (SUBGROUP_ID_MODE=0b11)
|
|
519
|
+
*/
|
|
520
|
+
export declare enum SubgroupHeaderType {
|
|
521
|
+
Type0x10 = 16,
|
|
522
|
+
Type0x11 = 17,
|
|
523
|
+
Type0x12 = 18,
|
|
524
|
+
Type0x13 = 19,
|
|
525
|
+
Type0x14 = 20,
|
|
526
|
+
Type0x15 = 21,
|
|
527
|
+
Type0x18 = 24,
|
|
528
|
+
Type0x19 = 25,
|
|
529
|
+
Type0x1A = 26,
|
|
530
|
+
Type0x1B = 27,
|
|
531
|
+
Type0x1C = 28,
|
|
532
|
+
Type0x1D = 29,
|
|
533
|
+
Type0x30 = 48,
|
|
534
|
+
Type0x31 = 49,
|
|
535
|
+
Type0x32 = 50,
|
|
536
|
+
Type0x33 = 51,
|
|
537
|
+
Type0x34 = 52,
|
|
538
|
+
Type0x35 = 53,
|
|
539
|
+
Type0x38 = 56,
|
|
540
|
+
Type0x39 = 57,
|
|
541
|
+
Type0x3A = 58,
|
|
542
|
+
Type0x3B = 59,
|
|
543
|
+
Type0x3C = 60,
|
|
544
|
+
Type0x3D = 61,
|
|
545
|
+
Type0x50 = 80,
|
|
546
|
+
Type0x51 = 81,
|
|
547
|
+
Type0x52 = 82,
|
|
548
|
+
Type0x53 = 83,
|
|
549
|
+
Type0x54 = 84,
|
|
550
|
+
Type0x55 = 85,
|
|
551
|
+
Type0x58 = 88,
|
|
552
|
+
Type0x59 = 89,
|
|
553
|
+
Type0x5A = 90,
|
|
554
|
+
Type0x5B = 91,
|
|
555
|
+
Type0x5C = 92,
|
|
556
|
+
Type0x5D = 93,
|
|
557
|
+
Type0x70 = 112,
|
|
558
|
+
Type0x71 = 113,
|
|
559
|
+
Type0x72 = 114,
|
|
560
|
+
Type0x73 = 115,
|
|
561
|
+
Type0x74 = 116,
|
|
562
|
+
Type0x75 = 117,
|
|
563
|
+
Type0x78 = 120,
|
|
564
|
+
Type0x79 = 121,
|
|
565
|
+
Type0x7A = 122,
|
|
566
|
+
Type0x7B = 123,
|
|
567
|
+
Type0x7C = 124,
|
|
568
|
+
Type0x7D = 125
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* Namespace for SubgroupHeaderType utilities and bit constants.
|
|
572
|
+
*/
|
|
573
|
+
/**
|
|
574
|
+
* @public
|
|
575
|
+
* The Publisher Priority to assume where a header omits the field, having set its
|
|
576
|
+
* DEFAULT_PRIORITY bit. A track may name its own with the DEFAULT_PUBLISHER_PRIORITY
|
|
577
|
+
* track property; this is the value for one that does not. Priority runs from 0 (most
|
|
578
|
+
* important) to 255, so a wrong default here is not a small error: 0 makes every such
|
|
579
|
+
* object outrank all others.
|
|
580
|
+
*/
|
|
581
|
+
export declare const DEFAULT_PUBLISHER_PRIORITY = 128;
|
|
582
|
+
export declare namespace SubgroupHeaderType {
|
|
583
|
+
/** Properties present in all objects (bit 0) */
|
|
584
|
+
const PROPERTIES = 1;
|
|
585
|
+
/** Mask for SUBGROUP_ID_MODE (bits 1-2) */
|
|
586
|
+
const SUBGROUP_ID_MODE_MASK = 6;
|
|
587
|
+
/** This subgroup contains the final object in the group (bit 3) */
|
|
588
|
+
const END_OF_GROUP = 8;
|
|
589
|
+
/** Required bit that must always be set (bit 4) */
|
|
590
|
+
const REQUIRED_BIT = 16;
|
|
591
|
+
/** Publisher priority field omitted, inherited from subscription (bit 5) */
|
|
592
|
+
const DEFAULT_PRIORITY = 32;
|
|
593
|
+
/** First object on this stream is the first published in the subgroup (bit 6) */
|
|
594
|
+
const FIRST_OBJECT = 64;
|
|
595
|
+
/** Mask for bits that must be zero: bit 7 only */
|
|
596
|
+
const INVALID_BITS_MASK = 128;
|
|
597
|
+
function hasProperties(t: SubgroupHeaderType): boolean;
|
|
598
|
+
function hasExplicitSubgroupId(t: SubgroupHeaderType): boolean;
|
|
599
|
+
function isSubgroupIdZero(t: SubgroupHeaderType): boolean;
|
|
600
|
+
function isSubgroupIdFirstObjectId(t: SubgroupHeaderType): boolean;
|
|
601
|
+
function containsEndOfGroup(t: SubgroupHeaderType): boolean;
|
|
602
|
+
function hasDefaultPriority(t: SubgroupHeaderType): boolean;
|
|
603
|
+
function isFirstObject(t: SubgroupHeaderType): boolean;
|
|
604
|
+
/**
|
|
605
|
+
* Converts a number or bigint to SubgroupHeaderType.
|
|
606
|
+
* Validates bit 7 must be zero, bit 4 must be set, SUBGROUP_ID_MODE must not be 0b11.
|
|
607
|
+
*/
|
|
608
|
+
function tryFrom(value: number | bigint): SubgroupHeaderType;
|
|
609
|
+
/**
|
|
610
|
+
* Determines the appropriate type for given properties.
|
|
611
|
+
* @param subgroupIdMode - SUBGROUP_ID_MODE (0=zero, 1=firstObjId, 2=explicit).
|
|
612
|
+
* @param firstObject - Whether the first object on the stream is the first the original
|
|
613
|
+
* publisher published in the subgroup.
|
|
614
|
+
*/
|
|
615
|
+
function fromProperties(hasProperties: boolean, subgroupIdMode: 0 | 1 | 2, containsEndOfGroup: boolean, hasDefaultPriority?: boolean, firstObject?: boolean): SubgroupHeaderType;
|
|
616
|
+
}
|
|
617
|
+
/**
|
|
618
|
+
* @public
|
|
619
|
+
* Publisher's preferred object delivery mechanism for a track.
|
|
620
|
+
* - `Subgroup`: Use ordered subgroups (reliable).
|
|
621
|
+
* - `Datagram`: Use unreliable datagrams when feasible.
|
|
622
|
+
*
|
|
623
|
+
* The preference is advisory: the relay/transport layer MAY override based on negotiated capabilities.
|
|
624
|
+
*/
|
|
625
|
+
export declare enum ObjectForwardingPreference {
|
|
626
|
+
Subgroup = "Subgroup",
|
|
627
|
+
Datagram = "Datagram"
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Namespace for ObjectForwardingPreference utilities.
|
|
631
|
+
*/
|
|
632
|
+
export declare namespace ObjectForwardingPreference {
|
|
633
|
+
/**
|
|
634
|
+
* Converts a number, bigint, or string to ObjectForwardingPreference.
|
|
635
|
+
* @param value - The value to convert.
|
|
636
|
+
* @returns The corresponding ObjectForwardingPreference.
|
|
637
|
+
* @throws Error if the value is not valid.
|
|
638
|
+
*/
|
|
639
|
+
function tryFrom(value: number | bigint | string): ObjectForwardingPreference;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* @public
|
|
643
|
+
* Object status codes for MOQT objects.
|
|
644
|
+
* - `Normal`: Object exists and is available.
|
|
645
|
+
* - `EndOfGroup`: End of group marker.
|
|
646
|
+
* - `EndOfTrack`: End of track marker.
|
|
647
|
+
*/
|
|
648
|
+
export declare enum ObjectStatus {
|
|
649
|
+
Normal = 0,
|
|
650
|
+
EndOfGroup = 3,
|
|
651
|
+
EndOfTrack = 4
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Namespace for ObjectStatus utilities.
|
|
655
|
+
*/
|
|
656
|
+
export declare namespace ObjectStatus {
|
|
657
|
+
/**
|
|
658
|
+
* Converts a number or bigint to ObjectStatus.
|
|
659
|
+
* @param value - The value to convert.
|
|
660
|
+
* @returns The corresponding ObjectStatus.
|
|
661
|
+
* @throws Error if the value is not valid.
|
|
662
|
+
*/
|
|
663
|
+
function tryFrom(value: number | bigint): ObjectStatus;
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Represents a unified OBJECT_DATAGRAM message.
|
|
667
|
+
*
|
|
668
|
+
* Type bit layout (form 0b00X0XXXX):
|
|
669
|
+
* - Bit 0 (0x01): PROPERTIES
|
|
670
|
+
* - Bit 1 (0x02): END_OF_GROUP
|
|
671
|
+
* - Bit 2 (0x04): ZERO_OBJECT_ID
|
|
672
|
+
* - Bit 3 (0x08): DEFAULT_PRIORITY
|
|
673
|
+
* - Bit 5 (0x20): STATUS
|
|
674
|
+
*/
|
|
675
|
+
export declare class Datagram {
|
|
676
|
+
readonly type: ObjectDatagramType;
|
|
677
|
+
readonly publisherPriority: number | null;
|
|
678
|
+
readonly properties: KeyValuePair[] | null;
|
|
679
|
+
readonly payload: Uint8Array | null;
|
|
680
|
+
readonly objectStatus: ObjectStatus | null;
|
|
681
|
+
readonly endOfGroup: boolean;
|
|
682
|
+
readonly trackAlias: bigint;
|
|
683
|
+
readonly location: Location;
|
|
684
|
+
private constructor();
|
|
685
|
+
get groupId(): bigint;
|
|
686
|
+
get objectId(): bigint;
|
|
687
|
+
/**
|
|
688
|
+
* Create a new Datagram with payload content.
|
|
689
|
+
* The type is automatically determined based on the properties.
|
|
690
|
+
*/
|
|
691
|
+
static newPayload(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number | null, properties: KeyValuePair[] | null, payload: Uint8Array, endOfGroup?: boolean): Datagram;
|
|
692
|
+
/**
|
|
693
|
+
* Create a new Datagram with Object Status (no payload).
|
|
694
|
+
* endOfGroup is always false since STATUS + END_OF_GROUP is invalid.
|
|
695
|
+
*/
|
|
696
|
+
static newStatus(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number | null, properties: KeyValuePair[] | null, objectStatus: ObjectStatus): Datagram;
|
|
697
|
+
serialize(): FrozenByteBuffer;
|
|
698
|
+
static deserialize(buf: BaseByteBuffer): Datagram;
|
|
699
|
+
}
|
|
700
|
+
export declare class FetchHeader {
|
|
701
|
+
readonly type: FetchHeaderType;
|
|
702
|
+
readonly requestId: bigint;
|
|
703
|
+
constructor(type: FetchHeaderType, requestId: bigint | number);
|
|
704
|
+
serialize(): FrozenByteBuffer;
|
|
705
|
+
static deserialize(buf: BaseByteBuffer): FetchHeader;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Copyright 2025 The MOQtail Authors
|
|
709
|
+
*
|
|
710
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
711
|
+
* you may not use this file except in compliance with the License.
|
|
712
|
+
* You may obtain a copy of the License at
|
|
713
|
+
*
|
|
714
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
715
|
+
*
|
|
716
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
717
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
718
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
719
|
+
* See the License for the specific language governing permissions and
|
|
720
|
+
* limitations under the License.
|
|
721
|
+
*/
|
|
722
|
+
/**
|
|
723
|
+
* Protocol string array exchanged in wt-available-protocols header
|
|
724
|
+
*/
|
|
725
|
+
export declare const SUPPORTED_VERSIONS: string[];
|
|
726
|
+
/**
|
|
727
|
+
* @public
|
|
728
|
+
* Control message types.
|
|
729
|
+
*/
|
|
730
|
+
export declare enum ControlMessageType {
|
|
731
|
+
ReservedSetupV00 = 1, // RESERVED; rejected by tryFrom
|
|
732
|
+
ReservedClientSetupV10 = 64, // RESERVED; rejected by tryFrom
|
|
733
|
+
ReservedServerSetupV10 = 65, // RESERVED; rejected by tryFrom
|
|
734
|
+
ReservedClientSetupV16 = 32, // RESERVED; rejected by tryFrom
|
|
735
|
+
ReservedServerSetupV16 = 33, // RESERVED; rejected by tryFrom
|
|
736
|
+
Setup = 12032, // Control
|
|
737
|
+
GoAway = 16, // Control, Request
|
|
738
|
+
Subscribe = 3, // Request, First
|
|
739
|
+
SubscribeOk = 4, // Request
|
|
740
|
+
RequestError = 5, // Request
|
|
741
|
+
RequestUpdate = 2, // Request
|
|
742
|
+
PublishDone = 11, // Request
|
|
743
|
+
Fetch = 22, // Request, First
|
|
744
|
+
FetchOk = 24, // Request
|
|
745
|
+
TrackStatus = 13, // Request, First
|
|
746
|
+
PublishNamespace = 6, // Request, First
|
|
747
|
+
RequestOk = 7, // Request
|
|
748
|
+
Namespace = 8, // Request
|
|
749
|
+
NamespaceDone = 14, // Request
|
|
750
|
+
SubscribeNamespace = 80, // Request, First
|
|
751
|
+
SubscribeTracks = 81, // Request, First
|
|
752
|
+
Publish = 29, // Request, First
|
|
753
|
+
PublishOk = 30, // Request; an alias of RequestOk (§10.5), not its own body
|
|
754
|
+
PublishSkipped = 15
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Converts a bigint value to a ControlMessageType enum.
|
|
758
|
+
* @param v - The bigint value.
|
|
759
|
+
* @returns The corresponding ControlMessageType.
|
|
760
|
+
* @throws InvalidEnumValue if the value is not a valid control message type.
|
|
761
|
+
*/
|
|
762
|
+
export declare namespace ControlMessageType {
|
|
763
|
+
/**
|
|
764
|
+
* True for the seven types marked `First` in Table 5: each one MUST be the first
|
|
765
|
+
* message on a new bidirectional request stream, and no other type may open one.
|
|
766
|
+
* Every remaining type travels on the control stream or on an already-open request
|
|
767
|
+
* stream.
|
|
768
|
+
*/
|
|
769
|
+
function isFirst(t: ControlMessageType): boolean;
|
|
770
|
+
/**
|
|
771
|
+
* True for the six request types §10.9 lets a REQUEST_UPDATE modify. TRACK_STATUS
|
|
772
|
+
* opens a request stream but is not one of them, so an update on its stream is
|
|
773
|
+
* refused with a REQUEST_ERROR.
|
|
774
|
+
*/
|
|
775
|
+
function isUpdatable(t: ControlMessageType): boolean;
|
|
776
|
+
/** Convert bigint discriminant to enum value or throw on invalid. */
|
|
777
|
+
function tryFrom(v: bigint): ControlMessageType;
|
|
778
|
+
}
|
|
779
|
+
/**
|
|
780
|
+
* @public
|
|
781
|
+
* Which fields of a LOCATION_FILTER follow its type, and how they are read.
|
|
782
|
+
*/
|
|
783
|
+
export declare enum LocationFilterType {
|
|
784
|
+
/** No filter: every Object passes. */
|
|
785
|
+
None = 0,
|
|
786
|
+
/** Starts StartGroup groups before the Next Group. */
|
|
787
|
+
RelativeStart = 1,
|
|
788
|
+
AbsoluteStart = 2,
|
|
789
|
+
/** Ends with the last Object of the End Group. */
|
|
790
|
+
AbsoluteStartGroupEnd = 3,
|
|
791
|
+
/** Ends with End Object of the End Group. */
|
|
792
|
+
AbsoluteRange = 4,
|
|
793
|
+
/** Starts at the Object after the Largest Object. */
|
|
794
|
+
NextObject = 5
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Converts a bigint value to a LocationFilterType enum.
|
|
798
|
+
* @param v - The bigint value.
|
|
799
|
+
* @returns The corresponding LocationFilterType.
|
|
800
|
+
* @throws InvalidEnumValue if the value is not a valid Location Filter Type.
|
|
801
|
+
*/
|
|
802
|
+
export declare namespace LocationFilterType {
|
|
803
|
+
function tryFrom(v: bigint): LocationFilterType;
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* @public
|
|
807
|
+
* Switch modes for subscription switching requests.
|
|
808
|
+
*/
|
|
809
|
+
export declare enum SwitchMode {
|
|
810
|
+
Hard = 0,
|
|
811
|
+
Soft = 1
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* @public
|
|
815
|
+
* Group ordering options for object delivery.
|
|
816
|
+
*/
|
|
817
|
+
export declare enum GroupOrder {
|
|
818
|
+
Original = 0,
|
|
819
|
+
Ascending = 1,
|
|
820
|
+
Descending = 2
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* Converts a number value to a GroupOrder enum.
|
|
824
|
+
* @param v - The number value.
|
|
825
|
+
* @returns The corresponding GroupOrder.
|
|
826
|
+
* @throws InvalidEnumValue if the value is not a valid group order.
|
|
827
|
+
*/
|
|
828
|
+
export declare namespace GroupOrder {
|
|
829
|
+
function tryFrom(v: number): GroupOrder;
|
|
830
|
+
}
|
|
831
|
+
/**
|
|
832
|
+
* @public
|
|
833
|
+
* Status codes for track status responses.
|
|
834
|
+
*/
|
|
835
|
+
export declare enum TrackStatusCode {
|
|
836
|
+
InProgress = 0,
|
|
837
|
+
DoesNotExist = 1,
|
|
838
|
+
NotYetBegun = 2,
|
|
839
|
+
Finished = 3,
|
|
840
|
+
RelayUnavailable = 4
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Converts a bigint value to a TrackStatusCode enum.
|
|
844
|
+
* @param v - The bigint value.
|
|
845
|
+
* @returns The corresponding TrackStatusCode.
|
|
846
|
+
* @throws InvalidEnumValue if the value is not a valid track status code.
|
|
847
|
+
*/
|
|
848
|
+
export declare namespace TrackStatusCode {
|
|
849
|
+
function tryFrom(v: bigint): TrackStatusCode;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* @public
|
|
853
|
+
* Status codes for PublishDone control messages.
|
|
854
|
+
*/
|
|
855
|
+
export declare enum PublishDoneStatusCode {
|
|
856
|
+
InternalError = 0,
|
|
857
|
+
Unauthorized = 1,
|
|
858
|
+
TrackEnded = 2,
|
|
859
|
+
GoingAway = 4,
|
|
860
|
+
TooFarBehind = 5,
|
|
861
|
+
Expired = 6,
|
|
862
|
+
UpdateFailed = 8,
|
|
863
|
+
ExcessiveLoad = 9,
|
|
864
|
+
MalformedTrack = 18
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* Converts a bigint value to a PublishDoneStatusCode enum.
|
|
868
|
+
* @param v - The bigint value.
|
|
869
|
+
* @returns The corresponding PublishDoneStatusCode.
|
|
870
|
+
* @throws InvalidEnumValue if the value is not a valid subscribe done status code.
|
|
871
|
+
*/
|
|
872
|
+
export declare namespace PublishDoneStatusCode {
|
|
873
|
+
function tryFrom(v: bigint): PublishDoneStatusCode;
|
|
874
|
+
/**
|
|
875
|
+
* Maps a received status code to a known variant, treating any unknown value
|
|
876
|
+
* (including GREASE) as InternalError. An unknown code is never fatal.
|
|
877
|
+
*/
|
|
878
|
+
function fromWire(v: bigint): PublishDoneStatusCode;
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* @public
|
|
882
|
+
* Unified error codes for REQUEST_ERROR control messages.
|
|
883
|
+
*
|
|
884
|
+
* A separate registry from {@link (StreamResetCode:enum)}, which disagrees with it on
|
|
885
|
+
* the same names: `GOING_AWAY` is `0x6` here but `0x4` as a stream reset code.
|
|
886
|
+
*/
|
|
887
|
+
export declare enum RequestErrorCode {
|
|
888
|
+
InternalError = 0,
|
|
889
|
+
Unauthorized = 1,
|
|
890
|
+
Timeout = 2,
|
|
891
|
+
NotSupported = 3,
|
|
892
|
+
MalformedAuthToken = 4,
|
|
893
|
+
ExpiredAuthToken = 5,
|
|
894
|
+
GoingAway = 6,
|
|
895
|
+
ExcessiveLoad = 9,
|
|
896
|
+
DoesNotExist = 16,
|
|
897
|
+
InvalidRange = 17,
|
|
898
|
+
MalformedTrack = 18,
|
|
899
|
+
Uninterested = 32,
|
|
900
|
+
PrefixOverlap = 48,
|
|
901
|
+
NamespaceTooLarge = 49,
|
|
902
|
+
InvalidSwitch = 50,
|
|
903
|
+
UnsupportedExtension = 51,
|
|
904
|
+
Redirect = 52,
|
|
905
|
+
ConflictingFilters = 53,
|
|
906
|
+
InvalidFilter = 54
|
|
907
|
+
}
|
|
908
|
+
/**
|
|
909
|
+
* Converts a bigint value to a RequestErrorCode enum.
|
|
910
|
+
* @param v - The bigint value.
|
|
911
|
+
* @returns The corresponding RequestErrorCode.
|
|
912
|
+
* @throws InvalidEnumValue if the value is not a valid request error code.
|
|
913
|
+
*/
|
|
914
|
+
export declare namespace RequestErrorCode {
|
|
915
|
+
function tryFrom(v: bigint): RequestErrorCode;
|
|
916
|
+
/**
|
|
917
|
+
* Maps a received error code to a known variant, treating any unknown value
|
|
918
|
+
* (including GREASE) as InternalError. An unknown error code is never fatal and
|
|
919
|
+
* never closes the session.
|
|
920
|
+
*/
|
|
921
|
+
function fromWire(v: bigint): RequestErrorCode;
|
|
922
|
+
}
|
|
923
|
+
/**
|
|
924
|
+
* The prior Object a Fetch Object is encoded against: each one is written as
|
|
925
|
+
* differences from it.
|
|
926
|
+
*/
|
|
927
|
+
export type FetchObjectContext = {
|
|
928
|
+
groupId: bigint;
|
|
929
|
+
/**
|
|
930
|
+
* Null while the stream has carried only End of Range markers and no Object yet:
|
|
931
|
+
* a marker sets the prior Group and Object IDs, but has no Subgroup ID.
|
|
932
|
+
*/
|
|
933
|
+
subgroupId: bigint | null;
|
|
934
|
+
objectId: bigint;
|
|
935
|
+
/**
|
|
936
|
+
* Null while the stream has carried only End of Range markers and no Object yet:
|
|
937
|
+
* a marker has no priority.
|
|
938
|
+
*/
|
|
939
|
+
publisherPriority: number | null;
|
|
940
|
+
};
|
|
941
|
+
/**
|
|
942
|
+
* Kind discriminator for End-of-Range markers.
|
|
943
|
+
*/
|
|
944
|
+
export declare enum EndOfRangeKind {
|
|
945
|
+
/** Serialization Flags = 0x8C: all objects in the range are known not to exist. */
|
|
946
|
+
NonExistent = 140,
|
|
947
|
+
/** Serialization Flags = 0x10C: the range is cache-unknown. */
|
|
948
|
+
Unknown = 268,
|
|
949
|
+
/**
|
|
950
|
+
* Serialization Flags = 0x20C: the range timed out, e.g. a relay ran out of its
|
|
951
|
+
* fill budget before it could retrieve it.
|
|
952
|
+
*/
|
|
953
|
+
TimedOut = 524
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Payload-bearing fetch object (§11.5, non-End-of-Range form).
|
|
957
|
+
*
|
|
958
|
+
* FETCH objects carry no Object Status field; a zero-length payload
|
|
959
|
+
* signals a zero-length Normal object.
|
|
960
|
+
*/
|
|
961
|
+
export declare class FetchObject {
|
|
962
|
+
readonly kind: 'object' | 'end_of_range';
|
|
963
|
+
readonly publisherPriority: number;
|
|
964
|
+
readonly forwardingPreference: ObjectForwardingPreference;
|
|
965
|
+
readonly properties: KeyValuePair[] | null;
|
|
966
|
+
readonly payload: Uint8Array | null;
|
|
967
|
+
readonly endOfRange: EndOfRangeKind | null;
|
|
968
|
+
readonly location: Location;
|
|
969
|
+
readonly subgroupId: bigint;
|
|
970
|
+
private constructor();
|
|
971
|
+
get groupId(): bigint;
|
|
972
|
+
get objectId(): bigint;
|
|
973
|
+
/**
|
|
974
|
+
* What the entry after this one is encoded against, given what this one was
|
|
975
|
+
* encoded against (`prev`).
|
|
976
|
+
*
|
|
977
|
+
* After an Object, that is the Object itself. After an End of Range marker, it is
|
|
978
|
+
* the marker's Group and Object IDs, with the Subgroup ID and priority still those
|
|
979
|
+
* of the last Object before the marker, or none if no Object came before it.
|
|
980
|
+
*/
|
|
981
|
+
nextContext(prev?: FetchObjectContext): FetchObjectContext;
|
|
982
|
+
static newObject(groupId: bigint | number, subgroupId: bigint | number, objectId: bigint | number, publisherPriority: number, forwardingPreference: ObjectForwardingPreference, properties: KeyValuePair[] | null, payload: Uint8Array): FetchObject;
|
|
983
|
+
static newEndOfRange(kind: EndOfRangeKind, groupId: bigint | number, objectId: bigint | number): FetchObject;
|
|
984
|
+
serialize(prev?: FetchObjectContext, groupOrder?: GroupOrder): FrozenByteBuffer;
|
|
985
|
+
static deserialize(buf: BaseByteBuffer, prev?: FetchObjectContext, groupOrder?: GroupOrder): FetchObject;
|
|
986
|
+
}
|
|
987
|
+
export declare const MAX_NAMESPACE_TUPLE_COUNT = 32;
|
|
988
|
+
export declare const MAX_FULL_TRACK_NAME_LENGTH = 4096;
|
|
989
|
+
/**
|
|
990
|
+
* Fully-qualified track identifier = hierarchical namespace (tuple) + leaf name bytes.
|
|
991
|
+
*
|
|
992
|
+
* Constraints enforced (throws {@link TrackNameError}):
|
|
993
|
+
* - Namespace tuple field count: 0 .. {@link MAX_NAMESPACE_TUPLE_COUNT} (an empty namespace is legal).
|
|
994
|
+
* - Total serialized length (namespace tuple + raw name bytes) less than or equals {@link MAX_FULL_TRACK_NAME_LENGTH} bytes.
|
|
995
|
+
*
|
|
996
|
+
* Namespace input may be:
|
|
997
|
+
* - `string` path with segments separated by `/` (converted via {@link Tuple.fromUtf8Path}). Empty segments are dropped,
|
|
998
|
+
* so `''` and `'/'` both yield a zero-element namespace.
|
|
999
|
+
* - Existing {@link Tuple} instance.
|
|
1000
|
+
*
|
|
1001
|
+
* Name input may be:
|
|
1002
|
+
* - UTF-8 string (encoded)
|
|
1003
|
+
* - Raw `Uint8Array` (used directly)
|
|
1004
|
+
*
|
|
1005
|
+
* Instances are created via {@link FullTrackName.tryNew} (validates) or {@link FullTrackName.deserialize}.
|
|
1006
|
+
* Use {@link FullTrackName.serialize} for wire encoding and {@link FullTrackName.toString} for a human friendly
|
|
1007
|
+
* diagnostic format: `namespace/segments:hexname` (name rendered as lowercase hex, no 0x prefix).
|
|
1008
|
+
*
|
|
1009
|
+
* The string form is intended for logs/debug only; do not parse it for protocol operations.
|
|
1010
|
+
*/
|
|
1011
|
+
export declare class FullTrackName {
|
|
1012
|
+
readonly namespace: Tuple;
|
|
1013
|
+
readonly name: Uint8Array;
|
|
1014
|
+
private constructor();
|
|
1015
|
+
/**
|
|
1016
|
+
* Human-readable representation: `\<namespace path joined by '/'\>:\<name as lowercase hex\>`.
|
|
1017
|
+
* If the underlying {@link Tuple} exposes `toUtf8Path`, it's used; otherwise the raw fields are joined.
|
|
1018
|
+
* This is lossy only in the sense that name bytes are hex encoded; round-tripping requires serialization.
|
|
1019
|
+
*/
|
|
1020
|
+
toString(): string;
|
|
1021
|
+
/**
|
|
1022
|
+
* Construct a validated full track name.
|
|
1023
|
+
*
|
|
1024
|
+
* Validation steps:
|
|
1025
|
+
* 1. Convert namespace string -\> {@link Tuple} (split on '/') if needed.
|
|
1026
|
+
* 2. Reject if namespace tuple field count is \> {@link MAX_NAMESPACE_TUPLE_COUNT}.
|
|
1027
|
+
* 3. Encode name string to UTF-8 if needed.
|
|
1028
|
+
* 4. Reject if total serialized length (namespace tuple + name bytes) \> {@link MAX_FULL_TRACK_NAME_LENGTH}.
|
|
1029
|
+
*
|
|
1030
|
+
* @throws :{@link TrackNameError} on any constraint violation.
|
|
1031
|
+
* @example
|
|
1032
|
+
* ```ts
|
|
1033
|
+
* const full = FullTrackName.tryNew('media/video', 'keyframe')
|
|
1034
|
+
* console.log(full.toString()) // media/video:6b65796672616d65
|
|
1035
|
+
* ```
|
|
1036
|
+
*/
|
|
1037
|
+
static tryNew(namespace: string | Tuple, name: string | Uint8Array): FullTrackName;
|
|
1038
|
+
/**
|
|
1039
|
+
* Serialize to a frozen buffer: tuple (namespace) followed by length‑prefixed name bytes.
|
|
1040
|
+
* Consumers needing raw bytes should call `.toUint8Array()` on the returned {@link FrozenByteBuffer}.
|
|
1041
|
+
*/
|
|
1042
|
+
serialize(): FrozenByteBuffer;
|
|
1043
|
+
/**
|
|
1044
|
+
* Parse a serialized full track name. Performs the same validations as {@link FullTrackName.tryNew}.
|
|
1045
|
+
* The provided buffer's read cursor advances accordingly.
|
|
1046
|
+
* @throws :{@link TrackNameError} if constraints are violated.
|
|
1047
|
+
*/
|
|
1048
|
+
static deserialize(buf: BaseByteBuffer): FullTrackName;
|
|
1049
|
+
}
|
|
1050
|
+
export declare class SubgroupObject {
|
|
1051
|
+
readonly properties: KeyValuePair[] | null;
|
|
1052
|
+
readonly objectStatus: ObjectStatus | null;
|
|
1053
|
+
readonly payload: Uint8Array | null;
|
|
1054
|
+
readonly objectId: bigint;
|
|
1055
|
+
private constructor();
|
|
1056
|
+
static newWithStatus(objectId: bigint | number, properties: KeyValuePair[] | null, objectStatus: ObjectStatus): SubgroupObject;
|
|
1057
|
+
static newWithPayload(objectId: bigint | number, properties: KeyValuePair[] | null, payload: Uint8Array): SubgroupObject;
|
|
1058
|
+
serialize(previousObjectId: bigint | undefined): FrozenByteBuffer;
|
|
1059
|
+
static deserialize(buf: BaseByteBuffer, hasProperties: boolean, previousObjectId: bigint | undefined): SubgroupObject;
|
|
1060
|
+
}
|
|
1061
|
+
export declare class MoqtObject {
|
|
1062
|
+
readonly fullTrackName: FullTrackName;
|
|
1063
|
+
readonly publisherPriority: number;
|
|
1064
|
+
readonly objectForwardingPreference: ObjectForwardingPreference;
|
|
1065
|
+
readonly objectStatus: ObjectStatus;
|
|
1066
|
+
readonly properties: KeyValuePair[] | null;
|
|
1067
|
+
readonly payload: Uint8Array | null;
|
|
1068
|
+
readonly location: Location;
|
|
1069
|
+
readonly subgroupId: bigint | null;
|
|
1070
|
+
private constructor();
|
|
1071
|
+
get groupId(): bigint;
|
|
1072
|
+
get objectId(): bigint;
|
|
1073
|
+
getSubgroupHeaderType(containsEnd: boolean, useDefaultPriority?: boolean, firstObject?: boolean): SubgroupHeaderType;
|
|
1074
|
+
isDatagram(): boolean;
|
|
1075
|
+
isSubgroup(): boolean;
|
|
1076
|
+
isEndOfGroup(): boolean;
|
|
1077
|
+
isEndOfTrack(): boolean;
|
|
1078
|
+
hasPayload(): boolean;
|
|
1079
|
+
hasStatus(): boolean;
|
|
1080
|
+
static newWithPayload(fullTrackName: FullTrackName, location: Location, publisherPriority: number, objectForwardingPreference: ObjectForwardingPreference, subgroupId: bigint | number | null, properties: KeyValuePair[] | null, payload: Uint8Array): MoqtObject;
|
|
1081
|
+
static newWithStatus(fullTrackName: FullTrackName, location: Location, publisherPriority: number, objectForwardingPreference: ObjectForwardingPreference, subgroupId: bigint | number | null, properties: KeyValuePair[] | null, objectStatus: ObjectStatus): MoqtObject;
|
|
1082
|
+
/**
|
|
1083
|
+
* Create a MoqtObject from a Datagram.
|
|
1084
|
+
* @param datagram - The received Datagram.
|
|
1085
|
+
* @param fullTrackName - The resolved full track name.
|
|
1086
|
+
* @param defaultPriority - The default publisher priority from the control message (used when DEFAULT_PRIORITY bit is set).
|
|
1087
|
+
*/
|
|
1088
|
+
static fromDatagram(datagram: Datagram, fullTrackName: FullTrackName, defaultPriority?: number): MoqtObject;
|
|
1089
|
+
/**
|
|
1090
|
+
* Returns the endOfGroup flag from the source Datagram.
|
|
1091
|
+
* This is separate from ObjectStatus.EndOfGroup - the flag indicates
|
|
1092
|
+
* this is the last object in the group even with Normal status.
|
|
1093
|
+
*/
|
|
1094
|
+
static isDatagramEndOfGroup(datagram: Datagram): boolean;
|
|
1095
|
+
static fromFetchObject(fetchObject: FetchObject, fullTrackName: FullTrackName): MoqtObject;
|
|
1096
|
+
static fromSubgroupObject(subgroupObject: SubgroupObject, groupId: bigint | number, publisherPriority: number | undefined, subgroupId: bigint | number | null, fullTrackName: FullTrackName): MoqtObject;
|
|
1097
|
+
/**
|
|
1098
|
+
* Convert to Datagram for wire transmission.
|
|
1099
|
+
* Automatically creates a payload or status Datagram based on the object's state.
|
|
1100
|
+
* @param trackAlias - The track alias to use.
|
|
1101
|
+
* @param endOfGroup - Whether this is the last object in the group (only for payload datagrams).
|
|
1102
|
+
* @param defaultPriority - If provided and matches this object's priority, the DEFAULT_PRIORITY bit is set.
|
|
1103
|
+
*/
|
|
1104
|
+
tryIntoDatagram(trackAlias: bigint | number, endOfGroup?: boolean, defaultPriority?: number): Datagram;
|
|
1105
|
+
tryIntoFetchObject(): FetchObject;
|
|
1106
|
+
tryIntoSubgroupObject(): SubgroupObject;
|
|
1107
|
+
}
|
|
1108
|
+
export declare class SubgroupHeader {
|
|
1109
|
+
readonly type: SubgroupHeaderType;
|
|
1110
|
+
readonly publisherPriority: number | undefined;
|
|
1111
|
+
/**
|
|
1112
|
+
* Absent on the wire, and still unknown here, when the type says the Subgroup ID
|
|
1113
|
+
* is the first Object ID: that object has not been read yet at header time.
|
|
1114
|
+
* `resolveSubgroupId` fills it in, so consumers can read this rather than each
|
|
1115
|
+
* deriving it again.
|
|
1116
|
+
*/
|
|
1117
|
+
subgroupId: bigint | undefined;
|
|
1118
|
+
readonly trackAlias: bigint;
|
|
1119
|
+
readonly groupId: bigint;
|
|
1120
|
+
constructor(type: SubgroupHeaderType, trackAlias: bigint | number, groupId: bigint | number, subgroupId: bigint | number | undefined, publisherPriority: number | undefined);
|
|
1121
|
+
serialize(): FrozenByteBuffer;
|
|
1122
|
+
static deserialize(buf: BaseByteBuffer): SubgroupHeader;
|
|
1123
|
+
/**
|
|
1124
|
+
* Name this subgroup from the first object read off its stream, for the header
|
|
1125
|
+
* type that defers the Subgroup ID to it. Ignored for every other type, and for
|
|
1126
|
+
* a header already named, so later objects on the stream cannot rename it.
|
|
1127
|
+
*/
|
|
1128
|
+
resolveSubgroupId(firstObjectId: bigint): void;
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* A bidirectional map between requestId (bigint) and full track names.
|
|
1132
|
+
* Used to efficiently look up either by requestId or by name, enforcing uniqueness.
|
|
1133
|
+
*
|
|
1134
|
+
* @public
|
|
1135
|
+
*/
|
|
1136
|
+
export declare class RequestIdMap {
|
|
1137
|
+
private requestIdToName;
|
|
1138
|
+
private nameToRequestId;
|
|
1139
|
+
/**
|
|
1140
|
+
* @public
|
|
1141
|
+
* Adds a mapping between a requestId and a full track name.
|
|
1142
|
+
*
|
|
1143
|
+
* @param requestId - The requestId to associate.
|
|
1144
|
+
* @param name - The full track name to associate.
|
|
1145
|
+
* @throws :{@link RequestIdError} if the requestId or name is already mapped to a different value.
|
|
1146
|
+
*/
|
|
1147
|
+
addMapping(requestId: bigint, name: FullTrackName): void;
|
|
1148
|
+
/**
|
|
1149
|
+
* @public
|
|
1150
|
+
* Gets the full track name for a given requestId.
|
|
1151
|
+
*
|
|
1152
|
+
* @param requestId - The requestId to look up.
|
|
1153
|
+
* @returns The associated full track name.
|
|
1154
|
+
* @throws :{@link RequestIdError} if the requestId does not exist.
|
|
1155
|
+
*/
|
|
1156
|
+
getNameByRequestId(requestId: bigint): FullTrackName;
|
|
1157
|
+
/**
|
|
1158
|
+
* @public
|
|
1159
|
+
* Gets the requestId for a given full track name.
|
|
1160
|
+
*
|
|
1161
|
+
* @param name - The full track name to look up.
|
|
1162
|
+
* @returns The associated requestId.
|
|
1163
|
+
* @throws :{@link RequestIdError} if the name does not exist.
|
|
1164
|
+
*/
|
|
1165
|
+
getRequestIdByName(name: FullTrackName): bigint;
|
|
1166
|
+
/**
|
|
1167
|
+
* @public
|
|
1168
|
+
* Removes a mapping by requestId.
|
|
1169
|
+
*
|
|
1170
|
+
* @param requestId - The requestId to remove.
|
|
1171
|
+
* @returns The removed full track name, or undefined if not found.
|
|
1172
|
+
*/
|
|
1173
|
+
removeMappingByRequestId(requestId: bigint): FullTrackName | undefined;
|
|
1174
|
+
/**
|
|
1175
|
+
* @public
|
|
1176
|
+
* Removes a mapping by full track name.
|
|
1177
|
+
*
|
|
1178
|
+
* @param name - The full track name to remove.
|
|
1179
|
+
* @returns The removed requestId, or undefined if not found.
|
|
1180
|
+
*/
|
|
1181
|
+
removeMappingByName(name: FullTrackName): bigint | undefined;
|
|
1182
|
+
/**
|
|
1183
|
+
* @public
|
|
1184
|
+
* Checks if the map contains a given requestId.
|
|
1185
|
+
*
|
|
1186
|
+
* @param requestId - The requestId to check.
|
|
1187
|
+
* @returns True if the requestId exists, false otherwise.
|
|
1188
|
+
*/
|
|
1189
|
+
containsRequestId(requestId: bigint): boolean;
|
|
1190
|
+
/**
|
|
1191
|
+
* @public
|
|
1192
|
+
* Checks if the map contains a given full track name.
|
|
1193
|
+
*
|
|
1194
|
+
* @param name - The full track name to check.
|
|
1195
|
+
* @returns True if the name exists, false otherwise.
|
|
1196
|
+
*/
|
|
1197
|
+
containsName(name: FullTrackName): boolean;
|
|
1198
|
+
}
|
|
1199
|
+
export type Header = FetchHeader | SubgroupHeader;
|
|
1200
|
+
export declare namespace Header {
|
|
1201
|
+
function newFetch(...args: ConstructorParameters<typeof FetchHeader>): Header;
|
|
1202
|
+
function newSubgroup(...args: ConstructorParameters<typeof SubgroupHeader>): Header;
|
|
1203
|
+
function isFetch(header: Header): header is FetchHeader;
|
|
1204
|
+
function isSubgroup(header: Header): header is SubgroupHeader;
|
|
1205
|
+
function serialize(header: Header): FrozenByteBuffer;
|
|
1206
|
+
function deserialize(buf: BaseByteBuffer): Header;
|
|
1207
|
+
}
|
|
1208
|
+
export declare abstract class BaseByteBuffer {
|
|
1209
|
+
protected buf: Uint8Array;
|
|
1210
|
+
protected view: DataView;
|
|
1211
|
+
protected _offset: number;
|
|
1212
|
+
protected _checkpoint: number;
|
|
1213
|
+
constructor(buf: Uint8Array);
|
|
1214
|
+
get offset(): number;
|
|
1215
|
+
abstract get length(): number;
|
|
1216
|
+
get remaining(): number;
|
|
1217
|
+
/**
|
|
1218
|
+
* Save current read position for potential rollback
|
|
1219
|
+
*/
|
|
1220
|
+
checkpoint(): void;
|
|
1221
|
+
/**
|
|
1222
|
+
* Restore read position to last checkpoint
|
|
1223
|
+
*/
|
|
1224
|
+
restore(): void;
|
|
1225
|
+
toUint8Array(): Uint8Array;
|
|
1226
|
+
getU8(): number;
|
|
1227
|
+
getU16(): number;
|
|
1228
|
+
getVI(): bigint;
|
|
1229
|
+
countLeadingOnes(byte: number): number;
|
|
1230
|
+
firstByteValueBits(first: number, length: number): bigint;
|
|
1231
|
+
getNumberVI(): number;
|
|
1232
|
+
getBytes(len: number): Uint8Array;
|
|
1233
|
+
getLengthPrefixedBytes(): Uint8Array;
|
|
1234
|
+
getKeyValuePair(): KeyValuePair;
|
|
1235
|
+
getReasonPhrase(): ReasonPhrase;
|
|
1236
|
+
getLocation(): Location;
|
|
1237
|
+
getTuple(): Tuple;
|
|
1238
|
+
getFullTrackName(): FullTrackName;
|
|
1239
|
+
}
|
|
1240
|
+
export declare class ByteBuffer extends BaseByteBuffer {
|
|
1241
|
+
private _length;
|
|
1242
|
+
constructor(initialSize?: number);
|
|
1243
|
+
get length(): number;
|
|
1244
|
+
/**
|
|
1245
|
+
* Clear all data and reset all positions
|
|
1246
|
+
*/
|
|
1247
|
+
clear(): void;
|
|
1248
|
+
/**
|
|
1249
|
+
* Drop all data before current offset and reset positions
|
|
1250
|
+
* This is the key method for memory management - removes processed data
|
|
1251
|
+
*/
|
|
1252
|
+
commit(): void;
|
|
1253
|
+
private ensureCapacity;
|
|
1254
|
+
putU8(v: number): void;
|
|
1255
|
+
putU16(v: number): void;
|
|
1256
|
+
/**
|
|
1257
|
+
/**
|
|
1258
|
+
* Encode a MOQT varint using the minimal length.
|
|
1259
|
+
*/
|
|
1260
|
+
putVI(v: bigint | number): void;
|
|
1261
|
+
putBytes(src: Uint8Array): void;
|
|
1262
|
+
putLengthPrefixedBytes(src: Uint8Array): void;
|
|
1263
|
+
putKeyValuePair(pair: KeyValuePair): void;
|
|
1264
|
+
putReasonPhrase(reason: ReasonPhrase): void;
|
|
1265
|
+
toUint8Array(): Uint8Array;
|
|
1266
|
+
freeze(): FrozenByteBuffer;
|
|
1267
|
+
putLocation(loc: Location): void;
|
|
1268
|
+
putTuple(tuple: Tuple): void;
|
|
1269
|
+
putFullTrackName(fullTrackName: FullTrackName): void;
|
|
1270
|
+
}
|
|
1271
|
+
export declare class FrozenByteBuffer extends BaseByteBuffer {
|
|
1272
|
+
constructor(buf: Uint8Array);
|
|
1273
|
+
get length(): number;
|
|
1274
|
+
}
|
|
1275
|
+
/**
|
|
1276
|
+
* @public
|
|
1277
|
+
* PUBLISH_SKIPPED (0xF): a publisher tells the peer it cannot send the PUBLISH that
|
|
1278
|
+
* would start a subscription to a track under a SUBSCRIBE_TRACKS namespace.
|
|
1279
|
+
*
|
|
1280
|
+
* Sent on the SUBSCRIBE_TRACKS response stream, so only the namespace suffix after that
|
|
1281
|
+
* subscription's prefix is carried.
|
|
1282
|
+
*/
|
|
1283
|
+
export declare class PublishSkipped {
|
|
1284
|
+
readonly trackNamespaceSuffix: Tuple;
|
|
1285
|
+
readonly trackName: Uint8Array;
|
|
1286
|
+
constructor(trackNamespaceSuffix: Tuple, trackName: Uint8Array);
|
|
1287
|
+
getType(): ControlMessageType;
|
|
1288
|
+
serialize(): FrozenByteBuffer;
|
|
1289
|
+
static parsePayload(buf: BaseByteBuffer): PublishSkipped;
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Copyright 2026 The MOQtail Authors
|
|
1293
|
+
*
|
|
1294
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1295
|
+
* you may not use this file except in compliance with the License.
|
|
1296
|
+
* You may obtain a copy of the License at
|
|
1297
|
+
*
|
|
1298
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1299
|
+
*
|
|
1300
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1301
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1302
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1303
|
+
* See the License for the specific language governing permissions and
|
|
1304
|
+
* limitations under the License.
|
|
1305
|
+
*/
|
|
1306
|
+
export declare enum SetupOptionType {
|
|
1307
|
+
Path = 1,
|
|
1308
|
+
AuthorizationToken = 3,
|
|
1309
|
+
MaxAuthTokenCacheSize = 4,
|
|
1310
|
+
/** Raw-QUIC only. Client-only; MUST NOT be sent over WebTransport. */
|
|
1311
|
+
Authority = 5,
|
|
1312
|
+
MaxFilterRanges = 6,
|
|
1313
|
+
MoqtImplementation = 7,
|
|
1314
|
+
MaxRequestUpdates = 8,
|
|
1315
|
+
/**
|
|
1316
|
+
* PROVISIONAL: sender-side track switching is not an adopted extension, so this
|
|
1317
|
+
* codepoint is absent from the registry the conformance fixture tracks. It sits in the
|
|
1318
|
+
* 0x07-0x7F range of this space, which that registry leaves free.
|
|
1319
|
+
*/
|
|
1320
|
+
SstsAlgorithms = 9
|
|
1321
|
+
}
|
|
1322
|
+
export declare function setupOptionTypeFromNumber(value: number): SetupOptionType;
|
|
1323
|
+
export declare enum MessageParameterType {
|
|
1324
|
+
ObjectDeliveryTimeout = 2,
|
|
1325
|
+
AuthorizationToken = 3,
|
|
1326
|
+
RendezvousTimeout = 4,
|
|
1327
|
+
SubgroupDeliveryTimeout = 6,
|
|
1328
|
+
Expires = 8,
|
|
1329
|
+
LargestObject = 9,
|
|
1330
|
+
FillTimeout = 10,
|
|
1331
|
+
Forward = 16,
|
|
1332
|
+
SubscriberPriority = 32,
|
|
1333
|
+
LocationFilter = 33,
|
|
1334
|
+
GroupOrder = 34,
|
|
1335
|
+
FillParameters = 35,
|
|
1336
|
+
SwitchFrom = 36,
|
|
1337
|
+
SubgroupFilter = 37,
|
|
1338
|
+
ObjectIdFilter = 38,
|
|
1339
|
+
PriorityFilter = 39,
|
|
1340
|
+
ObjectPropertyFilter = 40,
|
|
1341
|
+
TrackPropertyFilter = 41,
|
|
1342
|
+
NewGroupRequest = 50,
|
|
1343
|
+
/**
|
|
1344
|
+
* Registered codepoint with no typed parameter yet: its consumer is REQUEST_UPDATE for
|
|
1345
|
+
* SUBSCRIBE_TRACKS (TS-11), and the value is a Track Namespace tuple rather than the
|
|
1346
|
+
* varint its even Type implies.
|
|
1347
|
+
*/
|
|
1348
|
+
TrackNamespacePrefix = 52,
|
|
1349
|
+
IncludeProperties = 53,
|
|
1350
|
+
/**
|
|
1351
|
+
* PROVISIONAL: sender-side track switching is not an adopted extension, so this
|
|
1352
|
+
* codepoint is absent from the registry the conformance fixture tracks; see its
|
|
1353
|
+
* `local_extensions`.
|
|
1354
|
+
*/
|
|
1355
|
+
SwitchingSetAssignment = 65
|
|
1356
|
+
}
|
|
1357
|
+
export declare function messageParameterTypeFromNumber(value: bigint | number): MessageParameterType;
|
|
1358
|
+
export declare enum TokenAliasType {
|
|
1359
|
+
Delete = 0,
|
|
1360
|
+
Register = 1,
|
|
1361
|
+
UseAlias = 2,
|
|
1362
|
+
UseValue = 3
|
|
1363
|
+
}
|
|
1364
|
+
export declare function tokenAliasTypeFromNumber(value: number): TokenAliasType;
|
|
1365
|
+
export interface Parameter {
|
|
1366
|
+
toKeyValuePair(): KeyValuePair;
|
|
1367
|
+
}
|
|
1368
|
+
export type AuthTokenVariant = {
|
|
1369
|
+
aliasType: TokenAliasType.Delete;
|
|
1370
|
+
tokenAlias: bigint;
|
|
1371
|
+
} | {
|
|
1372
|
+
aliasType: TokenAliasType.Register;
|
|
1373
|
+
tokenAlias: bigint;
|
|
1374
|
+
tokenType: bigint;
|
|
1375
|
+
tokenValue: Uint8Array;
|
|
1376
|
+
} | {
|
|
1377
|
+
aliasType: TokenAliasType.UseAlias;
|
|
1378
|
+
tokenAlias: bigint;
|
|
1379
|
+
} | {
|
|
1380
|
+
aliasType: TokenAliasType.UseValue;
|
|
1381
|
+
tokenType: bigint;
|
|
1382
|
+
tokenValue: Uint8Array;
|
|
1383
|
+
};
|
|
1384
|
+
export declare class AuthorizationToken implements Parameter {
|
|
1385
|
+
readonly variant: AuthTokenVariant;
|
|
1386
|
+
static readonly TYPE = MessageParameterType.AuthorizationToken;
|
|
1387
|
+
private constructor();
|
|
1388
|
+
static newDelete(tokenAlias: bigint | number): AuthorizationToken;
|
|
1389
|
+
static newRegister(tokenAlias: bigint | number, tokenType: bigint | number, tokenValue: Uint8Array): AuthorizationToken;
|
|
1390
|
+
static newUseAlias(tokenAlias: bigint | number): AuthorizationToken;
|
|
1391
|
+
static newUseValue(tokenType: bigint | number, tokenValue: Uint8Array): AuthorizationToken;
|
|
1392
|
+
toKeyValuePair(): KeyValuePair;
|
|
1393
|
+
static fromKeyValuePair(pair: KeyValuePair): AuthorizationToken | undefined;
|
|
1394
|
+
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Duration in milliseconds a relay SHOULD wait for objects it does not yet hold before
|
|
1397
|
+
* ending the FETCH. FETCH only (§10.2.5).
|
|
1398
|
+
*/
|
|
1399
|
+
export declare class FillTimeout implements Parameter {
|
|
1400
|
+
readonly timeout: bigint;
|
|
1401
|
+
static readonly TYPE = MessageParameterType.FillTimeout;
|
|
1402
|
+
constructor(timeout: bigint);
|
|
1403
|
+
toKeyValuePair(): KeyValuePair;
|
|
1404
|
+
static fromKeyValuePair(pair: KeyValuePair): FillTimeout | undefined;
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Duration in milliseconds the relay SHOULD continue to attempt forwarding an Object.
|
|
1408
|
+
* A value of 0 means no timeout is set (§8).
|
|
1409
|
+
* This parameter is subscription-specific and SHOULD NOT be forwarded upstream
|
|
1410
|
+
* by a relay serving multiple subscriptions for the same track.
|
|
1411
|
+
*/
|
|
1412
|
+
export declare class ObjectDeliveryTimeout implements Parameter {
|
|
1413
|
+
readonly timeout: bigint;
|
|
1414
|
+
static readonly TYPE = MessageParameterType.ObjectDeliveryTimeout;
|
|
1415
|
+
constructor(timeout: bigint);
|
|
1416
|
+
toKeyValuePair(): KeyValuePair;
|
|
1417
|
+
static fromKeyValuePair(pair: KeyValuePair): ObjectDeliveryTimeout | undefined;
|
|
1418
|
+
}
|
|
1419
|
+
/**
|
|
1420
|
+
* Duration in milliseconds a relay SHOULD wait for a publisher of a track that has none
|
|
1421
|
+
* before answering the SUBSCRIBE. SUBSCRIBE only (§10.2.6).
|
|
1422
|
+
*/
|
|
1423
|
+
export declare class RendezvousTimeout implements Parameter {
|
|
1424
|
+
readonly timeout: bigint;
|
|
1425
|
+
static readonly TYPE = MessageParameterType.RendezvousTimeout;
|
|
1426
|
+
constructor(timeout: bigint);
|
|
1427
|
+
toKeyValuePair(): KeyValuePair;
|
|
1428
|
+
static fromKeyValuePair(pair: KeyValuePair): RendezvousTimeout | undefined;
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Duration in milliseconds the relay SHOULD continue to attempt forwarding a Subgroup.
|
|
1432
|
+
* A value of 0 means no timeout is set (§8).
|
|
1433
|
+
*/
|
|
1434
|
+
export declare class SubgroupDeliveryTimeout implements Parameter {
|
|
1435
|
+
readonly timeout: bigint;
|
|
1436
|
+
static readonly TYPE = MessageParameterType.SubgroupDeliveryTimeout;
|
|
1437
|
+
constructor(timeout: bigint);
|
|
1438
|
+
toKeyValuePair(): KeyValuePair;
|
|
1439
|
+
static fromKeyValuePair(pair: KeyValuePair): SubgroupDeliveryTimeout | undefined;
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Time in milliseconds after which the sender will terminate the subscription.
|
|
1443
|
+
* A value of 0 means the subscription does not expire or expires at an unknown time.
|
|
1444
|
+
* The receiver can extend the subscription by sending a REQUEST_UPDATE.
|
|
1445
|
+
*/
|
|
1446
|
+
export declare class Expires implements Parameter {
|
|
1447
|
+
readonly expires: bigint;
|
|
1448
|
+
static readonly TYPE = MessageParameterType.Expires;
|
|
1449
|
+
constructor(expires: bigint);
|
|
1450
|
+
toKeyValuePair(): KeyValuePair;
|
|
1451
|
+
static fromKeyValuePair(pair: KeyValuePair): Expires | undefined;
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* Forwarding state for affected subscriptions.
|
|
1455
|
+
* Allowed wire values: 0 (don't forward) or 1 (forward).
|
|
1456
|
+
* Any other value is a PROTOCOL_VIOLATION.
|
|
1457
|
+
* Default (when omitted) is 1 (forward).
|
|
1458
|
+
*/
|
|
1459
|
+
export declare class Forward implements Parameter {
|
|
1460
|
+
readonly forward: boolean;
|
|
1461
|
+
static readonly TYPE = MessageParameterType.Forward;
|
|
1462
|
+
constructor(forward: boolean);
|
|
1463
|
+
toKeyValuePair(): KeyValuePair;
|
|
1464
|
+
static fromKeyValuePair(pair: KeyValuePair): Forward | undefined;
|
|
1465
|
+
}
|
|
1466
|
+
/**
|
|
1467
|
+
* Whether the response carries Track Properties: the OK answering a SUBSCRIBE,
|
|
1468
|
+
* TRACK_STATUS or FETCH, or each PUBLISH a SUBSCRIBE_TRACKS brings. With 0 the
|
|
1469
|
+
* Track Properties field is still there, but empty.
|
|
1470
|
+
* Allowed wire values: 0 or 1; any other value is a PROTOCOL_VIOLATION.
|
|
1471
|
+
* Default (when omitted) is 1 (include them).
|
|
1472
|
+
*/
|
|
1473
|
+
export declare class IncludeProperties implements Parameter {
|
|
1474
|
+
readonly include: boolean;
|
|
1475
|
+
static readonly TYPE = MessageParameterType.IncludeProperties;
|
|
1476
|
+
constructor(include: boolean);
|
|
1477
|
+
toKeyValuePair(): KeyValuePair;
|
|
1478
|
+
static fromKeyValuePair(pair: KeyValuePair): IncludeProperties | undefined;
|
|
1479
|
+
}
|
|
1480
|
+
/**
|
|
1481
|
+
* How to prioritize Objects from different groups (Ascending=0x1 or Descending=0x2).
|
|
1482
|
+
* Values outside this range are a PROTOCOL_VIOLATION (Original/0x0 is not a valid wire value).
|
|
1483
|
+
* If omitted from SUBSCRIBE, the publisher's track preference is used.
|
|
1484
|
+
* If omitted from FETCH, Ascending (0x1) is used.
|
|
1485
|
+
*/
|
|
1486
|
+
export declare class GroupOrderParam implements Parameter {
|
|
1487
|
+
readonly order: GroupOrder.Ascending | GroupOrder.Descending;
|
|
1488
|
+
static readonly TYPE = MessageParameterType.GroupOrder;
|
|
1489
|
+
constructor(order: GroupOrder.Ascending | GroupOrder.Descending);
|
|
1490
|
+
toKeyValuePair(): KeyValuePair;
|
|
1491
|
+
static fromKeyValuePair(pair: KeyValuePair): GroupOrderParam | undefined;
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* Copyright 2026 The MOQtail Authors
|
|
1495
|
+
*
|
|
1496
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1497
|
+
* you may not use this file except in compliance with the License.
|
|
1498
|
+
* You may obtain a copy of the License at
|
|
1499
|
+
*
|
|
1500
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1501
|
+
*
|
|
1502
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1503
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1504
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1505
|
+
* See the License for the specific language governing permissions and
|
|
1506
|
+
* limitations under the License.
|
|
1507
|
+
*/
|
|
1508
|
+
/**
|
|
1509
|
+
* GREASE reservations (§14). Values matching `0x7f * N + 0x9D` are reserved across
|
|
1510
|
+
* several registries (Setup Options, Properties, error codes) so peers can emit them
|
|
1511
|
+
* to exercise unknown-value handling. Receivers treat them like any other unknown
|
|
1512
|
+
* value: ignore, never fatal.
|
|
1513
|
+
*/
|
|
1514
|
+
/** Step between successive GREASE values. */
|
|
1515
|
+
export declare const GREASE_STEP = 127n;
|
|
1516
|
+
/** The smallest GREASE value (N = 0). */
|
|
1517
|
+
export declare const GREASE_BASE = 157n;
|
|
1518
|
+
/**
|
|
1519
|
+
* @public
|
|
1520
|
+
* True if `value` is a reserved GREASE value, i.e. `0x7f * N + 0x9D` for some
|
|
1521
|
+
* non-negative `N`.
|
|
1522
|
+
*/
|
|
1523
|
+
export declare function isGrease(value: bigint | number): boolean;
|
|
1524
|
+
/**
|
|
1525
|
+
* @public
|
|
1526
|
+
* The `N`-th GREASE value, `0x7f * N + 0x9D`, or undefined if it would exceed what a
|
|
1527
|
+
* varint can carry (the pattern is capped at `0x3fffffffffffffde`).
|
|
1528
|
+
*/
|
|
1529
|
+
export declare function greaseValue(n: bigint | number): bigint | undefined;
|
|
1530
|
+
/**
|
|
1531
|
+
* Copyright 2026 The MOQtail Authors
|
|
1532
|
+
*
|
|
1533
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1534
|
+
* you may not use this file except in compliance with the License.
|
|
1535
|
+
* You may obtain a copy of the License at
|
|
1536
|
+
*
|
|
1537
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1538
|
+
*
|
|
1539
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1540
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1541
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1542
|
+
* See the License for the specific language governing permissions and
|
|
1543
|
+
* limitations under the License.
|
|
1544
|
+
*/
|
|
1545
|
+
/**
|
|
1546
|
+
* @public
|
|
1547
|
+
* A `moqt://` fragment, `#<type>:<value>`. Processed locally and never sent to the
|
|
1548
|
+
* server (§3.1).
|
|
1549
|
+
*/
|
|
1550
|
+
export interface MoqtFragment {
|
|
1551
|
+
kind: string;
|
|
1552
|
+
value: string;
|
|
1553
|
+
}
|
|
1554
|
+
/**
|
|
1555
|
+
* @public
|
|
1556
|
+
* A parsed `moqt://authority/path[?query][#fragment]` URI.
|
|
1557
|
+
*
|
|
1558
|
+
* `moqt-URI = "moqt" "://" authority path-abempty [ "?" query ]`, with an optional
|
|
1559
|
+
* local-only fragment. `authority` is `host[:port]`; `path` keeps its leading `/`
|
|
1560
|
+
* (empty when absent); `query` excludes the `?`.
|
|
1561
|
+
*
|
|
1562
|
+
* This is the TypeScript twin of `MoqtUrl` in `apps/client/src/connection.rs`; the two
|
|
1563
|
+
* must agree on what a given URL means.
|
|
1564
|
+
*/
|
|
1565
|
+
export declare class MoqtUrl {
|
|
1566
|
+
readonly authority: string;
|
|
1567
|
+
readonly path: string;
|
|
1568
|
+
readonly query: string | undefined;
|
|
1569
|
+
readonly fragment: MoqtFragment | undefined;
|
|
1570
|
+
constructor(authority: string, path: string, query: string | undefined, fragment: MoqtFragment | undefined);
|
|
1571
|
+
static parse(input: string): MoqtUrl;
|
|
1572
|
+
/** The `path[?query]` string carried in the PATH setup option on native QUIC. */
|
|
1573
|
+
pathAndQuery(): string;
|
|
1574
|
+
/** The equivalent `https://` URL for WebTransport, dropping the local fragment. */
|
|
1575
|
+
toHttps(): string;
|
|
1576
|
+
}
|
|
1577
|
+
/**
|
|
1578
|
+
* @public
|
|
1579
|
+
* Resolves a session URL to the URL WebTransport is actually opened with.
|
|
1580
|
+
*
|
|
1581
|
+
* `moqt://` is the scheme callers are meant to use (§3.1); it is mapped to the
|
|
1582
|
+
* equivalent `https://` here because the browser's WebTransport constructor only speaks
|
|
1583
|
+
* HTTP/3. An `https://` input is passed through unchanged so existing callers keep
|
|
1584
|
+
* working. Over WebTransport the authority and path travel in the HTTP CONNECT request,
|
|
1585
|
+
* so neither is repeated as a setup option -- AUTHORITY over WebTransport is a protocol
|
|
1586
|
+
* violation, and PATH would be redundant.
|
|
1587
|
+
*/
|
|
1588
|
+
export declare function resolveTransportUrl(url: string | URL): {
|
|
1589
|
+
transportUrl: string;
|
|
1590
|
+
moqtUrl: MoqtUrl | undefined;
|
|
1591
|
+
};
|
|
1592
|
+
/**
|
|
1593
|
+
* @public
|
|
1594
|
+
* Directs the peer to retry a request at a different URI and/or for a different Full
|
|
1595
|
+
* Track Name (§10.6.1). Carried by a REQUEST_ERROR whose code is `REDIRECT`.
|
|
1596
|
+
*/
|
|
1597
|
+
export declare class Redirect {
|
|
1598
|
+
/** Empty, together with an empty {@link Redirect.trackName}, means reuse the original request's track. */
|
|
1599
|
+
readonly trackNamespace: Tuple;
|
|
1600
|
+
/** Empty for namespace-scoped requests, which have no track name to redirect. */
|
|
1601
|
+
readonly trackName: Uint8Array;
|
|
1602
|
+
/** Undefined means reuse the current session's URI. */
|
|
1603
|
+
readonly connectUri: string | undefined;
|
|
1604
|
+
constructor(connectUri: string | undefined,
|
|
1605
|
+
/** Empty, together with an empty {@link Redirect.trackName}, means reuse the original request's track. */
|
|
1606
|
+
trackNamespace: Tuple,
|
|
1607
|
+
/** Empty for namespace-scoped requests, which have no track name to redirect. */
|
|
1608
|
+
trackName: Uint8Array);
|
|
1609
|
+
/** True when the redirect names no track of its own, so the original request's track carries over. */
|
|
1610
|
+
get keepsOriginalTrack(): boolean;
|
|
1611
|
+
serialize(): FrozenByteBuffer;
|
|
1612
|
+
static deserialize(buf: BaseByteBuffer): Redirect;
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
* The largest Location in the Track observed by the sending endpoint.
|
|
1616
|
+
* If omitted from a message, the sending endpoint has not published or
|
|
1617
|
+
* received any Objects in the Track.
|
|
1618
|
+
*/
|
|
1619
|
+
export declare class LargestObject implements Parameter {
|
|
1620
|
+
readonly location: Location;
|
|
1621
|
+
static readonly TYPE = MessageParameterType.LargestObject;
|
|
1622
|
+
constructor(location: Location);
|
|
1623
|
+
toKeyValuePair(): KeyValuePair;
|
|
1624
|
+
static fromKeyValuePair(pair: KeyValuePair): LargestObject | undefined;
|
|
1625
|
+
}
|
|
1626
|
+
/**
|
|
1627
|
+
* The largest Group ID in the Track known by the subscriber, plus 1.
|
|
1628
|
+
* A value of 0 indicates the subscriber has no Group information for the Track.
|
|
1629
|
+
* Only valid for tracks with the DYNAMIC_GROUPS property (value 1).
|
|
1630
|
+
*/
|
|
1631
|
+
export declare class NewGroupRequest implements Parameter {
|
|
1632
|
+
readonly group: bigint;
|
|
1633
|
+
static readonly TYPE = MessageParameterType.NewGroupRequest;
|
|
1634
|
+
constructor(group: bigint);
|
|
1635
|
+
toKeyValuePair(): KeyValuePair;
|
|
1636
|
+
static fromKeyValuePair(pair: KeyValuePair): NewGroupRequest | undefined;
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* Assigns a subscription to an SSTS (sender-side track switching) switching
|
|
1640
|
+
* set. Carried on SUBSCRIBE and on the PUBLISH_OK of a pushed track.
|
|
1641
|
+
*
|
|
1642
|
+
* PROVISIONAL: sender-side track switching is not an adopted extension, so
|
|
1643
|
+
* this parameter has no codepoint in the registry the conformance fixture
|
|
1644
|
+
* tracks (`dev/conformance/draft22`) and is never asserted against it. Id 0 is
|
|
1645
|
+
* the default allocation every implementation runs; other ids select an
|
|
1646
|
+
* algorithm specific to one implementation.
|
|
1647
|
+
*/
|
|
1648
|
+
export declare class SwitchingSetAssignment implements Parameter {
|
|
1649
|
+
readonly switchingSetId: bigint;
|
|
1650
|
+
readonly algorithmId: bigint;
|
|
1651
|
+
readonly throughputThresholdKbps: bigint;
|
|
1652
|
+
/** Relative bandwidth weight among same-rank sets, 1 through 10. */
|
|
1653
|
+
readonly setThroughputWeight: bigint;
|
|
1654
|
+
/** 0 pauses SSTS for the set; switching activates once the number of assigned tracks reaches this value. */
|
|
1655
|
+
readonly activateSwitching: bigint;
|
|
1656
|
+
/** Degradation priority; lower values are protected first. Default 0. */
|
|
1657
|
+
readonly setRank: number;
|
|
1658
|
+
static readonly TYPE = MessageParameterType.SwitchingSetAssignment;
|
|
1659
|
+
constructor(switchingSetId: bigint, algorithmId: bigint, throughputThresholdKbps: bigint,
|
|
1660
|
+
/** Relative bandwidth weight among same-rank sets, 1 through 10. */
|
|
1661
|
+
setThroughputWeight: bigint,
|
|
1662
|
+
/** 0 pauses SSTS for the set; switching activates once the number of assigned tracks reaches this value. */
|
|
1663
|
+
activateSwitching: bigint,
|
|
1664
|
+
/** Degradation priority; lower values are protected first. Default 0. */
|
|
1665
|
+
setRank?: number);
|
|
1666
|
+
toKeyValuePair(): KeyValuePair;
|
|
1667
|
+
static fromKeyValuePair(pair: KeyValuePair): SwitchingSetAssignment | undefined;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Priority of a subscription relative to others in the same session.
|
|
1671
|
+
* Lower numbers have higher priority. Range: 0-255.
|
|
1672
|
+
* Values outside this range are a PROTOCOL_VIOLATION.
|
|
1673
|
+
* Default (when omitted from SUBSCRIBE, PUBLISH_OK, or FETCH) is 128.
|
|
1674
|
+
*/
|
|
1675
|
+
export declare class SubscriberPriority implements Parameter {
|
|
1676
|
+
readonly priority: number;
|
|
1677
|
+
static readonly TYPE = MessageParameterType.SubscriberPriority;
|
|
1678
|
+
constructor(priority: number);
|
|
1679
|
+
toKeyValuePair(): KeyValuePair;
|
|
1680
|
+
static fromKeyValuePair(pair: KeyValuePair): SubscriberPriority | undefined;
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* The range of Locations a subscription or fetch selects. The Location Filter
|
|
1684
|
+
* Type decides which fields are set, and the value is not length-prefixed.
|
|
1685
|
+
*
|
|
1686
|
+
* Every Group here is absolute, except `startGroup` of a
|
|
1687
|
+
* {@link (LocationFilterType:enum).RelativeStart}, which counts back from the Next
|
|
1688
|
+
* Group: 0 is the Next Group, 1 the current one. The wire carries the End Group
|
|
1689
|
+
* as a delta from the Start Group; that is undone on the way in and redone on
|
|
1690
|
+
* the way out.
|
|
1691
|
+
*
|
|
1692
|
+
* If omitted from SUBSCRIBE or FETCH, the subscription or fetch is unfiltered.
|
|
1693
|
+
* If omitted from REQUEST_UPDATE, the value is unchanged.
|
|
1694
|
+
*/
|
|
1695
|
+
export declare class LocationFilter implements Parameter {
|
|
1696
|
+
readonly filterType: LocationFilterType;
|
|
1697
|
+
readonly startGroup?: bigint | undefined;
|
|
1698
|
+
readonly startObject?: bigint | undefined;
|
|
1699
|
+
readonly endGroup?: bigint | undefined;
|
|
1700
|
+
readonly endObject?: bigint | undefined;
|
|
1701
|
+
static readonly TYPE = MessageParameterType.LocationFilter;
|
|
1702
|
+
/**
|
|
1703
|
+
* @throws :{@link ProtocolViolationError} When a field the type calls for is
|
|
1704
|
+
* missing, or the End Group is before the Start Group.
|
|
1705
|
+
*/
|
|
1706
|
+
constructor(filterType: LocationFilterType, startGroup?: bigint | undefined, startObject?: bigint | undefined, endGroup?: bigint | undefined, endObject?: bigint | undefined);
|
|
1707
|
+
/**
|
|
1708
|
+
* The first Location the filter passes, given the track's Largest Object, or
|
|
1709
|
+
* `undefined` when there is no filter. A relative start that would fall before
|
|
1710
|
+
* group 0 is group 0; a track with nothing published yet starts a relative
|
|
1711
|
+
* filter at `{0,0}`.
|
|
1712
|
+
*/
|
|
1713
|
+
startLocation(largest?: Location): Location | undefined;
|
|
1714
|
+
/** The Start Location an absolute filter carries; `undefined` for the others. */
|
|
1715
|
+
get absoluteStart(): Location | undefined;
|
|
1716
|
+
/**
|
|
1717
|
+
* The last Location the filter passes, inclusive, or `undefined` when it is
|
|
1718
|
+
* open-ended. A Group End is the whole of that group, so its Object is 2^64-1.
|
|
1719
|
+
*/
|
|
1720
|
+
endLocation(): Location | undefined;
|
|
1721
|
+
/**
|
|
1722
|
+
* The inclusive range the filter selects under the rules for a Fetch, which
|
|
1723
|
+
* never reach past the Largest Object: an open end is the Largest Object, and
|
|
1724
|
+
* no filter at all is the whole track up to it.
|
|
1725
|
+
*
|
|
1726
|
+
* `undefined` when that range is empty, which includes a track with nothing
|
|
1727
|
+
* published yet and a Next Object filter, whose start is always past the
|
|
1728
|
+
* Largest Object.
|
|
1729
|
+
*/
|
|
1730
|
+
fetchRange(largest?: Location): {
|
|
1731
|
+
start: Location;
|
|
1732
|
+
end: Location;
|
|
1733
|
+
} | undefined;
|
|
1734
|
+
/** The Location Filter Type and its fields, without the Parameter Type. */
|
|
1735
|
+
serializeValue(): Uint8Array;
|
|
1736
|
+
/**
|
|
1737
|
+
* Reads a Location Filter Type and exactly the fields it calls for.
|
|
1738
|
+
* @throws :{@link ProtocolViolationError} For an unknown Location Filter Type,
|
|
1739
|
+
* or an End Group past 2^64-1.
|
|
1740
|
+
*/
|
|
1741
|
+
static deserializeValue(buf: BaseByteBuffer): LocationFilter;
|
|
1742
|
+
toKeyValuePair(): KeyValuePair;
|
|
1743
|
+
static fromKeyValuePair(pair: KeyValuePair): LocationFilter | undefined;
|
|
1744
|
+
}
|
|
1745
|
+
/**
|
|
1746
|
+
* Identifies the subscription being replaced by a switch request.
|
|
1747
|
+
* The value is two varints followed by a flags byte: bit 7 (MSB) is Publish Done;
|
|
1748
|
+
* bits 0 through 6 are reserved and must be zero.
|
|
1749
|
+
*/
|
|
1750
|
+
export declare class SwitchFrom implements Parameter {
|
|
1751
|
+
readonly requestId: bigint;
|
|
1752
|
+
readonly mode: SwitchMode;
|
|
1753
|
+
readonly publishDone: boolean;
|
|
1754
|
+
static readonly TYPE = MessageParameterType.SwitchFrom;
|
|
1755
|
+
constructor(requestId: bigint, mode: SwitchMode, publishDone: boolean);
|
|
1756
|
+
toKeyValuePair(): KeyValuePair;
|
|
1757
|
+
static fromKeyValuePair(pair: KeyValuePair): SwitchFrom | undefined;
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Requests a fill fetch stream, and overrides for it. An omitted parameter keeps
|
|
1761
|
+
* the value it has for the live subscription; an omitted LOCATION_FILTER fills
|
|
1762
|
+
* over the subscription's own.
|
|
1763
|
+
*/
|
|
1764
|
+
export declare class FillParameters implements Parameter {
|
|
1765
|
+
readonly parameters: MessageParameter[];
|
|
1766
|
+
static readonly TYPE = MessageParameterType.FillParameters;
|
|
1767
|
+
constructor(parameters: MessageParameter[]);
|
|
1768
|
+
toKeyValuePair(): KeyValuePair;
|
|
1769
|
+
static fromKeyValuePair(pair: KeyValuePair): FillParameters | undefined;
|
|
1770
|
+
}
|
|
1771
|
+
/**
|
|
1772
|
+
* Copyright 2025 The MOQtail Authors
|
|
1773
|
+
*
|
|
1774
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1775
|
+
* you may not use this file except in compliance with the License.
|
|
1776
|
+
* You may obtain a copy of the License at
|
|
1777
|
+
*
|
|
1778
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1779
|
+
*
|
|
1780
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1781
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1782
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1783
|
+
* See the License for the specific language governing permissions and
|
|
1784
|
+
* limitations under the License.
|
|
1785
|
+
*/
|
|
1786
|
+
/**
|
|
1787
|
+
* Base class for all MOQtail errors.
|
|
1788
|
+
*/
|
|
1789
|
+
export declare class MOQtailError extends Error {
|
|
1790
|
+
constructor(cause?: string);
|
|
1791
|
+
}
|
|
1792
|
+
/**
|
|
1793
|
+
* Not enough bytes in buffer to satisfy a read.
|
|
1794
|
+
*/
|
|
1795
|
+
export declare class NotEnoughBytesError extends MOQtailError {
|
|
1796
|
+
context: string;
|
|
1797
|
+
needed: number;
|
|
1798
|
+
available: number;
|
|
1799
|
+
constructor(context: string, needed: number, available: number);
|
|
1800
|
+
}
|
|
1801
|
+
/**
|
|
1802
|
+
* Cannot cast between two incompatible types.
|
|
1803
|
+
*/
|
|
1804
|
+
export declare class CastingError extends MOQtailError {
|
|
1805
|
+
context: string;
|
|
1806
|
+
fromType: string;
|
|
1807
|
+
toType: string;
|
|
1808
|
+
details: string;
|
|
1809
|
+
constructor(context: string, fromType: string, toType: string, details: string);
|
|
1810
|
+
}
|
|
1811
|
+
/**
|
|
1812
|
+
* Value too large to encode as varint.
|
|
1813
|
+
*/
|
|
1814
|
+
export declare class VarIntOverflowError extends MOQtailError {
|
|
1815
|
+
context: string;
|
|
1816
|
+
value: number;
|
|
1817
|
+
constructor(context: string, value: number);
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Length exceeds maximum allowed by protocol.
|
|
1821
|
+
*/
|
|
1822
|
+
export declare class LengthExceedsMaxError extends MOQtailError {
|
|
1823
|
+
context: string;
|
|
1824
|
+
max: number;
|
|
1825
|
+
len: number;
|
|
1826
|
+
constructor(context: string, max: number, len: number);
|
|
1827
|
+
}
|
|
1828
|
+
/**
|
|
1829
|
+
* Key/value formatting error.
|
|
1830
|
+
*/
|
|
1831
|
+
export declare class KeyValueFormattingError extends MOQtailError {
|
|
1832
|
+
context: string;
|
|
1833
|
+
constructor(context: string);
|
|
1834
|
+
}
|
|
1835
|
+
/**
|
|
1836
|
+
* Invalid discriminant or type tag.
|
|
1837
|
+
*/
|
|
1838
|
+
export declare class InvalidTypeError extends MOQtailError {
|
|
1839
|
+
context: string;
|
|
1840
|
+
details: string;
|
|
1841
|
+
constructor(context: string, details: string);
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* Invalid enum discriminant / value encountered when mapping to a protocol enum.
|
|
1845
|
+
*/
|
|
1846
|
+
export declare class InvalidEnumValue extends MOQtailError {
|
|
1847
|
+
context: string;
|
|
1848
|
+
value: bigint | number;
|
|
1849
|
+
constructor(context: string, value: bigint | number);
|
|
1850
|
+
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Invalid UTF-8 encountered in a string or bytes field.
|
|
1853
|
+
*/
|
|
1854
|
+
export declare class InvalidUTF8Error extends MOQtailError {
|
|
1855
|
+
context: string;
|
|
1856
|
+
details: string;
|
|
1857
|
+
constructor(context: string, details: string);
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* Generic protocol violation.
|
|
1861
|
+
*/
|
|
1862
|
+
export declare class ProtocolViolationError extends MOQtailError {
|
|
1863
|
+
context: string;
|
|
1864
|
+
details: string;
|
|
1865
|
+
constructor(context: string, details: string);
|
|
1866
|
+
}
|
|
1867
|
+
/**
|
|
1868
|
+
* Track naming error.
|
|
1869
|
+
*/
|
|
1870
|
+
export declare class TrackNameError extends MOQtailError {
|
|
1871
|
+
context: string;
|
|
1872
|
+
details: string;
|
|
1873
|
+
constructor(context: string, details: string);
|
|
1874
|
+
}
|
|
1875
|
+
/**
|
|
1876
|
+
* Request ID error.
|
|
1877
|
+
*/
|
|
1878
|
+
export declare class RequestIdError extends MOQtailError {
|
|
1879
|
+
context: string;
|
|
1880
|
+
details: string;
|
|
1881
|
+
constructor(context: string, details: string);
|
|
1882
|
+
}
|
|
1883
|
+
/**
|
|
1884
|
+
* Operation timed out.
|
|
1885
|
+
*/
|
|
1886
|
+
export declare class TimeoutError extends MOQtailError {
|
|
1887
|
+
context: string;
|
|
1888
|
+
constructor(context: string);
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* Internal error.
|
|
1892
|
+
*/
|
|
1893
|
+
export declare class InternalError extends MOQtailError {
|
|
1894
|
+
context: string;
|
|
1895
|
+
details: string;
|
|
1896
|
+
constructor(context: string, details: string);
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Connection terminated.
|
|
1900
|
+
*/
|
|
1901
|
+
export declare class TerminationError extends MOQtailError {
|
|
1902
|
+
context: string;
|
|
1903
|
+
terminationCode: number;
|
|
1904
|
+
constructor(context: string, terminationCode: number);
|
|
1905
|
+
}
|
|
1906
|
+
/**
|
|
1907
|
+
* What a Range Filter selects on. Each kind is its own parameter type, and the two
|
|
1908
|
+
* property kinds also name the Property they read.
|
|
1909
|
+
*/
|
|
1910
|
+
export declare enum RangeFilterKind {
|
|
1911
|
+
Subgroup = 37,
|
|
1912
|
+
ObjectId = 38,
|
|
1913
|
+
/** Publisher Priority, which is a single byte. */
|
|
1914
|
+
Priority = 39,
|
|
1915
|
+
ObjectProperty = 40,
|
|
1916
|
+
/** Selects tracks rather than Objects, so it only rides SUBSCRIBE_TRACKS. */
|
|
1917
|
+
TrackProperty = 41
|
|
1918
|
+
}
|
|
1919
|
+
export declare namespace RangeFilterKind {
|
|
1920
|
+
/** Whether the filter carries a Property Type after its SetID. */
|
|
1921
|
+
function hasPropertyType(kind: RangeFilterKind): boolean;
|
|
1922
|
+
function isRangeFilterType(typeValue: bigint | number): boolean;
|
|
1923
|
+
}
|
|
1924
|
+
/** An inclusive range of values. An open-ended range has no `end`. */
|
|
1925
|
+
export interface Range {
|
|
1926
|
+
readonly start: bigint;
|
|
1927
|
+
readonly end?: bigint;
|
|
1928
|
+
}
|
|
1929
|
+
/**
|
|
1930
|
+
* A Range as the wire carries it: the Start as a delta from the End before it, the
|
|
1931
|
+
* End as a delta from its own Start.
|
|
1932
|
+
*/
|
|
1933
|
+
export type RangeDelta = readonly [start: bigint, end?: bigint];
|
|
1934
|
+
/**
|
|
1935
|
+
* A Range Filter that cannot be honoured. A peer that sends one is answered with
|
|
1936
|
+
* REQUEST_ERROR INVALID_FILTER rather than a closed session: the request is
|
|
1937
|
+
* well-formed, it just asks for something that cannot be applied.
|
|
1938
|
+
*/
|
|
1939
|
+
export declare class InvalidFilterError extends MOQtailError {
|
|
1940
|
+
readonly context: string;
|
|
1941
|
+
readonly details: string;
|
|
1942
|
+
constructor(context: string, details: string);
|
|
1943
|
+
}
|
|
1944
|
+
/**
|
|
1945
|
+
* Delta-encodes ascending `ranges`. Only the last may be open-ended.
|
|
1946
|
+
* @throws :{@link InvalidFilterError} When the ranges do not ascend.
|
|
1947
|
+
*/
|
|
1948
|
+
export declare function encodeRanges(ranges: readonly Range[]): RangeDelta[];
|
|
1949
|
+
/**
|
|
1950
|
+
* One Range Filter parameter. Unlike other parameters it may repeat in a message,
|
|
1951
|
+
* once per SetID (and Property Type).
|
|
1952
|
+
*
|
|
1953
|
+
* Without a `setId` it is the zero-length form, which in REQUEST_UPDATE removes the
|
|
1954
|
+
* filters of its kind.
|
|
1955
|
+
*
|
|
1956
|
+
* The Ranges are held as the wire's deltas and only added back by {@link
|
|
1957
|
+
* RangeFilter.ranges}: a sum past 2^64-1 is answered with a REQUEST_ERROR for the
|
|
1958
|
+
* request that carried it, which a parser that rejected it could not do.
|
|
1959
|
+
*/
|
|
1960
|
+
export declare class RangeFilter implements Parameter {
|
|
1961
|
+
readonly kind: RangeFilterKind;
|
|
1962
|
+
readonly setId?: number | undefined;
|
|
1963
|
+
readonly propertyType?: bigint | undefined;
|
|
1964
|
+
readonly deltas: readonly RangeDelta[];
|
|
1965
|
+
/**
|
|
1966
|
+
* @throws :{@link ProtocolViolationError} When the Property Type's presence does not
|
|
1967
|
+
* match the kind, or a removal carries anything but its kind.
|
|
1968
|
+
*/
|
|
1969
|
+
constructor(kind: RangeFilterKind, setId?: number | undefined, propertyType?: bigint | undefined, deltas?: readonly RangeDelta[]);
|
|
1970
|
+
/** The zero-length form, which removes the filters of its kind. */
|
|
1971
|
+
get isRemoval(): boolean;
|
|
1972
|
+
/** How many Ranges the filter holds, which is what a peer's range limit counts. */
|
|
1973
|
+
get rangeCount(): number;
|
|
1974
|
+
/**
|
|
1975
|
+
* The Ranges with their deltas added back.
|
|
1976
|
+
* @throws :{@link InvalidFilterError} When a bound exceeds 2^64-1.
|
|
1977
|
+
*/
|
|
1978
|
+
ranges(): Range[];
|
|
1979
|
+
/**
|
|
1980
|
+
* The Ranges, once everything a filter of this kind has to satisfy holds.
|
|
1981
|
+
* @throws :{@link InvalidFilterError} For an odd Property Type, a priority above
|
|
1982
|
+
* 255, or a bound past 2^64-1.
|
|
1983
|
+
*/
|
|
1984
|
+
validate(): Range[];
|
|
1985
|
+
/** The SetID, Property Type if any, and the Ranges, without the Type or Length. */
|
|
1986
|
+
serializeValue(): Uint8Array;
|
|
1987
|
+
toKeyValuePair(): KeyValuePair;
|
|
1988
|
+
/**
|
|
1989
|
+
* Decodes a Range Filter value. The Value ends with the last Range, so a Start
|
|
1990
|
+
* with nothing after it is an open-ended last Range.
|
|
1991
|
+
*/
|
|
1992
|
+
static fromKeyValuePair(pair: KeyValuePair): RangeFilter | undefined;
|
|
1993
|
+
}
|
|
1994
|
+
export type MessageParameter = ObjectDeliveryTimeout | SubgroupDeliveryTimeout | RendezvousTimeout | FillTimeout | AuthorizationToken | Expires | LargestObject | Forward | SubscriberPriority | GroupOrderParam | LocationFilter | NewGroupRequest | SwitchFrom | FillParameters | RangeFilter | IncludeProperties | SwitchingSetAssignment;
|
|
1995
|
+
export declare namespace MessageParameter {
|
|
1996
|
+
/**
|
|
1997
|
+
* Parses a single KeyValuePair into a MessageParameter.
|
|
1998
|
+
* Returns undefined for unrecognized parameter types (be forgiving).
|
|
1999
|
+
* Still throws ProtocolViolationError for known types with invalid values.
|
|
2000
|
+
*/
|
|
2001
|
+
function fromKeyValuePair(pair: KeyValuePair): MessageParameter | undefined;
|
|
2002
|
+
function toKeyValuePair(param: MessageParameter): KeyValuePair;
|
|
2003
|
+
function isObjectDeliveryTimeout(param: MessageParameter): param is ObjectDeliveryTimeout;
|
|
2004
|
+
function isSubgroupDeliveryTimeout(param: MessageParameter): param is SubgroupDeliveryTimeout;
|
|
2005
|
+
function isRendezvousTimeout(param: MessageParameter): param is RendezvousTimeout;
|
|
2006
|
+
function isFillTimeout(param: MessageParameter): param is FillTimeout;
|
|
2007
|
+
function isAuthorizationToken(param: MessageParameter): param is AuthorizationToken;
|
|
2008
|
+
function isExpires(param: MessageParameter): param is Expires;
|
|
2009
|
+
function isLargestObject(param: MessageParameter): param is LargestObject;
|
|
2010
|
+
function isForward(param: MessageParameter): param is Forward;
|
|
2011
|
+
function isSubscriberPriority(param: MessageParameter): param is SubscriberPriority;
|
|
2012
|
+
function isGroupOrderParam(param: MessageParameter): param is GroupOrderParam;
|
|
2013
|
+
function isSwitchingSetAssignment(param: MessageParameter): param is SwitchingSetAssignment;
|
|
2014
|
+
/** The negotiated Group Order, or {@link (GroupOrder:enum).Original} when unparameterized. */
|
|
2015
|
+
function groupOrderOf(params: readonly MessageParameter[]): GroupOrder;
|
|
2016
|
+
function isLocationFilter(param: MessageParameter): param is LocationFilter;
|
|
2017
|
+
function isNewGroupRequest(param: MessageParameter): param is NewGroupRequest;
|
|
2018
|
+
function isSwitchFrom(param: MessageParameter): param is SwitchFrom;
|
|
2019
|
+
function isFillParameters(param: MessageParameter): param is FillParameters;
|
|
2020
|
+
function isRangeFilter(param: MessageParameter): param is RangeFilter;
|
|
2021
|
+
/**
|
|
2022
|
+
* Whether `params` carry a Range Filter, either directly or inside FILL_PARAMETERS,
|
|
2023
|
+
* removals included. An endpoint that allows no filter ranges rejects any of them.
|
|
2024
|
+
*/
|
|
2025
|
+
function carriesRangeFilter(params: readonly MessageParameter[]): boolean;
|
|
2026
|
+
function isIncludeProperties(param: MessageParameter): param is IncludeProperties;
|
|
2027
|
+
/**
|
|
2028
|
+
* The parameters a PUBLISH answering a SUBSCRIBE_TRACKS states: the request's
|
|
2029
|
+
* settings that a PUBLISH can carry (FORWARD, GROUP_ORDER, LOCATION_FILTER), which
|
|
2030
|
+
* are the new subscription's initial settings. AUTHORIZATION_TOKEN is never copied.
|
|
2031
|
+
* The Range Filters, FILL_PARAMETERS and INCLUDE_PROPERTIES cannot go in a PUBLISH;
|
|
2032
|
+
* they are the publisher's to apply.
|
|
2033
|
+
*/
|
|
2034
|
+
function publishParametersFor(subscribeTracks: readonly MessageParameter[]): MessageParameter[];
|
|
2035
|
+
/**
|
|
2036
|
+
* Whether a request's response should carry Track Properties: false only when it
|
|
2037
|
+
* has INCLUDE_PROPERTIES set to 0.
|
|
2038
|
+
*/
|
|
2039
|
+
function includesProperties(params: readonly MessageParameter[]): boolean;
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Builder for constructing a list of MessageParameters.
|
|
2043
|
+
* Mirrors the SetupOptions builder pattern.
|
|
2044
|
+
*/
|
|
2045
|
+
export declare class MessageParameters {
|
|
2046
|
+
private params;
|
|
2047
|
+
add(param: MessageParameter): this;
|
|
2048
|
+
addObjectDeliveryTimeout(timeout: bigint | number): this;
|
|
2049
|
+
addSubgroupDeliveryTimeout(timeout: bigint | number): this;
|
|
2050
|
+
addRendezvousTimeout(timeout: bigint | number): this;
|
|
2051
|
+
addFillTimeout(timeout: bigint | number): this;
|
|
2052
|
+
addAuthorizationToken(token: AuthorizationToken): this;
|
|
2053
|
+
addExpires(expires: bigint | number): this;
|
|
2054
|
+
addForward(forward: boolean): this;
|
|
2055
|
+
addIncludeProperties(include: boolean): this;
|
|
2056
|
+
addSubscriberPriority(priority: number): this;
|
|
2057
|
+
addGroupOrder(order: GroupOrderParam['order']): this;
|
|
2058
|
+
addLocationFilter(filter: LocationFilter): this;
|
|
2059
|
+
addNewGroupRequest(group: bigint | number): this;
|
|
2060
|
+
addSwitchFrom(requestId: bigint | number, mode: SwitchMode, publishDone: boolean): this;
|
|
2061
|
+
addFillParameters(parameters: MessageParameter[]): this;
|
|
2062
|
+
addRangeFilter(filter: RangeFilter): this;
|
|
2063
|
+
build(): MessageParameter[];
|
|
2064
|
+
/**
|
|
2065
|
+
* Parses an array of KeyValuePairs into a list of MessageParameters.
|
|
2066
|
+
* Unrecognized parameter types are silently skipped.
|
|
2067
|
+
* Known parameter types with invalid values still throw ProtocolViolationError.
|
|
2068
|
+
*/
|
|
2069
|
+
static fromKeyValuePairs(pairs: KeyValuePair[]): MessageParameter[];
|
|
2070
|
+
}
|
|
2071
|
+
/**
|
|
2072
|
+
* Serializes a list of message-parameter KVPs, delta-encoding the Types.
|
|
2073
|
+
* Mirrors {@link serializeKvpList} but honours per-parameter value encodings.
|
|
2074
|
+
*/
|
|
2075
|
+
export declare function serializeMessageParameterKvps(items: KeyValuePair[]): FrozenByteBuffer;
|
|
2076
|
+
/**
|
|
2077
|
+
* Reads exactly `count` delta-encoded message-parameter KVPs.
|
|
2078
|
+
* Mirrors {@link deserializeKvpList} but honours per-parameter value encodings.
|
|
2079
|
+
*/
|
|
2080
|
+
export declare function deserializeMessageParameterKvps(buf: BaseByteBuffer, count: number | bigint): KeyValuePair[];
|
|
2081
|
+
/**
|
|
2082
|
+
* Applies a set of parameter updates to an existing parameter list.
|
|
2083
|
+
*
|
|
2084
|
+
* A Type the update leaves out keeps its value. A Type it carries is replaced
|
|
2085
|
+
* outright, every instance of it: a Range Filter can repeat, and an update that
|
|
2086
|
+
* names a filter kind states the whole of that kind, so one left over from before
|
|
2087
|
+
* would quietly widen or narrow what the subscriber asked for. A zero-length Range
|
|
2088
|
+
* Filter replaces its kind with nothing.
|
|
2089
|
+
*/
|
|
2090
|
+
export declare function applyMessageParameterUpdate(current: MessageParameter[], updates: MessageParameter[]): void;
|
|
2091
|
+
/**
|
|
2092
|
+
* Represents a protocol PublishNamespace message, used to announce a track and its parameters.
|
|
2093
|
+
*
|
|
2094
|
+
* @public
|
|
2095
|
+
*/
|
|
2096
|
+
export declare class PublishNamespace {
|
|
2097
|
+
readonly requestId: bigint;
|
|
2098
|
+
readonly trackNamespace: Tuple;
|
|
2099
|
+
readonly parameters: MessageParameter[];
|
|
2100
|
+
/**
|
|
2101
|
+
* @public
|
|
2102
|
+
* Constructs a PublishNamespace message.
|
|
2103
|
+
*
|
|
2104
|
+
* @param requestId - The request ID for this publish namespace message.
|
|
2105
|
+
* @param trackNamespace - The track namespace as a Tuple.
|
|
2106
|
+
* @param parameters - The list of strongly-typed message parameters for the track.
|
|
2107
|
+
*/
|
|
2108
|
+
constructor(requestId: bigint, trackNamespace: Tuple, parameters: MessageParameter[]);
|
|
2109
|
+
/**
|
|
2110
|
+
* @public
|
|
2111
|
+
* Gets the message type for this PublishNamespace message.
|
|
2112
|
+
*
|
|
2113
|
+
* @returns The ControlMessageType.PublishNamespace value.
|
|
2114
|
+
*/
|
|
2115
|
+
getType(): ControlMessageType;
|
|
2116
|
+
/**
|
|
2117
|
+
* @public
|
|
2118
|
+
* Serializes the PublishNamespace message into a {@link FrozenByteBuffer}.
|
|
2119
|
+
*
|
|
2120
|
+
* @returns The serialized buffer.
|
|
2121
|
+
* @throws :{@link LengthExceedsMaxError} If the payload exceeds 65535 bytes.
|
|
2122
|
+
*/
|
|
2123
|
+
serialize(): FrozenByteBuffer;
|
|
2124
|
+
/**
|
|
2125
|
+
* @public
|
|
2126
|
+
* Parses a PublishNamespace message from the given buffer.
|
|
2127
|
+
*
|
|
2128
|
+
* @param buf - The buffer to parse from.
|
|
2129
|
+
* @returns The parsed PublishNamespace message.
|
|
2130
|
+
* @throws :{@link NotEnoughBytesError} If the buffer does not contain enough bytes.
|
|
2131
|
+
*/
|
|
2132
|
+
static parsePayload(buf: BaseByteBuffer): PublishNamespace;
|
|
2133
|
+
}
|
|
2134
|
+
/**
|
|
2135
|
+
* @public
|
|
2136
|
+
* Represents a NAMESPACE message sent on a SUBSCRIBE_NAMESPACE bi-stream.
|
|
2137
|
+
* Carries the namespace suffix (fields after the subscriber's prefix).
|
|
2138
|
+
*/
|
|
2139
|
+
export declare class Namespace {
|
|
2140
|
+
readonly trackNamespaceSuffix: Tuple;
|
|
2141
|
+
constructor(trackNamespaceSuffix: Tuple);
|
|
2142
|
+
getType(): ControlMessageType;
|
|
2143
|
+
serialize(): FrozenByteBuffer;
|
|
2144
|
+
static parsePayload(buf: BaseByteBuffer): Namespace;
|
|
2145
|
+
}
|
|
2146
|
+
/**
|
|
2147
|
+
* @public
|
|
2148
|
+
* Represents a NAMESPACE_DONE message sent on a SUBSCRIBE_NAMESPACE bi-stream.
|
|
2149
|
+
* Signals that a previously announced namespace suffix is no longer available.
|
|
2150
|
+
*/
|
|
2151
|
+
export declare class NamespaceDone {
|
|
2152
|
+
readonly trackNamespaceSuffix: Tuple;
|
|
2153
|
+
constructor(trackNamespaceSuffix: Tuple);
|
|
2154
|
+
getType(): ControlMessageType;
|
|
2155
|
+
serialize(): FrozenByteBuffer;
|
|
2156
|
+
static parsePayload(buf: BaseByteBuffer): NamespaceDone;
|
|
2157
|
+
}
|
|
2158
|
+
/**
|
|
2159
|
+
* The first message each endpoint sends on its control stream.
|
|
2160
|
+
*
|
|
2161
|
+
* Both peers send the same message; there are no separate client and server forms and
|
|
2162
|
+
* no version fields, since version negotiation happens over ALPN.
|
|
2163
|
+
*
|
|
2164
|
+
* Some options are client-only (see {@link SetupOptionType}); whether a peer is
|
|
2165
|
+
* allowed to send a given option depends on which side it is and on the transport,
|
|
2166
|
+
* neither of which is knowable here, so that rule is enforced by the caller rather than
|
|
2167
|
+
* by this class.
|
|
2168
|
+
*/
|
|
2169
|
+
export declare class Setup {
|
|
2170
|
+
readonly setupOptions: KeyValuePair[];
|
|
2171
|
+
constructor(setupOptions: KeyValuePair[]);
|
|
2172
|
+
getType(): ControlMessageType;
|
|
2173
|
+
serialize(): FrozenByteBuffer;
|
|
2174
|
+
static parsePayload(buf: BaseByteBuffer): Setup;
|
|
2175
|
+
}
|
|
2176
|
+
export declare class Fetch {
|
|
2177
|
+
readonly requestId: bigint;
|
|
2178
|
+
readonly fullTrackName: FullTrackName;
|
|
2179
|
+
readonly parameters: MessageParameter[];
|
|
2180
|
+
constructor(requestId: bigint, fullTrackName: FullTrackName, parameters: MessageParameter[]);
|
|
2181
|
+
/**
|
|
2182
|
+
* The requested range. A FETCH without a LOCATION_FILTER parameter asks for the
|
|
2183
|
+
* whole track up to the Largest Object, the same as a {@link (LocationFilterType:enum).None} filter.
|
|
2184
|
+
*/
|
|
2185
|
+
get locationFilter(): LocationFilter;
|
|
2186
|
+
getType(): ControlMessageType;
|
|
2187
|
+
serialize(): FrozenByteBuffer;
|
|
2188
|
+
static parsePayload(buf: BaseByteBuffer): Fetch;
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
* Copyright 2025 The MOQtail Authors
|
|
2192
|
+
*
|
|
2193
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2194
|
+
* you may not use this file except in compliance with the License.
|
|
2195
|
+
* You may obtain a copy of the License at
|
|
2196
|
+
*
|
|
2197
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2198
|
+
*
|
|
2199
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2200
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2201
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2202
|
+
* See the License for the specific language governing permissions and
|
|
2203
|
+
* limitations under the License.
|
|
2204
|
+
*/
|
|
2205
|
+
export declare enum LOCPropertyId {
|
|
2206
|
+
Timescale = 8,
|
|
2207
|
+
VideoFrameMarking = 9,
|
|
2208
|
+
AudioLevel = 12,
|
|
2209
|
+
VideoConfig = 13,
|
|
2210
|
+
AudioConfig = 15,
|
|
2211
|
+
Timestamp = 16
|
|
2212
|
+
}
|
|
2213
|
+
export declare enum TrackPropertyType {
|
|
2214
|
+
ObjectDeliveryTimeout = 2,
|
|
2215
|
+
MaxCacheDuration = 4,
|
|
2216
|
+
SubgroupDeliveryTimeout = 6,
|
|
2217
|
+
ImmutableProperties = 11,
|
|
2218
|
+
DefaultPublisherPriority = 14,
|
|
2219
|
+
DefaultPublisherGroupOrder = 34,
|
|
2220
|
+
DynamicGroups = 48,
|
|
2221
|
+
PriorGroupIdGap = 60,
|
|
2222
|
+
PriorObjectIdGap = 62
|
|
2223
|
+
}
|
|
2224
|
+
export declare function locPropertyIdFromNumber(value: number): LOCPropertyId;
|
|
2225
|
+
/**
|
|
2226
|
+
* @public
|
|
2227
|
+
* A registration-policy range in the Property Type space. `to` is absent for the
|
|
2228
|
+
* open-ended top range.
|
|
2229
|
+
*/
|
|
2230
|
+
export interface PropertyRange {
|
|
2231
|
+
readonly from: bigint;
|
|
2232
|
+
readonly to?: bigint;
|
|
2233
|
+
}
|
|
2234
|
+
/**
|
|
2235
|
+
* @public
|
|
2236
|
+
* Registration-policy ranges for the Property Type space.
|
|
2237
|
+
*
|
|
2238
|
+
*/
|
|
2239
|
+
export declare const PropertyRanges: {
|
|
2240
|
+
/** Standards Action or IESG Approval (1-byte encoding). */
|
|
2241
|
+
readonly StandardsAction: {
|
|
2242
|
+
readonly from: 0n;
|
|
2243
|
+
readonly to: 119n;
|
|
2244
|
+
};
|
|
2245
|
+
/** Application-specific use, no registration permitted (1-byte encoding). */
|
|
2246
|
+
readonly AppSpecific1Byte: {
|
|
2247
|
+
readonly from: 120n;
|
|
2248
|
+
readonly to: 127n;
|
|
2249
|
+
};
|
|
2250
|
+
/** Specification Required (2-byte encoding). */
|
|
2251
|
+
readonly SpecRequired: {
|
|
2252
|
+
readonly from: 128n;
|
|
2253
|
+
readonly to: 14335n;
|
|
2254
|
+
};
|
|
2255
|
+
/** Application-specific use, no registration permitted (2-byte encoding). */
|
|
2256
|
+
readonly AppSpecific2Byte: {
|
|
2257
|
+
readonly from: 14336n;
|
|
2258
|
+
readonly to: 16383n;
|
|
2259
|
+
};
|
|
2260
|
+
/** Mandatory Track Properties; Track scope only. */
|
|
2261
|
+
readonly MandatoryTrack: {
|
|
2262
|
+
readonly from: 16384n;
|
|
2263
|
+
readonly to: 32767n;
|
|
2264
|
+
};
|
|
2265
|
+
/** First Come First Served begins here (open-ended). */
|
|
2266
|
+
readonly Fcfs: {
|
|
2267
|
+
readonly from: 32768n;
|
|
2268
|
+
};
|
|
2269
|
+
};
|
|
2270
|
+
/**
|
|
2271
|
+
* @public
|
|
2272
|
+
* True if a Property Type is reserved for application-specific use (either encoding-width
|
|
2273
|
+
* range), for which no IANA registration is permitted.
|
|
2274
|
+
*/
|
|
2275
|
+
export declare function isApplicationSpecificProperty(typeValue: bigint | number): boolean;
|
|
2276
|
+
/** A timeout of 0 means no timeout is set (§8), on this side as on the parameter side. */
|
|
2277
|
+
export declare class ObjectDeliveryTimeoutProperty {
|
|
2278
|
+
readonly timeoutMs: bigint;
|
|
2279
|
+
static readonly TYPE = TrackPropertyType.ObjectDeliveryTimeout;
|
|
2280
|
+
constructor(timeoutMs: bigint);
|
|
2281
|
+
toKeyValuePair(): KeyValuePair;
|
|
2282
|
+
static fromKeyValuePair(pair: KeyValuePair): ObjectDeliveryTimeoutProperty | undefined;
|
|
2283
|
+
}
|
|
2284
|
+
export declare class SubgroupDeliveryTimeoutProperty {
|
|
2285
|
+
readonly timeoutMs: bigint;
|
|
2286
|
+
static readonly TYPE = TrackPropertyType.SubgroupDeliveryTimeout;
|
|
2287
|
+
constructor(timeoutMs: bigint);
|
|
2288
|
+
toKeyValuePair(): KeyValuePair;
|
|
2289
|
+
static fromKeyValuePair(pair: KeyValuePair): SubgroupDeliveryTimeoutProperty | undefined;
|
|
2290
|
+
}
|
|
2291
|
+
export declare class MaxCacheDurationProperty {
|
|
2292
|
+
readonly durationMs: bigint;
|
|
2293
|
+
static readonly TYPE = TrackPropertyType.MaxCacheDuration;
|
|
2294
|
+
constructor(durationMs: bigint);
|
|
2295
|
+
toKeyValuePair(): KeyValuePair;
|
|
2296
|
+
static fromKeyValuePair(pair: KeyValuePair): MaxCacheDurationProperty | undefined;
|
|
2297
|
+
}
|
|
2298
|
+
export declare class ImmutablePropertiesTrackProperty {
|
|
2299
|
+
readonly properties: KeyValuePair[];
|
|
2300
|
+
static readonly TYPE = TrackPropertyType.ImmutableProperties;
|
|
2301
|
+
constructor(properties: KeyValuePair[]);
|
|
2302
|
+
toKeyValuePair(): KeyValuePair;
|
|
2303
|
+
static fromKeyValuePair(pair: KeyValuePair): ImmutablePropertiesTrackProperty | undefined;
|
|
2304
|
+
}
|
|
2305
|
+
export declare class DefaultPublisherPriorityProperty {
|
|
2306
|
+
readonly priority: number;
|
|
2307
|
+
static readonly TYPE = TrackPropertyType.DefaultPublisherPriority;
|
|
2308
|
+
constructor(priority: number);
|
|
2309
|
+
toKeyValuePair(): KeyValuePair;
|
|
2310
|
+
static fromKeyValuePair(pair: KeyValuePair): DefaultPublisherPriorityProperty | undefined;
|
|
2311
|
+
}
|
|
2312
|
+
export declare class DefaultPublisherGroupOrderProperty {
|
|
2313
|
+
readonly order: GroupOrder;
|
|
2314
|
+
static readonly TYPE = TrackPropertyType.DefaultPublisherGroupOrder;
|
|
2315
|
+
constructor(order: GroupOrder);
|
|
2316
|
+
toKeyValuePair(): KeyValuePair;
|
|
2317
|
+
static fromKeyValuePair(pair: KeyValuePair): DefaultPublisherGroupOrderProperty | undefined;
|
|
2318
|
+
}
|
|
2319
|
+
export declare class DynamicGroupsProperty {
|
|
2320
|
+
readonly enabled: boolean;
|
|
2321
|
+
static readonly TYPE = TrackPropertyType.DynamicGroups;
|
|
2322
|
+
constructor(enabled: boolean);
|
|
2323
|
+
toKeyValuePair(): KeyValuePair;
|
|
2324
|
+
static fromKeyValuePair(pair: KeyValuePair): DynamicGroupsProperty | undefined;
|
|
2325
|
+
}
|
|
2326
|
+
export declare class UnknownTrackProperty {
|
|
2327
|
+
readonly kvp: KeyValuePair;
|
|
2328
|
+
constructor(kvp: KeyValuePair);
|
|
2329
|
+
toKeyValuePair(): KeyValuePair;
|
|
2330
|
+
}
|
|
2331
|
+
export type TrackProperty = ObjectDeliveryTimeoutProperty | SubgroupDeliveryTimeoutProperty | MaxCacheDurationProperty | ImmutablePropertiesTrackProperty | DefaultPublisherPriorityProperty | DefaultPublisherGroupOrderProperty | DynamicGroupsProperty | UnknownTrackProperty;
|
|
2332
|
+
export declare namespace TrackProperty {
|
|
2333
|
+
function fromKeyValuePair(pair: KeyValuePair): TrackProperty;
|
|
2334
|
+
function toKeyValuePair(ext: TrackProperty): KeyValuePair;
|
|
2335
|
+
function deserializeAll(buf: BaseByteBuffer): TrackProperty[];
|
|
2336
|
+
function serializeInto(exts: TrackProperty[], payload: ByteBuffer): void;
|
|
2337
|
+
function isObjectDeliveryTimeout(ext: TrackProperty): ext is ObjectDeliveryTimeoutProperty;
|
|
2338
|
+
function isSubgroupDeliveryTimeout(ext: TrackProperty): ext is SubgroupDeliveryTimeoutProperty;
|
|
2339
|
+
function isMaxCacheDuration(ext: TrackProperty): ext is MaxCacheDurationProperty;
|
|
2340
|
+
function isImmutableProperties(ext: TrackProperty): ext is ImmutablePropertiesTrackProperty;
|
|
2341
|
+
function isDefaultPublisherPriority(ext: TrackProperty): ext is DefaultPublisherPriorityProperty;
|
|
2342
|
+
function isDefaultPublisherGroupOrder(ext: TrackProperty): ext is DefaultPublisherGroupOrderProperty;
|
|
2343
|
+
function isDynamicGroups(ext: TrackProperty): ext is DynamicGroupsProperty;
|
|
2344
|
+
function isUnknown(ext: TrackProperty): ext is UnknownTrackProperty;
|
|
2345
|
+
}
|
|
2346
|
+
/**
|
|
2347
|
+
* FETCH_OK (0x18) keeps a body of its own rather than folding into REQUEST_OK, but like
|
|
2348
|
+
* every other response it carries no Request ID: the request stream it arrives on
|
|
2349
|
+
* identifies the request (§10.1).
|
|
2350
|
+
*/
|
|
2351
|
+
export declare class FetchOk {
|
|
2352
|
+
readonly endOfTrack: boolean;
|
|
2353
|
+
/** The last Location the response covers, inclusive. Object 2^64-1 is all of that group. */
|
|
2354
|
+
readonly endLocation: Location;
|
|
2355
|
+
readonly parameters: MessageParameter[];
|
|
2356
|
+
readonly trackProperties: TrackProperty[];
|
|
2357
|
+
constructor(endOfTrack: boolean,
|
|
2358
|
+
/** The last Location the response covers, inclusive. Object 2^64-1 is all of that group. */
|
|
2359
|
+
endLocation: Location, parameters: MessageParameter[], trackProperties?: TrackProperty[]);
|
|
2360
|
+
getType(): ControlMessageType;
|
|
2361
|
+
serialize(): FrozenByteBuffer;
|
|
2362
|
+
static parsePayload(buf: BaseByteBuffer): FetchOk;
|
|
2363
|
+
}
|
|
2364
|
+
/** §10.4: a longer New Session URI is a protocol violation. */
|
|
2365
|
+
export declare const MAX_NEW_SESSION_URI_LENGTH = 8192;
|
|
2366
|
+
/**
|
|
2367
|
+
* GOAWAY (0x10) winds down a session, or — on a request stream — migrates that one
|
|
2368
|
+
* request.
|
|
2369
|
+
*/
|
|
2370
|
+
export declare class GoAway {
|
|
2371
|
+
newSessionUri?: string | undefined;
|
|
2372
|
+
/**
|
|
2373
|
+
* Milliseconds the sender waits for graceful closure; 0 means no specific timeout.
|
|
2374
|
+
* On the control stream the sender closes the session with `GOAWAY_TIMEOUT` after it,
|
|
2375
|
+
* on a request stream it resets the stream with `GOING_AWAY`.
|
|
2376
|
+
*/
|
|
2377
|
+
readonly timeout: bigint;
|
|
2378
|
+
constructor(newSessionUri?: string, timeout?: bigint);
|
|
2379
|
+
getType(): ControlMessageType;
|
|
2380
|
+
serialize(): FrozenByteBuffer;
|
|
2381
|
+
static parsePayload(buf: BaseByteBuffer): GoAway;
|
|
2382
|
+
}
|
|
2383
|
+
export declare class Subscribe {
|
|
2384
|
+
requestId: bigint;
|
|
2385
|
+
fullTrackName: FullTrackName;
|
|
2386
|
+
parameters: MessageParameter[];
|
|
2387
|
+
constructor(requestId: bigint, fullTrackName: FullTrackName, parameters: MessageParameter[]);
|
|
2388
|
+
getType(): ControlMessageType;
|
|
2389
|
+
serialize(): FrozenByteBuffer;
|
|
2390
|
+
static parsePayload(buf: BaseByteBuffer): Subscribe;
|
|
2391
|
+
}
|
|
2392
|
+
export declare class PublishDone {
|
|
2393
|
+
readonly statusCode: PublishDoneStatusCode;
|
|
2394
|
+
readonly streamCount: bigint;
|
|
2395
|
+
readonly errorReason: ReasonPhrase;
|
|
2396
|
+
/**
|
|
2397
|
+
* The Stream Count a publisher sends when it cannot name the exact number of streams
|
|
2398
|
+
* it opened. Receivers fall back on a timeout to end the subscription.
|
|
2399
|
+
*/
|
|
2400
|
+
static readonly UNKNOWN_STREAM_COUNT: bigint;
|
|
2401
|
+
constructor(statusCode: PublishDoneStatusCode, streamCount: bigint, errorReason: ReasonPhrase);
|
|
2402
|
+
static new(statusCode: PublishDoneStatusCode, streamCount: bigint, errorReason: ReasonPhrase): PublishDone;
|
|
2403
|
+
getType(): ControlMessageType;
|
|
2404
|
+
serialize(): FrozenByteBuffer;
|
|
2405
|
+
static parsePayload(buf: BaseByteBuffer): PublishDone;
|
|
2406
|
+
}
|
|
2407
|
+
export declare class Publish {
|
|
2408
|
+
readonly requestId: bigint;
|
|
2409
|
+
readonly fullTrackName: FullTrackName;
|
|
2410
|
+
readonly trackAlias: bigint;
|
|
2411
|
+
readonly parameters: MessageParameter[];
|
|
2412
|
+
readonly trackProperties: TrackProperty[];
|
|
2413
|
+
constructor(requestId: bigint, fullTrackName: FullTrackName, trackAlias: bigint, parameters: MessageParameter[], trackProperties?: TrackProperty[]);
|
|
2414
|
+
getType(): ControlMessageType;
|
|
2415
|
+
serialize(): FrozenByteBuffer;
|
|
2416
|
+
static parsePayload(buf: BaseByteBuffer): Publish;
|
|
2417
|
+
}
|
|
2418
|
+
/**
|
|
2419
|
+
* SUBSCRIBE_OK (0x4) keeps a body of its own rather than folding into REQUEST_OK, but
|
|
2420
|
+
* like every other response it carries no Request ID: the request stream it arrives on
|
|
2421
|
+
* identifies the request (§10.1).
|
|
2422
|
+
*/
|
|
2423
|
+
export declare class SubscribeOk {
|
|
2424
|
+
trackAlias: bigint;
|
|
2425
|
+
parameters: MessageParameter[];
|
|
2426
|
+
trackProperties: TrackProperty[];
|
|
2427
|
+
private constructor();
|
|
2428
|
+
static create(trackAlias: bigint, parameters: MessageParameter[], trackProperties?: TrackProperty[]): SubscribeOk;
|
|
2429
|
+
getType(): ControlMessageType;
|
|
2430
|
+
serialize(): FrozenByteBuffer;
|
|
2431
|
+
static parsePayload(buf: BaseByteBuffer): SubscribeOk;
|
|
2432
|
+
}
|
|
2433
|
+
export declare class RequestUpdate {
|
|
2434
|
+
requestId: bigint;
|
|
2435
|
+
parameters: MessageParameter[];
|
|
2436
|
+
constructor(requestId: bigint, parameters: MessageParameter[]);
|
|
2437
|
+
getType(): ControlMessageType;
|
|
2438
|
+
serialize(): FrozenByteBuffer;
|
|
2439
|
+
static parsePayload(buf: BaseByteBuffer): RequestUpdate;
|
|
2440
|
+
equals(other: RequestUpdate): boolean;
|
|
2441
|
+
}
|
|
2442
|
+
export declare class TrackStatus {
|
|
2443
|
+
requestId: bigint;
|
|
2444
|
+
trackAlias: bigint;
|
|
2445
|
+
fullTrackName: FullTrackName;
|
|
2446
|
+
subscriberPriority: number;
|
|
2447
|
+
groupOrder: GroupOrder;
|
|
2448
|
+
forward: boolean;
|
|
2449
|
+
locationFilter: LocationFilter;
|
|
2450
|
+
subscribeParameters: MessageParameter[];
|
|
2451
|
+
constructor(requestId: bigint, trackAlias: bigint, fullTrackName: FullTrackName, subscriberPriority: number, groupOrder: GroupOrder, forward: boolean, locationFilter: LocationFilter, subscribeParameters: MessageParameter[]);
|
|
2452
|
+
getType(): ControlMessageType;
|
|
2453
|
+
serialize(): FrozenByteBuffer;
|
|
2454
|
+
static parsePayload(buf: BaseByteBuffer): TrackStatus;
|
|
2455
|
+
}
|
|
2456
|
+
export declare class SubscribeNamespace {
|
|
2457
|
+
readonly requestId: bigint;
|
|
2458
|
+
readonly trackNamespacePrefix: Tuple;
|
|
2459
|
+
readonly parameters: MessageParameter[];
|
|
2460
|
+
constructor(requestId: bigint, trackNamespacePrefix: Tuple, parameters: MessageParameter[]);
|
|
2461
|
+
getType(): ControlMessageType;
|
|
2462
|
+
serialize(): FrozenByteBuffer;
|
|
2463
|
+
static parsePayload(buf: BaseByteBuffer): SubscribeNamespace;
|
|
2464
|
+
}
|
|
2465
|
+
/**
|
|
2466
|
+
* SUBSCRIBE_TRACKS (0x51) asks for a PUBLISH for every track under a matching
|
|
2467
|
+
* namespace prefix, present and future (§10.19).
|
|
2468
|
+
*
|
|
2469
|
+
* Shares SUBSCRIBE_NAMESPACE's wire shape but has its own prefix-overlap space: the
|
|
2470
|
+
* two types may hold the same prefix, two of the same type may not.
|
|
2471
|
+
*/
|
|
2472
|
+
export declare class SubscribeTracks {
|
|
2473
|
+
readonly requestId: bigint;
|
|
2474
|
+
readonly trackNamespacePrefix: Tuple;
|
|
2475
|
+
readonly parameters: MessageParameter[];
|
|
2476
|
+
constructor(requestId: bigint, trackNamespacePrefix: Tuple, parameters: MessageParameter[]);
|
|
2477
|
+
getType(): ControlMessageType;
|
|
2478
|
+
serialize(): FrozenByteBuffer;
|
|
2479
|
+
static parsePayload(buf: BaseByteBuffer): SubscribeTracks;
|
|
2480
|
+
}
|
|
2481
|
+
/**
|
|
2482
|
+
* @public
|
|
2483
|
+
* REQUEST_OK (0x7) answers PUBLISH, REQUEST_UPDATE, TRACK_STATUS, SUBSCRIBE_NAMESPACE,
|
|
2484
|
+
* SUBSCRIBE_TRACKS and PUBLISH_NAMESPACE. There is one wire type; the per-request-type
|
|
2485
|
+
* names (PUBLISH_OK, TRACK_STATUS_OK, ...) are shorthands for logging, not distinct
|
|
2486
|
+
* messages. SUBSCRIBE_OK (0x4) and FETCH_OK (0x18) do keep bodies of their own.
|
|
2487
|
+
*
|
|
2488
|
+
* It carries no Request ID: the request stream it arrives on identifies the request.
|
|
2489
|
+
*/
|
|
2490
|
+
export declare class RequestOk {
|
|
2491
|
+
readonly parameters: MessageParameter[];
|
|
2492
|
+
/**
|
|
2493
|
+
* Track Properties, which the trailing bytes of the payload carry with no
|
|
2494
|
+
* count of their own. Populated only in TRACK_STATUS_OK; empty for every other request
|
|
2495
|
+
* type — see {@link RequestOk.validateTrackProperties}.
|
|
2496
|
+
*/
|
|
2497
|
+
readonly trackProperties: TrackProperty[];
|
|
2498
|
+
constructor(parameters?: MessageParameter[], trackProperties?: TrackProperty[]);
|
|
2499
|
+
getType(): ControlMessageType;
|
|
2500
|
+
/**
|
|
2501
|
+
* Track Properties may only be non-empty when this REQUEST_OK answers a TRACK_STATUS
|
|
2502
|
+
* request (§10.5). A receiver that sees them in any other REQUEST_OK — PUBLISH_OK,
|
|
2503
|
+
* REQUEST_UPDATE_OK, SUBSCRIBE_NAMESPACE_OK or PUBLISH_NAMESPACE_OK — MUST close the
|
|
2504
|
+
* session with a PROTOCOL_VIOLATION.
|
|
2505
|
+
*
|
|
2506
|
+
* @throws :{@link ProtocolViolationError} If Track Properties are present and this
|
|
2507
|
+
* REQUEST_OK does not answer a TRACK_STATUS.
|
|
2508
|
+
*/
|
|
2509
|
+
validateTrackProperties(answersTrackStatus: boolean): void;
|
|
2510
|
+
serialize(): FrozenByteBuffer;
|
|
2511
|
+
/**
|
|
2512
|
+
* Parses a REQUEST_OK body. `buf` must hold exactly the payload: whatever follows the
|
|
2513
|
+
* parameters is read as Track Properties, so trailing bytes from a longer buffer would
|
|
2514
|
+
* be parsed as properties.
|
|
2515
|
+
*/
|
|
2516
|
+
static parsePayload(buf: BaseByteBuffer): RequestOk;
|
|
2517
|
+
}
|
|
2518
|
+
/**
|
|
2519
|
+
* REQUEST_ERROR (0x5) refuses any request type. It carries no Request ID: the request
|
|
2520
|
+
* stream it arrives on identifies the request (§10.1).
|
|
2521
|
+
*/
|
|
2522
|
+
export declare class RequestError {
|
|
2523
|
+
readonly errorCode: RequestErrorCode;
|
|
2524
|
+
readonly retryInterval: bigint;
|
|
2525
|
+
readonly reasonPhrase: ReasonPhrase;
|
|
2526
|
+
/** Present exactly when {@link RequestError.errorCode} is `REDIRECT` (§10.6.2). */
|
|
2527
|
+
readonly redirect: Redirect | undefined;
|
|
2528
|
+
constructor(errorCode: RequestErrorCode, retryInterval: bigint, reasonPhrase: ReasonPhrase, redirect?: Redirect);
|
|
2529
|
+
/** A REQUEST_ERROR that redirects the request elsewhere (§10.6.1). */
|
|
2530
|
+
static redirect(retryInterval: bigint, reasonPhrase: ReasonPhrase, redirect: Redirect): RequestError;
|
|
2531
|
+
getType(): ControlMessageType;
|
|
2532
|
+
serialize(): FrozenByteBuffer;
|
|
2533
|
+
static parsePayload(buf: BaseByteBuffer): RequestError;
|
|
2534
|
+
}
|
|
2535
|
+
export type ControlMessage = Publish | PublishSkipped | PublishDone | PublishNamespace | Namespace | NamespaceDone | Setup | Fetch | FetchOk | GoAway | Subscribe | RequestError | SubscribeOk | RequestUpdate | TrackStatus | SubscribeNamespace | SubscribeTracks | RequestOk;
|
|
2536
|
+
export declare namespace ControlMessage {
|
|
2537
|
+
function deserialize(buf: FrozenByteBuffer): ControlMessage;
|
|
2538
|
+
function serialize(msg: ControlMessage): FrozenByteBuffer;
|
|
2539
|
+
}
|
|
2540
|
+
/**
|
|
2541
|
+
* Copyright 2025 The MOQtail Authors
|
|
2542
|
+
*
|
|
2543
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2544
|
+
* you may not use this file except in compliance with the License.
|
|
2545
|
+
* You may obtain a copy of the License at
|
|
2546
|
+
*
|
|
2547
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2548
|
+
*
|
|
2549
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2550
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2551
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2552
|
+
* See the License for the specific language governing permissions and
|
|
2553
|
+
* limitations under the License.
|
|
2554
|
+
*/
|
|
2555
|
+
export declare enum TerminationCode {
|
|
2556
|
+
NO_ERROR = 0,
|
|
2557
|
+
INTERNAL_ERROR = 1,
|
|
2558
|
+
UNAUTHORIZED = 2,
|
|
2559
|
+
PROTOCOL_VIOLATION = 3,
|
|
2560
|
+
INVALID_REQUEST_ID = 4,
|
|
2561
|
+
DUPLICATE_TRACK_ALIAS = 5,
|
|
2562
|
+
KEY_VALUE_FORMATTING_ERROR = 6,
|
|
2563
|
+
INVALID_PATH = 8,
|
|
2564
|
+
MALFORMED_PATH = 9,
|
|
2565
|
+
GOAWAY_TIMEOUT = 16,
|
|
2566
|
+
CONTROL_MESSAGE_TIMEOUT = 17,
|
|
2567
|
+
DATA_STREAM_TIMEOUT = 18,
|
|
2568
|
+
AUTH_TOKEN_CACHE_OVERFLOW = 19,
|
|
2569
|
+
DUPLICATE_AUTH_TOKEN_ALIAS = 20,
|
|
2570
|
+
MALFORMED_AUTH_TOKEN = 22,
|
|
2571
|
+
UNKNOWN_AUTH_TOKEN_ALIAS = 23,
|
|
2572
|
+
EXPIRED_AUTH_TOKEN = 24,
|
|
2573
|
+
INVALID_AUTHORITY = 25,
|
|
2574
|
+
MALFORMED_AUTHORITY = 26,
|
|
2575
|
+
TOO_MANY_REQUEST_UPDATES = 27
|
|
2576
|
+
}
|
|
2577
|
+
export declare namespace TerminationCode {
|
|
2578
|
+
/**
|
|
2579
|
+
* Tries to convert a number to a TerminationCode enum member.
|
|
2580
|
+
*
|
|
2581
|
+
* @param code - The numeric code to convert.
|
|
2582
|
+
* @returns The corresponding TerminationCode member, or throws InvalidTypeError if the code is not valid.
|
|
2583
|
+
*/
|
|
2584
|
+
function tryFrom(code: number): TerminationCode;
|
|
2585
|
+
}
|
|
2586
|
+
/**
|
|
2587
|
+
* Copyright 2026 The MOQtail Authors
|
|
2588
|
+
*
|
|
2589
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2590
|
+
* you may not use this file except in compliance with the License.
|
|
2591
|
+
* You may obtain a copy of the License at
|
|
2592
|
+
*
|
|
2593
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2594
|
+
*
|
|
2595
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2596
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2597
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2598
|
+
* See the License for the specific language governing permissions and
|
|
2599
|
+
* limitations under the License.
|
|
2600
|
+
*/
|
|
2601
|
+
/**
|
|
2602
|
+
* @public
|
|
2603
|
+
* Codes carried when resetting a request stream or sending STOP_SENDING on one.
|
|
2604
|
+
*
|
|
2605
|
+
* A separate registry from {@link (RequestErrorCode:enum)}, which disagrees with it on
|
|
2606
|
+
* the same names: `GOING_AWAY` is `0x4` here but `0x6` there.
|
|
2607
|
+
*/
|
|
2608
|
+
export declare enum StreamResetCode {
|
|
2609
|
+
InternalError = 0,
|
|
2610
|
+
Cancelled = 1,
|
|
2611
|
+
DeliveryTimeout = 2,
|
|
2612
|
+
SessionClosed = 3,
|
|
2613
|
+
GoingAway = 4,
|
|
2614
|
+
TooFarBehind = 5,
|
|
2615
|
+
UnknownObjectStatus = 6,
|
|
2616
|
+
ExpiredAuthToken = 7,
|
|
2617
|
+
ExcessiveLoad = 9,
|
|
2618
|
+
MalformedTrack = 18
|
|
2619
|
+
}
|
|
2620
|
+
export declare namespace StreamResetCode {
|
|
2621
|
+
/**
|
|
2622
|
+
* Converts a numeric application error code to a StreamResetCode. The code is a
|
|
2623
|
+
* `number` because that is what the transport reports it as
|
|
2624
|
+
* (`WebTransportError.streamErrorCode`, an `unsigned long`).
|
|
2625
|
+
*
|
|
2626
|
+
* @throws :{@link InvalidEnumValue} if the code is not a defined stream reset code.
|
|
2627
|
+
*/
|
|
2628
|
+
function tryFrom(code: number): StreamResetCode;
|
|
2629
|
+
}
|
|
2630
|
+
export declare class Timestamp {
|
|
2631
|
+
readonly timestamp: bigint;
|
|
2632
|
+
static readonly TYPE = LOCPropertyId.Timestamp;
|
|
2633
|
+
constructor(timestamp: bigint);
|
|
2634
|
+
toKeyValuePair(): KeyValuePair;
|
|
2635
|
+
static fromKeyValuePair(pair: KeyValuePair): Timestamp | undefined;
|
|
2636
|
+
}
|
|
2637
|
+
export declare class Timescale {
|
|
2638
|
+
readonly timescale: bigint;
|
|
2639
|
+
static readonly TYPE = LOCPropertyId.Timescale;
|
|
2640
|
+
constructor(timescale: bigint);
|
|
2641
|
+
toKeyValuePair(): KeyValuePair;
|
|
2642
|
+
static fromKeyValuePair(pair: KeyValuePair): Timescale | undefined;
|
|
2643
|
+
}
|
|
2644
|
+
export declare class VideoFrameMarking {
|
|
2645
|
+
readonly value: Uint8Array;
|
|
2646
|
+
static readonly TYPE = LOCPropertyId.VideoFrameMarking;
|
|
2647
|
+
/** The RFC 9626 frame-marking octets (1 to 4), without the length prefix. */
|
|
2648
|
+
constructor(value: Uint8Array);
|
|
2649
|
+
/** True if the frame decodes without temporally prior frames (the I bit). */
|
|
2650
|
+
get independent(): boolean;
|
|
2651
|
+
toKeyValuePair(): KeyValuePair;
|
|
2652
|
+
static fromKeyValuePair(pair: KeyValuePair): VideoFrameMarking | undefined;
|
|
2653
|
+
}
|
|
2654
|
+
export declare class AudioLevel {
|
|
2655
|
+
readonly audioLevel: bigint;
|
|
2656
|
+
static readonly TYPE = LOCPropertyId.AudioLevel;
|
|
2657
|
+
constructor(audioLevel: bigint);
|
|
2658
|
+
toKeyValuePair(): KeyValuePair;
|
|
2659
|
+
static fromKeyValuePair(pair: KeyValuePair): AudioLevel | undefined;
|
|
2660
|
+
}
|
|
2661
|
+
export declare class VideoConfig {
|
|
2662
|
+
readonly config: Uint8Array;
|
|
2663
|
+
static readonly TYPE = LOCPropertyId.VideoConfig;
|
|
2664
|
+
constructor(config: Uint8Array);
|
|
2665
|
+
toKeyValuePair(): KeyValuePair;
|
|
2666
|
+
static fromKeyValuePair(pair: KeyValuePair): VideoConfig | undefined;
|
|
2667
|
+
}
|
|
2668
|
+
export declare class AudioConfig {
|
|
2669
|
+
readonly config: Uint8Array;
|
|
2670
|
+
static readonly TYPE = LOCPropertyId.AudioConfig;
|
|
2671
|
+
constructor(config: Uint8Array);
|
|
2672
|
+
toKeyValuePair(): KeyValuePair;
|
|
2673
|
+
static fromKeyValuePair(pair: KeyValuePair): AudioConfig | undefined;
|
|
2674
|
+
}
|
|
2675
|
+
export type LOCProperty = Timestamp | Timescale | VideoFrameMarking | AudioLevel | VideoConfig | AudioConfig;
|
|
2676
|
+
export declare namespace LOCProperty {
|
|
2677
|
+
function fromKeyValuePair(pair: KeyValuePair): LOCProperty | undefined;
|
|
2678
|
+
function toKeyValuePair(header: LOCProperty): KeyValuePair;
|
|
2679
|
+
function isTimestamp(header: LOCProperty): header is Timestamp;
|
|
2680
|
+
function isTimescale(header: LOCProperty): header is Timescale;
|
|
2681
|
+
function isVideoFrameMarking(header: LOCProperty): header is VideoFrameMarking;
|
|
2682
|
+
function isAudioLevel(header: LOCProperty): header is AudioLevel;
|
|
2683
|
+
function isVideoConfig(header: LOCProperty): header is VideoConfig;
|
|
2684
|
+
function isAudioConfig(header: LOCProperty): header is AudioConfig;
|
|
2685
|
+
}
|
|
2686
|
+
export declare class LOCProperties {
|
|
2687
|
+
private kvps;
|
|
2688
|
+
addTimestamp(timestamp: bigint | number): this;
|
|
2689
|
+
addTimescale(timescale: bigint | number): this;
|
|
2690
|
+
/** Marks a whole, non-scalable frame (RFC 9626 short form): S and E set, I set on a keyframe. */
|
|
2691
|
+
addVideoFrameMarking(isKey: boolean): this;
|
|
2692
|
+
addAudioLevel(audioLevel: bigint | number): this;
|
|
2693
|
+
addVideoConfig(config: Uint8Array): this;
|
|
2694
|
+
addAudioConfig(config: Uint8Array): this;
|
|
2695
|
+
addRaw(pair: KeyValuePair): this;
|
|
2696
|
+
build(): KeyValuePair[];
|
|
2697
|
+
static fromKeyValuePairs(kvps: KeyValuePair[]): LOCProperty[];
|
|
2698
|
+
}
|
|
2699
|
+
export declare class ImmutablePropertiesObjectProperty {
|
|
2700
|
+
readonly properties: KeyValuePair[];
|
|
2701
|
+
static readonly TYPE = TrackPropertyType.ImmutableProperties;
|
|
2702
|
+
constructor(properties: KeyValuePair[]);
|
|
2703
|
+
toKeyValuePair(): KeyValuePair;
|
|
2704
|
+
static fromKeyValuePair(pair: KeyValuePair): ImmutablePropertiesObjectProperty | undefined;
|
|
2705
|
+
}
|
|
2706
|
+
export declare class PriorGroupIdGapProperty {
|
|
2707
|
+
readonly gap: bigint;
|
|
2708
|
+
static readonly TYPE = TrackPropertyType.PriorGroupIdGap;
|
|
2709
|
+
constructor(gap: bigint);
|
|
2710
|
+
toKeyValuePair(): KeyValuePair;
|
|
2711
|
+
static fromKeyValuePair(pair: KeyValuePair): PriorGroupIdGapProperty | undefined;
|
|
2712
|
+
}
|
|
2713
|
+
export declare class PriorObjectIdGapProperty {
|
|
2714
|
+
readonly gap: bigint;
|
|
2715
|
+
static readonly TYPE = TrackPropertyType.PriorObjectIdGap;
|
|
2716
|
+
constructor(gap: bigint);
|
|
2717
|
+
toKeyValuePair(): KeyValuePair;
|
|
2718
|
+
static fromKeyValuePair(pair: KeyValuePair): PriorObjectIdGapProperty | undefined;
|
|
2719
|
+
}
|
|
2720
|
+
export declare class UnknownObjectProperty {
|
|
2721
|
+
readonly kvp: KeyValuePair;
|
|
2722
|
+
constructor(kvp: KeyValuePair);
|
|
2723
|
+
toKeyValuePair(): KeyValuePair;
|
|
2724
|
+
}
|
|
2725
|
+
export type ObjectProperty = ImmutablePropertiesObjectProperty | PriorGroupIdGapProperty | PriorObjectIdGapProperty | UnknownObjectProperty;
|
|
2726
|
+
export declare namespace ObjectProperty {
|
|
2727
|
+
function fromKeyValuePair(pair: KeyValuePair): ObjectProperty;
|
|
2728
|
+
function toKeyValuePair(ext: ObjectProperty): KeyValuePair;
|
|
2729
|
+
function deserializeAll(buf: BaseByteBuffer): ObjectProperty[];
|
|
2730
|
+
function serializeInto(exts: ObjectProperty[], payload: ByteBuffer): void;
|
|
2731
|
+
function isImmutableProperties(ext: ObjectProperty): ext is ImmutablePropertiesObjectProperty;
|
|
2732
|
+
function isPriorGroupIdGap(ext: ObjectProperty): ext is PriorGroupIdGapProperty;
|
|
2733
|
+
function isPriorObjectIdGap(ext: ObjectProperty): ext is PriorObjectIdGapProperty;
|
|
2734
|
+
function isUnknown(ext: ObjectProperty): ext is UnknownObjectProperty;
|
|
2735
|
+
}
|
|
2736
|
+
/**
|
|
2737
|
+
* @public
|
|
2738
|
+
* A property class read by {@link findProperty}: its `TYPE` and `fromKeyValuePair`.
|
|
2739
|
+
* Every property class in the model already is one.
|
|
2740
|
+
*/
|
|
2741
|
+
export interface PropertyReader<T> {
|
|
2742
|
+
readonly TYPE: number | bigint;
|
|
2743
|
+
fromKeyValuePair(pair: KeyValuePair): T | undefined;
|
|
2744
|
+
}
|
|
2745
|
+
/**
|
|
2746
|
+
* @public
|
|
2747
|
+
* Finds the first property of `reader`'s type in a track or object property list and
|
|
2748
|
+
* returns it typed, or `undefined`. Unknown properties keep their raw key-value pair, so
|
|
2749
|
+
* a type the model doesn't know is still found.
|
|
2750
|
+
*
|
|
2751
|
+
* @example
|
|
2752
|
+
* ```ts
|
|
2753
|
+
* const timeout = findProperty(subscribeOk.trackProperties, ObjectDeliveryTimeoutProperty)
|
|
2754
|
+
* ```
|
|
2755
|
+
*/
|
|
2756
|
+
export declare function findProperty<T>(properties: readonly (KeyValuePair | {
|
|
2757
|
+
toKeyValuePair(): KeyValuePair;
|
|
2758
|
+
})[] | null | undefined, reader: PropertyReader<T>): T | undefined;
|
|
2759
|
+
export declare class Path implements Parameter {
|
|
2760
|
+
readonly moqtPath: string;
|
|
2761
|
+
static readonly TYPE = SetupOptionType.Path;
|
|
2762
|
+
constructor(moqtPath: string);
|
|
2763
|
+
toKeyValuePair(): KeyValuePair;
|
|
2764
|
+
static fromKeyValuePair(pair: KeyValuePair): Path | undefined;
|
|
2765
|
+
}
|
|
2766
|
+
export declare class MaxAuthTokenCacheSize implements Parameter {
|
|
2767
|
+
readonly maxSize: bigint;
|
|
2768
|
+
static readonly TYPE = SetupOptionType.MaxAuthTokenCacheSize;
|
|
2769
|
+
constructor(maxSize: bigint);
|
|
2770
|
+
toKeyValuePair(): KeyValuePair;
|
|
2771
|
+
static fromKeyValuePair(pair: KeyValuePair): MaxAuthTokenCacheSize | undefined;
|
|
2772
|
+
}
|
|
2773
|
+
/**
|
|
2774
|
+
* Raw-QUIC only: the authority component of the `moqt://` URI, carried in SETUP because
|
|
2775
|
+
* there is no HTTP CONNECT to carry it.
|
|
2776
|
+
*
|
|
2777
|
+
* Client-only; MUST NOT be sent by a server or over WebTransport. moqtail-ts always
|
|
2778
|
+
* connects over WebTransport, so its own handshake never sends this — see
|
|
2779
|
+
* `MOQtailClient.init`.
|
|
2780
|
+
*/
|
|
2781
|
+
export declare class Authority implements Parameter {
|
|
2782
|
+
readonly authority: string;
|
|
2783
|
+
static readonly TYPE = SetupOptionType.Authority;
|
|
2784
|
+
constructor(authority: string);
|
|
2785
|
+
toKeyValuePair(): KeyValuePair;
|
|
2786
|
+
static fromKeyValuePair(pair: KeyValuePair): Authority | undefined;
|
|
2787
|
+
}
|
|
2788
|
+
/**
|
|
2789
|
+
* Limits the total number of Ranges the peer may have across all Range filter parameters
|
|
2790
|
+
* of a single subscription or fetch. Zero, the default when absent, means the peer may
|
|
2791
|
+
* not send Range filters at all.
|
|
2792
|
+
*/
|
|
2793
|
+
export declare class MaxFilterRanges implements Parameter {
|
|
2794
|
+
readonly value: bigint;
|
|
2795
|
+
static readonly TYPE = SetupOptionType.MaxFilterRanges;
|
|
2796
|
+
constructor(value: bigint);
|
|
2797
|
+
toKeyValuePair(): KeyValuePair;
|
|
2798
|
+
static fromKeyValuePair(pair: KeyValuePair): MaxFilterRanges | undefined;
|
|
2799
|
+
}
|
|
2800
|
+
/**
|
|
2801
|
+
* Free-form implementation identification string, e.g. for logging and debugging.
|
|
2802
|
+
* Either peer may send it.
|
|
2803
|
+
*/
|
|
2804
|
+
export declare class MoqtImplementation implements Parameter {
|
|
2805
|
+
readonly info: string;
|
|
2806
|
+
static readonly TYPE = SetupOptionType.MoqtImplementation;
|
|
2807
|
+
constructor(info: string);
|
|
2808
|
+
toKeyValuePair(): KeyValuePair;
|
|
2809
|
+
static fromKeyValuePair(pair: KeyValuePair): MoqtImplementation | undefined;
|
|
2810
|
+
}
|
|
2811
|
+
/**
|
|
2812
|
+
* Maximum number of outstanding REQUEST_UPDATEs per request stream: an update counts
|
|
2813
|
+
* until its REQUEST_OK or REQUEST_ERROR arrives. Zero, the default when absent, means
|
|
2814
|
+
* no limit. Receiving one past the limit closes the session with TOO_MANY_REQUEST_UPDATES.
|
|
2815
|
+
*/
|
|
2816
|
+
export declare class MaxRequestUpdates implements Parameter {
|
|
2817
|
+
readonly value: bigint;
|
|
2818
|
+
static readonly TYPE = SetupOptionType.MaxRequestUpdates;
|
|
2819
|
+
constructor(value: bigint);
|
|
2820
|
+
toKeyValuePair(): KeyValuePair;
|
|
2821
|
+
static fromKeyValuePair(pair: KeyValuePair): MaxRequestUpdates | undefined;
|
|
2822
|
+
}
|
|
2823
|
+
/**
|
|
2824
|
+
* The sender-side track switching (SSTS) algorithms this endpoint supports.
|
|
2825
|
+
*
|
|
2826
|
+
* PROVISIONAL: sender-side track switching is not an adopted extension, so
|
|
2827
|
+
* this option has no codepoint in the registry the conformance fixture tracks
|
|
2828
|
+
* (`dev/conformance/draft22`) and is never asserted against it. An empty list
|
|
2829
|
+
* — or the absence of the option — prohibits the use of SSTS.
|
|
2830
|
+
*/
|
|
2831
|
+
export declare class SstsAlgorithms implements Parameter {
|
|
2832
|
+
readonly algorithms: bigint[];
|
|
2833
|
+
static readonly TYPE = SetupOptionType.SstsAlgorithms;
|
|
2834
|
+
constructor(algorithms: bigint[]);
|
|
2835
|
+
toKeyValuePair(): KeyValuePair;
|
|
2836
|
+
static fromKeyValuePair(pair: KeyValuePair): SstsAlgorithms | undefined;
|
|
2837
|
+
}
|
|
2838
|
+
export type SetupOption = Path | MaxAuthTokenCacheSize | AuthorizationToken | Authority | MaxFilterRanges | MoqtImplementation | MaxRequestUpdates | SstsAlgorithms;
|
|
2839
|
+
export declare namespace SetupOption {
|
|
2840
|
+
function fromKeyValuePair(pair: KeyValuePair): SetupOption | undefined;
|
|
2841
|
+
function toKeyValuePair(param: SetupOption): KeyValuePair;
|
|
2842
|
+
function isPath(param: SetupOption): param is Path;
|
|
2843
|
+
function isMaxAuthTokenCacheSize(param: SetupOption): param is MaxAuthTokenCacheSize;
|
|
2844
|
+
function isAuthorizationToken(param: SetupOption): param is AuthorizationToken;
|
|
2845
|
+
function isAuthority(param: SetupOption): param is Authority;
|
|
2846
|
+
function isMaxFilterRanges(param: SetupOption): param is MaxFilterRanges;
|
|
2847
|
+
function isMaxRequestUpdates(param: SetupOption): param is MaxRequestUpdates;
|
|
2848
|
+
function isMoqtImplementation(param: SetupOption): param is MoqtImplementation;
|
|
2849
|
+
function isSstsAlgorithms(param: SetupOption): param is SstsAlgorithms;
|
|
2850
|
+
}
|
|
2851
|
+
/** Throws if `params` carries AUTHORITY, which MUST NOT be sent over WebTransport. */
|
|
2852
|
+
export declare function assertNoAuthorityOverWebTransport(params: KeyValuePair[]): void;
|
|
2853
|
+
export declare class SetupOptions {
|
|
2854
|
+
private kvps;
|
|
2855
|
+
addMaxAuthTokenCacheSize(maxSize: bigint | number): this;
|
|
2856
|
+
addPath(moqtPath: string): this;
|
|
2857
|
+
addAuthorizationToken(auth: AuthorizationToken): this;
|
|
2858
|
+
addMaxFilterRanges(value: bigint | number): this;
|
|
2859
|
+
addMaxRequestUpdates(value: bigint | number): this;
|
|
2860
|
+
addMoqtImplementation(info: string): this;
|
|
2861
|
+
addSstsAlgorithms(algorithms: (bigint | number)[]): this;
|
|
2862
|
+
addRaw(pair: KeyValuePair): this;
|
|
2863
|
+
build(): KeyValuePair[];
|
|
2864
|
+
static fromKeyValuePairs(kvps: KeyValuePair[]): SetupOption[];
|
|
2865
|
+
}
|
|
2866
|
+
/**
|
|
2867
|
+
* The object filter a request's Range Filters add up to.
|
|
2868
|
+
*
|
|
2869
|
+
* Ranges within one filter are OR'd, filters sharing a SetID are AND'd, and the
|
|
2870
|
+
* SetIDs are OR'd with each other. No filter at all passes every Object.
|
|
2871
|
+
*/
|
|
2872
|
+
export declare class CombinedFilter {
|
|
2873
|
+
#private;
|
|
2874
|
+
/** How many Ranges the filters hold, which is what a range limit counts. */
|
|
2875
|
+
readonly rangeCount: number;
|
|
2876
|
+
/**
|
|
2877
|
+
* Builds the filter from every Range Filter in `params`; anything else, and a
|
|
2878
|
+
* zero-length removal, is ignored.
|
|
2879
|
+
*
|
|
2880
|
+
* @throws :{@link InvalidFilterError} For a filter that cannot be applied: one
|
|
2881
|
+
* that repeats a Type, SetID and Property Type already given, one with an odd
|
|
2882
|
+
* Property Type, a priority above 255 or a bound past 2^64-1, or a track filter,
|
|
2883
|
+
* which selects tracks rather than Objects.
|
|
2884
|
+
*/
|
|
2885
|
+
constructor(params: readonly MessageParameter[]);
|
|
2886
|
+
/** Whether the filter passes everything. */
|
|
2887
|
+
get isEmpty(): boolean;
|
|
2888
|
+
/**
|
|
2889
|
+
* Whether `obj` passes.
|
|
2890
|
+
*
|
|
2891
|
+
* @param subgroupId - The Subgroup ID `obj` travels in. It is passed in because an
|
|
2892
|
+
* Object whose Subgroup ID is its subgroup's first Object ID does not know it
|
|
2893
|
+
* itself. `null` — a datagram — has no subgroup, so no subgroup filter passes it.
|
|
2894
|
+
*/
|
|
2895
|
+
matches(obj: MoqtObject, subgroupId?: bigint | null): boolean;
|
|
2896
|
+
}
|