|
@@ -43,3 +43,17 @@ u_int32_t ts_crc32_section(struct ts_section_header *section_header) {
|
43
|
43
|
// +3 to include the first 3 bytes before section_length field
|
44
|
44
|
return ts_crc32(section_header->section_data, section_header->section_length + 3);
|
45
|
45
|
}
|
|
46
|
+
|
|
47
|
+int ts_crc32_section_check(struct ts_section_header *section_header, char *table) {
|
|
48
|
+ // +3 to include the first 3 bytes before section_length field
|
|
49
|
+ uint32_t check_crc = ts_crc32(section_header->section_data, section_header->section_length + 3);
|
|
50
|
+
|
|
51
|
+ if (check_crc != 0) {
|
|
52
|
+ ts_LOGf("!!! Wrong %s table CRC! It should be 0 but it is 0x%08x (CRC in data is 0x%08x)\n",
|
|
53
|
+ table,
|
|
54
|
+ check_crc,
|
|
55
|
+ section_header->CRC);
|
|
56
|
+ return 0;
|
|
57
|
+ }
|
|
58
|
+ return 1;
|
|
59
|
+}
|