9 // 2-STD-B10v4_6.pdf p89 (101/399)
10 int parseBIThead(unsigned char *data, BIThead *head) {
13 memset(head, 0, sizeof(BIThead));
15 head->table_id = getBit(data, &boff, 8);
16 head->section_syntax_indicator = getBit(data, &boff, 1);
17 head->reserved_future_use1 = getBit(data, &boff, 1);
18 head->reserved1 = getBit(data, &boff, 2);
19 head->section_length = getBit(data, &boff, 12);
20 head->original_network_id = getBit(data, &boff, 16);
21 head->reserved2 = getBit(data, &boff, 2);
22 head->version_number = getBit(data, &boff, 5);
23 head->current_next_indicator = getBit(data, &boff, 1);
24 head->section_number = getBit(data, &boff, 8);
25 head->last_section_number = getBit(data, &boff, 8);
26 head->reserved_future_use2 = getBit(data, &boff, 3);
27 head->broadcast_view_propriety = getBit(data, &boff, 1);
28 head->first_descriptors_length = getBit(data, &boff, 12);
29 return 10 + head->first_descriptors_length;
32 // 4-TR-B14v4_3-2p3.pdf p4-254 (276/543)
33 int parseBITloop(unsigned char *data, BITloop *loop) {
36 memset(loop, 0, sizeof(BITloop));
38 loop->broadcaster_id = getBit(data, &boff, 8);
39 loop->reserved_future_use = getBit(data, &boff, 4);
40 loop->broadcaster_descriptors_length = getBit(data, &boff, 12);
46 int parseBITdesc(unsigned char *data, BITdesc *desc) {
49 memset(desc, 0, sizeof(BITdesc));
51 desc->descriptor_tag = getBit(data, &boff, 8);
52 desc->descriptor_length = getBit(data, &boff, 8);
53 desc->parameter_version = getBit(data, &boff, 8);
54 desc->update_time = getBit(data, &boff,16);
59 int parseBITtable(unsigned char *data, BITtable *table) {
62 memset(table, 0, sizeof(BITtable));
64 table->table_id = getBit(data, &boff, 8);
65 table->table_description_length = getBit(data, &boff, 8);
66 table->table_cycle = getBit(data, &boff, 16);
68 return table->table_description_length + 2;
71 void dumpBIT(unsigned char *ptr)
84 len = parseBIThead(ptr, &bith);
86 loop_len = bith.section_length - (len - 3 + 4); // 3は共通ヘッダ長 4はCRC
89 len = parseBITloop(ptr, &bitl);
93 desc_len = bitl.broadcaster_descriptors_length;
97 len = parseBITdesc(ptr, &bitd);
101 table_len = bitd.descriptor_length - 3;
102 desc_len -= table_len;
104 if ( bitd.descriptor_tag != 0xD7 ) {
109 while(table_len > 0) {
110 len = parseBITtable(ptr, &bitt);
116 0x50(各局伝送パラメータ運用部分の H-EIT[schedule basic])
117 0x58 (各局伝送パラメータ運用部分の H-EIT[schedule extended])
122 if (0) printf("BIT=(%d)%d:%d:%d:%d|0x%x:%d:%d=BCD(%d)\n",
123 bitl.broadcaster_id, bitd.descriptor_tag, bitd.descriptor_length,
124 bitd.parameter_version, bitd.update_time,
125 bitt.table_id, bitt.table_description_length,
126 bitt.table_cycle, BCD(bitt.table_cycle));