@torrent-tv/proxy 2.99.14 → 2.99.15
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/package.json
CHANGED
|
@@ -682,6 +682,18 @@ export class MatroskaContainer extends Container {
|
|
|
682
682
|
|
|
683
683
|
async readMappedSourceRanges(interval) { return this.readSourceRanges(interval); }
|
|
684
684
|
|
|
685
|
+
/**
|
|
686
|
+
* The bytes a packet table of `interval` is read from: the clusters the
|
|
687
|
+
* Cues name for it, as for the original file. Every block header in them is
|
|
688
|
+
* read, and the headers lie throughout. Null without Cues, where the walk
|
|
689
|
+
* itself finds what it needs.
|
|
690
|
+
*/
|
|
691
|
+
async packetWalkRanges(interval) {
|
|
692
|
+
if (!await this.supportsOriginalSourceRanges()) return null;
|
|
693
|
+
const ranges = await this.readSourceRanges(interval);
|
|
694
|
+
return ranges.kind === "result" ? ranges : null;
|
|
695
|
+
}
|
|
696
|
+
|
|
685
697
|
async readSourceRanges(interval) {
|
|
686
698
|
if (!Number.isFinite(interval?.from) || !Number.isFinite(interval?.to) || interval.to <= interval.from) {
|
|
687
699
|
throw new TypeError("Source ranges require a finite increasing interval.");
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
import { SegmentInputs } from "./SegmentInputs.js";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
* @param {object} container - Has `supportsOriginalSourceRanges`, `readSourceRanges` and `readPacketIndex
|
|
17
|
+
* @param {object} container - Has `supportsOriginalSourceRanges`, `readSourceRanges` and `readPacketIndex`;
|
|
18
|
+
* `packetWalkRanges` where a packet table is read from bytes the container can name in advance.
|
|
18
19
|
* @param {{ interval: object, tracks: object[], mode: (track: object) => string }} segment
|
|
19
20
|
* @param {(built: Promise<void>) => void} whenBuilt - Given a promise that settles when a table
|
|
20
21
|
* still being built is built or refused, when the answer is "pending".
|
|
@@ -23,6 +24,14 @@ import { SegmentInputs } from "./SegmentInputs.js";
|
|
|
23
24
|
*/
|
|
24
25
|
export async function directSegmentInput(container, { interval, tracks, mode }, whenBuilt) {
|
|
25
26
|
if (await container.supportsOriginalSourceRanges(interval) === true) return container.readSourceRanges(interval);
|
|
27
|
+
// A soundtrack read from its own packets is prepared by walking the
|
|
28
|
+
// clusters that hold them, so those are the bytes it waits for: the map and
|
|
29
|
+
// the start forecast are told them, as for the picture. Told only the
|
|
30
|
+
// packets once the walk had found them, a far piece's bytes were unknown
|
|
31
|
+
// until downloaded, the forecast never stood, and a copied 1080p film did not
|
|
32
|
+
// start in 275 s (r53, torrent-tv/meta#178).
|
|
33
|
+
const walked = await container.packetWalkRanges?.(interval);
|
|
34
|
+
if (walked) return walked;
|
|
26
35
|
// The table is begun, or joined, and not waited for.
|
|
27
36
|
if (container.packetTableWouldWait?.() === true) {
|
|
28
37
|
whenBuilt(container.readPacketIndex(interval).then(() => undefined, () => undefined));
|