Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../ID3
File: module.audio-video.riff.php
$RIFFchunk['amvh']['us_per_frame'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 12, 4));
[1500] Fix | Delete
$RIFFchunk['amvh']['reserved28'] = substr($AMVheader, 16, 28); // null? reserved?
[1501] Fix | Delete
$RIFFchunk['amvh']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 44, 4));
[1502] Fix | Delete
$RIFFchunk['amvh']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 48, 4));
[1503] Fix | Delete
$RIFFchunk['amvh']['frame_rate_int'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 52, 4));
[1504] Fix | Delete
$RIFFchunk['amvh']['reserved0'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 56, 4)); // 1? reserved?
[1505] Fix | Delete
$RIFFchunk['amvh']['reserved1'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 60, 4)); // 0? reserved?
[1506] Fix | Delete
$RIFFchunk['amvh']['runtime_sec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 64, 1));
[1507] Fix | Delete
$RIFFchunk['amvh']['runtime_min'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 65, 1));
[1508] Fix | Delete
$RIFFchunk['amvh']['runtime_hrs'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 66, 2));
[1509] Fix | Delete
[1510] Fix | Delete
$info['video']['frame_rate'] = 1000000 / $RIFFchunk['amvh']['us_per_frame'];
[1511] Fix | Delete
$info['video']['resolution_x'] = $RIFFchunk['amvh']['resolution_x'];
[1512] Fix | Delete
$info['video']['resolution_y'] = $RIFFchunk['amvh']['resolution_y'];
[1513] Fix | Delete
$info['playtime_seconds'] = ($RIFFchunk['amvh']['runtime_hrs'] * 3600) + ($RIFFchunk['amvh']['runtime_min'] * 60) + $RIFFchunk['amvh']['runtime_sec'];
[1514] Fix | Delete
[1515] Fix | Delete
// the rest is all hardcoded(?) and does not appear to be useful until you get to audio info at offset 256, even then everything is probably hardcoded
[1516] Fix | Delete
[1517] Fix | Delete
if (substr($AMVheader, 68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") {
[1518] Fix | Delete
throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset + 68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 68, 20)).'"');
[1519] Fix | Delete
}
[1520] Fix | Delete
// followed by 56 bytes of null: substr($AMVheader, 88, 56) -> 144
[1521] Fix | Delete
if (substr($AMVheader, 144, 8) != 'strf'."\x24\x00\x00\x00") {
[1522] Fix | Delete
throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144, 8)).'"');
[1523] Fix | Delete
}
[1524] Fix | Delete
// followed by 36 bytes of null: substr($AMVheader, 144, 36) -> 180
[1525] Fix | Delete
[1526] Fix | Delete
if (substr($AMVheader, 188, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x30\x00\x00\x00") {
[1527] Fix | Delete
throw new Exception('expecting "LIST<0x00000000>strlstrh<0x30000000>" at offset '.($startoffset + 188).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 188, 20)).'"');
[1528] Fix | Delete
}
[1529] Fix | Delete
// followed by 48 bytes of null: substr($AMVheader, 208, 48) -> 256
[1530] Fix | Delete
if (substr($AMVheader, 256, 8) != 'strf'."\x14\x00\x00\x00") {
[1531] Fix | Delete
throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256, 8)).'"');
[1532] Fix | Delete
}
[1533] Fix | Delete
// followed by 20 bytes of a modified WAVEFORMATEX:
[1534] Fix | Delete
// typedef struct {
[1535] Fix | Delete
// WORD wFormatTag; //(Fixme: this is equal to PCM's 0x01 format code)
[1536] Fix | Delete
// WORD nChannels; //(Fixme: this is always 1)
[1537] Fix | Delete
// DWORD nSamplesPerSec; //(Fixme: for all known sample files this is equal to 22050)
[1538] Fix | Delete
// DWORD nAvgBytesPerSec; //(Fixme: for all known sample files this is equal to 44100)
[1539] Fix | Delete
// WORD nBlockAlign; //(Fixme: this seems to be 2 in AMV files, is this correct ?)
[1540] Fix | Delete
// WORD wBitsPerSample; //(Fixme: this seems to be 16 in AMV files instead of the expected 4)
[1541] Fix | Delete
// WORD cbSize; //(Fixme: this seems to be 0 in AMV files)
[1542] Fix | Delete
// WORD reserved;
[1543] Fix | Delete
// } WAVEFORMATEX;
[1544] Fix | Delete
$RIFFchunk['strf']['wformattag'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 264, 2));
[1545] Fix | Delete
$RIFFchunk['strf']['nchannels'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 266, 2));
[1546] Fix | Delete
$RIFFchunk['strf']['nsamplespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 268, 4));
[1547] Fix | Delete
$RIFFchunk['strf']['navgbytespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 272, 4));
[1548] Fix | Delete
$RIFFchunk['strf']['nblockalign'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 276, 2));
[1549] Fix | Delete
$RIFFchunk['strf']['wbitspersample'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 278, 2));
[1550] Fix | Delete
$RIFFchunk['strf']['cbsize'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 280, 2));
[1551] Fix | Delete
$RIFFchunk['strf']['reserved'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 282, 2));
[1552] Fix | Delete
[1553] Fix | Delete
[1554] Fix | Delete
$info['audio']['lossless'] = false;
[1555] Fix | Delete
$info['audio']['sample_rate'] = $RIFFchunk['strf']['nsamplespersec'];
[1556] Fix | Delete
$info['audio']['channels'] = $RIFFchunk['strf']['nchannels'];
[1557] Fix | Delete
$info['audio']['bits_per_sample'] = $RIFFchunk['strf']['wbitspersample'];
[1558] Fix | Delete
$info['audio']['bitrate'] = $info['audio']['sample_rate'] * $info['audio']['channels'] * $info['audio']['bits_per_sample'];
[1559] Fix | Delete
$info['audio']['bitrate_mode'] = 'cbr';
[1560] Fix | Delete
[1561] Fix | Delete
[1562] Fix | Delete
} catch (getid3_exception $e) {
[1563] Fix | Delete
if ($e->getCode() == 10) {
[1564] Fix | Delete
$this->warning('RIFFAMV parser: '.$e->getMessage());
[1565] Fix | Delete
} else {
[1566] Fix | Delete
throw $e;
[1567] Fix | Delete
}
[1568] Fix | Delete
}
[1569] Fix | Delete
[1570] Fix | Delete
return $RIFFchunk;
[1571] Fix | Delete
}
[1572] Fix | Delete
[1573] Fix | Delete
/**
[1574] Fix | Delete
* @param int $startoffset
[1575] Fix | Delete
* @param int $maxoffset
[1576] Fix | Delete
*
[1577] Fix | Delete
* @return array|false
[1578] Fix | Delete
* @throws getid3_exception
[1579] Fix | Delete
*/
[1580] Fix | Delete
public function ParseRIFF($startoffset, $maxoffset) {
[1581] Fix | Delete
$info = &$this->getid3->info;
[1582] Fix | Delete
[1583] Fix | Delete
$RIFFchunk = array();
[1584] Fix | Delete
$FoundAllChunksWeNeed = false;
[1585] Fix | Delete
$LISTchunkParent = null;
[1586] Fix | Delete
$LISTchunkMaxOffset = null;
[1587] Fix | Delete
$AC3syncwordBytes = pack('n', getid3_ac3::syncword); // 0x0B77 -> "\x0B\x77"
[1588] Fix | Delete
[1589] Fix | Delete
try {
[1590] Fix | Delete
$this->fseek($startoffset);
[1591] Fix | Delete
$maxoffset = min($maxoffset, $info['avdataend']);
[1592] Fix | Delete
while ($this->ftell() < $maxoffset) {
[1593] Fix | Delete
$chunknamesize = $this->fread(8);
[1594] Fix | Delete
//$chunkname = substr($chunknamesize, 0, 4);
[1595] Fix | Delete
$chunkname = str_replace("\x00", '_', substr($chunknamesize, 0, 4)); // note: chunk names of 4 null bytes do appear to be legal (has been observed inside INFO and PRMI chunks, for example), but makes traversing array keys more difficult
[1596] Fix | Delete
$chunksize = $this->EitherEndian2Int(substr($chunknamesize, 4, 4));
[1597] Fix | Delete
//if (strlen(trim($chunkname, "\x00")) < 4) {
[1598] Fix | Delete
if (strlen($chunkname) < 4) {
[1599] Fix | Delete
$this->error('Expecting chunk name at offset '.($this->ftell() - 8).' but found nothing. Aborting RIFF parsing.');
[1600] Fix | Delete
break;
[1601] Fix | Delete
}
[1602] Fix | Delete
if (($chunksize == 0) && ($chunkname != 'JUNK')) {
[1603] Fix | Delete
$this->warning('Chunk ('.$chunkname.') size at offset '.($this->ftell() - 4).' is zero. Aborting RIFF parsing.');
[1604] Fix | Delete
break;
[1605] Fix | Delete
}
[1606] Fix | Delete
if (($chunksize % 2) != 0) {
[1607] Fix | Delete
// all structures are packed on word boundaries
[1608] Fix | Delete
$chunksize++;
[1609] Fix | Delete
}
[1610] Fix | Delete
[1611] Fix | Delete
switch ($chunkname) {
[1612] Fix | Delete
case 'LIST':
[1613] Fix | Delete
$listname = $this->fread(4);
[1614] Fix | Delete
if (preg_match('#^(movi|rec )$#i', $listname)) {
[1615] Fix | Delete
$RIFFchunk[$listname]['offset'] = $this->ftell() - 4;
[1616] Fix | Delete
$RIFFchunk[$listname]['size'] = $chunksize;
[1617] Fix | Delete
[1618] Fix | Delete
if (!$FoundAllChunksWeNeed) {
[1619] Fix | Delete
$WhereWeWere = $this->ftell();
[1620] Fix | Delete
$AudioChunkHeader = $this->fread(12);
[1621] Fix | Delete
$AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2);
[1622] Fix | Delete
$AudioChunkStreamType = substr($AudioChunkHeader, 2, 2);
[1623] Fix | Delete
$AudioChunkSize = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4));
[1624] Fix | Delete
[1625] Fix | Delete
if ($AudioChunkStreamType == 'wb') {
[1626] Fix | Delete
$FirstFourBytes = substr($AudioChunkHeader, 8, 4);
[1627] Fix | Delete
if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', $FirstFourBytes)) {
[1628] Fix | Delete
// MP3
[1629] Fix | Delete
if (getid3_mp3::MPEGaudioHeaderBytesValid($FirstFourBytes)) {
[1630] Fix | Delete
$getid3_temp = new getID3();
[1631] Fix | Delete
$getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp);
[1632] Fix | Delete
$getid3_temp->info['avdataoffset'] = $this->ftell() - 4;
[1633] Fix | Delete
$getid3_temp->info['avdataend'] = $this->ftell() + $AudioChunkSize;
[1634] Fix | Delete
$getid3_mp3 = new getid3_mp3($getid3_temp, __CLASS__);
[1635] Fix | Delete
$getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false);
[1636] Fix | Delete
if (isset($getid3_temp->info['mpeg']['audio'])) {
[1637] Fix | Delete
$info['mpeg']['audio'] = $getid3_temp->info['mpeg']['audio'];
[1638] Fix | Delete
$info['audio'] = $getid3_temp->info['audio'];
[1639] Fix | Delete
$info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer'];
[1640] Fix | Delete
$info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate'];
[1641] Fix | Delete
$info['audio']['channels'] = $info['mpeg']['audio']['channels'];
[1642] Fix | Delete
$info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate'];
[1643] Fix | Delete
$info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
[1644] Fix | Delete
//$info['bitrate'] = $info['audio']['bitrate'];
[1645] Fix | Delete
}
[1646] Fix | Delete
unset($getid3_temp, $getid3_mp3);
[1647] Fix | Delete
}
[1648] Fix | Delete
[1649] Fix | Delete
} elseif (strpos($FirstFourBytes, $AC3syncwordBytes) === 0) {
[1650] Fix | Delete
// AC3
[1651] Fix | Delete
$getid3_temp = new getID3();
[1652] Fix | Delete
$getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp);
[1653] Fix | Delete
$getid3_temp->info['avdataoffset'] = $this->ftell() - 4;
[1654] Fix | Delete
$getid3_temp->info['avdataend'] = $this->ftell() + $AudioChunkSize;
[1655] Fix | Delete
$getid3_ac3 = new getid3_ac3($getid3_temp);
[1656] Fix | Delete
$getid3_ac3->Analyze();
[1657] Fix | Delete
if (empty($getid3_temp->info['error'])) {
[1658] Fix | Delete
$info['audio'] = $getid3_temp->info['audio'];
[1659] Fix | Delete
$info['ac3'] = $getid3_temp->info['ac3'];
[1660] Fix | Delete
if (!empty($getid3_temp->info['warning'])) {
[1661] Fix | Delete
foreach ($getid3_temp->info['warning'] as $key => $value) {
[1662] Fix | Delete
$this->warning($value);
[1663] Fix | Delete
}
[1664] Fix | Delete
}
[1665] Fix | Delete
}
[1666] Fix | Delete
unset($getid3_temp, $getid3_ac3);
[1667] Fix | Delete
}
[1668] Fix | Delete
}
[1669] Fix | Delete
$FoundAllChunksWeNeed = true;
[1670] Fix | Delete
$this->fseek($WhereWeWere);
[1671] Fix | Delete
}
[1672] Fix | Delete
$this->fseek($chunksize - 4, SEEK_CUR);
[1673] Fix | Delete
[1674] Fix | Delete
} else {
[1675] Fix | Delete
[1676] Fix | Delete
if (!isset($RIFFchunk[$listname])) {
[1677] Fix | Delete
$RIFFchunk[$listname] = array();
[1678] Fix | Delete
}
[1679] Fix | Delete
$LISTchunkParent = $listname;
[1680] Fix | Delete
$LISTchunkMaxOffset = $this->ftell() - 4 + $chunksize;
[1681] Fix | Delete
if ($parsedChunk = $this->ParseRIFF($this->ftell(), $LISTchunkMaxOffset)) {
[1682] Fix | Delete
$RIFFchunk[$listname] = array_merge_recursive($RIFFchunk[$listname], $parsedChunk);
[1683] Fix | Delete
}
[1684] Fix | Delete
[1685] Fix | Delete
}
[1686] Fix | Delete
break;
[1687] Fix | Delete
[1688] Fix | Delete
default:
[1689] Fix | Delete
if (preg_match('#^[0-9]{2}(wb|pc|dc|db)$#', $chunkname)) {
[1690] Fix | Delete
$this->fseek($chunksize, SEEK_CUR);
[1691] Fix | Delete
break;
[1692] Fix | Delete
}
[1693] Fix | Delete
$thisindex = 0;
[1694] Fix | Delete
if (isset($RIFFchunk[$chunkname]) && is_array($RIFFchunk[$chunkname])) {
[1695] Fix | Delete
$thisindex = count($RIFFchunk[$chunkname]);
[1696] Fix | Delete
}
[1697] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['offset'] = $this->ftell() - 8;
[1698] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['size'] = $chunksize;
[1699] Fix | Delete
switch ($chunkname) {
[1700] Fix | Delete
case 'data':
[1701] Fix | Delete
$info['avdataoffset'] = $this->ftell();
[1702] Fix | Delete
$info['avdataend'] = $info['avdataoffset'] + $chunksize;
[1703] Fix | Delete
[1704] Fix | Delete
$testData = $this->fread(36);
[1705] Fix | Delete
if ($testData === '') {
[1706] Fix | Delete
break;
[1707] Fix | Delete
}
[1708] Fix | Delete
if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', substr($testData, 0, 4))) {
[1709] Fix | Delete
[1710] Fix | Delete
// Probably is MP3 data
[1711] Fix | Delete
if (getid3_mp3::MPEGaudioHeaderBytesValid(substr($testData, 0, 4))) {
[1712] Fix | Delete
$getid3_temp = new getID3();
[1713] Fix | Delete
$getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp);
[1714] Fix | Delete
$getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
[1715] Fix | Delete
$getid3_temp->info['avdataend'] = $info['avdataend'];
[1716] Fix | Delete
$getid3_mp3 = new getid3_mp3($getid3_temp, __CLASS__);
[1717] Fix | Delete
$getid3_mp3->getOnlyMPEGaudioInfo($info['avdataoffset'], false);
[1718] Fix | Delete
if (empty($getid3_temp->info['error'])) {
[1719] Fix | Delete
$info['audio'] = $getid3_temp->info['audio'];
[1720] Fix | Delete
$info['mpeg'] = $getid3_temp->info['mpeg'];
[1721] Fix | Delete
}
[1722] Fix | Delete
unset($getid3_temp, $getid3_mp3);
[1723] Fix | Delete
}
[1724] Fix | Delete
[1725] Fix | Delete
} elseif (($isRegularAC3 = (substr($testData, 0, 2) == $AC3syncwordBytes)) || substr($testData, 8, 2) == strrev($AC3syncwordBytes)) {
[1726] Fix | Delete
[1727] Fix | Delete
// This is probably AC-3 data
[1728] Fix | Delete
$getid3_temp = new getID3();
[1729] Fix | Delete
if ($isRegularAC3) {
[1730] Fix | Delete
$getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp);
[1731] Fix | Delete
$getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
[1732] Fix | Delete
$getid3_temp->info['avdataend'] = $info['avdataend'];
[1733] Fix | Delete
}
[1734] Fix | Delete
$getid3_ac3 = new getid3_ac3($getid3_temp);
[1735] Fix | Delete
if ($isRegularAC3) {
[1736] Fix | Delete
$getid3_ac3->Analyze();
[1737] Fix | Delete
} else {
[1738] Fix | Delete
// Dolby Digital WAV
[1739] Fix | Delete
// AC-3 content, but not encoded in same format as normal AC-3 file
[1740] Fix | Delete
// For one thing, byte order is swapped
[1741] Fix | Delete
$ac3_data = '';
[1742] Fix | Delete
for ($i = 0; $i < 28; $i += 2) {
[1743] Fix | Delete
$ac3_data .= substr($testData, 8 + $i + 1, 1);
[1744] Fix | Delete
$ac3_data .= substr($testData, 8 + $i + 0, 1);
[1745] Fix | Delete
}
[1746] Fix | Delete
$getid3_ac3->getid3->info['avdataoffset'] = 0;
[1747] Fix | Delete
$getid3_ac3->getid3->info['avdataend'] = strlen($ac3_data);
[1748] Fix | Delete
$getid3_ac3->AnalyzeString($ac3_data);
[1749] Fix | Delete
}
[1750] Fix | Delete
[1751] Fix | Delete
if (empty($getid3_temp->info['error'])) {
[1752] Fix | Delete
$info['audio'] = $getid3_temp->info['audio'];
[1753] Fix | Delete
$info['ac3'] = $getid3_temp->info['ac3'];
[1754] Fix | Delete
if (!empty($getid3_temp->info['warning'])) {
[1755] Fix | Delete
foreach ($getid3_temp->info['warning'] as $newerror) {
[1756] Fix | Delete
$this->warning('getid3_ac3() says: ['.$newerror.']');
[1757] Fix | Delete
}
[1758] Fix | Delete
}
[1759] Fix | Delete
}
[1760] Fix | Delete
unset($getid3_temp, $getid3_ac3);
[1761] Fix | Delete
[1762] Fix | Delete
} elseif (preg_match('/^('.implode('|', array_map('preg_quote', getid3_dts::$syncwords)).')/', $testData)) {
[1763] Fix | Delete
[1764] Fix | Delete
// This is probably DTS data
[1765] Fix | Delete
$getid3_temp = new getID3();
[1766] Fix | Delete
$getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp);
[1767] Fix | Delete
$getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
[1768] Fix | Delete
$getid3_dts = new getid3_dts($getid3_temp);
[1769] Fix | Delete
$getid3_dts->Analyze();
[1770] Fix | Delete
if (empty($getid3_temp->info['error'])) {
[1771] Fix | Delete
$info['audio'] = $getid3_temp->info['audio'];
[1772] Fix | Delete
$info['dts'] = $getid3_temp->info['dts'];
[1773] Fix | Delete
$info['playtime_seconds'] = $getid3_temp->info['playtime_seconds']; // may not match RIFF calculations since DTS-WAV often used 14/16 bit-word packing
[1774] Fix | Delete
if (!empty($getid3_temp->info['warning'])) {
[1775] Fix | Delete
foreach ($getid3_temp->info['warning'] as $newerror) {
[1776] Fix | Delete
$this->warning('getid3_dts() says: ['.$newerror.']');
[1777] Fix | Delete
}
[1778] Fix | Delete
}
[1779] Fix | Delete
}
[1780] Fix | Delete
[1781] Fix | Delete
unset($getid3_temp, $getid3_dts);
[1782] Fix | Delete
[1783] Fix | Delete
} elseif (substr($testData, 0, 4) == 'wvpk') {
[1784] Fix | Delete
[1785] Fix | Delete
// This is WavPack data
[1786] Fix | Delete
$info['wavpack']['offset'] = $info['avdataoffset'];
[1787] Fix | Delete
$info['wavpack']['size'] = getid3_lib::LittleEndian2Int(substr($testData, 4, 4));
[1788] Fix | Delete
$this->parseWavPackHeader(substr($testData, 8, 28));
[1789] Fix | Delete
[1790] Fix | Delete
} else {
[1791] Fix | Delete
// This is some other kind of data (quite possibly just PCM)
[1792] Fix | Delete
// do nothing special, just skip it
[1793] Fix | Delete
}
[1794] Fix | Delete
$nextoffset = $info['avdataend'];
[1795] Fix | Delete
$this->fseek($nextoffset);
[1796] Fix | Delete
break;
[1797] Fix | Delete
[1798] Fix | Delete
case 'iXML':
[1799] Fix | Delete
case 'bext':
[1800] Fix | Delete
case 'cart':
[1801] Fix | Delete
case 'fmt ':
[1802] Fix | Delete
case 'strh':
[1803] Fix | Delete
case 'strf':
[1804] Fix | Delete
case 'indx':
[1805] Fix | Delete
case 'MEXT':
[1806] Fix | Delete
case 'DISP':
[1807] Fix | Delete
case 'wamd':
[1808] Fix | Delete
case 'guan':
[1809] Fix | Delete
// always read data in
[1810] Fix | Delete
case 'JUNK':
[1811] Fix | Delete
// should be: never read data in
[1812] Fix | Delete
// but some programs write their version strings in a JUNK chunk (e.g. VirtualDub, AVIdemux, etc)
[1813] Fix | Delete
if ($chunksize < 1048576) {
[1814] Fix | Delete
if ($chunksize > 0) {
[1815] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize);
[1816] Fix | Delete
if ($chunkname == 'JUNK') {
[1817] Fix | Delete
if (preg_match('#^([\\x20-\\x7F]+)#', $RIFFchunk[$chunkname][$thisindex]['data'], $matches)) {
[1818] Fix | Delete
// only keep text characters [chr(32)-chr(127)]
[1819] Fix | Delete
$info['riff']['comments']['junk'][] = trim($matches[1]);
[1820] Fix | Delete
}
[1821] Fix | Delete
// but if nothing there, ignore
[1822] Fix | Delete
// remove the key in either case
[1823] Fix | Delete
unset($RIFFchunk[$chunkname][$thisindex]['data']);
[1824] Fix | Delete
}
[1825] Fix | Delete
}
[1826] Fix | Delete
} else {
[1827] Fix | Delete
$this->warning('Chunk "'.$chunkname.'" at offset '.$this->ftell().' is unexpectedly larger than 1MB (claims to be '.number_format($chunksize).' bytes), skipping data');
[1828] Fix | Delete
$this->fseek($chunksize, SEEK_CUR);
[1829] Fix | Delete
}
[1830] Fix | Delete
break;
[1831] Fix | Delete
[1832] Fix | Delete
//case 'IDVX':
[1833] Fix | Delete
// $info['divxtag']['comments'] = self::ParseDIVXTAG($this->fread($chunksize));
[1834] Fix | Delete
// break;
[1835] Fix | Delete
[1836] Fix | Delete
case 'scot':
[1837] Fix | Delete
// https://cmsdk.com/node-js/adding-scot-chunk-to-wav-file.html
[1838] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize);
[1839] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['alter'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 0, 1);
[1840] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['attrib'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 1, 1);
[1841] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['artnum'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 2, 2));
[1842] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['title'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 4, 43); // "name" in other documentation
[1843] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['copy'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 47, 4);
[1844] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['padd'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 51, 1);
[1845] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['asclen'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 52, 5);
[1846] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['startseconds'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 57, 2));
[1847] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['starthundredths'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 59, 2));
[1848] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['endseconds'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 61, 2));
[1849] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['endhundreths'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 63, 2));
[1850] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['sdate'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 65, 6);
[1851] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['kdate'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 71, 6);
[1852] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['start_hr'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 77, 1);
[1853] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['kill_hr'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 78, 1);
[1854] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['digital'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 79, 1);
[1855] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 80, 2));
[1856] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['stereo'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 82, 1);
[1857] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['compress'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 83, 1);
[1858] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['eomstrt'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 84, 4));
[1859] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['eomlen'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 88, 2));
[1860] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['attrib2'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 90, 4));
[1861] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['future1'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 94, 12);
[1862] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['catfontcolor'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 106, 4));
[1863] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['catcolor'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 110, 4));
[1864] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['segeompos'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 114, 4));
[1865] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['vt_startsecs'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 118, 2));
[1866] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['vt_starthunds'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 120, 2));
[1867] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['priorcat'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 122, 3);
[1868] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['priorcopy'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 125, 4);
[1869] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['priorpadd'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 129, 1);
[1870] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['postcat'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 130, 3);
[1871] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['postcopy'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 133, 4);
[1872] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['postpadd'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 137, 1);
[1873] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['hrcanplay'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 138, 21);
[1874] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['future2'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 159, 108);
[1875] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['artist'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 267, 34);
[1876] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['comment'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 301, 34); // "trivia" in other documentation
[1877] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['intro'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 335, 2);
[1878] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['end'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 337, 1);
[1879] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['year'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 338, 4);
[1880] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['obsolete2'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 342, 1);
[1881] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['rec_hr'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 343, 1);
[1882] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['rdate'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 344, 6);
[1883] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['mpeg_bitrate'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 350, 2));
[1884] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['pitch'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 352, 2));
[1885] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['playlevel'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 354, 2));
[1886] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['lenvalid'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 356, 1);
[1887] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 357, 4));
[1888] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['newplaylevel'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 361, 2));
[1889] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['chopsize'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 363, 4));
[1890] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['vteomovr'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 367, 4));
[1891] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['desiredlen'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 371, 4));
[1892] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['triggers'] = getid3_lib::LittleEndian2Int(substr($RIFFchunk[$chunkname][$thisindex]['data'], 375, 4));
[1893] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['parsed']['fillout'] = substr($RIFFchunk[$chunkname][$thisindex]['data'], 379, 33);
[1894] Fix | Delete
[1895] Fix | Delete
foreach (array('title', 'artist', 'comment') as $key) {
[1896] Fix | Delete
if (trim($RIFFchunk[$chunkname][$thisindex]['parsed'][$key])) {
[1897] Fix | Delete
$info['riff']['comments'][$key] = array($RIFFchunk[$chunkname][$thisindex]['parsed'][$key]);
[1898] Fix | Delete
}
[1899] Fix | Delete
}
[1900] Fix | Delete
if ($RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] && !empty($info['filesize']) && ($RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'] != $info['filesize'])) {
[1901] Fix | Delete
$this->warning('RIFF.WAVE.scot.filelength ('.$RIFFchunk[$chunkname][$thisindex]['parsed']['filelength'].') different from actual filesize ('.$info['filesize'].')');
[1902] Fix | Delete
}
[1903] Fix | Delete
break;
[1904] Fix | Delete
[1905] Fix | Delete
default:
[1906] Fix | Delete
if (!empty($LISTchunkParent) && isset($LISTchunkMaxOffset) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) {
[1907] Fix | Delete
$RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset'];
[1908] Fix | Delete
$RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['size'] = $RIFFchunk[$chunkname][$thisindex]['size'];
[1909] Fix | Delete
unset($RIFFchunk[$chunkname][$thisindex]['offset']);
[1910] Fix | Delete
unset($RIFFchunk[$chunkname][$thisindex]['size']);
[1911] Fix | Delete
if (isset($RIFFchunk[$chunkname][$thisindex]) && empty($RIFFchunk[$chunkname][$thisindex])) {
[1912] Fix | Delete
unset($RIFFchunk[$chunkname][$thisindex]);
[1913] Fix | Delete
}
[1914] Fix | Delete
if (count($RIFFchunk[$chunkname]) === 0) {
[1915] Fix | Delete
unset($RIFFchunk[$chunkname]);
[1916] Fix | Delete
}
[1917] Fix | Delete
$RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['data'] = $this->fread($chunksize);
[1918] Fix | Delete
} elseif ($chunksize < 2048) {
[1919] Fix | Delete
// only read data in if smaller than 2kB
[1920] Fix | Delete
$RIFFchunk[$chunkname][$thisindex]['data'] = $this->fread($chunksize);
[1921] Fix | Delete
} else {
[1922] Fix | Delete
$this->fseek($chunksize, SEEK_CUR);
[1923] Fix | Delete
}
[1924] Fix | Delete
break;
[1925] Fix | Delete
}
[1926] Fix | Delete
break;
[1927] Fix | Delete
}
[1928] Fix | Delete
}
[1929] Fix | Delete
[1930] Fix | Delete
} catch (getid3_exception $e) {
[1931] Fix | Delete
if ($e->getCode() == 10) {
[1932] Fix | Delete
$this->warning('RIFF parser: '.$e->getMessage());
[1933] Fix | Delete
} else {
[1934] Fix | Delete
throw $e;
[1935] Fix | Delete
}
[1936] Fix | Delete
}
[1937] Fix | Delete
[1938] Fix | Delete
return !empty($RIFFchunk) ? $RIFFchunk : false;
[1939] Fix | Delete
}
[1940] Fix | Delete
[1941] Fix | Delete
/**
[1942] Fix | Delete
* @param string $RIFFdata
[1943] Fix | Delete
*
[1944] Fix | Delete
* @return bool
[1945] Fix | Delete
*/
[1946] Fix | Delete
public function ParseRIFFdata(&$RIFFdata) {
[1947] Fix | Delete
$info = &$this->getid3->info;
[1948] Fix | Delete
if ($RIFFdata) {
[1949] Fix | Delete
$tempfile = tempnam(GETID3_TEMP_DIR, 'getID3');
[1950] Fix | Delete
$fp_temp = fopen($tempfile, 'wb');
[1951] Fix | Delete
$RIFFdataLength = strlen($RIFFdata);
[1952] Fix | Delete
$NewLengthString = getid3_lib::LittleEndian2String($RIFFdataLength, 4);
[1953] Fix | Delete
for ($i = 0; $i < 4; $i++) {
[1954] Fix | Delete
$RIFFdata[($i + 4)] = $NewLengthString[$i];
[1955] Fix | Delete
}
[1956] Fix | Delete
fwrite($fp_temp, $RIFFdata);
[1957] Fix | Delete
fclose($fp_temp);
[1958] Fix | Delete
[1959] Fix | Delete
$getid3_temp = new getID3();
[1960] Fix | Delete
$getid3_temp->openfile($tempfile);
[1961] Fix | Delete
$getid3_temp->info['filesize'] = $RIFFdataLength;
[1962] Fix | Delete
$getid3_temp->info['filenamepath'] = $info['filenamepath'];
[1963] Fix | Delete
$getid3_temp->info['tags'] = $info['tags'];
[1964] Fix | Delete
$getid3_temp->info['warning'] = $info['warning'];
[1965] Fix | Delete
$getid3_temp->info['error'] = $info['error'];
[1966] Fix | Delete
$getid3_temp->info['comments'] = $info['comments'];
[1967] Fix | Delete
$getid3_temp->info['audio'] = (isset($info['audio']) ? $info['audio'] : array());
[1968] Fix | Delete
$getid3_temp->info['video'] = (isset($info['video']) ? $info['video'] : array());
[1969] Fix | Delete
$getid3_riff = new getid3_riff($getid3_temp);
[1970] Fix | Delete
$getid3_riff->Analyze();
[1971] Fix | Delete
[1972] Fix | Delete
$info['riff'] = $getid3_temp->info['riff'];
[1973] Fix | Delete
$info['warning'] = $getid3_temp->info['warning'];
[1974] Fix | Delete
$info['error'] = $getid3_temp->info['error'];
[1975] Fix | Delete
$info['tags'] = $getid3_temp->info['tags'];
[1976] Fix | Delete
$info['comments'] = $getid3_temp->info['comments'];
[1977] Fix | Delete
unset($getid3_riff, $getid3_temp);
[1978] Fix | Delete
unlink($tempfile);
[1979] Fix | Delete
}
[1980] Fix | Delete
return false;
[1981] Fix | Delete
}
[1982] Fix | Delete
[1983] Fix | Delete
/**
[1984] Fix | Delete
* @param array $RIFFinfoArray
[1985] Fix | Delete
* @param array $CommentsTargetArray
[1986] Fix | Delete
*
[1987] Fix | Delete
* @return bool
[1988] Fix | Delete
*/
[1989] Fix | Delete
public static function parseComments(&$RIFFinfoArray, &$CommentsTargetArray) {
[1990] Fix | Delete
$RIFFinfoKeyLookup = array(
[1991] Fix | Delete
'IARL'=>'archivallocation',
[1992] Fix | Delete
'IART'=>'artist',
[1993] Fix | Delete
'ICDS'=>'costumedesigner',
[1994] Fix | Delete
'ICMS'=>'commissionedby',
[1995] Fix | Delete
'ICMT'=>'comment',
[1996] Fix | Delete
'ICNT'=>'country',
[1997] Fix | Delete
'ICOP'=>'copyright',
[1998] Fix | Delete
'ICRD'=>'creationdate',
[1999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function