Branch Coverage

src/asf.c
Criterion Covered Total %
branch 264 362 72.9


line true false branch
88 0 23 if ( !_check_buf(infile, asf->buf, 30, ASF_BLOCK_SIZE) ) {
94 0 23 if ( !IsEqualGUID(&hdr.ID, &ASF_Header_Object) ) {
109 0 23 if ( hdr.reserved2 != 0x02 ) {
116 166 23 while ( hdr.num_objects-- ) {
117 0 166 if ( !_check_buf(infile, asf->buf, 24, ASF_BLOCK_SIZE) ) {
124 0 166 if ( !_check_buf(infile, asf->buf, tmp.size - 24, ASF_BLOCK_SIZE) ) {
132 22 144 if ( IsEqualGUID(&tmp.ID, &ASF_Content_Description) ) {
136 23 121 else if ( IsEqualGUID(&tmp.ID, &ASF_File_Properties) ) {
140 26 95 else if ( IsEqualGUID(&tmp.ID, &ASF_Stream_Properties) ) {
144 22 73 else if ( IsEqualGUID(&tmp.ID, &ASF_Extended_Content_Description) ) {
148 23 50 else if ( IsEqualGUID(&tmp.ID, &ASF_Codec_List) ) {
152 22 28 else if ( IsEqualGUID(&tmp.ID, &ASF_Stream_Bitrate_Properties) ) {
156 1 27 else if ( IsEqualGUID(&tmp.ID, &ASF_Content_Encryption) ) {
160 1 26 else if ( IsEqualGUID(&tmp.ID, &ASF_Extended_Content_Encryption) ) {
164 2 24 else if ( IsEqualGUID(&tmp.ID, &ASF_Script_Command) ) {
168 1 23 else if ( IsEqualGUID(&tmp.ID, &ASF_Digital_Signature) ) {
172 23 0 else if ( IsEqualGUID(&tmp.ID, &ASF_Header_Extension) ) {
174 0 23 if ( !_parse_header_extension(asf, tmp.size) ) {
179 0 0 else if ( IsEqualGUID(&tmp.ID, &ASF_Error_Correction) ) {
197 0 23 if ( !_check_buf(infile, asf->buf, 24, ASF_BLOCK_SIZE) ) {
203 0 23 if ( !IsEqualGUID(&data.ID, &ASF_Data) ) {
218 9 14 if (asf->audio_size > asf->file_size - asf->audio_offset) {
224 8 15 if (seeking) {
225 7 1 if ( hdr.size + data.size < asf->file_size ) {
228 0 7 if ( PerlIO_seek(infile, hdr.size + data.size, SEEK_SET) != 0 ) {
235 0 7 if ( !_parse_index_objects(asf, asf->file_size - hdr.size - data.size) ) {
246 23 0 if (asf->scratch->alloc)
266 110 22 for (i = 0; i < 5; i++) {
272 110 22 for (i = 0; i < 5; i++) {
275 101 9 if ( len[i] ) {
296 152 22 while ( count-- ) {
315 107 45 if (data_type == TYPE_UNICODE) {
321 19 26 else if (data_type == TYPE_BYTE) {
323 7 12 if ( !strcmp( SvPVX(key), "WM/Picture" ) ) {
331 22 4 else if (data_type == TYPE_BOOL) {
334 3 1 else if (data_type == TYPE_DWORD) {
337 1 0 else if (data_type == TYPE_QWORD) {
340 0 0 else if (data_type == TYPE_WORD) {
350 152 0 if (value != NULL) {
408 22 1 if ( !broadcast ) {
467 26 4 if ( IsEqualGUID(&stream_type, &ASF_Audio_Media) ) {
506 0 26 if (channels > 2) {
510 0 0 if (codec_id == 0x0163) {
516 0 26 if (samplerate > 48000) {
520 0 0 if (samplerate > 96000) {
527 3 23 if (asf->max_bitrate > 192999) {
530 2 1 if (asf->max_bitrate > 384999) {
533 0 2 if (asf->max_bitrate > 1499999) {
541 20 6 if (asf->valid_profiles & IS_VALID_WMA_BASE)
543 1 5 else if (asf->valid_profiles & IS_VALID_WMA_FULL)
545 1 4 else if (asf->valid_profiles & IS_VALID_WMA_PRO)
547 2 2 else if (asf->valid_profiles & IS_VALID_WMA_LSL)
549 0 2 else if (asf->valid_profiles & IS_VALID_WMA_LSL_MULT5)
557 25 1 if (is_wma) {
564 2 2 else if ( IsEqualGUID(&stream_type, &ASF_Video_Media) ) {
582 1 1 else if ( IsEqualGUID(&stream_type, &ASF_Command_Media) ) {
585 1 0 else if ( IsEqualGUID(&stream_type, &ASF_JFIF_Media) ) {
592 0 0 else if ( IsEqualGUID(&stream_type, &ASF_Degradable_JPEG_Media) ) {
597 0 0 else if ( IsEqualGUID(&stream_type, &ASF_File_Transfer_Media) ) {
602 0 0 else if ( IsEqualGUID(&stream_type, &ASF_Binary_Media) ) {
608 4 26 if ( IsEqualGUID(&ec_type, &ASF_No_Error_Correction) ) {
611 25 1 else if ( IsEqualGUID(&ec_type, &ASF_Audio_Spread) ) {
636 22 1 if (ext_size > 0) {
637 0 22 if (ext_size < 24) {
640 0 22 if (ext_size != len - 46) {
650 136 23 while (ext_size > 0) {
659 22 114 if ( IsEqualGUID(&hdr, &ASF_Metadata) ) {
663 28 86 else if ( IsEqualGUID(&hdr, &ASF_Extended_Stream_Properties) ) {
667 13 73 else if ( IsEqualGUID(&hdr, &ASF_Language_List) ) {
671 4 69 else if ( IsEqualGUID(&hdr, &ASF_Advanced_Mutual_Exclusion) ) {
675 4 65 else if ( IsEqualGUID(&hdr, &ASF_Metadata_Library) ) {
679 13 52 else if ( IsEqualGUID(&hdr, &ASF_Index_Parameters) ) {
683 22 30 else if ( IsEqualGUID(&hdr, &ASF_Compatibility) ) {
688 22 8 else if ( IsEqualGUID(&hdr, &ASF_Padding) ) {
693 8 0 else if ( IsEqualGUID(&hdr, &ASF_Index_Placeholder) ) {
723 66 22 while ( count-- ) {
744 27 39 if (data_type == TYPE_UNICODE) {
750 0 39 else if (data_type == TYPE_BYTE) {
754 12 27 else if (data_type == TYPE_BOOL || data_type == TYPE_WORD) {
0 12 else if (data_type == TYPE_BOOL || data_type == TYPE_WORD) {
757 12 0 else if (data_type == TYPE_DWORD) {
760 0 0 else if (data_type == TYPE_QWORD) {
768 66 0 if (value != NULL) {
782 66 0 if (stream_number > 0) {
814 0 28 if (start_time > 0) {
818 0 28 if (end_time > 0) {
831 0 28 if ( flags & 0x01 )
834 26 2 if ( flags & 0x02 )
837 0 28 if ( flags & 0x04 )
840 0 28 if ( flags & 0x08 )
850 0 28 while ( stream_name_count-- ) {
865 1 28 while ( payload_ext_count-- ) {
876 4 24 if (len) {
892 15 13 while ( count-- ) {
920 0 4 if ( IsEqualGUID(&mutex_type, &ASF_Mutex_Language) ) {
923 4 0 else if ( IsEqualGUID(&mutex_type, &ASF_Mutex_Bitrate) ) {
930 8 4 while ( count-- ) {
937 4 0 if ( !my_hv_exists( asf->info, "mutex_list" ) ) {
944 0 0 if (entry != NULL) {
968 24 23 while ( count-- ) {
998 2 22 if ( strstr( buffer_ptr(asf->scratch), "Lossless" ) ) {
1023 28 22 while ( count-- ) {
1038 19 4 while ( count-- ) {
1062 12 7 if (data_type == TYPE_UNICODE) {
1068 2 5 else if (data_type == TYPE_BYTE) {
1070 2 0 if ( !strcmp( SvPVX(key), "WM/Picture" ) ) {
1078 5 0 else if (data_type == TYPE_BOOL || data_type == TYPE_WORD) {
0 5 else if (data_type == TYPE_BOOL || data_type == TYPE_WORD) {
1081 0 5 else if (data_type == TYPE_DWORD) {
1084 0 5 else if (data_type == TYPE_QWORD) {
1087 5 0 else if (data_type == TYPE_GUID) {
1104 19 0 if (value != NULL) {
1119 0 19 if (stream_number > 0) {
1138 17 13 while ( count-- ) {
1166 23 726 if ( !my_hv_exists( info, "streams" ) ) {
1173 726 0 if (entry != NULL) {
1181 749 0 if (streams != NULL) {
1183 878 23 for (i = 0; av_len(streams) >= 0 && i <= av_len(streams); i++) {
871 7 for (i = 0; av_len(streams) >= 0 && i <= av_len(streams); i++) {
1185 871 0 if (stream != NULL) {
1190 871 0 if (sn != NULL) {
1191 871 0 if ( SvIV(*sn) == stream_number ) {
719 152 if ( SvIV(*sn) == stream_number ) {
1203 30 719 if ( !found ) {
1220 10 262 if ( my_hv_exists_ent( tags, key ) ) {
1222 10 0 if (entry != NULL) {
1223 2 8 if ( SvROK(*entry) && SvTYPE(SvRV(*entry)) == SVt_PVAV ) {
1 1 if ( SvROK(*entry) && SvTYPE(SvRV(*entry)) == SVt_PVAV ) {
1248 14 7 while (index_size > 0) {
1250 0 14 if ( !_check_buf(asf->infile, asf->buf, 24, ASF_BLOCK_SIZE) ) {
1257 0 14 if ( !_check_buf(asf->infile, asf->buf, size - 24, ASF_BLOCK_SIZE) ) {
1261 7 7 if ( IsEqualGUID(&tmp, &ASF_Index) ) {
1265 7 0 else if ( IsEqualGUID(&tmp, &ASF_Simple_Index) ) {
1299 0 7 if (block_count > 1) {
1308 0 7 New(0, asf->specs, spec_count * sizeof(*asf->specs), struct asf_index_specs);
1311 10 7 for (i = 0; i < spec_count; i++) {
1322 10 7 for (i = 0; i < spec_count; i++) {
1328 0 10 New(0, asf->specs[i].offsets, entry_count * sizeof(uint32_t), uint32_t);
1331 39 7 for (ec = 0; ec < entry_count; ec++) {
1332 54 39 for (i = 0; i < spec_count; i++) {
1372 1 0 if ( tmp_ptr[0] == 0xFF && tmp_ptr[1] == 0xFE ) {
1 0 if ( tmp_ptr[0] == 0xFF && tmp_ptr[1] == 0xFE ) {
1402 3 2 while ( type_count-- ) {
1414 3 2 while ( command_count-- ) {
1422 2 1 if (name_len) {
1459 90 9 while ( tmp_ptr[0] != '\0' || tmp_ptr[1] != '\0' ) {
0 9 while ( tmp_ptr[0] != '\0' || tmp_ptr[1] != '\0' ) {
1471 24 9 while ( tmp_ptr[0] != '\0' || tmp_ptr[1] != '\0' ) {
0 9 while ( tmp_ptr[0] != '\0' || tmp_ptr[1] != '\0' ) {
1482 2 7 if ( _env_true("AUDIO_SCAN_NO_ARTWORK") ) {
1516 0 8 if ( !my_hv_exists(info, "streams") ) {
1521 8 0 min_packet_size = SvIV( *(my_hv_fetch(info, "min_packet_size")) );
1522 8 0 max_packet_size = SvIV( *(my_hv_fetch(info, "max_packet_size")) );
1526 0 8 if (min_packet_size != max_packet_size) {
1531 8 0 song_length_ms = SvIV( *(my_hv_fetch( info, "song_length_ms" )) );
1533 2 6 if (time_offset > song_length_ms)
1537 7 1 if ( asf->spec_count ) {
1541 0 7 if (offset_index >= asf->specs[0].entry_count)
1545 7 7 while (frame_offset == -1 && offset_index >= 0) {
7 0 while (frame_offset == -1 && offset_index >= 0) {
1561 1 0 else if (asf->max_bitrate) {
1577 14 8 while ( !found && frame_offset >= 0 ) {
14 0 while ( !found && frame_offset >= 0 ) {
1582 0 14 if ( frame_offset > asf->file_size - 64 ) {
1591 0 14 if (time < 0) {
1596 9 5 if ( time + duration >= time_offset && time <= time_offset ) {
8 1 if ( time + duration >= time_offset && time <= time_offset ) {
1605 1 5 if (
1606 1 0 (delta < 0 && (frame_offset - max_packet_size) < asf->audio_offset)
1607 5 1 ||
1608 5 0 (delta > 0 && (frame_offset + max_packet_size) > (asf->audio_offset + asf->audio_size - 64))
1617 5 1 if (delta > 0) {
1631 7 1 if (asf->spec_count) {
1633 10 7 for (i = 0; i < asf->spec_count; i++) {
1642 8 0 if (asf->scratch->alloc)
1658 0 14 if ((PerlIO_seek(asf->infile, offset, SEEK_SET)) != 0) {
1664 0 14 if ( !_check_buf(asf->infile, asf->scratch, 64, 64) ) {
1671 14 0 if (tmp & 0x80) {
1684 14 0 1 + GETLEN2b((tmp >> 1) & 0x03) +
1685 14 0 GETLEN2b((tmp >> 3) & 0x03) +
1686 14 0 GETLEN2b((tmp >> 5) & 0x03)