Branch Coverage

src/mp4.c
Criterion Covered Total %
branch 614 1020 60.2


line true false branch
38 1 0 if ( my_hv_exists(info, "seek_offset") ) {
39 1 0 frame_offset = SvIV( *(my_hv_fetch(info, "seek_offset") ) );
83 1 4 if (mp4->track_count > 1) {
88 0 4 if ( !my_hv_exists(info, "samplerate") ) {
95 4 0 samplerate = SvIV( *( my_hv_fetch( info, "samplerate" ) ) );
102 4 0 if (
104 4 0 || !mp4->num_sample_byte_sizes
105 4 0 || !mp4->num_sample_to_chunks
106 0 4 || !mp4->num_chunk_offsets
114 4 0 while ( (i < mp4->num_time_to_samples) &&
4 0 while ( (i < mp4->num_time_to_samples) &&
126 4 0 if (j <= mp4->time_to_sample[i].sample_count) {
140 0 4 if ( new_sample >= mp4->num_sample_byte_sizes ) {
157 0 4 Newz(0, stts, stts_entries * sizeof(*stts), struct tts);
159 6341 4 for (i = new_sample; i < total_sample_count; i++) {
162 6337 4 if (cur_duration && cur_duration == duration) {
6336 1 if (cur_duration && cur_duration == duration) {
178 5 4 for (i = 0; i < stts_entries; i++) {
202 1 3 for (i = 1; i < mp4->num_sample_to_chunks; i++) {
209 1 0 if (new_sample < total_samples + range_samples)
219 1 3 if (new_sample >= mp4->sample_to_chunk[0].samples_per_chunk) {
235 0 4 if (chunk > mp4->num_chunk_offsets) {
244 0 4 if (chunk_sample > new_sample) {
251 5 4 for (i = chunk_sample; i < new_sample; i++) {
257 0 4 if (file_offset > mp4->audio_offset + mp4->audio_size) {
273 0 4 Newz(0, stsc, stsc_entries * sizeof(*stsc), struct stc);
275 1271 4 for (i = chunk; i <= mp4->num_chunk_offsets; i++) {
279 1267 4 if (cur_samples_per_chunk && cur_samples_per_chunk == samples_in_chunk) {
1265 2 if (cur_samples_per_chunk && cur_samples_per_chunk == samples_in_chunk) {
288 4 2 if (j == 1) {
306 6 4 for (i = 0; i < stsc_entries; i++) {
331 6341 4 for (i = new_sample; i < mp4->num_sample_byte_sizes; i++) {
357 4 0 chunk_offset = SvIV( *( my_hv_fetch(info, "audio_offset") ) );
366 1271 4 for (i = chunk - 1; i < mp4->num_chunk_offsets; i++) {
367 4 1267 if (i == chunk - 1) {
411 4 0 if (mp4->time_to_sample) Safefree(mp4->time_to_sample);
412 4 0 if (mp4->sample_to_chunk) Safefree(mp4->sample_to_chunk);
413 4 0 if (mp4->sample_byte_size) Safefree(mp4->sample_byte_size);
414 4 0 if (mp4->chunk_offset) Safefree(mp4->chunk_offset);
421 103 0 while ( (box_size = _mp4_read_box(mp4)) > 0 ) {
425 4 99 if (mp4->audio_offset >= mp4->file_size)
432 4 0 if (mp4->buf) {
441 4 1 if (mp4->new_stts) SvREFCNT_dec(mp4->new_stts);
442 4 1 if (mp4->new_stsc) SvREFCNT_dec(mp4->new_stsc);
443 4 1 if (mp4->new_stsz) SvREFCNT_dec(mp4->new_stsz);
444 4 1 if (mp4->new_stco) SvREFCNT_dec(mp4->new_stco);
447 5 0 if (mp4->time_to_sample) Safefree(mp4->time_to_sample);
448 5 0 if (mp4->sample_to_chunk) Safefree(mp4->sample_to_chunk);
449 5 0 if (mp4->sample_byte_size) Safefree(mp4->sample_byte_size);
450 5 0 if (mp4->chunk_offset) Safefree(mp4->chunk_offset);
457 1 4 if (ret == -1) {
499 495 0 while ( (box_size = _mp4_read_box(mp4)) > 0 ) {
503 17 478 if (mp4->audio_offset >= file_size)
510 4 13 if ( !my_hv_exists(info, "avg_bitrate") ) {
512 4 0 if (entry) {
514 4 0 if (audio_offset) {
515 4 0 uint32_t song_length_ms = SvIV(*entry);
516 4 0 uint32_t bitrate = _bitrate(file_size - SvIV(*audio_offset), song_length_ms);
525 15 2 if (!mp4->dlna_invalid && mp4->samplerate && mp4->bitrate && mp4->channels) {
15 0 if (!mp4->dlna_invalid && mp4->samplerate && mp4->bitrate && mp4->channels) {
15 0 if (!mp4->dlna_invalid && mp4->samplerate && mp4->bitrate && mp4->channels) {
15 0 if (!mp4->dlna_invalid && mp4->samplerate && mp4->bitrate && mp4->channels) {
530 11 0 if (mp4->samplerate < 8000 || mp4->samplerate > 48000)
10 1 if (mp4->samplerate < 8000 || mp4->samplerate > 48000)
533 10 0 if (mp4->channels <= 2) {
534 8 2 if (mp4->bitrate <= 192000)
536 2 0 else if (mp4->bitrate <= 320000)
538 0 0 else if (mp4->bitrate <= 576000)
541 0 0 else if (mp4->channels <= 6) {
542 0 0 if (mp4->bitrate <= 1440000)
552 0 0 if (mp4->samplerate < 8000)
555 0 0 if (mp4->samplerate <= 48000) {
556 0 0 if (mp4->channels <= 2 && mp4->bitrate <= 576000)
0 0 if (mp4->channels <= 2 && mp4->bitrate <= 576000)
559 0 0 else if (mp4->samplerate <= 96000) {
560 0 0 if (mp4->channels <= 6 && mp4->bitrate <= 2880000)
0 0 if (mp4->channels <= 6 && mp4->bitrate <= 2880000)
562 0 0 else if (mp4->channels <= 8 && mp4->bitrate <= 4032000)
0 0 else if (mp4->channels <= 8 && mp4->bitrate <= 4032000)
571 0 0 if (mp4->samplerate < 8000)
574 0 0 if (mp4->samplerate <= 24000) {
575 0 0 if (mp4->channels > 2)
578 0 0 if (mp4->bitrate <= 128000)
580 0 0 else if (mp4->bitrate <= 320000)
582 0 0 else if (mp4->bitrate <= 576000)
585 0 0 else if (mp4->samplerate <= 48000) {
586 0 0 if (mp4->channels <= 2 && mp4->bitrate <= 576000)
0 0 if (mp4->channels <= 2 && mp4->bitrate <= 576000)
588 0 0 else if (mp4->channels <= 6 && mp4->bitrate <= 1440000)
0 0 else if (mp4->channels <= 6 && mp4->bitrate <= 1440000)
590 0 0 else if (mp4->channels <= 8 && mp4->bitrate <= 4032000)
0 0 else if (mp4->channels <= 8 && mp4->bitrate <= 4032000)
593 0 0 else if (mp4->samplerate <= 96000) {
594 0 0 if (mp4->channels <= 8 && mp4->bitrate <= 4032000)
0 0 if (mp4->channels <= 8 && mp4->bitrate <= 4032000)
604 0 0 if (mp4->samplerate < 8000)
607 0 0 if (mp4->samplerate <= 24000) {
608 0 0 if (mp4->channels > 2)
611 0 0 if (mp4->bitrate <= 128000)
613 0 0 else if (mp4->bitrate <= 320000)
615 0 0 else if (mp4->bitrate <= 576000)
618 0 0 else if (mp4->samplerate <= 48000) {
619 0 0 if (mp4->channels <= 2 && mp4->bitrate <= 576000)
0 0 if (mp4->channels <= 2 && mp4->bitrate <= 576000)
621 0 0 else if (mp4->channels <= 6 && mp4->bitrate <= 1440000)
0 0 else if (mp4->channels <= 6 && mp4->bitrate <= 1440000)
623 0 0 else if (mp4->channels <= 6 && mp4->bitrate <= 2880000)
0 0 else if (mp4->channels <= 6 && mp4->bitrate <= 2880000)
625 0 0 else if (mp4->channels <= 8 && mp4->bitrate <= 4032000)
0 0 else if (mp4->channels <= 8 && mp4->bitrate <= 4032000)
628 0 0 else if (mp4->samplerate <= 96000) {
629 0 0 if (mp4->channels <= 8 && mp4->bitrate <= 4032000)
0 0 if (mp4->channels <= 8 && mp4->bitrate <= 4032000)
638 0 0 if (mp4->samplerate < 16000 || mp4->samplerate > 48000)
0 0 if (mp4->samplerate < 16000 || mp4->samplerate > 48000)
641 0 0 if (mp4->bitrate > 128000)
644 0 0 if (mp4->channels <= 2)
646 0 0 else if (mp4->channels <= 6)
672 0 598 if ( !_check_buf(mp4->infile, mp4->buf, 16, MP4_BLOCK_SIZE) ) {
682 0 598 if (size == 1) {
686 0 598 else if (size == 0) {
694 598 0 if (size) {
702 103 495 if (mp4->seekhdr) {
706 31 72 if (
707 4 27 FOURCC_EQ(type, "moov")
4 0 FOURCC_EQ(type, "moov")
4 0 FOURCC_EQ(type, "moov")
0 4 FOURCC_EQ(type, "moov")
708 8 91 || FOURCC_EQ(type, "trak")
4 4 || FOURCC_EQ(type, "trak")
4 0 || FOURCC_EQ(type, "trak")
4 0 || FOURCC_EQ(type, "trak")
0 4 || FOURCC_EQ(type, "trak")
709 27 68 || FOURCC_EQ(type, "mdia")
12 15 || FOURCC_EQ(type, "mdia")
12 0 || FOURCC_EQ(type, "mdia")
12 0 || FOURCC_EQ(type, "mdia")
8 4 || FOURCC_EQ(type, "mdia")
710 23 68 || FOURCC_EQ(type, "minf")
4 19 || FOURCC_EQ(type, "minf")
4 0 || FOURCC_EQ(type, "minf")
4 0 || FOURCC_EQ(type, "minf")
0 4 || FOURCC_EQ(type, "minf")
711 28 59 || FOURCC_EQ(type, "stbl")
24 4 || FOURCC_EQ(type, "stbl")
24 0 || FOURCC_EQ(type, "stbl")
24 0 || FOURCC_EQ(type, "stbl")
4 20 || FOURCC_EQ(type, "stbl")
720 24 59 else if ( FOURCC_EQ(type, "stts") ) {
20 4 else if ( FOURCC_EQ(type, "stts") ) {
20 0 else if ( FOURCC_EQ(type, "stts") ) {
20 0 else if ( FOURCC_EQ(type, "stts") ) {
4 16 else if ( FOURCC_EQ(type, "stts") ) {
724 20 59 else if ( FOURCC_EQ(type, "stsc") ) {
16 4 else if ( FOURCC_EQ(type, "stsc") ) {
16 0 else if ( FOURCC_EQ(type, "stsc") ) {
16 0 else if ( FOURCC_EQ(type, "stsc") ) {
4 12 else if ( FOURCC_EQ(type, "stsc") ) {
728 16 59 else if ( FOURCC_EQ(type, "stsz") ) {
12 4 else if ( FOURCC_EQ(type, "stsz") ) {
12 0 else if ( FOURCC_EQ(type, "stsz") ) {
12 0 else if ( FOURCC_EQ(type, "stsz") ) {
4 8 else if ( FOURCC_EQ(type, "stsz") ) {
732 12 59 else if ( FOURCC_EQ(type, "stco") ) {
8 4 else if ( FOURCC_EQ(type, "stco") ) {
8 0 else if ( FOURCC_EQ(type, "stco") ) {
8 0 else if ( FOURCC_EQ(type, "stco") ) {
4 4 else if ( FOURCC_EQ(type, "stco") ) {
743 8 59 if ( FOURCC_EQ(type, "stsd") ) {
4 4 if ( FOURCC_EQ(type, "stsd") ) {
4 0 if ( FOURCC_EQ(type, "stsd") ) {
4 0 if ( FOURCC_EQ(type, "stsd") ) {
4 0 if ( FOURCC_EQ(type, "stsd") ) {
748 19 44 else if ( FOURCC_EQ(type, "mp4a") ) {
3 16 else if ( FOURCC_EQ(type, "mp4a") ) {
3 0 else if ( FOURCC_EQ(type, "mp4a") ) {
3 0 else if ( FOURCC_EQ(type, "mp4a") ) {
3 0 else if ( FOURCC_EQ(type, "mp4a") ) {
753 16 44 else if ( FOURCC_EQ(type, "meta") ) {
4 12 else if ( FOURCC_EQ(type, "meta") ) {
4 0 else if ( FOURCC_EQ(type, "meta") ) {
4 0 else if ( FOURCC_EQ(type, "meta") ) {
4 0 else if ( FOURCC_EQ(type, "meta") ) {
758 3 53 else if (
759 0 3 !FOURCC_EQ(type, "edts")
0 0 !FOURCC_EQ(type, "edts")
0 0 !FOURCC_EQ(type, "edts")
0 0 !FOURCC_EQ(type, "edts")
760 8 48 && !FOURCC_EQ(type, "dinf")
4 4 && !FOURCC_EQ(type, "dinf")
4 0 && !FOURCC_EQ(type, "dinf")
4 0 && !FOURCC_EQ(type, "dinf")
0 4 && !FOURCC_EQ(type, "dinf")
761 4 48 && !FOURCC_EQ(type, "udta")
4 0 && !FOURCC_EQ(type, "udta")
4 0 && !FOURCC_EQ(type, "udta")
4 0 && !FOURCC_EQ(type, "udta")
0 4 && !FOURCC_EQ(type, "udta")
762 12 36 && !FOURCC_EQ(type, "mdat")
8 4 && !FOURCC_EQ(type, "mdat")
8 0 && !FOURCC_EQ(type, "mdat")
8 0 && !FOURCC_EQ(type, "mdat")
4 4 && !FOURCC_EQ(type, "mdat")
764 0 44 if ( !_check_buf(mp4->infile, mp4->buf, size - 8, MP4_BLOCK_SIZE) ) {
780 55 543 if ( FOURCC_EQ(type, "ftyp") ) {
21 34 if ( FOURCC_EQ(type, "ftyp") ) {
21 0 if ( FOURCC_EQ(type, "ftyp") ) {
21 0 if ( FOURCC_EQ(type, "ftyp") ) {
21 0 if ( FOURCC_EQ(type, "ftyp") ) {
781 0 21 if ( !_mp4_parse_ftyp(mp4) ) {
786 175 402 else if (
787 21 154 FOURCC_EQ(type, "moov")
21 0 FOURCC_EQ(type, "moov")
21 0 FOURCC_EQ(type, "moov")
0 21 FOURCC_EQ(type, "moov")
788 20 536 || FOURCC_EQ(type, "edts")
0 20 || FOURCC_EQ(type, "edts")
0 0 || FOURCC_EQ(type, "edts")
0 0 || FOURCC_EQ(type, "edts")
0 0 || FOURCC_EQ(type, "edts")
789 154 402 || FOURCC_EQ(type, "mdia")
69 85 || FOURCC_EQ(type, "mdia")
69 0 || FOURCC_EQ(type, "mdia")
69 0 || FOURCC_EQ(type, "mdia")
45 24 || FOURCC_EQ(type, "mdia")
790 130 402 || FOURCC_EQ(type, "minf")
24 106 || FOURCC_EQ(type, "minf")
24 0 || FOURCC_EQ(type, "minf")
24 0 || FOURCC_EQ(type, "minf")
0 24 || FOURCC_EQ(type, "minf")
791 48 460 || FOURCC_EQ(type, "dinf")
24 24 || FOURCC_EQ(type, "dinf")
24 0 || FOURCC_EQ(type, "dinf")
24 0 || FOURCC_EQ(type, "dinf")
0 24 || FOURCC_EQ(type, "dinf")
792 167 317 || FOURCC_EQ(type, "stbl")
144 23 || FOURCC_EQ(type, "stbl")
144 0 || FOURCC_EQ(type, "stbl")
144 0 || FOURCC_EQ(type, "stbl")
120 24 || FOURCC_EQ(type, "stbl")
793 21 439 || FOURCC_EQ(type, "udta")
21 0 || FOURCC_EQ(type, "udta")
21 0 || FOURCC_EQ(type, "udta")
21 0 || FOURCC_EQ(type, "udta")
21 0 || FOURCC_EQ(type, "udta")
799 0 138 if ( FOURCC_EQ(type, "trak") ) {
0 0 if ( FOURCC_EQ(type, "trak") ) {
0 0 if ( FOURCC_EQ(type, "trak") ) {
0 0 if ( FOURCC_EQ(type, "trak") ) {
0 0 if ( FOURCC_EQ(type, "trak") ) {
803 51 388 else if ( FOURCC_EQ(type, "trak") ) {
27 24 else if ( FOURCC_EQ(type, "trak") ) {
27 0 else if ( FOURCC_EQ(type, "trak") ) {
27 0 else if ( FOURCC_EQ(type, "trak") ) {
24 3 else if ( FOURCC_EQ(type, "trak") ) {
808 106 309 else if ( FOURCC_EQ(type, "mvhd") ) {
21 85 else if ( FOURCC_EQ(type, "mvhd") ) {
21 0 else if ( FOURCC_EQ(type, "mvhd") ) {
21 0 else if ( FOURCC_EQ(type, "mvhd") ) {
21 0 else if ( FOURCC_EQ(type, "mvhd") ) {
811 0 21 if ( !_mp4_parse_mvhd(mp4) ) {
816 27 367 else if ( FOURCC_EQ(type, "tkhd") ) {
24 3 else if ( FOURCC_EQ(type, "tkhd") ) {
24 0 else if ( FOURCC_EQ(type, "tkhd") ) {
24 0 else if ( FOURCC_EQ(type, "tkhd") ) {
24 0 else if ( FOURCC_EQ(type, "tkhd") ) {
817 0 24 if ( !_mp4_parse_tkhd(mp4) ) {
822 85 285 else if ( FOURCC_EQ(type, "mdhd") ) {
45 40 else if ( FOURCC_EQ(type, "mdhd") ) {
45 0 else if ( FOURCC_EQ(type, "mdhd") ) {
45 0 else if ( FOURCC_EQ(type, "mdhd") ) {
24 21 else if ( FOURCC_EQ(type, "mdhd") ) {
823 0 24 if ( !_mp4_parse_mdhd(mp4) ) {
828 27 319 else if ( FOURCC_EQ(type, "hdlr") ) {
24 3 else if ( FOURCC_EQ(type, "hdlr") ) {
24 0 else if ( FOURCC_EQ(type, "hdlr") ) {
24 0 else if ( FOURCC_EQ(type, "hdlr") ) {
24 0 else if ( FOURCC_EQ(type, "hdlr") ) {
829 0 24 if ( !_mp4_parse_hdlr(mp4) ) {
834 143 179 else if ( FOURCC_EQ(type, "stsd") ) {
120 23 else if ( FOURCC_EQ(type, "stsd") ) {
120 0 else if ( FOURCC_EQ(type, "stsd") ) {
120 0 else if ( FOURCC_EQ(type, "stsd") ) {
24 96 else if ( FOURCC_EQ(type, "stsd") ) {
835 0 24 if ( !_mp4_parse_stsd(mp4) ) {
843 61 237 else if ( FOURCC_EQ(type, "mp4a") ) {
20 41 else if ( FOURCC_EQ(type, "mp4a") ) {
20 0 else if ( FOURCC_EQ(type, "mp4a") ) {
20 0 else if ( FOURCC_EQ(type, "mp4a") ) {
20 0 else if ( FOURCC_EQ(type, "mp4a") ) {
844 0 20 if ( !_mp4_parse_mp4a(mp4) ) {
852 3 275 else if ( FOURCC_EQ(type, "alac") ) {
3 0 else if ( FOURCC_EQ(type, "alac") ) {
3 0 else if ( FOURCC_EQ(type, "alac") ) {
3 0 else if ( FOURCC_EQ(type, "alac") ) {
3 0 else if ( FOURCC_EQ(type, "alac") ) {
853 0 3 if ( !_mp4_parse_alac(mp4) ) {
862 24 251 else if ( FOURCC_EQ(type, "drms") ) {
24 0 else if ( FOURCC_EQ(type, "drms") ) {
24 0 else if ( FOURCC_EQ(type, "drms") ) {
24 0 else if ( FOURCC_EQ(type, "drms") ) {
0 24 else if ( FOURCC_EQ(type, "drms") ) {
871 20 255 else if ( FOURCC_EQ(type, "esds") ) {
20 0 else if ( FOURCC_EQ(type, "esds") ) {
20 0 else if ( FOURCC_EQ(type, "esds") ) {
20 0 else if ( FOURCC_EQ(type, "esds") ) {
20 0 else if ( FOURCC_EQ(type, "esds") ) {
872 0 20 if ( !_mp4_parse_esds(mp4) ) {
877 119 136 else if ( FOURCC_EQ(type, "stts") ) {
96 23 else if ( FOURCC_EQ(type, "stts") ) {
96 0 else if ( FOURCC_EQ(type, "stts") ) {
96 0 else if ( FOURCC_EQ(type, "stts") ) {
24 72 else if ( FOURCC_EQ(type, "stts") ) {
878 10 14 if ( mp4->seeking && mp4->track_count == 1 ) {
9 1 if ( mp4->seeking && mp4->track_count == 1 ) {
879 0 9 if ( !_mp4_parse_stts(mp4) ) {
889 95 136 else if ( FOURCC_EQ(type, "stsc") ) {
72 23 else if ( FOURCC_EQ(type, "stsc") ) {
72 0 else if ( FOURCC_EQ(type, "stsc") ) {
72 0 else if ( FOURCC_EQ(type, "stsc") ) {
24 48 else if ( FOURCC_EQ(type, "stsc") ) {
890 10 14 if ( mp4->seeking && mp4->track_count == 1 ) {
9 1 if ( mp4->seeking && mp4->track_count == 1 ) {
891 0 9 if ( !_mp4_parse_stsc(mp4) ) {
901 71 136 else if ( FOURCC_EQ(type, "stsz") ) {
48 23 else if ( FOURCC_EQ(type, "stsz") ) {
48 0 else if ( FOURCC_EQ(type, "stsz") ) {
48 0 else if ( FOURCC_EQ(type, "stsz") ) {
24 24 else if ( FOURCC_EQ(type, "stsz") ) {
902 10 14 if ( mp4->seeking && mp4->track_count == 1 ) {
9 1 if ( mp4->seeking && mp4->track_count == 1 ) {
903 0 9 if ( !_mp4_parse_stsz(mp4) ) {
913 47 136 else if ( FOURCC_EQ(type, "stco") ) {
24 23 else if ( FOURCC_EQ(type, "stco") ) {
24 0 else if ( FOURCC_EQ(type, "stco") ) {
24 0 else if ( FOURCC_EQ(type, "stco") ) {
24 0 else if ( FOURCC_EQ(type, "stco") ) {
914 10 14 if ( mp4->seeking && mp4->track_count == 1 ) {
9 1 if ( mp4->seeking && mp4->track_count == 1 ) {
915 0 9 if ( !_mp4_parse_stco(mp4) ) {
925 41 118 else if ( FOURCC_EQ(type, "meta") ) {
20 21 else if ( FOURCC_EQ(type, "meta") ) {
20 0 else if ( FOURCC_EQ(type, "meta") ) {
20 0 else if ( FOURCC_EQ(type, "meta") ) {
20 0 else if ( FOURCC_EQ(type, "meta") ) {
927 0 20 if ( !meta_size ) {
937 25 114 else if ( FOURCC_EQ(type, "ilst") ) {
20 5 else if ( FOURCC_EQ(type, "ilst") ) {
20 0 else if ( FOURCC_EQ(type, "ilst") ) {
20 0 else if ( FOURCC_EQ(type, "ilst") ) {
20 0 else if ( FOURCC_EQ(type, "ilst") ) {
938 0 20 if ( !_mp4_parse_ilst(mp4) ) {
943 21 98 else if ( FOURCC_EQ(type, "mdat") ) {
21 0 else if ( FOURCC_EQ(type, "mdat") ) {
21 0 else if ( FOURCC_EQ(type, "mdat") ) {
21 0 else if ( FOURCC_EQ(type, "mdat") ) {
21 0 else if ( FOURCC_EQ(type, "mdat") ) {
949 3 18 if ( !mp4->seen_moov ) {
964 182 416 if (skip) {
976 0 21 if ( !_check_buf(mp4->infile, mp4->buf, mp4->rsize, MP4_BLOCK_SIZE) ) {
987 0 21 if (mp4->rsize % 4) {
992 74 21 while (mp4->rsize > 0) {
1009 0 21 if ( !_check_buf(mp4->infile, mp4->buf, mp4->rsize, MP4_BLOCK_SIZE) ) {
1016 21 0 if (version == 0) { // 32-bit values
1025 0 0 else if (version == 1) { // 64-bit values
1054 24 0 uint32_t timescale = SvIV( *(my_hv_fetch(mp4->info, "mv_timescale")) );
1056 0 24 if ( !_check_buf(mp4->infile, mp4->buf, mp4->rsize, MP4_BLOCK_SIZE) ) {
1066 24 0 if (version == 0) { // 32-bit values
1079 0 0 else if (version == 1) { // 64-bit values
1102 0 24 if (width > 0) {
1108 0 24 if (height > 0) {
1126 0 24 if ( !_check_buf(mp4->infile, mp4->buf, mp4->rsize, MP4_BLOCK_SIZE) ) {
1133 24 0 if (version == 0) { // 32-bit values
1141 24 0 if ( my_hv_exists( mp4->info, "song_length_ms" ) ) {
1148 0 0 else if (version == 1) { // 64-bit values
1156 0 0 if ( my_hv_exists( mp4->info, "song_length_ms" ) ) {
1181 0 24 if (!trackinfo) {
1185 0 24 if ( !_check_buf(mp4->infile, mp4->buf, mp4->rsize, MP4_BLOCK_SIZE) ) {
1212 0 24 if ( !_check_buf(mp4->infile, mp4->buf, 8, MP4_BLOCK_SIZE) ) {
1229 0 20 if ( !_check_buf(mp4->infile, mp4->buf, 28, MP4_BLOCK_SIZE) ) {
1261 0 20 if ( !_check_buf(mp4->infile, mp4->buf, mp4->rsize, MP4_BLOCK_SIZE) ) {
1272 20 0 if (buffer_get_char(mp4->buf) == 0x03) {
1274 0 20 if ( _mp4_descr_length(mp4->buf) < 5 + 15 ) {
1287 0 20 if (buffer_get_char(mp4->buf) != 0x04) {
1292 0 20 if ( _mp4_descr_length(mp4->buf) < 13 ) {
1304 16 4 if (avg_bitrate) {
1305 3 13 if ( my_hv_exists(mp4->info, "avg_bitrate") ) {
1307 3 0 avg_bitrate += SvIV(*(my_hv_fetch(mp4->info, "avg_bitrate")));
1314 0 20 if (buffer_get_char(mp4->buf) != 0x05) {
1321 20 0 if (len > 0) {
1329 2 18 if ( aot == 0x1F ) {
1341 0 20 if (samplerate == 0xF) { // XXX need test file with 24-bit samplerate field
1355 2 18 if (aot == AAC_SLS) {
1363 17 1 else if (aot == AAC_HE || aot == AAC_PS) {
0 17 else if (aot == AAC_HE || aot == AAC_PS) {
1367 0 1 if (samplerate == 0xF) { // XXX need test file with 24-bit samplerate field
1388 0 20 if (buffer_get_char(mp4->buf) != 0x06) {
1395 0 20 if (buffer_get_char(mp4->buf) != 0x02) {
1407 0 3 if ( !_check_buf(mp4->infile, mp4->buf, 28, MP4_BLOCK_SIZE) ) {
1437 0 9 if ( !_check_buf(mp4->infile, mp4->buf, mp4->rsize, MP4_BLOCK_SIZE) ) {
1447 0 9 New(0,
1453 0 9 if ( !mp4->time_to_sample ) {
1458 11 9 for (i = 0; i < mp4->num_time_to_samples; i++) {
1477 0 9 if ( !_check_buf(mp4->infile, mp4->buf, mp4->rsize, MP4_BLOCK_SIZE) ) {
1487 0 9 New(0,
1493 0 9 if ( !mp4->sample_to_chunk ) {
1498 11 9 for (i = 0; i < mp4->num_sample_to_chunks; i++) {
1519 0 9 if ( !_check_buf(mp4->infile, mp4->buf, mp4->rsize, MP4_BLOCK_SIZE) ) {
1527 0 9 if ( buffer_get_int(mp4->buf) != 0 ) {
1537 0 9 New(0,
1543 0 9 if ( !mp4->sample_byte_size ) {
1548 32510 9 for (i = 0; i < mp4->num_sample_byte_sizes; i++) {
1551 0 32510 if (v > 0x0000ffff) {
1569 0 9 if ( !_check_buf(mp4->infile, mp4->buf, mp4->rsize, MP4_BLOCK_SIZE) ) {
1579 0 9 New(0,
1585 0 9 if ( !mp4->chunk_offset ) {
1590 21848 9 for (i = 0; i < mp4->num_chunk_offsets; i++) {
1605 0 20 if ( !_check_buf(mp4->infile, mp4->buf, 12, MP4_BLOCK_SIZE) ) {
1618 20 0 if ( !FOURCC_EQ(type, "hdlr") ) {
20 0 if ( !FOURCC_EQ(type, "hdlr") ) {
20 0 if ( !FOURCC_EQ(type, "hdlr") ) {
20 0 if ( !FOURCC_EQ(type, "hdlr") ) {
0 20 if ( !FOURCC_EQ(type, "hdlr") ) {
1623 0 20 if ( !_check_buf(mp4->infile, mp4->buf, hdlr_size - 8, MP4_BLOCK_SIZE) ) {
1635 396 20 while (mp4->rsize) {
1639 0 396 if ( !_check_buf(mp4->infile, mp4->buf, 8, MP4_BLOCK_SIZE) ) {
1658 67 329 if ( FOURCC_EQ(key, "----") ) {
67 0 if ( FOURCC_EQ(key, "----") ) {
67 0 if ( FOURCC_EQ(key, "----") ) {
67 0 if ( FOURCC_EQ(key, "----") ) {
67 0 if ( FOURCC_EQ(key, "----") ) {
1660 0 67 if ( !_mp4_parse_ilst_custom(mp4, size - 8) ) {
1668 0 329 if ( !_check_buf(mp4->infile, mp4->buf, 8, MP4_BLOCK_SIZE) ) {
1678 329 0 if ( bsize <= size - 8 ) {
1682 329 0 if ( !FOURCC_EQ(bptr, "data") ) {
329 0 if ( !FOURCC_EQ(bptr, "data") ) {
329 0 if ( !FOURCC_EQ(bptr, "data") ) {
329 0 if ( !FOURCC_EQ(bptr, "data") ) {
0 329 if ( !FOURCC_EQ(bptr, "data") ) {
1690 0 329 if ( !_mp4_parse_ilst_data(mp4, bsize - 8, skey) ) {
1698 2 327 if ( bsize < size - 8 ) {
1723 29 371 if ( FOURCC_EQ(ckey, "COVR") && _env_true("AUDIO_SCAN_NO_ARTWORK") ) {
13 16 if ( FOURCC_EQ(ckey, "COVR") && _env_true("AUDIO_SCAN_NO_ARTWORK") ) {
13 0 if ( FOURCC_EQ(ckey, "COVR") && _env_true("AUDIO_SCAN_NO_ARTWORK") ) {
13 0 if ( FOURCC_EQ(ckey, "COVR") && _env_true("AUDIO_SCAN_NO_ARTWORK") ) {
11 2 if ( FOURCC_EQ(ckey, "COVR") && _env_true("AUDIO_SCAN_NO_ARTWORK") ) {
1 10 if ( FOURCC_EQ(ckey, "COVR") && _env_true("AUDIO_SCAN_NO_ARTWORK") ) {
1733 0 399 if ( !_check_buf(mp4->infile, mp4->buf, size, MP4_BLOCK_SIZE) ) {
1745 351 48 if ( !flags || flags == 21 ) {
60 291 if ( !flags || flags == 21 ) {
1746 44 64 if ( FOURCC_EQ( SvPVX(key), "TRKN" ) || FOURCC_EQ( SvPVX(key), "DISK" ) ) {
15 29 if ( FOURCC_EQ( SvPVX(key), "TRKN" ) || FOURCC_EQ( SvPVX(key), "DISK" ) ) {
15 0 if ( FOURCC_EQ( SvPVX(key), "TRKN" ) || FOURCC_EQ( SvPVX(key), "DISK" ) ) {
15 0 if ( FOURCC_EQ( SvPVX(key), "TRKN" ) || FOURCC_EQ( SvPVX(key), "DISK" ) ) {
0 15 if ( FOURCC_EQ( SvPVX(key), "TRKN" ) || FOURCC_EQ( SvPVX(key), "DISK" ) ) {
13 80 if ( FOURCC_EQ( SvPVX(key), "TRKN" ) || FOURCC_EQ( SvPVX(key), "DISK" ) ) {
13 0 if ( FOURCC_EQ( SvPVX(key), "TRKN" ) || FOURCC_EQ( SvPVX(key), "DISK" ) ) {
13 0 if ( FOURCC_EQ( SvPVX(key), "TRKN" ) || FOURCC_EQ( SvPVX(key), "DISK" ) ) {
13 0 if ( FOURCC_EQ( SvPVX(key), "TRKN" ) || FOURCC_EQ( SvPVX(key), "DISK" ) ) {
13 0 if ( FOURCC_EQ( SvPVX(key), "TRKN" ) || FOURCC_EQ( SvPVX(key), "DISK" ) ) {
1756 27 1 if (size > 12) {
1763 26 2 if (total) {
1766 1 1 else if (num) {
1772 9 71 else if ( FOURCC_EQ( SvPVX(key), "GNRE" ) ) {
9 0 else if ( FOURCC_EQ( SvPVX(key), "GNRE" ) ) {
9 0 else if ( FOURCC_EQ( SvPVX(key), "GNRE" ) ) {
9 0 else if ( FOURCC_EQ( SvPVX(key), "GNRE" ) ) {
9 0 else if ( FOURCC_EQ( SvPVX(key), "GNRE" ) ) {
1777 9 0 if (genre_num > 0 && genre_num < NGENRES + 1) {
9 0 if (genre_num > 0 && genre_num < NGENRES + 1) {
1788 27 44 if (dsize == 1) {
1791 15 29 else if (dsize == 2) {
1794 18 11 else if (dsize == 4) {
1797 1 10 else if (dsize == 8) {
1811 124 167 if ( ckey[0] == 0xA9 ) {
1822 100 263 if ( my_hv_exists( mp4->tags, (char *)ckey ) ) {
1824 100 0 if (entry != NULL) {
1825 7 93 if ( SvROK(*entry) && SvTYPE(SvRV(*entry)) == SVt_PVAV ) {
7 0 if ( SvROK(*entry) && SvTYPE(SvRV(*entry)) == SVt_PVAV ) {
1849 205 67 while (size) {
1854 0 205 if ( !_check_buf(mp4->infile, mp4->buf, 8, MP4_BLOCK_SIZE) ) {
1866 67 138 if ( FOURCC_EQ(type, "name") ) {
67 0 if ( FOURCC_EQ(type, "name") ) {
67 0 if ( FOURCC_EQ(type, "name") ) {
67 0 if ( FOURCC_EQ(type, "name") ) {
67 0 if ( FOURCC_EQ(type, "name") ) {
1868 0 67 if ( !_check_buf(mp4->infile, mp4->buf, bsize, MP4_BLOCK_SIZE) ) {
1880 71 67 else if ( FOURCC_EQ(type, "data") ) {
71 0 else if ( FOURCC_EQ(type, "data") ) {
71 0 else if ( FOURCC_EQ(type, "data") ) {
71 0 else if ( FOURCC_EQ(type, "data") ) {
71 0 else if ( FOURCC_EQ(type, "data") ) {
1881 0 71 if (!key) {
1886 0 71 if ( !_mp4_parse_ilst_data(mp4, bsize - 8, key) ) {
1893 0 67 if ( !_check_buf(mp4->infile, mp4->buf, bsize - 8, MP4_BLOCK_SIZE) ) {
1917 67 0 if (entry != NULL) {
1925 74 0 for (i = 0; av_len(tracks) >= 0 && i <= av_len(tracks); i++) {
74 0 for (i = 0; av_len(tracks) >= 0 && i <= av_len(tracks); i++) {
1927 74 0 if (info != NULL) {
1932 74 0 if (tid != NULL) {
1933 74 0 if ( SvIV(*tid) == mp4->current_track ) {
67 7 if ( SvIV(*tid) == mp4->current_track ) {
1954 228 80 } while ( (b & 0x80) && num_bytes < 4 );
228 0 } while ( (b & 0x80) && num_bytes < 4 );
1962 154 31 if ( buffer_len(mp4->buf) >= size ) {
1981 2538 0 for (i = mp4->num_sample_to_chunks - 1; i >= 0; i--) {
1982 1271 1267 if (mp4->sample_to_chunk[i].first_chunk <= chunk) {
1996 5 4 for (i = 0; i < mp4->num_time_to_samples; i++) {
2009 6342 0 for (i = 0; i < mp4->num_time_to_samples; i++) {
2011 6341 1 if (sample < co + delta) {