getid3_riff::Analyze(): bool
- Source
wp-includes/ID3/module.audio-video.riff.php:42
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_riff::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
- Light
- Scaling
- Scales with input
- Instructions
- 181–253
- Plugin surface
- None
- Called by
- 0
Touches nothing outside its own arguments.
The body loops, so the work grows with how much data it finds.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 3918.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What one call costs · 2 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost getid3_riff::Analyze() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
$RIFFsize != "\x00\x00\x00\x00" && !empty($thisfile_audio) && !empty($thisfile_audio_dataformat) && !isset($value) && empty($value) && isset($thisfile_audio) && empty($info) && $thisfile_audio_dataformat != "ac3" && !isset($thisfile_riff_WAVE) && isset($info) | 181–198 | ->fseek(), ->fread(), ->ftell(), ->EitherEndian2Int(), ->ParseRIFF() |
$RIFFsize != "\x00\x00\x00\x00" && !empty($thisfile_audio) && !empty($thisfile_audio_dataformat) && empty($value) && isset($thisfile_audio) && empty($info) && $thisfile_audio_dataformat != "ac3" && !isset($thisfile_riff_WAVE) && isset($info) | 226–253 | ->fseek(), ->fread(), ->ftell(), ->EitherEndian2Int(), ->ParseRIFF(), strtolower(), ->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 | 3917 | 181–253 | 282 | 1 fewer instruction than PHP 8.5 |
| 8.5 | 3918 | 181–253 | 282 | |
| 8.4 | 3918 | 181–253 | 282 | 449 fewer instructions than PHP 8.3 |
| 8.3 | 4367 | 190–262 | 282 | |
| 8.2 | 4367 | 190–262 | 282 | 16 more instructions than PHP 8.1 |
| 8.1 | 4351 | 190–261 | 282 | |
| 7.4 | 4351 | 190–261 | 282 |
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 · 39
- getid3_riff::fseek()
- getid3_riff::fread()
- getid3_riff::ftell()
- getid3_riff::warning()
- getid3_riff::EitherEndian2Int()
- getid3_riff::ParseRIFF()
- getid3_riff::error()
- getid3_riff::ParseRIFFAMV()
- getid3_riff::ParseDIVXTAG()
- getid3_lib::PrintHexBytes()
- getid3_riff::parseWAVEFORMATex()
- getid3_lib::array_merge_noclobber()
Show all 39
- getid3_lib::SafeDiv()Perform a division, guarding against division by zero
- getid3_lib::LittleEndian2Float()
- getid3_lib::Dec2Bin()
- getid3_lib::Bin2Dec()
- getid3_lib::RGADnameLookup()
- getid3_lib::RGADoriginatorLookup()
- getid3_lib::RGADadjustmentLookup()
- getid3_lib::CastAsInt()
- getid3_lib::LittleEndian2Int()
- getid3_lib::BigEndian2Int()
- getid3_riff::waveSNDMtagLookup()
- getid3_lib::XML2array()
- getid3_lib::CreateDeepArray()
- getid3_riff::__construct()
- getid3_riff::wFormatTagLookup()
- getid3_riff::fourccLookup()
- getid3_riff::ParseBITMAPINFOHEADER()
- getid3_lib::BigEndian2Float()ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic
- getid3_lib::DateMac2Unix()
- getid3_lib::FixedPoint16_16()
- getid3_lib::IncludeDependency()
- getID3::__construct()
- getid3_mpeg::__construct()
- getid3_lib::LittleEndian2Bin()
- getid3_id3v2::__construct()
- getid3_riff::parseComments()
- getid3_mp3::__construct()
Source code
public function Analyze() { $info = &$this->getid3->info; // initialize these values to an empty array, otherwise they default to NULL // and you can't append array values to a NULL value $info['riff'] = array('raw'=>array()); // Shortcuts $thisfile_riff = &$info['riff']; $thisfile_riff_raw = &$thisfile_riff['raw']; $thisfile_audio = &$info['audio']; $thisfile_video = &$info['video']; $thisfile_audio_dataformat = &$thisfile_audio['dataformat']; $thisfile_riff_audio = &$thisfile_riff['audio']; $thisfile_riff_video = &$thisfile_riff['video']; $thisfile_riff_WAVE = array(); $Original = array(); $Original['avdataoffset'] = $info['avdataoffset']; $Original['avdataend'] = $info['avdataend']; $this->fseek($info['avdataoffset']); $RIFFheader = $this->fread(12); $offset = $this->ftell(); $RIFFtype = substr($RIFFheader, 0, 4); $RIFFsize = substr($RIFFheader, 4, 4); $RIFFsubtype = substr($RIFFheader, 8, 4); if ($RIFFsize == "\x00\x00\x00\x00") { // https://github.com/JamesHeinrich/getID3/issues/468 // may occur in streaming files where the data size is unknown $thisfile_riff['header_size'] = $info['avdataend'] - 8; $this->warning('RIFF size field is empty, assuming the correct value is filesize-8 ('.$thisfile_riff['header_size'].')'); } else { $thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize); } switch ($RIFFtype) { case 'FORM': // AIFF, AIFC //$info['fileformat'] = 'aiff'; $this->container = 'aiff'; $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); break; case 'RIFF': // AVI, WAV, etc case 'SDSS': // SDSS is identical to RIFF, just renamed. Used by SmartSound QuickTracks (www.smartsound.com) case 'RMP3': // RMP3 is identical to RIFF, just renamed. Used by [unknown program] when creating RIFF-MP3s //$info['fileformat'] = 'riff'; $this->container = 'riff'; if ($RIFFsubtype == 'RMP3') { // RMP3 is identical to WAVE, just renamed. Used by [unknown program] when creating RIFF-MP3s $RIFFsubtype = 'WAVE'; } if ($RIFFsubtype != 'AMV ') { // AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size // Handled separately in ParseRIFFAMV() $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); } if (($info['avdataend'] - $info['filesize']) == 1) { // LiteWave appears to incorrectly *not* pad actual output file // to nearest WORD boundary so may appear to be short by one // byte, in which case - skip warning $info['avdataend'] = $info['filesize']; } $nextRIFFoffset = (int) $Original['avdataoffset'] + 8 + (int) $thisfile_riff['header_size']; // 8 = "RIFF" + 32-bit offset while ($nextRIFFoffset < min($info['filesize'], $info['avdataend'])) { try { $this->fseek($nextRIFFoffset); } catch (getid3_exception $e) { if ($e->getCode() == 10) { //$this->warning('RIFF parser: '.$e->getMessage()); $this->error('AVI extends beyond '.round(PHP_INT_MAX / 1073741824).'GB and PHP filesystem functions cannot read that far, playtime may be wrong'); $this->warning('[avdataend] value may be incorrect, multiple AVIX chunks may be present'); break; } else { throw $e; } } $nextRIFFheader = $this->fread(12);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-video.riff.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.