Changeset 56975 for trunk/src/wp-includes/ID3/module.audio.mp3.php
- Timestamp:
- 10/20/2023 01:27:56 PM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/module.audio.mp3.php
r54376 r56975 1381 1381 $Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]] = isset($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]) ? ++$Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]] : 1; 1382 1382 if (++$frames_scanned >= $max_frames_scan) { 1383 $pct_data_scanned = ($this->ftell() - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']);1383 $pct_data_scanned = getid3_lib::SafeDiv($this->ftell() - $info['avdataoffset'], $info['avdataend'] - $info['avdataoffset']); 1384 1384 $this->warning('too many MPEG audio frames to scan, only scanned first '.$max_frames_scan.' frames ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.'); 1385 1385 foreach ($Distribution as $key1 => $value1) { 1386 1386 foreach ($value1 as $key2 => $value2) { 1387 $Distribution[$key1][$key2] = round($value2 / $pct_data_scanned);1387 $Distribution[$key1][$key2] = $pct_data_scanned ? round($value2 / $pct_data_scanned) : 1; 1388 1388 } 1389 1389 } … … 1476 1476 $FirstFrameThisfileInfo = null; 1477 1477 while ($SynchSeekOffset < $sync_seek_buffer_size) { 1478 if ((($avdataoffset + $SynchSeekOffset) < $info['avdataend']) && ! feof($this->getid3->fp)) {1478 if ((($avdataoffset + $SynchSeekOffset) < $info['avdataend']) && !$this->feof()) { 1479 1479 1480 1480 if ($SynchSeekOffset > $sync_seek_buffer_size) { … … 1488 1488 } 1489 1489 if (empty($info['mpeg'])) { 1490 unset($info['mpeg']);1491 }1492 return false;1493 1494 } elseif (feof($this->getid3->fp)) {1495 1496 $this->error('Could not find valid MPEG audio synch before end of file');1497 if (isset($info['audio']['bitrate'])) {1498 unset($info['audio']['bitrate']);1499 }1500 if (isset($info['mpeg']['audio'])) {1501 unset($info['mpeg']['audio']);1502 }1503 if (isset($info['mpeg']) && (!is_array($info['mpeg']) || (count($info['mpeg']) == 0))) {1504 1490 unset($info['mpeg']); 1505 1491 } … … 1653 1639 $frames_scanned++; 1654 1640 if ($frames_scan_per_segment && (++$frames_scanned_this_segment >= $frames_scan_per_segment)) { 1655 $this_pct_scanned = ($this->ftell() - $scan_start_offset[$current_segment]) / ($info['avdataend'] - $info['avdataoffset']);1641 $this_pct_scanned = getid3_lib::SafeDiv($this->ftell() - $scan_start_offset[$current_segment], $info['avdataend'] - $info['avdataoffset']); 1656 1642 if (($current_segment == 0) && (($this_pct_scanned * $max_scan_segments) >= 1)) { 1657 1643 // file likely contains < $max_frames_scan, just scan as one segment … … 1744 1730 } 1745 1731 $info['audio']['channels'] = $info['mpeg']['audio']['channels']; 1732 if ($info['audio']['channels'] < 1) { 1733 $this->error('Corrupt MP3 file: no channels'); 1734 return false; 1735 } 1746 1736 $info['audio']['channelmode'] = $info['mpeg']['audio']['channelmode']; 1747 1737 $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate'];
Note: See TracChangeset
for help on using the changeset viewer.