From ac82a653bbcd13d95aeb8f5934cc486c7f703152 Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 19 Sep 2023 11:47:38 -0400 Subject: libm4a: Fix warnings introduced in 001a338e51 Change-Id: Ia915e6f8babbd71533f22af566e5c45c2b40fbe5 --- lib/rbcodec/codecs/aac.c | 28 ++++++++++++++-------------- lib/rbcodec/codecs/libm4a/m4a.c | 26 +++++++++++++------------- lib/rbcodec/codecs/libm4a/m4a.h | 14 +++++++------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lib/rbcodec/codecs/aac.c b/lib/rbcodec/codecs/aac.c index 11a84cfa24..15c75708e1 100644 --- a/lib/rbcodec/codecs/aac.c +++ b/lib/rbcodec/codecs/aac.c @@ -28,7 +28,7 @@ CODEC_HEADER /* The maximum buffer size handled by faad. 12 bytes are required by libfaad - * as headroom (see libfaad/bits.c). FAAD_BYTE_BUFFER_SIZE bytes are buffered + * as headroom (see libfaad/bits.c). FAAD_BYTE_BUFFER_SIZE bytes are buffered * for each frame. */ #define FAAD_BYTE_BUFFER_SIZE (2048-12) @@ -62,7 +62,7 @@ enum codec_status codec_run(void) int framelength; int lead_trim = 0; unsigned int frame_samples; - unsigned int i; + uint32_t i; unsigned char* buffer; NeAACDecFrameInfo frame_info; NeAACDecHandle decoder; @@ -129,7 +129,7 @@ enum codec_status codec_run(void) #endif i = 0; - + if (param) { elapsed_time = param; action = CODEC_ACTION_SEEK_TIME; @@ -138,7 +138,7 @@ enum codec_status codec_run(void) * upsampling files the resulting sound_samples_done must be expanded * by a factor of 2. This is done via using sbr_fac. */ if (m4a_seek_raw(&demux_res, &input_stream, file_offset, - &sound_samples_done, (int*) &i, &seek_idx)) { + &sound_samples_done, &i, &seek_idx)) { sound_samples_done *= sbr_fac; } else { sound_samples_done = 0; @@ -151,8 +151,8 @@ enum codec_status codec_run(void) } ci->set_elapsed(elapsed_time); - - if (i == 0) + + if (i == 0) { lead_trim = ci->id3->lead_trim; } @@ -168,17 +168,17 @@ enum codec_status codec_run(void) /* Deal with any pending seek requests */ if (action == CODEC_ACTION_SEEK_TIME) { /* Seek to the desired time position. Important: When seeking in SBR - * upsampling files the seek_time must be divided by 2 when calling - * m4a_seek and the resulting sound_samples_done must be expanded + * upsampling files the seek_time must be divided by 2 when calling + * m4a_seek and the resulting sound_samples_done must be expanded * by a factor 2. This is done via using sbr_fac. */ if (m4a_seek(&demux_res, &input_stream, (uint64_t) param * ci->id3->frequency / sbr_fac / 1000ULL, - &sound_samples_done, (int*) &i, &seek_idx)) { + &sound_samples_done, &i, &seek_idx)) { sound_samples_done *= sbr_fac; elapsed_time = sound_samples_done * 1000LL / ci->id3->frequency; ci->set_elapsed(elapsed_time); - if (i == 0) + if (i == 0) { lead_trim = ci->id3->lead_trim; } @@ -190,9 +190,9 @@ enum codec_status codec_run(void) action = CODEC_ACTION_NULL; /* There can be gaps between chunks, so skip ahead if needed. It - * doesn't seem to happen much, but it probably means that a + * doesn't seem to happen much, but it probably means that a * "proper" file can have chunks out of order. Why one would want - * that an good question (but files with gaps do exist, so who + * that an good question (but files with gaps do exist, so who * knows?), so we don't support that - for now, at least. */ file_offset = m4a_check_sample_offset(&demux_res, i, &seek_idx); @@ -219,7 +219,7 @@ enum codec_status codec_run(void) /* Output the audio */ ci->yield(); - + frame_samples = frame_info.samples >> 1; if (empty_first_frame) @@ -238,7 +238,7 @@ enum codec_status codec_run(void) /* Gather number of samples for the decoded frame. */ framelength = frame_samples - lead_trim; - + if (i == demux_res.num_sample_byte_sizes - 1) { // Size of the last frame diff --git a/lib/rbcodec/codecs/libm4a/m4a.c b/lib/rbcodec/codecs/libm4a/m4a.c index 6adc58dab0..295c39c5ff 100644 --- a/lib/rbcodec/codecs/libm4a/m4a.c +++ b/lib/rbcodec/codecs/libm4a/m4a.c @@ -114,10 +114,10 @@ void stream_create(stream_t *stream,struct codec_api* ci) /* Check if there is a dedicated byte position contained for the given frame. * Return this byte position in case of success or return -1. This allows to - * skip empty samples. - * During standard playback the search result (index i) will always increase. + * skip empty samples. + * During standard playback the search result (index i) will always increase. * Therefor we save this index and let the caller set this value again as start - * index when calling m4a_check_sample_offset() for the next frame. This + * index when calling m4a_check_sample_offset() for the next frame. This * reduces the overall loop count significantly. */ int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *start) { @@ -139,9 +139,9 @@ int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *st /* Seek to desired sound sample location. Return 1 on success (and modify * sound_samples_done and current_sample), 0 if failed. */ -unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, - uint64_t sound_sample_loc, uint64_t* sound_samples_done, - int* current_sample, int* lookup_table_idx) +unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, + uint64_t sound_sample_loc, uint64_t* sound_samples_done, + uint32_t* current_sample, uint32_t* lookup_table_idx) { uint32_t i, sample_i; uint32_t time, time_cnt, time_dur; @@ -257,7 +257,7 @@ unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, * 1) the lookup_table array contains the file offset for the first sample * of each chunk. * - * 2) the time_to_sample array contains the duration (in sound samples) + * 2) the time_to_sample array contains the duration (in sound samples) * of each sample of data. * * Locate the chunk containing location (using lookup_table), find the first @@ -265,8 +265,8 @@ unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, * calculate the sound_samples_done value. */ unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream, - uint32_t file_loc, uint64_t* sound_samples_done, - int* current_sample, int* lookup_table_idx) + uint32_t file_loc, uint64_t* sound_samples_done, + uint32_t* current_sample, uint32_t* lookup_table_idx) { uint32_t i; uint32_t chunk_sample = 0; @@ -276,7 +276,7 @@ unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream, uint32_t tmp_cnt; uint32_t new_pos; - /* We know the desired byte offset, search for the chunk right before. + /* We know the desired byte offset, search for the chunk right before. * Return the associated sample to this chunk as chunk_sample. */ for (i=0; i < demux_res->num_lookup_table; ++i) { @@ -287,7 +287,7 @@ unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream, *lookup_table_idx = i; chunk_sample = demux_res->lookup_table[i].sample; new_pos = demux_res->lookup_table[i].offset; - + /* Get sound sample offset. */ i = 0; time_to_sample_t *tab2 = demux_res->time_to_sample; @@ -306,12 +306,12 @@ unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream, } /* Go to the new file position. */ - if (stream->ci->seek_buffer(new_pos)) + if (stream->ci->seek_buffer(new_pos)) { *sound_samples_done = new_sound_sample; *current_sample = chunk_sample; return 1; - } + } return 0; } diff --git a/lib/rbcodec/codecs/libm4a/m4a.h b/lib/rbcodec/codecs/libm4a/m4a.h index bcc32f53bb..7120f8b4c6 100644 --- a/lib/rbcodec/codecs/libm4a/m4a.h +++ b/lib/rbcodec/codecs/libm4a/m4a.h @@ -45,13 +45,13 @@ typedef struct { typedef uint32_t fourcc_t; -typedef struct +typedef struct { uint32_t first_chunk; uint32_t num_samples; } sample_to_chunk_t; -typedef struct +typedef struct { uint32_t sample_count; uint32_t sample_duration; @@ -73,10 +73,10 @@ typedef struct int32_t sample_to_chunk_offset; uint32_t num_sample_to_chunks; - + sample_offset_t *lookup_table; uint32_t num_lookup_table; - + time_to_sample_t *time_to_sample; uint32_t num_time_to_samples; @@ -130,10 +130,10 @@ int stream_eof(stream_t *stream); void stream_create(stream_t *stream,struct codec_api* ci); unsigned int get_sample_offset(demux_res_t *demux_res, uint32_t sample); unsigned int m4a_seek (demux_res_t* demux_res, stream_t* stream, - uint64_t sound_sample_loc, uint64_t* sound_samples_done, - int* current_sample, int* lookup_table_idx); + uint64_t sound_sample_loc, uint64_t* sound_samples_done, + uint32_t* current_sample, uint32_t* lookup_table_idx); unsigned int m4a_seek_raw (demux_res_t* demux_res, stream_t* stream, - uint32_t file_loc, uint64_t* sound_samples_done, int* current_sample, int* lookup_table_idx); + uint32_t file_loc, uint64_t* sound_samples_done, uint32_t* current_sample, uint32_t* lookup_table_idx); int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *start); #endif /* STREAM_H */ -- cgit v1.2.3