getid3_matroska::parseEBML( array $info )
- Source
wp-includes/ID3/module.audio-video.matroska.php:578
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.
Parameters
$infoarray
Performance profile
How much work a call to getid3_matroska::parseEBML() 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
- 13–137
- Plugin surface
- None
- Called by
- 2
Touches nothing outside its own arguments.
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 1756.
Nothing here hands control to plugin code.
2 places in core call this, so the cost is paid more often than your own code shows.
What one call costs · 3 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost getid3_matroska::parseEBML() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!->getEBMLelement() | 13 | ->getEBMLelement() |
->getEBMLelement() | 99–132 | ->getEBMLelement(), ->getEBMLelement() |
->getEBMLelement() | 100–137 | ->getEBMLelement(), ->getEBMLelement(), ->playtimeFromMetadata() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 1756 | 13–137 | 192 | |
| 8.5 | 1756 | 13–137 | 192 | |
| 8.4 | 1756 | 13–137 | 192 | |
| 8.3 | 1756 | 13–137 | 192 | |
| 8.2 | 1756 | 13–137 | 192 | 35 more instructions than PHP 8.1 |
| 8.1 | 1721 | 1721 | 192 | |
| 7.4 | 1721 | 1721 | 192 |
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::getEBMLelement()
- getid3_lib::BigEndian2Int()
- getid3_lib::trimNullByte()
- getid3_matroska::unhandledElement()
- getid3_matroska::EBML2Int()
- getid3_matroska::EBMLidName()
- getid3_matroska::warning()
- getid3_lib::PrintHexBytes()
- getid3_lib::BigEndian2Float()ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic
- getid3_matroska::readEBMLelementData()
- getid3_matroska::EBMLdate2unix()
- getid3_matroska::TargetTypeValue()
Show all 16
- getid3_matroska::HandleEMBLSimpleTag()
- getid3_matroska::saveAttachment()
- getid3_matroska::HandleEMBLClusterBlock()
- getid3_matroska::playtimeFromMetadata()
Used by · 2
- getid3_matroska::Analyze()
- 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
Source code
private function parseEBML(&$info) { // http://www.matroska.org/technical/specs/index.html#EBMLBasics $this->current_offset = $info['avdataoffset']; while ($this->getEBMLelement($top_element, $info['avdataend'])) { switch ($top_element['id']) { case EBML_ID_EBML: $info['matroska']['header']['offset'] = $top_element['offset']; $info['matroska']['header']['length'] = $top_element['length']; while ($this->getEBMLelement($element_data, $top_element['end'], true)) { switch ($element_data['id']) { case EBML_ID_EBMLVERSION: case EBML_ID_EBMLREADVERSION: case EBML_ID_EBMLMAXIDLENGTH: case EBML_ID_EBMLMAXSIZELENGTH: case EBML_ID_DOCTYPEVERSION: case EBML_ID_DOCTYPEREADVERSION: $element_data['data'] = getid3_lib::BigEndian2Int($element_data['data']); break; case EBML_ID_DOCTYPE: $element_data['data'] = getid3_lib::trimNullByte($element_data['data']); $info['matroska']['doctype'] = $element_data['data']; $info['fileformat'] = $element_data['data']; break; default: $this->unhandledElement('header', __LINE__, $element_data); break; } unset($element_data['offset'], $element_data['end']); $info['matroska']['header']['elements'][] = $element_data; } break; case EBML_ID_SEGMENT: $info['matroska']['segment'][0]['offset'] = $top_element['offset']; $info['matroska']['segment'][0]['length'] = $top_element['length']; while ($this->getEBMLelement($element_data, $top_element['end'])) { if ($element_data['id'] != EBML_ID_CLUSTER || !$this->hide_clusters) { // collect clusters only if required $info['matroska']['segments'][] = $element_data; } switch ($element_data['id']) { case EBML_ID_SEEKHEAD: // Contains the position of other level 1 elements. while ($this->getEBMLelement($seek_entry, $element_data['end'])) { switch ($seek_entry['id']) { case EBML_ID_SEEK: // Contains a single seek entry to an EBML element while ($this->getEBMLelement($sub_seek_entry, $seek_entry['end'], true)) { switch ($sub_seek_entry['id']) { case EBML_ID_SEEKID: $seek_entry['target_id'] = self::EBML2Int($sub_seek_entry['data']); $seek_entry['target_name'] = self::EBMLidName($seek_entry['target_id']); break; case EBML_ID_SEEKPOSITION: $seek_entry['target_offset'] = $element_data['offset'] + getid3_lib::BigEndian2Int($sub_seek_entry['data']); break; default: $this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry); } break; } if (!isset($seek_entry['target_id'])) { $this->warning('seek_entry[target_id] unexpectedly not set at '.$seek_entry['offset']); break; } if (($seek_entry['target_id'] != EBML_ID_CLUSTER) || !$this->hide_clusters) { // collect clusters only if required $info['matroska']['seek'][] = $seek_entry; } 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-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.