wppaste
WordPress

getid3_quicktime::QuicktimeParseAtom( string $atomname, int $atomsize, string $atom_data, int $baseoffset, array $atomHierarchy, bool $ParseAllPossibleAtoms ): array|false

Source
wp-includes/ID3/module.audio-video.quicktime.php:276

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

$atomnamestring
$atomsizeint
$atom_datastring
$baseoffsetint
$atomHierarchyarray
$ParseAllPossibleAtomsbool

Return value

array|false

Performance profile

How much work a call to getid3_quicktime::QuicktimeParseAtom() 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

Touches nothing outside its own arguments.

Scaling
Scales with input

The body loops, so the work grows with what you pass in.

Instructions
46–91

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 6149.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
2

2 places in core call this, so the cost is paid more often than your own code shows.

What one call costs · 7 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost getid3_quicktime::QuicktimeParseAtom() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always46–71end(), array_push(), ->QuicktimeParseContainerAtom(), array_pop()
$atom_parent != "udta" && !$atomoffset && empty($atom_structure)48–50end(), array_push(), array_pop()
$atom_parent != "udta" && !$atomoffset && !empty($atom_structure)58–60end(), array_push(), ->CopyToAppropriateCommentsSection(), array_pop()
$atom_parent == "udta" && empty($atom_structure)72–78end(), array_push(), ::getid3_lib(), ::getid3_lib(), ->QuicktimeLanguageLookup(), array_pop()
$atom_parent != "udta" && $atomoffset && empty($atom_structure)81end(), array_push(), ::getid3_lib(), ->warning(), array_pop()
$atom_parent == "udta" && !empty($atom_structure)82–88end(), array_push(), ::getid3_lib(), ::getid3_lib(), ->QuicktimeLanguageLookup(), ->CopyToAppropriateCommentsSection(), array_pop()
$atom_parent != "udta" && $atomoffset && !empty($atom_structure)91end(), array_push(), ::getid3_lib(), ->warning(), ->CopyToAppropriateCommentsSection(), array_pop()

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

PHPCompiledExecutedBranchesNotes
8.6-dev615146–915042 more instructions than PHP 8.5
8.5614946–91504
8.4614946–915041179 fewer instructions than PHP 8.3
8.3732852–112504
8.2732852–11250420 more instructions than PHP 8.1
8.1730852–19250410 fewer instructions than PHP 7.4
7.4731852–192504

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 · 35

Show all 35

Used by · 2

Source code

	public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) {		// http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/INDEX/atomalphaindex.htm		// https://code.google.com/p/mp4v2/wiki/iTunesMetadata 		$info = &$this->getid3->info; 		$atom_parent = end($atomHierarchy); // not array_pop($atomHierarchy); see https://www.getid3.org/phpBB3/viewtopic.php?t=1717		array_push($atomHierarchy, $atomname);		$atom_structure              = array();		$atom_structure['hierarchy'] = implode(' ', $atomHierarchy);		$atom_structure['name']      = $atomname;		$atom_structure['size']      = $atomsize;		$atom_structure['offset']    = $baseoffset;		if (substr($atomname, 0, 3) == "\x00\x00\x00") {			// https://github.com/JamesHeinrich/getID3/issues/139			$atomname = getid3_lib::BigEndian2Int($atomname);			$atom_structure['name'] = $atomname;			$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);		} else {			switch ($atomname) {				case 'moov': // MOVie container atom				case 'moof': // MOvie Fragment box				case 'trak': // TRAcK container atom				case 'traf': // TRAck Fragment box				case 'clip': // CLIPping container atom				case 'matt': // track MATTe container atom				case 'edts': // EDiTS container atom				case 'tref': // Track REFerence container atom				case 'mdia': // MeDIA container atom				case 'minf': // Media INFormation container atom				case 'dinf': // Data INFormation container atom				case 'nmhd': // Null Media HeaDer container atom				case 'udta': // User DaTA container atom				case 'cmov': // Compressed MOVie container atom				case 'rmra': // Reference Movie Record Atom				case 'rmda': // Reference Movie Descriptor Atom				case 'gmhd': // Generic Media info HeaDer atom (seen on QTVR)					$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);					break; 				case 'ilst': // Item LiST container atom					if ($atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms)) {						// some "ilst" atoms contain data atoms that have a numeric name, and the data is far more accessible if the returned array is compacted						$allnumericnames = true;						foreach ($atom_structure['subatoms'] as $subatomarray) {							if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) {								$allnumericnames = false;								break;							}						}						if ($allnumericnames) {							$newData = array();							foreach ($atom_structure['subatoms'] as $subatomarray) {								foreach ($subatomarray['subatoms'] as $newData_subatomarray) {									unset($newData_subatomarray['hierarchy'], $newData_subatomarray['name']);									$newData[$subatomarray['name']] = $newData_subatomarray;									break;								}							}							$atom_structure['data'] = $newData;							unset($atom_structure['subatoms']);						}					}					break; 				case 'stbl': // Sample TaBLe container atom					$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms);					$isVideo = false;					$framerate  = 0;					$framecount = 0;					foreach ($atom_structure['subatoms'] as $key => $value_array) {						if (isset($value_array['sample_description_table'])) {							foreach ($value_array['sample_description_table'] as $key2 => $value_array2) {								if (isset($value_array2['data_format'])) {									switch ($value_array2['data_format']) {										case 'avc1':										case 'mp4v':											// video data											$isVideo = true;											break;

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-video.quicktime.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.