mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
75 lines
2.2 KiB
Plaintext
75 lines
2.2 KiB
Plaintext
=== Data Block (`DBLK`)
|
|
|
|
A data block encapsulates media-derived content and is composed of a header followed by either compressed or uncompressed data.
|
|
|
|
The contents of a data block may represent user data—such as media sectors—or auxiliary data elements, including media or sector-specific tags.
|
|
|
|
When a data block includes multiple items (e.g., sectors or sector tags), the `sectorSize` field specifies the size, in bytes, of each individual item.
|
|
Conversely, if the block contains a single item (e.g., media tags), `sectorSize` must be set to 0.
|
|
|
|
==== Structure Definition
|
|
|
|
[source,c]
|
|
#define DATABLOCK_MAGIC 0x4B4C4244
|
|
/**Block header, precedes block data */
|
|
typedef struct BlockHeader
|
|
{
|
|
uint32_t identifier; ///< Block identifier, must be BlockType::DataBlock.
|
|
uint16_t type; ///< Logical data classification (value from \ref DataType).
|
|
uint16_t compression; ///< Compression algorithm used (value from \ref CompressionType).
|
|
uint32_t sectorSize; ///< Size in bytes of each logical sector represented in this block.
|
|
uint32_t cmpLength; ///< Size in bytes of the compressed payload immediately following this header.
|
|
uint32_t length; ///< Size in bytes of the uncompressed payload resulting after decompression.
|
|
uint64_t cmpCrc64; ///< CRC64-ECMA of the compressed payload (cmpLength bytes).
|
|
uint64_t crc64; ///< CRC64-ECMA of the uncompressed payload (length bytes).
|
|
} BlockHeader;
|
|
|
|
==== Field Descriptions
|
|
|
|
[cols="2,2,2,6",options="header"]
|
|
|===
|
|
|Type
|
|
|Size
|
|
|Name
|
|
|Description
|
|
|
|
|uint32_t
|
|
|4 bytes
|
|
|identifier
|
|
|The data block identifier, always `DBLK`
|
|
|
|
|uint16_t
|
|
|2 bytes
|
|
|type
|
|
|The data type contained in this block. See Annex B.
|
|
|
|
|uint16_t
|
|
|2 bytes
|
|
|compression
|
|
|The compression algorithm used in the data. See Annex C.
|
|
|
|
|uint32_t
|
|
|4 bytes
|
|
|sectorSize
|
|
|The size in bytes of the sectors contained in this data block if applicable.
|
|
|
|
|uint32_t
|
|
|4 bytes
|
|
|cmpLength
|
|
|The size in bytes of the compressed data that follows this header.
|
|
|
|
|uint32_t
|
|
|4 bytes
|
|
|length
|
|
|The size in bytes of the data block when decompressed.
|
|
|
|
|uint64_t
|
|
|8 bytes
|
|
|cmpCrc64
|
|
|The CRC64-ECMA checksum of the compressed data that follows this header.
|
|
|
|
|uint64_t
|
|
|8 bytes
|
|
|crc64
|
|
|The CRC64-ECMA checksum of the decompressed data.
|
|
|=== |