@ahmedrowaihi/mediabunny 1.65.2-beta.721 → 1.65.2-beta.722

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.
@@ -52125,8 +52125,8 @@ ${cue.notes ?? ""}`;
52125
52125
  );
52126
52126
  continue;
52127
52127
  }
52128
- const attribute = cue.outOfNetwork === false ? "SCTE35-IN" : "SCTE35-OUT";
52129
- text += `#EXT-X-DATERANGE:ID="${this.nextDaterangeId++}",START-DATE="${date}"` + (cue.outOfNetwork !== false && cue.breakDuration !== null ? `,PLANNED-DURATION=${+cue.breakDuration.toFixed(3)}` : "") + `,${attribute}=0x${bytesToHexString(cue.section).toUpperCase()}
52128
+ const attribute = cue.outOfNetwork === true ? "SCTE35-OUT" : cue.outOfNetwork === false ? "SCTE35-IN" : "SCTE35-CMD";
52129
+ 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
52130
  `;
52131
52131
  }
52132
52132
  return text;
@@ -52556,7 +52556,7 @@ ${cue.notes ?? ""}`;
52556
52556
  var SPLICE_IMMEDIATE_FLAG = 16;
52557
52557
  var TIME_SIGNAL = 6;
52558
52558
  var SEGMENTATION_DESCRIPTOR_TAG = 2;
52559
- var BREAK_START_TYPE_IDS = /* @__PURE__ */ new Set([
52559
+ var AVAIL_START_TYPE_IDS = /* @__PURE__ */ new Set([
52560
52560
  34,
52561
52561
  // Break Start
52562
52562
  48,
@@ -52565,22 +52565,10 @@ ${cue.notes ?? ""}`;
52565
52565
  // Distributor Advertisement Start
52566
52566
  52,
52567
52567
  // Provider Placement Opportunity Start
52568
- 54,
52568
+ 54
52569
52569
  // 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
52570
  ]);
52583
- var BREAK_END_TYPE_IDS = new Set([...BREAK_START_TYPE_IDS].map((id) => id + 1));
52571
+ var AVAIL_END_TYPE_IDS = new Set([...AVAIL_START_TYPE_IDS].map((id) => id + 1));
52584
52572
  var readU163 = (bytes2, offset) => bytes2[offset] << 8 | bytes2[offset + 1];
52585
52573
  var readU323 = (bytes2, offset) => (bytes2[offset] << 24 | bytes2[offset + 1] << 16 | bytes2[offset + 2] << 8 | bytes2[offset + 3]) >>> 0;
52586
52574
  var read33Bits = (bytes2, offset, lowBitsOfFirstByte) => {
@@ -52729,7 +52717,13 @@ ${cue.notes ?? ""}`;
52729
52717
  const commandType = section[13];
52730
52718
  const wrap = (ticks) => ticks % TIMESTAMP_MODULUS / MPEG_TS_TIMESCALE;
52731
52719
  const base = { section, commandType, ptsAdjustment };
52732
- const nothing = { ...base, time: null, outOfNetwork: null, breakDuration: null };
52720
+ const nothing = {
52721
+ ...base,
52722
+ time: null,
52723
+ outOfNetwork: null,
52724
+ breakDuration: null,
52725
+ segmentationTypeId: null
52726
+ };
52733
52727
  if (encrypted || commandLength === 0) {
52734
52728
  return nothing;
52735
52729
  }
@@ -52740,7 +52734,8 @@ ${cue.notes ?? ""}`;
52740
52734
  const withSegmentation = {
52741
52735
  ...nothing,
52742
52736
  outOfNetwork: segmentation?.outOfNetwork ?? null,
52743
- breakDuration: segmentation?.duration ?? null
52737
+ breakDuration: segmentation?.duration ?? null,
52738
+ segmentationTypeId: segmentation?.typeId ?? null
52744
52739
  };
52745
52740
  if (commandPos + 5 > section.length || (section[commandPos] & 128) === 0) {
52746
52741
  return withSegmentation;
@@ -52851,8 +52846,8 @@ ${cue.notes ?? ""}`;
52851
52846
  return null;
52852
52847
  }
52853
52848
  const typeId = section[at];
52854
- const outOfNetwork = BREAK_START_TYPE_IDS.has(typeId) ? true : BREAK_END_TYPE_IDS.has(typeId) ? false : null;
52855
- return { outOfNetwork, duration };
52849
+ const outOfNetwork = AVAIL_START_TYPE_IDS.has(typeId) ? true : AVAIL_END_TYPE_IDS.has(typeId) ? false : null;
52850
+ return { outOfNetwork, duration, typeId };
52856
52851
  }
52857
52852
  return null;
52858
52853
  };
@@ -54300,8 +54295,13 @@ ${cue.notes ?? ""}`;
54300
54295
  *
54301
54296
  * @internal
54302
54297
  */
54303
- writeScte35Section(section) {
54304
- const parsed = parseSpliceInfoSection(section);
54298
+ writeScte35Section(section, options = {}) {
54299
+ const read = parseSpliceInfoSection(section);
54300
+ const parsed = {
54301
+ ...read,
54302
+ outOfNetwork: options.outOfNetwork === void 0 ? read.outOfNetwork : options.outOfNetwork,
54303
+ breakDuration: options.breakDuration === void 0 ? read.breakDuration : options.breakDuration
54304
+ };
54305
54305
  this.pendingScte35.push({ section, parsed, mediaTime: parsed.time, placedIn: /* @__PURE__ */ new Set() });
54306
54306
  }
54307
54307
  toMediaTimestamp(timestamp) {
@@ -68043,16 +68043,25 @@ ${baseUrl}${p.getFileName()}`;
68043
68043
  };
68044
68044
 
68045
68045
  // src/mpeg-ts/scte35-output.ts
68046
- var addScte35Section = (output, section) => {
68046
+ var addScte35Section = (output, section, options = {}) => {
68047
68047
  if (!(section instanceof Uint8Array)) {
68048
68048
  throw new TypeError("section must be a Uint8Array.");
68049
68049
  }
68050
68050
  if (section.length < 3) {
68051
68051
  throw new InvalidUsageError("A splice_info_section is at least three bytes.");
68052
68052
  }
68053
+ if (!options || typeof options !== "object") {
68054
+ throw new TypeError("options must be an object.");
68055
+ }
68056
+ if (options.outOfNetwork !== void 0 && options.outOfNetwork !== null && typeof options.outOfNetwork !== "boolean") {
68057
+ throw new TypeError("options.outOfNetwork, when provided, must be a boolean or null.");
68058
+ }
68059
+ if (options.breakDuration !== void 0 && options.breakDuration !== null && !(options.breakDuration >= 0)) {
68060
+ throw new TypeError("options.breakDuration, when provided, must be a non-negative number or null.");
68061
+ }
68053
68062
  const muxer = output._muxer;
68054
68063
  if (muxer instanceof SegmentPipelineMuxer) {
68055
- muxer.writeScte35Section(section);
68064
+ muxer.writeScte35Section(section, options);
68056
68065
  return;
68057
68066
  }
68058
68067
  if (!(muxer instanceof MpegTsMuxer)) {