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.

libm4a: Fix warnings introduced in 001a338e51

Change-Id: Ia915e6f8babbd71533f22af566e5c45c2b40fbe5

+34 -34
+14 -14
lib/rbcodec/codecs/aac.c
··· 28 28 CODEC_HEADER 29 29 30 30 /* The maximum buffer size handled by faad. 12 bytes are required by libfaad 31 - * as headroom (see libfaad/bits.c). FAAD_BYTE_BUFFER_SIZE bytes are buffered 31 + * as headroom (see libfaad/bits.c). FAAD_BYTE_BUFFER_SIZE bytes are buffered 32 32 * for each frame. */ 33 33 #define FAAD_BYTE_BUFFER_SIZE (2048-12) 34 34 ··· 62 62 int framelength; 63 63 int lead_trim = 0; 64 64 unsigned int frame_samples; 65 - unsigned int i; 65 + uint32_t i; 66 66 unsigned char* buffer; 67 67 NeAACDecFrameInfo frame_info; 68 68 NeAACDecHandle decoder; ··· 129 129 #endif 130 130 131 131 i = 0; 132 - 132 + 133 133 if (param) { 134 134 elapsed_time = param; 135 135 action = CODEC_ACTION_SEEK_TIME; ··· 138 138 * upsampling files the resulting sound_samples_done must be expanded 139 139 * by a factor of 2. This is done via using sbr_fac. */ 140 140 if (m4a_seek_raw(&demux_res, &input_stream, file_offset, 141 - &sound_samples_done, (int*) &i, &seek_idx)) { 141 + &sound_samples_done, &i, &seek_idx)) { 142 142 sound_samples_done *= sbr_fac; 143 143 } else { 144 144 sound_samples_done = 0; ··· 151 151 } 152 152 153 153 ci->set_elapsed(elapsed_time); 154 - 155 - if (i == 0) 154 + 155 + if (i == 0) 156 156 { 157 157 lead_trim = ci->id3->lead_trim; 158 158 } ··· 168 168 /* Deal with any pending seek requests */ 169 169 if (action == CODEC_ACTION_SEEK_TIME) { 170 170 /* Seek to the desired time position. Important: When seeking in SBR 171 - * upsampling files the seek_time must be divided by 2 when calling 172 - * m4a_seek and the resulting sound_samples_done must be expanded 171 + * upsampling files the seek_time must be divided by 2 when calling 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 175 (uint64_t) param * ci->id3->frequency / sbr_fac / 1000ULL, 176 - &sound_samples_done, (int*) &i, &seek_idx)) { 176 + &sound_samples_done, &i, &seek_idx)) { 177 177 sound_samples_done *= sbr_fac; 178 178 elapsed_time = sound_samples_done * 1000LL / ci->id3->frequency; 179 179 ci->set_elapsed(elapsed_time); 180 180 181 - if (i == 0) 181 + if (i == 0) 182 182 { 183 183 lead_trim = ci->id3->lead_trim; 184 184 } ··· 190 190 action = CODEC_ACTION_NULL; 191 191 192 192 /* There can be gaps between chunks, so skip ahead if needed. It 193 - * doesn't seem to happen much, but it probably means that a 193 + * doesn't seem to happen much, but it probably means that a 194 194 * "proper" file can have chunks out of order. Why one would want 195 - * that an good question (but files with gaps do exist, so who 195 + * that an good question (but files with gaps do exist, so who 196 196 * knows?), so we don't support that - for now, at least. 197 197 */ 198 198 file_offset = m4a_check_sample_offset(&demux_res, i, &seek_idx); ··· 219 219 220 220 /* Output the audio */ 221 221 ci->yield(); 222 - 222 + 223 223 frame_samples = frame_info.samples >> 1; 224 224 225 225 if (empty_first_frame) ··· 238 238 239 239 /* Gather number of samples for the decoded frame. */ 240 240 framelength = frame_samples - lead_trim; 241 - 241 + 242 242 if (i == demux_res.num_sample_byte_sizes - 1) 243 243 { 244 244 // Size of the last frame
+13 -13
lib/rbcodec/codecs/libm4a/m4a.c
··· 114 114 115 115 /* Check if there is a dedicated byte position contained for the given frame. 116 116 * Return this byte position in case of success or return -1. This allows to 117 - * skip empty samples. 118 - * During standard playback the search result (index i) will always increase. 117 + * skip empty samples. 118 + * During standard playback the search result (index i) will always increase. 119 119 * Therefor we save this index and let the caller set this value again as start 120 - * index when calling m4a_check_sample_offset() for the next frame. This 120 + * index when calling m4a_check_sample_offset() for the next frame. This 121 121 * reduces the overall loop count significantly. */ 122 122 int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *start) 123 123 { ··· 139 139 140 140 /* Seek to desired sound sample location. Return 1 on success (and modify 141 141 * sound_samples_done and current_sample), 0 if failed. */ 142 - unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, 143 - uint64_t sound_sample_loc, uint64_t* sound_samples_done, 144 - int* current_sample, int* lookup_table_idx) 142 + unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, 143 + uint64_t sound_sample_loc, uint64_t* sound_samples_done, 144 + uint32_t* current_sample, uint32_t* lookup_table_idx) 145 145 { 146 146 uint32_t i, sample_i; 147 147 uint32_t time, time_cnt, time_dur; ··· 257 257 * 1) the lookup_table array contains the file offset for the first sample 258 258 * of each chunk. 259 259 * 260 - * 2) the time_to_sample array contains the duration (in sound samples) 260 + * 2) the time_to_sample array contains the duration (in sound samples) 261 261 * of each sample of data. 262 262 * 263 263 * Locate the chunk containing location (using lookup_table), find the first ··· 265 265 * calculate the sound_samples_done value. 266 266 */ 267 267 unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream, 268 - uint32_t file_loc, uint64_t* sound_samples_done, 269 - int* current_sample, int* lookup_table_idx) 268 + uint32_t file_loc, uint64_t* sound_samples_done, 269 + uint32_t* current_sample, uint32_t* lookup_table_idx) 270 270 { 271 271 uint32_t i; 272 272 uint32_t chunk_sample = 0; ··· 276 276 uint32_t tmp_cnt; 277 277 uint32_t new_pos; 278 278 279 - /* We know the desired byte offset, search for the chunk right before. 279 + /* We know the desired byte offset, search for the chunk right before. 280 280 * Return the associated sample to this chunk as chunk_sample. */ 281 281 for (i=0; i < demux_res->num_lookup_table; ++i) 282 282 { ··· 287 287 *lookup_table_idx = i; 288 288 chunk_sample = demux_res->lookup_table[i].sample; 289 289 new_pos = demux_res->lookup_table[i].offset; 290 - 290 + 291 291 /* Get sound sample offset. */ 292 292 i = 0; 293 293 time_to_sample_t *tab2 = demux_res->time_to_sample; ··· 306 306 } 307 307 308 308 /* Go to the new file position. */ 309 - if (stream->ci->seek_buffer(new_pos)) 309 + if (stream->ci->seek_buffer(new_pos)) 310 310 { 311 311 *sound_samples_done = new_sound_sample; 312 312 *current_sample = chunk_sample; 313 313 return 1; 314 - } 314 + } 315 315 316 316 return 0; 317 317 }
+7 -7
lib/rbcodec/codecs/libm4a/m4a.h
··· 45 45 46 46 typedef uint32_t fourcc_t; 47 47 48 - typedef struct 48 + typedef struct 49 49 { 50 50 uint32_t first_chunk; 51 51 uint32_t num_samples; 52 52 } sample_to_chunk_t; 53 53 54 - typedef struct 54 + typedef struct 55 55 { 56 56 uint32_t sample_count; 57 57 uint32_t sample_duration; ··· 73 73 74 74 int32_t sample_to_chunk_offset; 75 75 uint32_t num_sample_to_chunks; 76 - 76 + 77 77 sample_offset_t *lookup_table; 78 78 uint32_t num_lookup_table; 79 - 79 + 80 80 time_to_sample_t *time_to_sample; 81 81 uint32_t num_time_to_samples; 82 82 ··· 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 - uint64_t sound_sample_loc, uint64_t* sound_samples_done, 134 - int* current_sample, int* lookup_table_idx); 133 + uint64_t sound_sample_loc, uint64_t* sound_samples_done, 134 + uint32_t* current_sample, uint32_t* lookup_table_idx); 135 135 unsigned int m4a_seek_raw (demux_res_t* demux_res, stream_t* stream, 136 - uint32_t file_loc, uint64_t* sound_samples_done, int* current_sample, int* lookup_table_idx); 136 + uint32_t file_loc, uint64_t* sound_samples_done, uint32_t* current_sample, uint32_t* lookup_table_idx); 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 */