diff options
Diffstat (limited to 'apps/codecs/libm4a')
-rw-r--r-- | apps/codecs/libm4a/demux.c | 6 | ||||
-rw-r--r-- | apps/codecs/libm4a/m4a.c | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/apps/codecs/libm4a/demux.c b/apps/codecs/libm4a/demux.c index 34bc07556b..10972f8b1f 100644 --- a/apps/codecs/libm4a/demux.c +++ b/apps/codecs/libm4a/demux.c | |||
@@ -762,7 +762,11 @@ int qtmovie_read(stream_t *file, demux_res_t *demux_res) | |||
762 | read_chunk_mdat(&qtmovie, chunk_len); | 762 | read_chunk_mdat(&qtmovie, chunk_len); |
763 | /* Keep track of start of stream in file - used for seeking */ | 763 | /* Keep track of start of stream in file - used for seeking */ |
764 | qtmovie.res->mdat_offset=stream_tell(qtmovie.stream); | 764 | qtmovie.res->mdat_offset=stream_tell(qtmovie.stream); |
765 | return 1; | 765 | /* There can be empty mdats before the real one. If so, skip them */ |
766 | if (qtmovie.res->mdat_len > 0) { | ||
767 | return 1; | ||
768 | } | ||
769 | break; | ||
766 | 770 | ||
767 | /* these following atoms can be skipped !!!! */ | 771 | /* these following atoms can be skipped !!!! */ |
768 | case MAKEFOURCC('f','r','e','e'): | 772 | case MAKEFOURCC('f','r','e','e'): |
diff --git a/apps/codecs/libm4a/m4a.c b/apps/codecs/libm4a/m4a.c index 0a87ec35ea..f5aaeca302 100644 --- a/apps/codecs/libm4a/m4a.c +++ b/apps/codecs/libm4a/m4a.c | |||
@@ -199,7 +199,7 @@ unsigned int get_sample_offset(demux_res_t *demux_res, uint32_t sample) | |||
199 | prev_chunk_samples = demux_res->sample_to_chunk[i].num_samples; | 199 | prev_chunk_samples = demux_res->sample_to_chunk[i].num_samples; |
200 | } | 200 | } |
201 | 201 | ||
202 | if (demux_res->num_sample_to_chunks > 1) | 202 | if (sample >= demux_res->sample_to_chunk[0].num_samples) |
203 | { | 203 | { |
204 | chunk = prev_chunk + (sample - total_samples) / prev_chunk_samples; | 204 | chunk = prev_chunk + (sample - total_samples) / prev_chunk_samples; |
205 | } | 205 | } |
@@ -223,7 +223,8 @@ unsigned int get_sample_offset(demux_res_t *demux_res, uint32_t sample) | |||
223 | file_offset = demux_res->chunk_offset[chunk - 1]; | 223 | file_offset = demux_res->chunk_offset[chunk - 1]; |
224 | } | 224 | } |
225 | 225 | ||
226 | if (chunk_sample > sample) { | 226 | if (chunk_sample > sample) |
227 | { | ||
227 | return 0; | 228 | return 0; |
228 | } | 229 | } |
229 | 230 | ||