@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/README.md +2 -2
- package/dist/ait.d.ts +4 -4
- package/dist/ait.js +5 -5
- package/dist/aribtext-gaiji.d.ts +1 -1
- package/dist/aribtext-gaiji.js +1 -1
- package/dist/aribtext.js +3 -3
- package/dist/b24-tables.d.ts +5 -5
- package/dist/b24-tables.js +42 -42
- package/dist/b24caption.js +7 -4
- package/dist/bml-protocol.d.ts +2 -2
- package/dist/bml-protocol.js +1 -1
- package/dist/bml.d.ts +4 -4
- package/dist/bml.js +8 -8
- package/dist/bytes.d.ts +3 -3
- package/dist/bytes.js +3 -3
- package/dist/caption-text.d.ts +1 -1
- package/dist/drcs-smooth.d.ts +1 -1
- package/dist/drcs-smooth.js +1 -1
- package/dist/dsmcc.d.ts +5 -5
- package/dist/dsmcc.js +4 -4
- package/dist/eit.d.ts +11 -11
- package/dist/eit.js +27 -19
- package/dist/multipart.js +1 -1
- package/dist/pes.d.ts +4 -4
- package/dist/pes.js +10 -10
- package/dist/psi.d.ts +28 -45
- package/dist/psi.js +66 -46
- package/dist/service-filter.d.ts +9 -9
- package/dist/service-filter.js +10 -10
- package/dist/synth-av.d.ts +5 -5
- package/dist/synth-av.js +8 -8
- package/dist/synth-caption.d.ts +1 -1
- package/dist/synth-caption.js +1 -1
- package/dist/synth.d.ts +10 -10
- package/dist/synth.js +11 -11
- package/package.json +1 -1
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
|
-
/**
|
|
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) を適応フィールドに書く (
|
|
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
|
|
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
|
|
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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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) {
|