@danything/arib 1.3.1 → 2.1.0

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/synth.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * TS のセクションを組み立てる。
3
3
  *
4
4
  * 実チューナーが無いので、解析のテストにも偽エージェントにも「それらしい TS」が要る。
5
- * 読む側 (psi.ts・eit.ts・dsmcc.ts・ait.ts、denpa の logo.ts など) と対になる書く側で、ここだけが仕様の写し。
5
+ * 読む側 (psi.ts・eit.ts・dsmcc.ts・ait.ts、denpa の logo.ts など) と対になる書く側で、仕様を書き写しているのはここだけ。
6
6
  */
7
7
  import { joinBytes } from "./bytes.js";
8
8
  import { PACKET, SYNC, withCrc } from "./psi.js";
@@ -10,7 +10,7 @@ import { PACKET, SYNC, withCrc } from "./psi.js";
10
10
  export { withCrc };
11
11
  const be = (value) => [(value >> 8) & 0xff, value & 0xff];
12
12
  const be32 = (value) => [...be(value >>> 16), ...be(value & 0xffff)];
13
- /** セクションの頭 8 バイト (長さは `withCrc` が埋める) */
13
+ /** セクションの先頭 8 バイト (長さは `withCrc` が埋める) */
14
14
  function head(tableId, extension, part = {}) {
15
15
  return [
16
16
  tableId,
@@ -22,7 +22,7 @@ function head(tableId, extension, part = {}) {
22
22
  part.lastSectionNumber ?? 0,
23
23
  ];
24
24
  }
25
- /** PCR の基準部 (90kHz) を適応フィールドに書く (旗は呼ぶ側)。拡張部 (27MHz の端数) は読む側が見ていないので 0 */
25
+ /** PCR の基準部 (90kHz) を適応フィールドに書く (フラグは呼ぶ側が立てる)。拡張部 (27MHz の端数) は読む側が見ていないので 0 */
26
26
  export function putPcr(packet, pcr) {
27
27
  const base = Math.round(pcr) % 2 ** 33;
28
28
  packet[6] = Math.floor(base / 2 ** 25) & 0xff;
@@ -96,7 +96,7 @@ function encodeSiText(text) {
96
96
  }
97
97
  /** 言語の符号 "jpn" (ISO 639-2) */
98
98
  const JPN = [0x6a, 0x70, 0x6e];
99
- /** 長さ 1 バイトを頭に付けた文字列。SI の記述子はどこもこの形式 */
99
+ /** 長さ 1 バイトを先頭に付けた文字列。SI の記述子はどこもこの形式 */
100
100
  const sized = (text) => {
101
101
  const body = encodeSiText(text);
102
102
  return [body.length, ...body];
@@ -305,7 +305,7 @@ export function terrestrialDeliveryDescriptor(areaCode, frequencies) {
305
305
  ];
306
306
  return [0xfa, body.length, ...body];
307
307
  }
308
- /** セクションを TS パケットに詰める。頭のパケットには pointer_field が付く */
308
+ /** セクションを TS パケットに詰める。最初のパケットには pointer_field が付く */
309
309
  export function packetize(pid, section, counter = 0) {
310
310
  const packets = [];
311
311
  let data = [0x00, ...section]; // pointer_field = 0
@@ -320,7 +320,7 @@ export function packetize(pid, section, counter = 0) {
320
320
  }
321
321
  return Uint8Array.from(packets);
322
322
  }
323
- /** 部品を 1 本のバイト列に繋ぐ。組んだパケットを流し込むときの糊 */
323
+ /** 部品を 1 本のバイト列に繋ぐ。組んだパケットを流し込むときに使う */
324
324
  export function stream(...parts) {
325
325
  return joinBytes(parts);
326
326
  }
@@ -350,7 +350,7 @@ export function patSection(programs, transportStreamId = 1) {
350
350
  return withCrc(body);
351
351
  }
352
352
  /**
353
- * PMT。ロゴのカルーセルが乗る ES を 1 つだけ持たせる。
353
+ * PMT。ロゴのカルーセルを運ぶ ES を 1 つだけ持たせる。
354
354
  * 目印は stream_identifier_descriptor (0x52) の component_tag
355
355
  */
356
356
  export function pmtSection(serviceId, esPid, componentTag) {
@@ -538,7 +538,7 @@ export function bmlPmt() {
538
538
  ],
539
539
  ]);
540
540
  }
541
- /** PAT と PMT。データ放送のストリームの頭 */
541
+ /** PAT と PMT。データ放送のストリームの先頭 */
542
542
  export function bmlHead() {
543
543
  return [
544
544
  packetize(0x0000, patSection([[BML_TS.service, BML_TS.pmtPid]])),
@@ -547,7 +547,7 @@ export function bmlHead() {
547
547
  }
548
548
  /**
549
549
  * モジュール 1 つぶんの中身。**放送は multipart/mixed で複数のファイルを詰める。**
550
- * 本物と同じく、頭に Content-Type、境界で区切って各ファイルに Content-Location
550
+ * 本物と同じく、先頭に Content-Type、境界で区切って各ファイルに Content-Location
551
551
  */
552
552
  export function multipartModule(files) {
553
553
  const boundary = "denpa";
@@ -565,7 +565,7 @@ export function aitSignallingDescriptor(applicationType = 0x0010, version = 1) {
565
565
  /**
566
566
  * AIT (table_id 0x74)。**Hybridcast のアプリのアドレス (URL) が載っている表。**
567
567
  *
568
- * 中身そのものは電波に乗っていないので、ここに入るのは URL と名前だけ
568
+ * アプリそのものは放送では送られていないので、ここに入るのは URL と名前だけ
569
569
  */
570
570
  export function aitSection(applications, applicationType = 0x0010) {
571
571
  const loop = [];
@@ -578,7 +578,7 @@ export function aitSection(applications, applicationType = 0x0010) {
578
578
  }
579
579
  if (app.base !== undefined) {
580
580
  const base = [...new TextEncoder().encode(app.base)];
581
- // transport_protocol_descriptor: protocol_id=3 (通信路)、label、URL の頭
581
+ // transport_protocol_descriptor: protocol_id=3 (通信路)、label、URL の先頭部分
582
582
  info.push(0x02, 5 + base.length, ...be(0x0003), 0x01, base.length, ...base, 0x00);
583
583
  }
584
584
  if (app.path !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danything/arib",
3
- "version": "1.3.1",
3
+ "version": "2.1.0",
4
4
  "description": "日本のデジタル放送 (ARIB) の TS を読む: PSI・PES・EIT・ARIB の文字・字幕・データ放送",
5
5
  "license": "MIT",
6
6
  "repository": {