81 bool has_cached_secondary_ddt =
86 TRACE(
"Writing cached secondary DDT table to file");
93 if(end_of_file & alignment_mask)
96 uint64_t aligned_position = end_of_file + alignment_mask & ~alignment_mask;
99 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
100 end_of_file = aligned_position;
102 TRACE(
"Aligned DDT write position from %ld to %" PRIu64
" (alignment shift: %d)",
103 ftell(ctx->
imageStream) - (aligned_position - end_of_file), aligned_position,
122 ddt_header.
blocks = items_per_ddt_entry;
123 ddt_header.
entries = items_per_ddt_entry;
127 ddt_header.
length = items_per_ddt_entry *
sizeof(uint64_t);
131 if(crc64_context != NULL)
137 ddt_header.
crc64 = crc64;
140 uint8_t *buffer = NULL;
150 buffer = malloc((
size_t)ddt_header.
length * 2);
153 TRACE(
"Failed to allocate memory for secondary DDT v2 compression");
157 size_t dst_size = (size_t)ddt_header.
length * 2 * 2;
164 ddt_header.
cmpLength = (uint32_t)dst_size;
193 const uint64_t new_secondary_table_block_offset =
199 TRACE(
"Updating index for cached secondary DDT");
208 for(
unsigned int k = 0; k < utarray_len(ctx->
index_entries); k++)
214 TRACE(
"Found old DDT index entry at position %u, removing", k);
225 new_ddt_entry.
offset = end_of_file;
229 TRACE(
"Added new DDT index entry at offset %" PRIu64, end_of_file);
237 size_t primary_written_bytes = 0;
240 if(primary_written_bytes != 1)
242 TRACE(
"Could not flush primary DDT table to file.");
249 TRACE(
"Failed to write cached secondary DDT data");
252 TRACE(
"Failed to write cached secondary DDT header");
289 TRACE(
"Writing cached primary DDT table back to file");
293 if(crc64_context != NULL)
313 TRACE(
"Calculated CRC64 for primary DDT: 0x%16lX", crc64);
320 if(headerWritten != 1)
322 TRACE(
"Failed to write primary DDT header to file");
330 size_t written_bytes = 0;
333 if(written_bytes == 1)
335 TRACE(
"Successfully wrote primary DDT header and table to file (%" PRIu64
" entries, %zu bytes)",
339 TRACE(
"Removing any previously existing primary DDT index entries");
340 for(
int k = utarray_len(ctx->
index_entries) - 1; k >= 0; k--)
345 TRACE(
"Found existing primary DDT index entry at position %d, removing", k);
351 TRACE(
"Adding primary DDT to index");
362 TRACE(
"Failed to write primary DDT table to file");
388 TRACE(
"Writing single-level DDT table to file");
409 uint8_t *cmp_buffer = NULL;
421 if(cmp_buffer == NULL)
423 TRACE(
"Failed to allocate memory for secondary DDT v2 compression");
460 if(ddt_position & alignment_mask)
462 const uint64_t aligned_position = ddt_position + alignment_mask & ~alignment_mask;
463 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
464 ddt_position = aligned_position;
468 if(header_written != 1)
470 TRACE(
"Failed to write single-level DDT header to file");
475 size_t written_bytes = 0;
481 if(written_bytes == 1)
483 TRACE(
"Successfully wrote single-level DDT header and table to file (%" PRIu64
484 " entries, %zu bytes, %zu compressed bytes)",
488 TRACE(
"Removing any previously existing single-level DDT index entries");
489 for(
int k = utarray_len(ctx->
index_entries) - 1; k >= 0; k--)
494 TRACE(
"Found existing single-level DDT index entry at position %d, removing", k);
500 TRACE(
"Adding single-level DDT to index");
504 single_ddt_entry.
offset = ddt_position;
508 TRACE(
"Added single-level DDT index entry at offset %" PRIu64, ddt_position);
511 TRACE(
"Failed to write single-level DDT table data to file");
628 uint64_t max_key = 0;
630 HASH_ITER(hh, ctx->
tape_ddt, entry, tmp)
631 if(entry->
key > max_key) max_key = entry->
key;
653 TRACE(
"Failed to allocate memory for tape DDT table");
658 HASH_ITER(hh, ctx->
tape_ddt, entry, tmp)
683 uint64_t alignment_mask;
684 uint64_t aligned_position;
720 if(!has_checksums)
return;
729 if(checksum_position & alignment_mask)
731 aligned_position = checksum_position + alignment_mask & ~alignment_mask;
732 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
733 checksum_position = aligned_position;
737 fseek(ctx->
imageStream,
sizeof(checksum_header), SEEK_CUR);
741 TRACE(
"Writing MD5 checksum entry");
753 TRACE(
"Writing SHA1 checksum entry");
765 TRACE(
"Writing SHA256 checksum entry");
777 TRACE(
"Writing SpamSum checksum entry");
789 TRACE(
"Writing BLAKE3 checksum entry");
791 blake3_entry.
length = BLAKE3_OUT_LEN;
800 fseek(ctx->
imageStream, checksum_position, SEEK_SET);
801 TRACE(
"Writing checksum header");
805 TRACE(
"Adding checksum block to index");
809 checksum_index_entry.
offset = checksum_position;
811 utarray_push_back(ctx->
index_entries, &checksum_index_entry);
813 TRACE(
"Added checksum block index entry at offset %" PRIu64, checksum_position);
835 if(tracks_position & alignment_mask)
837 uint64_t aligned_position = tracks_position + alignment_mask & ~alignment_mask;
838 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
839 tracks_position = aligned_position;
842 TRACE(
"Writing tracks block at position %ld", tracks_position);
847 size_t written_entries =
854 TRACE(
"Adding tracks block to index");
859 tracks_index_entry.
offset = tracks_position;
862 TRACE(
"Added tracks block index entry at offset %" PRIu64, tracks_position);
885 long mode2_subheaders_position = ftell(ctx->
imageStream);
888 if(mode2_subheaders_position & alignment_mask)
890 uint64_t aligned_position = mode2_subheaders_position + alignment_mask & ~alignment_mask;
891 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
892 mode2_subheaders_position = aligned_position;
895 TRACE(
"Writing MODE 2 subheaders block at position %ld", mode2_subheaders_position);
907 uint8_t *buffer = NULL;
917 buffer = malloc((
size_t)subheaders_block.
length * 2);
920 TRACE(
"Failed to allocate memory for MODE 2 subheaders compression");
924 size_t dst_size = (size_t)subheaders_block.
length * 2 * 2;
929 subheaders_block.
cmpLength = (uint32_t)dst_size;
947 const size_t length_to_write = subheaders_block.
cmpLength;
956 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
957 if(written_bytes == 1)
959 TRACE(
"Successfully wrote MODE 2 subheaders block (%" PRIu64
" bytes)", subheaders_block.
cmpLength);
961 TRACE(
"Adding MODE 2 subheaders block to index");
965 mode2_subheaders_index_entry.
offset = mode2_subheaders_position;
966 utarray_push_back(ctx->
index_entries, &mode2_subheaders_index_entry);
968 TRACE(
"Added MODE 2 subheaders block index entry at offset %" PRIu64, mode2_subheaders_position);
1005 if(prefix_position & alignment_mask)
1007 uint64_t aligned_position = prefix_position + alignment_mask & ~alignment_mask;
1008 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
1009 prefix_position = aligned_position;
1012 TRACE(
"Writing sector prefix block at position %ld", prefix_position);
1022 uint8_t *buffer = NULL;
1032 buffer = malloc((
size_t)prefix_block.
length * 2);
1035 TRACE(
"Failed to allocate memory for CD sector prefix compression");
1039 size_t dst_size = (size_t)prefix_block.
length * 2 * 2;
1044 prefix_block.
cmpLength = (uint32_t)dst_size;
1062 const size_t length_to_write = prefix_block.
cmpLength;
1071 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
1072 if(written_bytes == 1)
1074 TRACE(
"Successfully wrote CD sector prefix block (%" PRIu64
" bytes)", prefix_block.
cmpLength);
1076 TRACE(
"Adding CD sector prefix block to index");
1080 prefix_index_entry.
offset = prefix_position;
1083 TRACE(
"Added CD sector prefix block index entry at offset %" PRIu64, prefix_position);
1129 if(suffix_position & alignment_mask)
1131 const uint64_t aligned_position = suffix_position + alignment_mask & ~alignment_mask;
1132 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
1133 suffix_position = aligned_position;
1136 TRACE(
"Writing sector suffix block at position %ld", suffix_position);
1146 uint8_t *buffer = NULL;
1156 buffer = malloc((
size_t)suffix_block.
length * 2);
1159 TRACE(
"Failed to allocate memory for CD sector suffix compression");
1163 size_t dst_size = (size_t)suffix_block.
length * 2 * 2;
1168 suffix_block.
cmpLength = (uint32_t)dst_size;
1186 const size_t length_to_write = suffix_block.
cmpLength;
1195 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
1196 if(written_bytes == 1)
1198 TRACE(
"Successfully wrote CD sector suffix block (%" PRIu64
" bytes)", suffix_block.
cmpLength);
1200 TRACE(
"Adding CD sector suffix block to index");
1204 suffix_index_entry.
offset = suffix_position;
1207 TRACE(
"Added CD sector suffix block index entry at offset %" PRIu64, suffix_position);
1246 long prefix_ddt_position = ftell(ctx->
imageStream);
1249 if(prefix_ddt_position & alignment_mask)
1251 const uint64_t aligned_position = prefix_ddt_position + alignment_mask & ~alignment_mask;
1252 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
1253 prefix_ddt_position = aligned_position;
1256 TRACE(
"Writing sector prefix DDT v2 at position %ld", prefix_ddt_position);
1271 ddt_header2.
start = 0;
1272 ddt_header2.
length = ddt_header2.
entries *
sizeof(uint64_t);
1276 uint8_t *buffer = NULL;
1286 buffer = malloc((
size_t)ddt_header2.
length * 2);
1289 TRACE(
"Failed to allocate memory for sector prefix DDT v2 compression");
1293 size_t dst_size = (size_t)ddt_header2.
length * 2 * 2;
1296 lzma_properties, &props_size, 9, ctx->
lzma_dict_size, 4, 0, 2, 273, 8);
1298 ddt_header2.
cmpLength = (uint32_t)dst_size;
1316 const size_t length_to_write = ddt_header2.
cmpLength;
1325 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
1326 if(written_bytes == 1)
1328 TRACE(
"Successfully wrote sector prefix DDT v2 (%" PRIu64
" bytes)", ddt_header2.
cmpLength);
1330 TRACE(
"Adding sector prefix DDT v2 to index");
1334 prefix_ddt_index_entry.
offset = prefix_ddt_position;
1335 utarray_push_back(ctx->
index_entries, &prefix_ddt_index_entry);
1337 TRACE(
"Added sector prefix DDT v2 index entry at offset %" PRIu64, prefix_ddt_position);
1392 long suffix_ddt_position = ftell(ctx->
imageStream);
1395 if(suffix_ddt_position & alignment_mask)
1397 const uint64_t aligned_position = suffix_ddt_position + alignment_mask & ~alignment_mask;
1398 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
1399 suffix_ddt_position = aligned_position;
1402 TRACE(
"Writing sector suffix DDT v2 at position %ld", suffix_ddt_position);
1417 ddt_header2.
start = 0;
1418 ddt_header2.
length = ddt_header2.
entries *
sizeof(uint64_t);
1422 uint8_t *buffer = NULL;
1432 buffer = malloc((
size_t)ddt_header2.
length * 2);
1435 TRACE(
"Failed to allocate memory for sector suffix DDT v2 compression");
1439 size_t dst_size = (size_t)ddt_header2.
length * 2 * 2;
1442 lzma_properties, &props_size, 9, ctx->
lzma_dict_size, 4, 0, 2, 273, 8);
1444 ddt_header2.
cmpLength = (uint32_t)dst_size;
1462 const size_t length_to_write = ddt_header2.
cmpLength;
1471 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
1472 if(written_bytes == 1)
1474 TRACE(
"Successfully wrote sector suffix DDT v2 (%" PRIu64
" bytes)", ddt_header2.
cmpLength);
1476 TRACE(
"Adding sector suffix DDT v2 to index");
1480 suffix_ddt_index_entry.
offset = suffix_ddt_position;
1481 utarray_push_back(ctx->
index_entries, &suffix_ddt_index_entry);
1483 TRACE(
"Added sector suffix DDT v2 index entry at offset %" PRIu64, suffix_ddt_position);
1555 if(block_position & alignment_mask)
1557 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
1558 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
1559 block_position = aligned_position;
1562 TRACE(
"Writing sector subchannel block at position %ld", block_position);
1568 bool owns_buffer =
false;
1581 uint8_t *cst_buffer = malloc(subchannel_block.
length);
1583 if(cst_buffer == NULL)
1585 TRACE(
"Failed to allocate memory for Claunia Subchannel Transform output");
1589 uint8_t *dst_buffer = malloc(subchannel_block.
length);
1591 if(dst_buffer == NULL)
1593 TRACE(
"Failed to allocate memory for LZMA output");
1599 size_t dst_size = subchannel_block.
length;
1607 if(dst_size < subchannel_block.
length)
1610 subchannel_block.
cmpLength = (uint32_t)dst_size;
1611 buffer = dst_buffer;
1641 TRACE(
"Incorrect media type, not writing sector subchannel block");
1647 uint8_t *dst_buffer = malloc(subchannel_block.
length);
1649 if(dst_buffer == NULL)
1651 TRACE(
"Failed to allocate memory for LZMA output");
1655 size_t dst_size = subchannel_block.
length;
1659 lzma_properties, &props_size, 9, ctx->
lzma_dict_size, 4, 0, 2, 273, 8);
1661 if(dst_size < subchannel_block.
length)
1663 subchannel_block.
cmpLength = (uint32_t)dst_size;
1664 buffer = dst_buffer;
1676 TRACE(
"Incorrect media type, not writing sector subchannel block");
1687 const size_t length_to_write = subchannel_block.
cmpLength;
1696 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
1697 if(written_bytes == 1)
1699 TRACE(
"Successfully wrote sector subchannel block (%" PRIu64
" bytes)", subchannel_block.
cmpLength);
1701 TRACE(
"Adding sector subchannel block to index");
1704 subchannel_index_entry.
dataType = subchannel_block.
type;
1705 subchannel_index_entry.
offset = block_position;
1706 utarray_push_back(ctx->
index_entries, &subchannel_index_entry);
1708 TRACE(
"Added sector subchannel block index entry at offset %" PRIu64, block_position);
1712 if(owns_buffer) free(buffer);
1856 uint64_t total_sectors =
1863 if(id_position & alignment_mask)
1865 const uint64_t aligned_position = id_position + alignment_mask & ~alignment_mask;
1866 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
1867 id_position = aligned_position;
1869 TRACE(
"Writing DVD sector ID block at position %ld", id_position);
1874 id_block.
length = (uint32_t)total_sectors * 4;
1879 uint8_t *buffer = NULL;
1889 buffer = malloc((
size_t)id_block.
length * 2);
1892 TRACE(
"Failed to allocate memory for DVD sector ID compression");
1896 size_t dst_size = (size_t)id_block.
length * 2 * 2;
1901 id_block.
cmpLength = (uint32_t)dst_size;
1919 size_t length_to_write = id_block.
cmpLength;
1928 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
1929 if(written_bytes == 1)
1931 TRACE(
"Successfully wrote DVD sector ID block (%" PRIu64
" bytes)", id_block.
cmpLength);
1933 TRACE(
"Adding DVD sector ID block to index");
1937 id_index_entry.
offset = id_position;
1940 TRACE(
"Added DVD sector ID block index entry at offset %" PRIu64, id_position);
1949 if(ied_position & alignment_mask)
1951 const uint64_t aligned_position = ied_position + alignment_mask & ~alignment_mask;
1952 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
1953 ied_position = aligned_position;
1955 TRACE(
"Writing DVD sector IED block at position %ld", ied_position);
1960 ied_block.
length = (uint32_t)total_sectors * 2;
1973 buffer = malloc((
size_t)ied_block.
length * 2);
1976 TRACE(
"Failed to allocate memory for DVD sector IED compression");
1980 size_t dst_size = (size_t)ied_block.
length * 2 * 2;
1985 ied_block.
cmpLength = (uint32_t)dst_size;
2012 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
2013 if(written_bytes == 1)
2015 TRACE(
"Successfully wrote DVD sector IED block (%" PRIu64
" bytes)", ied_block.
cmpLength);
2017 TRACE(
"Adding DVD sector IED block to index");
2021 ied_index_entry.
offset = ied_position;
2024 TRACE(
"Added DVD sector IED block index entry at offset %" PRIu64, ied_position);
2033 if(cpr_mai_position & alignment_mask)
2035 const uint64_t aligned_position = cpr_mai_position + alignment_mask & ~alignment_mask;
2036 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
2037 cpr_mai_position = aligned_position;
2039 TRACE(
"Writing DVD sector CPR/MAI block at position %ld", cpr_mai_position);
2044 cpr_mai_block.
length = (uint32_t)total_sectors * 6;
2057 buffer = malloc((
size_t)cpr_mai_block.
length * 2);
2060 TRACE(
"Failed to allocate memory for DVD sector CPR/MAI compression");
2064 size_t dst_size = (size_t)cpr_mai_block.
length * 2 * 2;
2069 cpr_mai_block.
cmpLength = (uint32_t)dst_size;
2087 length_to_write = cpr_mai_block.
cmpLength;
2096 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
2097 if(written_bytes == 1)
2099 TRACE(
"Successfully wrote DVD sector CPR/MAI block (%" PRIu64
" bytes)", cpr_mai_block.
cmpLength);
2101 TRACE(
"Adding DVD sector CPR/MAI block to index");
2105 cpr_mai_index_entry.
offset = cpr_mai_position;
2106 utarray_push_back(ctx->
index_entries, &cpr_mai_index_entry);
2108 TRACE(
"Added DVD sector CPR/MAI block index entry at offset %" PRIu64, cpr_mai_position);
2117 if(edc_position & alignment_mask)
2119 const uint64_t aligned_position = edc_position + alignment_mask & ~alignment_mask;
2120 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
2121 edc_position = aligned_position;
2123 TRACE(
"Writing DVD sector EDC block at position %ld", edc_position);
2128 edc_block.
length = (uint32_t)total_sectors * 4;
2141 buffer = malloc((
size_t)edc_block.
length * 2);
2144 TRACE(
"Failed to allocate memory for DVD sector EDC compression");
2148 size_t dst_size = (size_t)edc_block.
length * 2 * 2;
2153 edc_block.
cmpLength = (uint32_t)dst_size;
2180 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
2181 if(written_bytes == 1)
2183 TRACE(
"Successfully wrote DVD sector EDC block (%" PRIu64
" bytes)", edc_block.
cmpLength);
2185 TRACE(
"Adding DVD sector EDC block to index");
2189 edc_index_entry.
offset = edc_position;
2192 TRACE(
"Added DVD sector EDC block index entry at offset %" PRIu64, edc_position);
2303 if(block_position & alignment_mask)
2305 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
2306 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
2307 block_position = aligned_position;
2309 TRACE(
"Writing DVD decrypted title key block at position %ld", block_position);
2314 decrypted_title_key_block.
length =
2318 decrypted_title_key_block.
crc64 =
2321 uint8_t *buffer = NULL;
2327 decrypted_title_key_block.
cmpCrc64 = decrypted_title_key_block.
crc64;
2331 buffer = malloc((
size_t)decrypted_title_key_block.
length * 2);
2334 TRACE(
"Failed to allocate memory for DVD decrypted title key compression");
2338 size_t dst_size = (size_t)decrypted_title_key_block.
length * 2 * 2;
2341 lzma_properties, &props_size, 9, ctx->
lzma_dict_size, 4, 0, 2, 273, 8);
2343 decrypted_title_key_block.
cmpLength = (uint32_t)dst_size;
2345 if(decrypted_title_key_block.
cmpLength >= decrypted_title_key_block.
length)
2355 decrypted_title_key_block.
cmpLength = decrypted_title_key_block.
length;
2356 decrypted_title_key_block.
cmpCrc64 = decrypted_title_key_block.
crc64;
2361 const size_t length_to_write = decrypted_title_key_block.
cmpLength;
2371 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
2372 if(written_bytes == 1)
2374 TRACE(
"Successfully wrote DVD decrypted title key block (%" PRIu64
" bytes)",
2377 TRACE(
"Adding DVD decrypted title key block to index");
2381 decrypted_title_key_index_entry.
offset = block_position;
2382 utarray_push_back(ctx->
index_entries, &decrypted_title_key_index_entry);
2384 TRACE(
"Added DVD decrypted title key block index entry at offset %" PRIu64, block_position);
2469 HASH_ITER(hh, ctx->
mediaTags, media_tag, tmp_media_tag)
2474 if(tag_position & alignment_mask)
2476 const uint64_t aligned_position = tag_position + alignment_mask & ~alignment_mask;
2477 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
2478 tag_position = aligned_position;
2492 uint8_t *buffer = NULL;
2497 buffer = media_tag->
data;
2502 buffer = malloc((
size_t)tag_block.
length * 2);
2505 TRACE(
"Failed to allocate memory for media tag compression");
2509 size_t dst_size = (size_t)tag_block.
length * 2 * 2;
2514 tag_block.
cmpLength = (uint32_t)dst_size;
2520 buffer = media_tag->
data;
2532 const size_t length_to_write = tag_block.
cmpLength;
2541 const size_t written_bytes = fwrite(buffer, length_to_write, 1, ctx->
imageStream);
2542 if(written_bytes == 1)
2544 TRACE(
"Successfully wrote media tag block type %d (%" PRIu64
" bytes)", tag_block.
type,
2547 TRACE(
"Adding media tag type %d block to index", tag_block.
type);
2551 tag_index_entry.
offset = tag_position;
2554 TRACE(
"Added media tag block type %d index entry at offset %" PRIu64, tag_block.
type, tag_position);
2731 size_t tape_file_count = 0;
2732 HASH_ITER(hh, ctx->
tape_files, tape_file, tmp_tape_file) tape_file_count++;
2735 const size_t buffer_size = tape_file_count *
sizeof(
TapeFileEntry);
2739 TRACE(
"Failed to allocate memory for tape file entries");
2742 memset(buffer, 0, buffer_size);
2744 HASH_ITER(hh, ctx->
tape_files, tape_file, tmp_tape_file)
2746 if(index >= tape_file_count)
break;
2754 tape_file_block.
length = (uint32_t)buffer_size;
2761 if(block_position & alignment_mask)
2763 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
2764 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
2765 block_position = aligned_position;
2767 TRACE(
"Writing tape file block at position %ld", block_position);
2770 const size_t written_bytes = fwrite(buffer, tape_file_block.
length, 1, ctx->
imageStream);
2771 if(written_bytes == 1)
2773 TRACE(
"Successfully wrote tape file block (%" PRIu64
" bytes)", tape_file_block.
length);
2775 TRACE(
"Adding tape file block to index");
2779 index_entry.
offset = block_position;
2782 TRACE(
"Added tape file block index entry at offset %" PRIu64, block_position);
2964 size_t tape_partition_count = 0;
2965 HASH_ITER(hh, ctx->
tape_partitions, tape_partition, tmp_tape_partition) tape_partition_count++;
2972 TRACE(
"Failed to allocate memory for tape partition entries");
2975 memset(buffer, 0, buffer_size);
2977 HASH_ITER(hh, ctx->
tape_partitions, tape_partition, tmp_tape_partition)
2979 if(index >= tape_partition_count)
break;
2987 tape_partition_block.
length = (uint32_t)buffer_size;
2994 if(block_position & alignment_mask)
2996 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
2997 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
2998 block_position = aligned_position;
3000 TRACE(
"Writing tape partition block at position %ld", block_position);
3003 const size_t written_bytes = fwrite(buffer, tape_partition_block.
length, 1, ctx->
imageStream);
3004 if(written_bytes == 1)
3006 TRACE(
"Successfully wrote tape partition block (%" PRIu64
" bytes)", tape_partition_block.
length);
3008 TRACE(
"Adding tape partition block to index");
3012 index_entry.
offset = block_position;
3015 TRACE(
"Added tape partition block index entry at offset %" PRIu64, block_position);
3090 if(block_position & alignment_mask)
3092 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
3093 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
3094 block_position = aligned_position;
3097 TRACE(
"Writing geometry block at position %ld", block_position);
3102 TRACE(
"Successfully wrote geometry block");
3105 TRACE(
"Adding geometry block to index");
3109 index_entry.
offset = block_position;
3112 TRACE(
"Added geometry block index entry at offset %" PRIu64, block_position);
3244 if(buffer == NULL)
return;
3332 if(block_position & alignment_mask)
3334 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
3335 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
3336 block_position = aligned_position;
3341 TRACE(
"Writing metadata block at position %ld", block_position);
3345 TRACE(
"Successfully wrote metadata block");
3348 TRACE(
"Adding metadata block to index");
3352 index_entry.
offset = block_position;
3355 TRACE(
"Added metadata block index entry at offset %" PRIu64, block_position);
3515 uint8_t *buffer = calloc(1, required_length);
3517 if(buffer == NULL)
return;
3534 if(offset + entry_size > required_length)
3536 FATAL(
"Calculated size exceeds provided buffer length");
3618 if(block_position & alignment_mask)
3620 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
3621 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
3622 block_position = aligned_position;
3624 TRACE(
"Writing dump hardware block at position %ld", block_position);
3625 if(fwrite(buffer, required_length, 1, ctx->
imageStream) == 1)
3627 TRACE(
"Successfully wrote dump hardware block");
3630 TRACE(
"Adding dump hardware block to index");
3634 index_entry.
offset = block_position;
3637 TRACE(
"Added dump hardware block index entry at offset %" PRIu64, block_position);
3746 if(block_position & alignment_mask)
3748 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
3749 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
3750 block_position = aligned_position;
3753 TRACE(
"Writing CICM XML block at position %ld", block_position);
3757 TRACE(
"Successfully wrote CICM XML block");
3760 TRACE(
"Adding CICM XML block to index");
3764 index_entry.
offset = block_position;
3767 TRACE(
"Added CICM XML block index entry at offset %" PRIu64, block_position);
3885 if(block_position & alignment_mask)
3887 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
3888 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
3889 block_position = aligned_position;
3892 TRACE(
"Writing Aaru metadata JSON block at position %ld", block_position);
3896 TRACE(
"Successfully wrote Aaru metadata JSON block");
3899 TRACE(
"Adding Aaru metadata JSON block to index");
3903 index_entry.
offset = block_position;
3906 TRACE(
"Added Aaru metadata JSON block index entry at offset %" PRIu64, block_position);
3929 TRACE(
"Writing index at the end of the file");
3935 if(index_position & alignment_mask)
3937 uint64_t aligned_position = index_position + alignment_mask & ~alignment_mask;
3938 fseek(ctx->
imageStream, aligned_position, SEEK_SET);
3939 index_position = aligned_position;
3940 TRACE(
"Aligned index position to %" PRIu64, aligned_position);
3949 TRACE(
"Writing index with %" PRIu64
" entries at position %ld", index_header.
entries, index_position);
3953 if(index_crc64_context != NULL && index_header.
entries > 0)
3958 TRACE(
"Calculated index CRC64: 0x%16lX", index_header.
crc64);
3961 index_header.
crc64 = 0;
3966 TRACE(
"Successfully wrote index header");
3971 size_t entries_written = 0;
3979 TRACE(
"Wrote index entry: blockType=0x%08X dataType=%u offset=%" PRIu64, entry->
blockType,
3984 TRACE(
"Failed to write index entry %zu", entries_written);
3988 if(entries_written == index_header.
entries)
3990 TRACE(
"Successfully wrote all %zu index entries", entries_written);
3999 TRACE(
"Successfully updated header with index offset");
4002 TRACE(
"Failed to update header with index offset");
4008 TRACE(
"Failed to write all index entries (wrote %zu of %" PRIu64
")", entries_written,
4016 TRACE(
"Failed to write index header");
4061 TRACE(
"Entering aaruf_close(%p)", context);
4068 FATAL(
"Invalid context");
4078 FATAL(
"Invalid context");
4085 TRACE(
"File is writing");
4087 TRACE(
"Seeking to start of image");
4091 TRACE(
"Writing header at position 0");
4101 TRACE(
"Closing current block if any");
4206 TRACE(
"Clearing sector hash map");
4213 TRACE(
"Freeing memory pointers");
4241 TRACE(
"Freeing media tags");
4245 free(media_tag->
data);
4250 TRACE(
"Unmapping user data DDT if it is not in memory");
4318 TRACE(
"Exiting aaruf_close() = 0");
void write_dvd_long_sector_blocks(aaruformat_context *ctx)
Serialize DVD long sector auxiliary data blocks to the image file.
static int32_t write_primary_ddt(aaruformat_context *ctx)
Write (flush) the multi-level primary DDT table header and data back to its file offset.
static void write_cicm_block(aaruformat_context *ctx)
Serialize the CICM XML metadata block to the image file.
static void write_sector_subchannel(aaruformat_context *ctx)
Serialize the per-sector subchannel or tag data block.
static int32_t write_index_block(aaruformat_context *ctx)
Serialize the accumulated index entries at the end of the image and back-patch the header.
static void write_media_tags(aaruformat_context *ctx)
Serialize all accumulated media tags to the image file.
static void write_dvd_title_key_decrypted_block(aaruformat_context *ctx)
Serialize the DVD decrypted title key data block to the image file.
int aaruf_close(void *context)
Close an Aaru image context, flushing pending data structures and releasing resources.
static int32_t write_single_level_ddt(aaruformat_context *ctx)
Serialize a single-level DDT (tableShift == 0) directly after its header.
static void write_tape_file_block(aaruformat_context *ctx)
Serialize the tape file metadata block to the image file.
static void write_dumphw_block(aaruformat_context *ctx)
Serialize the dump hardware block containing acquisition environment information.
static void write_checksum_block(aaruformat_context *ctx)
Finalize any active checksum calculations and append a checksum block.
static void write_sector_suffix(aaruformat_context *ctx)
Serialize the optional CD sector suffix block (EDC/ECC region capture).
static void write_sector_suffix_ddt(aaruformat_context *ctx)
Serialize the per-sector CD suffix status / index DeDuplication Table (DDT v2, suffix variant).
static void write_tracks_block(aaruformat_context *ctx)
Serialize the tracks metadata block and add it to the index.
static void write_aaru_json_block(aaruformat_context *ctx)
Serialize the Aaru metadata JSON block to the image file.
static void write_geometry_block(aaruformat_context *ctx)
Serialize the geometry metadata block to the image file.
static void write_mode2_subheaders_block(aaruformat_context *ctx)
Serialize a MODE 2 (XA) subheaders data block.
static void write_tape_partition_block(aaruformat_context *ctx)
Serialize the tape partition metadata block to the image file.
static void write_sector_prefix_ddt(aaruformat_context *ctx)
Serialize the per-sector CD prefix status / index DeDuplication Table (DDT v2, prefix variant).
static int32_t write_tape_ddt(aaruformat_context *ctx)
Converts tape DDT hash table to array format and writes it as a single-level DDT.
static int32_t write_cached_secondary_ddt(aaruformat_context *ctx)
Flush a cached secondary (child) DeDuplication Table (DDT) to the image.
static void write_metadata_block(aaruformat_context *ctx)
Serialize the metadata block containing image and media descriptive information.
static void write_sector_prefix(aaruformat_context *ctx)
Serialize the optional CD sector prefix block.
#define LZMA_PROPERTIES_LENGTH
Size in bytes of the fixed LZMA properties header (lc/lp/pb + dictionary size).
#define AARU_MAGIC
Magic identifier for AaruFormat container (ASCII "AARUFRMT").
#define MD5_DIGEST_LENGTH
struct TapeFileHashEntry tapeFileHashEntry
void aaruf_sha1_final(sha1_ctx *ctx, unsigned char *result)
int32_t aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, size_t length)
Transforms interleaved subchannel data to sequential format.
int32_t aaruf_lzma_encode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t src_size, uint8_t *out_props, size_t *out_props_size, int32_t level, uint32_t dict_size, int32_t lc, int32_t lp, int32_t pb, int32_t fb, int32_t num_threads)
Encodes a buffer using LZMA compression.
uint64_t aaruf_crc64_data(const uint8_t *data, uint32_t len)
int aaruf_crc64_update(crc64_ctx *ctx, const uint8_t *data, uint32_t len)
Updates the CRC64 context with new data.
void aaruf_sha256_final(sha256_ctx *ctx, unsigned char *result)
crc64_ctx * aaruf_crc64_init()
Initializes a CRC64 context.
void aaruf_md5_final(md5_ctx *ctx, unsigned char *result)
void aaruf_spamsum_free(spamsum_ctx *ctx)
Frees a spamsum (fuzzy hash) context.
int32_t aaruf_get_datatype_for_media_tag_type(int32_t tag_type)
Converts an Aaru media tag type to an image data type.
int aaruf_spamsum_final(spamsum_ctx *ctx, uint8_t *result)
int aaruf_crc64_final(crc64_ctx *ctx, uint64_t *crc)
Computes the final CRC64 value from the context.
@ IndexBlock3
Block containing the index v3.
@ ChecksumBlock
Block containing contents checksums.
@ DataBlock
Block containing data.
@ TapePartitionBlock
Block containing list of partitions for a tape image.
@ GeometryBlock
Block containing logical geometry.
@ DeDuplicationTableSecondary
Block containing a secondary deduplication table (v2).
@ AaruMetadataJsonBlock
Block containing JSON version of Aaru Metadata.
@ CicmBlock
Block containing CICM XML metadata.
@ DeDuplicationTable2
Block containing a deduplication table v2.
@ TapeFileBlock
Block containing list of files for a tape image.
@ DumpHardwareBlock
Block containing an array of hardware used to create the image.
@ MetadataBlock
Block containing metadata.
@ TracksBlock
Block containing optical disc tracks.
@ OpticalDisc
Purely optical discs.
@ BlockMedia
Media that is physically block-based or abstracted like that.
@ SpamSum
SpamSum (context-triggered piecewise hash).
@ CdSectorSubchannel
Compact Disc subchannel data.
@ AppleProfileTag
Apple Profile (20‑byte) tag.
@ DvdSectorIed
DVD ID Error Detection Code (IED)
@ DvdSectorCprMai
DVD Copyright Management Information (CPR_MAI)
@ AppleSonyTag
Apple Sony (12‑byte) tag.
@ CdSectorPrefix
Compact Disc sector prefix (sync, header).
@ PriamDataTowerTag
Priam Data Tower (24‑byte) tag.
@ UserData
User (main) data.
@ DvdSectorEdc
DVD Error Detection Code (EDC)
@ DvdSectorTitleKeyDecrypted
Decrypted DVD Title Key.
@ DvdSectorId
DVD Identification Data (ID)
@ CdSectorSuffix
Compact Disc sector suffix (EDC, ECC P, ECC Q).
@ CompactDiscMode2Subheader
Compact Disc MODE 2 subheader.
@ AARU_FEATURE_RW_BLAKE3
BLAKE3 checksum is present (read/write support for BLAKE3 hashes).
@ AARUF_STATUS_INVALID_CONTEXT
Provided context/handle is invalid.
@ LzmaClauniaSubchannelTransform
LZMA applied to Claunia Subchannel Transform processed data.
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
#define AARUF_ERROR_NOT_ENOUGH_MEMORY
Memory allocation failure (critical).
#define AARUF_ERROR_CANNOT_WRITE_HEADER
Failure writing container header.
void free_map(hash_map_t *map)
Frees all memory associated with a hash map.
int32_t aaruf_close_current_block(aaruformat_context *ctx)
Finalizes and writes the current data block to the AaruFormat image file.
#define SHA1_DIGEST_LENGTH
#define SHA256_DIGEST_LENGTH
Per-checksum metadata immediately followed by the digest / signature bytes.
uint32_t length
Length in bytes of the digest that immediately follows this structure.
uint8_t type
Algorithm used (value from ChecksumAlgorithm).
uint8_t * spamsum
SpamSum fuzzy hash (ASCII), allocated length+1 with trailing 0.
bool hasSha256
True if sha256[] buffer populated.
uint8_t sha1[20]
SHA-1 digest (20 bytes).
uint8_t sha256[32]
SHA-256 digest (32 bytes).
uint8_t md5[16]
MD5 digest (16 bytes).
bool hasSpamSum
True if spamsum pointer allocated and signature read.
bool hasSha1
True if sha1[] buffer populated.
uint8_t blake3[BLAKE3_OUT_LEN]
BLAKE3 digest (32 bytes).
bool hasMd5
True if md5[] buffer populated.
bool hasBlake3
True if blake3[] buffer populated.
Inclusive [start,end] logical sector range contributed by a single hardware environment.
uint8_t * firmware
Firmware version string or NULL.
uint8_t * revision
Hardware revision string or NULL.
uint8_t * model
Model string or NULL.
uint8_t * softwareName
Dump software name or NULL.
struct DumpExtent * extents
Array of extents (entry.extents elements) or NULL.
uint8_t * manufacturer
Manufacturer string (UTF-8) or NULL.
uint8_t * softwareVersion
Dump software version or NULL.
uint8_t * serial
Serial number string or NULL.
DumpHardwareEntry entry
Fixed-size header with lengths & counts.
uint8_t * softwareOperatingSystem
Host operating system string or NULL.
Per-environment length table describing subsequent UTF-8 strings and optional extent array.
uint32_t softwareNameLength
Length in bytes of dumping software name string.
uint32_t manufacturerLength
Length in bytes of manufacturer UTF-8 string.
uint32_t softwareVersionLength
Length in bytes of dumping software version string.
uint32_t firmwareLength
Length in bytes of firmware version string.
uint32_t extents
Number of DumpExtent records following the strings (0 = none).
uint32_t modelLength
Length in bytes of model UTF-8 string.
uint32_t serialLength
Length in bytes of device serial number string.
uint32_t revisionLength
Length in bytes of revision / hardware revision string.
uint32_t softwareOperatingSystemLength
Length in bytes of host operating system string.
uint32_t MediaType
Media type identifier (see MediaType enum; 0=Unknown)
uint8_t MetadataMediaType
Media type for sidecar generation (internal archival use)
uint64_t Sectors
Total count of addressable logical sectors/blocks.
Single index entry describing a block's type, (optional) data classification, and file offset.
uint32_t blockType
Block identifier of the referenced block (value from BlockType).
uint64_t offset
Absolute byte offset in the image where the referenced block header begins.
uint16_t dataType
Data classification (value from DataType) or unused for untyped blocks.
uint64_t key
Key: sector address.
uint64_t value
Value: DDT entry.
Describes a single logical file on a tape medium.
TapeFileEntry fileEntry
The actual tape file data.
Describes a single physical partition on a tape medium.
TapePartitionEntry partitionEntry
The actual tape partition data.
Single optical disc track descriptor (sequence, type, LBAs, session, ISRC, flags).
Master context representing an open or in‑creation Aaru image.
uint8_t * media_barcode
Barcode of the media represented by the image.
DdtHeader2 user_data_ddt_header
Active user data DDT v2 header (primary table meta).
Checksums checksums
Whole-image checksums discovered.
uint8_t * creator
Who (person) created the image?
bool dirty_checksum_block
True if checksum block should be written during close.
bool deduplicate
Storage deduplication active (duplicates coalesce).
bool compression_enabled
True if block compression enabled (writing path).
uint8_t * cicm_block
CICM XML payload.
uint8_t * sector_cpr_mai
DVD sector CPR_MAI (6 bytes) if present.
bool dirty_media_tags
True if media tags should be written during close.
hash_map_t * sector_hash_map
Deduplication hash map (fingerprint->entry mapping).
uint8_t * sector_prefix_corrected
Corrected variant (post error correction) if stored.
uint64_t * user_data_ddt
Legacy flat DDT pointer (NULL when using v2 mini/big arrays).
sha256_ctx sha256_context
Opaque SHA-256 context for streaming updates.
bool calculating_sha256
True if whole-image SHA-256 being calculated on-the-fly.
bool dirty_primary_ddt
True if primary DDT table should be written during close.
uint8_t * drive_firmware_revision
Firmware revision of the drive used to read the media represented by the image.
uint8_t * media_serial_number
Serial number of the media represented by the image.
uint8_t * sector_ied
DVD sector IED (2 bytes) if present.
md5_ctx md5_context
Opaque MD5 context for streaming updates.
bool dirty_sector_suffix_block
True if sector suffix block should be written during close.
uint64_t * user_data_ddt2
DDT entries (big variant) primary/secondary current.
MetadataBlockHeader metadata_block_header
Metadata block header.
uint8_t * sector_prefix
Raw per-sector prefix (e.g., sync+header) uncorrected.
bool dirty_dvd_title_key_decrypted_block
True if decrypted title key block should be written during close.
uint64_t * sector_suffix_ddt2
CD sector suffix DDT V2.
tapeFileHashEntry * tape_files
Hash table root for tape files.
bool dirty_mode2_subheaders_block
True if MODE2 subheader block should be written during close.
bool dirty_tape_partition_block
True if tape partition block should be written during close.
uint64_t cached_ddt_offset
File offset of currently cached secondary DDT (0=none).
bool dirty_cicm_block
True if CICM metadata block should be written during close.
bool is_tape
True if the image is a tape image.
uint8_t * sector_edc
DVD sector EDC (4 bytes) if present.
bool calculating_sha1
True if whole-image SHA-1 being calculated on-the-fly.
uint8_t * media_model
Model of the media represented by the image.
bool dirty_tracks_block
True if tracks block should be written during close.
uint8_t * drive_serial_number
Serial number of the drive used to read the media represented by the image.
CdEccContext * ecc_cd_context
CD ECC/EDC helper tables (allocated on demand).
uint32_t * sector_suffix_ddt
Legacy CD sector suffix DDT.
bool dirty_sector_prefix_block
True if sector prefix block should be written during close.
uint8_t * drive_manufacturer
Manufacturer of the drive used to read the media represented by the image.
bool in_memory_ddt
True if primary (and possibly secondary) DDT loaded.
bool dirty_index_block
True if index block should be written during close.
uint8_t * sector_suffix
Raw per-sector suffix (EDC/ECC) uncorrected.
AaruHeaderV2 header
Parsed container header (v2).
bool dirty_json_block
True if JSON metadata block should be written during close.
bool is_writing
True if context opened/created for writing.
TapeDdtHashEntry * tape_ddt
Hash table root for tape DDT entries.
spamsum_ctx * spamsum_context
Opaque SpamSum context for streaming updates.
CicmMetadataBlock cicm_block_header
CICM metadata header (if present).
size_t sector_prefix_offset
Current position in sector_prefix.
uint8_t * drive_model
Model of the drive used to read the media represented by the image.
bool dirty_single_level_ddt
True if single-level DDT should be written during close.
uint64_t magic
File magic (AARU_MAGIC) post-open.
uint8_t * writing_buffer
Accumulation buffer for current block data.
uint64_t * sector_prefix_ddt2
CD sector prefix DDT V2.
bool calculating_spamsum
True if whole-image SpamSum being calculated on-the-fly.
uint64_t primary_ddt_offset
File offset of the primary DDT v2 table.
mediaTagEntry * mediaTags
Hash table of extra media tags (uthash root).
blake3_hasher * blake3_context
Opaque BLAKE3 context for streaming updates.
bool calculating_blake3
True if whole-image BLAKE3 being calculated on-the-fly.
struct DumpHardwareEntriesWithData * dump_hardware_entries_with_data
Array of dump hardware entries + strings.
bool calculating_md5
True if whole-image MD5 being calculated on-the-fly.
bool dirty_sector_suffix_ddt
True if sector suffix DDT should be written during close.
GeometryBlockHeader geometry_block
Logical geometry block (if present).
size_t sector_suffix_offset
Current position in sector_suffix.
uint64_t * cached_secondary_ddt2
Cached secondary table (big entries) or NULL.
uint8_t * json_block
JSON metadata block payload (UTF-8).
uint8_t * media_part_number
Part number of the media represented by the image.
uint8_t * sector_decrypted_title_key
DVD decrypted title key (5 bytes) if present.
bool dirty_dumphw_block
True if dump hardware block should be written during close.
AaruMetadataJsonBlockHeader json_block_header
JSON metadata block header (if present).
bool dirty_metadata_block
True if metadata block should be written during close.
uint8_t * sector_subchannel
Raw 96-byte subchannel (if captured).
uint8_t * comments
Image comments.
bool dirty_sector_subchannel_block
True if subchannel block should be written during close.
FILE * imageStream
Underlying FILE* stream (binary mode).
bool dirty_dvd_long_sector_blocks
True if DVD long sector blocks should be written during close.
bool dirty_sector_prefix_ddt
True if sector prefix DDT should be written during close.
UT_array * index_entries
Flattened index entries (UT_array of IndexEntry).
bool dirty_tape_file_block
True if tape file block should be written during close.
uint8_t * mode2_subheaders
MODE2 Form1/Form2 8-byte subheaders (concatenated).
ImageInfo image_info
Exposed high-level image info summary.
uint8_t * sector_id
DVD sector ID (4 bytes) if present.
DumpHardwareHeader dump_hardware_header
Dump hardware header.
sha1_ctx sha1_context
Opaque SHA-1 context for streaming updates.
bool dirty_secondary_ddt
True if secondary DDT tables should be written during close.
bool * readableSectorTags
Per-sector boolean array (optical tags read successfully?).
bool dirty_tape_ddt
True if tape DDT should be written during close.
TapePartitionHashEntry * tape_partitions
Hash table root for tape partitions.
uint32_t * sector_prefix_ddt
Legacy CD sector prefix DDT (deprecated by *2).
uint32_t lzma_dict_size
LZMA dictionary size (writing path).
TrackEntry * track_entries
Full track list (tracksHeader.entries elements).
uint8_t * sector_suffix_corrected
Corrected suffix if stored separately.
uint8_t * metadata_block
Raw metadata UTF-16LE concatenated strings.
uint64_t cached_ddt_position
Position index of cached secondary DDT.
uint8_t * media_title
Title of the media represented by the image.
bool dirty_geometry_block
True if geometry block should be written during close.
size_t mapped_memory_ddt_size
Length of mmapped DDT if userDataDdt is mmapped.
uint8_t * media_manufacturer
Manufacturer of the media represented by the image.
TracksHeader tracks_header
Tracks header (optical) if present.
Minimal ECMA-182 CRC64 incremental state container (running value only).
Hash table entry for an arbitrary media tag (e.g., proprietary drive/medium descriptor).
uint8_t * data
Tag data blob (opaque to library core); length bytes long.
int32_t type
Numeric type identifier.
uint32_t length
Length in bytes of data.