Changeset 56975 for trunk/src/wp-includes/ID3/module.audio-video.riff.php
- Timestamp:
- 10/20/2023 01:27:56 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/module.audio-video.riff.php
r54376 r56975 215 215 216 216 if (empty($info['playtime_seconds'])) { // may already be set (e.g. DTS-WAV) 217 $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) /$thisfile_audio['bitrate']);217 $info['playtime_seconds'] = (float)getid3_lib::SafeDiv(($info['avdataend'] - $info['avdataoffset']) * 8, $thisfile_audio['bitrate']); 218 218 } 219 219 … … 441 441 if (isset($parsedXML['SPEED']['MASTER_SPEED'])) { 442 442 @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['MASTER_SPEED']); 443 $thisfile_riff_WAVE['iXML'][0]['master_speed'] = $numerator / ($denominator ? $denominator : 1000);443 $thisfile_riff_WAVE['iXML'][0]['master_speed'] = (int) $numerator / ($denominator ? $denominator : 1000); 444 444 } 445 445 if (isset($parsedXML['SPEED']['TIMECODE_RATE'])) { 446 446 @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['TIMECODE_RATE']); 447 $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000);447 $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = (int) $numerator / ($denominator ? $denominator : 1000); 448 448 } 449 449 if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && !empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && !empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) { … … 522 522 if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) { 523 523 $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; 524 $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) /$thisfile_audio['bitrate']);524 $info['playtime_seconds'] = (float)getid3_lib::SafeDiv((($info['avdataend'] - $info['avdataoffset']) * 8), $thisfile_audio['bitrate']); 525 525 } 526 526 … … 532 532 // Reset to the way it was - RIFF parsing will have messed this up 533 533 $info['avdataend'] = $Original['avdataend']; 534 $thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];534 $thisfile_audio['bitrate'] = getid3_lib::SafeDiv(($info['avdataend'] - $info['avdataoffset']) * 8, $info['playtime_seconds']); 535 535 536 536 $this->fseek($info['avdataoffset'] - 44); … … 633 633 } 634 634 if ($info['avdataend'] > $info['filesize']) { 635 switch ( !empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') {635 switch ($thisfile_audio_dataformat) { 636 636 case 'wavpack': // WavPack 637 637 case 'lpac': // LPAC … … 673 673 } 674 674 } 675 if ( isset($thisfile_audio_dataformat) && ($thisfile_audio_dataformat == 'ac3')) {675 if ($thisfile_audio_dataformat == 'ac3') { 676 676 unset($thisfile_audio['bits_per_sample']); 677 677 if (!empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) { … … 782 782 $thisfile_riff_video_current = &$thisfile_riff_video[$streamindex]; 783 783 784 if ($thisfile_riff_raw_avih['dwWidth'] > 0) { 784 if ($thisfile_riff_raw_avih['dwWidth'] > 0) { // @phpstan-ignore-line 785 785 $thisfile_riff_video_current['frame_width'] = $thisfile_riff_raw_avih['dwWidth']; 786 786 $thisfile_video['resolution_x'] = $thisfile_riff_video_current['frame_width']; 787 787 } 788 if ($thisfile_riff_raw_avih['dwHeight'] > 0) { 788 if ($thisfile_riff_raw_avih['dwHeight'] > 0) { // @phpstan-ignore-line 789 789 $thisfile_riff_video_current['frame_height'] = $thisfile_riff_raw_avih['dwHeight']; 790 790 $thisfile_video['resolution_y'] = $thisfile_riff_video_current['frame_height']; 791 791 } 792 if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) { 792 if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) { // @phpstan-ignore-line 793 793 $thisfile_riff_video_current['total_frames'] = $thisfile_riff_raw_avih['dwTotalFrames']; 794 794 $thisfile_video['total_frames'] = $thisfile_riff_video_current['total_frames']; … … 1914 1914 unset($RIFFchunk[$chunkname][$thisindex]); 1915 1915 } 1916 if ( isset($RIFFchunk[$chunkname]) && empty($RIFFchunk[$chunkname])) {1916 if (count($RIFFchunk[$chunkname]) === 0) { 1917 1917 unset($RIFFchunk[$chunkname]); 1918 1918 } … … 2035 2035 if (isset($RIFFinfoArray[$key])) { 2036 2036 foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) { 2037 if ( trim($commentdata['data']) != '') {2037 if (!empty($commentdata['data']) && trim($commentdata['data']) != '') { 2038 2038 if (isset($CommentsTargetArray[$value])) { 2039 2039 $CommentsTargetArray[$value][] = trim($commentdata['data']);
Note: See TracChangeset
for help on using the changeset viewer.