getid3_mp3::Analyze(): bool
- Source
wp-includes/ID3/module.audio.mp3.php:44
Compatibility
- WordPress
- core
- PHP
- 7.4–8.6-dev
- 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), and compiles on PHP 7.4 through 8.6-dev.
Return value
bool
Performance profile
How much work a call to getid3_mp3::Analyze() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 57–161
- Plugin surface
- None
- Called by
- 0
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 364.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What one call costs · 16 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost getid3_mp3::Analyze() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && empty($CurrentDataLAMEversionString) && empty($value) && empty($info) | 57–92 | ->getOnlyMPEGaudioInfo() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && empty($CurrentDataLAMEversionString) && empty($value) && !empty($info) | 64–129 | ->getOnlyMPEGaudioInfo(), ->GuessEncoderOptions() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && empty($CurrentDataLAMEversionString) && !empty($value) && empty($info) | 66–101 | ->getOnlyMPEGaudioInfo(), rtrim() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && empty($CurrentDataLAMEversionString) && empty($value) && empty($info) | 71–94 | ->getOnlyMPEGaudioInfo(), ->warning() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && empty($CurrentDataLAMEversionString) && !empty($value) && !empty($info) | 73–138 | ->getOnlyMPEGaudioInfo(), rtrim(), ->GuessEncoderOptions() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && empty($CurrentDataLAMEversionString) && empty($value) && !empty($info) | 78–131 | ->getOnlyMPEGaudioInfo(), ->warning(), ->GuessEncoderOptions() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && empty($CurrentDataLAMEversionString) && !empty($value) && empty($info) | 80–103 | ->getOnlyMPEGaudioInfo(), rtrim(), ->warning() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && $CurrentDataLAMEversionString && empty($value) && empty($info) | 83–116 | ->getOnlyMPEGaudioInfo(), ->fseek(), ->fread() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && empty($CurrentDataLAMEversionString) && !empty($value) && !empty($info) | 87–140 | ->getOnlyMPEGaudioInfo(), rtrim(), ->warning(), ->GuessEncoderOptions() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && $CurrentDataLAMEversionString && empty($value) && !empty($info) | 90–153 | ->getOnlyMPEGaudioInfo(), ->fseek(), ->fread(), ->GuessEncoderOptions() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && $CurrentDataLAMEversionString && !empty($value) && empty($info) | 92–122 | ->getOnlyMPEGaudioInfo(), ->fseek(), ->fread(), rtrim() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && $CurrentDataLAMEversionString && empty($value) && empty($info) | 97–118 | ->getOnlyMPEGaudioInfo(), ->fseek(), ->fread(), ->warning() |
4 further outcomes, up to 161 instructions
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && $CurrentDataLAMEversionString && !empty($value) && !empty($info) | 99–159 | ->getOnlyMPEGaudioInfo(), ->fseek(), ->fread(), rtrim(), ->GuessEncoderOptions() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && $CurrentDataLAMEversionString && empty($value) && !empty($info) | 104–155 | ->getOnlyMPEGaudioInfo(), ->fseek(), ->fread(), ->warning(), ->GuessEncoderOptions() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && $CurrentDataLAMEversionString && !empty($value) && empty($info) | 106–124 | ->getOnlyMPEGaudioInfo(), ->fseek(), ->fread(), rtrim(), ->warning() |
->getOnlyMPEGaudioInfo() && !isset($value) && isset($info) && $CurrentDataLAMEversionString && !empty($value) && !empty($info) | 113–161 | ->getOnlyMPEGaudioInfo(), ->fseek(), ->fread(), rtrim(), ->warning(), ->GuessEncoderOptions() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 364 | 57–161 | 51 | |
| 8.5 | 364 | 57–161 | 51 | |
| 8.4 | 364 | 57–161 | 51 | 26 fewer instructions than PHP 8.3 |
| 8.3 | 390 | 57–183 | 51 | |
| 8.2 | 390 | 57–183 | 51 | |
| 8.1 | 390 | 57–183 | 51 | 3 fewer instructions than PHP 7.4 |
| 7.4 | 393 | 57–184 | 51 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 7
- getid3_mp3::getOnlyMPEGaudioInfo()
- getid3_mp3::error()
- getid3_mp3::getOnlyMPEGaudioInfoBruteForce()
- getid3_mp3::warning()
- getid3_mp3::fseek()
- getid3_mp3::fread()
- getid3_mp3::GuessEncoderOptions()
Source code
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"); } } $CurrentDataLAMEversionString = (!empty($CurrentDataLAMEversionString) ? $CurrentDataLAMEversionString : (isset($info['audio']['encoder']) ? $info['audio']['encoder'] : '')); if (!empty($CurrentDataLAMEversionString) && (substr($CurrentDataLAMEversionString, 0, 6) == 'LAME3.') && !preg_match('[0-9\)]', substr($CurrentDataLAMEversionString, -1))) { // a version number of LAME that does not end with a number like "LAME3.92" // or with a closing parenthesis like "LAME3.88 (alpha)" // or a version of LAME with the LAMEtag-not-filled-in-DLL-mode bug (3.90-3.92) // not sure what the actual last frame length will be, but will be less than or equal to 1441 $PossiblyLongerLAMEversion_FrameLength = 1441; // Not sure what version of LAME this is - look in padding of last frame for longer version string $PossibleLAMEversionStringOffset = $info['avdataend'] - $PossiblyLongerLAMEversion_FrameLength; $this->fseek($PossibleLAMEversionStringOffset); $PossiblyLongerLAMEversion_Data = $this->fread($PossiblyLongerLAMEversion_FrameLength); switch (substr($CurrentDataLAMEversionString, -1)) { case 'a': case 'b': // "LAME3.94a" will have a longer version string of "LAME3.94 (alpha)" for example // need to trim off "a" to match longer string $CurrentDataLAMEversionString = substr($CurrentDataLAMEversionString, 0, -1); break; }Changelog
Unchanged from 6.7.7 through 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.