wppaste
WordPress

getid3_mp3

Source
wp-includes/ID3/module.audio.mp3.php:22

Compatibility

WordPress
core
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Properties · 2

$allow_bruteforceboolpublic
Forces getID3() to scan the file byte-by-byte and log all the valid audio frame headers - extremely slow, unrecommended, but may provide data from otherwise-unusable files.
$mp3_valid_check_framesintpublic
number of frames to scan to determine if MPEG-audio sequence is valid Lower this number to 5-20 for faster scanning Increase this number to 50+ for most accurate detection of valid VBR/CBR mpeg-audio streams

Methods · 25

Source code

class getid3_mp3 extends getid3_handler{	/**	 * Forces getID3() to scan the file byte-by-byte and log all the valid audio frame headers - extremely slow,	 * unrecommended, but may provide data from otherwise-unusable files.	 *	 * @var bool	 */	public $allow_bruteforce = false; 	/**	 * number of frames to scan to determine if MPEG-audio sequence is valid	 * Lower this number to 5-20 for faster scanning	 * Increase this number to 50+ for most accurate detection of valid VBR/CBR mpeg-audio streams	 *	 * @var int	 */	public $mp3_valid_check_frames = 50; 	/**	 * @return bool	 */	public function Analyze() {		$info = &$this->getid3->info; 		$initialOffset = $info['avdataoffset']; 		if (!$this->getOnlyMPEGaudioInfo($info['avdataoffset'])) {			if ($this->allow_bruteforce) {				$this->error('Rescanning file in BruteForce mode');				$this->getOnlyMPEGaudioInfoBruteForce();			}		}  		if (isset($info['mpeg']['audio']['bitrate_mode'])) {			$info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);		} 		$CurrentDataLAMEversionString = null;		if (((isset($info['id3v2']['headerlength']) && ($info['avdataoffset'] > $info['id3v2']['headerlength'])) || (!isset($info['id3v2']) && ($info['avdataoffset'] > 0) && ($info['avdataoffset'] != $initialOffset)))) { 			$synchoffsetwarning = 'Unknown data before synch ';			if (isset($info['id3v2']['headerlength'])) {				$synchoffsetwarning .= '(ID3v2 header ends at '.$info['id3v2']['headerlength'].', then '.($info['avdataoffset'] - $info['id3v2']['headerlength']).' bytes garbage, ';			} elseif ($initialOffset > 0) {				$synchoffsetwarning .= '(should be at '.$initialOffset.', ';			} else {				$synchoffsetwarning .= '(should be at beginning of file, ';			}			$synchoffsetwarning .= 'synch detected at '.$info['avdataoffset'].')';			if (isset($info['audio']['bitrate_mode']) && ($info['audio']['bitrate_mode'] == 'cbr')) { 				if (!empty($info['id3v2']['headerlength']) && (($info['avdataoffset'] - $info['id3v2']['headerlength']) == $info['mpeg']['audio']['framelength'])) { 					$synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90-3.92) DLL in CBR mode.';					$info['audio']['codec'] = 'LAME';					$CurrentDataLAMEversionString = 'LAME3.'; 				} elseif (empty($info['id3v2']['headerlength']) && ($info['avdataoffset'] == $info['mpeg']['audio']['framelength'])) { 					$synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90 - 3.92) DLL in CBR mode.';					$info['audio']['codec'] = 'LAME';					$CurrentDataLAMEversionString = 'LAME3.'; 				} 			}			$this->warning($synchoffsetwarning); 		} 		if (isset($info['mpeg']['audio']['LAME'])) {			$info['audio']['codec'] = 'LAME';			if (!empty($info['mpeg']['audio']['LAME']['long_version'])) {				$info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['long_version'], "\x00");			} elseif (!empty($info['mpeg']['audio']['LAME']['short_version'])) {				$info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['short_version'], "\x00");			}		}

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/ID3/module.audio.mp3.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.