wppaste
WordPress

getid3_flv

Source
wp-includes/ID3/module.audio-video.flv.php:81

Compatibility

WordPress
core
  • 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).

Properties · 1

$max_framesintpublic
Break out of the loop if too many frames have been scanned; only scan this many if meta frame does not contain useful duration.

Methods · 5

Source code

class getid3_flv extends getid3_handler{	const magic = 'FLV'; 	/**	 * Break out of the loop if too many frames have been scanned; only scan this	 * many if meta frame does not contain useful duration.	 *	 * @var int	 */	public $max_frames = 100000; 	/**	 * @return bool	 */	public function Analyze() {		$info = &$this->getid3->info; 		$this->fseek($info['avdataoffset']); 		$FLVdataLength = $info['avdataend'] - $info['avdataoffset'];		$FLVheader = $this->fread(5); 		$info['fileformat'] = 'flv';		$info['flv']['header']['signature'] =                           substr($FLVheader, 0, 3);		$info['flv']['header']['version']   = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1));		$TypeFlags                          = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1)); 		if ($info['flv']['header']['signature'] != self::magic) {			$this->error('Expecting "'.getid3_lib::PrintHexBytes(self::magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($info['flv']['header']['signature']).'"');			unset($info['flv'], $info['fileformat']);			return false;		} 		$info['flv']['header']['hasAudio'] = (bool) ($TypeFlags & 0x04);		$info['flv']['header']['hasVideo'] = (bool) ($TypeFlags & 0x01); 		$FrameSizeDataLength = getid3_lib::BigEndian2Int($this->fread(4));		$FLVheaderFrameLength = 9;		if ($FrameSizeDataLength > $FLVheaderFrameLength) {			$this->fseek($FrameSizeDataLength - $FLVheaderFrameLength, SEEK_CUR);		}		$Duration = 0;		$found_video = false;		$found_audio = false;		$found_meta  = false;		$found_valid_meta_playtime = false;		$tagParseCount = 0;		$info['flv']['framecount'] = array('total'=>0, 'audio'=>0, 'video'=>0);		$flv_framecount = &$info['flv']['framecount'];		while ((($this->ftell() + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || !$found_valid_meta_playtime))  {			$ThisTagHeader = $this->fread(16); 			$PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  0, 4));			$TagType           = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  4, 1));			$DataLength        = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  5, 3));			$Timestamp         = getid3_lib::BigEndian2Int(substr($ThisTagHeader,  8, 3));			$LastHeaderByte    = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1));			$NextOffset = $this->ftell() - 1 + $DataLength;			if ($Timestamp > $Duration) {				$Duration = $Timestamp;			} 			$flv_framecount['total']++;			switch ($TagType) {				case GETID3_FLV_TAG_AUDIO:					$flv_framecount['audio']++;					if (!$found_audio) {						$found_audio = true;						$info['flv']['audio']['audioFormat']     = ($LastHeaderByte >> 4) & 0x0F;						$info['flv']['audio']['audioRate']       = ($LastHeaderByte >> 2) & 0x03;						$info['flv']['audio']['audioSampleSize'] = ($LastHeaderByte >> 1) & 0x01;						$info['flv']['audio']['audioType']       =  $LastHeaderByte       & 0x01;					}					break; 				case GETID3_FLV_TAG_VIDEO:					$flv_framecount['video']++;					if (!$found_video) {						$found_video = true;

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