moqtail 0.8.0 → 0.9.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/dist/{client/index.cjs → client.cjs} +25 -14
- package/dist/{client/index.d.cts → client.d.cts} +8 -2
- package/dist/{client/index.d.ts → client.d.ts} +8 -2
- package/dist/{client/index.js → client.js} +25 -14
- package/dist/index.cjs +239 -316
- package/dist/index.d.cts +4 -5
- package/dist/index.d.ts +4 -5
- package/dist/index.js +239 -311
- package/dist/{model/index.cjs → model.cjs} +214 -0
- package/dist/{model/index.d.ts → model.d.cts} +53 -4
- package/dist/{model/index.d.cts → model.d.ts} +53 -4
- package/dist/{model/index.js → model.js} +214 -1
- package/dist/util.cjs +102 -0
- package/dist/util.d.cts +57 -0
- package/dist/util.d.ts +57 -0
- package/dist/util.js +99 -0
- package/dist/{version_parameter-BpmuiMQj.d.cts → version_parameter-DXBOBueW.d.cts} +986 -2
- package/dist/{version_parameter-f75NkWiO.d.ts → version_parameter-DXBOBueW.d.ts} +986 -2
- package/package.json +20 -23
- package/dist/byte_buffer-BM4uNj4n.d.cts +0 -987
- package/dist/byte_buffer-BM4uNj4n.d.ts +0 -987
- package/dist/util/index.cjs +0 -1804
- package/dist/util/index.d.cts +0 -164
- package/dist/util/index.d.ts +0 -164
- package/dist/util/index.js +0 -1795
|
@@ -1,4 +1,703 @@
|
|
|
1
|
-
|
|
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
|
+
/**
|
|
18
|
+
* @public
|
|
19
|
+
* Represents a key-value pair for MOQT protocol parameters.
|
|
20
|
+
*
|
|
21
|
+
* - If `typeValue` is **even**, the value is a varint (`bigint`).
|
|
22
|
+
* - If `typeValue` is **odd**, the value is a binary blob (`Uint8Array`) with a maximum length of 65535 bytes.
|
|
23
|
+
*
|
|
24
|
+
* Use {@link KeyValuePair.tryNewVarInt} for varint pairs and {@link KeyValuePair.tryNewBytes} for blob pairs.
|
|
25
|
+
*/
|
|
26
|
+
declare class KeyValuePair {
|
|
27
|
+
/**
|
|
28
|
+
* The key/type identifier for this pair.
|
|
29
|
+
* - Even: value is a varint.
|
|
30
|
+
* - Odd: value is a blob.
|
|
31
|
+
*/
|
|
32
|
+
readonly typeValue: bigint;
|
|
33
|
+
/**
|
|
34
|
+
* The value for this pair.
|
|
35
|
+
* - If `typeValue` is even: a varint (`bigint`).
|
|
36
|
+
* - If `typeValue` is odd: a binary blob (`Uint8Array`).
|
|
37
|
+
*/
|
|
38
|
+
readonly value: bigint | Uint8Array;
|
|
39
|
+
/**
|
|
40
|
+
* Constructs a new KeyValuePair.
|
|
41
|
+
* @param typeValue - The key/type identifier.
|
|
42
|
+
* @param value - The value (varint or blob).
|
|
43
|
+
* @internal Use static factory methods instead.
|
|
44
|
+
*/
|
|
45
|
+
private constructor();
|
|
46
|
+
/**
|
|
47
|
+
* Creates a new varint KeyValuePair.
|
|
48
|
+
* @param typeValue - Must be even.
|
|
49
|
+
* @param value - The varint value.
|
|
50
|
+
* @returns A KeyValuePair with varint value.
|
|
51
|
+
* @throws KeyValueFormattingError if typeValue is not even.
|
|
52
|
+
*/
|
|
53
|
+
static tryNewVarInt(typeValue: bigint | number, value: bigint | number): KeyValuePair;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new blob KeyValuePair.
|
|
56
|
+
* @param typeValue - Must be odd.
|
|
57
|
+
* @param value - The binary blob value.
|
|
58
|
+
* @returns A KeyValuePair with blob value.
|
|
59
|
+
* @throws KeyValueFormattingError if typeValue is not odd.
|
|
60
|
+
* @throws LengthExceedsMaxError if value length exceeds 65535 bytes.
|
|
61
|
+
*/
|
|
62
|
+
static tryNewBytes(typeValue: bigint | number, value: Uint8Array): KeyValuePair;
|
|
63
|
+
/**
|
|
64
|
+
* Serializes this key-value pair to a frozen byte buffer.
|
|
65
|
+
* @returns The serialized buffer.
|
|
66
|
+
*/
|
|
67
|
+
serialize(): FrozenByteBuffer;
|
|
68
|
+
/**
|
|
69
|
+
* Deserializes a KeyValuePair from a buffer.
|
|
70
|
+
* @param buf - The buffer to read from.
|
|
71
|
+
* @returns The deserialized KeyValuePair.
|
|
72
|
+
* @throws LengthExceedsMaxError if blob length exceeds 65535 bytes.
|
|
73
|
+
* @throws NotEnoughBytesError if buffer does not contain enough bytes.
|
|
74
|
+
*/
|
|
75
|
+
static deserialize(buf: BaseByteBuffer): KeyValuePair;
|
|
76
|
+
/**
|
|
77
|
+
* Checks if this pair is equal to another.
|
|
78
|
+
* @param other - The other KeyValuePair.
|
|
79
|
+
* @returns True if both type and value are equal.
|
|
80
|
+
*/
|
|
81
|
+
equals(other: KeyValuePair): boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Checks if the KeyValuePair is a varint pair (even typeValue).
|
|
85
|
+
* @param pair - The KeyValuePair to check.
|
|
86
|
+
* @returns True if value is a varint.
|
|
87
|
+
*/
|
|
88
|
+
declare function isVarInt(pair: KeyValuePair): pair is KeyValuePair & {
|
|
89
|
+
value: bigint;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Checks if the KeyValuePair is a blob pair (odd typeValue).
|
|
93
|
+
* @param pair - The KeyValuePair to check.
|
|
94
|
+
* @returns True if value is a Uint8Array.
|
|
95
|
+
*/
|
|
96
|
+
declare function isBytes(pair: KeyValuePair): pair is KeyValuePair & {
|
|
97
|
+
value: Uint8Array;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Copyright 2025 The MOQtail Authors
|
|
102
|
+
*
|
|
103
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
104
|
+
* you may not use this file except in compliance with the License.
|
|
105
|
+
* You may obtain a copy of the License at
|
|
106
|
+
*
|
|
107
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
108
|
+
*
|
|
109
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
110
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
111
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
112
|
+
* See the License for the specific language governing permissions and
|
|
113
|
+
* limitations under the License.
|
|
114
|
+
*/
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @public
|
|
118
|
+
* Represents a position in a MOQT track, consisting of a group and object index.
|
|
119
|
+
*
|
|
120
|
+
* Used for specifying start/end positions in subscription and fetch requests.
|
|
121
|
+
* - `group`: The group index (e.g. segment, GOP, or logical group).
|
|
122
|
+
* - `object`: The object index within the group (e.g. frame, chunk).
|
|
123
|
+
*/
|
|
124
|
+
declare class Location {
|
|
125
|
+
/**
|
|
126
|
+
* The group index for this location.
|
|
127
|
+
*/
|
|
128
|
+
readonly group: bigint;
|
|
129
|
+
/**
|
|
130
|
+
* The object index within the group for this location.
|
|
131
|
+
*/
|
|
132
|
+
readonly object: bigint;
|
|
133
|
+
/**
|
|
134
|
+
* Constructs a new Location.
|
|
135
|
+
* @param group - The group index (number or bigint).
|
|
136
|
+
* @param object - The object index (number or bigint).
|
|
137
|
+
*/
|
|
138
|
+
constructor(group: bigint | number, object: bigint | number);
|
|
139
|
+
/**
|
|
140
|
+
* Serializes this Location to a FrozenByteBuffer.
|
|
141
|
+
* @returns The serialized buffer.
|
|
142
|
+
* @throws CastingError if group or object is negative.
|
|
143
|
+
* @throws VarIntOverflowError if group or object exceeds varint encoding limits.
|
|
144
|
+
*/
|
|
145
|
+
serialize(): FrozenByteBuffer;
|
|
146
|
+
/**
|
|
147
|
+
* Deserializes a Location from a buffer.
|
|
148
|
+
* @param buf - The buffer to read from.
|
|
149
|
+
* @returns The deserialized Location.
|
|
150
|
+
* @throws NotEnoughBytesError if buffer does not contain enough bytes.
|
|
151
|
+
*/
|
|
152
|
+
static deserialize(buf: BaseByteBuffer): Location;
|
|
153
|
+
/**
|
|
154
|
+
* Checks if this Location is equal to another.
|
|
155
|
+
* @param other - The other Location to compare.
|
|
156
|
+
* @returns True if both group and object are equal.
|
|
157
|
+
*/
|
|
158
|
+
equals(other: Location): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Compares this Location to another for ordering.
|
|
161
|
+
* @param other - The other Location to compare.
|
|
162
|
+
* @returns -1 if this \< other, 1 if this \> other, 0 if equal.
|
|
163
|
+
*/
|
|
164
|
+
compare(other: Location): number;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Copyright 2025 The MOQtail Authors
|
|
169
|
+
*
|
|
170
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
171
|
+
* you may not use this file except in compliance with the License.
|
|
172
|
+
* You may obtain a copy of the License at
|
|
173
|
+
*
|
|
174
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
175
|
+
*
|
|
176
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
177
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
178
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
179
|
+
* See the License for the specific language governing permissions and
|
|
180
|
+
* limitations under the License.
|
|
181
|
+
*/
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @public
|
|
185
|
+
* Represents a single field in a Tuple, storing a value as a UTF-8 encoded byte array.
|
|
186
|
+
*
|
|
187
|
+
* Used for path segments or protocol fields in MOQT.
|
|
188
|
+
*/
|
|
189
|
+
declare class TupleField {
|
|
190
|
+
readonly value: Uint8Array;
|
|
191
|
+
/**
|
|
192
|
+
* The raw value of the field as a byte array.
|
|
193
|
+
*/
|
|
194
|
+
constructor(value: Uint8Array);
|
|
195
|
+
/**
|
|
196
|
+
* Creates a TupleField from a UTF-8 string.
|
|
197
|
+
* @param str - The string to encode.
|
|
198
|
+
* @returns A new TupleField containing the encoded value.
|
|
199
|
+
*/
|
|
200
|
+
static fromUtf8(str: string): TupleField;
|
|
201
|
+
/**
|
|
202
|
+
* Decodes the field value to a UTF-8 string.
|
|
203
|
+
* @returns The decoded string.
|
|
204
|
+
*/
|
|
205
|
+
toUtf8(): string;
|
|
206
|
+
/**
|
|
207
|
+
* Serializes this field to a length-prefixed byte array.
|
|
208
|
+
* @returns The serialized bytes.
|
|
209
|
+
*/
|
|
210
|
+
serialize(): Uint8Array;
|
|
211
|
+
/**
|
|
212
|
+
* Deserializes a TupleField from a buffer.
|
|
213
|
+
* @param buf - The buffer to read from.
|
|
214
|
+
* @returns The deserialized TupleField.
|
|
215
|
+
* @throws CastingError if the length cannot be safely cast to number.
|
|
216
|
+
* @throws NotEnoughBytesError if buffer does not contain enough bytes.
|
|
217
|
+
*/
|
|
218
|
+
static deserialize(buf: BaseByteBuffer): TupleField;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* @public
|
|
222
|
+
* Represents a sequence of TupleFields, typically used for hierarchical paths or protocol tuples in MOQT.
|
|
223
|
+
*/
|
|
224
|
+
declare class Tuple {
|
|
225
|
+
readonly fields: TupleField[];
|
|
226
|
+
/**
|
|
227
|
+
* The ordered list of fields in this tuple.
|
|
228
|
+
*/
|
|
229
|
+
constructor(fields?: TupleField[]);
|
|
230
|
+
/**
|
|
231
|
+
* Creates a Tuple from a path string, splitting on '/'.
|
|
232
|
+
* @param path - The path string (e.g. '/foo/bar').
|
|
233
|
+
* @returns A Tuple with each segment as a field.
|
|
234
|
+
*/
|
|
235
|
+
static fromUtf8Path(path: string): Tuple;
|
|
236
|
+
/**
|
|
237
|
+
* Converts the tuple to a path string, joining fields with '/'.
|
|
238
|
+
* @returns The path string (e.g. '/foo/bar').
|
|
239
|
+
*/
|
|
240
|
+
toUtf8Path(): string;
|
|
241
|
+
/**
|
|
242
|
+
* Adds a field to the tuple.
|
|
243
|
+
* @param field - The TupleField to add.
|
|
244
|
+
*/
|
|
245
|
+
add(field: TupleField): void;
|
|
246
|
+
/**
|
|
247
|
+
* Gets the field at the specified index.
|
|
248
|
+
* @param index - The field index.
|
|
249
|
+
* @returns The TupleField at the index.
|
|
250
|
+
* @throws Error if no field exists at the index.
|
|
251
|
+
*/
|
|
252
|
+
get(index: number): TupleField;
|
|
253
|
+
/**
|
|
254
|
+
* Sets the field at the specified index.
|
|
255
|
+
* @param index - The field index.
|
|
256
|
+
* @param field - The TupleField to set.
|
|
257
|
+
*/
|
|
258
|
+
set(index: number, field: TupleField): void;
|
|
259
|
+
/**
|
|
260
|
+
* Clears all fields from the tuple.
|
|
261
|
+
*/
|
|
262
|
+
clear(): void;
|
|
263
|
+
/**
|
|
264
|
+
* Serializes the tuple to a FrozenByteBuffer.
|
|
265
|
+
* @returns The serialized buffer.
|
|
266
|
+
*/
|
|
267
|
+
serialize(): FrozenByteBuffer;
|
|
268
|
+
/**
|
|
269
|
+
* Deserializes a Tuple from a buffer.
|
|
270
|
+
* @param buf - The buffer to read from.
|
|
271
|
+
* @returns The deserialized Tuple.
|
|
272
|
+
* @throws CastingError if the count cannot be safely cast to number.
|
|
273
|
+
* @throws NotEnoughBytesError if buffer does not contain enough bytes.
|
|
274
|
+
*/
|
|
275
|
+
static deserialize(buf: BaseByteBuffer): Tuple;
|
|
276
|
+
/**
|
|
277
|
+
* Checks if this tuple is equal to another.
|
|
278
|
+
* @param other - The other Tuple to compare.
|
|
279
|
+
* @returns True if all fields are equal.
|
|
280
|
+
*/
|
|
281
|
+
equals(other: Tuple): boolean;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Copyright 2025 The MOQtail Authors
|
|
286
|
+
*
|
|
287
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
288
|
+
* you may not use this file except in compliance with the License.
|
|
289
|
+
* You may obtain a copy of the License at
|
|
290
|
+
*
|
|
291
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
292
|
+
*
|
|
293
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
294
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
295
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
296
|
+
* See the License for the specific language governing permissions and
|
|
297
|
+
* limitations under the License.
|
|
298
|
+
*/
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* The maximum allowed length (in bytes) for a ReasonPhrase.
|
|
302
|
+
* @public
|
|
303
|
+
*/
|
|
304
|
+
declare const MAX_REASON_PHRASE_LEN = 1024;
|
|
305
|
+
/**
|
|
306
|
+
* Represents a protocol ReasonPhrase, a short UTF-8 string used for error or status reporting.
|
|
307
|
+
* Enforces a maximum byte length and validates encoding.
|
|
308
|
+
*
|
|
309
|
+
* @public
|
|
310
|
+
*/
|
|
311
|
+
declare class ReasonPhrase {
|
|
312
|
+
#private;
|
|
313
|
+
/**
|
|
314
|
+
* Constructs a ReasonPhrase, validating UTF-8 encoding and length.
|
|
315
|
+
*
|
|
316
|
+
* @param phrase - The string to use as the reason phrase.
|
|
317
|
+
* @throws {@link InvalidUTF8Error} if encoding fails.
|
|
318
|
+
* @throws {@link LengthExceedsMaxError} if the encoded phrase exceeds {@link MAX_REASON_PHRASE_LEN} bytes.
|
|
319
|
+
* @public
|
|
320
|
+
*/
|
|
321
|
+
constructor(phrase: string);
|
|
322
|
+
/**
|
|
323
|
+
* Returns the phrase string.
|
|
324
|
+
* @public
|
|
325
|
+
*/
|
|
326
|
+
get phrase(): string;
|
|
327
|
+
/**
|
|
328
|
+
* Serializes the ReasonPhrase into a {@link FrozenByteBuffer} containing:
|
|
329
|
+
* varint(length_of_phrase_bytes) || phrase_bytes
|
|
330
|
+
*
|
|
331
|
+
* @returns The serialized buffer.
|
|
332
|
+
* @public
|
|
333
|
+
*/
|
|
334
|
+
serialize(): FrozenByteBuffer;
|
|
335
|
+
/**
|
|
336
|
+
* Deserializes a ReasonPhrase from the given buffer.
|
|
337
|
+
* Reads varint(length) || utf8‑bytes.
|
|
338
|
+
*
|
|
339
|
+
* @param buf - The buffer to read from.
|
|
340
|
+
* @returns The deserialized ReasonPhrase.
|
|
341
|
+
* @throws :{@link CastingError} if the length cannot be safely cast to a number.
|
|
342
|
+
* @throws :{@link LengthExceedsMaxError} if the length exceeds {@link MAX_REASON_PHRASE_LEN}.
|
|
343
|
+
* @throws :{@link NotEnoughBytesError} if the buffer does not contain enough bytes.
|
|
344
|
+
* @throws :{@link InvalidUTF8Error} if decoding fails.
|
|
345
|
+
* @public
|
|
346
|
+
*/
|
|
347
|
+
static deserialize(buf: BaseByteBuffer): ReasonPhrase;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Copyright 2025 The MOQtail Authors
|
|
352
|
+
*
|
|
353
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
354
|
+
* you may not use this file except in compliance with the License.
|
|
355
|
+
* You may obtain a copy of the License at
|
|
356
|
+
*
|
|
357
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
358
|
+
*
|
|
359
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
360
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
361
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
362
|
+
* See the License for the specific language governing permissions and
|
|
363
|
+
* limitations under the License.
|
|
364
|
+
*/
|
|
365
|
+
/**
|
|
366
|
+
* @public
|
|
367
|
+
* Object datagram status types for MOQT objects (Draft-14).
|
|
368
|
+
* Status datagrams use types 0x20-0x21.
|
|
369
|
+
*
|
|
370
|
+
* Type bit layout:
|
|
371
|
+
* - Bit 0: Extensions Present (0 = no, 1 = yes)
|
|
372
|
+
*
|
|
373
|
+
* | Type | Extensions Present | Object ID Present |
|
|
374
|
+
* |------|-------------------|------------------|
|
|
375
|
+
* | 0x20 | No | Yes |
|
|
376
|
+
* | 0x21 | Yes | Yes |
|
|
377
|
+
*/
|
|
378
|
+
declare enum ObjectDatagramStatusType {
|
|
379
|
+
/** Status without extensions (0x20) */
|
|
380
|
+
WithoutExtensions = 32,
|
|
381
|
+
/** Status with extensions (0x21) */
|
|
382
|
+
WithExtensions = 33
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* @public
|
|
386
|
+
* Namespace for ObjectDatagramStatusType utilities.
|
|
387
|
+
*/
|
|
388
|
+
declare namespace ObjectDatagramStatusType {
|
|
389
|
+
/**
|
|
390
|
+
* Converts a number or bigint to ObjectDatagramStatusType.
|
|
391
|
+
* @param value - The value to convert.
|
|
392
|
+
* @returns The corresponding ObjectDatagramStatusType.
|
|
393
|
+
* @throws Error if the value is not valid.
|
|
394
|
+
*/
|
|
395
|
+
function tryFrom(value: number | bigint): ObjectDatagramStatusType;
|
|
396
|
+
/**
|
|
397
|
+
* Returns true if the type has extensions.
|
|
398
|
+
* @param t - The ObjectDatagramStatusType.
|
|
399
|
+
*/
|
|
400
|
+
function hasExtensions(t: ObjectDatagramStatusType): boolean;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* @public
|
|
404
|
+
* Object datagram types for MOQT objects (Draft-14).
|
|
405
|
+
*
|
|
406
|
+
* Type bit layout for 0x00-0x07:
|
|
407
|
+
* - Bit 0: Extensions Present (0 = no, 1 = yes)
|
|
408
|
+
* - Bit 1: End of Group (0 = no, 1 = yes)
|
|
409
|
+
* - Bit 2: Object ID Present (0 = Object ID omitted & is 0, 1 = Object ID present)
|
|
410
|
+
*
|
|
411
|
+
* Note: Bit 2 is inverted - when set, Object ID is ABSENT (and assumed 0)
|
|
412
|
+
*
|
|
413
|
+
* | Type | End of Group | Extensions | Object ID Present | Content |
|
|
414
|
+
* |------|-------------|------------|------------------|--------|
|
|
415
|
+
* | 0x00 | No | No | Yes | Payload |
|
|
416
|
+
* | 0x01 | No | Yes | Yes | Payload |
|
|
417
|
+
* | 0x02 | Yes | No | Yes | Payload |
|
|
418
|
+
* | 0x03 | Yes | Yes | Yes | Payload |
|
|
419
|
+
* | 0x04 | No | No | No (ID=0) | Payload |
|
|
420
|
+
* | 0x05 | No | Yes | No (ID=0) | Payload |
|
|
421
|
+
* | 0x06 | Yes | No | No (ID=0) | Payload |
|
|
422
|
+
* | 0x07 | Yes | Yes | No (ID=0) | Payload |
|
|
423
|
+
*/
|
|
424
|
+
declare enum ObjectDatagramType {
|
|
425
|
+
/** No End of Group, No Extensions, Object ID Present (0x00) */
|
|
426
|
+
Type0x00 = 0,
|
|
427
|
+
/** No End of Group, With Extensions, Object ID Present (0x01) */
|
|
428
|
+
Type0x01 = 1,
|
|
429
|
+
/** End of Group, No Extensions, Object ID Present (0x02) */
|
|
430
|
+
Type0x02 = 2,
|
|
431
|
+
/** End of Group, With Extensions, Object ID Present (0x03) */
|
|
432
|
+
Type0x03 = 3,
|
|
433
|
+
/** No End of Group, No Extensions, Object ID = 0 (0x04) */
|
|
434
|
+
Type0x04 = 4,
|
|
435
|
+
/** No End of Group, With Extensions, Object ID = 0 (0x05) */
|
|
436
|
+
Type0x05 = 5,
|
|
437
|
+
/** End of Group, No Extensions, Object ID = 0 (0x06) */
|
|
438
|
+
Type0x06 = 6,
|
|
439
|
+
/** End of Group, With Extensions, Object ID = 0 (0x07) */
|
|
440
|
+
Type0x07 = 7
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* @public
|
|
444
|
+
* Namespace for ObjectDatagramType utilities.
|
|
445
|
+
*/
|
|
446
|
+
declare namespace ObjectDatagramType {
|
|
447
|
+
/**
|
|
448
|
+
* Converts a number or bigint to ObjectDatagramType.
|
|
449
|
+
* @param value - The value to convert.
|
|
450
|
+
* @returns The corresponding ObjectDatagramType.
|
|
451
|
+
* @throws Error if the value is not valid.
|
|
452
|
+
*/
|
|
453
|
+
function tryFrom(value: number | bigint): ObjectDatagramType;
|
|
454
|
+
/**
|
|
455
|
+
* Returns true if the type has extensions (bit 0 set).
|
|
456
|
+
* @param t - The ObjectDatagramType.
|
|
457
|
+
*/
|
|
458
|
+
function hasExtensions(t: ObjectDatagramType): boolean;
|
|
459
|
+
/**
|
|
460
|
+
* Returns true if the type indicates End of Group (bit 1 set).
|
|
461
|
+
* @param t - The ObjectDatagramType.
|
|
462
|
+
*/
|
|
463
|
+
function isEndOfGroup(t: ObjectDatagramType): boolean;
|
|
464
|
+
/**
|
|
465
|
+
* Returns true if Object ID is present in the wire format.
|
|
466
|
+
* When bit 2 is set (0x04-0x07), Object ID is ABSENT and assumed to be 0.
|
|
467
|
+
* @param t - The ObjectDatagramType.
|
|
468
|
+
*/
|
|
469
|
+
function hasObjectId(t: ObjectDatagramType): boolean;
|
|
470
|
+
/**
|
|
471
|
+
* Determines the appropriate type for given properties.
|
|
472
|
+
* @param hasExtensions - Whether extensions are present.
|
|
473
|
+
* @param endOfGroup - Whether this is the last object in the group.
|
|
474
|
+
* @param objectIdIsZero - Whether the objectId is 0.
|
|
475
|
+
*/
|
|
476
|
+
function fromProperties(hasExtensions: boolean, endOfGroup: boolean, objectIdIsZero: boolean): ObjectDatagramType;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* @public
|
|
480
|
+
* Fetch header types for MOQT fetch requests.
|
|
481
|
+
*/
|
|
482
|
+
declare enum FetchHeaderType {
|
|
483
|
+
Type0x05 = 5
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Namespace for FetchHeaderType utilities.
|
|
487
|
+
*/
|
|
488
|
+
declare namespace FetchHeaderType {
|
|
489
|
+
/**
|
|
490
|
+
* Converts a number or bigint to FetchHeaderType.
|
|
491
|
+
* @param value - The value to convert.
|
|
492
|
+
* @returns The corresponding FetchHeaderType.
|
|
493
|
+
* @throws Error if the value is not valid.
|
|
494
|
+
*/
|
|
495
|
+
function tryFrom(value: number | bigint): FetchHeaderType;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* @public
|
|
499
|
+
* Subgroup header types for MOQT subgroups.
|
|
500
|
+
*/
|
|
501
|
+
declare enum SubgroupHeaderType {
|
|
502
|
+
Type0x10 = 16,
|
|
503
|
+
Type0x11 = 17,
|
|
504
|
+
Type0x12 = 18,
|
|
505
|
+
Type0x13 = 19,
|
|
506
|
+
Type0x14 = 20,
|
|
507
|
+
Type0x15 = 21,
|
|
508
|
+
Type0x18 = 24,
|
|
509
|
+
Type0x19 = 25,
|
|
510
|
+
Type0x1A = 26,
|
|
511
|
+
Type0x1B = 27,
|
|
512
|
+
Type0x1C = 28,
|
|
513
|
+
Type0x1D = 29
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Namespace for SubgroupHeaderType utilities.
|
|
517
|
+
*/
|
|
518
|
+
declare namespace SubgroupHeaderType {
|
|
519
|
+
/**
|
|
520
|
+
* Returns true if the header type has an explicit subgroup ID.
|
|
521
|
+
* @param t - The SubgroupHeaderType.
|
|
522
|
+
*/
|
|
523
|
+
function hasExplicitSubgroupId(t: SubgroupHeaderType): boolean;
|
|
524
|
+
/**
|
|
525
|
+
* Returns true if the header type implies a subgroup ID of zero.
|
|
526
|
+
* @param t - The SubgroupHeaderType.
|
|
527
|
+
*/
|
|
528
|
+
function isSubgroupIdZero(t: SubgroupHeaderType): boolean;
|
|
529
|
+
/**
|
|
530
|
+
* Returns true if the header type has extensions.
|
|
531
|
+
* @param t - The SubgroupHeaderType.
|
|
532
|
+
*/
|
|
533
|
+
function hasExtensions(t: SubgroupHeaderType): boolean;
|
|
534
|
+
/**
|
|
535
|
+
* Converts a number or bigint to SubgroupHeaderType.
|
|
536
|
+
* @param value - The value to convert.
|
|
537
|
+
* @returns The corresponding SubgroupHeaderType.
|
|
538
|
+
* @throws Error if the value is not valid.
|
|
539
|
+
*/
|
|
540
|
+
function tryFrom(value: number | bigint): SubgroupHeaderType;
|
|
541
|
+
}
|
|
542
|
+
/**
|
|
543
|
+
* @public
|
|
544
|
+
* Publisher's preferred object delivery mechanism for a track.
|
|
545
|
+
* - `Subgroup`: Use ordered subgroups (reliable).
|
|
546
|
+
* - `Datagram`: Use unreliable datagrams when feasible.
|
|
547
|
+
*
|
|
548
|
+
* The preference is advisory: the relay/transport layer MAY override based on negotiated capabilities.
|
|
549
|
+
*/
|
|
550
|
+
declare enum ObjectForwardingPreference {
|
|
551
|
+
Subgroup = "Subgroup",
|
|
552
|
+
Datagram = "Datagram"
|
|
553
|
+
}
|
|
554
|
+
/**
|
|
555
|
+
* Namespace for ObjectForwardingPreference utilities.
|
|
556
|
+
*/
|
|
557
|
+
declare namespace ObjectForwardingPreference {
|
|
558
|
+
/**
|
|
559
|
+
* Converts a number, bigint, or string to ObjectForwardingPreference.
|
|
560
|
+
* @param value - The value to convert.
|
|
561
|
+
* @returns The corresponding ObjectForwardingPreference.
|
|
562
|
+
* @throws Error if the value is not valid.
|
|
563
|
+
*/
|
|
564
|
+
function tryFrom(value: number | bigint | string): ObjectForwardingPreference;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* @public
|
|
568
|
+
* Object status codes for MOQT objects.
|
|
569
|
+
* - `Normal`: Object exists and is available.
|
|
570
|
+
* - `DoesNotExist`: Object does not exist.
|
|
571
|
+
* - `EndOfGroup`: End of group marker.
|
|
572
|
+
* - `EndOfTrack`: End of track marker.
|
|
573
|
+
*/
|
|
574
|
+
declare enum ObjectStatus {
|
|
575
|
+
Normal = 0,
|
|
576
|
+
DoesNotExist = 1,
|
|
577
|
+
EndOfGroup = 3,
|
|
578
|
+
EndOfTrack = 4
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Namespace for ObjectStatus utilities.
|
|
582
|
+
*/
|
|
583
|
+
declare namespace ObjectStatus {
|
|
584
|
+
/**
|
|
585
|
+
* Converts a number or bigint to ObjectStatus.
|
|
586
|
+
* @param value - The value to convert.
|
|
587
|
+
* @returns The corresponding ObjectStatus.
|
|
588
|
+
* @throws Error if the value is not valid.
|
|
589
|
+
*/
|
|
590
|
+
function tryFrom(value: number | bigint): ObjectStatus;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Copyright 2025 The MOQtail Authors
|
|
595
|
+
*
|
|
596
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
597
|
+
* you may not use this file except in compliance with the License.
|
|
598
|
+
* You may obtain a copy of the License at
|
|
599
|
+
*
|
|
600
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
601
|
+
*
|
|
602
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
603
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
604
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
605
|
+
* See the License for the specific language governing permissions and
|
|
606
|
+
* limitations under the License.
|
|
607
|
+
*/
|
|
608
|
+
|
|
609
|
+
/**
|
|
610
|
+
* Represents an OBJECT_DATAGRAM message (Draft-14).
|
|
611
|
+
*
|
|
612
|
+
* Type values 0x00-0x07 indicate payload datagrams with varying properties:
|
|
613
|
+
* - Bit 0: Extensions Present
|
|
614
|
+
* - Bit 1: End of Group
|
|
615
|
+
* - Bit 2: Object ID NOT present (when set, Object ID is 0)
|
|
616
|
+
*/
|
|
617
|
+
declare class DatagramObject {
|
|
618
|
+
readonly type: ObjectDatagramType;
|
|
619
|
+
readonly publisherPriority: number;
|
|
620
|
+
readonly extensionHeaders: KeyValuePair[] | null;
|
|
621
|
+
readonly payload: Uint8Array;
|
|
622
|
+
readonly endOfGroup: boolean;
|
|
623
|
+
readonly trackAlias: bigint;
|
|
624
|
+
readonly location: Location;
|
|
625
|
+
private constructor();
|
|
626
|
+
get groupId(): bigint;
|
|
627
|
+
get objectId(): bigint;
|
|
628
|
+
/**
|
|
629
|
+
* Create a new DatagramObject with all properties specified.
|
|
630
|
+
* The type is automatically determined based on extensions, endOfGroup, and objectId.
|
|
631
|
+
*/
|
|
632
|
+
static new(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array, endOfGroup?: boolean): DatagramObject;
|
|
633
|
+
/**
|
|
634
|
+
* Create a DatagramObject with extensions.
|
|
635
|
+
* @deprecated Use DatagramObject.new() instead for Draft-14 compliance.
|
|
636
|
+
*/
|
|
637
|
+
static newWithExtensions(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number, extensionHeaders: KeyValuePair[], payload: Uint8Array, endOfGroup?: boolean): DatagramObject;
|
|
638
|
+
/**
|
|
639
|
+
* Create a DatagramObject without extensions.
|
|
640
|
+
* @deprecated Use DatagramObject.new() instead for Draft-14 compliance.
|
|
641
|
+
*/
|
|
642
|
+
static newWithoutExtensions(trackAlias: bigint, groupId: bigint, objectId: bigint, publisherPriority: number, payload: Uint8Array, endOfGroup?: boolean): DatagramObject;
|
|
643
|
+
serialize(): FrozenByteBuffer;
|
|
644
|
+
static deserialize(buf: BaseByteBuffer): DatagramObject;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Copyright 2025 The MOQtail Authors
|
|
649
|
+
*
|
|
650
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
651
|
+
* you may not use this file except in compliance with the License.
|
|
652
|
+
* You may obtain a copy of the License at
|
|
653
|
+
*
|
|
654
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
655
|
+
*
|
|
656
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
657
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
658
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
659
|
+
* See the License for the specific language governing permissions and
|
|
660
|
+
* limitations under the License.
|
|
661
|
+
*/
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* Represents an OBJECT_DATAGRAM with status (Draft-14).
|
|
665
|
+
*
|
|
666
|
+
* Type values 0x20-0x21 indicate status datagrams:
|
|
667
|
+
* - 0x20: Without extensions, Object ID present
|
|
668
|
+
* - 0x21: With extensions, Object ID present
|
|
669
|
+
*
|
|
670
|
+
* Status datagrams always have Object ID present (unlike payload datagrams
|
|
671
|
+
* which can omit Object ID when it's 0).
|
|
672
|
+
*/
|
|
673
|
+
declare class DatagramStatus {
|
|
674
|
+
readonly type: ObjectDatagramStatusType;
|
|
675
|
+
readonly publisherPriority: number;
|
|
676
|
+
readonly extensionHeaders: KeyValuePair[] | null;
|
|
677
|
+
readonly objectStatus: ObjectStatus;
|
|
678
|
+
readonly trackAlias: bigint;
|
|
679
|
+
readonly location: Location;
|
|
680
|
+
private constructor();
|
|
681
|
+
get groupId(): bigint;
|
|
682
|
+
get objectId(): bigint;
|
|
683
|
+
/**
|
|
684
|
+
* Create a new DatagramStatus with all properties specified.
|
|
685
|
+
* The type is automatically determined based on whether extensions are present.
|
|
686
|
+
*/
|
|
687
|
+
static new(trackAlias: bigint | number, location: Location, publisherPriority: number, extensionHeaders: KeyValuePair[] | null, objectStatus: ObjectStatus): DatagramStatus;
|
|
688
|
+
/**
|
|
689
|
+
* Create a DatagramStatus with extensions.
|
|
690
|
+
* @deprecated Use DatagramStatus.new() instead for Draft-14 compliance.
|
|
691
|
+
*/
|
|
692
|
+
static withExtensions(trackAlias: bigint | number, location: Location, publisherPriority: number, extensionHeaders: KeyValuePair[], objectStatus: ObjectStatus): DatagramStatus;
|
|
693
|
+
/**
|
|
694
|
+
* Create a DatagramStatus without extensions.
|
|
695
|
+
* @deprecated Use DatagramStatus.new() instead for Draft-14 compliance.
|
|
696
|
+
*/
|
|
697
|
+
static newWithoutExtensions(trackAlias: bigint | number, location: Location, publisherPriority: number, objectStatus: ObjectStatus): DatagramStatus;
|
|
698
|
+
serialize(): FrozenByteBuffer;
|
|
699
|
+
static deserialize(buf: BaseByteBuffer): DatagramStatus;
|
|
700
|
+
}
|
|
2
701
|
|
|
3
702
|
/**
|
|
4
703
|
* Copyright 2025 The MOQtail Authors
|
|
@@ -24,6 +723,205 @@ declare class FetchHeader {
|
|
|
24
723
|
static deserialize(buf: BaseByteBuffer): FetchHeader;
|
|
25
724
|
}
|
|
26
725
|
|
|
726
|
+
/**
|
|
727
|
+
* Copyright 2025 The MOQtail Authors
|
|
728
|
+
*
|
|
729
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
730
|
+
* you may not use this file except in compliance with the License.
|
|
731
|
+
* You may obtain a copy of the License at
|
|
732
|
+
*
|
|
733
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
734
|
+
*
|
|
735
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
736
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
737
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
738
|
+
* See the License for the specific language governing permissions and
|
|
739
|
+
* limitations under the License.
|
|
740
|
+
*/
|
|
741
|
+
|
|
742
|
+
declare class FetchObject {
|
|
743
|
+
readonly publisherPriority: number;
|
|
744
|
+
readonly extensionHeaders: KeyValuePair[] | null;
|
|
745
|
+
readonly objectStatus: ObjectStatus | null;
|
|
746
|
+
readonly payload: Uint8Array | null;
|
|
747
|
+
readonly location: Location;
|
|
748
|
+
readonly subgroupId: bigint;
|
|
749
|
+
private constructor();
|
|
750
|
+
get groupId(): bigint;
|
|
751
|
+
get objectId(): bigint;
|
|
752
|
+
static newWithStatus(groupId: bigint | number, subgroupId: bigint | number, objectId: bigint | number, publisherPriority: number, extensionHeaders: KeyValuePair[] | null, objectStatus: ObjectStatus): FetchObject;
|
|
753
|
+
static newWithPayload(groupId: bigint | number, subgroupId: bigint | number, objectId: bigint | number, publisherPriority: number, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array): FetchObject;
|
|
754
|
+
serialize(_previousObjectId?: BigInt): FrozenByteBuffer;
|
|
755
|
+
static deserialize(buf: BaseByteBuffer): FetchObject;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* Copyright 2025 The MOQtail Authors
|
|
760
|
+
*
|
|
761
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
762
|
+
* you may not use this file except in compliance with the License.
|
|
763
|
+
* You may obtain a copy of the License at
|
|
764
|
+
*
|
|
765
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
766
|
+
*
|
|
767
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
768
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
769
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
770
|
+
* See the License for the specific language governing permissions and
|
|
771
|
+
* limitations under the License.
|
|
772
|
+
*/
|
|
773
|
+
|
|
774
|
+
declare const MAX_NAMESPACE_TUPLE_COUNT = 32;
|
|
775
|
+
declare const MAX_FULL_TRACK_NAME_LENGTH = 4096;
|
|
776
|
+
/**
|
|
777
|
+
* Fully-qualified track identifier = hierarchical namespace (tuple) + leaf name bytes.
|
|
778
|
+
*
|
|
779
|
+
* Constraints enforced (throws {@link TrackNameError}):
|
|
780
|
+
* - Namespace tuple field count: 1 .. {@link MAX_NAMESPACE_TUPLE_COUNT} (must not be empty).
|
|
781
|
+
* - Total serialized length (namespace tuple + raw name bytes) less than or equals {@link MAX_FULL_TRACK_NAME_LENGTH} bytes.
|
|
782
|
+
*
|
|
783
|
+
* Namespace input may be:
|
|
784
|
+
* - `string` path with segments separated by `/` (converted via {@link Tuple.fromUtf8Path}). Empty segments are preserved
|
|
785
|
+
* except leading/trailing slashes are treated as empty fields and will be rejected by the length check if result is 0.
|
|
786
|
+
* - Existing {@link Tuple} instance.
|
|
787
|
+
*
|
|
788
|
+
* Name input may be:
|
|
789
|
+
* - UTF-8 string (encoded)
|
|
790
|
+
* - Raw `Uint8Array` (used directly)
|
|
791
|
+
*
|
|
792
|
+
* Instances are created via {@link FullTrackName.tryNew} (validates) or {@link FullTrackName.deserialize}.
|
|
793
|
+
* Use {@link FullTrackName.serialize} for wire encoding and {@link FullTrackName.toString} for a human friendly
|
|
794
|
+
* diagnostic format: `namespace/segments:hexname` (name rendered as lowercase hex, no 0x prefix).
|
|
795
|
+
*
|
|
796
|
+
* The string form is intended for logs/debug only; do not parse it for protocol operations.
|
|
797
|
+
*/
|
|
798
|
+
declare class FullTrackName {
|
|
799
|
+
readonly namespace: Tuple;
|
|
800
|
+
readonly name: Uint8Array;
|
|
801
|
+
private constructor();
|
|
802
|
+
/**
|
|
803
|
+
* Human-readable representation: `\<namespace path joined by '/'\>:\<name as lowercase hex\>`.
|
|
804
|
+
* If the underlying {@link Tuple} exposes `toUtf8Path`, it's used; otherwise the raw fields are joined.
|
|
805
|
+
* This is lossy only in the sense that name bytes are hex encoded; round-tripping requires serialization.
|
|
806
|
+
*/
|
|
807
|
+
toString(): string;
|
|
808
|
+
/**
|
|
809
|
+
* Construct a validated full track name.
|
|
810
|
+
*
|
|
811
|
+
* Validation steps:
|
|
812
|
+
* 1. Convert namespace string -\> {@link Tuple} (split on '/') if needed.
|
|
813
|
+
* 2. Reject if namespace tuple field count is 0 or \> {@link MAX_NAMESPACE_TUPLE_COUNT}.
|
|
814
|
+
* 3. Encode name string to UTF-8 if needed.
|
|
815
|
+
* 4. Reject if total serialized length (namespace tuple + name bytes) \> {@link MAX_FULL_TRACK_NAME_LENGTH}.
|
|
816
|
+
*
|
|
817
|
+
* @throws :{@link TrackNameError} on any constraint violation.
|
|
818
|
+
* @example
|
|
819
|
+
* ```ts
|
|
820
|
+
* const full = FullTrackName.tryNew('media/video', 'keyframe')
|
|
821
|
+
* console.log(full.toString()) // media/video:6b65796672616d65
|
|
822
|
+
* ```
|
|
823
|
+
*/
|
|
824
|
+
static tryNew(namespace: string | Tuple, name: string | Uint8Array): FullTrackName;
|
|
825
|
+
/**
|
|
826
|
+
* Serialize to a frozen buffer: tuple (namespace) followed by length‑prefixed name bytes.
|
|
827
|
+
* Consumers needing raw bytes should call `.toUint8Array()` on the returned {@link FrozenByteBuffer}.
|
|
828
|
+
*/
|
|
829
|
+
serialize(): FrozenByteBuffer;
|
|
830
|
+
/**
|
|
831
|
+
* Parse a serialized full track name. Performs the same validations as {@link FullTrackName.tryNew}.
|
|
832
|
+
* The provided buffer's read cursor advances accordingly.
|
|
833
|
+
* @throws :{@link TrackNameError} if constraints are violated.
|
|
834
|
+
*/
|
|
835
|
+
static deserialize(buf: BaseByteBuffer): FullTrackName;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* Copyright 2025 The MOQtail Authors
|
|
840
|
+
*
|
|
841
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
842
|
+
* you may not use this file except in compliance with the License.
|
|
843
|
+
* You may obtain a copy of the License at
|
|
844
|
+
*
|
|
845
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
846
|
+
*
|
|
847
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
848
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
849
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
850
|
+
* See the License for the specific language governing permissions and
|
|
851
|
+
* limitations under the License.
|
|
852
|
+
*/
|
|
853
|
+
|
|
854
|
+
declare class SubgroupObject {
|
|
855
|
+
readonly extensionHeaders: KeyValuePair[] | null;
|
|
856
|
+
readonly objectStatus: ObjectStatus | null;
|
|
857
|
+
readonly payload: Uint8Array | null;
|
|
858
|
+
readonly objectId: bigint;
|
|
859
|
+
private constructor();
|
|
860
|
+
static newWithStatus(objectId: bigint | number, extensionHeaders: KeyValuePair[] | null, objectStatus: ObjectStatus): SubgroupObject;
|
|
861
|
+
static newWithPayload(objectId: bigint | number, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array): SubgroupObject;
|
|
862
|
+
serialize(previousObjectId: bigint | undefined): FrozenByteBuffer;
|
|
863
|
+
static deserialize(buf: BaseByteBuffer, hasExtensions: boolean, previousObjectId: bigint | undefined): SubgroupObject;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
/**
|
|
867
|
+
* Copyright 2025 The MOQtail Authors
|
|
868
|
+
*
|
|
869
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
870
|
+
* you may not use this file except in compliance with the License.
|
|
871
|
+
* You may obtain a copy of the License at
|
|
872
|
+
*
|
|
873
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
874
|
+
*
|
|
875
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
876
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
877
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
878
|
+
* See the License for the specific language governing permissions and
|
|
879
|
+
* limitations under the License.
|
|
880
|
+
*/
|
|
881
|
+
|
|
882
|
+
declare class MoqtObject {
|
|
883
|
+
readonly fullTrackName: FullTrackName;
|
|
884
|
+
readonly publisherPriority: number;
|
|
885
|
+
readonly objectForwardingPreference: ObjectForwardingPreference;
|
|
886
|
+
readonly objectStatus: ObjectStatus;
|
|
887
|
+
readonly extensionHeaders: KeyValuePair[] | null;
|
|
888
|
+
readonly payload: Uint8Array | null;
|
|
889
|
+
readonly location: Location;
|
|
890
|
+
readonly subgroupId: bigint | null;
|
|
891
|
+
private constructor();
|
|
892
|
+
get groupId(): bigint;
|
|
893
|
+
get objectId(): bigint;
|
|
894
|
+
getSubgroupHeaderType(containsEnd: boolean): SubgroupHeaderType;
|
|
895
|
+
isDatagram(): boolean;
|
|
896
|
+
isSubgroup(): boolean;
|
|
897
|
+
isEndOfGroup(): boolean;
|
|
898
|
+
isEndOfTrack(): boolean;
|
|
899
|
+
doesNotExist(): boolean;
|
|
900
|
+
hasPayload(): boolean;
|
|
901
|
+
hasStatus(): boolean;
|
|
902
|
+
static newWithPayload(fullTrackName: FullTrackName, location: Location, publisherPriority: number, objectForwardingPreference: ObjectForwardingPreference, subgroupId: bigint | number | null, extensionHeaders: KeyValuePair[] | null, payload: Uint8Array): MoqtObject;
|
|
903
|
+
static newWithStatus(fullTrackName: FullTrackName, location: Location, publisherPriority: number, objectForwardingPreference: ObjectForwardingPreference, subgroupId: bigint | number | null, extensionHeaders: KeyValuePair[] | null, objectStatus: ObjectStatus): MoqtObject;
|
|
904
|
+
static fromDatagramObject(datagramObject: DatagramObject, fullTrackName: FullTrackName): MoqtObject;
|
|
905
|
+
/**
|
|
906
|
+
* Returns the endOfGroup flag from the source DatagramObject.
|
|
907
|
+
* This is separate from ObjectStatus.EndOfGroup - the flag indicates
|
|
908
|
+
* this is the last object in the group even with Normal status.
|
|
909
|
+
*/
|
|
910
|
+
static isDatagramEndOfGroup(datagramObject: DatagramObject): boolean;
|
|
911
|
+
static fromDatagramStatus(datagramStatus: DatagramStatus, fullTrackName: FullTrackName): MoqtObject;
|
|
912
|
+
static fromFetchObject(fetchObject: FetchObject, fullTrackName: FullTrackName): MoqtObject;
|
|
913
|
+
static fromSubgroupObject(subgroupObject: SubgroupObject, groupId: bigint | number, publisherPriority: number, subgroupId: bigint | number, fullTrackName: FullTrackName): MoqtObject;
|
|
914
|
+
/**
|
|
915
|
+
* Convert to DatagramObject for wire transmission.
|
|
916
|
+
* @param trackAlias - The track alias to use
|
|
917
|
+
* @param endOfGroup - Draft-14: Whether this is the last object in the group
|
|
918
|
+
*/
|
|
919
|
+
tryIntoDatagramObject(trackAlias: bigint | number, endOfGroup?: boolean): DatagramObject;
|
|
920
|
+
tryIntoDatagramStatus(trackAlias: bigint | number): DatagramStatus;
|
|
921
|
+
tryIntoFetchObject(): FetchObject;
|
|
922
|
+
tryIntoSubgroupObject(): SubgroupObject;
|
|
923
|
+
}
|
|
924
|
+
|
|
27
925
|
/**
|
|
28
926
|
* Copyright 2025 The MOQtail Authors
|
|
29
927
|
*
|
|
@@ -163,6 +1061,92 @@ declare namespace Header {
|
|
|
163
1061
|
function deserialize(buf: BaseByteBuffer): Header;
|
|
164
1062
|
}
|
|
165
1063
|
|
|
1064
|
+
/**
|
|
1065
|
+
* Copyright 2025 The MOQtail Authors
|
|
1066
|
+
*
|
|
1067
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1068
|
+
* you may not use this file except in compliance with the License.
|
|
1069
|
+
* You may obtain a copy of the License at
|
|
1070
|
+
*
|
|
1071
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1072
|
+
*
|
|
1073
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1074
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1075
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1076
|
+
* See the License for the specific language governing permissions and
|
|
1077
|
+
* limitations under the License.
|
|
1078
|
+
*/
|
|
1079
|
+
|
|
1080
|
+
declare abstract class BaseByteBuffer {
|
|
1081
|
+
protected buf: Uint8Array;
|
|
1082
|
+
protected view: DataView;
|
|
1083
|
+
protected _offset: number;
|
|
1084
|
+
protected _checkpoint: number;
|
|
1085
|
+
constructor(buf: Uint8Array);
|
|
1086
|
+
get offset(): number;
|
|
1087
|
+
abstract get length(): number;
|
|
1088
|
+
get remaining(): number;
|
|
1089
|
+
/**
|
|
1090
|
+
* Save current read position for potential rollback
|
|
1091
|
+
*/
|
|
1092
|
+
checkpoint(): void;
|
|
1093
|
+
/**
|
|
1094
|
+
* Restore read position to last checkpoint
|
|
1095
|
+
*/
|
|
1096
|
+
restore(): void;
|
|
1097
|
+
toUint8Array(): Uint8Array;
|
|
1098
|
+
getU8(): number;
|
|
1099
|
+
getU16(): number;
|
|
1100
|
+
getVI(): bigint;
|
|
1101
|
+
getNumberVI(): number;
|
|
1102
|
+
getBytes(len: number): Uint8Array;
|
|
1103
|
+
getLengthPrefixedBytes(): Uint8Array;
|
|
1104
|
+
getKeyValuePair(): KeyValuePair;
|
|
1105
|
+
getReasonPhrase(): ReasonPhrase;
|
|
1106
|
+
getLocation(): Location;
|
|
1107
|
+
getTuple(): Tuple;
|
|
1108
|
+
getFullTrackName(): FullTrackName;
|
|
1109
|
+
}
|
|
1110
|
+
declare class ByteBuffer extends BaseByteBuffer {
|
|
1111
|
+
private _length;
|
|
1112
|
+
constructor(initialSize?: number);
|
|
1113
|
+
get length(): number;
|
|
1114
|
+
/**
|
|
1115
|
+
* Clear all data and reset all positions
|
|
1116
|
+
*/
|
|
1117
|
+
clear(): void;
|
|
1118
|
+
/**
|
|
1119
|
+
* Drop all data before current offset and reset positions
|
|
1120
|
+
* This is the key method for memory management - removes processed data
|
|
1121
|
+
*/
|
|
1122
|
+
commit(): void;
|
|
1123
|
+
private ensureCapacity;
|
|
1124
|
+
putU8(v: number): void;
|
|
1125
|
+
putU16(v: number): void;
|
|
1126
|
+
/**
|
|
1127
|
+
* Write a variable-length integer (QUIC-style varint)
|
|
1128
|
+
* Encoding:
|
|
1129
|
+
* - 2 MSB = 00: 1 byte (6 bits) for values 0-63
|
|
1130
|
+
* - 2 MSB = 01: 2 bytes (14 bits) for values 0-16383
|
|
1131
|
+
* - 2 MSB = 10: 4 bytes (30 bits) for values 0-1073741823
|
|
1132
|
+
* - 2 MSB = 11: 8 bytes (62 bits) for values 0-4611686018427387903
|
|
1133
|
+
*/
|
|
1134
|
+
putVI(v: bigint | number): void;
|
|
1135
|
+
putBytes(src: Uint8Array): void;
|
|
1136
|
+
putLengthPrefixedBytes(src: Uint8Array): void;
|
|
1137
|
+
putKeyValuePair(pair: KeyValuePair): void;
|
|
1138
|
+
putReasonPhrase(reason: ReasonPhrase): void;
|
|
1139
|
+
toUint8Array(): Uint8Array;
|
|
1140
|
+
freeze(): FrozenByteBuffer;
|
|
1141
|
+
putLocation(loc: Location): void;
|
|
1142
|
+
putTuple(tuple: Tuple): void;
|
|
1143
|
+
putFullTrackName(fullTrackName: FullTrackName): void;
|
|
1144
|
+
}
|
|
1145
|
+
declare class FrozenByteBuffer extends BaseByteBuffer {
|
|
1146
|
+
constructor(buf: Uint8Array);
|
|
1147
|
+
get length(): number;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
166
1150
|
/**
|
|
167
1151
|
* Copyright 2025 The MOQtail Authors
|
|
168
1152
|
*
|
|
@@ -1656,4 +2640,4 @@ declare class VersionSpecificParameters {
|
|
|
1656
2640
|
static fromKeyValuePairs(kvps: KeyValuePair[]): VersionSpecificParameter[];
|
|
1657
2641
|
}
|
|
1658
2642
|
|
|
1659
|
-
export {
|
|
2643
|
+
export { PublishNamespaceOk as $, type AuthTokenVariant as A, BaseByteBuffer as B, ClientSetup as C, DRAFT_14 as D, MoqtObject as E, Fetch as F, GoAway as G, Header as H, ObjectDatagramType as I, ObjectForwardingPreference as J, KeyValuePair as K, Location as L, MAX_FULL_TRACK_NAME_LENGTH as M, ObjectStatus as N, ObjectDatagramStatusType as O, type Parameter as P, Path as Q, Publish as R, PublishDone as S, PublishDoneStatusCode as T, PublishError as U, PublishErrorCode as V, PublishNamespace as W, PublishNamespaceCancel as X, PublishNamespaceDone as Y, PublishNamespaceError as Z, PublishNamespaceErrorCode as _, AuthorizationToken as a, PublishOk as a0, ReasonPhrase as a1, RequestIdMap as a2, RequestsBlocked as a3, ServerSetup as a4, SetupParameter as a5, SetupParameterType as a6, SetupParameters as a7, SubgroupHeader as a8, SubgroupHeaderType as a9, filterTypeFromBigInt as aA, groupOrderFromNumber as aB, isBytes as aC, isVarInt as aD, publishDoneStatusCodeFromBigInt as aE, publishErrorCodeFromBigInt as aF, publishNamespaceErrorCodeFromBigInt as aG, setupParameterTypeFromNumber as aH, subscribeErrorCodeFromBigInt as aI, subscribeNamespaceErrorCodeFromBigInt as aJ, tokenAliasTypeFromNumber as aK, trackStatusCodeFromBigInt as aL, versionSpecificParameterTypeFromNumber as aM, SubgroupObject as aa, Subscribe as ab, SubscribeError as ac, SubscribeErrorCode as ad, SubscribeNamespace as ae, SubscribeNamespaceError as af, SubscribeNamespaceErrorCode as ag, SubscribeNamespaceOk as ah, SubscribeOk as ai, SubscribeUpdate as aj, TokenAliasType as ak, TrackStatus as al, TrackStatusCode as am, TrackStatusError as an, TrackStatusOk as ao, Tuple as ap, TupleField as aq, Unsubscribe as ar, UnsubscribeNamespace as as, VersionSpecificParameter as at, VersionSpecificParameterType as au, VersionSpecificParameters as av, commonTypeFromNumber as aw, controlMessageTypeFromBigInt as ax, fetchErrorCodeFromBigInt as ay, fetchTypeFromBigInt as az, ByteBuffer as b, CommonType as c, ControlMessage as d, ControlMessageType as e, DatagramObject as f, DatagramStatus as g, DeliveryTimeout as h, FetchCancel as i, FetchError as j, FetchErrorCode as k, FetchHeader as l, FetchHeaderType as m, FetchObject as n, FetchOk as o, FetchType as p, FilterType as q, FrozenByteBuffer as r, FullTrackName as s, GroupOrder as t, MAX_NAMESPACE_TUPLE_COUNT as u, MAX_REASON_PHRASE_LEN as v, MaxAuthTokenCacheSize as w, MaxCacheDuration as x, MaxRequestId$1 as y, MaxRequestId as z };
|