Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Codecs: mp4: Fix seek in very large files

Samples count requires 64 bit

Change-Id: Ia54be57d7d15b3db19dbc29ff8a06671594abb4b

authored by

roman.artiukhin and committed by
Solomon Peachy
27aa95af d2f7777f

+11 -10
+2 -2
lib/rbcodec/codecs/aac.c
··· 56 56 size_t n; 57 57 demux_res_t demux_res; 58 58 stream_t input_stream; 59 - uint32_t sound_samples_done; 59 + uint64_t sound_samples_done; 60 60 uint32_t elapsed_time; 61 61 int file_offset; 62 62 int framelength; ··· 172 172 * m4a_seek and the resulting sound_samples_done must be expanded 173 173 * by a factor 2. This is done via using sbr_fac. */ 174 174 if (m4a_seek(&demux_res, &input_stream, 175 - (param/10/sbr_fac)*(ci->id3->frequency/100), 175 + (uint64_t) param * ci->id3->frequency / sbr_fac / 1000ULL, 176 176 &sound_samples_done, (int*) &i)) { 177 177 sound_samples_done *= sbr_fac; 178 178 elapsed_time = sound_samples_done * 1000LL / ci->id3->frequency;
+1 -1
lib/rbcodec/codecs/alac.c
··· 55 55 size_t n; 56 56 demux_res_t demux_res; 57 57 stream_t input_stream; 58 - uint32_t samplesdone; 58 + uint64_t samplesdone; 59 59 int samplesdecoded; 60 60 unsigned int i; 61 61 unsigned char* buffer;
+6 -5
lib/rbcodec/codecs/libm4a/m4a.c
··· 137 137 /* Seek to desired sound sample location. Return 1 on success (and modify 138 138 * sound_samples_done and current_sample), 0 if failed. */ 139 139 unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, 140 - uint32_t sound_sample_loc, uint32_t* sound_samples_done, 140 + uint64_t sound_sample_loc, uint64_t* sound_samples_done, 141 141 int* current_sample) 142 142 { 143 - uint32_t i, sample_i, sound_sample_i; 143 + uint32_t i, sample_i; 144 144 uint32_t time, time_cnt, time_dur; 145 145 uint32_t chunk, chunk_first_sample; 146 146 uint32_t offset; 147 + uint64_t sound_sample_i; 147 148 time_to_sample_t *tts_tab = demux_res->time_to_sample; 148 149 sample_offset_t *tco_tab = demux_res->lookup_table; 149 150 uint32_t *tsz_tab = demux_res->sample_byte_sizes; ··· 208 209 209 210 DEBUGF("seek chunk=%lu, sample=%lu, soundsample=%lu, offset=%lu\n", 210 211 (unsigned long)chunk, (unsigned long)chunk_first_sample, 211 - (unsigned long)sound_sample_i, (unsigned long)offset); 212 + sound_sample_i, (unsigned long)offset); 212 213 213 214 if (tsz_tab) { 214 215 /* We have a sample-to-bytes table available so we can do accurate ··· 260 261 * calculate the sound_samples_done value. 261 262 */ 262 263 unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream, 263 - uint32_t file_loc, uint32_t* sound_samples_done, 264 + uint32_t file_loc, uint64_t* sound_samples_done, 264 265 int* current_sample) 265 266 { 266 267 uint32_t i; 267 268 uint32_t chunk_sample = 0; 268 269 uint32_t total_samples = 0; 269 - uint32_t new_sound_sample = 0; 270 + uint64_t new_sound_sample = 0; 270 271 uint32_t tmp_dur; 271 272 uint32_t tmp_cnt; 272 273 uint32_t new_pos;
+2 -2
lib/rbcodec/codecs/libm4a/m4a.h
··· 130 130 void stream_create(stream_t *stream,struct codec_api* ci); 131 131 unsigned int get_sample_offset(demux_res_t *demux_res, uint32_t sample); 132 132 unsigned int m4a_seek (demux_res_t* demux_res, stream_t* stream, 133 - uint32_t sound_sample_loc, uint32_t* sound_samples_done, 133 + uint64_t sound_sample_loc, uint64_t* sound_samples_done, 134 134 int* current_sample); 135 135 unsigned int m4a_seek_raw (demux_res_t* demux_res, stream_t* stream, 136 - uint32_t file_loc, uint32_t* sound_samples_done, int* current_sample); 136 + uint32_t file_loc, uint64_t* sound_samples_done, int* current_sample); 137 137 int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *start); 138 138 139 139 #endif /* STREAM_H */