wppaste
WordPress

getid3_asf::Analyze(): bool

Source
wp-includes/ID3/module.audio-video.asf.php:59

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_asf::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

Touches nothing outside its own arguments.

Scaling
Scales with input

The body loops, so the work grows with how much data it finds.

Instructions
133–171

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

Plugin surface
None

Nothing here hands control to plugin code.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What one call costs · 1 distinct outcome

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

WhenInstructionsCalls it makes
!$HeaderObjectsCounter && !isset($thisfile_asf_streambitratepropertiesobject) && !isset($thisfile_asf) && !isset($thisfile_asf_codeclistobject) && !isset($thisfile_audio) && !isset($info)133–171->fseek(), ->fread(), ->BytestringToGUID(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ->ftell(), ->fread(), ->ftell()

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-dev2892133–171200
8.52892133–171200
8.42892133–171200430 fewer instructions than PHP 8.3
8.33322148–186200
8.23322148–18620019 more instructions than PHP 8.1
8.13303148–18620012 fewer instructions than PHP 7.4
7.43315148–190200

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

Show all 21

Source code

	public function Analyze() {		$info = &$this->getid3->info; 		// Shortcuts		$thisfile_audio = &$info['audio'];		$thisfile_video = &$info['video'];		$info['asf']  = array();		$thisfile_asf = &$info['asf'];		$thisfile_asf['comments'] = array();		$thisfile_asf_comments    = &$thisfile_asf['comments'];		$thisfile_asf['header_object'] = array();		$thisfile_asf_headerobject     = &$thisfile_asf['header_object'];  		// ASF structure:		// * Header Object [required]		//   * File Properties Object [required]   (global file attributes)		//   * Stream Properties Object [required] (defines media stream & characteristics)		//   * Header Extension Object [required]  (additional functionality)		//   * Content Description Object          (bibliographic information)		//   * Script Command Object               (commands for during playback)		//   * Marker Object                       (named jumped points within the file)		// * Data Object [required]		//   * Data Packets		// * Index Object 		// Header Object: (mandatory, one only)		// Field Name                   Field Type   Size (bits)		// Object ID                    GUID         128             // GUID for header object - GETID3_ASF_Header_Object		// Object Size                  QWORD        64              // size of header object, including 30 bytes of Header Object header		// Number of Header Objects     DWORD        32              // number of objects in header object		// Reserved1                    BYTE         8               // hardcoded: 0x01		// Reserved2                    BYTE         8               // hardcoded: 0x02 		$info['fileformat'] = 'asf'; 		$this->fseek($info['avdataoffset']);		$HeaderObjectData = $this->fread(30); 		$thisfile_asf_headerobject['objectid']      = substr($HeaderObjectData, 0, 16);		$thisfile_asf_headerobject['objectid_guid'] = $this->BytestringToGUID($thisfile_asf_headerobject['objectid']);		if ($thisfile_asf_headerobject['objectid'] != GETID3_ASF_Header_Object) {			unset($info['fileformat'], $info['asf']);			return $this->error('ASF header GUID {'.$this->BytestringToGUID($thisfile_asf_headerobject['objectid']).'} does not match expected "GETID3_ASF_Header_Object" GUID {'.$this->BytestringToGUID(GETID3_ASF_Header_Object).'}');		}		$thisfile_asf_headerobject['objectsize']    = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 16, 8));		$thisfile_asf_headerobject['headerobjects'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 24, 4));		$thisfile_asf_headerobject['reserved1']     = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 28, 1));		$thisfile_asf_headerobject['reserved2']     = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 29, 1)); 		$NextObjectOffset = $this->ftell();		$ASFHeaderData = $this->fread($thisfile_asf_headerobject['objectsize'] - 30);		$offset = 0;		$thisfile_asf_streambitratepropertiesobject = array();		$thisfile_asf_codeclistobject = array();		$StreamPropertiesObjectData = array(); 		for ($HeaderObjectsCounter = 0; $HeaderObjectsCounter < $thisfile_asf_headerobject['headerobjects']; $HeaderObjectsCounter++) {			$NextObjectGUID = substr($ASFHeaderData, $offset, 16);			$offset += 16;			$NextObjectGUIDtext = $this->BytestringToGUID($NextObjectGUID);			$NextObjectSize = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));			$offset += 8;			switch ($NextObjectGUID) { 				case GETID3_ASF_File_Properties_Object:					// File Properties Object: (mandatory, one only)					// Field Name                   Field Type   Size (bits)					// Object ID                    GUID         128             // GUID for file properties object - GETID3_ASF_File_Properties_Object					// Object Size                  QWORD        64              // size of file properties object, including 104 bytes of File Properties Object header					// File ID                      GUID         128             // unique ID - identical to File ID in Data Object					// File Size                    QWORD        64              // entire file in bytes. Invalid if Broadcast Flag == 1					// Creation Date                QWORD        64              // date & time of file creation. Maybe invalid if Broadcast Flag == 1					// Data Packets Count           QWORD        64              // number of data packets in Data Object. Invalid if Broadcast Flag == 1					// Play Duration                QWORD        64              // playtime, in 100-nanosecond units. Invalid if Broadcast Flag == 1					// Send Duration                QWORD        64              // time needed to send file, in 100-nanosecond units. Players can ignore this value. Invalid if Broadcast Flag == 1					// Preroll                      QWORD        64              // time to buffer data before starting to play file, in 1-millisecond units. If <> 0, PlayDuration and PresentationTime have been offset by this amount					// Flags                        DWORD        32              //					// * Broadcast Flag             bits         1  (0x01)       // file is currently being written, some header values are invalid					// * Seekable Flag              bits         1  (0x02)       // is file seekable

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.asf.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.