2 * ALAC (Apple Lossless Audio Codec) decoder
3 * Copyright (c) 2005 David Hammerton
6 * This is the quicktime container demuxer.
8 * http://crazney.net/programs/itunes/alac.html
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.
42 #define DEBUGF qtmovie->stream->ci->debugf
55 static void read_chunk_ftyp(qtmovie_t
*qtmovie
, size_t chunk_len
)
59 size_t size_remaining
= chunk_len
- 8;
61 type
= stream_read_uint32(qtmovie
->stream
);
63 if ((type
!= MAKEFOURCC('M','4','A',' ')) &&
64 (type
!= MAKEFOURCC('m','4','a',' ')) &&
65 (type
!= MAKEFOURCC('M','4','B',' ')) &&
66 (type
!= MAKEFOURCC('m','p','4','2')) &&
67 (type
!= MAKEFOURCC('3','g','p','6')) &&
68 (type
!= MAKEFOURCC('q','t',' ',' ')) &&
69 (type
!= MAKEFOURCC('i','s','o','m')))
71 DEBUGF("not M4A file\n");
74 minor_ver
= stream_read_uint32(qtmovie
->stream
);
77 /* compatible brands */
78 while (size_remaining
)
81 /*fourcc_t cbrand =*/ stream_read_uint32(qtmovie
->stream
);
86 static uint32_t mp4ff_read_mp4_descr_length(stream_t
* stream
)
94 b
= stream_read_uint8(stream
);
96 length
= (length
<< 7) | (b
& 0x7F);
97 } while ((b
& 0x80) && numBytes
< 4);
102 /* The following function is based on mp4ff */
103 static bool read_chunk_esds(qtmovie_t
*qtmovie
, size_t 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
);
120 if (mp4ff_read_mp4_descr_length(qtmovie
->stream
) < 5 + 15)
125 stream_skip(qtmovie
->stream
,3);
128 stream_skip(qtmovie
->stream
,2);
131 /* get and verify DecoderConfigDescrTab */
132 if (stream_read_uint8(qtmovie
->stream
) != 0x04)
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)
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
);
163 stream_read(qtmovie
->stream
, qtmovie
->res
->codecdata_len
, qtmovie
->res
->codecdata
);
165 /* will skip the remainder of the atom */
169 static bool read_chunk_stsd(qtmovie_t
*qtmovie
, size_t chunk_len
)
174 size_t size_remaining
= chunk_len
- 8;
175 bool got_codec_data
= false;
178 stream_read_uint8(qtmovie
->stream
);
181 stream_read_uint8(qtmovie
->stream
);
182 stream_read_uint8(qtmovie
->stream
);
183 stream_read_uint8(qtmovie
->stream
);
186 numentries
= stream_read_uint32(qtmovie
->stream
);
189 /* if (numentries != 1)
191 DEBUGF("only expecting one entry in sample description atom!\n");
195 for (i
= 0; i
< numentries
; i
++)
199 uint32_t entry_remaining
;
201 entry_size
= stream_read_uint32(qtmovie
->stream
);
202 qtmovie
->res
->format
= stream_read_uint32(qtmovie
->stream
);
203 DEBUGF("format: %c%c%c%c\n",SPLITFOURCC(qtmovie
->res
->format
));
204 entry_remaining
= entry_size
;
205 entry_remaining
-= 8;
209 /* reserved + data reference index + sound version + reserved */
210 stream_skip(qtmovie
->stream
, 6 + 2 + 2 + 6);
211 entry_remaining
-= 6 + 2 + 2 + 6;
213 qtmovie
->res
->num_channels
= stream_read_uint16(qtmovie
->stream
);
214 qtmovie
->res
->sound_sample_size
= stream_read_uint16(qtmovie
->stream
);
215 entry_remaining
-= 4;
218 stream_skip(qtmovie
->stream
, 2);
219 qtmovie
->res
->sound_sample_rate
= stream_read_uint32(qtmovie
->stream
);
221 stream_skip(qtmovie
->stream
, 2);
222 entry_remaining
-= 8;
224 /* remaining is codec data */
226 if ((qtmovie
->res
->format
==MAKEFOURCC('a','l','a','c'))) {
227 if (qtmovie
->stream
->ci
->id3
->codectype
!=AFMT_MP4_ALAC
) {
231 /* 12 = audio format atom, 8 = padding */
232 qtmovie
->res
->codecdata_len
= entry_remaining
+ 12 + 8;
233 if (qtmovie
->res
->codecdata_len
> MAX_CODECDATA_SIZE
)
235 DEBUGF("codecdata too large (%d) in stsd\n",
236 (int)qtmovie
->res
->codecdata_len
);
240 memset(qtmovie
->res
->codecdata
, 0, qtmovie
->res
->codecdata_len
);
241 /* audio format atom */
243 /* The ALAC decoder skips these bytes, so there is no need to store them,
244 and this code isn't endian/alignment safe */
245 ((unsigned int*)qtmovie
->res
->codecdata
)[0] = 0x0c000000;
246 ((unsigned int*)qtmovie
->res
->codecdata
)[1] = MAKEFOURCC('a','m','r','f');
247 ((unsigned int*)qtmovie
->res
->codecdata
)[2] = MAKEFOURCC('c','a','l','a');
250 stream_read(qtmovie
->stream
,
252 ((char*)qtmovie
->res
->codecdata
) + 12);
253 entry_remaining
-= entry_remaining
;
254 got_codec_data
= true;
257 stream_skip(qtmovie
->stream
, entry_remaining
);
259 } else if (qtmovie
->res
->format
==MAKEFOURCC('m','p','4','a')) {
260 if (qtmovie
->stream
->ci
->id3
->codectype
!=AFMT_MP4_AAC
&&
261 qtmovie
->stream
->ci
->id3
->codectype
!=AFMT_MP4_AAC_HE
) {
265 size_t sub_chunk_len
;
266 fourcc_t sub_chunk_id
;
268 sub_chunk_len
= stream_read_uint32(qtmovie
->stream
);
269 if (sub_chunk_len
<= 1 || sub_chunk_len
> entry_remaining
)
271 DEBUGF("strange size (%lu) for chunk inside mp4a\n",
272 (unsigned long)sub_chunk_len
);
276 sub_chunk_id
= stream_read_uint32(qtmovie
->stream
);
278 if (sub_chunk_id
!= MAKEFOURCC('e','s','d','s'))
280 DEBUGF("Expected esds chunk inside mp4a, found %c%c%c%c\n",SPLITFOURCC(sub_chunk_id
));
284 j
=qtmovie
->stream
->ci
->curpos
+sub_chunk_len
-8;
285 if (read_chunk_esds(qtmovie
,sub_chunk_len
)) {
286 if (j
!=qtmovie
->stream
->ci
->curpos
) {
287 DEBUGF("curpos=%ld, j=%d - Skipping %ld bytes\n",qtmovie
->stream
->ci
->curpos
,j
,j
-qtmovie
->stream
->ci
->curpos
);
288 stream_skip(qtmovie
->stream
,j
-qtmovie
->stream
->ci
->curpos
);
290 got_codec_data
= true;
291 entry_remaining
-=sub_chunk_len
;
293 DEBUGF("Error reading esds\n");
297 DEBUGF("entry_remaining=%ld\n",(long)entry_remaining
);
298 stream_skip(qtmovie
->stream
,entry_remaining
);
300 } else if (qtmovie
->res
->format
==MAKEFOURCC('f','r','e','e')) {
301 /* Skip "filler" atom */
302 stream_skip(qtmovie
->stream
,entry_remaining
);
304 DEBUGF("expecting 'alac', 'mp4a' or 'free' data format, got %c%c%c%c\n",
305 SPLITFOURCC(qtmovie
->res
->format
));
309 return got_codec_data
;
312 static bool read_chunk_stts(qtmovie_t
*qtmovie
, size_t chunk_len
)
316 size_t size_remaining
= chunk_len
- 8;
319 stream_read_uint8(qtmovie
->stream
);
322 stream_read_uint8(qtmovie
->stream
);
323 stream_read_uint8(qtmovie
->stream
);
324 stream_read_uint8(qtmovie
->stream
);
327 numentries
= stream_read_uint32(qtmovie
->stream
);
330 qtmovie
->res
->num_time_to_samples
= numentries
;
331 qtmovie
->res
->time_to_sample
= malloc(numentries
* sizeof(*qtmovie
->res
->time_to_sample
));
333 if (!qtmovie
->res
->time_to_sample
)
335 DEBUGF("stts too large\n");
339 for (i
= 0; i
< numentries
; i
++)
341 qtmovie
->res
->time_to_sample
[i
].sample_count
= stream_read_uint32(qtmovie
->stream
);
342 qtmovie
->res
->time_to_sample
[i
].sample_duration
= stream_read_uint32(qtmovie
->stream
);
348 DEBUGF("ehm, size remianing?\n");
349 stream_skip(qtmovie
->stream
, size_remaining
);
355 static bool read_chunk_stsz(qtmovie_t
*qtmovie
, size_t chunk_len
)
357 size_t size_remaining
= chunk_len
- 8;
360 stream_read_uint8(qtmovie
->stream
);
363 stream_read_uint8(qtmovie
->stream
);
364 stream_read_uint8(qtmovie
->stream
);
365 stream_read_uint8(qtmovie
->stream
);
368 /* default sample size */
369 if (stream_read_uint32(qtmovie
->stream
) != 0)
371 DEBUGF("i was expecting variable samples sizes\n");
372 stream_read_uint32(qtmovie
->stream
);
378 qtmovie
->res
->num_sample_byte_sizes
= stream_read_uint32(qtmovie
->stream
);
383 stream_skip(qtmovie
->stream
, size_remaining
);
389 static bool read_chunk_stsc(qtmovie_t
*qtmovie
, size_t chunk_len
)
393 size_t size_remaining
= chunk_len
- 8;
395 /* version + flags */
396 stream_read_uint32(qtmovie
->stream
);
399 numentries
= stream_read_uint32(qtmovie
->stream
);
402 qtmovie
->res
->num_sample_to_chunks
= numentries
;
403 qtmovie
->res
->sample_to_chunk
= malloc(numentries
* sizeof(sample_to_chunk_t
));
405 if (!qtmovie
->res
->sample_to_chunk
)
407 DEBUGF("stsc too large\n");
411 for (i
= 0; i
< numentries
; i
++)
413 qtmovie
->res
->sample_to_chunk
[i
].first_chunk
=
414 stream_read_uint32(qtmovie
->stream
);
415 qtmovie
->res
->sample_to_chunk
[i
].num_samples
=
416 stream_read_uint32(qtmovie
->stream
);
417 stream_read_uint32(qtmovie
->stream
);
418 size_remaining
-= 12;
423 DEBUGF("ehm, size remianing?\n");
424 stream_skip(qtmovie
->stream
, size_remaining
);
430 static bool read_chunk_stco(qtmovie_t
*qtmovie
, size_t chunk_len
)
432 uint32_t i
, k
, old_i
;
440 size_t size_remaining
= chunk_len
- 8;
442 /* version + flags */
443 stream_read_uint32(qtmovie
->stream
);
446 numentries
= stream_read_uint32(qtmovie
->stream
);
449 qtmovie
->res
->num_lookup_table
= numentries
;
450 qtmovie
->res
->lookup_table
= malloc(numentries
* sizeof(*qtmovie
->res
->lookup_table
));
452 if (!qtmovie
->res
->lookup_table
)
454 DEBUGF("stco too large to allocate lookup_table[]\n");
458 /* read first offset */
459 offset
= stream_read_uint32(qtmovie
->stream
);
462 /* Build up lookup table. The lookup table contains the sample index and
463 * byte position in the file for each chunk. This table is used to seek
464 * and resume (see m4a_seek() and m4a_seek_raw() in libm4a/m4a.c) and
465 * to skip empty chunks (see m4a_check_sample_offset() in codecs/aac.c and
467 * The seek/resume precision is lower than using sample_byte_size[] and
468 * depends on numentries. Typically the resolution is ~1/10 of all frames
469 * which equals about 1/4-1/2 seconds. The loss of seek precision is
470 * accepted to be able to avoid allocation of the large sample_byte_size[]
471 * table. This reduces the memory consumption by a factor of 2 or even
476 old_first
= qtmovie
->res
->sample_to_chunk
[0].first_chunk
;
477 old_frame
= qtmovie
->res
->sample_to_chunk
[0].num_samples
;
478 new_first
= qtmovie
->res
->sample_to_chunk
[1].first_chunk
;
479 for (k
= 1; k
< numentries
; ++k
)
481 for (; i
< qtmovie
->res
->num_sample_to_chunks
; ++i
)
485 /* Only access sample_to_chunk[] if new data is required. */
486 old_first
= qtmovie
->res
->sample_to_chunk
[i
-1].first_chunk
;
487 old_frame
= qtmovie
->res
->sample_to_chunk
[i
-1].num_samples
;
488 new_first
= qtmovie
->res
->sample_to_chunk
[i
].first_chunk
;
495 frame
+= (new_first
- old_first
) * old_frame
;
497 frame
+= (k
- old_first
) * old_frame
;
499 qtmovie
->res
->lookup_table
[idx
].sample
= frame
;
500 qtmovie
->res
->lookup_table
[idx
].offset
= offset
;
503 frame
-= (k
- old_first
) * old_frame
;
505 offset
= stream_read_uint32(qtmovie
->stream
);
508 /* zero-terminate the lookup table */
509 qtmovie
->res
->lookup_table
[idx
].sample
= 0;
510 qtmovie
->res
->lookup_table
[idx
].offset
= 0;
514 DEBUGF("ehm, size remianing?\n");
515 stream_skip(qtmovie
->stream
, size_remaining
);
521 static bool read_chunk_stbl(qtmovie_t
*qtmovie
, size_t chunk_len
)
523 size_t size_remaining
= chunk_len
- 8;
525 while (size_remaining
)
527 size_t sub_chunk_len
;
528 fourcc_t sub_chunk_id
;
530 sub_chunk_len
= stream_read_uint32(qtmovie
->stream
);
531 if (sub_chunk_len
<= 1 || sub_chunk_len
> size_remaining
)
533 DEBUGF("strange size (%lu) for chunk inside stbl\n",
534 (unsigned long)sub_chunk_len
);
538 sub_chunk_id
= stream_read_uint32(qtmovie
->stream
);
540 switch (sub_chunk_id
)
542 case MAKEFOURCC('s','t','s','d'):
543 if (!read_chunk_stsd(qtmovie
, sub_chunk_len
)) {
547 case MAKEFOURCC('s','t','t','s'):
548 if (!read_chunk_stts(qtmovie
, sub_chunk_len
))
553 case MAKEFOURCC('s','t','s','z'):
554 if (!read_chunk_stsz(qtmovie
, sub_chunk_len
))
559 case MAKEFOURCC('s','t','s','c'):
560 if (!read_chunk_stsc(qtmovie
, sub_chunk_len
))
565 case MAKEFOURCC('s','t','c','o'):
566 if (!read_chunk_stco(qtmovie
, sub_chunk_len
))
572 /*DEBUGF("(stbl) unknown chunk id: %c%c%c%c\n",
573 SPLITFOURCC(sub_chunk_id));*/
574 stream_skip(qtmovie
->stream
, sub_chunk_len
- 8);
577 size_remaining
-= sub_chunk_len
;
582 static bool read_chunk_minf(qtmovie_t
*qtmovie
, size_t chunk_len
)
584 size_t size_remaining
= chunk_len
- 8;
587 /* Check for smhd, only kind of minf we care about */
589 if ((i
= stream_read_uint32(qtmovie
->stream
)) != 16)
591 DEBUGF("unexpected size in media info: %ld\n", (long)i
);
592 stream_skip(qtmovie
->stream
, size_remaining
-4);
596 if (stream_read_uint32(qtmovie
->stream
) != MAKEFOURCC('s','m','h','d'))
598 DEBUGF("not a sound header! can't handle this.\n");
602 /* now skip the rest of the atom */
603 stream_skip(qtmovie
->stream
, 16 - 8);
604 size_remaining
-= 16;
606 while (size_remaining
)
608 size_t sub_chunk_len
;
609 fourcc_t sub_chunk_id
;
611 sub_chunk_len
= stream_read_uint32(qtmovie
->stream
);
613 if (sub_chunk_len
<= 1 || sub_chunk_len
> size_remaining
)
615 DEBUGF("strange size (%lu) for chunk inside minf\n",
616 (unsigned long)sub_chunk_len
);
620 sub_chunk_id
= stream_read_uint32(qtmovie
->stream
);
622 switch (sub_chunk_id
)
624 case MAKEFOURCC('s','t','b','l'):
625 if (!read_chunk_stbl(qtmovie
, sub_chunk_len
)) {
630 /*DEBUGF("(minf) unknown chunk id: %c%c%c%c\n",
631 SPLITFOURCC(sub_chunk_id));*/
632 stream_skip(qtmovie
->stream
, sub_chunk_len
- 8);
636 size_remaining
-= sub_chunk_len
;
641 static bool read_chunk_mdia(qtmovie_t
*qtmovie
, size_t chunk_len
)
643 size_t size_remaining
= chunk_len
- 8;
645 while (size_remaining
)
647 size_t sub_chunk_len
;
648 fourcc_t sub_chunk_id
;
650 sub_chunk_len
= stream_read_uint32(qtmovie
->stream
);
651 if (sub_chunk_len
<= 1 || sub_chunk_len
> size_remaining
)
653 DEBUGF("strange size (%lu) for chunk inside mdia\n",
654 (unsigned long)sub_chunk_len
);
658 sub_chunk_id
= stream_read_uint32(qtmovie
->stream
);
660 switch (sub_chunk_id
)
662 case MAKEFOURCC('m','i','n','f'):
663 if (!read_chunk_minf(qtmovie
, sub_chunk_len
)) {
668 /*DEBUGF("(mdia) unknown chunk id: %c%c%c%c\n",
669 SPLITFOURCC(sub_chunk_id));*/
670 stream_skip(qtmovie
->stream
, sub_chunk_len
- 8);
674 size_remaining
-= sub_chunk_len
;
679 /* 'trak' - a movie track - contains other atoms */
680 static bool read_chunk_trak(qtmovie_t
*qtmovie
, size_t chunk_len
)
682 size_t size_remaining
= chunk_len
- 8;
684 while (size_remaining
)
686 size_t sub_chunk_len
;
687 fourcc_t sub_chunk_id
;
689 sub_chunk_len
= stream_read_uint32(qtmovie
->stream
);
690 if (sub_chunk_len
<= 1 || sub_chunk_len
> size_remaining
)
692 DEBUGF("strange size (%lu) for chunk inside trak\n",
693 (unsigned long)sub_chunk_len
);
697 sub_chunk_id
= stream_read_uint32(qtmovie
->stream
);
699 switch (sub_chunk_id
)
701 case MAKEFOURCC('m','d','i','a'):
702 if (!read_chunk_mdia(qtmovie
, sub_chunk_len
)) {
707 /*DEBUGF("(trak) unknown chunk id: %c%c%c%c\n",
708 SPLITFOURCC(sub_chunk_id));*/
709 stream_skip(qtmovie
->stream
, sub_chunk_len
- 8);
713 size_remaining
-= sub_chunk_len
;
718 /* 'moov' movie atom - contains other atoms */
719 static bool read_chunk_moov(qtmovie_t
*qtmovie
, size_t chunk_len
)
721 size_t size_remaining
= chunk_len
- 8;
723 while (size_remaining
)
725 size_t sub_chunk_len
;
726 fourcc_t sub_chunk_id
;
728 sub_chunk_len
= stream_read_uint32(qtmovie
->stream
);
729 if (sub_chunk_len
<= 1 || sub_chunk_len
> size_remaining
)
731 DEBUGF("strange size (%lu) for chunk inside moov\n",
732 (unsigned long)sub_chunk_len
);
736 sub_chunk_id
= stream_read_uint32(qtmovie
->stream
);
738 switch (sub_chunk_id
)
740 case MAKEFOURCC('t','r','a','k'):
741 if (!read_chunk_trak(qtmovie
, sub_chunk_len
)) {
746 /*DEBUGF("(moov) unknown chunk id: %c%c%c%c\n",
747 SPLITFOURCC(sub_chunk_id));*/
748 stream_skip(qtmovie
->stream
, sub_chunk_len
- 8);
752 size_remaining
-= sub_chunk_len
;
757 static void read_chunk_mdat(qtmovie_t
*qtmovie
, size_t chunk_len
)
759 size_t size_remaining
= chunk_len
- 8;
761 qtmovie
->res
->mdat_len
= size_remaining
;
764 int qtmovie_read(stream_t
*file
, demux_res_t
*demux_res
)
768 /* construct the stream */
769 qtmovie
.stream
= file
;
770 qtmovie
.res
= demux_res
;
772 /* read the chunks */
778 chunk_len
= stream_read_uint32(qtmovie
.stream
);
779 if (stream_eof(qtmovie
.stream
))
781 if(qtmovie
.res
->mdat_offset
== 0 || qtmovie
.res
->format
== 0)
783 stream_seek(qtmovie
.stream
, qtmovie
.res
->mdat_offset
);
789 //DEBUGF("need 64bit support\n");
792 chunk_id
= stream_read_uint32(qtmovie
.stream
);
794 //DEBUGF("Found a chunk %c%c%c%c, length=%d\n",SPLITFOURCC(chunk_id),chunk_len);
797 case MAKEFOURCC('f','t','y','p'):
798 read_chunk_ftyp(&qtmovie
, chunk_len
);
800 case MAKEFOURCC('m','o','o','v'):
801 if (!read_chunk_moov(&qtmovie
, chunk_len
)) {
805 case MAKEFOURCC('m','d','a','t'):
806 /* There can be empty mdats before the real one. If so, skip them */
809 read_chunk_mdat(&qtmovie
, chunk_len
);
810 qtmovie
.res
->mdat_offset
=stream_tell(qtmovie
.stream
);
811 /* If we've already seen the format, assume there's nothing
812 interesting after the mdat chunk (the file is "streamable").
813 This avoids having to seek, which might cause rebuffering. */
814 if(qtmovie
.res
->format
> 0)
816 stream_skip(qtmovie
.stream
, chunk_len
- 8);
819 /* these following atoms can be skipped !!!! */
820 case MAKEFOURCC('f','r','e','e'):
821 stream_skip(qtmovie
.stream
, chunk_len
- 8);
824 //DEBUGF("(top) unknown chunk id: %c%c%c%c\n",SPLITFOURCC(chunk_id));