diff options
author | roman.artiukhin <bahusdrive@gmail.com> | 2023-09-18 13:14:47 +0300 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2023-09-19 11:13:19 -0400 |
commit | 001a338e5126cbec422867481ef7485b1b3c8eea (patch) | |
tree | 6593e544ee074ca86f79df7d9f04814ce21c323d /lib/rbcodec/codecs/libm4a/m4a.c | |
parent | ef7d6009b4f8b2e64d6ced27bc97aad0b520271e (diff) | |
download | rockbox-001a338e5126cbec422867481ef7485b1b3c8eea.tar.gz rockbox-001a338e5126cbec422867481ef7485b1b3c8eea.zip |
Codecs: mp4: Reuse lookup_table index from seek in m4a_check_sample_offset
Change-Id: If2fc3038ce8db8ddf2991406a5cce294a857eadc
Diffstat (limited to 'lib/rbcodec/codecs/libm4a/m4a.c')
-rw-r--r-- | lib/rbcodec/codecs/libm4a/m4a.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/rbcodec/codecs/libm4a/m4a.c b/lib/rbcodec/codecs/libm4a/m4a.c index 958d0b1575..6adc58dab0 100644 --- a/lib/rbcodec/codecs/libm4a/m4a.c +++ b/lib/rbcodec/codecs/libm4a/m4a.c | |||
@@ -141,7 +141,7 @@ int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *st | |||
141 | * sound_samples_done and current_sample), 0 if failed. */ | 141 | * sound_samples_done and current_sample), 0 if failed. */ |
142 | unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, | 142 | unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, |
143 | uint64_t sound_sample_loc, uint64_t* sound_samples_done, | 143 | uint64_t sound_sample_loc, uint64_t* sound_samples_done, |
144 | int* current_sample) | 144 | int* current_sample, int* lookup_table_idx) |
145 | { | 145 | { |
146 | uint32_t i, sample_i; | 146 | uint32_t i, sample_i; |
147 | uint32_t time, time_cnt, time_dur; | 147 | uint32_t time, time_cnt, time_dur; |
@@ -189,6 +189,7 @@ unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, | |||
189 | 189 | ||
190 | /* The preceding chunk is the one that contains 'sample_i'. */ | 190 | /* The preceding chunk is the one that contains 'sample_i'. */ |
191 | chunk--; | 191 | chunk--; |
192 | *lookup_table_idx = chunk; | ||
192 | chunk_first_sample = tco_tab[chunk].sample; | 193 | chunk_first_sample = tco_tab[chunk].sample; |
193 | offset = tco_tab[chunk].offset; | 194 | offset = tco_tab[chunk].offset; |
194 | 195 | ||
@@ -265,7 +266,7 @@ unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, | |||
265 | */ | 266 | */ |
266 | unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream, | 267 | unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream, |
267 | uint32_t file_loc, uint64_t* sound_samples_done, | 268 | uint32_t file_loc, uint64_t* sound_samples_done, |
268 | int* current_sample) | 269 | int* current_sample, int* lookup_table_idx) |
269 | { | 270 | { |
270 | uint32_t i; | 271 | uint32_t i; |
271 | uint32_t chunk_sample = 0; | 272 | uint32_t chunk_sample = 0; |
@@ -283,6 +284,7 @@ unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream, | |||
283 | break; | 284 | break; |
284 | } | 285 | } |
285 | i = (i>0) ? i-1 : 0; /* We want the last chunk _before_ file_loc. */ | 286 | i = (i>0) ? i-1 : 0; /* We want the last chunk _before_ file_loc. */ |
287 | *lookup_table_idx = i; | ||
286 | chunk_sample = demux_res->lookup_table[i].sample; | 288 | chunk_sample = demux_res->lookup_table[i].sample; |
287 | new_pos = demux_res->lookup_table[i].offset; | 289 | new_pos = demux_res->lookup_table[i].offset; |
288 | 290 | ||