Add data type to datastream block

This commit is contained in:
Rebecca Wallander
2026-01-01 00:27:32 +01:00
parent 588b354725
commit 86b6680e3e
5 changed files with 23 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ For other data types, the payload layout is specific to the data type.
typedef struct DataStreamPayloadHeader
{
uint32_t identifier; ///< Block identifier, must be BlockType::DataStreamPayloadBlock (0x4C505344).
uint16_t dataType; ///< Data type classification (value from DataType), e.g., FluxData or BitstreamData.
uint16_t compression; ///< Compression type (0 = None, 1 = Lzma).
uint32_t cmpLength; ///< Compressed length in bytes (includes LZMA properties if compressed).
uint32_t length; ///< Uncompressed length in bytes.
@@ -40,6 +41,11 @@ typedef struct DataStreamPayloadHeader
|identifier
|The data stream payload block identifier, always `DSPL` (`0x4C505344`)
|uint16_t
|2 bytes
|dataType
|The data type contained in this block (value from DataType), e.g., FluxData or BitstreamData. See Annex B.
|uint16_t
|2 bytes
|compression

View File

@@ -201,6 +201,12 @@ typedef struct FluxCaptureMapEntry FluxCaptureMapEntry;
* may be compressed using LZMA compression. Currently used for flux capture data, but
* can be used for other data streams such as bitstreams or PNG data.
*
* **Data Type:**
* The dataType field identifies the type of data stored in the payload. Common values include:
* - FluxData: Flux capture data (data and index buffers)
* - BitstreamData: Bitstream data
* This field enables the block to be self-describing and allows validation of the payload content.
*
* **Compression:**
* The compression field indicates whether the payload is compressed:
* - 0 (None): Payload is stored uncompressed
@@ -226,6 +232,7 @@ typedef struct FluxCaptureMapEntry FluxCaptureMapEntry;
typedef struct DataStreamPayloadHeader
{
uint32_t identifier; ///< Block identifier, must be BlockType::DataStreamPayloadBlock (0x4C505344, "DSPL").
uint16_t dataType; ///< Data type classification (value from \ref DataType), e.g., FluxData or BitstreamData.
uint16_t compression; ///< Compression type: 0 = None, 1 = Lzma.
uint32_t cmpLength; ///< Compressed length in bytes (includes LZMA properties if compression = Lzma).
uint32_t length; ///< Uncompressed length in bytes.

View File

@@ -832,6 +832,14 @@ static int32_t read_flux_payload_header(const aaruformat_context *ctx, uint64_t
return AARUF_ERROR_CANNOT_READ_BLOCK;
}
if(header->dataType != FluxData)
{
FATAL("Incorrect data type %u for flux payload at offset %" PRIu64 " (expected FluxData)", header->dataType,
payload_offset);
TRACE("Exiting read_flux_payload_header() = AARUF_ERROR_CANNOT_READ_BLOCK\n");
return AARUF_ERROR_CANNOT_READ_BLOCK;
}
return AARUF_STATUS_OK;
}

View File

@@ -4468,6 +4468,7 @@ static int32_t write_flux_capture_payload(aaruformat_context *ctx, FluxCaptureRe
DataStreamPayloadHeader payload_header = {0};
payload_header.identifier = DataStreamPayloadBlock;
payload_header.dataType = FluxData;
payload_header.compression = (uint16_t)compression;
payload_header.cmpLength = cmp_length;
payload_header.length = (uint32_t)raw_length;

View File

@@ -1164,6 +1164,7 @@ struct FluxDataBlock
struct DataStreamPayloadHeader
{
BlockType identifier;
u16 dataType;
u16 compression;
u32 cmpLength;
u32 length;