forked from len0rd/rockbox
libm4a: Fix warnings introduced in 001a338e51
Change-Id: Ia915e6f8babbd71533f22af566e5c45c2b40fbe5
This commit is contained in:
parent
001a338e51
commit
ac82a653bb
3 changed files with 34 additions and 34 deletions
|
@ -28,7 +28,7 @@
|
||||||
CODEC_HEADER
|
CODEC_HEADER
|
||||||
|
|
||||||
/* The maximum buffer size handled by faad. 12 bytes are required by libfaad
|
/* 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. */
|
* for each frame. */
|
||||||
#define FAAD_BYTE_BUFFER_SIZE (2048-12)
|
#define FAAD_BYTE_BUFFER_SIZE (2048-12)
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ enum codec_status codec_run(void)
|
||||||
int framelength;
|
int framelength;
|
||||||
int lead_trim = 0;
|
int lead_trim = 0;
|
||||||
unsigned int frame_samples;
|
unsigned int frame_samples;
|
||||||
unsigned int i;
|
uint32_t i;
|
||||||
unsigned char* buffer;
|
unsigned char* buffer;
|
||||||
NeAACDecFrameInfo frame_info;
|
NeAACDecFrameInfo frame_info;
|
||||||
NeAACDecHandle decoder;
|
NeAACDecHandle decoder;
|
||||||
|
@ -129,7 +129,7 @@ enum codec_status codec_run(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
if (param) {
|
if (param) {
|
||||||
elapsed_time = param;
|
elapsed_time = param;
|
||||||
action = CODEC_ACTION_SEEK_TIME;
|
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
|
* upsampling files the resulting sound_samples_done must be expanded
|
||||||
* by a factor of 2. This is done via using sbr_fac. */
|
* by a factor of 2. This is done via using sbr_fac. */
|
||||||
if (m4a_seek_raw(&demux_res, &input_stream, file_offset,
|
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;
|
sound_samples_done *= sbr_fac;
|
||||||
} else {
|
} else {
|
||||||
sound_samples_done = 0;
|
sound_samples_done = 0;
|
||||||
|
@ -151,8 +151,8 @@ enum codec_status codec_run(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
ci->set_elapsed(elapsed_time);
|
ci->set_elapsed(elapsed_time);
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
lead_trim = ci->id3->lead_trim;
|
lead_trim = ci->id3->lead_trim;
|
||||||
}
|
}
|
||||||
|
@ -168,17 +168,17 @@ enum codec_status codec_run(void)
|
||||||
/* Deal with any pending seek requests */
|
/* Deal with any pending seek requests */
|
||||||
if (action == CODEC_ACTION_SEEK_TIME) {
|
if (action == CODEC_ACTION_SEEK_TIME) {
|
||||||
/* Seek to the desired time position. Important: When seeking in SBR
|
/* Seek to the desired time position. Important: When seeking in SBR
|
||||||
* upsampling files the seek_time must be divided by 2 when calling
|
* upsampling files the seek_time must be divided by 2 when calling
|
||||||
* m4a_seek and the resulting sound_samples_done must be expanded
|
* m4a_seek and the resulting sound_samples_done must be expanded
|
||||||
* by a factor 2. This is done via using sbr_fac. */
|
* by a factor 2. This is done via using sbr_fac. */
|
||||||
if (m4a_seek(&demux_res, &input_stream,
|
if (m4a_seek(&demux_res, &input_stream,
|
||||||
(uint64_t) param * ci->id3->frequency / sbr_fac / 1000ULL,
|
(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;
|
sound_samples_done *= sbr_fac;
|
||||||
elapsed_time = sound_samples_done * 1000LL / ci->id3->frequency;
|
elapsed_time = sound_samples_done * 1000LL / ci->id3->frequency;
|
||||||
ci->set_elapsed(elapsed_time);
|
ci->set_elapsed(elapsed_time);
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
lead_trim = ci->id3->lead_trim;
|
lead_trim = ci->id3->lead_trim;
|
||||||
}
|
}
|
||||||
|
@ -190,9 +190,9 @@ enum codec_status codec_run(void)
|
||||||
action = CODEC_ACTION_NULL;
|
action = CODEC_ACTION_NULL;
|
||||||
|
|
||||||
/* There can be gaps between chunks, so skip ahead if needed. It
|
/* 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
|
* "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.
|
* knows?), so we don't support that - for now, at least.
|
||||||
*/
|
*/
|
||||||
file_offset = m4a_check_sample_offset(&demux_res, i, &seek_idx);
|
file_offset = m4a_check_sample_offset(&demux_res, i, &seek_idx);
|
||||||
|
@ -219,7 +219,7 @@ enum codec_status codec_run(void)
|
||||||
|
|
||||||
/* Output the audio */
|
/* Output the audio */
|
||||||
ci->yield();
|
ci->yield();
|
||||||
|
|
||||||
frame_samples = frame_info.samples >> 1;
|
frame_samples = frame_info.samples >> 1;
|
||||||
|
|
||||||
if (empty_first_frame)
|
if (empty_first_frame)
|
||||||
|
@ -238,7 +238,7 @@ enum codec_status codec_run(void)
|
||||||
|
|
||||||
/* Gather number of samples for the decoded frame. */
|
/* Gather number of samples for the decoded frame. */
|
||||||
framelength = frame_samples - lead_trim;
|
framelength = frame_samples - lead_trim;
|
||||||
|
|
||||||
if (i == demux_res.num_sample_byte_sizes - 1)
|
if (i == demux_res.num_sample_byte_sizes - 1)
|
||||||
{
|
{
|
||||||
// Size of the last frame
|
// Size of the last frame
|
||||||
|
|
|
@ -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.
|
/* 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
|
* Return this byte position in case of success or return -1. This allows to
|
||||||
* skip empty samples.
|
* skip empty samples.
|
||||||
* During standard playback the search result (index i) will always increase.
|
* 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
|
* 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. */
|
* reduces the overall loop count significantly. */
|
||||||
int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *start)
|
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
|
/* Seek to desired sound sample location. Return 1 on success (and modify
|
||||||
* sound_samples_done and current_sample), 0 if failed. */
|
* sound_samples_done and current_sample), 0 if failed. */
|
||||||
unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream,
|
unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream,
|
||||||
uint64_t sound_sample_loc, uint64_t* sound_samples_done,
|
uint64_t sound_sample_loc, uint64_t* sound_samples_done,
|
||||||
int* current_sample, int* lookup_table_idx)
|
uint32_t* current_sample, uint32_t* lookup_table_idx)
|
||||||
{
|
{
|
||||||
uint32_t i, sample_i;
|
uint32_t i, sample_i;
|
||||||
uint32_t time, time_cnt, time_dur;
|
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
|
* 1) the lookup_table array contains the file offset for the first sample
|
||||||
* of each chunk.
|
* 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.
|
* of each sample of data.
|
||||||
*
|
*
|
||||||
* Locate the chunk containing location (using lookup_table), find the first
|
* 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.
|
* calculate the sound_samples_done value.
|
||||||
*/
|
*/
|
||||||
unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream,
|
unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream,
|
||||||
uint32_t file_loc, uint64_t* sound_samples_done,
|
uint32_t file_loc, uint64_t* sound_samples_done,
|
||||||
int* current_sample, int* lookup_table_idx)
|
uint32_t* current_sample, uint32_t* lookup_table_idx)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint32_t chunk_sample = 0;
|
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 tmp_cnt;
|
||||||
uint32_t new_pos;
|
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. */
|
* Return the associated sample to this chunk as chunk_sample. */
|
||||||
for (i=0; i < demux_res->num_lookup_table; ++i)
|
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;
|
*lookup_table_idx = i;
|
||||||
chunk_sample = demux_res->lookup_table[i].sample;
|
chunk_sample = demux_res->lookup_table[i].sample;
|
||||||
new_pos = demux_res->lookup_table[i].offset;
|
new_pos = demux_res->lookup_table[i].offset;
|
||||||
|
|
||||||
/* Get sound sample offset. */
|
/* Get sound sample offset. */
|
||||||
i = 0;
|
i = 0;
|
||||||
time_to_sample_t *tab2 = demux_res->time_to_sample;
|
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. */
|
/* 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;
|
*sound_samples_done = new_sound_sample;
|
||||||
*current_sample = chunk_sample;
|
*current_sample = chunk_sample;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,13 +45,13 @@ typedef struct {
|
||||||
|
|
||||||
typedef uint32_t fourcc_t;
|
typedef uint32_t fourcc_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t first_chunk;
|
uint32_t first_chunk;
|
||||||
uint32_t num_samples;
|
uint32_t num_samples;
|
||||||
} sample_to_chunk_t;
|
} sample_to_chunk_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint32_t sample_count;
|
uint32_t sample_count;
|
||||||
uint32_t sample_duration;
|
uint32_t sample_duration;
|
||||||
|
@ -73,10 +73,10 @@ typedef struct
|
||||||
|
|
||||||
int32_t sample_to_chunk_offset;
|
int32_t sample_to_chunk_offset;
|
||||||
uint32_t num_sample_to_chunks;
|
uint32_t num_sample_to_chunks;
|
||||||
|
|
||||||
sample_offset_t *lookup_table;
|
sample_offset_t *lookup_table;
|
||||||
uint32_t num_lookup_table;
|
uint32_t num_lookup_table;
|
||||||
|
|
||||||
time_to_sample_t *time_to_sample;
|
time_to_sample_t *time_to_sample;
|
||||||
uint32_t num_time_to_samples;
|
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);
|
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 get_sample_offset(demux_res_t *demux_res, uint32_t sample);
|
||||||
unsigned int m4a_seek (demux_res_t* demux_res, stream_t* stream,
|
unsigned int m4a_seek (demux_res_t* demux_res, stream_t* stream,
|
||||||
uint64_t sound_sample_loc, uint64_t* sound_samples_done,
|
uint64_t sound_sample_loc, uint64_t* sound_samples_done,
|
||||||
int* current_sample, int* lookup_table_idx);
|
uint32_t* current_sample, uint32_t* lookup_table_idx);
|
||||||
unsigned int m4a_seek_raw (demux_res_t* demux_res, stream_t* stream,
|
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);
|
int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *start);
|
||||||
|
|
||||||
#endif /* STREAM_H */
|
#endif /* STREAM_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue