Add function to write per-sector tag data for optical and block media

This commit is contained in:
2025-10-06 05:47:56 +01:00
parent 4f321d65b8
commit 93c402ceff
4 changed files with 621 additions and 33 deletions

View File

@@ -240,10 +240,11 @@ typedef struct aaruformatContext
AaruMetadataJsonBlockHeader jsonBlockHeader; ///< JSON metadata block header (if present).
uint8_t *jsonBlock; ///< JSON metadata block payload (UTF-8).
uint8_t *sector_id; ///< DVD sector ID (4 bytes) if present.
uint8_t *sector_ied; ///< DVD sector IED (2 bytes) if present.
uint8_t *sector_cpr_mai; ///< DVD sector CPR_MAI (6 bytes) if present.
uint8_t *sector_edc; ///< DVD sector EDC (4 bytes) if present.
uint8_t *sector_id; ///< DVD sector ID (4 bytes) if present.
uint8_t *sector_ied; ///< DVD sector IED (2 bytes) if present.
uint8_t *sector_cpr_mai; ///< DVD sector CPR_MAI (6 bytes) if present.
uint8_t *sector_edc; ///< DVD sector EDC (4 bytes) if present.
uint8_t *sector_decrypted_title_key; ///< DVD decrypted title key (5 bytes) if present.
} aaruformatContext;
/** \struct DumpHardwareEntriesWithData

View File

@@ -96,8 +96,9 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector(void *context, uint64_t sector_
const uint8_t *data, uint8_t sector_status, uint32_t length);
AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t sector_address, bool negative,
const uint8_t *data, uint8_t sector_status, uint32_t length);
AARU_EXPORT int32_t AARU_CALL aaruf_write_media_tag(void *context, const uint8_t *data, const int32_t type,
const uint32_t length);
AARU_EXPORT int32_t AARU_CALL aaruf_write_media_tag(void *context, const uint8_t *data, int32_t type, uint32_t length);
AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_tag(void *context, uint64_t sector_address, bool negative,
const uint8_t *data, size_t length, int32_t tag);
AARU_EXPORT int32_t AARU_CALL aaruf_verify_image(void *context);
@@ -161,7 +162,7 @@ AARU_EXPORT int32_t AARU_CALL aaruf_get_cicm_metadata(const void *context, uint8
AARU_EXPORT int32_t AARU_CALL aaruf_get_aaru_json_metadata(const void *context, uint8_t *buffer, size_t *length);
AARU_EXPORT int32_t AARU_CALL aaruf_set_aaru_json_metadata(void *context, uint8_t *data, size_t length);
AARU_EXPORT int32_t AARU_CALL aaruf_get_dumphw(void* context, uint8_t *buffer, size_t *length);
AARU_EXPORT int32_t AARU_CALL aaruf_get_dumphw(void *context, uint8_t *buffer, size_t *length);
AARU_EXPORT int32_t AARU_CALL aaruf_set_dumphw(void *context, uint8_t *data, size_t length);
AARU_EXPORT spamsum_ctx *AARU_CALL aaruf_spamsum_init(void);

View File

@@ -63,6 +63,7 @@
#define AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA (-24) ///< Failure writing block payload.
#define AARUF_ERROR_CANNOT_SET_DDT_ENTRY (-25) ///< Failed to encode/store a DDT entry (overflow or IO).
#define AARUF_ERROR_INCORRECT_DATA_SIZE (-26) ///< Data size does not match expected size.
#define AARUF_ERROR_INVALID_TAG (-27) ///< Invalid or unsupported media or sector tag format.
/** @} */
/** \name Non-fatal sector status codes (non-negative)