Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/lib/rbcodec/codecs/libm4a/demux.c b/lib/rbcodec/codecs/libm4a/demux.c
- index 3bf46ef..6ed8756 100644
- --- a/lib/rbcodec/codecs/libm4a/demux.c
- +++ b/lib/rbcodec/codecs/libm4a/demux.c
- @@ -65,7 +65,8 @@ static void read_chunk_ftyp(qtmovie_t *qtmovie, size_t chunk_len)
- (type != MAKEFOURCC('m','p','4','2')) &&
- (type != MAKEFOURCC('3','g','p','6')) &&
- (type != MAKEFOURCC('q','t',' ',' ')) &&
- - (type != MAKEFOURCC('i','s','o','m')))
- + (type != MAKEFOURCC('i','s','o','m')) &&
- + (type != MAKEFOURCC('M','4','A','\0')))
- {
- DEBUGF("not M4A file\n");
- return;
- @@ -425,6 +426,7 @@ static bool read_chunk_stco(qtmovie_t *qtmovie, size_t chunk_len)
- {
- uint32_t i, k, old_i;
- uint32_t numentries;
- + uint32_t table_reduce_factor;
- uint32_t idx = 0;
- uint32_t frame;
- uint32_t offset;
- @@ -440,9 +442,12 @@ static bool read_chunk_stco(qtmovie_t *qtmovie, size_t chunk_len)
- numentries = stream_read_uint32(qtmovie->stream);
- size_remaining -= 4;
- - qtmovie->res->num_lookup_table = numentries;
- - qtmovie->res->lookup_table = malloc(numentries * sizeof(*qtmovie->res->lookup_table));
- -
- + for (i = 0; !qtmovie->res->lookup_table; ++i) {
- + qtmovie->res->lookup_table = malloc((numentries >> i) * sizeof(*qtmovie->res->lookup_table));
- + }
- + table_reduce_factor = i > 0 ? i - 1 : 0;
- + qtmovie->res->num_lookup_table = numentries >> table_reduce_factor;
- +
- if (!qtmovie->res->lookup_table)
- {
- DEBUGF("stco too large to allocate lookup_table[]\n");
- @@ -489,10 +494,11 @@ static bool read_chunk_stco(qtmovie_t *qtmovie, size_t chunk_len)
- frame += (new_first - old_first) * old_frame;
- }
- frame += (k - old_first) * old_frame;
- -
- - qtmovie->res->lookup_table[idx].sample = frame;
- - qtmovie->res->lookup_table[idx].offset = offset;
- - idx++;
- + if (!(k % (1 << table_reduce_factor))) {
- + qtmovie->res->lookup_table[idx].sample = frame;
- + qtmovie->res->lookup_table[idx].offset = offset;
- + idx++;
- + }
- frame -= (k - old_first) * old_frame;
- diff --git a/lib/rbcodec/metadata/mp4.c b/lib/rbcodec/metadata/mp4.c
- index 6973d3a..d1fc6f4 100644
- --- a/lib/rbcodec/metadata/mp4.c
- +++ b/lib/rbcodec/metadata/mp4.c
- @@ -605,7 +605,7 @@ static bool read_mp4_container(int fd, struct mp3entry* id3,
- if ((id != MP4_M4A) && (id != MP4_M4B) && (id != MP4_mp42)
- && (id != MP4_qt) && (id != MP4_3gp6) && (id != MP4_m4a)
- - && (id != MP4_isom))
- + && (id != MP4_isom) && id != 1295270144)
- {
- DEBUGF("Unknown MP4 file type: '%c%c%c%c'\n",
- (int)(id >> 24 & 0xff), (int)(id >> 16 & 0xff),
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement