summaryrefslogtreecommitdiffstats
path: root/apps/codecs/libm4a/m4a.h
diff options
context:
space:
mode:
authorAndree Buschmann <AndreeBuschmann@t-online.de>2011-04-18 19:12:51 +0000
committerAndree Buschmann <AndreeBuschmann@t-online.de>2011-04-18 19:12:51 +0000
commit68199cc19557ddb4a4c6357510a196ee6a487846 (patch)
treeabfab8127753b6a602626141552972a205947d1d /apps/codecs/libm4a/m4a.h
parentb6a68098795b0b6bc4735735e5e55cc9f6454436 (diff)
downloadrockbox-68199cc19557ddb4a4c6357510a196ee6a487846.tar.gz
rockbox-68199cc19557ddb4a4c6357510a196ee6a487846.tar.bz2
rockbox-68199cc19557ddb4a4c6357510a196ee6a487846.zip
Major rework of the m4a parser for aac/alac playback, seek and resume support. As a result the memory consumption was drastically reduced. This allows to play several files with long duration -- especially on low memory targets. The change builds a lookup table from m4a's sample_to_chunk[] and chunk_offset[] and completely removes the allocation of the large tables chunk_offset[] and sample_byte_size[]. To be able to remove reading and allocating sample_byte_offset[] the aac and alac decoder now buffer a fixed amount of bytes for each frame. The generated lookup table is used for seek/resume and skipping bytes in empty chunks (aac decoder only). The precision for seek/resume is somewhat lower but still equals 0.5 sec for the worst case. Fixes FS#8923.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29745 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libm4a/m4a.h')
-rw-r--r--apps/codecs/libm4a/m4a.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/codecs/libm4a/m4a.h b/apps/codecs/libm4a/m4a.h
index 2b361e8784..e49d14b832 100644
--- a/apps/codecs/libm4a/m4a.h
+++ b/apps/codecs/libm4a/m4a.h
@@ -59,6 +59,12 @@ typedef struct
typedef struct
{
+ uint32_t sample;
+ uint32_t offset;
+} sample_offset_t;
+
+typedef struct
+{
uint16_t num_channels;
uint16_t sound_sample_size;
uint32_t sound_sample_rate;
@@ -68,13 +74,12 @@ typedef struct
sample_to_chunk_t *sample_to_chunk;
uint32_t num_sample_to_chunks;
- uint32_t *chunk_offset;
- uint32_t num_chunk_offsets;
+ sample_offset_t *lookup_table;
+ uint32_t num_lookup_table;
time_to_sample_t *time_to_sample;
uint32_t num_time_to_samples;
- uint16_t *sample_byte_size;
uint32_t num_sample_byte_sizes;
uint32_t codecdata_len;
@@ -127,10 +132,11 @@ void stream_create(stream_t *stream,struct codec_api* ci);
int get_sample_info(demux_res_t *demux_res, uint32_t sample,
uint32_t *sample_duration, uint32_t *sample_byte_size);
unsigned int get_sample_offset(demux_res_t *demux_res, uint32_t sample);
-unsigned int alac_seek (demux_res_t* demux_res, stream_t* stream,
+unsigned int m4a_seek (demux_res_t* demux_res, stream_t* stream,
uint32_t sound_sample_loc, uint32_t* sound_samples_done,
int* current_sample);
-unsigned int alac_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, uint32_t* sound_samples_done, int* current_sample);
+int m4a_check_sample_offset(demux_res_t *demux_res, uint32_t frame);
#endif /* STREAM_H */