114 size_t read_bytes = 0;
121 FATAL(
"Invalid context or image stream.");
129 FATAL(
"Could not seek to %" PRIu64
" as indicated by index entry...\n", entry->
offset);
140 TRACE(
"Could not read tracks header, continuing...\n");
147 TRACE(
"Incorrect identifier for data block at position %" PRIu64
"\n", entry->
offset);
157 FATAL(
"Could not allocate memory for metadata block, continuing...\n");
168 FATAL(
"Could not read metadata block, continuing...\n");
180 TRACE(
"Incorrect CRC found: 0x%" PRIx64
" found, expected 0x%" PRIx64
", continuing...\n", crc64,
202 FATAL(
"Could not allocate memory for data tracks, continuing without filtered list.\n");
283 TRACE(
"Entering aaruf_get_tracks(%p, %p, %zu)", context, buffer, (length ? *length : 0));
288 FATAL(
"Invalid context");
290 TRACE(
"Exiting aaruf_get_tracks() = AARUF_ERROR_NOT_AARUFORMAT");
299 FATAL(
"Invalid context");
301 TRACE(
"Exiting aaruf_get_tracks() = AARUF_ERROR_NOT_AARUFORMAT");
307 FATAL(
"Image contains no tracks");
309 TRACE(
"Exiting aaruf_get_tracks() = AARUF_ERROR_TRACK_NOT_FOUND");
315 if(buffer == NULL || length == NULL || *length < required_length)
317 if(length) *length = required_length;
318 TRACE(
"Buffer too small for tracks, required %zu bytes", required_length);
320 TRACE(
"Exiting aaruf_get_tracks() = AARUF_ERROR_BUFFER_TOO_SMALL");
325 *length = required_length;
327 TRACE(
"Exiting aaruf_get_tracks(%p, %p, %zu) = AARUF_STATUS_OK", context, buffer, *length);
394 TRACE(
"Entering aaruf_set_tracks(%p, %p, %d)", context, tracks, count);
399 FATAL(
"Invalid context");
401 TRACE(
"Exiting aaruf_get_tracks() = AARUF_ERROR_NOT_AARUFORMAT");
410 FATAL(
"Invalid context");
412 TRACE(
"Exiting aaruf_get_tracks() = AARUF_ERROR_NOT_AARUFORMAT");
426 TRACE(
"Exiting aaruf_set_tracks() = AARUF_STATUS_OK");
430 if(tracks == NULL || count < 0)
432 FATAL(
"Invalid tracks data");
434 TRACE(
"Exiting aaruf_set_tracks() = AARUF_ERROR_INVALID_TRACK_FORMAT");
445 FATAL(
"Could not allocate memory for tracks");
447 TRACE(
"Exiting aaruf_set_tracks() = AARUF_ERROR_NOT_ENOUGH_MEMORY");
473 FATAL(
"Could not allocate memory for data tracks");
475 TRACE(
"Exiting aaruf_set_tracks() = AARUF_ERROR_NOT_ENOUGH_MEMORY");
488 TRACE(
"Exiting aaruf_set_tracks() = AARUF_STATUS_OK");
#define AARU_MAGIC
Magic identifier for AaruFormat container (ASCII "AARUFRMT").
#define AARUF_VERSION_V1
First on‑disk version (C# implementation).
uint64_t aaruf_crc64_data(const uint8_t *data, uint32_t len)
@ TracksBlock
Block containing optical disc tracks.
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
#define AARUF_ERROR_TRACK_NOT_FOUND
Referenced track number not present.
#define AARUF_ERROR_NOT_ENOUGH_MEMORY
Memory allocation failure (critical).
#define AARUF_ERROR_INVALID_TRACK_FORMAT
Track metadata internally inconsistent or malformed.
#define AARUF_ERROR_NOT_AARUFORMAT
Input file/stream failed magic or structural validation.
#define AARUF_ERROR_BUFFER_TOO_SMALL
Caller-supplied buffer insufficient for data.
int32_t aaruf_get_tracks(const void *context, uint8_t *buffer, size_t *length)
Retrieve the array of track descriptors contained in an opened AaruFormat image.
void process_tracks_block(aaruformat_context *ctx, const IndexEntry *entry)
Parse and integrate a Tracks block from the image stream into the context.
int32_t aaruf_set_tracks(void *context, TrackEntry *tracks, const int count)
Replace (or clear) the in-memory track table for an AaruFormat image context.
uint8_t HasPartitions
Image contains partitions (or tracks for optical media); 0=no, non-zero=yes.
uint8_t HasSessions
Image contains multiple sessions (optical media); 0=single/none, non-zero=multi.
uint64_t ImageSize
Size of the image payload in bytes (excludes headers/metadata)
Single index entry describing a block's type, (optional) data classification, and file offset.
uint64_t offset
Absolute byte offset in the image where the referenced block header begins.
Single optical disc track descriptor (sequence, type, LBAs, session, ISRC, flags).
uint8_t sequence
Track number (1..99 typical for CD audio/data). 0 may indicate placeholder/non-standard.
Master context representing an open or in‑creation Aaru image.
TrackEntry * data_tracks
Filtered list of data tracks (subset of trackEntries).
AaruHeaderV2 header
Parsed container header (v2).
uint64_t magic
File magic (AARU_MAGIC) post-open.
FILE * imageStream
Underlying FILE* stream (binary mode).
ImageInfo image_info
Exposed high-level image info summary.
TrackEntry * track_entries
Full track list (tracksHeader.entries elements).
uint8_t number_of_data_tracks
Count of tracks considered "data" (sequence 1..99 heuristics).
TracksHeader tracks_header
Tracks header (optical) if present.