getid3_matroska::Analyze(): bool
- Source
wp-includes/ID3/module.audio-video.matroska.php:262
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_matroska::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
- 42–92
- 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 807.
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_matroska::Analyze() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
isset($info) && !isset($value) | 42–84 | ->parseEBML(), ->playtimeFromMetadata() |
isset($info) | 66–92 | ->parseEBML(), ->playtimeFromMetadata(), ::getDefaultStreamInfo() |
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 | 807 | 42–92 | 119 | |
| 8.5 | 807 | 42–92 | 119 | |
| 8.4 | 807 | 42–92 | 119 | 6 fewer instructions than PHP 8.3 |
| 8.3 | 813 | 42–92 | 119 | |
| 8.2 | 813 | 42–92 | 119 | 2 more instructions than PHP 8.1 |
| 8.1 | 811 | 42–92 | 119 | 14 fewer instructions than PHP 7.4 |
| 7.4 | 825 | 43–93 | 119 |
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 · 16
- getid3_matroska::parseEBML()
- getid3_matroska::error()
- getid3_matroska::playtimeFromMetadata()
- getid3_matroska::scanStartEndForClusters()Scan start and end of file for cluster information when Duration is missing Only use this if no Duration was found in the Info element and we are not in parse_whole_file mode
- getid3_matroska::calculatePlaytimeFromClusters()Calculate duration from scanned cluster timecodes
- getid3_matroska::ExtractCommentsSimpleTag()
- getid3_matroska::CodecIDtoCommonName()
- getid3_matroska::displayUnit()
- getid3_lib::IncludeDependency()
- getid3_riff::ParseBITMAPINFOHEADER()
- getid3_riff::fourccLookup()
- getid3_matroska::warning()
Show all 16
- getID3::__construct()
- getid3_ogg::__construct()
- getid3_riff::parseWAVEFORMATex()
- getid3_matroska::getDefaultStreamInfo()
Source code
public function Analyze() { $info = &$this->getid3->info; $this->scan_mode = $this->parse_whole_file ? MATROSKA_SCAN_WHOLE_FILE : MATROSKA_SCAN_HEADER; // parse container try { $this->parseEBML($info); } catch (Exception $e) { $this->error('EBML parser: '.$e->getMessage()); } $this->playtimeFromMetadata($info); // If there was no duration metadata, this might be an incomplete file or a streaming file // We need Cluster information so we can use their timecodes to estimate playtime. if (!isset($info['playtime_seconds']) && !$this->parse_whole_file) { // Scan the start and end of file for Clusters to estimate duration $this->scanStartEndForClusters($info); } if (isset($info['matroska']['cluster']) && is_array($info['matroska']['cluster'])) { if (!isset($info['playtime_seconds']) && !empty($info['matroska']['cluster'])) { // estimate playtime using clusters if not yet known $this->calculatePlaytimeFromClusters($info); } // Remove cluster information from output if hide_clusters is true // These could have been set during scanStartEndForClusters() if ($this->hide_clusters) { unset($info['matroska']['cluster']); } } // extract tags if (isset($info['matroska']['tags']) && is_array($info['matroska']['tags'])) { foreach ($info['matroska']['tags'] as $key => $infoarray) { $this->ExtractCommentsSimpleTag($infoarray); } } // process tracks if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) { foreach ($info['matroska']['tracks']['tracks'] as $key => $trackarray) { $track_info = array(); $track_info['dataformat'] = self::CodecIDtoCommonName($trackarray['CodecID']); $track_info['default'] = (isset($trackarray['FlagDefault']) ? $trackarray['FlagDefault'] : true); if (isset($trackarray['Name'])) { $track_info['name'] = $trackarray['Name']; } switch ($trackarray['TrackType']) { case 1: // Video $track_info['resolution_x'] = $trackarray['PixelWidth']; $track_info['resolution_y'] = $trackarray['PixelHeight']; $track_info['display_unit'] = self::displayUnit(isset($trackarray['DisplayUnit']) ? $trackarray['DisplayUnit'] : 0); $track_info['display_x'] = (isset($trackarray['DisplayWidth']) ? $trackarray['DisplayWidth'] : $trackarray['PixelWidth']); $track_info['display_y'] = (isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight']); if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; } if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; } if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; } if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; } if (!empty($trackarray['DefaultDuration'])) { $track_info['frame_rate'] = round(1000000000 / $trackarray['DefaultDuration'], 3); } if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } switch ($trackarray['CodecID']) { case 'V_MS/VFW/FOURCC': getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); $parsed = getid3_riff::ParseBITMAPINFOHEADER($trackarray['CodecPrivate']); $track_info['codec'] = getid3_riff::fourccLookup($parsed['fourcc']); $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $parsed; break; /*case 'V_MPEG4/ISO/AVC': $h264['profile'] = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 1, 1)); $h264['level'] = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 3, 1)); $rn = getid3_lib::BigEndian2Int(substr($trackarray['CodecPrivate'], 4, 1)); $h264['NALUlength'] = ($rn & 3) + 1;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.matroska.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.