@ahmedrowaihi/mediabunny 1.65.2-beta.721 → 1.65.2-beta.723
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 +37 -29
- package/dist/bundles/mediabunny.min.cjs +4 -4
- package/dist/bundles/mediabunny.min.mjs +4 -4
- package/dist/bundles/mediabunny.mjs +37 -29
- package/dist/bundles/mediabunny.node.cjs +37 -29
- package/dist/mediabunny.d.ts +68 -4
- package/dist/modules/src/hls/hls-manifest-emitter.js +9 -2
- package/dist/modules/src/index.d.ts +1 -0
- package/dist/modules/src/index.d.ts.map +1 -1
- package/dist/modules/src/mpeg-ts/mpeg-ts-muxer.d.ts.map +1 -1
- package/dist/modules/src/mpeg-ts/mpeg-ts-muxer.js +10 -4
- package/dist/modules/src/mpeg-ts/scte35-output.d.ts +53 -1
- package/dist/modules/src/mpeg-ts/scte35-output.d.ts.map +1 -1
- package/dist/modules/src/mpeg-ts/scte35-output.js +15 -2
- package/dist/modules/src/mpeg-ts/scte35.d.ts +14 -3
- package/dist/modules/src/mpeg-ts/scte35.d.ts.map +1 -1
- package/dist/modules/src/mpeg-ts/scte35.js +21 -15
- package/dist/modules/src/segment-pipeline-muxer.d.ts.map +1 -1
- package/dist/modules/src/segment-pipeline-muxer.js +9 -2
- package/dist/modules/src/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/hls/hls-manifest-emitter.ts +10 -2
- package/src/index.ts +1 -0
- package/src/mpeg-ts/mpeg-ts-muxer.ts +11 -4
- package/src/mpeg-ts/scte35-output.ts +77 -2
- package/src/mpeg-ts/scte35.ts +36 -19
- package/src/segment-pipeline-muxer.ts +11 -2
|
@@ -47287,15 +47287,14 @@ ${cue.notes ?? ""}`;
|
|
|
47287
47287
|
this.writeTsPacket(NULL_PACKET_PID, false, null, this.payloadBuffer);
|
|
47288
47288
|
}
|
|
47289
47289
|
writeTsPacket(pid, pusi, adaptationField, payload) {
|
|
47290
|
-
const cc = this.continuityCounters.get(pid) ?? 0;
|
|
47291
47290
|
const hasPayload = payload.length > 0;
|
|
47291
|
+
const previous = this.continuityCounters.get(pid);
|
|
47292
|
+
const cc = previous === void 0 ? 0 : hasPayload ? previous + 1 & 15 : previous;
|
|
47292
47293
|
const adaptCtrl = adaptationField ? hasPayload ? 3 : 2 : hasPayload ? 1 : 0;
|
|
47293
47294
|
this.packetBuffer[0] = 71;
|
|
47294
47295
|
this.packetView.setUint16(1, (pusi ? 16384 : 0) | pid & 8191, false);
|
|
47295
47296
|
this.packetBuffer[3] = adaptCtrl << 4 | cc & 15;
|
|
47296
|
-
|
|
47297
|
-
this.continuityCounters.set(pid, cc + 1 & 15);
|
|
47298
|
-
}
|
|
47297
|
+
this.continuityCounters.set(pid, cc);
|
|
47299
47298
|
let offset = 4;
|
|
47300
47299
|
if (adaptationField) {
|
|
47301
47300
|
this.packetBuffer.set(adaptationField, offset);
|
|
@@ -52125,8 +52124,8 @@ ${cue.notes ?? ""}`;
|
|
|
52125
52124
|
);
|
|
52126
52125
|
continue;
|
|
52127
52126
|
}
|
|
52128
|
-
const attribute = cue.outOfNetwork === false ? "SCTE35-IN" : "SCTE35-
|
|
52129
|
-
text += `#EXT-X-DATERANGE:ID="${this.nextDaterangeId++}",START-DATE="${date}"` + (cue.outOfNetwork
|
|
52127
|
+
const attribute = cue.outOfNetwork === true ? "SCTE35-OUT" : cue.outOfNetwork === false ? "SCTE35-IN" : "SCTE35-CMD";
|
|
52128
|
+
text += `#EXT-X-DATERANGE:ID="${this.nextDaterangeId++}",START-DATE="${date}"` + (cue.outOfNetwork === true && cue.breakDuration !== null ? `,PLANNED-DURATION=${+cue.breakDuration.toFixed(3)}` : "") + `,${attribute}=0x${bytesToHexString(cue.section).toUpperCase()}
|
|
52130
52129
|
`;
|
|
52131
52130
|
}
|
|
52132
52131
|
return text;
|
|
@@ -52556,7 +52555,7 @@ ${cue.notes ?? ""}`;
|
|
|
52556
52555
|
var SPLICE_IMMEDIATE_FLAG = 16;
|
|
52557
52556
|
var TIME_SIGNAL = 6;
|
|
52558
52557
|
var SEGMENTATION_DESCRIPTOR_TAG = 2;
|
|
52559
|
-
var
|
|
52558
|
+
var AVAIL_START_TYPE_IDS = /* @__PURE__ */ new Set([
|
|
52560
52559
|
34,
|
|
52561
52560
|
// Break Start
|
|
52562
52561
|
48,
|
|
@@ -52565,22 +52564,10 @@ ${cue.notes ?? ""}`;
|
|
|
52565
52564
|
// Distributor Advertisement Start
|
|
52566
52565
|
52,
|
|
52567
52566
|
// Provider Placement Opportunity Start
|
|
52568
|
-
54
|
|
52567
|
+
54
|
|
52569
52568
|
// Distributor Placement Opportunity Start
|
|
52570
|
-
56,
|
|
52571
|
-
// Provider Overlay Placement Opportunity Start
|
|
52572
|
-
58,
|
|
52573
|
-
// Distributor Overlay Placement Opportunity Start
|
|
52574
|
-
64,
|
|
52575
|
-
// Unscheduled Event Start
|
|
52576
|
-
66,
|
|
52577
|
-
// Alternate Content Opportunity Start
|
|
52578
|
-
68,
|
|
52579
|
-
// Provider Ad Block Start
|
|
52580
|
-
70
|
|
52581
|
-
// Distributor Ad Block Start
|
|
52582
52569
|
]);
|
|
52583
|
-
var
|
|
52570
|
+
var AVAIL_END_TYPE_IDS = new Set([...AVAIL_START_TYPE_IDS].map((id) => id + 1));
|
|
52584
52571
|
var readU163 = (bytes2, offset) => bytes2[offset] << 8 | bytes2[offset + 1];
|
|
52585
52572
|
var readU323 = (bytes2, offset) => (bytes2[offset] << 24 | bytes2[offset + 1] << 16 | bytes2[offset + 2] << 8 | bytes2[offset + 3]) >>> 0;
|
|
52586
52573
|
var read33Bits = (bytes2, offset, lowBitsOfFirstByte) => {
|
|
@@ -52729,7 +52716,13 @@ ${cue.notes ?? ""}`;
|
|
|
52729
52716
|
const commandType = section[13];
|
|
52730
52717
|
const wrap = (ticks) => ticks % TIMESTAMP_MODULUS / MPEG_TS_TIMESCALE;
|
|
52731
52718
|
const base = { section, commandType, ptsAdjustment };
|
|
52732
|
-
const nothing = {
|
|
52719
|
+
const nothing = {
|
|
52720
|
+
...base,
|
|
52721
|
+
time: null,
|
|
52722
|
+
outOfNetwork: null,
|
|
52723
|
+
breakDuration: null,
|
|
52724
|
+
segmentationTypeId: null
|
|
52725
|
+
};
|
|
52733
52726
|
if (encrypted || commandLength === 0) {
|
|
52734
52727
|
return nothing;
|
|
52735
52728
|
}
|
|
@@ -52740,7 +52733,8 @@ ${cue.notes ?? ""}`;
|
|
|
52740
52733
|
const withSegmentation = {
|
|
52741
52734
|
...nothing,
|
|
52742
52735
|
outOfNetwork: segmentation?.outOfNetwork ?? null,
|
|
52743
|
-
breakDuration: segmentation?.duration ?? null
|
|
52736
|
+
breakDuration: segmentation?.duration ?? null,
|
|
52737
|
+
segmentationTypeId: segmentation?.typeId ?? null
|
|
52744
52738
|
};
|
|
52745
52739
|
if (commandPos + 5 > section.length || (section[commandPos] & 128) === 0) {
|
|
52746
52740
|
return withSegmentation;
|
|
@@ -52851,8 +52845,8 @@ ${cue.notes ?? ""}`;
|
|
|
52851
52845
|
return null;
|
|
52852
52846
|
}
|
|
52853
52847
|
const typeId = section[at];
|
|
52854
|
-
const outOfNetwork =
|
|
52855
|
-
return { outOfNetwork, duration };
|
|
52848
|
+
const outOfNetwork = AVAIL_START_TYPE_IDS.has(typeId) ? true : AVAIL_END_TYPE_IDS.has(typeId) ? false : null;
|
|
52849
|
+
return { outOfNetwork, duration, typeId };
|
|
52856
52850
|
}
|
|
52857
52851
|
return null;
|
|
52858
52852
|
};
|
|
@@ -54300,8 +54294,13 @@ ${cue.notes ?? ""}`;
|
|
|
54300
54294
|
*
|
|
54301
54295
|
* @internal
|
|
54302
54296
|
*/
|
|
54303
|
-
writeScte35Section(section) {
|
|
54304
|
-
const
|
|
54297
|
+
writeScte35Section(section, options = {}) {
|
|
54298
|
+
const read = parseSpliceInfoSection(section);
|
|
54299
|
+
const parsed = {
|
|
54300
|
+
...read,
|
|
54301
|
+
outOfNetwork: options.outOfNetwork === void 0 ? read.outOfNetwork : options.outOfNetwork,
|
|
54302
|
+
breakDuration: options.breakDuration === void 0 ? read.breakDuration : options.breakDuration
|
|
54303
|
+
};
|
|
54305
54304
|
this.pendingScte35.push({ section, parsed, mediaTime: parsed.time, placedIn: /* @__PURE__ */ new Set() });
|
|
54306
54305
|
}
|
|
54307
54306
|
toMediaTimestamp(timestamp) {
|
|
@@ -68043,16 +68042,25 @@ ${baseUrl}${p.getFileName()}`;
|
|
|
68043
68042
|
};
|
|
68044
68043
|
|
|
68045
68044
|
// src/mpeg-ts/scte35-output.ts
|
|
68046
|
-
var addScte35Section = (output, section) => {
|
|
68045
|
+
var addScte35Section = (output, section, options = {}) => {
|
|
68047
68046
|
if (!(section instanceof Uint8Array)) {
|
|
68048
68047
|
throw new TypeError("section must be a Uint8Array.");
|
|
68049
68048
|
}
|
|
68050
68049
|
if (section.length < 3) {
|
|
68051
68050
|
throw new InvalidUsageError("A splice_info_section is at least three bytes.");
|
|
68052
68051
|
}
|
|
68052
|
+
if (!options || typeof options !== "object") {
|
|
68053
|
+
throw new TypeError("options must be an object.");
|
|
68054
|
+
}
|
|
68055
|
+
if (options.outOfNetwork !== void 0 && options.outOfNetwork !== null && typeof options.outOfNetwork !== "boolean") {
|
|
68056
|
+
throw new TypeError("options.outOfNetwork, when provided, must be a boolean or null.");
|
|
68057
|
+
}
|
|
68058
|
+
if (options.breakDuration !== void 0 && options.breakDuration !== null && !(options.breakDuration >= 0)) {
|
|
68059
|
+
throw new TypeError("options.breakDuration, when provided, must be a non-negative number or null.");
|
|
68060
|
+
}
|
|
68053
68061
|
const muxer = output._muxer;
|
|
68054
68062
|
if (muxer instanceof SegmentPipelineMuxer) {
|
|
68055
|
-
muxer.writeScte35Section(section);
|
|
68063
|
+
muxer.writeScte35Section(section, options);
|
|
68056
68064
|
return;
|
|
68057
68065
|
}
|
|
68058
68066
|
if (!(muxer instanceof MpegTsMuxer)) {
|