@danything/arib 1.2.2 → 1.3.1

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/bml.js CHANGED
@@ -431,17 +431,22 @@ export class BmlDecoder {
431
431
  const mark = doneMark(component, version);
432
432
  if (component.done.get(moduleId) === mark)
433
433
  return;
434
- component.done.set(moduleId, mark);
435
434
  // 大きさ 0 は伸ばしようが無い。ファイルの無いモジュールとして配り、待っている受け側を終わらせる
436
435
  const empty = held.module.moduleSize === 0;
437
436
  const data = empty
438
437
  ? held.builder.data
439
438
  : inflate(held.builder.data, held.module.compression);
440
- if (data === null)
441
- return;
442
- const files = moduleFiles(data, held.module.contentType);
443
- if (files.length === 0 && !empty)
439
+ const files = data === null ? [] : moduleFiles(data, held.module.contentType);
440
+ /*
441
+ * **伸ばせない・分けられないモジュールは諦める。** 配らずに黙ると、受け側は DII に
442
+ * 載っている限り待ち続ける。ブロックは CRC を通っているので、組み直しても同じ結果になる
443
+ */
444
+ if (files.length === 0 && !empty) {
445
+ component.abandoned.add(moduleId);
446
+ this.sendList(component);
444
447
  return;
448
+ }
449
+ component.done.set(moduleId, mark);
445
450
  this.send({
446
451
  type: "moduleDownloaded",
447
452
  componentId: component.componentId,
package/dist/eit.d.ts CHANGED
@@ -98,6 +98,12 @@ export interface EitEvent {
98
98
  * 詳細の表 (0x58〜) には載らない。詳細だけ届いた回で消さないため (`EpgReader.merge`)
99
99
  */
100
100
  series?: EitSeries | null;
101
+ /**
102
+ * CA契約情報記述子 (0xCB) の contract_verification_info。
103
+ * 有料放送の契約確認・復号判定に使う (B-CAS の 0x90 0x3C コマンド)。
104
+ * 載っていなければ null。詳細の表では言っていないので undefined。
105
+ */
106
+ contractVerification?: Uint8Array | null;
101
107
  }
102
108
  export interface EitSection {
103
109
  tableId: number;
package/dist/eit.js CHANGED
@@ -31,6 +31,7 @@ const DESC_EXTENDED_EVENT = 0x4e;
31
31
  const DESC_COMPONENT = 0x50;
32
32
  const DESC_CONTENT = 0x54;
33
33
  const DESC_AUDIO_COMPONENT = 0xc4;
34
+ const DESC_CA_CONTRACT_INFO = 0xcb;
34
35
  const DESC_SERIES = 0xd5;
35
36
  /** 自局の表か (p/f 0x4E と schedule 0x50〜0x5F)。ほかの TS の schedule (0x60〜0x6F) は下、他局の p/f (0x4F) は読まない */
36
37
  function isEitActual(tableId) {
@@ -241,6 +242,27 @@ function readDescriptors(event, body) {
241
242
  event.copyNever = isCopyNever(data);
242
243
  break;
243
244
  }
245
+ case DESC_CA_CONTRACT_INFO: {
246
+ if (data.length < 4)
247
+ break;
248
+ const caSystemId = (data[0] << 8) | data[1];
249
+ const numOfComponent = data[2] & 0x0f;
250
+ let at = 3 + numOfComponent;
251
+ if (at >= data.length)
252
+ break;
253
+ const cviLength = data[at];
254
+ at++;
255
+ if (at + cviLength <= data.length && cviLength > 0) {
256
+ const cvi = data.subarray(at, at + cviLength);
257
+ // B-CAS (0x0005) を優先。まだ無ければ拾う
258
+ if (caSystemId === 0x0005 ||
259
+ event.contractVerification === undefined ||
260
+ event.contractVerification === null) {
261
+ event.contractVerification = cvi;
262
+ }
263
+ }
264
+ break;
265
+ }
244
266
  /*
245
267
  * series_descriptor (ARIB STD-B10 第 2 部)。
246
268
  *
@@ -333,6 +355,9 @@ export function parseEit(section, options = {}) {
333
355
  copyNever: tableId >= SCHEDULE_ACTUAL_EXTENDED ? null : false,
334
356
  // シリーズも同じ。載っていなければ「シリーズではない」、詳細の表なら「言っていない」
335
357
  ...(tableId >= SCHEDULE_ACTUAL_EXTENDED ? {} : { series: null }),
358
+ ...(tableId >= SCHEDULE_ACTUAL_EXTENDED
359
+ ? {}
360
+ : { contractVerification: null }),
336
361
  };
337
362
  at += 12 + descriptorsLength;
338
363
  if (body.length < descriptorsLength)
@@ -597,6 +622,10 @@ export class EpgReader {
597
622
  ...(event.series === undefined && old.series !== undefined
598
623
  ? { series: old.series }
599
624
  : {}),
625
+ ...(event.contractVerification === undefined &&
626
+ old.contractVerification !== undefined
627
+ ? { contractVerification: old.contractVerification }
628
+ : {}),
600
629
  });
601
630
  }
602
631
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danything/arib",
3
- "version": "1.2.2",
3
+ "version": "1.3.1",
4
4
  "description": "日本のデジタル放送 (ARIB) の TS を読む: PSI・PES・EIT・ARIB の文字・字幕・データ放送",
5
5
  "license": "MIT",
6
6
  "repository": {