diff options
Diffstat (limited to 'lib/rbcodec/codecs/aac.c')
-rw-r--r-- | lib/rbcodec/codecs/aac.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/rbcodec/codecs/aac.c b/lib/rbcodec/codecs/aac.c index c9cf737b48..015e332be2 100644 --- a/lib/rbcodec/codecs/aac.c +++ b/lib/rbcodec/codecs/aac.c | |||
@@ -72,6 +72,7 @@ enum codec_status codec_run(void) | |||
72 | uint32_t sbr_fac = 1; | 72 | uint32_t sbr_fac = 1; |
73 | unsigned char c = 0; | 73 | unsigned char c = 0; |
74 | void *ret; | 74 | void *ret; |
75 | enum codec_command_action action; | ||
75 | intptr_t param; | 76 | intptr_t param; |
76 | bool empty_first_frame = false; | 77 | bool empty_first_frame = false; |
77 | 78 | ||
@@ -82,6 +83,8 @@ enum codec_status codec_run(void) | |||
82 | return CODEC_ERROR; | 83 | return CODEC_ERROR; |
83 | } | 84 | } |
84 | 85 | ||
86 | action = CODEC_ACTION_NULL; | ||
87 | param = ci->id3->elapsed; | ||
85 | file_offset = ci->id3->offset; | 88 | file_offset = ci->id3->offset; |
86 | 89 | ||
87 | ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency); | 90 | ci->configure(DSP_SET_FREQUENCY, ci->id3->frequency); |
@@ -138,11 +141,16 @@ enum codec_status codec_run(void) | |||
138 | sound_samples_done = 0; | 141 | sound_samples_done = 0; |
139 | } | 142 | } |
140 | NeAACDecPostSeekReset(decoder, i); | 143 | NeAACDecPostSeekReset(decoder, i); |
144 | elapsed_time = (sound_samples_done * 10) / | ||
145 | (ci->id3->frequency / 100); | ||
146 | } else if (param) { | ||
147 | elapsed_time = param; | ||
148 | action = CODEC_ACTION_SEEK_TIME; | ||
141 | } else { | 149 | } else { |
150 | elapsed_time = 0; | ||
142 | sound_samples_done = 0; | 151 | sound_samples_done = 0; |
143 | } | 152 | } |
144 | 153 | ||
145 | elapsed_time = (sound_samples_done * 10) / (ci->id3->frequency / 100); | ||
146 | ci->set_elapsed(elapsed_time); | 154 | ci->set_elapsed(elapsed_time); |
147 | 155 | ||
148 | if (i == 0) | 156 | if (i == 0) |
@@ -152,7 +160,8 @@ enum codec_status codec_run(void) | |||
152 | 160 | ||
153 | /* The main decoding loop */ | 161 | /* The main decoding loop */ |
154 | while (i < demux_res.num_sample_byte_sizes) { | 162 | while (i < demux_res.num_sample_byte_sizes) { |
155 | enum codec_command_action action = ci->get_command(¶m); | 163 | if (action == CODEC_ACTION_NULL) |
164 | action = ci->get_command(¶m); | ||
156 | 165 | ||
157 | if (action == CODEC_ACTION_HALT) | 166 | if (action == CODEC_ACTION_HALT) |
158 | break; | 167 | break; |
@@ -180,6 +189,8 @@ enum codec_status codec_run(void) | |||
180 | ci->seek_complete(); | 189 | ci->seek_complete(); |
181 | } | 190 | } |
182 | 191 | ||
192 | action = CODEC_ACTION_NULL; | ||
193 | |||
183 | /* There can be gaps between chunks, so skip ahead if needed. It | 194 | /* There can be gaps between chunks, so skip ahead if needed. It |
184 | * doesn't seem to happen much, but it probably means that a | 195 | * doesn't seem to happen much, but it probably means that a |
185 | * "proper" file can have chunks out of order. Why one would want | 196 | * "proper" file can have chunks out of order. Why one would want |