From 71997fabf82c1269122ecdc68f3dc91eba95edf4 Mon Sep 17 00:00:00 2001 From: bnnm Date: Thu, 16 Apr 2020 00:27:53 +0200 Subject: [PATCH] Fix XMA encoder delay in Ubi SB bigfiles --- src/coding/coding_utils.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/coding/coding_utils.c b/src/coding/coding_utils.c index fa83dbd8..b97fddc6 100644 --- a/src/coding/coding_utils.c +++ b/src/coding/coding_utils.c @@ -19,7 +19,7 @@ * read num_bits (up to 25) from a bit offset. * 25 since we read a 32 bit int, and need to adjust up to 7 bits from the byte-rounded fseek (32-7=25) */ -static uint32_t read_bitsBE_b(off_t bit_offset, int num_bits, STREAMFILE *streamFile) { +static uint32_t read_bitsBE_b(int64_t bit_offset, int num_bits, STREAMFILE *streamFile) { uint32_t num, mask; if (num_bits > 25) return -1; //??? @@ -400,7 +400,7 @@ fail: /* XMA PARSING */ /* ******************************************** */ -static void ms_audio_parse_header(STREAMFILE *streamFile, int xma_version, off_t offset_b, int bits_frame_size, size_t *first_frame_b, size_t *packet_skip_count, size_t *header_size_b) { +static void ms_audio_parse_header(STREAMFILE *streamFile, int xma_version, int64_t offset_b, int bits_frame_size, size_t *first_frame_b, size_t *packet_skip_count, size_t *header_size_b) { if (xma_version == 1) { /* XMA1 */ //packet_sequence = read_bitsBE_b(offset_b+0, 4, streamFile); /* numbered from 0 to N */ //unknown = read_bitsBE_b(offset_b+4, 2, streamFile); /* packet_metadata? (always 2) */ @@ -431,11 +431,11 @@ static void ms_audio_parse_header(STREAMFILE *streamFile, int xma_version, off_t /* full packet skip, no new frames start in this packet (prev frames can end here) * standardized to some value */ if (*packet_skip_count == 0x7FF) { /* XMA1, 11b */ - VGM_LOG("MS_SAMPLES: XMA1 full packet_skip at 0x%x\n", (uint32_t)offset_b/8); + VGM_LOG("MS_SAMPLES: XMA1 full packet_skip at %"PRIx64"\n", offset_b/8); *packet_skip_count = 0x800; } else if (*packet_skip_count == 0xFF) { /* XMA2, 8b*/ - VGM_LOG("MS_SAMPLES: XMA2 full packet_skip at 0x%x\n", (uint32_t)offset_b/8); + VGM_LOG("MS_SAMPLES: XMA2 full packet_skip at %"PRIx64"\n", offset_b/8); *packet_skip_count = 0x800; } @@ -458,7 +458,7 @@ static void ms_audio_get_samples(ms_sample_data * msd, STREAMFILE *streamFile, i int frames = 0, samples = 0, loop_start_frame = 0, loop_end_frame = 0; size_t first_frame_b, packet_skip_count, header_size_b, frame_size_b; - off_t offset_b, packet_offset_b, frame_offset_b; + int64_t offset_b, packet_offset_b, frame_offset_b; size_t packet_size = bytes_per_packet; size_t packet_size_b = packet_size * 8; @@ -535,11 +535,11 @@ static void ms_audio_get_skips(STREAMFILE *streamFile, int xma_version, off_t da int start_skip = 0, end_skip = 0; size_t first_frame_b, packet_skip_count, header_size_b, frame_size_b; - off_t offset_b, packet_offset_b, frame_offset_b; + int64_t offset_b, packet_offset_b, frame_offset_b; size_t packet_size = bytes_per_packet; size_t packet_size_b = packet_size * 8; - off_t offset = data_offset; + int64_t offset = data_offset; /* read packet */ {