summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libm4a/m4a.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libm4a/m4a.c')
-rw-r--r--lib/rbcodec/codecs/libm4a/m4a.c26
1 files changed, 13 insertions, 13 deletions
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)
114 114
115/* Check if there is a dedicated byte position contained for the given frame. 115/* Check if there is a dedicated byte position contained for the given frame.
116 * Return this byte position in case of success or return -1. This allows to 116 * Return this byte position in case of success or return -1. This allows to
117 * skip empty samples. 117 * skip empty samples.
118 * During standard playback the search result (index i) will always increase. 118 * During standard playback the search result (index i) will always increase.
119 * Therefor we save this index and let the caller set this value again as start 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 * reduces the overall loop count significantly. */ 121 * reduces the overall loop count significantly. */
122int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *start) 122int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *start)
123{ 123{
@@ -139,9 +139,9 @@ int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame, uint32_t *st
139 139
140/* Seek to desired sound sample location. Return 1 on success (and modify 140/* Seek to desired sound sample location. Return 1 on success (and modify
141 * sound_samples_done and current_sample), 0 if failed. */ 141 * sound_samples_done and current_sample), 0 if failed. */
142unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream, 142unsigned 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, int* lookup_table_idx) 144 uint32_t* current_sample, uint32_t* 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;
@@ -257,7 +257,7 @@ unsigned int m4a_seek(demux_res_t* demux_res, stream_t* stream,
257 * 1) the lookup_table array contains the file offset for the first sample 257 * 1) the lookup_table array contains the file offset for the first sample
258 * of each chunk. 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 * of each sample of data. 261 * of each sample of data.
262 * 262 *
263 * Locate the chunk containing location (using lookup_table), find the first 263 * 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,
265 * calculate the sound_samples_done value. 265 * calculate the sound_samples_done value.
266 */ 266 */
267unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream, 267unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream,
268 uint32_t file_loc, uint64_t* sound_samples_done, 268 uint32_t file_loc, uint64_t* sound_samples_done,
269 int* current_sample, int* lookup_table_idx) 269 uint32_t* current_sample, uint32_t* lookup_table_idx)
270{ 270{
271 uint32_t i; 271 uint32_t i;
272 uint32_t chunk_sample = 0; 272 uint32_t chunk_sample = 0;
@@ -276,7 +276,7 @@ unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream,
276 uint32_t tmp_cnt; 276 uint32_t tmp_cnt;
277 uint32_t new_pos; 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 * Return the associated sample to this chunk as chunk_sample. */ 280 * Return the associated sample to this chunk as chunk_sample. */
281 for (i=0; i < demux_res->num_lookup_table; ++i) 281 for (i=0; i < demux_res->num_lookup_table; ++i)
282 { 282 {
@@ -287,7 +287,7 @@ unsigned int m4a_seek_raw(demux_res_t* demux_res, stream_t* stream,
287 *lookup_table_idx = i; 287 *lookup_table_idx = i;
288 chunk_sample = demux_res->lookup_table[i].sample; 288 chunk_sample = demux_res->lookup_table[i].sample;
289 new_pos = demux_res->lookup_table[i].offset; 289 new_pos = demux_res->lookup_table[i].offset;
290 290
291 /* Get sound sample offset. */ 291 /* Get sound sample offset. */
292 i = 0; 292 i = 0;
293 time_to_sample_t *tab2 = demux_res->time_to_sample; 293 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,
306 } 306 }
307 307
308 /* Go to the new file position. */ 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 *sound_samples_done = new_sound_sample; 311 *sound_samples_done = new_sound_sample;
312 *current_sample = chunk_sample; 312 *current_sample = chunk_sample;
313 return 1; 313 return 1;
314 } 314 }
315 315
316 return 0; 316 return 0;
317} 317}