@ahmedrowaihi/mediabunny 1.65.2-beta.587 → 1.65.2-beta.593
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/bundles/mediabunny.cjs +34 -2
- package/dist/bundles/mediabunny.min.cjs +35 -35
- package/dist/bundles/mediabunny.min.mjs +34 -34
- package/dist/bundles/mediabunny.mjs +34 -2
- package/dist/bundles/mediabunny.node.cjs +34 -2
- package/dist/mediabunny.d.ts +12 -0
- package/dist/modules/src/mpeg-ts/mpeg-ts-muxer.d.ts +10 -0
- package/dist/modules/src/mpeg-ts/mpeg-ts-muxer.d.ts.map +1 -1
- package/dist/modules/src/mpeg-ts/mpeg-ts-muxer.js +32 -2
- package/dist/modules/src/output-format.d.ts +12 -0
- package/dist/modules/src/output-format.d.ts.map +1 -1
- package/dist/modules/src/output-format.js +4 -0
- package/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/mpeg-ts/mpeg-ts-muxer.ts +37 -3
- package/src/output-format.ts +19 -0
|
@@ -45350,6 +45350,8 @@ ${cue.notes ?? ""}`;
|
|
|
45350
45350
|
this.pendingScte35Sections = [];
|
|
45351
45351
|
this.tablesWritten = false;
|
|
45352
45352
|
this.continuityCounters = /* @__PURE__ */ new Map();
|
|
45353
|
+
/** Stream time the tables were last written at, or null until the first write. */
|
|
45354
|
+
this.lastTableTimestamp = null;
|
|
45353
45355
|
this.packetBuffer = new Uint8Array(TS_PACKET_SIZE);
|
|
45354
45356
|
this.packetView = toDataView(this.packetBuffer);
|
|
45355
45357
|
this.allTracksKnown = promiseWithResolvers();
|
|
@@ -45362,6 +45364,7 @@ ${cue.notes ?? ""}`;
|
|
|
45362
45364
|
this.timestampOffset = format._options.timestampOffset ?? 0;
|
|
45363
45365
|
this.offsetIsStated = format._options.timestampOffset !== void 0;
|
|
45364
45366
|
this.scte35Pid = format._options.scte35Pid ?? null;
|
|
45367
|
+
this.tableRepeatInterval = format._options.tableRepeatInterval ?? 0.1;
|
|
45365
45368
|
}
|
|
45366
45369
|
get maxInterleaveDelta() {
|
|
45367
45370
|
return this.format._options.maxInterleaveDelta ?? DEFAULT_MAX_INTERLEAVE_DELTA;
|
|
@@ -45752,17 +45755,43 @@ ${cue.notes ?? ""}`;
|
|
|
45752
45755
|
}
|
|
45753
45756
|
this.decideTimestampOffset();
|
|
45754
45757
|
const queuedPacket = trackWithMinTimestamp.packetQueue.shift();
|
|
45758
|
+
this.repeatTablesIfDue(queuedPacket);
|
|
45755
45759
|
this.writePesPacket(trackWithMinTimestamp, queuedPacket);
|
|
45756
45760
|
}
|
|
45757
45761
|
if (!isFinalCall) {
|
|
45758
45762
|
await this.writer.flush();
|
|
45759
45763
|
}
|
|
45760
45764
|
}
|
|
45765
|
+
/** PAT then PMT, on their own PIDs, each continuing its own continuity counter. */
|
|
45766
|
+
writeTableSections() {
|
|
45767
|
+
this.writePsiSection(PAT_PID2, PAT_SECTION);
|
|
45768
|
+
this.writePsiSection(PMT_PID, buildPmt(this.trackDatas, this.scte35Pid));
|
|
45769
|
+
}
|
|
45770
|
+
/**
|
|
45771
|
+
* Repeats the tables once the period has elapsed on the stream's own timeline, or a little early to
|
|
45772
|
+
* get in front of a key frame, which is where a receiver joining mid-stream begins.
|
|
45773
|
+
*/
|
|
45774
|
+
repeatTablesIfDue(packet) {
|
|
45775
|
+
if (!Number.isFinite(this.tableRepeatInterval)) {
|
|
45776
|
+
return;
|
|
45777
|
+
}
|
|
45778
|
+
if (this.lastTableTimestamp === null) {
|
|
45779
|
+
this.lastTableTimestamp = packet.presentationTimestamp;
|
|
45780
|
+
return;
|
|
45781
|
+
}
|
|
45782
|
+
const elapsed = packet.presentationTimestamp - this.lastTableTimestamp;
|
|
45783
|
+
const earlyForKeyFrame = packet.isKeyframe && elapsed >= this.tableRepeatInterval / 2;
|
|
45784
|
+
if (elapsed < this.tableRepeatInterval && !earlyForKeyFrame) {
|
|
45785
|
+
return;
|
|
45786
|
+
}
|
|
45787
|
+
this.writePsiSection(PAT_PID2, PAT_SECTION);
|
|
45788
|
+
this.writePsiSection(PMT_PID, buildPmt(this.trackDatas, this.scte35Pid));
|
|
45789
|
+
this.lastTableTimestamp = packet.presentationTimestamp;
|
|
45790
|
+
}
|
|
45761
45791
|
writeTables() {
|
|
45762
45792
|
assert(!this.tablesWritten);
|
|
45763
|
-
this.writePsiSection(PAT_PID2, PAT_SECTION);
|
|
45764
45793
|
this.pcrPid = pcrTrackOf(this.trackDatas)?.pid ?? null;
|
|
45765
|
-
this.
|
|
45794
|
+
this.writeTableSections();
|
|
45766
45795
|
this.tablesWritten = true;
|
|
45767
45796
|
this.flushScte35Sections();
|
|
45768
45797
|
}
|
|
@@ -53087,6 +53116,9 @@ ${cue.text}
|
|
|
53087
53116
|
if (options.scte35Pid !== void 0 && (!Number.isInteger(options.scte35Pid) || options.scte35Pid < 16 || options.scte35Pid > 8190)) {
|
|
53088
53117
|
throw new TypeError("options.scte35Pid, when provided, must be an integer between 0x0010 and 0x1ffe.");
|
|
53089
53118
|
}
|
|
53119
|
+
if (options.tableRepeatInterval !== void 0 && !(options.tableRepeatInterval > 0)) {
|
|
53120
|
+
throw new TypeError("options.tableRepeatInterval, when provided, must be a positive number.");
|
|
53121
|
+
}
|
|
53090
53122
|
if (options.maxInterleaveDelta !== void 0 && !(options.maxInterleaveDelta > 0)) {
|
|
53091
53123
|
throw new TypeError("options.maxInterleaveDelta, when provided, must be a positive number.");
|
|
53092
53124
|
}
|