wppaste
WordPress

getid3_riff

Source
wp-includes/ID3/module.audio-video.riff.php:33

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

$containerprotected

Methods · 13

Source code

class getid3_riff extends getid3_handler{	protected $container = 'riff'; // default 	/**	 * @return bool	 *	 * @throws getid3_exception	 */	public function Analyze() {		$info = &$this->getid3->info; 		// initialize these values to an empty array, otherwise they default to NULL		// and you can't append array values to a NULL value		$info['riff'] = array('raw'=>array()); 		// Shortcuts		$thisfile_riff             = &$info['riff'];		$thisfile_riff_raw         = &$thisfile_riff['raw'];		$thisfile_audio            = &$info['audio'];		$thisfile_video            = &$info['video'];		$thisfile_audio_dataformat = &$thisfile_audio['dataformat'];		$thisfile_riff_audio       = &$thisfile_riff['audio'];		$thisfile_riff_video       = &$thisfile_riff['video'];		$thisfile_riff_WAVE        = array(); 		$Original                 = array();		$Original['avdataoffset'] = $info['avdataoffset'];		$Original['avdataend']    = $info['avdataend']; 		$this->fseek($info['avdataoffset']);		$RIFFheader = $this->fread(12);		$offset = $this->ftell();		$RIFFtype    = substr($RIFFheader, 0, 4);		$RIFFsize    = substr($RIFFheader, 4, 4);		$RIFFsubtype = substr($RIFFheader, 8, 4); 		if ($RIFFsize == "\x00\x00\x00\x00") {			// https://github.com/JamesHeinrich/getID3/issues/468			// may occur in streaming files where the data size is unknown			$thisfile_riff['header_size'] = $info['avdataend'] - 8;			$this->warning('RIFF size field is empty, assuming the correct value is filesize-8 ('.$thisfile_riff['header_size'].')');		} else {			$thisfile_riff['header_size'] = $this->EitherEndian2Int($RIFFsize);		} 		switch ($RIFFtype) {			case 'FORM':  // AIFF, AIFC				//$info['fileformat']   = 'aiff';				$this->container = 'aiff';				$thisfile_riff[$RIFFsubtype]  = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4));				break; 			case 'RIFF':  // AVI, WAV, etc			case 'SDSS':  // SDSS is identical to RIFF, just renamed. Used by SmartSound QuickTracks (www.smartsound.com)			case 'RMP3':  // RMP3 is identical to RIFF, just renamed. Used by [unknown program] when creating RIFF-MP3s				//$info['fileformat']   = 'riff';				$this->container = 'riff';				if ($RIFFsubtype == 'RMP3') {					// RMP3 is identical to WAVE, just renamed. Used by [unknown program] when creating RIFF-MP3s					$RIFFsubtype = 'WAVE';				}				if ($RIFFsubtype != 'AMV ') {					// AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size					// Handled separately in ParseRIFFAMV()					$thisfile_riff[$RIFFsubtype]  = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4));				}				if (($info['avdataend'] - $info['filesize']) == 1) {					// LiteWave appears to incorrectly *not* pad actual output file					// to nearest WORD boundary so may appear to be short by one					// byte, in which case - skip warning					$info['avdataend'] = $info['filesize'];				} 				$nextRIFFoffset = (int) $Original['avdataoffset'] + 8 + (int) $thisfile_riff['header_size']; // 8 = "RIFF" + 32-bit offset				while ($nextRIFFoffset < min($info['filesize'], $info['avdataend'])) {					try {						$this->fseek($nextRIFFoffset);					} catch (getid3_exception $e) {						if ($e->getCode() == 10) {

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