Avoid possible memory corruption
[kugel-rb.git] / apps / codecs / libm4a / demux.c
blob61ff16c0d918fbf803e552b97374730e6106f49f
1 /*
2 * ALAC (Apple Lossless Audio Codec) decoder
3 * Copyright (c) 2005 David Hammerton
4 * All rights reserved.
6 * This is the quicktime container demuxer.
8 * http://crazney.net/programs/itunes/alac.html
9 *
10 * Permission is hereby granted, free of charge, to any person
11 * obtaining a copy of this software and associated documentation
12 * files (the "Software"), to deal in the Software without
13 * restriction, including without limitation the rights to use,
14 * copy, modify, merge, publish, distribute, sublicense, and/or
15 * sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 * OTHER DEALINGS IN THE SOFTWARE.
32 #include <string.h>
33 #include <inttypes.h>
34 #include <stdlib.h>
36 #include "codeclib.h"
38 #include "m4a.h"
40 #if defined(DEBUG) || defined(SIMULATOR)
41 #ifdef DEBUGF
42 #undef DEBUGF
43 #endif
44 #define DEBUGF qtmovie->stream->ci->debugf
45 #else
46 #define DEBUGF(...)
47 #endif
49 typedef struct
51 stream_t *stream;
52 demux_res_t *res;
53 } qtmovie_t;
56 /* chunk handlers */
57 static void read_chunk_ftyp(qtmovie_t *qtmovie, size_t chunk_len)
59 fourcc_t type;
60 uint32_t minor_ver;
61 size_t size_remaining = chunk_len - 8;
63 type = stream_read_uint32(qtmovie->stream);
64 size_remaining-=4;
65 if ((type != MAKEFOURCC('M','4','A',' ')) &&
66 (type != MAKEFOURCC('M','4','B',' ')) &&
67 (type != MAKEFOURCC('m','p','4','2')) &&
68 (type != MAKEFOURCC('3','g','p','6')) &&
69 (type != MAKEFOURCC('q','t',' ',' ')))
71 DEBUGF("not M4A file\n");
72 return;
74 minor_ver = stream_read_uint32(qtmovie->stream);
75 size_remaining-=4;
77 /* compatible brands */
78 while (size_remaining)
80 /* unused */
81 /*fourcc_t cbrand =*/ stream_read_uint32(qtmovie->stream);
82 size_remaining-=4;
86 static uint32_t mp4ff_read_mp4_descr_length(stream_t* stream)
88 uint8_t b;
89 uint8_t numBytes = 0;
90 uint32_t length = 0;
94 b = stream_read_uint8(stream);
95 numBytes++;
96 length = (length << 7) | (b & 0x7F);
97 } while ((b & 0x80) && numBytes < 4);
99 return length;
102 /* The following function is based on mp4ff */
103 static bool read_chunk_esds(qtmovie_t *qtmovie, size_t chunk_len)
105 uint8_t tag;
106 uint32_t temp;
107 int audioType;
108 int32_t maxBitrate;
109 int32_t avgBitrate;
111 (void)chunk_len;
112 /* version and flags */
113 temp=stream_read_uint32(qtmovie->stream);
115 /* get and verify ES_DescrTag */
116 tag = stream_read_uint8(qtmovie->stream);
117 if (tag == 0x03)
119 /* read length */
120 if (mp4ff_read_mp4_descr_length(qtmovie->stream) < 5 + 15)
122 return false;
124 /* skip 3 bytes */
125 stream_skip(qtmovie->stream,3);
126 } else {
127 /* skip 2 bytes */
128 stream_skip(qtmovie->stream,2);
131 /* get and verify DecoderConfigDescrTab */
132 if (stream_read_uint8(qtmovie->stream) != 0x04)
134 return false;
137 /* read length */
138 temp = mp4ff_read_mp4_descr_length(qtmovie->stream);
139 if (temp < 13) return false;
141 audioType = stream_read_uint8(qtmovie->stream);
142 temp=stream_read_int32(qtmovie->stream);//0x15000414 ????
143 maxBitrate = stream_read_int32(qtmovie->stream);
144 avgBitrate = stream_read_int32(qtmovie->stream);
145 DEBUGF("audioType=%d, maxBitrate=%ld, avgBitrate=%ld\n",audioType,
146 (long)maxBitrate,(long)avgBitrate);
148 /* get and verify DecSpecificInfoTag */
149 if (stream_read_uint8(qtmovie->stream) != 0x05)
151 return false;
154 /* read length */
155 qtmovie->res->codecdata_len = mp4ff_read_mp4_descr_length(qtmovie->stream);
156 if (qtmovie->res->codecdata_len > MAX_CODECDATA_SIZE)
158 DEBUGF("codecdata too large (%d) in esds\n",
159 (int)qtmovie->res->codecdata_len);
160 return false;
163 stream_read(qtmovie->stream, qtmovie->res->codecdata_len, qtmovie->res->codecdata);
165 /* will skip the remainder of the atom */
166 return true;
169 static bool read_chunk_stsd(qtmovie_t *qtmovie, size_t chunk_len)
171 unsigned int i;
172 int j;
173 uint32_t numentries;
174 size_t size_remaining = chunk_len - 8;
176 /* version */
177 stream_read_uint8(qtmovie->stream);
178 size_remaining -= 1;
179 /* flags */
180 stream_read_uint8(qtmovie->stream);
181 stream_read_uint8(qtmovie->stream);
182 stream_read_uint8(qtmovie->stream);
183 size_remaining -= 3;
185 numentries = stream_read_uint32(qtmovie->stream);
186 size_remaining -= 4;
188 if (numentries != 1)
190 DEBUGF("only expecting one entry in sample description atom!\n");
191 return false;
194 for (i = 0; i < numentries; i++)
196 uint32_t entry_size;
198 uint32_t entry_remaining;
200 entry_size = stream_read_uint32(qtmovie->stream);
201 qtmovie->res->format = stream_read_uint32(qtmovie->stream);
202 DEBUGF("format: %c%c%c%c\n",SPLITFOURCC(qtmovie->res->format));
203 entry_remaining = entry_size;
204 entry_remaining -= 8;
206 /* sound info: */
208 /* reserved + data reference index + sound version + reserved */
209 stream_skip(qtmovie->stream, 6 + 2 + 2 + 6);
210 entry_remaining -= 6 + 2 + 2 + 6;
212 qtmovie->res->num_channels = stream_read_uint16(qtmovie->stream);
213 qtmovie->res->sound_sample_size = stream_read_uint16(qtmovie->stream);
214 entry_remaining -= 4;
216 /* packet size */
217 stream_skip(qtmovie->stream, 2);
218 qtmovie->res->sound_sample_rate = stream_read_uint32(qtmovie->stream);
219 /* reserved size */
220 stream_skip(qtmovie->stream, 2);
221 entry_remaining -= 8;
223 /* remaining is codec data */
225 if ((qtmovie->res->format==MAKEFOURCC('a','l','a','c'))) {
226 if (qtmovie->stream->ci->id3->codectype!=AFMT_MP4_ALAC) {
227 return false;
230 /* 12 = audio format atom, 8 = padding */
231 qtmovie->res->codecdata_len = entry_remaining + 12 + 8;
232 if (qtmovie->res->codecdata_len > MAX_CODECDATA_SIZE)
234 DEBUGF("codecdata too large (%d) in stsd\n",
235 (int)qtmovie->res->codecdata_len);
236 return false;
239 memset(qtmovie->res->codecdata, 0, qtmovie->res->codecdata_len);
240 /* audio format atom */
241 #if 0
242 /* The ALAC decoder skips these bytes, so there is no need to store them,
243 and this code isn't endian/alignment safe */
244 ((unsigned int*)qtmovie->res->codecdata)[0] = 0x0c000000;
245 ((unsigned int*)qtmovie->res->codecdata)[1] = MAKEFOURCC('a','m','r','f');
246 ((unsigned int*)qtmovie->res->codecdata)[2] = MAKEFOURCC('c','a','l','a');
247 #endif
249 stream_read(qtmovie->stream,
250 entry_remaining,
251 ((char*)qtmovie->res->codecdata) + 12);
252 entry_remaining -= entry_remaining;
254 if (entry_remaining)
255 stream_skip(qtmovie->stream, entry_remaining);
257 } else if (qtmovie->res->format==MAKEFOURCC('m','p','4','a')) {
258 if (qtmovie->stream->ci->id3->codectype!=AFMT_MP4_AAC) {
259 return false;
262 size_t sub_chunk_len;
263 fourcc_t sub_chunk_id;
265 sub_chunk_len = stream_read_uint32(qtmovie->stream);
266 if (sub_chunk_len <= 1 || sub_chunk_len > entry_remaining)
268 DEBUGF("strange size (%lu) for chunk inside mp4a\n",
269 (unsigned long)sub_chunk_len);
270 return false;
273 sub_chunk_id = stream_read_uint32(qtmovie->stream);
275 if (sub_chunk_id != MAKEFOURCC('e','s','d','s'))
277 DEBUGF("Expected esds chunk inside mp4a, found %c%c%c%c\n",SPLITFOURCC(sub_chunk_id));
278 return false;
281 j=qtmovie->stream->ci->curpos+sub_chunk_len-8;
282 if (read_chunk_esds(qtmovie,sub_chunk_len)) {
283 if (j!=qtmovie->stream->ci->curpos) {
284 DEBUGF("curpos=%ld, j=%d - Skipping %ld bytes\n",qtmovie->stream->ci->curpos,j,j-qtmovie->stream->ci->curpos);
285 stream_skip(qtmovie->stream,j-qtmovie->stream->ci->curpos);
287 entry_remaining-=sub_chunk_len;
288 } else {
289 DEBUGF("Error reading esds\n");
290 return false;
293 DEBUGF("entry_remaining=%ld\n",(long)entry_remaining);
294 stream_skip(qtmovie->stream,entry_remaining);
296 } else {
297 DEBUGF("expecting 'alac' or 'mp4a' data format, got %c%c%c%c\n",
298 SPLITFOURCC(qtmovie->res->format));
299 return false;
302 return true;
305 static bool read_chunk_stts(qtmovie_t *qtmovie, size_t chunk_len)
307 unsigned int i;
308 uint32_t numentries;
309 size_t size_remaining = chunk_len - 8;
311 /* version */
312 stream_read_uint8(qtmovie->stream);
313 size_remaining -= 1;
314 /* flags */
315 stream_read_uint8(qtmovie->stream);
316 stream_read_uint8(qtmovie->stream);
317 stream_read_uint8(qtmovie->stream);
318 size_remaining -= 3;
320 numentries = stream_read_uint32(qtmovie->stream);
321 size_remaining -= 4;
323 qtmovie->res->num_time_to_samples = numentries;
324 qtmovie->res->time_to_sample = malloc(numentries * sizeof(*qtmovie->res->time_to_sample));
326 if (!qtmovie->res->time_to_sample)
328 DEBUGF("stts too large\n");
329 return false;
332 for (i = 0; i < numentries; i++)
334 qtmovie->res->time_to_sample[i].sample_count = stream_read_uint32(qtmovie->stream);
335 qtmovie->res->time_to_sample[i].sample_duration = stream_read_uint32(qtmovie->stream);
336 size_remaining -= 8;
339 if (size_remaining)
341 DEBUGF("ehm, size remianing?\n");
342 stream_skip(qtmovie->stream, size_remaining);
345 return true;
348 static bool read_chunk_stsz(qtmovie_t *qtmovie, size_t chunk_len)
350 unsigned int i;
351 uint32_t numentries;
352 size_t size_remaining = chunk_len - 8;
354 /* version */
355 stream_read_uint8(qtmovie->stream);
356 size_remaining -= 1;
357 /* flags */
358 stream_read_uint8(qtmovie->stream);
359 stream_read_uint8(qtmovie->stream);
360 stream_read_uint8(qtmovie->stream);
361 size_remaining -= 3;
363 /* default sample size */
364 if (stream_read_uint32(qtmovie->stream) != 0)
366 DEBUGF("i was expecting variable samples sizes\n");
367 stream_read_uint32(qtmovie->stream);
368 size_remaining -= 4;
369 return true;
371 size_remaining -= 4;
373 numentries = stream_read_uint32(qtmovie->stream);
374 size_remaining -= 4;
376 qtmovie->res->num_sample_byte_sizes = numentries;
377 qtmovie->res->sample_byte_size = malloc(numentries * sizeof(*qtmovie->res->sample_byte_size));
379 if (!qtmovie->res->sample_byte_size)
381 DEBUGF("stsz too large\n");
382 return false;
385 for (i = 0; i < numentries; i++)
387 uint32_t v = stream_read_uint32(qtmovie->stream);
389 if (v > 0x0000ffff)
391 DEBUGF("stsz[%d] > 65 kB (%ld)\n", i, (long)v);
392 return false;
395 qtmovie->res->sample_byte_size[i] = v;
396 size_remaining -= 4;
399 if (size_remaining)
401 DEBUGF("ehm, size remianing?\n");
402 stream_skip(qtmovie->stream, size_remaining);
405 return true;
408 static bool read_chunk_stsc(qtmovie_t *qtmovie, size_t chunk_len)
410 unsigned int i;
411 uint32_t numentries;
412 size_t size_remaining = chunk_len - 8;
414 /* version + flags */
415 stream_read_uint32(qtmovie->stream);
416 size_remaining -= 4;
418 numentries = stream_read_uint32(qtmovie->stream);
419 size_remaining -= 4;
421 qtmovie->res->num_sample_to_chunks = numentries;
422 qtmovie->res->sample_to_chunk = malloc(numentries *
423 sizeof(*qtmovie->res->sample_to_chunk));
425 if (!qtmovie->res->sample_to_chunk)
427 DEBUGF("stsc too large\n");
428 return false;
431 for (i = 0; i < numentries; i++)
433 qtmovie->res->sample_to_chunk[i].first_chunk =
434 stream_read_uint32(qtmovie->stream);
435 qtmovie->res->sample_to_chunk[i].num_samples =
436 stream_read_uint32(qtmovie->stream);
437 stream_read_uint32(qtmovie->stream);
438 size_remaining -= 12;
441 if (size_remaining)
443 DEBUGF("ehm, size remianing?\n");
444 stream_skip(qtmovie->stream, size_remaining);
447 return true;
450 static bool read_chunk_stco(qtmovie_t *qtmovie, size_t chunk_len)
452 unsigned int i;
453 uint32_t numentries;
454 size_t size_remaining = chunk_len - 8;
456 /* version + flags */
457 stream_read_uint32(qtmovie->stream);
458 size_remaining -= 4;
460 numentries = stream_read_uint32(qtmovie->stream);
461 size_remaining -= 4;
463 qtmovie->res->num_chunk_offsets = numentries;
464 qtmovie->res->chunk_offset = malloc(numentries *
465 sizeof(*qtmovie->res->chunk_offset));
467 if (!qtmovie->res->chunk_offset)
469 DEBUGF("stco too large\n");
470 return false;
473 for (i = 0; i < numentries; i++)
475 qtmovie->res->chunk_offset[i] = stream_read_uint32(qtmovie->stream);
476 size_remaining -= 4;
479 if (size_remaining)
481 DEBUGF("ehm, size remianing?\n");
482 stream_skip(qtmovie->stream, size_remaining);
485 return true;
488 static bool read_chunk_stbl(qtmovie_t *qtmovie, size_t chunk_len)
490 size_t size_remaining = chunk_len - 8;
492 while (size_remaining)
494 size_t sub_chunk_len;
495 fourcc_t sub_chunk_id;
497 sub_chunk_len = stream_read_uint32(qtmovie->stream);
498 if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining)
500 DEBUGF("strange size (%lu) for chunk inside stbl\n",
501 (unsigned long)sub_chunk_len);
502 return false;
505 sub_chunk_id = stream_read_uint32(qtmovie->stream);
507 switch (sub_chunk_id)
509 case MAKEFOURCC('s','t','s','d'):
510 if (!read_chunk_stsd(qtmovie, sub_chunk_len)) {
511 return false;
513 break;
514 case MAKEFOURCC('s','t','t','s'):
515 if (!read_chunk_stts(qtmovie, sub_chunk_len))
517 return false;
519 break;
520 case MAKEFOURCC('s','t','s','z'):
521 if (!read_chunk_stsz(qtmovie, sub_chunk_len))
523 return false;
525 break;
526 case MAKEFOURCC('s','t','s','c'):
527 if (!read_chunk_stsc(qtmovie, sub_chunk_len))
529 return false;
531 break;
532 case MAKEFOURCC('s','t','c','o'):
533 if (!read_chunk_stco(qtmovie, sub_chunk_len))
535 return false;
537 break;
538 default:
539 /*DEBUGF("(stbl) unknown chunk id: %c%c%c%c\n",
540 SPLITFOURCC(sub_chunk_id));*/
541 stream_skip(qtmovie->stream, sub_chunk_len - 8);
544 size_remaining -= sub_chunk_len;
546 return true;
549 static bool read_chunk_minf(qtmovie_t *qtmovie, size_t chunk_len)
551 size_t size_remaining = chunk_len - 8;
552 uint32_t i;
554 /* Check for smhd, only kind of minf we care about */
556 if ((i = stream_read_uint32(qtmovie->stream)) != 16)
558 DEBUGF("unexpected size in media info: %ld\n", (long)i);
559 stream_skip(qtmovie->stream, size_remaining-4);
560 return true;
563 if (stream_read_uint32(qtmovie->stream) != MAKEFOURCC('s','m','h','d'))
565 DEBUGF("not a sound header! can't handle this.\n");
566 return false;
569 /* now skip the rest of the atom */
570 stream_skip(qtmovie->stream, 16 - 8);
571 size_remaining -= 16;
573 while (size_remaining)
575 size_t sub_chunk_len;
576 fourcc_t sub_chunk_id;
578 sub_chunk_len = stream_read_uint32(qtmovie->stream);
580 if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining)
582 DEBUGF("strange size (%lu) for chunk inside minf\n",
583 (unsigned long)sub_chunk_len);
584 return false;
587 sub_chunk_id = stream_read_uint32(qtmovie->stream);
589 switch (sub_chunk_id)
591 case MAKEFOURCC('s','t','b','l'):
592 if (!read_chunk_stbl(qtmovie, sub_chunk_len)) {
593 return false;
595 break;
596 default:
597 /*DEBUGF("(minf) unknown chunk id: %c%c%c%c\n",
598 SPLITFOURCC(sub_chunk_id));*/
599 stream_skip(qtmovie->stream, sub_chunk_len - 8);
600 break;
603 size_remaining -= sub_chunk_len;
605 return true;
608 static bool read_chunk_mdia(qtmovie_t *qtmovie, size_t chunk_len)
610 size_t size_remaining = chunk_len - 8;
612 while (size_remaining)
614 size_t sub_chunk_len;
615 fourcc_t sub_chunk_id;
617 sub_chunk_len = stream_read_uint32(qtmovie->stream);
618 if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining)
620 DEBUGF("strange size (%lu) for chunk inside mdia\n",
621 (unsigned long)sub_chunk_len);
622 return false;
625 sub_chunk_id = stream_read_uint32(qtmovie->stream);
627 switch (sub_chunk_id)
629 case MAKEFOURCC('m','i','n','f'):
630 if (!read_chunk_minf(qtmovie, sub_chunk_len)) {
631 return false;
633 break;
634 default:
635 /*DEBUGF("(mdia) unknown chunk id: %c%c%c%c\n",
636 SPLITFOURCC(sub_chunk_id));*/
637 stream_skip(qtmovie->stream, sub_chunk_len - 8);
638 break;
641 size_remaining -= sub_chunk_len;
643 return true;
646 /* 'trak' - a movie track - contains other atoms */
647 static bool read_chunk_trak(qtmovie_t *qtmovie, size_t chunk_len)
649 size_t size_remaining = chunk_len - 8;
651 while (size_remaining)
653 size_t sub_chunk_len;
654 fourcc_t sub_chunk_id;
656 sub_chunk_len = stream_read_uint32(qtmovie->stream);
657 if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining)
659 DEBUGF("strange size (%lu) for chunk inside trak\n",
660 (unsigned long)sub_chunk_len);
661 return false;
664 sub_chunk_id = stream_read_uint32(qtmovie->stream);
666 switch (sub_chunk_id)
668 case MAKEFOURCC('m','d','i','a'):
669 if (!read_chunk_mdia(qtmovie, sub_chunk_len)) {
670 return false;
672 break;
673 default:
674 /*DEBUGF("(trak) unknown chunk id: %c%c%c%c\n",
675 SPLITFOURCC(sub_chunk_id));*/
676 stream_skip(qtmovie->stream, sub_chunk_len - 8);
677 break;
680 size_remaining -= sub_chunk_len;
682 return true;
685 /* 'moov' movie atom - contains other atoms */
686 static bool read_chunk_moov(qtmovie_t *qtmovie, size_t chunk_len)
688 size_t size_remaining = chunk_len - 8;
690 while (size_remaining)
692 size_t sub_chunk_len;
693 fourcc_t sub_chunk_id;
695 sub_chunk_len = stream_read_uint32(qtmovie->stream);
696 if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining)
698 DEBUGF("strange size (%lu) for chunk inside moov\n",
699 (unsigned long)sub_chunk_len);
700 return false;
703 sub_chunk_id = stream_read_uint32(qtmovie->stream);
705 switch (sub_chunk_id)
707 case MAKEFOURCC('t','r','a','k'):
708 if (!read_chunk_trak(qtmovie, sub_chunk_len)) {
709 return false;
711 break;
712 default:
713 /*DEBUGF("(moov) unknown chunk id: %c%c%c%c\n",
714 SPLITFOURCC(sub_chunk_id));*/
715 stream_skip(qtmovie->stream, sub_chunk_len - 8);
716 break;
719 size_remaining -= sub_chunk_len;
721 return true;
724 static void read_chunk_mdat(qtmovie_t *qtmovie, size_t chunk_len)
726 size_t size_remaining = chunk_len - 8;
728 qtmovie->res->mdat_len = size_remaining;
731 int qtmovie_read(stream_t *file, demux_res_t *demux_res)
733 qtmovie_t qtmovie;
735 /* construct the stream */
736 qtmovie.stream = file;
737 qtmovie.res = demux_res;
739 /* read the chunks */
740 while (1)
742 size_t chunk_len;
743 fourcc_t chunk_id;
745 chunk_len = stream_read_uint32(qtmovie.stream);
746 if (stream_eof(qtmovie.stream))
748 return 0;
751 if (chunk_len == 1)
753 //DEBUGF("need 64bit support\n");
754 return 0;
756 chunk_id = stream_read_uint32(qtmovie.stream);
758 //DEBUGF("Found a chunk %c%c%c%c, length=%d\n",SPLITFOURCC(chunk_id),chunk_len);
759 switch (chunk_id)
761 case MAKEFOURCC('f','t','y','p'):
762 read_chunk_ftyp(&qtmovie, chunk_len);
763 break;
764 case MAKEFOURCC('m','o','o','v'):
765 if (!read_chunk_moov(&qtmovie, chunk_len)) {
766 return 0;
768 break;
769 /* once we hit mdat we stop reading and return.
770 * this is on the assumption that there is no furhter interesting
771 * stuff in the stream. if there is stuff will fail (:()).
772 * But we need the read pointer to be at the mdat stuff
773 * for the decoder. And we don't want to rely on fseek/ftell,
774 * as they may not always be avilable */
775 case MAKEFOURCC('m','d','a','t'):
776 read_chunk_mdat(&qtmovie, chunk_len);
777 /* Keep track of start of stream in file - used for seeking */
778 qtmovie.res->mdat_offset=stream_tell(qtmovie.stream);
779 /* There can be empty mdats before the real one. If so, skip them */
780 if (qtmovie.res->mdat_len > 0) {
781 return 1;
783 break;
785 /* these following atoms can be skipped !!!! */
786 case MAKEFOURCC('f','r','e','e'):
787 stream_skip(qtmovie.stream, chunk_len - 8);
788 break;
789 default:
790 //DEBUGF("(top) unknown chunk id: %c%c%c%c\n",SPLITFOURCC(chunk_id));
791 return 0;
795 return 0;