@@ -118,6 +118,10 @@ discard block |
||
| 118 | 118 | return true; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | + /** |
|
| 122 | + * @param string $atomname |
|
| 123 | + * @param string $atom_data |
|
| 124 | + */ |
|
| 121 | 125 | public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { |
| 122 | 126 | // http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/INDEX/atomalphaindex.htm |
| 123 | 127 | |
@@ -1424,6 +1428,9 @@ discard block |
||
| 1424 | 1428 | return $atom_structure; |
| 1425 | 1429 | } |
| 1426 | 1430 | |
| 1431 | + /** |
|
| 1432 | + * @param integer $baseoffset |
|
| 1433 | + */ |
|
| 1427 | 1434 | public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { |
| 1428 | 1435 | //echo 'QuicktimeParseContainerAtom('.substr($atom_data, 4, 4).') @ '.$baseoffset.'<br><br>'; |
| 1429 | 1436 | $atom_structure = false; |
@@ -1452,6 +1459,9 @@ discard block |
||
| 1452 | 1459 | } |
| 1453 | 1460 | |
| 1454 | 1461 | |
| 1462 | + /** |
|
| 1463 | + * @param integer $offset |
|
| 1464 | + */ |
|
| 1455 | 1465 | public function quicktime_read_mp4_descr_length($data, &$offset) { |
| 1456 | 1466 | // http://libquicktime.sourcearchive.com/documentation/2:1.0.2plus-pdebian-2build1/esds_8c-source.html |
| 1457 | 1467 | $num_bytes = 0; |
@@ -2230,6 +2240,9 @@ discard block |
||
| 2230 | 2240 | return true; |
| 2231 | 2241 | } |
| 2232 | 2242 | |
| 2243 | + /** |
|
| 2244 | + * @param string $nullterminatedstring |
|
| 2245 | + */ |
|
| 2233 | 2246 | public function NoNullString($nullterminatedstring) { |
| 2234 | 2247 | // remove the single null terminator on null terminated strings |
| 2235 | 2248 | if (substr($nullterminatedstring, strlen($nullterminatedstring) - 1, 1) === "\x00") { |
@@ -2238,6 +2251,9 @@ discard block |
||
| 2238 | 2251 | return $nullterminatedstring; |
| 2239 | 2252 | } |
| 2240 | 2253 | |
| 2254 | + /** |
|
| 2255 | + * @param string $pascalstring |
|
| 2256 | + */ |
|
| 2241 | 2257 | public function Pascal2String($pascalstring) { |
| 2242 | 2258 | // Pascal strings have 1 unsigned byte at the beginning saying how many chars (1-255) are in the string |
| 2243 | 2259 | return substr($pascalstring, 1); |
@@ -1402,9 +1402,9 @@ discard block |
||
| 1402 | 1402 | // mdta keys \005 mdtacom.apple.quicktime.make (mdtacom.apple.quicktime.creationdate ,mdtacom.apple.quicktime.location.ISO6709 $mdtacom.apple.quicktime.software !mdtacom.apple.quicktime.model ilst \01D \001 \015data \001DE\010Apple 0 \002 (data \001DE\0102011-05-11T17:54:04+0200 2 \003 *data \001DE\010+52.4936+013.3897+040.247/ \01D \004 \015data \001DE\0104.3.1 \005 \018data \001DE\010iPhone 4 |
| 1403 | 1403 | // http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt |
| 1404 | 1404 | |
| 1405 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1406 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 1407 | - $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
|
| 1405 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1406 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 1407 | + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
|
| 1408 | 1408 | //$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
| 1409 | 1409 | break; |
| 1410 | 1410 | |
@@ -1753,56 +1753,56 @@ discard block |
||
| 1753 | 1753 | static $QuicktimeIODSaudioProfileNameLookup = array(); |
| 1754 | 1754 | if (empty($QuicktimeIODSaudioProfileNameLookup)) { |
| 1755 | 1755 | $QuicktimeIODSaudioProfileNameLookup = array( |
| 1756 | - 0x00 => 'ISO Reserved (0x00)', |
|
| 1757 | - 0x01 => 'Main Audio Profile @ Level 1', |
|
| 1758 | - 0x02 => 'Main Audio Profile @ Level 2', |
|
| 1759 | - 0x03 => 'Main Audio Profile @ Level 3', |
|
| 1760 | - 0x04 => 'Main Audio Profile @ Level 4', |
|
| 1761 | - 0x05 => 'Scalable Audio Profile @ Level 1', |
|
| 1762 | - 0x06 => 'Scalable Audio Profile @ Level 2', |
|
| 1763 | - 0x07 => 'Scalable Audio Profile @ Level 3', |
|
| 1764 | - 0x08 => 'Scalable Audio Profile @ Level 4', |
|
| 1765 | - 0x09 => 'Speech Audio Profile @ Level 1', |
|
| 1766 | - 0x0A => 'Speech Audio Profile @ Level 2', |
|
| 1767 | - 0x0B => 'Synthetic Audio Profile @ Level 1', |
|
| 1768 | - 0x0C => 'Synthetic Audio Profile @ Level 2', |
|
| 1769 | - 0x0D => 'Synthetic Audio Profile @ Level 3', |
|
| 1770 | - 0x0E => 'High Quality Audio Profile @ Level 1', |
|
| 1771 | - 0x0F => 'High Quality Audio Profile @ Level 2', |
|
| 1772 | - 0x10 => 'High Quality Audio Profile @ Level 3', |
|
| 1773 | - 0x11 => 'High Quality Audio Profile @ Level 4', |
|
| 1774 | - 0x12 => 'High Quality Audio Profile @ Level 5', |
|
| 1775 | - 0x13 => 'High Quality Audio Profile @ Level 6', |
|
| 1776 | - 0x14 => 'High Quality Audio Profile @ Level 7', |
|
| 1777 | - 0x15 => 'High Quality Audio Profile @ Level 8', |
|
| 1778 | - 0x16 => 'Low Delay Audio Profile @ Level 1', |
|
| 1779 | - 0x17 => 'Low Delay Audio Profile @ Level 2', |
|
| 1780 | - 0x18 => 'Low Delay Audio Profile @ Level 3', |
|
| 1781 | - 0x19 => 'Low Delay Audio Profile @ Level 4', |
|
| 1782 | - 0x1A => 'Low Delay Audio Profile @ Level 5', |
|
| 1783 | - 0x1B => 'Low Delay Audio Profile @ Level 6', |
|
| 1784 | - 0x1C => 'Low Delay Audio Profile @ Level 7', |
|
| 1785 | - 0x1D => 'Low Delay Audio Profile @ Level 8', |
|
| 1786 | - 0x1E => 'Natural Audio Profile @ Level 1', |
|
| 1787 | - 0x1F => 'Natural Audio Profile @ Level 2', |
|
| 1788 | - 0x20 => 'Natural Audio Profile @ Level 3', |
|
| 1789 | - 0x21 => 'Natural Audio Profile @ Level 4', |
|
| 1790 | - 0x22 => 'Mobile Audio Internetworking Profile @ Level 1', |
|
| 1791 | - 0x23 => 'Mobile Audio Internetworking Profile @ Level 2', |
|
| 1792 | - 0x24 => 'Mobile Audio Internetworking Profile @ Level 3', |
|
| 1793 | - 0x25 => 'Mobile Audio Internetworking Profile @ Level 4', |
|
| 1794 | - 0x26 => 'Mobile Audio Internetworking Profile @ Level 5', |
|
| 1795 | - 0x27 => 'Mobile Audio Internetworking Profile @ Level 6', |
|
| 1796 | - 0x28 => 'AAC Profile @ Level 1', |
|
| 1797 | - 0x29 => 'AAC Profile @ Level 2', |
|
| 1798 | - 0x2A => 'AAC Profile @ Level 4', |
|
| 1799 | - 0x2B => 'AAC Profile @ Level 5', |
|
| 1800 | - 0x2C => 'High Efficiency AAC Profile @ Level 2', |
|
| 1801 | - 0x2D => 'High Efficiency AAC Profile @ Level 3', |
|
| 1802 | - 0x2E => 'High Efficiency AAC Profile @ Level 4', |
|
| 1803 | - 0x2F => 'High Efficiency AAC Profile @ Level 5', |
|
| 1804 | - 0xFE => 'Not part of MPEG-4 audio profiles', |
|
| 1805 | - 0xFF => 'No audio capability required', |
|
| 1756 | + 0x00 => 'ISO Reserved (0x00)', |
|
| 1757 | + 0x01 => 'Main Audio Profile @ Level 1', |
|
| 1758 | + 0x02 => 'Main Audio Profile @ Level 2', |
|
| 1759 | + 0x03 => 'Main Audio Profile @ Level 3', |
|
| 1760 | + 0x04 => 'Main Audio Profile @ Level 4', |
|
| 1761 | + 0x05 => 'Scalable Audio Profile @ Level 1', |
|
| 1762 | + 0x06 => 'Scalable Audio Profile @ Level 2', |
|
| 1763 | + 0x07 => 'Scalable Audio Profile @ Level 3', |
|
| 1764 | + 0x08 => 'Scalable Audio Profile @ Level 4', |
|
| 1765 | + 0x09 => 'Speech Audio Profile @ Level 1', |
|
| 1766 | + 0x0A => 'Speech Audio Profile @ Level 2', |
|
| 1767 | + 0x0B => 'Synthetic Audio Profile @ Level 1', |
|
| 1768 | + 0x0C => 'Synthetic Audio Profile @ Level 2', |
|
| 1769 | + 0x0D => 'Synthetic Audio Profile @ Level 3', |
|
| 1770 | + 0x0E => 'High Quality Audio Profile @ Level 1', |
|
| 1771 | + 0x0F => 'High Quality Audio Profile @ Level 2', |
|
| 1772 | + 0x10 => 'High Quality Audio Profile @ Level 3', |
|
| 1773 | + 0x11 => 'High Quality Audio Profile @ Level 4', |
|
| 1774 | + 0x12 => 'High Quality Audio Profile @ Level 5', |
|
| 1775 | + 0x13 => 'High Quality Audio Profile @ Level 6', |
|
| 1776 | + 0x14 => 'High Quality Audio Profile @ Level 7', |
|
| 1777 | + 0x15 => 'High Quality Audio Profile @ Level 8', |
|
| 1778 | + 0x16 => 'Low Delay Audio Profile @ Level 1', |
|
| 1779 | + 0x17 => 'Low Delay Audio Profile @ Level 2', |
|
| 1780 | + 0x18 => 'Low Delay Audio Profile @ Level 3', |
|
| 1781 | + 0x19 => 'Low Delay Audio Profile @ Level 4', |
|
| 1782 | + 0x1A => 'Low Delay Audio Profile @ Level 5', |
|
| 1783 | + 0x1B => 'Low Delay Audio Profile @ Level 6', |
|
| 1784 | + 0x1C => 'Low Delay Audio Profile @ Level 7', |
|
| 1785 | + 0x1D => 'Low Delay Audio Profile @ Level 8', |
|
| 1786 | + 0x1E => 'Natural Audio Profile @ Level 1', |
|
| 1787 | + 0x1F => 'Natural Audio Profile @ Level 2', |
|
| 1788 | + 0x20 => 'Natural Audio Profile @ Level 3', |
|
| 1789 | + 0x21 => 'Natural Audio Profile @ Level 4', |
|
| 1790 | + 0x22 => 'Mobile Audio Internetworking Profile @ Level 1', |
|
| 1791 | + 0x23 => 'Mobile Audio Internetworking Profile @ Level 2', |
|
| 1792 | + 0x24 => 'Mobile Audio Internetworking Profile @ Level 3', |
|
| 1793 | + 0x25 => 'Mobile Audio Internetworking Profile @ Level 4', |
|
| 1794 | + 0x26 => 'Mobile Audio Internetworking Profile @ Level 5', |
|
| 1795 | + 0x27 => 'Mobile Audio Internetworking Profile @ Level 6', |
|
| 1796 | + 0x28 => 'AAC Profile @ Level 1', |
|
| 1797 | + 0x29 => 'AAC Profile @ Level 2', |
|
| 1798 | + 0x2A => 'AAC Profile @ Level 4', |
|
| 1799 | + 0x2B => 'AAC Profile @ Level 5', |
|
| 1800 | + 0x2C => 'High Efficiency AAC Profile @ Level 2', |
|
| 1801 | + 0x2D => 'High Efficiency AAC Profile @ Level 3', |
|
| 1802 | + 0x2E => 'High Efficiency AAC Profile @ Level 4', |
|
| 1803 | + 0x2F => 'High Efficiency AAC Profile @ Level 5', |
|
| 1804 | + 0xFE => 'Not part of MPEG-4 audio profiles', |
|
| 1805 | + 0xFF => 'No audio capability required', |
|
| 1806 | 1806 | ); |
| 1807 | 1807 | } |
| 1808 | 1808 | return (isset($QuicktimeIODSaudioProfileNameLookup[$audio_profile_id]) ? $QuicktimeIODSaudioProfileNameLookup[$audio_profile_id] : 'ISO Reserved / User Private'); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | $atomcounter = 0; |
| 38 | 38 | $atom_data_read_buffer_size = ($info['php_memory_limit'] ? round($info['php_memory_limit'] / 2) : $this->getid3->option_fread_buffer_size * 1024); // allow [default: 32MB] if PHP configured with no memory_limit |
| 39 | 39 | while ($offset < $info['avdataend']) { |
| 40 | - if (!getid3_lib::intValueSupported($offset)) { |
|
| 40 | + if ( ! getid3_lib::intValueSupported($offset)) { |
|
| 41 | 41 | $info['error'][] = 'Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions'; |
| 42 | 42 | break; |
| 43 | 43 | } |
@@ -74,20 +74,20 @@ discard block |
||
| 74 | 74 | $atomcounter++; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - if (!empty($info['avdataend_tmp'])) { |
|
| 77 | + if ( ! empty($info['avdataend_tmp'])) { |
|
| 78 | 78 | // this value is assigned to a temp value and then erased because |
| 79 | 79 | // otherwise any atoms beyond the 'mdat' atom would not get parsed |
| 80 | 80 | $info['avdataend'] = $info['avdataend_tmp']; |
| 81 | 81 | unset($info['avdataend_tmp']); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - if (!isset($info['bitrate']) && isset($info['playtime_seconds'])) { |
|
| 84 | + if ( ! isset($info['bitrate']) && isset($info['playtime_seconds'])) { |
|
| 85 | 85 | $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; |
| 86 | 86 | } |
| 87 | - if (isset($info['bitrate']) && !isset($info['audio']['bitrate']) && !isset($info['quicktime']['video'])) { |
|
| 87 | + if (isset($info['bitrate']) && ! isset($info['audio']['bitrate']) && ! isset($info['quicktime']['video'])) { |
|
| 88 | 88 | $info['audio']['bitrate'] = $info['bitrate']; |
| 89 | 89 | } |
| 90 | - if (!empty($info['playtime_seconds']) && !isset($info['video']['frame_rate']) && !empty($info['quicktime']['stts_framecount'])) { |
|
| 90 | + if ( ! empty($info['playtime_seconds']) && ! isset($info['video']['frame_rate']) && ! empty($info['quicktime']['stts_framecount'])) { |
|
| 91 | 91 | foreach ($info['quicktime']['stts_framecount'] as $key => $samples_count) { |
| 92 | 92 | $samples_per_second = $samples_count / $info['playtime_seconds']; |
| 93 | 93 | if ($samples_per_second > 240) { |
@@ -104,14 +104,14 @@ discard block |
||
| 104 | 104 | unset($info['video']['dataformat']); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | - if (!$this->ReturnAtomData) { |
|
| 107 | + if ( ! $this->ReturnAtomData) { |
|
| 108 | 108 | unset($info['quicktime']['moov']); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - if (empty($info['audio']['dataformat']) && !empty($info['quicktime']['audio'])) { |
|
| 111 | + if (empty($info['audio']['dataformat']) && ! empty($info['quicktime']['audio'])) { |
|
| 112 | 112 | $info['audio']['dataformat'] = 'quicktime'; |
| 113 | 113 | } |
| 114 | - if (empty($info['video']['dataformat']) && !empty($info['quicktime']['video'])) { |
|
| 114 | + if (empty($info['video']['dataformat']) && ! empty($info['quicktime']['video'])) { |
|
| 115 | 115 | $info['video']['dataformat'] = 'quicktime'; |
| 116 | 116 | } |
| 117 | 117 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | // some "ilst" atoms contain data atoms that have a numeric name, and the data is far more accessible if the returned array is compacted |
| 153 | 153 | $allnumericnames = true; |
| 154 | 154 | foreach ($atom_structure['subatoms'] as $subatomarray) { |
| 155 | - if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) { |
|
| 155 | + if ( ! is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) { |
|
| 156 | 156 | $allnumericnames = false; |
| 157 | 157 | break; |
| 158 | 158 | } |
@@ -301,10 +301,10 @@ discard block |
||
| 301 | 301 | // User data atom handler |
| 302 | 302 | $atom_structure['data_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); |
| 303 | 303 | $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); |
| 304 | - $atom_structure['data'] = substr($atom_data, 4); |
|
| 304 | + $atom_structure['data'] = substr($atom_data, 4); |
|
| 305 | 305 | |
| 306 | 306 | $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); |
| 307 | - if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { |
|
| 307 | + if (empty($info['comments']['language']) || ( ! in_array($atom_structure['language'], $info['comments']['language']))) { |
|
| 308 | 308 | $info['comments']['language'][] = $atom_structure['language']; |
| 309 | 309 | } |
| 310 | 310 | } else { |
@@ -314,9 +314,9 @@ discard block |
||
| 314 | 314 | // not sure what it means, but observed on iPhone4 data. |
| 315 | 315 | // Each $atom_data has 2 bytes of datasize, plus 0x10B5, then data |
| 316 | 316 | while ($atomoffset < strlen($atom_data)) { |
| 317 | - $boxsmallsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 2)); |
|
| 318 | - $boxsmalltype = substr($atom_data, $atomoffset + 2, 2); |
|
| 319 | - $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize); |
|
| 317 | + $boxsmallsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 2)); |
|
| 318 | + $boxsmalltype = substr($atom_data, $atomoffset + 2, 2); |
|
| 319 | + $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize); |
|
| 320 | 320 | if ($boxsmallsize <= 1) { |
| 321 | 321 | $info['warning'][] = 'Invalid QuickTime atom smallbox size "'.$boxsmallsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset); |
| 322 | 322 | $atom_structure['data'] = null; |
@@ -337,8 +337,8 @@ discard block |
||
| 337 | 337 | } else { |
| 338 | 338 | while ($atomoffset < strlen($atom_data)) { |
| 339 | 339 | $boxsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 4)); |
| 340 | - $boxtype = substr($atom_data, $atomoffset + 4, 4); |
|
| 341 | - $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8); |
|
| 340 | + $boxtype = substr($atom_data, $atomoffset + 4, 4); |
|
| 341 | + $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8); |
|
| 342 | 342 | if ($boxsize <= 1) { |
| 343 | 343 | $info['warning'][] = 'Invalid QuickTime atom box size "'.$boxsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset); |
| 344 | 344 | $atom_structure['data'] = null; |
@@ -354,8 +354,8 @@ discard block |
||
| 354 | 354 | break; |
| 355 | 355 | |
| 356 | 356 | case 'data': |
| 357 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1)); |
|
| 358 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3)); |
|
| 357 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1)); |
|
| 358 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3)); |
|
| 359 | 359 | switch ($atom_structure['flags_raw']) { |
| 360 | 360 | case 0: // data flag |
| 361 | 361 | case 21: // tmpo/cpil flag |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | |
| 381 | 381 | case 'gnre': |
| 382 | 382 | $GenreID = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); |
| 383 | - $atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1); |
|
| 383 | + $atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1); |
|
| 384 | 384 | break; |
| 385 | 385 | |
| 386 | 386 | case 'rtng': |
@@ -440,15 +440,15 @@ discard block |
||
| 440 | 440 | |
| 441 | 441 | |
| 442 | 442 | case 'play': // auto-PLAY atom |
| 443 | - $atom_structure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 443 | + $atom_structure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 444 | 444 | |
| 445 | 445 | $info['quicktime']['autoplay'] = $atom_structure['autoplay']; |
| 446 | 446 | break; |
| 447 | 447 | |
| 448 | 448 | |
| 449 | 449 | case 'WLOC': // Window LOCation atom |
| 450 | - $atom_structure['location_x'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); |
|
| 451 | - $atom_structure['location_y'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); |
|
| 450 | + $atom_structure['location_x'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); |
|
| 451 | + $atom_structure['location_y'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); |
|
| 452 | 452 | break; |
| 453 | 453 | |
| 454 | 454 | |
@@ -488,27 +488,27 @@ discard block |
||
| 488 | 488 | |
| 489 | 489 | |
| 490 | 490 | case 'rdrf': // Reference movie Data ReFerence atom |
| 491 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 492 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 491 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 492 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 493 | 493 | $atom_structure['flags']['internal_data'] = (bool) ($atom_structure['flags_raw'] & 0x000001); |
| 494 | 494 | |
| 495 | - $atom_structure['reference_type_name'] = substr($atom_data, 4, 4); |
|
| 496 | - $atom_structure['reference_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 495 | + $atom_structure['reference_type_name'] = substr($atom_data, 4, 4); |
|
| 496 | + $atom_structure['reference_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 497 | 497 | switch ($atom_structure['reference_type_name']) { |
| 498 | 498 | case 'url ': |
| 499 | - $atom_structure['url'] = $this->NoNullString(substr($atom_data, 12)); |
|
| 499 | + $atom_structure['url'] = $this->NoNullString(substr($atom_data, 12)); |
|
| 500 | 500 | break; |
| 501 | 501 | |
| 502 | 502 | case 'alis': |
| 503 | - $atom_structure['file_alias'] = substr($atom_data, 12); |
|
| 503 | + $atom_structure['file_alias'] = substr($atom_data, 12); |
|
| 504 | 504 | break; |
| 505 | 505 | |
| 506 | 506 | case 'rsrc': |
| 507 | - $atom_structure['resource_alias'] = substr($atom_data, 12); |
|
| 507 | + $atom_structure['resource_alias'] = substr($atom_data, 12); |
|
| 508 | 508 | break; |
| 509 | 509 | |
| 510 | 510 | default: |
| 511 | - $atom_structure['data'] = substr($atom_data, 12); |
|
| 511 | + $atom_structure['data'] = substr($atom_data, 12); |
|
| 512 | 512 | break; |
| 513 | 513 | } |
| 514 | 514 | break; |
@@ -520,28 +520,28 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | |
| 522 | 522 | case 'rmcs': // Reference Movie Cpu Speed atom |
| 523 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 524 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 525 | - $atom_structure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 523 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 524 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 525 | + $atom_structure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 526 | 526 | break; |
| 527 | 527 | |
| 528 | 528 | |
| 529 | 529 | case 'rmvc': // Reference Movie Version Check atom |
| 530 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 531 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 532 | - $atom_structure['gestalt_selector'] = substr($atom_data, 4, 4); |
|
| 533 | - $atom_structure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 530 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 531 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 532 | + $atom_structure['gestalt_selector'] = substr($atom_data, 4, 4); |
|
| 533 | + $atom_structure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 534 | 534 | $atom_structure['gestalt_value'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
| 535 | 535 | $atom_structure['gestalt_check_type'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2)); |
| 536 | 536 | break; |
| 537 | 537 | |
| 538 | 538 | |
| 539 | 539 | case 'rmcd': // Reference Movie Component check atom |
| 540 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 541 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 542 | - $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
| 543 | - $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
| 544 | - $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
| 540 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 541 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 542 | + $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
| 543 | + $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
| 544 | + $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
| 545 | 545 | $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
| 546 | 546 | $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
| 547 | 547 | $atom_structure['component_min_version'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 4)); |
@@ -549,30 +549,30 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | |
| 551 | 551 | case 'rmdr': // Reference Movie Data Rate atom |
| 552 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 553 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 554 | - $atom_structure['data_rate'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 552 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 553 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 554 | + $atom_structure['data_rate'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 555 | 555 | |
| 556 | 556 | $atom_structure['data_rate_bps'] = $atom_structure['data_rate'] * 10; |
| 557 | 557 | break; |
| 558 | 558 | |
| 559 | 559 | |
| 560 | 560 | case 'rmla': // Reference Movie Language Atom |
| 561 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 562 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 563 | - $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 561 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 562 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 563 | + $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 564 | 564 | |
| 565 | 565 | $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); |
| 566 | - if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { |
|
| 566 | + if (empty($info['comments']['language']) || ( ! in_array($atom_structure['language'], $info['comments']['language']))) { |
|
| 567 | 567 | $info['comments']['language'][] = $atom_structure['language']; |
| 568 | 568 | } |
| 569 | 569 | break; |
| 570 | 570 | |
| 571 | 571 | |
| 572 | 572 | case 'rmla': // Reference Movie Language Atom |
| 573 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 574 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 575 | - $atom_structure['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 573 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 574 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 575 | + $atom_structure['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 576 | 576 | break; |
| 577 | 577 | |
| 578 | 578 | |
@@ -601,49 +601,49 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | |
| 603 | 603 | case 'stsd': // Sample Table Sample Description atom |
| 604 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 605 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 606 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 604 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 605 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 606 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 607 | 607 | $stsdEntriesDataOffset = 8; |
| 608 | 608 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
| 609 | 609 | $atom_structure['sample_description_table'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 4)); |
| 610 | 610 | $stsdEntriesDataOffset += 4; |
| 611 | - $atom_structure['sample_description_table'][$i]['data_format'] = substr($atom_data, $stsdEntriesDataOffset, 4); |
|
| 611 | + $atom_structure['sample_description_table'][$i]['data_format'] = substr($atom_data, $stsdEntriesDataOffset, 4); |
|
| 612 | 612 | $stsdEntriesDataOffset += 4; |
| 613 | 613 | $atom_structure['sample_description_table'][$i]['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 6)); |
| 614 | 614 | $stsdEntriesDataOffset += 6; |
| 615 | 615 | $atom_structure['sample_description_table'][$i]['reference_index'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 2)); |
| 616 | 616 | $stsdEntriesDataOffset += 2; |
| 617 | - $atom_structure['sample_description_table'][$i]['data'] = substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2)); |
|
| 617 | + $atom_structure['sample_description_table'][$i]['data'] = substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2)); |
|
| 618 | 618 | $stsdEntriesDataOffset += ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2); |
| 619 | 619 | |
| 620 | - $atom_structure['sample_description_table'][$i]['encoder_version'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 0, 2)); |
|
| 621 | - $atom_structure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 2, 2)); |
|
| 622 | - $atom_structure['sample_description_table'][$i]['encoder_vendor'] = substr($atom_structure['sample_description_table'][$i]['data'], 4, 4); |
|
| 620 | + $atom_structure['sample_description_table'][$i]['encoder_version'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 0, 2)); |
|
| 621 | + $atom_structure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 2, 2)); |
|
| 622 | + $atom_structure['sample_description_table'][$i]['encoder_vendor'] = substr($atom_structure['sample_description_table'][$i]['data'], 4, 4); |
|
| 623 | 623 | |
| 624 | 624 | switch ($atom_structure['sample_description_table'][$i]['encoder_vendor']) { |
| 625 | 625 | |
| 626 | 626 | case "\x00\x00\x00\x00": |
| 627 | 627 | // audio tracks |
| 628 | - $atom_structure['sample_description_table'][$i]['audio_channels'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 2)); |
|
| 629 | - $atom_structure['sample_description_table'][$i]['audio_bit_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 10, 2)); |
|
| 630 | - $atom_structure['sample_description_table'][$i]['audio_compression_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 2)); |
|
| 631 | - $atom_structure['sample_description_table'][$i]['audio_packet_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 14, 2)); |
|
| 632 | - $atom_structure['sample_description_table'][$i]['audio_sample_rate'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 16, 4)); |
|
| 628 | + $atom_structure['sample_description_table'][$i]['audio_channels'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 2)); |
|
| 629 | + $atom_structure['sample_description_table'][$i]['audio_bit_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 10, 2)); |
|
| 630 | + $atom_structure['sample_description_table'][$i]['audio_compression_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 2)); |
|
| 631 | + $atom_structure['sample_description_table'][$i]['audio_packet_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 14, 2)); |
|
| 632 | + $atom_structure['sample_description_table'][$i]['audio_sample_rate'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 16, 4)); |
|
| 633 | 633 | |
| 634 | 634 | // video tracks |
| 635 | 635 | // http://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap3/qtff3.html |
| 636 | - $atom_structure['sample_description_table'][$i]['temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
| 637 | - $atom_structure['sample_description_table'][$i]['spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
| 638 | - $atom_structure['sample_description_table'][$i]['width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
| 639 | - $atom_structure['sample_description_table'][$i]['height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
| 640 | - $atom_structure['sample_description_table'][$i]['resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
| 641 | - $atom_structure['sample_description_table'][$i]['resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
| 642 | - $atom_structure['sample_description_table'][$i]['data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 4)); |
|
| 643 | - $atom_structure['sample_description_table'][$i]['frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 36, 2)); |
|
| 644 | - $atom_structure['sample_description_table'][$i]['compressor_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 38, 4); |
|
| 645 | - $atom_structure['sample_description_table'][$i]['pixel_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 42, 2)); |
|
| 646 | - $atom_structure['sample_description_table'][$i]['color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 44, 2)); |
|
| 636 | + $atom_structure['sample_description_table'][$i]['temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
| 637 | + $atom_structure['sample_description_table'][$i]['spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
| 638 | + $atom_structure['sample_description_table'][$i]['width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
| 639 | + $atom_structure['sample_description_table'][$i]['height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
| 640 | + $atom_structure['sample_description_table'][$i]['resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
| 641 | + $atom_structure['sample_description_table'][$i]['resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
| 642 | + $atom_structure['sample_description_table'][$i]['data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 4)); |
|
| 643 | + $atom_structure['sample_description_table'][$i]['frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 36, 2)); |
|
| 644 | + $atom_structure['sample_description_table'][$i]['compressor_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 38, 4); |
|
| 645 | + $atom_structure['sample_description_table'][$i]['pixel_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 42, 2)); |
|
| 646 | + $atom_structure['sample_description_table'][$i]['color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 44, 2)); |
|
| 647 | 647 | |
| 648 | 648 | switch ($atom_structure['sample_description_table'][$i]['data_format']) { |
| 649 | 649 | case '2vuY': |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | $info['video']['fourcc'] = $atom_structure['sample_description_table'][$i]['data_format']; |
| 677 | 677 | // http://www.getid3.org/phpBB3/viewtopic.php?t=1550 |
| 678 | 678 | //if ((!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($atom_structure['sample_description_table'][$i]['width'])) && (empty($info['video']['resolution_x']) || empty($info['video']['resolution_y']) || (number_format($info['video']['resolution_x'], 6) != number_format(round($info['video']['resolution_x']), 6)) || (number_format($info['video']['resolution_y'], 6) != number_format(round($info['video']['resolution_y']), 6)))) { // ugly check for floating point numbers |
| 679 | -if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($atom_structure['sample_description_table'][$i]['height'])) { |
|
| 679 | +if ( ! empty($atom_structure['sample_description_table'][$i]['width']) && ! empty($atom_structure['sample_description_table'][$i]['height'])) { |
|
| 680 | 680 | // assume that values stored here are more important than values stored in [tkhd] atom |
| 681 | 681 | $info['video']['resolution_x'] = $atom_structure['sample_description_table'][$i]['width']; |
| 682 | 682 | $info['video']['resolution_y'] = $atom_structure['sample_description_table'][$i]['height']; |
@@ -720,18 +720,18 @@ discard block |
||
| 720 | 720 | |
| 721 | 721 | default: |
| 722 | 722 | // video atom |
| 723 | - $atom_structure['sample_description_table'][$i]['video_temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
| 724 | - $atom_structure['sample_description_table'][$i]['video_spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
| 725 | - $atom_structure['sample_description_table'][$i]['video_frame_width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
| 726 | - $atom_structure['sample_description_table'][$i]['video_frame_height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
| 727 | - $atom_structure['sample_description_table'][$i]['video_resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 20, 4)); |
|
| 728 | - $atom_structure['sample_description_table'][$i]['video_resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
| 729 | - $atom_structure['sample_description_table'][$i]['video_data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
| 730 | - $atom_structure['sample_description_table'][$i]['video_frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 2)); |
|
| 731 | - $atom_structure['sample_description_table'][$i]['video_encoder_name_len'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 34, 1)); |
|
| 732 | - $atom_structure['sample_description_table'][$i]['video_encoder_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 35, $atom_structure['sample_description_table'][$i]['video_encoder_name_len']); |
|
| 733 | - $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 66, 2)); |
|
| 734 | - $atom_structure['sample_description_table'][$i]['video_color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 68, 2)); |
|
| 723 | + $atom_structure['sample_description_table'][$i]['video_temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
| 724 | + $atom_structure['sample_description_table'][$i]['video_spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
| 725 | + $atom_structure['sample_description_table'][$i]['video_frame_width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
| 726 | + $atom_structure['sample_description_table'][$i]['video_frame_height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
| 727 | + $atom_structure['sample_description_table'][$i]['video_resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 20, 4)); |
|
| 728 | + $atom_structure['sample_description_table'][$i]['video_resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
| 729 | + $atom_structure['sample_description_table'][$i]['video_data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
| 730 | + $atom_structure['sample_description_table'][$i]['video_frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 2)); |
|
| 731 | + $atom_structure['sample_description_table'][$i]['video_encoder_name_len'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 34, 1)); |
|
| 732 | + $atom_structure['sample_description_table'][$i]['video_encoder_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 35, $atom_structure['sample_description_table'][$i]['video_encoder_name_len']); |
|
| 733 | + $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 66, 2)); |
|
| 734 | + $atom_structure['sample_description_table'][$i]['video_color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 68, 2)); |
|
| 735 | 735 | |
| 736 | 736 | $atom_structure['sample_description_table'][$i]['video_pixel_color_type'] = (($atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] > 32) ? 'grayscale' : 'color'); |
| 737 | 737 | $atom_structure['sample_description_table'][$i]['video_pixel_color_name'] = $this->QuicktimeColorNameLookup($atom_structure['sample_description_table'][$i]['video_pixel_color_depth']); |
@@ -792,9 +792,9 @@ discard block |
||
| 792 | 792 | |
| 793 | 793 | |
| 794 | 794 | case 'stts': // Sample Table Time-to-Sample atom |
| 795 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 796 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 797 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 795 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 796 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 797 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 798 | 798 | $sttsEntriesDataOffset = 8; |
| 799 | 799 | //$FrameRateCalculatorArray = array(); |
| 800 | 800 | $frames_count = 0; |
@@ -845,9 +845,9 @@ discard block |
||
| 845 | 845 | |
| 846 | 846 | case 'stss': // Sample Table Sync Sample (key frames) atom |
| 847 | 847 | if ($ParseAllPossibleAtoms) { |
| 848 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 849 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 850 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 848 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 849 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 850 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 851 | 851 | $stssEntriesDataOffset = 8; |
| 852 | 852 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
| 853 | 853 | $atom_structure['time_to_sample_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stssEntriesDataOffset, 4)); |
@@ -859,9 +859,9 @@ discard block |
||
| 859 | 859 | |
| 860 | 860 | case 'stsc': // Sample Table Sample-to-Chunk atom |
| 861 | 861 | if ($ParseAllPossibleAtoms) { |
| 862 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 863 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 864 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 862 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 863 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 864 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 865 | 865 | $stscEntriesDataOffset = 8; |
| 866 | 866 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
| 867 | 867 | $atom_structure['sample_to_chunk_table'][$i]['first_chunk'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4)); |
@@ -877,10 +877,10 @@ discard block |
||
| 877 | 877 | |
| 878 | 878 | case 'stsz': // Sample Table SiZe atom |
| 879 | 879 | if ($ParseAllPossibleAtoms) { |
| 880 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 881 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 882 | - $atom_structure['sample_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 883 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 880 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 881 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 882 | + $atom_structure['sample_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 883 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 884 | 884 | $stszEntriesDataOffset = 12; |
| 885 | 885 | if ($atom_structure['sample_size'] == 0) { |
| 886 | 886 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
@@ -894,9 +894,9 @@ discard block |
||
| 894 | 894 | |
| 895 | 895 | case 'stco': // Sample Table Chunk Offset atom |
| 896 | 896 | if ($ParseAllPossibleAtoms) { |
| 897 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 898 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 899 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 897 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 898 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 899 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 900 | 900 | $stcoEntriesDataOffset = 8; |
| 901 | 901 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
| 902 | 902 | $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 4)); |
@@ -908,9 +908,9 @@ discard block |
||
| 908 | 908 | |
| 909 | 909 | case 'co64': // Chunk Offset 64-bit (version of "stco" that supports > 2GB files) |
| 910 | 910 | if ($ParseAllPossibleAtoms) { |
| 911 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 912 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 913 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 911 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 912 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 913 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 914 | 914 | $stcoEntriesDataOffset = 8; |
| 915 | 915 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
| 916 | 916 | $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 8)); |
@@ -921,20 +921,20 @@ discard block |
||
| 921 | 921 | |
| 922 | 922 | |
| 923 | 923 | case 'dref': // Data REFerence atom |
| 924 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 925 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 926 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 924 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 925 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 926 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 927 | 927 | $drefDataOffset = 8; |
| 928 | 928 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
| 929 | 929 | $atom_structure['data_references'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 4)); |
| 930 | 930 | $drefDataOffset += 4; |
| 931 | - $atom_structure['data_references'][$i]['type'] = substr($atom_data, $drefDataOffset, 4); |
|
| 931 | + $atom_structure['data_references'][$i]['type'] = substr($atom_data, $drefDataOffset, 4); |
|
| 932 | 932 | $drefDataOffset += 4; |
| 933 | - $atom_structure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 1)); |
|
| 933 | + $atom_structure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 1)); |
|
| 934 | 934 | $drefDataOffset += 1; |
| 935 | - $atom_structure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 3)); // hardcoded: 0x0000 |
|
| 935 | + $atom_structure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 3)); // hardcoded: 0x0000 |
|
| 936 | 936 | $drefDataOffset += 3; |
| 937 | - $atom_structure['data_references'][$i]['data'] = substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); |
|
| 937 | + $atom_structure['data_references'][$i]['data'] = substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); |
|
| 938 | 938 | $drefDataOffset += ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3); |
| 939 | 939 | |
| 940 | 940 | $atom_structure['data_references'][$i]['flags']['self_reference'] = (bool) ($atom_structure['data_references'][$i]['flags_raw'] & 0x001); |
@@ -943,11 +943,11 @@ discard block |
||
| 943 | 943 | |
| 944 | 944 | |
| 945 | 945 | case 'gmin': // base Media INformation atom |
| 946 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 947 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 948 | - $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 949 | - $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
| 950 | - $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
| 946 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 947 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 948 | + $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 949 | + $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
| 950 | + $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
| 951 | 951 | $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); |
| 952 | 952 | $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 2)); |
| 953 | 953 | $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2)); |
@@ -955,19 +955,19 @@ discard block |
||
| 955 | 955 | |
| 956 | 956 | |
| 957 | 957 | case 'smhd': // Sound Media information HeaDer atom |
| 958 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 959 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 960 | - $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 961 | - $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
| 958 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 959 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 960 | + $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 961 | + $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
| 962 | 962 | break; |
| 963 | 963 | |
| 964 | 964 | |
| 965 | 965 | case 'vmhd': // Video Media information HeaDer atom |
| 966 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 967 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 968 | - $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 969 | - $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
| 970 | - $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
| 966 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 967 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 968 | + $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
| 969 | + $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
| 970 | + $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
| 971 | 971 | $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); |
| 972 | 972 | |
| 973 | 973 | $atom_structure['flags']['no_lean_ahead'] = (bool) ($atom_structure['flags_raw'] & 0x001); |
@@ -975,14 +975,14 @@ discard block |
||
| 975 | 975 | |
| 976 | 976 | |
| 977 | 977 | case 'hdlr': // HanDLeR reference atom |
| 978 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 979 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 980 | - $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
| 981 | - $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
| 982 | - $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
| 978 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 979 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 980 | + $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
| 981 | + $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
| 982 | + $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
| 983 | 983 | $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
| 984 | 984 | $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
| 985 | - $atom_structure['component_name'] = $this->Pascal2String(substr($atom_data, 24)); |
|
| 985 | + $atom_structure['component_name'] = $this->Pascal2String(substr($atom_data, 24)); |
|
| 986 | 986 | |
| 987 | 987 | if (($atom_structure['component_subtype'] == 'STpn') && ($atom_structure['component_manufacturer'] == 'zzzz')) { |
| 988 | 988 | $info['video']['dataformat'] = 'quicktimevr'; |
@@ -991,10 +991,10 @@ discard block |
||
| 991 | 991 | |
| 992 | 992 | |
| 993 | 993 | case 'mdhd': // MeDia HeaDer atom |
| 994 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 995 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 996 | - $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 997 | - $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 994 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 995 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 996 | + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 997 | + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 998 | 998 | $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
| 999 | 999 | $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
| 1000 | 1000 | $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 2)); |
@@ -1010,16 +1010,16 @@ discard block |
||
| 1010 | 1010 | $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); |
| 1011 | 1011 | $atom_structure['playtime_seconds'] = $atom_structure['duration'] / $atom_structure['time_scale']; |
| 1012 | 1012 | $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); |
| 1013 | - if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { |
|
| 1013 | + if (empty($info['comments']['language']) || ( ! in_array($atom_structure['language'], $info['comments']['language']))) { |
|
| 1014 | 1014 | $info['comments']['language'][] = $atom_structure['language']; |
| 1015 | 1015 | } |
| 1016 | 1016 | break; |
| 1017 | 1017 | |
| 1018 | 1018 | |
| 1019 | 1019 | case 'pnot': // Preview atom |
| 1020 | - $atom_structure['modification_date'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // "standard Macintosh format" |
|
| 1021 | - $atom_structure['version_number'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x00 |
|
| 1022 | - $atom_structure['atom_type'] = substr($atom_data, 6, 4); // usually: 'PICT' |
|
| 1020 | + $atom_structure['modification_date'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // "standard Macintosh format" |
|
| 1021 | + $atom_structure['version_number'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x00 |
|
| 1022 | + $atom_structure['atom_type'] = substr($atom_data, 6, 4); // usually: 'PICT' |
|
| 1023 | 1023 | $atom_structure['atom_index'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); // usually: 0x01 |
| 1024 | 1024 | |
| 1025 | 1025 | $atom_structure['modification_date_unix'] = getid3_lib::DateMac2Unix($atom_structure['modification_date']); |
@@ -1027,16 +1027,16 @@ discard block |
||
| 1027 | 1027 | |
| 1028 | 1028 | |
| 1029 | 1029 | case 'crgn': // Clipping ReGioN atom |
| 1030 | - $atom_structure['region_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); // The Region size, Region boundary box, |
|
| 1031 | - $atom_structure['boundary_box'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 8)); // and Clipping region data fields |
|
| 1032 | - $atom_structure['clipping_data'] = substr($atom_data, 10); // constitute a QuickDraw region. |
|
| 1030 | + $atom_structure['region_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); // The Region size, Region boundary box, |
|
| 1031 | + $atom_structure['boundary_box'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 8)); // and Clipping region data fields |
|
| 1032 | + $atom_structure['clipping_data'] = substr($atom_data, 10); // constitute a QuickDraw region. |
|
| 1033 | 1033 | break; |
| 1034 | 1034 | |
| 1035 | 1035 | |
| 1036 | 1036 | case 'load': // track LOAD settings atom |
| 1037 | - $atom_structure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
| 1038 | - $atom_structure['preload_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 1039 | - $atom_structure['preload_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 1037 | + $atom_structure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
| 1038 | + $atom_structure['preload_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 1039 | + $atom_structure['preload_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 1040 | 1040 | $atom_structure['default_hints_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
| 1041 | 1041 | |
| 1042 | 1042 | $atom_structure['default_hints']['double_buffer'] = (bool) ($atom_structure['default_hints_raw'] & 0x0020); |
@@ -1056,28 +1056,28 @@ discard block |
||
| 1056 | 1056 | |
| 1057 | 1057 | |
| 1058 | 1058 | case 'elst': // Edit LiST atom |
| 1059 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1060 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 1061 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 1062 | - for ($i = 0; $i < $atom_structure['number_entries']; $i++ ) { |
|
| 1063 | - $atom_structure['edit_list'][$i]['track_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4)); |
|
| 1064 | - $atom_structure['edit_list'][$i]['media_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4)); |
|
| 1059 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1060 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 1061 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 1062 | + for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
|
| 1063 | + $atom_structure['edit_list'][$i]['track_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4)); |
|
| 1064 | + $atom_structure['edit_list'][$i]['media_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4)); |
|
| 1065 | 1065 | $atom_structure['edit_list'][$i]['media_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 8 + ($i * 12) + 8, 4)); |
| 1066 | 1066 | } |
| 1067 | 1067 | break; |
| 1068 | 1068 | |
| 1069 | 1069 | |
| 1070 | 1070 | case 'kmat': // compressed MATte atom |
| 1071 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1072 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 1073 | - $atom_structure['matte_data_raw'] = substr($atom_data, 4); |
|
| 1071 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1072 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
| 1073 | + $atom_structure['matte_data_raw'] = substr($atom_data, 4); |
|
| 1074 | 1074 | break; |
| 1075 | 1075 | |
| 1076 | 1076 | |
| 1077 | 1077 | case 'ctab': // Color TABle atom |
| 1078 | - $atom_structure['color_table_seed'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // hardcoded: 0x00000000 |
|
| 1079 | - $atom_structure['color_table_flags'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x8000 |
|
| 1080 | - $atom_structure['color_table_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)) + 1; |
|
| 1078 | + $atom_structure['color_table_seed'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // hardcoded: 0x00000000 |
|
| 1079 | + $atom_structure['color_table_flags'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x8000 |
|
| 1080 | + $atom_structure['color_table_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)) + 1; |
|
| 1081 | 1081 | for ($colortableentry = 0; $colortableentry < $atom_structure['color_table_size']; $colortableentry++) { |
| 1082 | 1082 | $atom_structure['color_table'][$colortableentry]['alpha'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 0, 2)); |
| 1083 | 1083 | $atom_structure['color_table'][$colortableentry]['red'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 2, 2)); |
@@ -1088,31 +1088,31 @@ discard block |
||
| 1088 | 1088 | |
| 1089 | 1089 | |
| 1090 | 1090 | case 'mvhd': // MoVie HeaDer atom |
| 1091 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1092 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 1093 | - $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 1094 | - $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 1095 | - $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
| 1096 | - $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
| 1091 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1092 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 1093 | + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 1094 | + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 1095 | + $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
| 1096 | + $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
| 1097 | 1097 | $atom_structure['preferred_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 20, 4)); |
| 1098 | - $atom_structure['preferred_volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 24, 2)); |
|
| 1099 | - $atom_structure['reserved'] = substr($atom_data, 26, 10); |
|
| 1098 | + $atom_structure['preferred_volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 24, 2)); |
|
| 1099 | + $atom_structure['reserved'] = substr($atom_data, 26, 10); |
|
| 1100 | 1100 | $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 36, 4)); |
| 1101 | 1101 | $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4)); |
| 1102 | - $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 44, 4)); |
|
| 1102 | + $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 44, 4)); |
|
| 1103 | 1103 | $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 48, 4)); |
| 1104 | 1104 | $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4)); |
| 1105 | - $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 56, 4)); |
|
| 1105 | + $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 56, 4)); |
|
| 1106 | 1106 | $atom_structure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atom_data, 60, 4)); |
| 1107 | 1107 | $atom_structure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4)); |
| 1108 | - $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4)); |
|
| 1109 | - $atom_structure['preview_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 72, 4)); |
|
| 1110 | - $atom_structure['preview_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 76, 4)); |
|
| 1111 | - $atom_structure['poster_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 80, 4)); |
|
| 1112 | - $atom_structure['selection_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 84, 4)); |
|
| 1113 | - $atom_structure['selection_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 88, 4)); |
|
| 1114 | - $atom_structure['current_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 92, 4)); |
|
| 1115 | - $atom_structure['next_track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 96, 4)); |
|
| 1108 | + $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4)); |
|
| 1109 | + $atom_structure['preview_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 72, 4)); |
|
| 1110 | + $atom_structure['preview_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 76, 4)); |
|
| 1111 | + $atom_structure['poster_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 80, 4)); |
|
| 1112 | + $atom_structure['selection_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 84, 4)); |
|
| 1113 | + $atom_structure['selection_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 88, 4)); |
|
| 1114 | + $atom_structure['current_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 92, 4)); |
|
| 1115 | + $atom_structure['next_track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 96, 4)); |
|
| 1116 | 1116 | |
| 1117 | 1117 | if ($atom_structure['time_scale'] == 0) { |
| 1118 | 1118 | $info['error'][] = 'Corrupt Quicktime file: mvhd.time_scale == zero'; |
@@ -1127,29 +1127,29 @@ discard block |
||
| 1127 | 1127 | |
| 1128 | 1128 | |
| 1129 | 1129 | case 'tkhd': // TracK HeaDer atom |
| 1130 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1131 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 1132 | - $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 1133 | - $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 1134 | - $atom_structure['trackid'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
| 1135 | - $atom_structure['reserved1'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
| 1136 | - $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
|
| 1137 | - $atom_structure['reserved2'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 8)); |
|
| 1138 | - $atom_structure['layer'] = getid3_lib::BigEndian2Int(substr($atom_data, 32, 2)); |
|
| 1139 | - $atom_structure['alternate_group'] = getid3_lib::BigEndian2Int(substr($atom_data, 34, 2)); |
|
| 1140 | - $atom_structure['volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 36, 2)); |
|
| 1141 | - $atom_structure['reserved3'] = getid3_lib::BigEndian2Int(substr($atom_data, 38, 2)); |
|
| 1130 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1131 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 1132 | + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 1133 | + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
| 1134 | + $atom_structure['trackid'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
| 1135 | + $atom_structure['reserved1'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
| 1136 | + $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
|
| 1137 | + $atom_structure['reserved2'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 8)); |
|
| 1138 | + $atom_structure['layer'] = getid3_lib::BigEndian2Int(substr($atom_data, 32, 2)); |
|
| 1139 | + $atom_structure['alternate_group'] = getid3_lib::BigEndian2Int(substr($atom_data, 34, 2)); |
|
| 1140 | + $atom_structure['volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 36, 2)); |
|
| 1141 | + $atom_structure['reserved3'] = getid3_lib::BigEndian2Int(substr($atom_data, 38, 2)); |
|
| 1142 | 1142 | // http://developer.apple.com/library/mac/#documentation/QuickTime/RM/MovieBasics/MTEditing/K-Chapter/11MatrixFunctions.html |
| 1143 | 1143 | // http://developer.apple.com/library/mac/#documentation/QuickTime/qtff/QTFFChap4/qtff4.html#//apple_ref/doc/uid/TP40000939-CH206-18737 |
| 1144 | 1144 | $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4)); |
| 1145 | 1145 | $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 44, 4)); |
| 1146 | - $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 48, 4)); |
|
| 1146 | + $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 48, 4)); |
|
| 1147 | 1147 | $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4)); |
| 1148 | 1148 | $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 56, 4)); |
| 1149 | - $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 60, 4)); |
|
| 1149 | + $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 60, 4)); |
|
| 1150 | 1150 | $atom_structure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4)); |
| 1151 | 1151 | $atom_structure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atom_data, 68, 4)); |
| 1152 | - $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 72, 4)); |
|
| 1152 | + $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 72, 4)); |
|
| 1153 | 1153 | $atom_structure['width'] = getid3_lib::FixedPoint16_16(substr($atom_data, 76, 4)); |
| 1154 | 1154 | $atom_structure['height'] = getid3_lib::FixedPoint16_16(substr($atom_data, 80, 4)); |
| 1155 | 1155 | $atom_structure['flags']['enabled'] = (bool) ($atom_structure['flags_raw'] & 0x0001); |
@@ -1160,7 +1160,7 @@ discard block |
||
| 1160 | 1160 | $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); |
| 1161 | 1161 | |
| 1162 | 1162 | if ($atom_structure['flags']['enabled'] == 1) { |
| 1163 | - if (!isset($info['video']['resolution_x']) || !isset($info['video']['resolution_y'])) { |
|
| 1163 | + if ( ! isset($info['video']['resolution_x']) || ! isset($info['video']['resolution_y'])) { |
|
| 1164 | 1164 | $info['video']['resolution_x'] = $atom_structure['width']; |
| 1165 | 1165 | $info['video']['resolution_y'] = $atom_structure['height']; |
| 1166 | 1166 | } |
@@ -1181,34 +1181,34 @@ discard block |
||
| 1181 | 1181 | // http://www.koders.com/c/fid1FAB3E762903DC482D8A246D4A4BF9F28E049594.aspx?s=windows.h |
| 1182 | 1182 | // http://libquicktime.sourcearchive.com/documentation/1.0.2plus-pdebian/iods_8c-source.html |
| 1183 | 1183 | $offset = 0; |
| 1184 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1184 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1185 | 1185 | $offset += 1; |
| 1186 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 3)); |
|
| 1186 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 3)); |
|
| 1187 | 1187 | $offset += 3; |
| 1188 | - $atom_structure['mp4_iod_tag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1188 | + $atom_structure['mp4_iod_tag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1189 | 1189 | $offset += 1; |
| 1190 | 1190 | $atom_structure['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset); |
| 1191 | 1191 | //$offset already adjusted by quicktime_read_mp4_descr_length() |
| 1192 | - $atom_structure['object_descriptor_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); |
|
| 1192 | + $atom_structure['object_descriptor_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); |
|
| 1193 | 1193 | $offset += 2; |
| 1194 | - $atom_structure['od_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1194 | + $atom_structure['od_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1195 | 1195 | $offset += 1; |
| 1196 | - $atom_structure['scene_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1196 | + $atom_structure['scene_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1197 | 1197 | $offset += 1; |
| 1198 | - $atom_structure['audio_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1198 | + $atom_structure['audio_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1199 | 1199 | $offset += 1; |
| 1200 | - $atom_structure['video_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1200 | + $atom_structure['video_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1201 | 1201 | $offset += 1; |
| 1202 | - $atom_structure['graphics_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1202 | + $atom_structure['graphics_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1203 | 1203 | $offset += 1; |
| 1204 | 1204 | |
| 1205 | 1205 | $atom_structure['num_iods_tracks'] = ($atom_structure['length'] - 7) / 6; // 6 bytes would only be right if all tracks use 1-byte length fields |
| 1206 | 1206 | for ($i = 0; $i < $atom_structure['num_iods_tracks']; $i++) { |
| 1207 | - $atom_structure['track'][$i]['ES_ID_IncTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1207 | + $atom_structure['track'][$i]['ES_ID_IncTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
| 1208 | 1208 | $offset += 1; |
| 1209 | 1209 | $atom_structure['track'][$i]['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset); |
| 1210 | 1210 | //$offset already adjusted by quicktime_read_mp4_descr_length() |
| 1211 | - $atom_structure['track'][$i]['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); |
|
| 1211 | + $atom_structure['track'][$i]['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); |
|
| 1212 | 1212 | $offset += 4; |
| 1213 | 1213 | } |
| 1214 | 1214 | |
@@ -1217,9 +1217,9 @@ discard block |
||
| 1217 | 1217 | break; |
| 1218 | 1218 | |
| 1219 | 1219 | case 'ftyp': // FileTYPe (?) atom (for MP4 it seems) |
| 1220 | - $atom_structure['signature'] = substr($atom_data, 0, 4); |
|
| 1221 | - $atom_structure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 1222 | - $atom_structure['fourcc'] = substr($atom_data, 8, 4); |
|
| 1220 | + $atom_structure['signature'] = substr($atom_data, 0, 4); |
|
| 1221 | + $atom_structure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
| 1222 | + $atom_structure['fourcc'] = substr($atom_data, 8, 4); |
|
| 1223 | 1223 | break; |
| 1224 | 1224 | |
| 1225 | 1225 | case 'mdat': // Media DATa atom |
@@ -1240,7 +1240,7 @@ discard block |
||
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | // check to see if it looks like chapter titles, in the form of unterminated strings with a leading 16-bit size field |
| 1243 | - while (($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2))) |
|
| 1243 | + while (($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2))) |
|
| 1244 | 1244 | && ($chapter_string_length < 1000) |
| 1245 | 1245 | && ($chapter_string_length <= (strlen($atom_data) - $mdat_offset - 2)) |
| 1246 | 1246 | && preg_match('#^[\x20-\xFF]+$#', substr($atom_data, $mdat_offset + 2, $chapter_string_length), $chapter_matches)) { |
@@ -1250,9 +1250,9 @@ discard block |
||
| 1250 | 1250 | |
| 1251 | 1251 | |
| 1252 | 1252 | |
| 1253 | - if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) { |
|
| 1253 | + if (($atomsize > 8) && ( ! isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) { |
|
| 1254 | 1254 | |
| 1255 | - $info['avdataoffset'] = $atom_structure['offset'] + 8; // $info['quicktime'][$atomname]['offset'] + 8; |
|
| 1255 | + $info['avdataoffset'] = $atom_structure['offset'] + 8; // $info['quicktime'][$atomname]['offset'] + 8; |
|
| 1256 | 1256 | $OldAVDataEnd = $info['avdataend']; |
| 1257 | 1257 | $info['avdataend'] = $atom_structure['offset'] + $atom_structure['size']; // $info['quicktime'][$atomname]['offset'] + $info['quicktime'][$atomname]['size']; |
| 1258 | 1258 | |
@@ -1263,16 +1263,16 @@ discard block |
||
| 1263 | 1263 | $getid3_mp3 = new getid3_mp3($getid3_temp); |
| 1264 | 1264 | if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode($this->fread(4)))) { |
| 1265 | 1265 | $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false); |
| 1266 | - if (!empty($getid3_temp->info['warning'])) { |
|
| 1266 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
| 1267 | 1267 | foreach ($getid3_temp->info['warning'] as $value) { |
| 1268 | 1268 | $info['warning'][] = $value; |
| 1269 | 1269 | } |
| 1270 | 1270 | } |
| 1271 | - if (!empty($getid3_temp->info['mpeg'])) { |
|
| 1271 | + if ( ! empty($getid3_temp->info['mpeg'])) { |
|
| 1272 | 1272 | $info['mpeg'] = $getid3_temp->info['mpeg']; |
| 1273 | 1273 | if (isset($info['mpeg']['audio'])) { |
| 1274 | 1274 | $info['audio']['dataformat'] = 'mp3'; |
| 1275 | - $info['audio']['codec'] = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3'))); |
|
| 1275 | + $info['audio']['codec'] = ( ! empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : ( ! empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : ( ! empty($info['mpeg']['audio']['LAME']) ? 'LAME' : 'mp3'))); |
|
| 1276 | 1276 | $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate']; |
| 1277 | 1277 | $info['audio']['channels'] = $info['mpeg']['audio']['channels']; |
| 1278 | 1278 | $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate']; |
@@ -1307,7 +1307,7 @@ discard block |
||
| 1307 | 1307 | |
| 1308 | 1308 | case 'nsav': // NoSAVe atom |
| 1309 | 1309 | // http://developer.apple.com/technotes/tn/tn2038.html |
| 1310 | - $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
| 1310 | + $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
| 1311 | 1311 | break; |
| 1312 | 1312 | |
| 1313 | 1313 | case 'ctyp': // Controller TYPe atom (seen on QTVR) |
@@ -1325,7 +1325,7 @@ discard block |
||
| 1325 | 1325 | break; |
| 1326 | 1326 | |
| 1327 | 1327 | case 'pano': // PANOrama track (seen on QTVR) |
| 1328 | - $atom_structure['pano'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
| 1328 | + $atom_structure['pano'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
| 1329 | 1329 | break; |
| 1330 | 1330 | |
| 1331 | 1331 | case 'hint': // HINT track |
@@ -1364,7 +1364,7 @@ discard block |
||
| 1364 | 1364 | @list($all, $latitude, $longitude, $altitude) = $matches; |
| 1365 | 1365 | $info['quicktime']['comments']['gps_latitude'][] = floatval($latitude); |
| 1366 | 1366 | $info['quicktime']['comments']['gps_longitude'][] = floatval($longitude); |
| 1367 | - if (!empty($altitude)) { |
|
| 1367 | + if ( ! empty($altitude)) { |
|
| 1368 | 1368 | $info['quicktime']['comments']['gps_altitude'][] = floatval($altitude); |
| 1369 | 1369 | } |
| 1370 | 1370 | } else { |
@@ -1402,17 +1402,17 @@ discard block |
||
| 1402 | 1402 | // mdta keys \005 mdtacom.apple.quicktime.make (mdtacom.apple.quicktime.creationdate ,mdtacom.apple.quicktime.location.ISO6709 $mdtacom.apple.quicktime.software !mdtacom.apple.quicktime.model ilst \01D \001 \015data \001DE\010Apple 0 \002 (data \001DE\0102011-05-11T17:54:04+0200 2 \003 *data \001DE\010+52.4936+013.3897+040.247/ \01D \004 \015data \001DE\0104.3.1 \005 \018data \001DE\010iPhone 4 |
| 1403 | 1403 | // http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt |
| 1404 | 1404 | |
| 1405 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1406 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 1405 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
| 1406 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
| 1407 | 1407 | $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
| 1408 | 1408 | //$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
| 1409 | 1409 | break; |
| 1410 | 1410 | |
| 1411 | 1411 | case 'data': // metaDATA atom |
| 1412 | 1412 | // seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in sample I have), remainder is useful data |
| 1413 | - $atom_structure['language'] = substr($atom_data, 4 + 0, 2); |
|
| 1413 | + $atom_structure['language'] = substr($atom_data, 4 + 0, 2); |
|
| 1414 | 1414 | $atom_structure['unknown'] = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2)); |
| 1415 | - $atom_structure['data'] = substr($atom_data, 4 + 4); |
|
| 1415 | + $atom_structure['data'] = substr($atom_data, 4 + 4); |
|
| 1416 | 1416 | break; |
| 1417 | 1417 | |
| 1418 | 1418 | default: |
@@ -1426,7 +1426,7 @@ discard block |
||
| 1426 | 1426 | |
| 1427 | 1427 | public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { |
| 1428 | 1428 | //echo 'QuicktimeParseContainerAtom('.substr($atom_data, 4, 4).') @ '.$baseoffset.'<br><br>'; |
| 1429 | - $atom_structure = false; |
|
| 1429 | + $atom_structure = false; |
|
| 1430 | 1430 | $subatomoffset = 0; |
| 1431 | 1431 | $subatomcounter = 0; |
| 1432 | 1432 | if ((strlen($atom_data) == 4) && (getid3_lib::BigEndian2Int($atom_data) == 0x00000000)) { |
@@ -1434,8 +1434,8 @@ discard block |
||
| 1434 | 1434 | } |
| 1435 | 1435 | while ($subatomoffset < strlen($atom_data)) { |
| 1436 | 1436 | $subatomsize = getid3_lib::BigEndian2Int(substr($atom_data, $subatomoffset + 0, 4)); |
| 1437 | - $subatomname = substr($atom_data, $subatomoffset + 4, 4); |
|
| 1438 | - $subatomdata = substr($atom_data, $subatomoffset + 8, $subatomsize - 8); |
|
| 1437 | + $subatomname = substr($atom_data, $subatomoffset + 4, 4); |
|
| 1438 | + $subatomdata = substr($atom_data, $subatomoffset + 8, $subatomsize - 8); |
|
| 1439 | 1439 | if ($subatomsize == 0) { |
| 1440 | 1440 | // Furthermore, for historical reasons the list of atoms is optionally |
| 1441 | 1441 | // terminated by a 32-bit integer set to 0. If you are writing a program |
@@ -1594,8 +1594,8 @@ discard block |
||
| 1594 | 1594 | */ |
| 1595 | 1595 | $iso_language_id = ''; |
| 1596 | 1596 | $iso_language_id .= chr((($languageid & 0x7C00) >> 10) + 0x60); |
| 1597 | - $iso_language_id .= chr((($languageid & 0x03E0) >> 5) + 0x60); |
|
| 1598 | - $iso_language_id .= chr((($languageid & 0x001F) >> 0) + 0x60); |
|
| 1597 | + $iso_language_id .= chr((($languageid & 0x03E0) >> 5) + 0x60); |
|
| 1598 | + $iso_language_id .= chr((($languageid & 0x001F) >> 0) + 0x60); |
|
| 1599 | 1599 | $QuicktimeLanguageLookup[$languageid] = getid3_id3v2::LanguageLookup($iso_language_id); |
| 1600 | 1600 | } |
| 1601 | 1601 | return (isset($QuicktimeLanguageLookup[$languageid]) ? $QuicktimeLanguageLookup[$languageid] : 'invalid'); |
@@ -1975,9 +1975,9 @@ discard block |
||
| 1975 | 1975 | $parsed = array(); |
| 1976 | 1976 | while ($offset < $datalength) { |
| 1977 | 1977 | //echo getid3_lib::PrintHexBytes(substr($atom_data, $offset, 4)).'<br>'; |
| 1978 | - $record_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); $offset += 4; |
|
| 1979 | - $data_size_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
| 1980 | - $data_size = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
| 1978 | + $record_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); $offset += 4; |
|
| 1979 | + $data_size_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
| 1980 | + $data_size = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
| 1981 | 1981 | switch ($data_size_type) { |
| 1982 | 1982 | case 0x0001: // 0x0001 = flag (size field *= 1-byte) |
| 1983 | 1983 | $data = getid3_lib::BigEndian2Int(substr($atom_data, $offset, $data_size * 1)); |
@@ -2050,23 +2050,23 @@ discard block |
||
| 2050 | 2050 | break; |
| 2051 | 2051 | case 0x02000023: // PictureControlData |
| 2052 | 2052 | $PictureControlAdjust = array(0=>'default', 1=>'quick', 2=>'full'); |
| 2053 | - $FilterEffect = array(0x80=>'off', 0x81=>'yellow', 0x82=>'orange', 0x83=>'red', 0x84=>'green', 0xff=>'n/a'); |
|
| 2054 | - $ToningEffect = array(0x80=>'b&w', 0x81=>'sepia', 0x82=>'cyanotype', 0x83=>'red', 0x84=>'yellow', 0x85=>'green', 0x86=>'blue-green', 0x87=>'blue', 0x88=>'purple-blue', 0x89=>'red-purple', 0xff=>'n/a'); |
|
| 2053 | + $FilterEffect = array(0x80=>'off', 0x81=>'yellow', 0x82=>'orange', 0x83=>'red', 0x84=>'green', 0xff=>'n/a'); |
|
| 2054 | + $ToningEffect = array(0x80=>'b&w', 0x81=>'sepia', 0x82=>'cyanotype', 0x83=>'red', 0x84=>'yellow', 0x85=>'green', 0x86=>'blue-green', 0x87=>'blue', 0x88=>'purple-blue', 0x89=>'red-purple', 0xff=>'n/a'); |
|
| 2055 | 2055 | $data = array( |
| 2056 | - 'PictureControlVersion' => substr($data, 0, 4), |
|
| 2057 | - 'PictureControlName' => rtrim(substr($data, 4, 20), "\x00"), |
|
| 2056 | + 'PictureControlVersion' => substr($data, 0, 4), |
|
| 2057 | + 'PictureControlName' => rtrim(substr($data, 4, 20), "\x00"), |
|
| 2058 | 2058 | 'PictureControlBase' => rtrim(substr($data, 24, 20), "\x00"), |
| 2059 | 2059 | //'?' => substr($data, 44, 4), |
| 2060 | - 'PictureControlAdjust' => $PictureControlAdjust[ord(substr($data, 48, 1))], |
|
| 2061 | - 'PictureControlQuickAdjust' => ord(substr($data, 49, 1)), |
|
| 2062 | - 'Sharpness' => ord(substr($data, 50, 1)), |
|
| 2063 | - 'Contrast' => ord(substr($data, 51, 1)), |
|
| 2064 | - 'Brightness' => ord(substr($data, 52, 1)), |
|
| 2065 | - 'Saturation' => ord(substr($data, 53, 1)), |
|
| 2066 | - 'HueAdjustment' => ord(substr($data, 54, 1)), |
|
| 2067 | - 'FilterEffect' => $FilterEffect[ord(substr($data, 55, 1))], |
|
| 2068 | - 'ToningEffect' => $ToningEffect[ord(substr($data, 56, 1))], |
|
| 2069 | - 'ToningSaturation' => ord(substr($data, 57, 1)), |
|
| 2060 | + 'PictureControlAdjust' => $PictureControlAdjust[ord(substr($data, 48, 1))], |
|
| 2061 | + 'PictureControlQuickAdjust' => ord(substr($data, 49, 1)), |
|
| 2062 | + 'Sharpness' => ord(substr($data, 50, 1)), |
|
| 2063 | + 'Contrast' => ord(substr($data, 51, 1)), |
|
| 2064 | + 'Brightness' => ord(substr($data, 52, 1)), |
|
| 2065 | + 'Saturation' => ord(substr($data, 53, 1)), |
|
| 2066 | + 'HueAdjustment' => ord(substr($data, 54, 1)), |
|
| 2067 | + 'FilterEffect' => $FilterEffect[ord(substr($data, 55, 1))], |
|
| 2068 | + 'ToningEffect' => $ToningEffect[ord(substr($data, 56, 1))], |
|
| 2069 | + 'ToningSaturation' => ord(substr($data, 57, 1)), |
|
| 2070 | 2070 | ); |
| 2071 | 2071 | break; |
| 2072 | 2072 | case 0x02000024: // WorldTime |
@@ -2108,11 +2108,11 @@ discard block |
||
| 2108 | 2108 | } |
| 2109 | 2109 | |
| 2110 | 2110 | |
| 2111 | - public function CopyToAppropriateCommentsSection($keyname, $data, $boxname='') { |
|
| 2111 | + public function CopyToAppropriateCommentsSection($keyname, $data, $boxname = '') { |
|
| 2112 | 2112 | static $handyatomtranslatorarray = array(); |
| 2113 | 2113 | if (empty($handyatomtranslatorarray)) { |
| 2114 | 2114 | $handyatomtranslatorarray["\xA9".'cpy'] = 'copyright'; |
| 2115 | - $handyatomtranslatorarray["\xA9".'day'] = 'creation_date'; // iTunes 4.0 |
|
| 2115 | + $handyatomtranslatorarray["\xA9".'day'] = 'creation_date'; // iTunes 4.0 |
|
| 2116 | 2116 | $handyatomtranslatorarray["\xA9".'dir'] = 'director'; |
| 2117 | 2117 | $handyatomtranslatorarray["\xA9".'ed1'] = 'edit1'; |
| 2118 | 2118 | $handyatomtranslatorarray["\xA9".'ed2'] = 'edit2'; |
@@ -2132,8 +2132,8 @@ discard block |
||
| 2132 | 2132 | $handyatomtranslatorarray["\xA9".'wrt'] = 'writer'; |
| 2133 | 2133 | |
| 2134 | 2134 | // http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt |
| 2135 | - $handyatomtranslatorarray["\xA9".'nam'] = 'title'; // iTunes 4.0 |
|
| 2136 | - $handyatomtranslatorarray["\xA9".'cmt'] = 'comment'; // iTunes 4.0 |
|
| 2135 | + $handyatomtranslatorarray["\xA9".'nam'] = 'title'; // iTunes 4.0 |
|
| 2136 | + $handyatomtranslatorarray["\xA9".'cmt'] = 'comment'; // iTunes 4.0 |
|
| 2137 | 2137 | $handyatomtranslatorarray["\xA9".'wrn'] = 'warning'; |
| 2138 | 2138 | $handyatomtranslatorarray["\xA9".'hst'] = 'host_computer'; |
| 2139 | 2139 | $handyatomtranslatorarray["\xA9".'mak'] = 'make'; |
@@ -2143,39 +2143,39 @@ discard block |
||
| 2143 | 2143 | $handyatomtranslatorarray["\xA9".'aut'] = 'author'; |
| 2144 | 2144 | $handyatomtranslatorarray["\xA9".'ART'] = 'artist'; |
| 2145 | 2145 | $handyatomtranslatorarray["\xA9".'trk'] = 'track'; |
| 2146 | - $handyatomtranslatorarray["\xA9".'alb'] = 'album'; // iTunes 4.0 |
|
| 2146 | + $handyatomtranslatorarray["\xA9".'alb'] = 'album'; // iTunes 4.0 |
|
| 2147 | 2147 | $handyatomtranslatorarray["\xA9".'com'] = 'comment'; |
| 2148 | - $handyatomtranslatorarray["\xA9".'gen'] = 'genre'; // iTunes 4.0 |
|
| 2148 | + $handyatomtranslatorarray["\xA9".'gen'] = 'genre'; // iTunes 4.0 |
|
| 2149 | 2149 | $handyatomtranslatorarray["\xA9".'ope'] = 'composer'; |
| 2150 | 2150 | $handyatomtranslatorarray["\xA9".'url'] = 'url'; |
| 2151 | 2151 | $handyatomtranslatorarray["\xA9".'enc'] = 'encoder'; |
| 2152 | 2152 | |
| 2153 | 2153 | // http://atomicparsley.sourceforge.net/mpeg-4files.html |
| 2154 | - $handyatomtranslatorarray["\xA9".'art'] = 'artist'; // iTunes 4.0 |
|
| 2154 | + $handyatomtranslatorarray["\xA9".'art'] = 'artist'; // iTunes 4.0 |
|
| 2155 | 2155 | $handyatomtranslatorarray['aART'] = 'album_artist'; |
| 2156 | - $handyatomtranslatorarray['trkn'] = 'track_number'; // iTunes 4.0 |
|
| 2157 | - $handyatomtranslatorarray['disk'] = 'disc_number'; // iTunes 4.0 |
|
| 2158 | - $handyatomtranslatorarray['gnre'] = 'genre'; // iTunes 4.0 |
|
| 2159 | - $handyatomtranslatorarray["\xA9".'too'] = 'encoder'; // iTunes 4.0 |
|
| 2160 | - $handyatomtranslatorarray['tmpo'] = 'bpm'; // iTunes 4.0 |
|
| 2161 | - $handyatomtranslatorarray['cprt'] = 'copyright'; // iTunes 4.0? |
|
| 2162 | - $handyatomtranslatorarray['cpil'] = 'compilation'; // iTunes 4.0 |
|
| 2163 | - $handyatomtranslatorarray['covr'] = 'picture'; // iTunes 4.0 |
|
| 2164 | - $handyatomtranslatorarray['rtng'] = 'rating'; // iTunes 4.0 |
|
| 2165 | - $handyatomtranslatorarray["\xA9".'grp'] = 'grouping'; // iTunes 4.2 |
|
| 2166 | - $handyatomtranslatorarray['stik'] = 'stik'; // iTunes 4.9 |
|
| 2167 | - $handyatomtranslatorarray['pcst'] = 'podcast'; // iTunes 4.9 |
|
| 2168 | - $handyatomtranslatorarray['catg'] = 'category'; // iTunes 4.9 |
|
| 2169 | - $handyatomtranslatorarray['keyw'] = 'keyword'; // iTunes 4.9 |
|
| 2170 | - $handyatomtranslatorarray['purl'] = 'podcast_url'; // iTunes 4.9 |
|
| 2171 | - $handyatomtranslatorarray['egid'] = 'episode_guid'; // iTunes 4.9 |
|
| 2172 | - $handyatomtranslatorarray['desc'] = 'description'; // iTunes 5.0 |
|
| 2173 | - $handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics'; // iTunes 5.0 |
|
| 2174 | - $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; // iTunes 6.0 |
|
| 2175 | - $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; // iTunes 6.0 |
|
| 2176 | - $handyatomtranslatorarray['tvsn'] = 'tv_season'; // iTunes 6.0 |
|
| 2177 | - $handyatomtranslatorarray['tves'] = 'tv_episode'; // iTunes 6.0 |
|
| 2178 | - $handyatomtranslatorarray['purd'] = 'purchase_date'; // iTunes 6.0.2 |
|
| 2156 | + $handyatomtranslatorarray['trkn'] = 'track_number'; // iTunes 4.0 |
|
| 2157 | + $handyatomtranslatorarray['disk'] = 'disc_number'; // iTunes 4.0 |
|
| 2158 | + $handyatomtranslatorarray['gnre'] = 'genre'; // iTunes 4.0 |
|
| 2159 | + $handyatomtranslatorarray["\xA9".'too'] = 'encoder'; // iTunes 4.0 |
|
| 2160 | + $handyatomtranslatorarray['tmpo'] = 'bpm'; // iTunes 4.0 |
|
| 2161 | + $handyatomtranslatorarray['cprt'] = 'copyright'; // iTunes 4.0? |
|
| 2162 | + $handyatomtranslatorarray['cpil'] = 'compilation'; // iTunes 4.0 |
|
| 2163 | + $handyatomtranslatorarray['covr'] = 'picture'; // iTunes 4.0 |
|
| 2164 | + $handyatomtranslatorarray['rtng'] = 'rating'; // iTunes 4.0 |
|
| 2165 | + $handyatomtranslatorarray["\xA9".'grp'] = 'grouping'; // iTunes 4.2 |
|
| 2166 | + $handyatomtranslatorarray['stik'] = 'stik'; // iTunes 4.9 |
|
| 2167 | + $handyatomtranslatorarray['pcst'] = 'podcast'; // iTunes 4.9 |
|
| 2168 | + $handyatomtranslatorarray['catg'] = 'category'; // iTunes 4.9 |
|
| 2169 | + $handyatomtranslatorarray['keyw'] = 'keyword'; // iTunes 4.9 |
|
| 2170 | + $handyatomtranslatorarray['purl'] = 'podcast_url'; // iTunes 4.9 |
|
| 2171 | + $handyatomtranslatorarray['egid'] = 'episode_guid'; // iTunes 4.9 |
|
| 2172 | + $handyatomtranslatorarray['desc'] = 'description'; // iTunes 5.0 |
|
| 2173 | + $handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics'; // iTunes 5.0 |
|
| 2174 | + $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; // iTunes 6.0 |
|
| 2175 | + $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; // iTunes 6.0 |
|
| 2176 | + $handyatomtranslatorarray['tvsn'] = 'tv_season'; // iTunes 6.0 |
|
| 2177 | + $handyatomtranslatorarray['tves'] = 'tv_episode'; // iTunes 6.0 |
|
| 2178 | + $handyatomtranslatorarray['purd'] = 'purchase_date'; // iTunes 6.0.2 |
|
| 2179 | 2179 | $handyatomtranslatorarray['pgap'] = 'gapless_playback'; // iTunes 7.0 |
| 2180 | 2180 | |
| 2181 | 2181 | // http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt |
@@ -2211,7 +2211,7 @@ discard block |
||
| 2211 | 2211 | } |
| 2212 | 2212 | if ($comment_key) { |
| 2213 | 2213 | if ($comment_key == 'picture') { |
| 2214 | - if (!is_array($data)) { |
|
| 2214 | + if ( ! is_array($data)) { |
|
| 2215 | 2215 | $image_mime = ''; |
| 2216 | 2216 | if (preg_match('#^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A#', $data)) { |
| 2217 | 2217 | $image_mime = 'image/png'; |
@@ -1320,6 +1320,9 @@ discard block |
||
| 1320 | 1320 | return true; |
| 1321 | 1321 | } |
| 1322 | 1322 | |
| 1323 | + /** |
|
| 1324 | + * @param double $startoffset |
|
| 1325 | + */ |
|
| 1323 | 1326 | public function ParseRIFFAMV($startoffset, $maxoffset) { |
| 1324 | 1327 | // 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 |
| 1325 | 1328 | |
@@ -1715,6 +1718,9 @@ discard block |
||
| 1715 | 1718 | return $RIFFchunk; |
| 1716 | 1719 | } |
| 1717 | 1720 | |
| 1721 | + /** |
|
| 1722 | + * @param string $RIFFdata |
|
| 1723 | + */ |
|
| 1718 | 1724 | public function ParseRIFFdata(&$RIFFdata) { |
| 1719 | 1725 | $info = &$this->getid3->info; |
| 1720 | 1726 | if ($RIFFdata) { |
@@ -1836,6 +1842,9 @@ discard block |
||
| 1836 | 1842 | return $WaveFormatEx; |
| 1837 | 1843 | } |
| 1838 | 1844 | |
| 1845 | + /** |
|
| 1846 | + * @param string $WavPackChunkData |
|
| 1847 | + */ |
|
| 1839 | 1848 | public function parseWavPackHeader($WavPackChunkData) { |
| 1840 | 1849 | // typedef struct { |
| 1841 | 1850 | // char ckID [4]; |
@@ -1916,6 +1925,9 @@ discard block |
||
| 1916 | 1925 | return $parsed; |
| 1917 | 1926 | } |
| 1918 | 1927 | |
| 1928 | + /** |
|
| 1929 | + * @param string $DIVXTAG |
|
| 1930 | + */ |
|
| 1919 | 1931 | public static function ParseDIVXTAG($DIVXTAG, $raw=false) { |
| 1920 | 1932 | // structure from "IDivX" source, Form1.frm, by "Greg Frazier of Daemonic Software Group", email: [email protected], web: http://dsg.cjb.net/ |
| 1921 | 1933 | // source available at http://files.divx-digest.com/download/c663efe7ef8ad2e90bf4af4d3ea6188a/on0SWN2r/edit/IDivX.zip |
@@ -1990,6 +2002,9 @@ discard block |
||
| 1990 | 2002 | return $parsed; |
| 1991 | 2003 | } |
| 1992 | 2004 | |
| 2005 | + /** |
|
| 2006 | + * @param string $tagshortname |
|
| 2007 | + */ |
|
| 1993 | 2008 | public static function waveSNDMtagLookup($tagshortname) { |
| 1994 | 2009 | $begin = __LINE__; |
| 1995 | 2010 | |
@@ -2576,6 +2591,9 @@ discard block |
||
| 2576 | 2591 | return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); |
| 2577 | 2592 | } |
| 2578 | 2593 | |
| 2594 | + /** |
|
| 2595 | + * @param string $byteword |
|
| 2596 | + */ |
|
| 2579 | 2597 | private function EitherEndian2Int($byteword, $signed=false) { |
| 2580 | 2598 | if ($this->container == 'riff') { |
| 2581 | 2599 | return getid3_lib::LittleEndian2Int($byteword, $signed); |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | 'capturedfile' => 0x00010000, |
| 694 | 694 | 'copyrighted' => 0x00020010, |
| 695 | 695 | ); |
| 696 | - foreach ($flags as $flag => $value) { |
|
| 696 | + foreach ($flags as $flag => $value) { |
|
| 697 | 697 | $thisfile_riff_raw_avih['flags'][$flag] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & $value); |
| 698 | 698 | } |
| 699 | 699 | |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | // http://en.wikipedia.org/wiki/CD-DA |
| 913 | 913 | case 'CDDA': |
| 914 | 914 | $info['fileformat'] = 'cda'; |
| 915 | - unset($info['mime_type']); |
|
| 915 | + unset($info['mime_type']); |
|
| 916 | 916 | |
| 917 | 917 | $thisfile_audio_dataformat = 'cda'; |
| 918 | 918 | |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | } |
| 946 | 946 | break; |
| 947 | 947 | |
| 948 | - // http://en.wikipedia.org/wiki/AIFF |
|
| 948 | + // http://en.wikipedia.org/wiki/AIFF |
|
| 949 | 949 | case 'AIFF': |
| 950 | 950 | case 'AIFC': |
| 951 | 951 | $info['fileformat'] = 'aiff'; |
@@ -2007,8 +2007,7 @@ discard block |
||
| 2007 | 2007 | ©cdt cdtitle |
| 2008 | 2008 | ©alb library |
| 2009 | 2009 | ©com composer |
| 2010 | - |
|
| 2011 | - */ |
|
| 2010 | + */ |
|
| 2012 | 2011 | |
| 2013 | 2012 | return getid3_lib::EmbeddedLookup($tagshortname, $begin, __LINE__, __FILE__, 'riff-sndm'); |
| 2014 | 2013 | } |
@@ -2176,8 +2175,7 @@ discard block |
||
| 2176 | 2175 | 0x7A22 GSM-AMR (VBR, including SID) |
| 2177 | 2176 | 0xFFFE WAVE_FORMAT_EXTENSIBLE |
| 2178 | 2177 | 0xFFFF WAVE_FORMAT_DEVELOPMENT |
| 2179 | - |
|
| 2180 | - */ |
|
| 2178 | + */ |
|
| 2181 | 2179 | |
| 2182 | 2180 | return getid3_lib::EmbeddedLookup('0x'.str_pad(strtoupper(dechex($wFormatTag)), 4, '0', STR_PAD_LEFT), $begin, __LINE__, __FILE__, 'riff-wFormatTag'); |
| 2183 | 2181 | } |
@@ -2570,8 +2568,7 @@ discard block |
||
| 2570 | 2568 | YVYU YVYU 4:2:2 Packed |
| 2571 | 2569 | ZLIB Lossless Codec Library zlib compression (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm) |
| 2572 | 2570 | ZPEG Metheus Video Zipper |
| 2573 | - |
|
| 2574 | - */ |
|
| 2571 | + */ |
|
| 2575 | 2572 | |
| 2576 | 2573 | return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); |
| 2577 | 2574 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | if ($RIFFsubtype != 'AMV ') { |
| 80 | 80 | // 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 |
| 81 | 81 | // Handled separately in ParseRIFFAMV() |
| 82 | - $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); |
|
| 82 | + $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); |
|
| 83 | 83 | } |
| 84 | 84 | if (($info['avdataend'] - $info['filesize']) == 1) { |
| 85 | 85 | // LiteWave appears to incorrectly *not* pad actual output file |
@@ -109,9 +109,9 @@ discard block |
||
| 109 | 109 | break; |
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | - $nextRIFFheaderID = substr($nextRIFFheader, 0, 4); |
|
| 112 | + $nextRIFFheaderID = substr($nextRIFFheader, 0, 4); |
|
| 113 | 113 | $nextRIFFsize = $this->EitherEndian2Int(substr($nextRIFFheader, 4, 4)); |
| 114 | - $nextRIFFtype = substr($nextRIFFheader, 8, 4); |
|
| 114 | + $nextRIFFtype = substr($nextRIFFheader, 8, 4); |
|
| 115 | 115 | $chunkdata = array(); |
| 116 | 116 | $chunkdata['offset'] = $nextRIFFoffset + 8; |
| 117 | 117 | $chunkdata['size'] = $nextRIFFsize; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | switch ($nextRIFFheaderID) { |
| 121 | 121 | case 'RIFF': |
| 122 | 122 | $chunkdata['chunks'] = $this->ParseRIFF($chunkdata['offset'] + 4, $nextRIFFoffset); |
| 123 | - if (!isset($thisfile_riff[$nextRIFFtype])) { |
|
| 123 | + if ( ! isset($thisfile_riff[$nextRIFFtype])) { |
|
| 124 | 124 | $thisfile_riff[$nextRIFFtype] = array(); |
| 125 | 125 | } |
| 126 | 126 | $thisfile_riff[$nextRIFFtype][] = $chunkdata; |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | $thisfile_riff_audio[$streamindex] = self::parseWAVEFORMATex($thisfile_riff_WAVE['fmt '][0]['data']); |
| 191 | 191 | $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag']; |
| 192 | - if (!isset($thisfile_riff_audio[$streamindex]['bitrate']) || ($thisfile_riff_audio[$streamindex]['bitrate'] == 0)) { |
|
| 192 | + if ( ! isset($thisfile_riff_audio[$streamindex]['bitrate']) || ($thisfile_riff_audio[$streamindex]['bitrate'] == 0)) { |
|
| 193 | 193 | $info['error'][] = 'Corrupt RIFF file: bitrate_audio == zero'; |
| 194 | 194 | return false; |
| 195 | 195 | } |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | $thisfile_riff_raw_rgad_album = &$thisfile_riff_raw_rgad['album']; |
| 242 | 242 | |
| 243 | 243 | $thisfile_riff_raw_rgad['fPeakAmplitude'] = getid3_lib::LittleEndian2Float(substr($rgadData, 0, 4)); |
| 244 | - $thisfile_riff_raw_rgad['nRadioRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 4, 2)); |
|
| 245 | - $thisfile_riff_raw_rgad['nAudiophileRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 6, 2)); |
|
| 244 | + $thisfile_riff_raw_rgad['nRadioRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 4, 2)); |
|
| 245 | + $thisfile_riff_raw_rgad['nAudiophileRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 6, 2)); |
|
| 246 | 246 | |
| 247 | 247 | $nRadioRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nRadioRgAdjust']), 16, '0', STR_PAD_LEFT); |
| 248 | 248 | $nAudiophileRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nAudiophileRgAdjust']), 16, '0', STR_PAD_LEFT); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | // $info['playtime_seconds'] = (float) $thisfile_riff_raw['fact']['NumberOfSamples'] / $thisfile_riff_raw['fmt ']['nSamplesPerSec']; |
| 280 | 280 | // } |
| 281 | 281 | } |
| 282 | - if (!empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) { |
|
| 282 | + if ( ! empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) { |
|
| 283 | 283 | $thisfile_audio['bitrate'] = getid3_lib::CastAsInt($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'] * 8); |
| 284 | 284 | } |
| 285 | 285 | |
@@ -287,18 +287,18 @@ discard block |
||
| 287 | 287 | // shortcut |
| 288 | 288 | $thisfile_riff_WAVE_bext_0 = &$thisfile_riff_WAVE['bext'][0]; |
| 289 | 289 | |
| 290 | - $thisfile_riff_WAVE_bext_0['title'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 0, 256)); |
|
| 291 | - $thisfile_riff_WAVE_bext_0['author'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 256, 32)); |
|
| 292 | - $thisfile_riff_WAVE_bext_0['reference'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 288, 32)); |
|
| 293 | - $thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10); |
|
| 294 | - $thisfile_riff_WAVE_bext_0['origin_time'] = substr($thisfile_riff_WAVE_bext_0['data'], 330, 8); |
|
| 295 | - $thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338, 8)); |
|
| 296 | - $thisfile_riff_WAVE_bext_0['bwf_version'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346, 1)); |
|
| 297 | - $thisfile_riff_WAVE_bext_0['reserved'] = substr($thisfile_riff_WAVE_bext_0['data'], 347, 254); |
|
| 298 | - $thisfile_riff_WAVE_bext_0['coding_history'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601))); |
|
| 290 | + $thisfile_riff_WAVE_bext_0['title'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 0, 256)); |
|
| 291 | + $thisfile_riff_WAVE_bext_0['author'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 256, 32)); |
|
| 292 | + $thisfile_riff_WAVE_bext_0['reference'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 288, 32)); |
|
| 293 | + $thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10); |
|
| 294 | + $thisfile_riff_WAVE_bext_0['origin_time'] = substr($thisfile_riff_WAVE_bext_0['data'], 330, 8); |
|
| 295 | + $thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338, 8)); |
|
| 296 | + $thisfile_riff_WAVE_bext_0['bwf_version'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346, 1)); |
|
| 297 | + $thisfile_riff_WAVE_bext_0['reserved'] = substr($thisfile_riff_WAVE_bext_0['data'], 347, 254); |
|
| 298 | + $thisfile_riff_WAVE_bext_0['coding_history'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601))); |
|
| 299 | 299 | if (preg_match('#^([0-9]{4}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_date'], $matches_bext_date)) { |
| 300 | 300 | if (preg_match('#^([0-9]{2}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_time'], $matches_bext_time)) { |
| 301 | - list($dummy, $bext_timestamp['year'], $bext_timestamp['month'], $bext_timestamp['day']) = $matches_bext_date; |
|
| 301 | + list($dummy, $bext_timestamp['year'], $bext_timestamp['month'], $bext_timestamp['day']) = $matches_bext_date; |
|
| 302 | 302 | list($dummy, $bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second']) = $matches_bext_time; |
| 303 | 303 | $thisfile_riff_WAVE_bext_0['origin_date_unix'] = gmmktime($bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second'], $bext_timestamp['month'], $bext_timestamp['day'], $bext_timestamp['year']); |
| 304 | 304 | } else { |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | $thisfile_riff_WAVE_MEXT_0['flags']['homogenous'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0001); |
| 320 | 320 | if ($thisfile_riff_WAVE_MEXT_0['flags']['homogenous']) { |
| 321 | 321 | $thisfile_riff_WAVE_MEXT_0['flags']['padding'] = ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0002) ? false : true; |
| 322 | - $thisfile_riff_WAVE_MEXT_0['flags']['22_or_44'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004); |
|
| 323 | - $thisfile_riff_WAVE_MEXT_0['flags']['free_format'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008); |
|
| 322 | + $thisfile_riff_WAVE_MEXT_0['flags']['22_or_44'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004); |
|
| 323 | + $thisfile_riff_WAVE_MEXT_0['flags']['free_format'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008); |
|
| 324 | 324 | |
| 325 | 325 | $thisfile_riff_WAVE_MEXT_0['nominal_frame_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 2, 2)); |
| 326 | 326 | } |
@@ -335,27 +335,27 @@ discard block |
||
| 335 | 335 | // shortcut |
| 336 | 336 | $thisfile_riff_WAVE_cart_0 = &$thisfile_riff_WAVE['cart'][0]; |
| 337 | 337 | |
| 338 | - $thisfile_riff_WAVE_cart_0['version'] = substr($thisfile_riff_WAVE_cart_0['data'], 0, 4); |
|
| 339 | - $thisfile_riff_WAVE_cart_0['title'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 4, 64)); |
|
| 340 | - $thisfile_riff_WAVE_cart_0['artist'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 68, 64)); |
|
| 341 | - $thisfile_riff_WAVE_cart_0['cut_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64)); |
|
| 342 | - $thisfile_riff_WAVE_cart_0['client_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64)); |
|
| 343 | - $thisfile_riff_WAVE_cart_0['category'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64)); |
|
| 344 | - $thisfile_riff_WAVE_cart_0['classification'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64)); |
|
| 345 | - $thisfile_riff_WAVE_cart_0['out_cue'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64)); |
|
| 346 | - $thisfile_riff_WAVE_cart_0['start_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10)); |
|
| 347 | - $thisfile_riff_WAVE_cart_0['start_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 462, 8)); |
|
| 348 | - $thisfile_riff_WAVE_cart_0['end_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10)); |
|
| 349 | - $thisfile_riff_WAVE_cart_0['end_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 480, 8)); |
|
| 350 | - $thisfile_riff_WAVE_cart_0['producer_app_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64)); |
|
| 351 | - $thisfile_riff_WAVE_cart_0['producer_app_version'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64)); |
|
| 352 | - $thisfile_riff_WAVE_cart_0['user_defined_text'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64)); |
|
| 353 | - $thisfile_riff_WAVE_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680, 4), true); |
|
| 338 | + $thisfile_riff_WAVE_cart_0['version'] = substr($thisfile_riff_WAVE_cart_0['data'], 0, 4); |
|
| 339 | + $thisfile_riff_WAVE_cart_0['title'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 4, 64)); |
|
| 340 | + $thisfile_riff_WAVE_cart_0['artist'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 68, 64)); |
|
| 341 | + $thisfile_riff_WAVE_cart_0['cut_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64)); |
|
| 342 | + $thisfile_riff_WAVE_cart_0['client_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64)); |
|
| 343 | + $thisfile_riff_WAVE_cart_0['category'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64)); |
|
| 344 | + $thisfile_riff_WAVE_cart_0['classification'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64)); |
|
| 345 | + $thisfile_riff_WAVE_cart_0['out_cue'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64)); |
|
| 346 | + $thisfile_riff_WAVE_cart_0['start_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10)); |
|
| 347 | + $thisfile_riff_WAVE_cart_0['start_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 462, 8)); |
|
| 348 | + $thisfile_riff_WAVE_cart_0['end_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10)); |
|
| 349 | + $thisfile_riff_WAVE_cart_0['end_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 480, 8)); |
|
| 350 | + $thisfile_riff_WAVE_cart_0['producer_app_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64)); |
|
| 351 | + $thisfile_riff_WAVE_cart_0['producer_app_version'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64)); |
|
| 352 | + $thisfile_riff_WAVE_cart_0['user_defined_text'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64)); |
|
| 353 | + $thisfile_riff_WAVE_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680, 4), true); |
|
| 354 | 354 | for ($i = 0; $i < 8; $i++) { |
| 355 | - $thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] = substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4); |
|
| 355 | + $thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] = substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4); |
|
| 356 | 356 | $thisfile_riff_WAVE_cart_0['post_time'][$i]['timer_value'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8) + 4, 4)); |
| 357 | 357 | } |
| 358 | - $thisfile_riff_WAVE_cart_0['url'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 748, 1024)); |
|
| 358 | + $thisfile_riff_WAVE_cart_0['url'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 748, 1024)); |
|
| 359 | 359 | $thisfile_riff_WAVE_cart_0['tag_text'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_cart_0['data'], 1772))); |
| 360 | 360 | |
| 361 | 361 | $thisfile_riff['comments']['artist'][] = $thisfile_riff_WAVE_cart_0['artist']; |
@@ -375,13 +375,13 @@ discard block |
||
| 375 | 375 | $SNDM_thisTagOffset = 0; |
| 376 | 376 | $SNDM_thisTagSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4)); |
| 377 | 377 | $SNDM_thisTagOffset += 4; |
| 378 | - $SNDM_thisTagKey = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4); |
|
| 378 | + $SNDM_thisTagKey = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4); |
|
| 379 | 379 | $SNDM_thisTagOffset += 4; |
| 380 | 380 | $SNDM_thisTagDataSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2)); |
| 381 | 381 | $SNDM_thisTagOffset += 2; |
| 382 | 382 | $SNDM_thisTagDataFlags = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2)); |
| 383 | 383 | $SNDM_thisTagOffset += 2; |
| 384 | - $SNDM_thisTagDataText = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, $SNDM_thisTagDataSize); |
|
| 384 | + $SNDM_thisTagDataText = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, $SNDM_thisTagDataSize); |
|
| 385 | 385 | $SNDM_thisTagOffset += $SNDM_thisTagDataSize; |
| 386 | 386 | |
| 387 | 387 | if ($SNDM_thisTagSize != (4 + 4 + 2 + 2 + $SNDM_thisTagDataSize)) { |
@@ -426,15 +426,15 @@ discard block |
||
| 426 | 426 | @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['TIMECODE_RATE']); |
| 427 | 427 | $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000); |
| 428 | 428 | } |
| 429 | - if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && !empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && !empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) { |
|
| 429 | + if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && ! empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && ! empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) { |
|
| 430 | 430 | $samples_since_midnight = floatval(ltrim($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_HI'].$parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO'], '0')); |
| 431 | 431 | $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] = $samples_since_midnight / $parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']; |
| 432 | - $h = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] / 3600); |
|
| 433 | - $m = floor(($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600)) / 60); |
|
| 434 | - $s = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60)); |
|
| 435 | - $f = ($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60) - $s) * $thisfile_riff_WAVE['iXML'][0]['timecode_rate']; |
|
| 436 | - $thisfile_riff_WAVE['iXML'][0]['timecode_string'] = sprintf('%02d:%02d:%02d:%05.2f', $h, $m, $s, $f); |
|
| 437 | - $thisfile_riff_WAVE['iXML'][0]['timecode_string_round'] = sprintf('%02d:%02d:%02d:%02d', $h, $m, $s, round($f)); |
|
| 432 | + $h = floor($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] / 3600); |
|
| 433 | + $m = floor(($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600)) / 60); |
|
| 434 | + $s = floor($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60)); |
|
| 435 | + $f = ($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60) - $s) * $thisfile_riff_WAVE['iXML'][0]['timecode_rate']; |
|
| 436 | + $thisfile_riff_WAVE['iXML'][0]['timecode_string'] = sprintf('%02d:%02d:%02d:%05.2f', $h, $m, $s, $f); |
|
| 437 | + $thisfile_riff_WAVE['iXML'][0]['timecode_string_round'] = sprintf('%02d:%02d:%02d:%02d', $h, $m, $s, round($f)); |
|
| 438 | 438 | } |
| 439 | 439 | unset($parsedXML); |
| 440 | 440 | } |
@@ -442,23 +442,23 @@ discard block |
||
| 442 | 442 | |
| 443 | 443 | |
| 444 | 444 | |
| 445 | - if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) { |
|
| 445 | + if ( ! isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) { |
|
| 446 | 446 | $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; |
| 447 | 447 | $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']); |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | - if (!empty($info['wavpack'])) { |
|
| 450 | + if ( ! empty($info['wavpack'])) { |
|
| 451 | 451 | $thisfile_audio_dataformat = 'wavpack'; |
| 452 | 452 | $thisfile_audio['bitrate_mode'] = 'vbr'; |
| 453 | 453 | $thisfile_audio['encoder'] = 'WavPack v'.$info['wavpack']['version']; |
| 454 | 454 | |
| 455 | 455 | // Reset to the way it was - RIFF parsing will have messed this up |
| 456 | - $info['avdataend'] = $Original['avdataend']; |
|
| 456 | + $info['avdataend'] = $Original['avdataend']; |
|
| 457 | 457 | $thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; |
| 458 | 458 | |
| 459 | 459 | $this->fseek($info['avdataoffset'] - 44); |
| 460 | 460 | $RIFFdata = $this->fread(44); |
| 461 | - $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; |
|
| 461 | + $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; |
|
| 462 | 462 | $OrignalRIFFdataSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44; |
| 463 | 463 | |
| 464 | 464 | if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) { |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | if (isset($thisfile_riff_raw['fmt ']['wFormatTag'])) { |
| 480 | 480 | switch ($thisfile_riff_raw['fmt ']['wFormatTag']) { |
| 481 | 481 | case 0x0001: // PCM |
| 482 | - if (!empty($info['ac3'])) { |
|
| 482 | + if ( ! empty($info['ac3'])) { |
|
| 483 | 483 | // Dolby Digital WAV files masquerade as PCM-WAV, but they're not |
| 484 | 484 | $thisfile_audio['wformattag'] = 0x2000; |
| 485 | 485 | $thisfile_audio['codec'] = self::wFormatTagLookup($thisfile_audio['wformattag']); |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | $thisfile_audio['bitrate'] = $info['ac3']['bitrate']; |
| 488 | 488 | $thisfile_audio['sample_rate'] = $info['ac3']['sample_rate']; |
| 489 | 489 | } |
| 490 | - if (!empty($info['dts'])) { |
|
| 490 | + if ( ! empty($info['dts'])) { |
|
| 491 | 491 | // Dolby DTS files masquerade as PCM-WAV, but they're not |
| 492 | 492 | $thisfile_audio['wformattag'] = 0x2001; |
| 493 | 493 | $thisfile_audio['codec'] = self::wFormatTagLookup($thisfile_audio['wformattag']); |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | break; |
| 499 | 499 | case 0x08AE: // ClearJump LiteWave |
| 500 | 500 | $thisfile_audio['bitrate_mode'] = 'vbr'; |
| 501 | - $thisfile_audio_dataformat = 'litewave'; |
|
| 501 | + $thisfile_audio_dataformat = 'litewave'; |
|
| 502 | 502 | |
| 503 | 503 | //typedef struct tagSLwFormat { |
| 504 | 504 | // WORD m_wCompFormat; // low byte defines compression method, high byte is compression flags |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | |
| 545 | 545 | $riff_litewave['flags']['raw_source'] = ($riff_litewave_raw['compression_flags'] & 0x01) ? false : true; |
| 546 | 546 | $riff_litewave['flags']['vbr_blocksize'] = ($riff_litewave_raw['compression_flags'] & 0x02) ? false : true; |
| 547 | - $riff_litewave['flags']['seekpoints'] = (bool) ($riff_litewave_raw['compression_flags'] & 0x04); |
|
| 547 | + $riff_litewave['flags']['seekpoints'] = (bool) ($riff_litewave_raw['compression_flags'] & 0x04); |
|
| 548 | 548 | |
| 549 | 549 | $thisfile_audio['lossless'] = (($riff_litewave_raw['m_wQuality'] == 100) ? true : false); |
| 550 | 550 | $thisfile_audio['encoder_options'] = '-q'.$riff_litewave['quality_factor']; |
@@ -555,11 +555,11 @@ discard block |
||
| 555 | 555 | } |
| 556 | 556 | } |
| 557 | 557 | if ($info['avdataend'] > $info['filesize']) { |
| 558 | - switch (!empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') { |
|
| 559 | - case 'wavpack': // WavPack |
|
| 560 | - case 'lpac': // LPAC |
|
| 561 | - case 'ofr': // OptimFROG |
|
| 562 | - case 'ofs': // OptimFROG DualStream |
|
| 558 | + switch ( ! empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') { |
|
| 559 | + case 'wavpack' : // WavPack |
|
| 560 | + case 'lpac' : // LPAC |
|
| 561 | + case 'ofr' : // OptimFROG |
|
| 562 | + case 'ofs' : // OptimFROG DualStream |
|
| 563 | 563 | // lossless compressed audio formats that keep original RIFF headers - skip warning |
| 564 | 564 | break; |
| 565 | 565 | |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | break; |
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | - if (!empty($info['mpeg']['audio']['LAME']['audio_bytes'])) { |
|
| 592 | + if ( ! empty($info['mpeg']['audio']['LAME']['audio_bytes'])) { |
|
| 593 | 593 | if ((($info['avdataend'] - $info['avdataoffset']) - $info['mpeg']['audio']['LAME']['audio_bytes']) == 1) { |
| 594 | 594 | $info['avdataend']--; |
| 595 | 595 | $info['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored'; |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | if (isset($thisfile_audio_dataformat) && ($thisfile_audio_dataformat == 'ac3')) { |
| 599 | 599 | unset($thisfile_audio['bits_per_sample']); |
| 600 | - if (!empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) { |
|
| 600 | + if ( ! empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) { |
|
| 601 | 601 | $thisfile_audio['bitrate'] = $info['ac3']['bitrate']; |
| 602 | 602 | } |
| 603 | 603 | } |
@@ -638,11 +638,11 @@ discard block |
||
| 638 | 638 | foreach ($thisfile_riff['AVI ']['hdrl']['strl']['indx'] as $streamnumber => $steamdataarray) { |
| 639 | 639 | $ahsisd = &$thisfile_riff['AVI ']['hdrl']['strl']['indx'][$streamnumber]['data']; |
| 640 | 640 | |
| 641 | - $thisfile_riff_raw['indx'][$streamnumber]['wLongsPerEntry'] = $this->EitherEndian2Int(substr($ahsisd, 0, 2)); |
|
| 642 | - $thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType'] = $this->EitherEndian2Int(substr($ahsisd, 2, 1)); |
|
| 643 | - $thisfile_riff_raw['indx'][$streamnumber]['bIndexType'] = $this->EitherEndian2Int(substr($ahsisd, 3, 1)); |
|
| 644 | - $thisfile_riff_raw['indx'][$streamnumber]['nEntriesInUse'] = $this->EitherEndian2Int(substr($ahsisd, 4, 4)); |
|
| 645 | - $thisfile_riff_raw['indx'][$streamnumber]['dwChunkId'] = substr($ahsisd, 8, 4); |
|
| 641 | + $thisfile_riff_raw['indx'][$streamnumber]['wLongsPerEntry'] = $this->EitherEndian2Int(substr($ahsisd, 0, 2)); |
|
| 642 | + $thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType'] = $this->EitherEndian2Int(substr($ahsisd, 2, 1)); |
|
| 643 | + $thisfile_riff_raw['indx'][$streamnumber]['bIndexType'] = $this->EitherEndian2Int(substr($ahsisd, 3, 1)); |
|
| 644 | + $thisfile_riff_raw['indx'][$streamnumber]['nEntriesInUse'] = $this->EitherEndian2Int(substr($ahsisd, 4, 4)); |
|
| 645 | + $thisfile_riff_raw['indx'][$streamnumber]['dwChunkId'] = substr($ahsisd, 8, 4); |
|
| 646 | 646 | $thisfile_riff_raw['indx'][$streamnumber]['dwReserved'] = $this->EitherEndian2Int(substr($ahsisd, 12, 4)); |
| 647 | 647 | |
| 648 | 648 | //$thisfile_riff_raw['indx'][$streamnumber]['bIndexType_name'] = $bIndexType[$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']]; |
@@ -658,26 +658,26 @@ discard block |
||
| 658 | 658 | $thisfile_riff_raw['avih'] = array(); |
| 659 | 659 | $thisfile_riff_raw_avih = &$thisfile_riff_raw['avih']; |
| 660 | 660 | |
| 661 | - $thisfile_riff_raw_avih['dwMicroSecPerFrame'] = $this->EitherEndian2Int(substr($avihData, 0, 4)); // frame display rate (or 0L) |
|
| 661 | + $thisfile_riff_raw_avih['dwMicroSecPerFrame'] = $this->EitherEndian2Int(substr($avihData, 0, 4)); // frame display rate (or 0L) |
|
| 662 | 662 | if ($thisfile_riff_raw_avih['dwMicroSecPerFrame'] == 0) { |
| 663 | 663 | $info['error'][] = 'Corrupt RIFF file: avih.dwMicroSecPerFrame == zero'; |
| 664 | 664 | return false; |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | $flags = array( |
| 668 | - 'dwMaxBytesPerSec', // max. transfer rate |
|
| 669 | - 'dwPaddingGranularity', // pad to multiples of this size; normally 2K. |
|
| 670 | - 'dwFlags', // the ever-present flags |
|
| 671 | - 'dwTotalFrames', // # frames in file |
|
| 672 | - 'dwInitialFrames', // |
|
| 673 | - 'dwStreams', // |
|
| 674 | - 'dwSuggestedBufferSize', // |
|
| 675 | - 'dwWidth', // |
|
| 676 | - 'dwHeight', // |
|
| 677 | - 'dwScale', // |
|
| 678 | - 'dwRate', // |
|
| 679 | - 'dwStart', // |
|
| 680 | - 'dwLength', // |
|
| 668 | + 'dwMaxBytesPerSec', // max. transfer rate |
|
| 669 | + 'dwPaddingGranularity', // pad to multiples of this size; normally 2K. |
|
| 670 | + 'dwFlags', // the ever-present flags |
|
| 671 | + 'dwTotalFrames', // # frames in file |
|
| 672 | + 'dwInitialFrames', // |
|
| 673 | + 'dwStreams', // |
|
| 674 | + 'dwSuggestedBufferSize', // |
|
| 675 | + 'dwWidth', // |
|
| 676 | + 'dwHeight', // |
|
| 677 | + 'dwScale', // |
|
| 678 | + 'dwRate', // |
|
| 679 | + 'dwStart', // |
|
| 680 | + 'dwLength', // |
|
| 681 | 681 | ); |
| 682 | 682 | $avih_offset = 4; |
| 683 | 683 | foreach ($flags as $flag) { |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | for ($i = 0; $i < count($thisfile_riff['AVI ']['hdrl']['strl']['strh']); $i++) { |
| 723 | 723 | if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) { |
| 724 | 724 | $strhData = $thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data']; |
| 725 | - $strhfccType = substr($strhData, 0, 4); |
|
| 725 | + $strhfccType = substr($strhData, 0, 4); |
|
| 726 | 726 | |
| 727 | 727 | if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) { |
| 728 | 728 | $strfData = $thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data']; |
@@ -806,9 +806,9 @@ discard block |
||
| 806 | 806 | $thisfile_riff_raw['strh'][$i] = array(); |
| 807 | 807 | $thisfile_riff_raw_strh_current = &$thisfile_riff_raw['strh'][$i]; |
| 808 | 808 | |
| 809 | - $thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); // same as $strhfccType; |
|
| 810 | - $thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4); |
|
| 811 | - $thisfile_riff_raw_strh_current['dwFlags'] = $this->EitherEndian2Int(substr($strhData, 8, 4)); // Contains AVITF_* flags |
|
| 809 | + $thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); // same as $strhfccType; |
|
| 810 | + $thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4); |
|
| 811 | + $thisfile_riff_raw_strh_current['dwFlags'] = $this->EitherEndian2Int(substr($strhData, 8, 4)); // Contains AVITF_* flags |
|
| 812 | 812 | $thisfile_riff_raw_strh_current['wPriority'] = $this->EitherEndian2Int(substr($strhData, 12, 2)); |
| 813 | 813 | $thisfile_riff_raw_strh_current['wLanguage'] = $this->EitherEndian2Int(substr($strhData, 14, 2)); |
| 814 | 814 | $thisfile_riff_raw_strh_current['dwInitialFrames'] = $this->EitherEndian2Int(substr($strhData, 16, 4)); |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | |
| 824 | 824 | $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strh_current['fccHandler']); |
| 825 | 825 | $thisfile_video['fourcc'] = $thisfile_riff_raw_strh_current['fccHandler']; |
| 826 | - if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { |
|
| 826 | + if ( ! $thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { |
|
| 827 | 827 | $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']); |
| 828 | 828 | $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']; |
| 829 | 829 | } |
@@ -877,12 +877,12 @@ discard block |
||
| 877 | 877 | case 'HFYU': // Huffman Lossless Codec |
| 878 | 878 | case 'IRAW': // Intel YUV Uncompressed |
| 879 | 879 | case 'YUY2': // Uncompressed YUV 4:2:2 |
| 880 | - $thisfile_video['lossless'] = true; |
|
| 880 | + $thisfile_video['lossless'] = true; |
|
| 881 | 881 | //$thisfile_video['bits_per_sample'] = 24; |
| 882 | 882 | break; |
| 883 | 883 | |
| 884 | 884 | default: |
| 885 | - $thisfile_video['lossless'] = false; |
|
| 885 | + $thisfile_video['lossless'] = false; |
|
| 886 | 886 | //$thisfile_video['bits_per_sample'] = 24; |
| 887 | 887 | break; |
| 888 | 888 | } |
@@ -914,7 +914,7 @@ discard block |
||
| 914 | 914 | $info['fileformat'] = 'cda'; |
| 915 | 915 | unset($info['mime_type']); |
| 916 | 916 | |
| 917 | - $thisfile_audio_dataformat = 'cda'; |
|
| 917 | + $thisfile_audio_dataformat = 'cda'; |
|
| 918 | 918 | |
| 919 | 919 | $info['avdataoffset'] = 44; |
| 920 | 920 | |
@@ -922,10 +922,10 @@ discard block |
||
| 922 | 922 | // shortcut |
| 923 | 923 | $thisfile_riff_CDDA_fmt_0 = &$thisfile_riff['CDDA']['fmt '][0]; |
| 924 | 924 | |
| 925 | - $thisfile_riff_CDDA_fmt_0['unknown1'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2)); |
|
| 926 | - $thisfile_riff_CDDA_fmt_0['track_num'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2)); |
|
| 927 | - $thisfile_riff_CDDA_fmt_0['disc_id'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4)); |
|
| 928 | - $thisfile_riff_CDDA_fmt_0['start_offset_frame'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4)); |
|
| 925 | + $thisfile_riff_CDDA_fmt_0['unknown1'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2)); |
|
| 926 | + $thisfile_riff_CDDA_fmt_0['track_num'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2)); |
|
| 927 | + $thisfile_riff_CDDA_fmt_0['disc_id'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4)); |
|
| 928 | + $thisfile_riff_CDDA_fmt_0['start_offset_frame'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4)); |
|
| 929 | 929 | $thisfile_riff_CDDA_fmt_0['playtime_frames'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 12, 4)); |
| 930 | 930 | $thisfile_riff_CDDA_fmt_0['unknown6'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 16, 4)); |
| 931 | 931 | $thisfile_riff_CDDA_fmt_0['unknown7'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 20, 4)); |
@@ -974,15 +974,15 @@ discard block |
||
| 974 | 974 | // shortcut |
| 975 | 975 | $thisfile_riff_RIFFsubtype_COMM_0_data = &$thisfile_riff[$RIFFsubtype]['COMM'][0]['data']; |
| 976 | 976 | |
| 977 | - $thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true); |
|
| 978 | - $thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false); |
|
| 979 | - $thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true); |
|
| 980 | - $thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10)); |
|
| 977 | + $thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true); |
|
| 978 | + $thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false); |
|
| 979 | + $thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true); |
|
| 980 | + $thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10)); |
|
| 981 | 981 | |
| 982 | 982 | if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) { |
| 983 | - $thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4); |
|
| 984 | - $CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false); |
|
| 985 | - $thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize); |
|
| 983 | + $thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4); |
|
| 984 | + $CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false); |
|
| 985 | + $thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize); |
|
| 986 | 986 | switch ($thisfile_riff_audio['codec_name']) { |
| 987 | 987 | case 'NONE': |
| 988 | 988 | $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)'; |
@@ -1014,11 +1014,11 @@ discard block |
||
| 1014 | 1014 | } |
| 1015 | 1015 | } |
| 1016 | 1016 | |
| 1017 | - $thisfile_audio['channels'] = $thisfile_riff_audio['channels']; |
|
| 1017 | + $thisfile_audio['channels'] = $thisfile_riff_audio['channels']; |
|
| 1018 | 1018 | if ($thisfile_riff_audio['bits_per_sample'] > 0) { |
| 1019 | 1019 | $thisfile_audio['bits_per_sample'] = $thisfile_riff_audio['bits_per_sample']; |
| 1020 | 1020 | } |
| 1021 | - $thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate']; |
|
| 1021 | + $thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate']; |
|
| 1022 | 1022 | if ($thisfile_audio['sample_rate'] == 0) { |
| 1023 | 1023 | $info['error'][] = 'Corrupted AIFF file: sample_rate == zero'; |
| 1024 | 1024 | return false; |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | |
| 1029 | 1029 | if (isset($thisfile_riff[$RIFFsubtype]['COMT'])) { |
| 1030 | 1030 | $offset = 0; |
| 1031 | - $CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); |
|
| 1031 | + $CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); |
|
| 1032 | 1032 | $offset += 2; |
| 1033 | 1033 | for ($i = 0; $i < $CommentCount; $i++) { |
| 1034 | 1034 | $info['comments_raw'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 4), false); |
@@ -1037,7 +1037,7 @@ discard block |
||
| 1037 | 1037 | $offset += 2; |
| 1038 | 1038 | $CommentLength = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); |
| 1039 | 1039 | $offset += 2; |
| 1040 | - $info['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength); |
|
| 1040 | + $info['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength); |
|
| 1041 | 1041 | $offset += $CommentLength; |
| 1042 | 1042 | |
| 1043 | 1043 | $info['comments_raw'][$i]['timestamp_unix'] = getid3_lib::DateMac2Unix($info['comments_raw'][$i]['timestamp']); |
@@ -1088,12 +1088,12 @@ discard block |
||
| 1088 | 1088 | // shortcut |
| 1089 | 1089 | $thisfile_riff_RIFFsubtype_VHDR_0 = &$thisfile_riff[$RIFFsubtype]['VHDR'][0]; |
| 1090 | 1090 | |
| 1091 | - $thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4)); |
|
| 1092 | - $thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4)); |
|
| 1093 | - $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4)); |
|
| 1094 | - $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2)); |
|
| 1095 | - $thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1)); |
|
| 1096 | - $thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1)); |
|
| 1091 | + $thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4)); |
|
| 1092 | + $thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4)); |
|
| 1093 | + $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4)); |
|
| 1094 | + $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2)); |
|
| 1095 | + $thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1)); |
|
| 1096 | + $thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1)); |
|
| 1097 | 1097 | $thisfile_riff_RIFFsubtype_VHDR_0['Volume'] = getid3_lib::FixedPoint16_16(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 16, 4)); |
| 1098 | 1098 | |
| 1099 | 1099 | $thisfile_audio['sample_rate'] = $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec']; |
@@ -1144,7 +1144,7 @@ discard block |
||
| 1144 | 1144 | } |
| 1145 | 1145 | |
| 1146 | 1146 | $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $ActualBitsPerSample * $thisfile_audio['channels']; |
| 1147 | - if (!empty($thisfile_audio['bitrate'])) { |
|
| 1147 | + if ( ! empty($thisfile_audio['bitrate'])) { |
|
| 1148 | 1148 | $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($thisfile_audio['bitrate'] / 8); |
| 1149 | 1149 | } |
| 1150 | 1150 | break; |
@@ -1153,7 +1153,7 @@ discard block |
||
| 1153 | 1153 | $info['fileformat'] = 'vcd'; // Asume Video CD |
| 1154 | 1154 | $info['mime_type'] = 'video/mpeg'; |
| 1155 | 1155 | |
| 1156 | - if (!empty($thisfile_riff['CDXA']['data'][0]['size'])) { |
|
| 1156 | + if ( ! empty($thisfile_riff['CDXA']['data'][0]['size'])) { |
|
| 1157 | 1157 | getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, true); |
| 1158 | 1158 | |
| 1159 | 1159 | $getid3_temp = new getID3(); |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | $ID3v2_key_good = 'id3 '; |
| 1184 | 1184 | $ID3v2_keys_bad = array('ID3 ', 'tag '); |
| 1185 | 1185 | foreach ($ID3v2_keys_bad as $ID3v2_key_bad) { |
| 1186 | - if (isset($thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]) && !array_key_exists($ID3v2_key_good, $thisfile_riff[$RIFFsubtype])) { |
|
| 1186 | + if (isset($thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]) && ! array_key_exists($ID3v2_key_good, $thisfile_riff[$RIFFsubtype])) { |
|
| 1187 | 1187 | $thisfile_riff[$RIFFsubtype][$ID3v2_key_good] = $thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]; |
| 1188 | 1188 | $info['warning'][] = 'mapping "'.$ID3v2_key_bad.'" chunk to "'.$ID3v2_key_good.'"'; |
| 1189 | 1189 | } |
@@ -1214,11 +1214,11 @@ discard block |
||
| 1214 | 1214 | self::parseComments($thisfile_riff['AVI ']['INFO'], $thisfile_riff['comments']); |
| 1215 | 1215 | } |
| 1216 | 1216 | |
| 1217 | - if (empty($thisfile_audio['encoder']) && !empty($info['mpeg']['audio']['LAME']['short_version'])) { |
|
| 1217 | + if (empty($thisfile_audio['encoder']) && ! empty($info['mpeg']['audio']['LAME']['short_version'])) { |
|
| 1218 | 1218 | $thisfile_audio['encoder'] = $info['mpeg']['audio']['LAME']['short_version']; |
| 1219 | 1219 | } |
| 1220 | 1220 | |
| 1221 | - if (!isset($info['playtime_seconds'])) { |
|
| 1221 | + if ( ! isset($info['playtime_seconds'])) { |
|
| 1222 | 1222 | $info['playtime_seconds'] = 0; |
| 1223 | 1223 | } |
| 1224 | 1224 | if (isset($thisfile_riff_raw['strh'][0]['dwLength']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { |
@@ -1231,19 +1231,19 @@ discard block |
||
| 1231 | 1231 | if ($info['playtime_seconds'] > 0) { |
| 1232 | 1232 | if (isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { |
| 1233 | 1233 | |
| 1234 | - if (!isset($info['bitrate'])) { |
|
| 1234 | + if ( ! isset($info['bitrate'])) { |
|
| 1235 | 1235 | $info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); |
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | - } elseif (isset($thisfile_riff_audio) && !isset($thisfile_riff_video)) { |
|
| 1238 | + } elseif (isset($thisfile_riff_audio) && ! isset($thisfile_riff_video)) { |
|
| 1239 | 1239 | |
| 1240 | - if (!isset($thisfile_audio['bitrate'])) { |
|
| 1240 | + if ( ! isset($thisfile_audio['bitrate'])) { |
|
| 1241 | 1241 | $thisfile_audio['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); |
| 1242 | 1242 | } |
| 1243 | 1243 | |
| 1244 | - } elseif (!isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { |
|
| 1244 | + } elseif ( ! isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { |
|
| 1245 | 1245 | |
| 1246 | - if (!isset($thisfile_video['bitrate'])) { |
|
| 1246 | + if ( ! isset($thisfile_video['bitrate'])) { |
|
| 1247 | 1247 | $thisfile_video['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); |
| 1248 | 1248 | } |
| 1249 | 1249 | |
@@ -1274,10 +1274,10 @@ discard block |
||
| 1274 | 1274 | $thisfile_audio['channels'] = $info['mpeg']['audio']['channels']; |
| 1275 | 1275 | $thisfile_audio['bitrate'] = $info['mpeg']['audio']['bitrate']; |
| 1276 | 1276 | $thisfile_audio['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); |
| 1277 | - if (!empty($info['mpeg']['audio']['codec'])) { |
|
| 1277 | + if ( ! empty($info['mpeg']['audio']['codec'])) { |
|
| 1278 | 1278 | $thisfile_audio['codec'] = $info['mpeg']['audio']['codec'].' '.$thisfile_audio['codec']; |
| 1279 | 1279 | } |
| 1280 | - if (!empty($thisfile_audio['streams'])) { |
|
| 1280 | + if ( ! empty($thisfile_audio['streams'])) { |
|
| 1281 | 1281 | foreach ($thisfile_audio['streams'] as $streamnumber => $streamdata) { |
| 1282 | 1282 | if ($streamdata['dataformat'] == $thisfile_audio_dataformat) { |
| 1283 | 1283 | $thisfile_audio['streams'][$streamnumber]['sample_rate'] = $thisfile_audio['sample_rate']; |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | 1296 | |
| 1297 | - if (!empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) { |
|
| 1297 | + if ( ! empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) { |
|
| 1298 | 1298 | switch ($thisfile_audio_dataformat) { |
| 1299 | 1299 | case 'ac3': |
| 1300 | 1300 | // ignore bits_per_sample |
@@ -1347,23 +1347,23 @@ discard block |
||
| 1347 | 1347 | $this->fseek($startoffset); |
| 1348 | 1348 | $maxoffset = min($maxoffset, $info['avdataend']); |
| 1349 | 1349 | $AMVheader = $this->fread(284); |
| 1350 | - if (substr($AMVheader, 0, 8) != 'hdrlamvh') { |
|
| 1351 | - throw new Exception('expecting "hdrlamv" at offset '.($startoffset + 0).', found "'.substr($AMVheader, 0, 8).'"'); |
|
| 1350 | + if (substr($AMVheader, 0, 8) != 'hdrlamvh') { |
|
| 1351 | + throw new Exception('expecting "hdrlamv" at offset '.($startoffset + 0).', found "'.substr($AMVheader, 0, 8).'"'); |
|
| 1352 | 1352 | } |
| 1353 | - if (substr($AMVheader, 8, 4) != "\x38\x00\x00\x00") { // "amvh" chunk size, hardcoded to 0x38 = 56 bytes |
|
| 1354 | - throw new Exception('expecting "0x38000000" at offset '.($startoffset + 8).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 8, 4)).'"'); |
|
| 1353 | + if (substr($AMVheader, 8, 4) != "\x38\x00\x00\x00") { // "amvh" chunk size, hardcoded to 0x38 = 56 bytes |
|
| 1354 | + throw new Exception('expecting "0x38000000" at offset '.($startoffset + 8).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 8, 4)).'"'); |
|
| 1355 | 1355 | } |
| 1356 | 1356 | $RIFFchunk = array(); |
| 1357 | - $RIFFchunk['amvh']['us_per_frame'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 12, 4)); |
|
| 1358 | - $RIFFchunk['amvh']['reserved28'] = substr($AMVheader, 16, 28); // null? reserved? |
|
| 1359 | - $RIFFchunk['amvh']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 44, 4)); |
|
| 1360 | - $RIFFchunk['amvh']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 48, 4)); |
|
| 1361 | - $RIFFchunk['amvh']['frame_rate_int'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 52, 4)); |
|
| 1362 | - $RIFFchunk['amvh']['reserved0'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 56, 4)); // 1? reserved? |
|
| 1363 | - $RIFFchunk['amvh']['reserved1'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 60, 4)); // 0? reserved? |
|
| 1364 | - $RIFFchunk['amvh']['runtime_sec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 64, 1)); |
|
| 1365 | - $RIFFchunk['amvh']['runtime_min'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 65, 1)); |
|
| 1366 | - $RIFFchunk['amvh']['runtime_hrs'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 66, 2)); |
|
| 1357 | + $RIFFchunk['amvh']['us_per_frame'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 12, 4)); |
|
| 1358 | + $RIFFchunk['amvh']['reserved28'] = substr($AMVheader, 16, 28); // null? reserved? |
|
| 1359 | + $RIFFchunk['amvh']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 44, 4)); |
|
| 1360 | + $RIFFchunk['amvh']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 48, 4)); |
|
| 1361 | + $RIFFchunk['amvh']['frame_rate_int'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 52, 4)); |
|
| 1362 | + $RIFFchunk['amvh']['reserved0'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 56, 4)); // 1? reserved? |
|
| 1363 | + $RIFFchunk['amvh']['reserved1'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 60, 4)); // 0? reserved? |
|
| 1364 | + $RIFFchunk['amvh']['runtime_sec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 64, 1)); |
|
| 1365 | + $RIFFchunk['amvh']['runtime_min'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 65, 1)); |
|
| 1366 | + $RIFFchunk['amvh']['runtime_hrs'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 66, 2)); |
|
| 1367 | 1367 | |
| 1368 | 1368 | $info['video']['frame_rate'] = 1000000 / $RIFFchunk['amvh']['us_per_frame']; |
| 1369 | 1369 | $info['video']['resolution_x'] = $RIFFchunk['amvh']['resolution_x']; |
@@ -1372,12 +1372,12 @@ discard block |
||
| 1372 | 1372 | |
| 1373 | 1373 | // 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 |
| 1374 | 1374 | |
| 1375 | - if (substr($AMVheader, 68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") { |
|
| 1376 | - throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset + 68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 68, 20)).'"'); |
|
| 1375 | + if (substr($AMVheader, 68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") { |
|
| 1376 | + throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset + 68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 68, 20)).'"'); |
|
| 1377 | 1377 | } |
| 1378 | 1378 | // followed by 56 bytes of null: substr($AMVheader, 88, 56) -> 144 |
| 1379 | - if (substr($AMVheader, 144, 8) != 'strf'."\x24\x00\x00\x00") { |
|
| 1380 | - throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144, 8)).'"'); |
|
| 1379 | + if (substr($AMVheader, 144, 8) != 'strf'."\x24\x00\x00\x00") { |
|
| 1380 | + throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144, 8)).'"'); |
|
| 1381 | 1381 | } |
| 1382 | 1382 | // followed by 36 bytes of null: substr($AMVheader, 144, 36) -> 180 |
| 1383 | 1383 | |
@@ -1385,8 +1385,8 @@ discard block |
||
| 1385 | 1385 | throw new Exception('expecting "LIST<0x00000000>strlstrh<0x30000000>" at offset '.($startoffset + 188).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 188, 20)).'"'); |
| 1386 | 1386 | } |
| 1387 | 1387 | // followed by 48 bytes of null: substr($AMVheader, 208, 48) -> 256 |
| 1388 | - if (substr($AMVheader, 256, 8) != 'strf'."\x14\x00\x00\x00") { |
|
| 1389 | - throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256, 8)).'"'); |
|
| 1388 | + if (substr($AMVheader, 256, 8) != 'strf'."\x14\x00\x00\x00") { |
|
| 1389 | + throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256, 8)).'"'); |
|
| 1390 | 1390 | } |
| 1391 | 1391 | // followed by 20 bytes of a modified WAVEFORMATEX: |
| 1392 | 1392 | // typedef struct { |
@@ -1399,14 +1399,14 @@ discard block |
||
| 1399 | 1399 | // WORD cbSize; //(Fixme: this seems to be 0 in AMV files) |
| 1400 | 1400 | // WORD reserved; |
| 1401 | 1401 | // } WAVEFORMATEX; |
| 1402 | - $RIFFchunk['strf']['wformattag'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 264, 2)); |
|
| 1403 | - $RIFFchunk['strf']['nchannels'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 266, 2)); |
|
| 1404 | - $RIFFchunk['strf']['nsamplespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 268, 4)); |
|
| 1405 | - $RIFFchunk['strf']['navgbytespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 272, 4)); |
|
| 1406 | - $RIFFchunk['strf']['nblockalign'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 276, 2)); |
|
| 1407 | - $RIFFchunk['strf']['wbitspersample'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 278, 2)); |
|
| 1408 | - $RIFFchunk['strf']['cbsize'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 280, 2)); |
|
| 1409 | - $RIFFchunk['strf']['reserved'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 282, 2)); |
|
| 1402 | + $RIFFchunk['strf']['wformattag'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 264, 2)); |
|
| 1403 | + $RIFFchunk['strf']['nchannels'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 266, 2)); |
|
| 1404 | + $RIFFchunk['strf']['nsamplespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 268, 4)); |
|
| 1405 | + $RIFFchunk['strf']['navgbytespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 272, 4)); |
|
| 1406 | + $RIFFchunk['strf']['nblockalign'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 276, 2)); |
|
| 1407 | + $RIFFchunk['strf']['wbitspersample'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 278, 2)); |
|
| 1408 | + $RIFFchunk['strf']['cbsize'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 280, 2)); |
|
| 1409 | + $RIFFchunk['strf']['reserved'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 282, 2)); |
|
| 1410 | 1410 | |
| 1411 | 1411 | |
| 1412 | 1412 | $info['audio']['lossless'] = false; |
@@ -1441,8 +1441,8 @@ discard block |
||
| 1441 | 1441 | while ($this->ftell() < $maxoffset) { |
| 1442 | 1442 | $chunknamesize = $this->fread(8); |
| 1443 | 1443 | //$chunkname = substr($chunknamesize, 0, 4); |
| 1444 | - $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 |
|
| 1445 | - $chunksize = $this->EitherEndian2Int(substr($chunknamesize, 4, 4)); |
|
| 1444 | + $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 |
|
| 1445 | + $chunksize = $this->EitherEndian2Int(substr($chunknamesize, 4, 4)); |
|
| 1446 | 1446 | //if (strlen(trim($chunkname, "\x00")) < 4) { |
| 1447 | 1447 | if (strlen($chunkname) < 4) { |
| 1448 | 1448 | $this->error('Expecting chunk name at offset '.($this->ftell() - 8).' but found nothing. Aborting RIFF parsing.'); |
@@ -1464,11 +1464,11 @@ discard block |
||
| 1464 | 1464 | $RIFFchunk[$listname]['offset'] = $this->ftell() - 4; |
| 1465 | 1465 | $RIFFchunk[$listname]['size'] = $chunksize; |
| 1466 | 1466 | |
| 1467 | - if (!$FoundAllChunksWeNeed) { |
|
| 1467 | + if ( ! $FoundAllChunksWeNeed) { |
|
| 1468 | 1468 | $WhereWeWere = $this->ftell(); |
| 1469 | 1469 | $AudioChunkHeader = $this->fread(12); |
| 1470 | - $AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2); |
|
| 1471 | - $AudioChunkStreamType = substr($AudioChunkHeader, 2, 2); |
|
| 1470 | + $AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2); |
|
| 1471 | + $AudioChunkStreamType = substr($AudioChunkHeader, 2, 2); |
|
| 1472 | 1472 | $AudioChunkSize = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4)); |
| 1473 | 1473 | |
| 1474 | 1474 | if ($AudioChunkStreamType == 'wb') { |
@@ -1507,7 +1507,7 @@ discard block |
||
| 1507 | 1507 | if (empty($getid3_temp->info['error'])) { |
| 1508 | 1508 | $info['audio'] = $getid3_temp->info['audio']; |
| 1509 | 1509 | $info['ac3'] = $getid3_temp->info['ac3']; |
| 1510 | - if (!empty($getid3_temp->info['warning'])) { |
|
| 1510 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
| 1511 | 1511 | foreach ($getid3_temp->info['warning'] as $key => $value) { |
| 1512 | 1512 | $info['warning'][] = $value; |
| 1513 | 1513 | } |
@@ -1523,7 +1523,7 @@ discard block |
||
| 1523 | 1523 | |
| 1524 | 1524 | } else { |
| 1525 | 1525 | |
| 1526 | - if (!isset($RIFFchunk[$listname])) { |
|
| 1526 | + if ( ! isset($RIFFchunk[$listname])) { |
|
| 1527 | 1527 | $RIFFchunk[$listname] = array(); |
| 1528 | 1528 | } |
| 1529 | 1529 | $LISTchunkParent = $listname; |
@@ -1599,7 +1599,7 @@ discard block |
||
| 1599 | 1599 | if (empty($getid3_temp->info['error'])) { |
| 1600 | 1600 | $info['audio'] = $getid3_temp->info['audio']; |
| 1601 | 1601 | $info['ac3'] = $getid3_temp->info['ac3']; |
| 1602 | - if (!empty($getid3_temp->info['warning'])) { |
|
| 1602 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
| 1603 | 1603 | foreach ($getid3_temp->info['warning'] as $newerror) { |
| 1604 | 1604 | $this->warning('getid3_ac3() says: ['.$newerror.']'); |
| 1605 | 1605 | } |
@@ -1619,7 +1619,7 @@ discard block |
||
| 1619 | 1619 | $info['audio'] = $getid3_temp->info['audio']; |
| 1620 | 1620 | $info['dts'] = $getid3_temp->info['dts']; |
| 1621 | 1621 | $info['playtime_seconds'] = $getid3_temp->info['playtime_seconds']; // may not match RIFF calculations since DTS-WAV often used 14/16 bit-word packing |
| 1622 | - if (!empty($getid3_temp->info['warning'])) { |
|
| 1622 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
| 1623 | 1623 | foreach ($getid3_temp->info['warning'] as $newerror) { |
| 1624 | 1624 | $this->warning('getid3_dts() says: ['.$newerror.']'); |
| 1625 | 1625 | } |
@@ -1680,7 +1680,7 @@ discard block |
||
| 1680 | 1680 | // break; |
| 1681 | 1681 | |
| 1682 | 1682 | default: |
| 1683 | - if (!empty($LISTchunkParent) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) { |
|
| 1683 | + if ( ! empty($LISTchunkParent) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) { |
|
| 1684 | 1684 | $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; |
| 1685 | 1685 | $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['size'] = $RIFFchunk[$chunkname][$thisindex]['size']; |
| 1686 | 1686 | unset($RIFFchunk[$chunkname][$thisindex]['offset']); |
@@ -1800,7 +1800,7 @@ discard block |
||
| 1800 | 1800 | foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) { |
| 1801 | 1801 | if (trim($commentdata['data']) != '') { |
| 1802 | 1802 | if (isset($CommentsTargetArray[$value])) { |
| 1803 | - $CommentsTargetArray[$value][] = trim($commentdata['data']); |
|
| 1803 | + $CommentsTargetArray[$value][] = trim($commentdata['data']); |
|
| 1804 | 1804 | } else { |
| 1805 | 1805 | $CommentsTargetArray[$value] = array(trim($commentdata['data'])); |
| 1806 | 1806 | } |
@@ -1816,14 +1816,14 @@ discard block |
||
| 1816 | 1816 | $WaveFormatEx['raw'] = array(); |
| 1817 | 1817 | $WaveFormatEx_raw = &$WaveFormatEx['raw']; |
| 1818 | 1818 | |
| 1819 | - $WaveFormatEx_raw['wFormatTag'] = substr($WaveFormatExData, 0, 2); |
|
| 1820 | - $WaveFormatEx_raw['nChannels'] = substr($WaveFormatExData, 2, 2); |
|
| 1821 | - $WaveFormatEx_raw['nSamplesPerSec'] = substr($WaveFormatExData, 4, 4); |
|
| 1822 | - $WaveFormatEx_raw['nAvgBytesPerSec'] = substr($WaveFormatExData, 8, 4); |
|
| 1819 | + $WaveFormatEx_raw['wFormatTag'] = substr($WaveFormatExData, 0, 2); |
|
| 1820 | + $WaveFormatEx_raw['nChannels'] = substr($WaveFormatExData, 2, 2); |
|
| 1821 | + $WaveFormatEx_raw['nSamplesPerSec'] = substr($WaveFormatExData, 4, 4); |
|
| 1822 | + $WaveFormatEx_raw['nAvgBytesPerSec'] = substr($WaveFormatExData, 8, 4); |
|
| 1823 | 1823 | $WaveFormatEx_raw['nBlockAlign'] = substr($WaveFormatExData, 12, 2); |
| 1824 | 1824 | $WaveFormatEx_raw['wBitsPerSample'] = substr($WaveFormatExData, 14, 2); |
| 1825 | 1825 | if (strlen($WaveFormatExData) > 16) { |
| 1826 | - $WaveFormatEx_raw['cbSize'] = substr($WaveFormatExData, 16, 2); |
|
| 1826 | + $WaveFormatEx_raw['cbSize'] = substr($WaveFormatExData, 16, 2); |
|
| 1827 | 1827 | } |
| 1828 | 1828 | $WaveFormatEx_raw = array_map('getid3_lib::LittleEndian2Int', $WaveFormatEx_raw); |
| 1829 | 1829 | |
@@ -1852,20 +1852,20 @@ discard block |
||
| 1852 | 1852 | $info['wavpack'] = array(); |
| 1853 | 1853 | $thisfile_wavpack = &$info['wavpack']; |
| 1854 | 1854 | |
| 1855 | - $thisfile_wavpack['version'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 0, 2)); |
|
| 1855 | + $thisfile_wavpack['version'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 0, 2)); |
|
| 1856 | 1856 | if ($thisfile_wavpack['version'] >= 2) { |
| 1857 | - $thisfile_wavpack['bits'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 2, 2)); |
|
| 1857 | + $thisfile_wavpack['bits'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 2, 2)); |
|
| 1858 | 1858 | } |
| 1859 | 1859 | if ($thisfile_wavpack['version'] >= 3) { |
| 1860 | - $thisfile_wavpack['flags_raw'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 4, 2)); |
|
| 1861 | - $thisfile_wavpack['shift'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 6, 2)); |
|
| 1862 | - $thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 8, 4)); |
|
| 1860 | + $thisfile_wavpack['flags_raw'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 4, 2)); |
|
| 1861 | + $thisfile_wavpack['shift'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 6, 2)); |
|
| 1862 | + $thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 8, 4)); |
|
| 1863 | 1863 | $thisfile_wavpack['crc1'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 12, 4)); |
| 1864 | 1864 | $thisfile_wavpack['crc2'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 16, 4)); |
| 1865 | - $thisfile_wavpack['extension'] = substr($WavPackChunkData, 20, 4); |
|
| 1865 | + $thisfile_wavpack['extension'] = substr($WavPackChunkData, 20, 4); |
|
| 1866 | 1866 | $thisfile_wavpack['extra_bc'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 24, 1)); |
| 1867 | 1867 | for ($i = 0; $i <= 2; $i++) { |
| 1868 | - $thisfile_wavpack['extras'][] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1)); |
|
| 1868 | + $thisfile_wavpack['extras'][] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1)); |
|
| 1869 | 1869 | } |
| 1870 | 1870 | |
| 1871 | 1871 | // shortcut |
@@ -1897,11 +1897,11 @@ discard block |
||
| 1897 | 1897 | return true; |
| 1898 | 1898 | } |
| 1899 | 1899 | |
| 1900 | - public static function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian=true) { |
|
| 1900 | + public static function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian = true) { |
|
| 1901 | 1901 | |
| 1902 | - $parsed['biSize'] = substr($BITMAPINFOHEADER, 0, 4); // number of bytes required by the BITMAPINFOHEADER structure |
|
| 1903 | - $parsed['biWidth'] = substr($BITMAPINFOHEADER, 4, 4); // width of the bitmap in pixels |
|
| 1904 | - $parsed['biHeight'] = substr($BITMAPINFOHEADER, 8, 4); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner |
|
| 1902 | + $parsed['biSize'] = substr($BITMAPINFOHEADER, 0, 4); // number of bytes required by the BITMAPINFOHEADER structure |
|
| 1903 | + $parsed['biWidth'] = substr($BITMAPINFOHEADER, 4, 4); // width of the bitmap in pixels |
|
| 1904 | + $parsed['biHeight'] = substr($BITMAPINFOHEADER, 8, 4); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner |
|
| 1905 | 1905 | $parsed['biPlanes'] = substr($BITMAPINFOHEADER, 12, 2); // number of color planes on the target device. In most cases this value must be set to 1 |
| 1906 | 1906 | $parsed['biBitCount'] = substr($BITMAPINFOHEADER, 14, 2); // Specifies the number of bits per pixels |
| 1907 | 1907 | $parsed['biSizeImage'] = substr($BITMAPINFOHEADER, 20, 4); // size of the bitmap data section of the image (the actual pixel data, excluding BITMAPINFOHEADER and RGBQUAD structures) |
@@ -1911,12 +1911,12 @@ discard block |
||
| 1911 | 1911 | $parsed['biClrImportant'] = substr($BITMAPINFOHEADER, 36, 4); // number of color indices that are considered important for displaying the bitmap. If this value is zero, all colors are important |
| 1912 | 1912 | $parsed = array_map('getid3_lib::'.($littleEndian ? 'Little' : 'Big').'Endian2Int', $parsed); |
| 1913 | 1913 | |
| 1914 | - $parsed['fourcc'] = substr($BITMAPINFOHEADER, 16, 4); // compression identifier |
|
| 1914 | + $parsed['fourcc'] = substr($BITMAPINFOHEADER, 16, 4); // compression identifier |
|
| 1915 | 1915 | |
| 1916 | 1916 | return $parsed; |
| 1917 | 1917 | } |
| 1918 | 1918 | |
| 1919 | - public static function ParseDIVXTAG($DIVXTAG, $raw=false) { |
|
| 1919 | + public static function ParseDIVXTAG($DIVXTAG, $raw = false) { |
|
| 1920 | 1920 | // structure from "IDivX" source, Form1.frm, by "Greg Frazier of Daemonic Software Group", email: [email protected], web: http://dsg.cjb.net/ |
| 1921 | 1921 | // source available at http://files.divx-digest.com/download/c663efe7ef8ad2e90bf4af4d3ea6188a/on0SWN2r/edit/IDivX.zip |
| 1922 | 1922 | // 'Byte Layout: '1111111111111111 |
@@ -1929,7 +1929,7 @@ discard block |
||
| 1929 | 1929 | // '5 for Future Additions - 0 '333400000DIVXTAG |
| 1930 | 1930 | // '128 bytes total |
| 1931 | 1931 | |
| 1932 | - static $DIVXTAGgenre = array( |
|
| 1932 | + static $DIVXTAGgenre = array( |
|
| 1933 | 1933 | 0 => 'Action', |
| 1934 | 1934 | 1 => 'Action/Adventure', |
| 1935 | 1935 | 2 => 'Adventure', |
@@ -1962,22 +1962,22 @@ discard block |
||
| 1962 | 1962 | 5 => 'NC-17', |
| 1963 | 1963 | ); |
| 1964 | 1964 | |
| 1965 | - $parsed['title'] = trim(substr($DIVXTAG, 0, 32)); |
|
| 1966 | - $parsed['artist'] = trim(substr($DIVXTAG, 32, 28)); |
|
| 1967 | - $parsed['year'] = intval(trim(substr($DIVXTAG, 60, 4))); |
|
| 1968 | - $parsed['comment'] = trim(substr($DIVXTAG, 64, 48)); |
|
| 1969 | - $parsed['genre_id'] = intval(trim(substr($DIVXTAG, 112, 3))); |
|
| 1970 | - $parsed['rating_id'] = ord(substr($DIVXTAG, 115, 1)); |
|
| 1965 | + $parsed['title'] = trim(substr($DIVXTAG, 0, 32)); |
|
| 1966 | + $parsed['artist'] = trim(substr($DIVXTAG, 32, 28)); |
|
| 1967 | + $parsed['year'] = intval(trim(substr($DIVXTAG, 60, 4))); |
|
| 1968 | + $parsed['comment'] = trim(substr($DIVXTAG, 64, 48)); |
|
| 1969 | + $parsed['genre_id'] = intval(trim(substr($DIVXTAG, 112, 3))); |
|
| 1970 | + $parsed['rating_id'] = ord(substr($DIVXTAG, 115, 1)); |
|
| 1971 | 1971 | //$parsed['padding'] = substr($DIVXTAG, 116, 5); // 5-byte null |
| 1972 | 1972 | //$parsed['magic'] = substr($DIVXTAG, 121, 7); // "DIVXTAG" |
| 1973 | 1973 | |
| 1974 | - $parsed['genre'] = (isset($DIVXTAGgenre[$parsed['genre_id']]) ? $DIVXTAGgenre[$parsed['genre_id']] : $parsed['genre_id']); |
|
| 1974 | + $parsed['genre'] = (isset($DIVXTAGgenre[$parsed['genre_id']]) ? $DIVXTAGgenre[$parsed['genre_id']] : $parsed['genre_id']); |
|
| 1975 | 1975 | $parsed['rating'] = (isset($DIVXTAGrating[$parsed['rating_id']]) ? $DIVXTAGrating[$parsed['rating_id']] : $parsed['rating_id']); |
| 1976 | 1976 | |
| 1977 | - if (!$raw) { |
|
| 1977 | + if ( ! $raw) { |
|
| 1978 | 1978 | unset($parsed['genre_id'], $parsed['rating_id']); |
| 1979 | 1979 | foreach ($parsed as $key => $value) { |
| 1980 | - if (!$value === '') { |
|
| 1980 | + if ( ! $value === '') { |
|
| 1981 | 1981 | unset($parsed['key']); |
| 1982 | 1982 | } |
| 1983 | 1983 | } |
@@ -2576,7 +2576,7 @@ discard block |
||
| 2576 | 2576 | return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); |
| 2577 | 2577 | } |
| 2578 | 2578 | |
| 2579 | - private function EitherEndian2Int($byteword, $signed=false) { |
|
| 2579 | + private function EitherEndian2Int($byteword, $signed = false) { |
|
| 2580 | 2580 | if ($this->container == 'riff') { |
| 2581 | 2581 | return getid3_lib::LittleEndian2Int($byteword, $signed); |
| 2582 | 2582 | } |
@@ -234,6 +234,9 @@ discard block |
||
| 234 | 234 | return true; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | + /** |
|
| 238 | + * @param integer $length |
|
| 239 | + */ |
|
| 237 | 240 | private function readHeaderBSI($length) { |
| 238 | 241 | $data = substr($this->AC3header['bsi'], $this->BSIoffset, $length); |
| 239 | 242 | $this->BSIoffset += $length; |
@@ -323,6 +326,9 @@ discard block |
||
| 323 | 326 | return (isset($dolbySurroundModeLookup[$dsurmod]) ? $dolbySurroundModeLookup[$dsurmod] : false); |
| 324 | 327 | } |
| 325 | 328 | |
| 329 | + /** |
|
| 330 | + * @param boolean $lfeon |
|
| 331 | + */ |
|
| 326 | 332 | public static function channelsEnabledLookup($acmod, $lfeon) { |
| 327 | 333 | $lookup = array( |
| 328 | 334 | 'ch1'=>(bool) ($acmod == 0), |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | class getid3_ac3 extends getid3_handler |
| 19 | 19 | { |
| 20 | - private $AC3header = array(); |
|
| 21 | - private $BSIoffset = 0; |
|
| 20 | + private $AC3header = array(); |
|
| 21 | + private $BSIoffset = 0; |
|
| 22 | 22 | |
| 23 | - const syncword = "\x0B\x77"; |
|
| 23 | + const syncword = "\x0B\x77"; |
|
| 24 | 24 | |
| 25 | 25 | public function Analyze() { |
| 26 | 26 | $info = &$this->getid3->info; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | // If this standard is extended by the addition of additional elements or features, a value of bsid greater than 8 will be used. |
| 97 | 97 | // Decoders built to this version of the standard will not be able to decode versions with bsid greater than 8. |
| 98 | 98 | $this->error('Bit stream identification is version '.$thisfile_ac3_raw_bsi['bsid'].', but getID3() only understands up to version 8'); |
| 99 | - unset($info['ac3']); |
|
| 99 | + unset($info['ac3']); |
|
| 100 | 100 | return false; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $thisfile_ac3_raw['synchinfo']['synchword'] = self::syncword; |
| 62 | 62 | $offset = 2; |
| 63 | 63 | } else { |
| 64 | - if (!$this->isDependencyFor('matroska')) { |
|
| 64 | + if ( ! $this->isDependencyFor('matroska')) { |
|
| 65 | 65 | unset($info['fileformat'], $info['ac3']); |
| 66 | 66 | return $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($this->AC3header['syncinfo'], 0, 2)).'"'); |
| 67 | 67 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | $thisfile_ac3['service_type'] = self::serviceTypeLookup($thisfile_ac3_raw_bsi['bsmod'], $thisfile_ac3_raw_bsi['acmod']); |
| 107 | 107 | $ac3_coding_mode = self::audioCodingModeLookup($thisfile_ac3_raw_bsi['acmod']); |
| 108 | - foreach($ac3_coding_mode as $key => $value) { |
|
| 108 | + foreach ($ac3_coding_mode as $key => $value) { |
|
| 109 | 109 | $thisfile_ac3[$key] = $value; |
| 110 | 110 | } |
| 111 | 111 | switch ($thisfile_ac3_raw_bsi['acmod']) { |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $serviceTypeLookup[6][$i] = 'associated service: emergency (E)'; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - $serviceTypeLookup[7][1] = 'associated service: voice over (VO)'; |
|
| 267 | + $serviceTypeLookup[7][1] = 'associated service: voice over (VO)'; |
|
| 268 | 268 | for ($i = 2; $i <= 7; $i++) { |
| 269 | 269 | $serviceTypeLookup[7][$i] = 'main audio service: karaoke'; |
| 270 | 270 | } |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | public static function audioCodingModeLookup($acmod) { |
| 276 | 276 | // array(channel configuration, # channels (not incl LFE), channel order) |
| 277 | - static $audioCodingModeLookup = array ( |
|
| 277 | + static $audioCodingModeLookup = array( |
|
| 278 | 278 | 0 => array('channel_config'=>'1+1', 'num_channels'=>2, 'channel_order'=>'Ch1,Ch2'), |
| 279 | 279 | 1 => array('channel_config'=>'1/0', 'num_channels'=>1, 'channel_order'=>'C'), |
| 280 | 280 | 2 => array('channel_config'=>'2/0', 'num_channels'=>2, 'channel_order'=>'L,R'), |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | switch ($acmod) { |
| 338 | 338 | case 4: |
| 339 | 339 | case 5: |
| 340 | - $lookup['surround_mono'] = true; |
|
| 340 | + $lookup['surround_mono'] = true; |
|
| 341 | 341 | break; |
| 342 | 342 | case 6: |
| 343 | 343 | case 7: |
@@ -410,11 +410,11 @@ discard block |
||
| 410 | 410 | |
| 411 | 411 | public static function frameSizeLookup($frmsizecod, $fscod) { |
| 412 | 412 | $padding = (bool) ($frmsizecod % 2); |
| 413 | - $framesizeid = floor($frmsizecod / 2); |
|
| 413 | + $framesizeid = floor($frmsizecod / 2); |
|
| 414 | 414 | |
| 415 | 415 | static $frameSizeLookup = array(); |
| 416 | 416 | if (empty($frameSizeLookup)) { |
| 417 | - $frameSizeLookup = array ( |
|
| 417 | + $frameSizeLookup = array( |
|
| 418 | 418 | 0 => array(128, 138, 192), |
| 419 | 419 | 1 => array(40, 160, 174, 240), |
| 420 | 420 | 2 => array(48, 192, 208, 288), |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | public static function bitrateLookup($frmsizecod) { |
| 447 | - $framesizeid = floor($frmsizecod / 2); |
|
| 447 | + $framesizeid = floor($frmsizecod / 2); |
|
| 448 | 448 | |
| 449 | 449 | static $bitrateLookup = array( |
| 450 | 450 | 0 => 32000, |
@@ -139,6 +139,10 @@ |
||
| 139 | 139 | return true; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | + /** |
|
| 143 | + * @param string $bin |
|
| 144 | + * @param integer $length |
|
| 145 | + */ |
|
| 142 | 146 | private function readBinData($bin, $length) { |
| 143 | 147 | $data = substr($bin, $this->readBinDataOffset, $length); |
| 144 | 148 | $this->readBinDataOffset += $length; |
@@ -21,20 +21,20 @@ discard block |
||
| 21 | 21 | class getid3_dts extends getid3_handler |
| 22 | 22 | { |
| 23 | 23 | /** |
| 24 | - * Default DTS syncword used in native .cpt or .dts formats |
|
| 25 | - */ |
|
| 26 | - const syncword = "\x7F\xFE\x80\x01"; |
|
| 24 | + * Default DTS syncword used in native .cpt or .dts formats |
|
| 25 | + */ |
|
| 26 | + const syncword = "\x7F\xFE\x80\x01"; |
|
| 27 | 27 | |
| 28 | 28 | private $readBinDataOffset = 0; |
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Possible syncwords indicating bitstream encoding |
|
| 32 | - */ |
|
| 33 | - public static $syncwords = array( |
|
| 34 | - 0 => "\x7F\xFE\x80\x01", // raw big-endian |
|
| 35 | - 1 => "\xFE\x7F\x01\x80", // raw little-endian |
|
| 36 | - 2 => "\x1F\xFF\xE8\x00", // 14-bit big-endian |
|
| 37 | - 3 => "\xFF\x1F\x00\xE8"); // 14-bit little-endian |
|
| 30 | + /** |
|
| 31 | + * Possible syncwords indicating bitstream encoding |
|
| 32 | + */ |
|
| 33 | + public static $syncwords = array( |
|
| 34 | + 0 => "\x7F\xFE\x80\x01", // raw big-endian |
|
| 35 | + 1 => "\xFE\x7F\x01\x80", // raw little-endian |
|
| 36 | + 2 => "\x1F\xFF\xE8\x00", // 14-bit big-endian |
|
| 37 | + 3 => "\xFF\x1F\x00\xE8"); // 14-bit little-endian |
|
| 38 | 38 | |
| 39 | 39 | public function Analyze() { |
| 40 | 40 | $info = &$this->getid3->info; |
@@ -45,18 +45,18 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | // check syncword |
| 47 | 47 | $sync = substr($DTSheader, 0, 4); |
| 48 | - if (($encoding = array_search($sync, self::$syncwords)) !== false) { |
|
| 48 | + if (($encoding = array_search($sync, self::$syncwords)) !== false) { |
|
| 49 | 49 | |
| 50 | - $info['dts']['raw']['magic'] = $sync; |
|
| 50 | + $info['dts']['raw']['magic'] = $sync; |
|
| 51 | 51 | $this->readBinDataOffset = 32; |
| 52 | 52 | |
| 53 | - } elseif ($this->isDependencyFor('matroska')) { |
|
| 53 | + } elseif ($this->isDependencyFor('matroska')) { |
|
| 54 | 54 | |
| 55 | 55 | // Matroska contains DTS without syncword encoded as raw big-endian format |
| 56 | 56 | $encoding = 0; |
| 57 | 57 | $this->readBinDataOffset = 0; |
| 58 | 58 | |
| 59 | - } else { |
|
| 59 | + } else { |
|
| 60 | 60 | |
| 61 | 61 | unset($info['fileformat']); |
| 62 | 62 | return $this->error('Expecting "'.implode('| ', array_map('getid3_lib::PrintHexBytes', self::$syncwords)).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($sync).'"'); |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * Possible syncwords indicating bitstream encoding |
| 32 | 32 | */ |
| 33 | 33 | public static $syncwords = array( |
| 34 | - 0 => "\x7F\xFE\x80\x01", // raw big-endian |
|
| 35 | - 1 => "\xFE\x7F\x01\x80", // raw little-endian |
|
| 36 | - 2 => "\x1F\xFF\xE8\x00", // 14-bit big-endian |
|
| 34 | + 0 => "\x7F\xFE\x80\x01", // raw big-endian |
|
| 35 | + 1 => "\xFE\x7F\x01\x80", // raw little-endian |
|
| 36 | + 2 => "\x1F\xFF\xE8\x00", // 14-bit big-endian |
|
| 37 | 37 | 3 => "\xFF\x1F\x00\xE8"); // 14-bit little-endian |
| 38 | 38 | |
| 39 | 39 | public function Analyze() { |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | for ($word_offset = 0; $word_offset <= strlen($DTSheader); $word_offset += 2) { |
| 69 | 69 | switch ($encoding) { |
| 70 | 70 | case 0: // raw big-endian |
| 71 | - $fhBS .= getid3_lib::BigEndian2Bin( substr($DTSheader, $word_offset, 2) ); |
|
| 71 | + $fhBS .= getid3_lib::BigEndian2Bin(substr($DTSheader, $word_offset, 2)); |
|
| 72 | 72 | break; |
| 73 | 73 | case 1: // raw little-endian |
| 74 | - $fhBS .= getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2))); |
|
| 74 | + $fhBS .= getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2))); |
|
| 75 | 75 | break; |
| 76 | 76 | case 2: // 14-bit big-endian |
| 77 | - $fhBS .= substr(getid3_lib::BigEndian2Bin( substr($DTSheader, $word_offset, 2) ), 2, 14); |
|
| 77 | + $fhBS .= substr(getid3_lib::BigEndian2Bin(substr($DTSheader, $word_offset, 2)), 2, 14); |
|
| 78 | 78 | break; |
| 79 | 79 | case 3: // 14-bit little-endian |
| 80 | 80 | $fhBS .= substr(getid3_lib::BigEndian2Bin(strrev(substr($DTSheader, $word_offset, 2))), 2, 14); |
@@ -82,42 +82,42 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $info['dts']['raw']['frame_type'] = $this->readBinData($fhBS, 1); |
|
| 86 | - $info['dts']['raw']['deficit_samples'] = $this->readBinData($fhBS, 5); |
|
| 87 | - $info['dts']['flags']['crc_present'] = (bool) $this->readBinData($fhBS, 1); |
|
| 88 | - $info['dts']['raw']['pcm_sample_blocks'] = $this->readBinData($fhBS, 7); |
|
| 89 | - $info['dts']['raw']['frame_byte_size'] = $this->readBinData($fhBS, 14); |
|
| 90 | - $info['dts']['raw']['channel_arrangement'] = $this->readBinData($fhBS, 6); |
|
| 91 | - $info['dts']['raw']['sample_frequency'] = $this->readBinData($fhBS, 4); |
|
| 92 | - $info['dts']['raw']['bitrate'] = $this->readBinData($fhBS, 5); |
|
| 93 | - $info['dts']['flags']['embedded_downmix'] = (bool) $this->readBinData($fhBS, 1); |
|
| 94 | - $info['dts']['flags']['dynamicrange'] = (bool) $this->readBinData($fhBS, 1); |
|
| 95 | - $info['dts']['flags']['timestamp'] = (bool) $this->readBinData($fhBS, 1); |
|
| 96 | - $info['dts']['flags']['auxdata'] = (bool) $this->readBinData($fhBS, 1); |
|
| 97 | - $info['dts']['flags']['hdcd'] = (bool) $this->readBinData($fhBS, 1); |
|
| 98 | - $info['dts']['raw']['extension_audio'] = $this->readBinData($fhBS, 3); |
|
| 99 | - $info['dts']['flags']['extended_coding'] = (bool) $this->readBinData($fhBS, 1); |
|
| 100 | - $info['dts']['flags']['audio_sync_insertion'] = (bool) $this->readBinData($fhBS, 1); |
|
| 101 | - $info['dts']['raw']['lfe_effects'] = $this->readBinData($fhBS, 2); |
|
| 102 | - $info['dts']['flags']['predictor_history'] = (bool) $this->readBinData($fhBS, 1); |
|
| 85 | + $info['dts']['raw']['frame_type'] = $this->readBinData($fhBS, 1); |
|
| 86 | + $info['dts']['raw']['deficit_samples'] = $this->readBinData($fhBS, 5); |
|
| 87 | + $info['dts']['flags']['crc_present'] = (bool) $this->readBinData($fhBS, 1); |
|
| 88 | + $info['dts']['raw']['pcm_sample_blocks'] = $this->readBinData($fhBS, 7); |
|
| 89 | + $info['dts']['raw']['frame_byte_size'] = $this->readBinData($fhBS, 14); |
|
| 90 | + $info['dts']['raw']['channel_arrangement'] = $this->readBinData($fhBS, 6); |
|
| 91 | + $info['dts']['raw']['sample_frequency'] = $this->readBinData($fhBS, 4); |
|
| 92 | + $info['dts']['raw']['bitrate'] = $this->readBinData($fhBS, 5); |
|
| 93 | + $info['dts']['flags']['embedded_downmix'] = (bool) $this->readBinData($fhBS, 1); |
|
| 94 | + $info['dts']['flags']['dynamicrange'] = (bool) $this->readBinData($fhBS, 1); |
|
| 95 | + $info['dts']['flags']['timestamp'] = (bool) $this->readBinData($fhBS, 1); |
|
| 96 | + $info['dts']['flags']['auxdata'] = (bool) $this->readBinData($fhBS, 1); |
|
| 97 | + $info['dts']['flags']['hdcd'] = (bool) $this->readBinData($fhBS, 1); |
|
| 98 | + $info['dts']['raw']['extension_audio'] = $this->readBinData($fhBS, 3); |
|
| 99 | + $info['dts']['flags']['extended_coding'] = (bool) $this->readBinData($fhBS, 1); |
|
| 100 | + $info['dts']['flags']['audio_sync_insertion'] = (bool) $this->readBinData($fhBS, 1); |
|
| 101 | + $info['dts']['raw']['lfe_effects'] = $this->readBinData($fhBS, 2); |
|
| 102 | + $info['dts']['flags']['predictor_history'] = (bool) $this->readBinData($fhBS, 1); |
|
| 103 | 103 | if ($info['dts']['flags']['crc_present']) { |
| 104 | - $info['dts']['raw']['crc16'] = $this->readBinData($fhBS, 16); |
|
| 104 | + $info['dts']['raw']['crc16'] = $this->readBinData($fhBS, 16); |
|
| 105 | 105 | } |
| 106 | - $info['dts']['flags']['mri_perfect_reconst'] = (bool) $this->readBinData($fhBS, 1); |
|
| 107 | - $info['dts']['raw']['encoder_soft_version'] = $this->readBinData($fhBS, 4); |
|
| 108 | - $info['dts']['raw']['copy_history'] = $this->readBinData($fhBS, 2); |
|
| 109 | - $info['dts']['raw']['bits_per_sample'] = $this->readBinData($fhBS, 2); |
|
| 110 | - $info['dts']['flags']['surround_es'] = (bool) $this->readBinData($fhBS, 1); |
|
| 111 | - $info['dts']['flags']['front_sum_diff'] = (bool) $this->readBinData($fhBS, 1); |
|
| 112 | - $info['dts']['flags']['surround_sum_diff'] = (bool) $this->readBinData($fhBS, 1); |
|
| 113 | - $info['dts']['raw']['dialog_normalization'] = $this->readBinData($fhBS, 4); |
|
| 106 | + $info['dts']['flags']['mri_perfect_reconst'] = (bool) $this->readBinData($fhBS, 1); |
|
| 107 | + $info['dts']['raw']['encoder_soft_version'] = $this->readBinData($fhBS, 4); |
|
| 108 | + $info['dts']['raw']['copy_history'] = $this->readBinData($fhBS, 2); |
|
| 109 | + $info['dts']['raw']['bits_per_sample'] = $this->readBinData($fhBS, 2); |
|
| 110 | + $info['dts']['flags']['surround_es'] = (bool) $this->readBinData($fhBS, 1); |
|
| 111 | + $info['dts']['flags']['front_sum_diff'] = (bool) $this->readBinData($fhBS, 1); |
|
| 112 | + $info['dts']['flags']['surround_sum_diff'] = (bool) $this->readBinData($fhBS, 1); |
|
| 113 | + $info['dts']['raw']['dialog_normalization'] = $this->readBinData($fhBS, 4); |
|
| 114 | 114 | |
| 115 | 115 | |
| 116 | 116 | $info['dts']['bitrate'] = self::bitrateLookup($info['dts']['raw']['bitrate']); |
| 117 | 117 | $info['dts']['bits_per_sample'] = self::bitPerSampleLookup($info['dts']['raw']['bits_per_sample']); |
| 118 | 118 | $info['dts']['sample_rate'] = self::sampleRateLookup($info['dts']['raw']['sample_frequency']); |
| 119 | 119 | $info['dts']['dialog_normalization'] = self::dialogNormalization($info['dts']['raw']['dialog_normalization'], $info['dts']['raw']['encoder_soft_version']); |
| 120 | - $info['dts']['flags']['lossless'] = (($info['dts']['raw']['bitrate'] == 31) ? true : false); |
|
| 120 | + $info['dts']['flags']['lossless'] = (($info['dts']['raw']['bitrate'] == 31) ? true : false); |
|
| 121 | 121 | $info['dts']['bitrate_mode'] = (($info['dts']['raw']['bitrate'] == 30) ? 'vbr' : 'cbr'); |
| 122 | 122 | $info['dts']['channels'] = self::numChannelsLookup($info['dts']['raw']['channel_arrangement']); |
| 123 | 123 | $info['dts']['channel_arrangement'] = self::channelArrangementLookup($info['dts']['raw']['channel_arrangement']); |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | $info['audio']['sample_rate'] = $info['dts']['sample_rate']; |
| 130 | 130 | $info['audio']['channels'] = $info['dts']['channels']; |
| 131 | 131 | $info['audio']['bitrate'] = $info['dts']['bitrate']; |
| 132 | - if (isset($info['avdataend']) && !empty($info['dts']['bitrate']) && is_numeric($info['dts']['bitrate'])) { |
|
| 133 | - $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($info['dts']['bitrate'] / 8); |
|
| 132 | + if (isset($info['avdataend']) && ! empty($info['dts']['bitrate']) && is_numeric($info['dts']['bitrate'])) { |
|
| 133 | + $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($info['dts']['bitrate'] / 8); |
|
| 134 | 134 | if (($encoding == 2) || ($encoding == 3)) { |
| 135 | 135 | // 14-bit data packed into 16-bit words, so the playtime is wrong because only (14/16) of the bytes in the data portion of the file are used at the specified bitrate |
| 136 | 136 | $info['playtime_seconds'] *= (14 / 16); |
@@ -1072,6 +1072,9 @@ discard block |
||
| 1072 | 1072 | return true; |
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | + /** |
|
| 1076 | + * @param boolean $ScanAsCBR |
|
| 1077 | + */ |
|
| 1075 | 1078 | public function RecursiveFrameScanning(&$offset, &$nextframetestoffset, $ScanAsCBR) { |
| 1076 | 1079 | $info = &$this->getid3->info; |
| 1077 | 1080 | $firstframetestarray = array('error'=>'', 'warning'=>'', 'avdataend'=>$info['avdataend'], 'avdataoffset'=>$info['avdataoffset']); |
@@ -1686,6 +1689,9 @@ discard block |
||
| 1686 | 1689 | return $MPEGaudioEmphasis; |
| 1687 | 1690 | } |
| 1688 | 1691 | |
| 1692 | + /** |
|
| 1693 | + * @param string $head4 |
|
| 1694 | + */ |
|
| 1689 | 1695 | public static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15=false) { |
| 1690 | 1696 | return self::MPEGaudioHeaderValid(self::MPEGaudioHeaderDecode($head4), false, $allowBitrate15); |
| 1691 | 1697 | } |
@@ -1936,6 +1942,9 @@ discard block |
||
| 1936 | 1942 | return (isset($LAMEmiscStereoModeLookup[$StereoModeID]) ? $LAMEmiscStereoModeLookup[$StereoModeID] : ''); |
| 1937 | 1943 | } |
| 1938 | 1944 | |
| 1945 | + /** |
|
| 1946 | + * @param integer $SourceSampleFrequencyID |
|
| 1947 | + */ |
|
| 1939 | 1948 | public static function LAMEmiscSourceSampleFrequencyLookup($SourceSampleFrequencyID) { |
| 1940 | 1949 | static $LAMEmiscSourceSampleFrequencyLookup = array( |
| 1941 | 1950 | 0 => '<= 32 kHz', |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | $initialOffset = $info['avdataoffset']; |
| 34 | 34 | |
| 35 | - if (!$this->getOnlyMPEGaudioInfo($info['avdataoffset'])) { |
|
| 35 | + if ( ! $this->getOnlyMPEGaudioInfo($info['avdataoffset'])) { |
|
| 36 | 36 | if ($this->allow_bruteforce) { |
| 37 | 37 | $info['error'][] = 'Rescanning file in BruteForce mode'; |
| 38 | 38 | $this->getOnlyMPEGaudioInfoBruteForce($this->getid3->fp, $info); |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $info['audio']['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if (((isset($info['id3v2']['headerlength']) && ($info['avdataoffset'] > $info['id3v2']['headerlength'])) || (!isset($info['id3v2']) && ($info['avdataoffset'] > 0) && ($info['avdataoffset'] != $initialOffset)))) { |
|
| 47 | + if (((isset($info['id3v2']['headerlength']) && ($info['avdataoffset'] > $info['id3v2']['headerlength'])) || ( ! isset($info['id3v2']) && ($info['avdataoffset'] > 0) && ($info['avdataoffset'] != $initialOffset)))) { |
|
| 48 | 48 | |
| 49 | 49 | $synchoffsetwarning = 'Unknown data before synch '; |
| 50 | 50 | if (isset($info['id3v2']['headerlength'])) { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $synchoffsetwarning .= 'synch detected at '.$info['avdataoffset'].')'; |
| 58 | 58 | if (isset($info['audio']['bitrate_mode']) && ($info['audio']['bitrate_mode'] == 'cbr')) { |
| 59 | 59 | |
| 60 | - if (!empty($info['id3v2']['headerlength']) && (($info['avdataoffset'] - $info['id3v2']['headerlength']) == $info['mpeg']['audio']['framelength'])) { |
|
| 60 | + if ( ! empty($info['id3v2']['headerlength']) && (($info['avdataoffset'] - $info['id3v2']['headerlength']) == $info['mpeg']['audio']['framelength'])) { |
|
| 61 | 61 | |
| 62 | 62 | $synchoffsetwarning .= '. This is a known problem with some versions of LAME (3.90-3.92) DLL in CBR mode.'; |
| 63 | 63 | $info['audio']['codec'] = 'LAME'; |
@@ -78,15 +78,15 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | if (isset($info['mpeg']['audio']['LAME'])) { |
| 80 | 80 | $info['audio']['codec'] = 'LAME'; |
| 81 | - if (!empty($info['mpeg']['audio']['LAME']['long_version'])) { |
|
| 81 | + if ( ! empty($info['mpeg']['audio']['LAME']['long_version'])) { |
|
| 82 | 82 | $info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['long_version'], "\x00"); |
| 83 | - } elseif (!empty($info['mpeg']['audio']['LAME']['short_version'])) { |
|
| 83 | + } elseif ( ! empty($info['mpeg']['audio']['LAME']['short_version'])) { |
|
| 84 | 84 | $info['audio']['encoder'] = rtrim($info['mpeg']['audio']['LAME']['short_version'], "\x00"); |
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - $CurrentDataLAMEversionString = (!empty($CurrentDataLAMEversionString) ? $CurrentDataLAMEversionString : (isset($info['audio']['encoder']) ? $info['audio']['encoder'] : '')); |
|
| 89 | - if (!empty($CurrentDataLAMEversionString) && (substr($CurrentDataLAMEversionString, 0, 6) == 'LAME3.') && !preg_match('[0-9\)]', substr($CurrentDataLAMEversionString, -1))) { |
|
| 88 | + $CurrentDataLAMEversionString = ( ! empty($CurrentDataLAMEversionString) ? $CurrentDataLAMEversionString : (isset($info['audio']['encoder']) ? $info['audio']['encoder'] : '')); |
|
| 89 | + if ( ! empty($CurrentDataLAMEversionString) && (substr($CurrentDataLAMEversionString, 0, 6) == 'LAME3.') && ! preg_match('[0-9\)]', substr($CurrentDataLAMEversionString, -1))) { |
|
| 90 | 90 | // a version number of LAME that does not end with a number like "LAME3.92" |
| 91 | 91 | // or with a closing parenthesis like "LAME3.88 (alpha)" |
| 92 | 92 | // or a version of LAME with the LAMEtag-not-filled-in-DLL-mode bug (3.90-3.92) |
@@ -115,14 +115,12 @@ discard block |
||
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | - if (!empty($info['audio']['encoder'])) { |
|
| 118 | + if ( ! empty($info['audio']['encoder'])) { |
|
| 119 | 119 | $info['audio']['encoder'] = rtrim($info['audio']['encoder'], "\x00 "); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | switch (isset($info['mpeg']['audio']['layer']) ? $info['mpeg']['audio']['layer'] : '') { |
| 123 | - case 1: |
|
| 124 | - case 2: |
|
| 125 | - $info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer']; |
|
| 123 | + case 1 : case 2 : $info['audio']['dataformat'] = 'mp'.$info['mpeg']['audio']['layer']; |
|
| 126 | 124 | break; |
| 127 | 125 | } |
| 128 | 126 | if (isset($info['fileformat']) && ($info['fileformat'] == 'mp3')) { |
@@ -151,7 +149,7 @@ discard block |
||
| 151 | 149 | $info['audio']['lossless'] = false; |
| 152 | 150 | |
| 153 | 151 | // Calculate playtime |
| 154 | - if (!isset($info['playtime_seconds']) && isset($info['audio']['bitrate']) && ($info['audio']['bitrate'] > 0)) { |
|
| 152 | + if ( ! isset($info['playtime_seconds']) && isset($info['audio']['bitrate']) && ($info['audio']['bitrate'] > 0)) { |
|
| 155 | 153 | $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) * 8 / $info['audio']['bitrate']; |
| 156 | 154 | } |
| 157 | 155 | |
@@ -164,9 +162,9 @@ discard block |
||
| 164 | 162 | public function GuessEncoderOptions() { |
| 165 | 163 | // shortcuts |
| 166 | 164 | $info = &$this->getid3->info; |
| 167 | - if (!empty($info['mpeg']['audio'])) { |
|
| 165 | + if ( ! empty($info['mpeg']['audio'])) { |
|
| 168 | 166 | $thisfile_mpeg_audio = &$info['mpeg']['audio']; |
| 169 | - if (!empty($thisfile_mpeg_audio['LAME'])) { |
|
| 167 | + if ( ! empty($thisfile_mpeg_audio['LAME'])) { |
|
| 170 | 168 | $thisfile_mpeg_audio_lame = &$thisfile_mpeg_audio['LAME']; |
| 171 | 169 | } |
| 172 | 170 | } |
@@ -174,71 +172,71 @@ discard block |
||
| 174 | 172 | $encoder_options = ''; |
| 175 | 173 | static $NamedPresetBitrates = array(16, 24, 40, 56, 112, 128, 160, 192, 256); |
| 176 | 174 | |
| 177 | - if (isset($thisfile_mpeg_audio['VBR_method']) && ($thisfile_mpeg_audio['VBR_method'] == 'Fraunhofer') && !empty($thisfile_mpeg_audio['VBR_quality'])) { |
|
| 175 | + if (isset($thisfile_mpeg_audio['VBR_method']) && ($thisfile_mpeg_audio['VBR_method'] == 'Fraunhofer') && ! empty($thisfile_mpeg_audio['VBR_quality'])) { |
|
| 178 | 176 | |
| 179 | 177 | $encoder_options = 'VBR q'.$thisfile_mpeg_audio['VBR_quality']; |
| 180 | 178 | |
| 181 | - } elseif (!empty($thisfile_mpeg_audio_lame['preset_used']) && (!in_array($thisfile_mpeg_audio_lame['preset_used_id'], $NamedPresetBitrates))) { |
|
| 179 | + } elseif ( ! empty($thisfile_mpeg_audio_lame['preset_used']) && ( ! in_array($thisfile_mpeg_audio_lame['preset_used_id'], $NamedPresetBitrates))) { |
|
| 182 | 180 | |
| 183 | 181 | $encoder_options = $thisfile_mpeg_audio_lame['preset_used']; |
| 184 | 182 | |
| 185 | - } elseif (!empty($thisfile_mpeg_audio_lame['vbr_quality'])) { |
|
| 183 | + } elseif ( ! empty($thisfile_mpeg_audio_lame['vbr_quality'])) { |
|
| 186 | 184 | |
| 187 | 185 | static $KnownEncoderValues = array(); |
| 188 | 186 | if (empty($KnownEncoderValues)) { |
| 189 | 187 | |
| 190 | 188 | //$KnownEncoderValues[abrbitrate_minbitrate][vbr_quality][raw_vbr_method][raw_noise_shaping][raw_stereo_mode][ath_type][lowpass_frequency] = 'preset name'; |
| 191 | - $KnownEncoderValues[0xFF][58][1][1][3][2][20500] = '--alt-preset insane'; // 3.90, 3.90.1, 3.92 |
|
| 192 | - $KnownEncoderValues[0xFF][58][1][1][3][2][20600] = '--alt-preset insane'; // 3.90.2, 3.90.3, 3.91 |
|
| 193 | - $KnownEncoderValues[0xFF][57][1][1][3][4][20500] = '--alt-preset insane'; // 3.94, 3.95 |
|
| 194 | - $KnownEncoderValues['**'][78][3][2][3][2][19500] = '--alt-preset extreme'; // 3.90, 3.90.1, 3.92 |
|
| 195 | - $KnownEncoderValues['**'][78][3][2][3][2][19600] = '--alt-preset extreme'; // 3.90.2, 3.91 |
|
| 196 | - $KnownEncoderValues['**'][78][3][1][3][2][19600] = '--alt-preset extreme'; // 3.90.3 |
|
| 197 | - $KnownEncoderValues['**'][78][4][2][3][2][19500] = '--alt-preset fast extreme'; // 3.90, 3.90.1, 3.92 |
|
| 198 | - $KnownEncoderValues['**'][78][4][2][3][2][19600] = '--alt-preset fast extreme'; // 3.90.2, 3.90.3, 3.91 |
|
| 199 | - $KnownEncoderValues['**'][78][3][2][3][4][19000] = '--alt-preset standard'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 200 | - $KnownEncoderValues['**'][78][3][1][3][4][19000] = '--alt-preset standard'; // 3.90.3 |
|
| 189 | + $KnownEncoderValues[0xFF][58][1][1][3][2][20500] = '--alt-preset insane'; // 3.90, 3.90.1, 3.92 |
|
| 190 | + $KnownEncoderValues[0xFF][58][1][1][3][2][20600] = '--alt-preset insane'; // 3.90.2, 3.90.3, 3.91 |
|
| 191 | + $KnownEncoderValues[0xFF][57][1][1][3][4][20500] = '--alt-preset insane'; // 3.94, 3.95 |
|
| 192 | + $KnownEncoderValues['**'][78][3][2][3][2][19500] = '--alt-preset extreme'; // 3.90, 3.90.1, 3.92 |
|
| 193 | + $KnownEncoderValues['**'][78][3][2][3][2][19600] = '--alt-preset extreme'; // 3.90.2, 3.91 |
|
| 194 | + $KnownEncoderValues['**'][78][3][1][3][2][19600] = '--alt-preset extreme'; // 3.90.3 |
|
| 195 | + $KnownEncoderValues['**'][78][4][2][3][2][19500] = '--alt-preset fast extreme'; // 3.90, 3.90.1, 3.92 |
|
| 196 | + $KnownEncoderValues['**'][78][4][2][3][2][19600] = '--alt-preset fast extreme'; // 3.90.2, 3.90.3, 3.91 |
|
| 197 | + $KnownEncoderValues['**'][78][3][2][3][4][19000] = '--alt-preset standard'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 198 | + $KnownEncoderValues['**'][78][3][1][3][4][19000] = '--alt-preset standard'; // 3.90.3 |
|
| 201 | 199 | $KnownEncoderValues['**'][78][4][2][3][4][19000] = '--alt-preset fast standard'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
| 202 | 200 | $KnownEncoderValues['**'][78][4][1][3][4][19000] = '--alt-preset fast standard'; // 3.90.3 |
| 203 | - $KnownEncoderValues['**'][88][4][1][3][3][19500] = '--r3mix'; // 3.90, 3.90.1, 3.92 |
|
| 204 | - $KnownEncoderValues['**'][88][4][1][3][3][19600] = '--r3mix'; // 3.90.2, 3.90.3, 3.91 |
|
| 205 | - $KnownEncoderValues['**'][67][4][1][3][4][18000] = '--r3mix'; // 3.94, 3.95 |
|
| 206 | - $KnownEncoderValues['**'][68][3][2][3][4][18000] = '--alt-preset medium'; // 3.90.3 |
|
| 207 | - $KnownEncoderValues['**'][68][4][2][3][4][18000] = '--alt-preset fast medium'; // 3.90.3 |
|
| 208 | - |
|
| 209 | - $KnownEncoderValues[0xFF][99][1][1][1][2][0] = '--preset studio'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 210 | - $KnownEncoderValues[0xFF][58][2][1][3][2][20600] = '--preset studio'; // 3.90.3, 3.93.1 |
|
| 211 | - $KnownEncoderValues[0xFF][58][2][1][3][2][20500] = '--preset studio'; // 3.93 |
|
| 212 | - $KnownEncoderValues[0xFF][57][2][1][3][4][20500] = '--preset studio'; // 3.94, 3.95 |
|
| 213 | - $KnownEncoderValues[0xC0][88][1][1][1][2][0] = '--preset cd'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 214 | - $KnownEncoderValues[0xC0][58][2][2][3][2][19600] = '--preset cd'; // 3.90.3, 3.93.1 |
|
| 215 | - $KnownEncoderValues[0xC0][58][2][2][3][2][19500] = '--preset cd'; // 3.93 |
|
| 216 | - $KnownEncoderValues[0xC0][57][2][1][3][4][19500] = '--preset cd'; // 3.94, 3.95 |
|
| 217 | - $KnownEncoderValues[0xA0][78][1][1][3][2][18000] = '--preset hifi'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 218 | - $KnownEncoderValues[0xA0][58][2][2][3][2][18000] = '--preset hifi'; // 3.90.3, 3.93, 3.93.1 |
|
| 219 | - $KnownEncoderValues[0xA0][57][2][1][3][4][18000] = '--preset hifi'; // 3.94, 3.95 |
|
| 220 | - $KnownEncoderValues[0x80][67][1][1][3][2][18000] = '--preset tape'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 221 | - $KnownEncoderValues[0x80][67][1][1][3][2][15000] = '--preset radio'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 222 | - $KnownEncoderValues[0x70][67][1][1][3][2][15000] = '--preset fm'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 223 | - $KnownEncoderValues[0x70][58][2][2][3][2][16000] = '--preset tape/radio/fm'; // 3.90.3, 3.93, 3.93.1 |
|
| 224 | - $KnownEncoderValues[0x70][57][2][1][3][4][16000] = '--preset tape/radio/fm'; // 3.94, 3.95 |
|
| 225 | - $KnownEncoderValues[0x38][58][2][2][0][2][10000] = '--preset voice'; // 3.90.3, 3.93, 3.93.1 |
|
| 226 | - $KnownEncoderValues[0x38][57][2][1][0][4][15000] = '--preset voice'; // 3.94, 3.95 |
|
| 227 | - $KnownEncoderValues[0x38][57][2][1][0][4][16000] = '--preset voice'; // 3.94a14 |
|
| 228 | - $KnownEncoderValues[0x28][65][1][1][0][2][7500] = '--preset mw-us'; // 3.90, 3.90.1, 3.92 |
|
| 229 | - $KnownEncoderValues[0x28][65][1][1][0][2][7600] = '--preset mw-us'; // 3.90.2, 3.91 |
|
| 230 | - $KnownEncoderValues[0x28][58][2][2][0][2][7000] = '--preset mw-us'; // 3.90.3, 3.93, 3.93.1 |
|
| 231 | - $KnownEncoderValues[0x28][57][2][1][0][4][10500] = '--preset mw-us'; // 3.94, 3.95 |
|
| 232 | - $KnownEncoderValues[0x28][57][2][1][0][4][11200] = '--preset mw-us'; // 3.94a14 |
|
| 233 | - $KnownEncoderValues[0x28][57][2][1][0][4][8800] = '--preset mw-us'; // 3.94a15 |
|
| 201 | + $KnownEncoderValues['**'][88][4][1][3][3][19500] = '--r3mix'; // 3.90, 3.90.1, 3.92 |
|
| 202 | + $KnownEncoderValues['**'][88][4][1][3][3][19600] = '--r3mix'; // 3.90.2, 3.90.3, 3.91 |
|
| 203 | + $KnownEncoderValues['**'][67][4][1][3][4][18000] = '--r3mix'; // 3.94, 3.95 |
|
| 204 | + $KnownEncoderValues['**'][68][3][2][3][4][18000] = '--alt-preset medium'; // 3.90.3 |
|
| 205 | + $KnownEncoderValues['**'][68][4][2][3][4][18000] = '--alt-preset fast medium'; // 3.90.3 |
|
| 206 | + |
|
| 207 | + $KnownEncoderValues[0xFF][99][1][1][1][2][0] = '--preset studio'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 208 | + $KnownEncoderValues[0xFF][58][2][1][3][2][20600] = '--preset studio'; // 3.90.3, 3.93.1 |
|
| 209 | + $KnownEncoderValues[0xFF][58][2][1][3][2][20500] = '--preset studio'; // 3.93 |
|
| 210 | + $KnownEncoderValues[0xFF][57][2][1][3][4][20500] = '--preset studio'; // 3.94, 3.95 |
|
| 211 | + $KnownEncoderValues[0xC0][88][1][1][1][2][0] = '--preset cd'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 212 | + $KnownEncoderValues[0xC0][58][2][2][3][2][19600] = '--preset cd'; // 3.90.3, 3.93.1 |
|
| 213 | + $KnownEncoderValues[0xC0][58][2][2][3][2][19500] = '--preset cd'; // 3.93 |
|
| 214 | + $KnownEncoderValues[0xC0][57][2][1][3][4][19500] = '--preset cd'; // 3.94, 3.95 |
|
| 215 | + $KnownEncoderValues[0xA0][78][1][1][3][2][18000] = '--preset hifi'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 216 | + $KnownEncoderValues[0xA0][58][2][2][3][2][18000] = '--preset hifi'; // 3.90.3, 3.93, 3.93.1 |
|
| 217 | + $KnownEncoderValues[0xA0][57][2][1][3][4][18000] = '--preset hifi'; // 3.94, 3.95 |
|
| 218 | + $KnownEncoderValues[0x80][67][1][1][3][2][18000] = '--preset tape'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 219 | + $KnownEncoderValues[0x80][67][1][1][3][2][15000] = '--preset radio'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 220 | + $KnownEncoderValues[0x70][67][1][1][3][2][15000] = '--preset fm'; // 3.90, 3.90.1, 3.90.2, 3.91, 3.92 |
|
| 221 | + $KnownEncoderValues[0x70][58][2][2][3][2][16000] = '--preset tape/radio/fm'; // 3.90.3, 3.93, 3.93.1 |
|
| 222 | + $KnownEncoderValues[0x70][57][2][1][3][4][16000] = '--preset tape/radio/fm'; // 3.94, 3.95 |
|
| 223 | + $KnownEncoderValues[0x38][58][2][2][0][2][10000] = '--preset voice'; // 3.90.3, 3.93, 3.93.1 |
|
| 224 | + $KnownEncoderValues[0x38][57][2][1][0][4][15000] = '--preset voice'; // 3.94, 3.95 |
|
| 225 | + $KnownEncoderValues[0x38][57][2][1][0][4][16000] = '--preset voice'; // 3.94a14 |
|
| 226 | + $KnownEncoderValues[0x28][65][1][1][0][2][7500] = '--preset mw-us'; // 3.90, 3.90.1, 3.92 |
|
| 227 | + $KnownEncoderValues[0x28][65][1][1][0][2][7600] = '--preset mw-us'; // 3.90.2, 3.91 |
|
| 228 | + $KnownEncoderValues[0x28][58][2][2][0][2][7000] = '--preset mw-us'; // 3.90.3, 3.93, 3.93.1 |
|
| 229 | + $KnownEncoderValues[0x28][57][2][1][0][4][10500] = '--preset mw-us'; // 3.94, 3.95 |
|
| 230 | + $KnownEncoderValues[0x28][57][2][1][0][4][11200] = '--preset mw-us'; // 3.94a14 |
|
| 231 | + $KnownEncoderValues[0x28][57][2][1][0][4][8800] = '--preset mw-us'; // 3.94a15 |
|
| 234 | 232 | $KnownEncoderValues[0x18][58][2][2][0][2][4000] = '--preset phon+/lw/mw-eu/sw'; // 3.90.3, 3.93.1 |
| 235 | 233 | $KnownEncoderValues[0x18][58][2][2][0][2][3900] = '--preset phon+/lw/mw-eu/sw'; // 3.93 |
| 236 | 234 | $KnownEncoderValues[0x18][57][2][1][0][4][5900] = '--preset phon+/lw/mw-eu/sw'; // 3.94, 3.95 |
| 237 | 235 | $KnownEncoderValues[0x18][57][2][1][0][4][6200] = '--preset phon+/lw/mw-eu/sw'; // 3.94a14 |
| 238 | 236 | $KnownEncoderValues[0x18][57][2][1][0][4][3200] = '--preset phon+/lw/mw-eu/sw'; // 3.94a15 |
| 239 | - $KnownEncoderValues[0x10][58][2][2][0][2][3800] = '--preset phone'; // 3.90.3, 3.93.1 |
|
| 240 | - $KnownEncoderValues[0x10][58][2][2][0][2][3700] = '--preset phone'; // 3.93 |
|
| 241 | - $KnownEncoderValues[0x10][57][2][1][0][4][5600] = '--preset phone'; // 3.94, 3.95 |
|
| 237 | + $KnownEncoderValues[0x10][58][2][2][0][2][3800] = '--preset phone'; // 3.90.3, 3.93.1 |
|
| 238 | + $KnownEncoderValues[0x10][58][2][2][0][2][3700] = '--preset phone'; // 3.93 |
|
| 239 | + $KnownEncoderValues[0x10][57][2][1][0][4][5600] = '--preset phone'; // 3.94, 3.95 |
|
| 242 | 240 | } |
| 243 | 241 | |
| 244 | 242 | if (isset($KnownEncoderValues[$thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate']][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) { |
@@ -269,11 +267,11 @@ discard block |
||
| 269 | 267 | |
| 270 | 268 | } |
| 271 | 269 | |
| 272 | - } elseif (!empty($thisfile_mpeg_audio_lame['bitrate_abr'])) { |
|
| 270 | + } elseif ( ! empty($thisfile_mpeg_audio_lame['bitrate_abr'])) { |
|
| 273 | 271 | |
| 274 | 272 | $encoder_options = 'ABR'.$thisfile_mpeg_audio_lame['bitrate_abr']; |
| 275 | 273 | |
| 276 | - } elseif (!empty($info['audio']['bitrate'])) { |
|
| 274 | + } elseif ( ! empty($info['audio']['bitrate'])) { |
|
| 277 | 275 | |
| 278 | 276 | if ($info['audio']['bitrate_mode'] == 'cbr') { |
| 279 | 277 | $encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000); |
@@ -282,15 +280,15 @@ discard block |
||
| 282 | 280 | } |
| 283 | 281 | |
| 284 | 282 | } |
| 285 | - if (!empty($thisfile_mpeg_audio_lame['bitrate_min'])) { |
|
| 283 | + if ( ! empty($thisfile_mpeg_audio_lame['bitrate_min'])) { |
|
| 286 | 284 | $encoder_options .= ' -b'.$thisfile_mpeg_audio_lame['bitrate_min']; |
| 287 | 285 | } |
| 288 | 286 | |
| 289 | - if (!empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']) || !empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'])) { |
|
| 287 | + if ( ! empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev']) || ! empty($thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'])) { |
|
| 290 | 288 | $encoder_options .= ' --nogap'; |
| 291 | 289 | } |
| 292 | 290 | |
| 293 | - if (!empty($thisfile_mpeg_audio_lame['lowpass_frequency'])) { |
|
| 291 | + if ( ! empty($thisfile_mpeg_audio_lame['lowpass_frequency'])) { |
|
| 294 | 292 | $ExplodedOptions = explode(' ', $encoder_options, 4); |
| 295 | 293 | if ($ExplodedOptions[0] == '--r3mix') { |
| 296 | 294 | $ExplodedOptions[1] = 'r3mix'; |
@@ -316,20 +314,20 @@ discard block |
||
| 316 | 314 | case 'r3mix': |
| 317 | 315 | static $ExpectedLowpass = array( |
| 318 | 316 | 'insane|20500' => 20500, |
| 319 | - 'insane|20600' => 20600, // 3.90.2, 3.90.3, 3.91 |
|
| 317 | + 'insane|20600' => 20600, // 3.90.2, 3.90.3, 3.91 |
|
| 320 | 318 | 'medium|18000' => 18000, |
| 321 | 319 | 'fast medium|18000' => 18000, |
| 322 | - 'extreme|19500' => 19500, // 3.90, 3.90.1, 3.92, 3.95 |
|
| 323 | - 'extreme|19600' => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1 |
|
| 324 | - 'fast extreme|19500' => 19500, // 3.90, 3.90.1, 3.92, 3.95 |
|
| 325 | - 'fast extreme|19600' => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1 |
|
| 320 | + 'extreme|19500' => 19500, // 3.90, 3.90.1, 3.92, 3.95 |
|
| 321 | + 'extreme|19600' => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1 |
|
| 322 | + 'fast extreme|19500' => 19500, // 3.90, 3.90.1, 3.92, 3.95 |
|
| 323 | + 'fast extreme|19600' => 19600, // 3.90.2, 3.90.3, 3.91, 3.93.1 |
|
| 326 | 324 | 'standard|19000' => 19000, |
| 327 | 325 | 'fast standard|19000' => 19000, |
| 328 | - 'r3mix|19500' => 19500, // 3.90, 3.90.1, 3.92 |
|
| 329 | - 'r3mix|19600' => 19600, // 3.90.2, 3.90.3, 3.91 |
|
| 330 | - 'r3mix|18000' => 18000, // 3.94, 3.95 |
|
| 326 | + 'r3mix|19500' => 19500, // 3.90, 3.90.1, 3.92 |
|
| 327 | + 'r3mix|19600' => 19600, // 3.90.2, 3.90.3, 3.91 |
|
| 328 | + 'r3mix|18000' => 18000, // 3.94, 3.95 |
|
| 331 | 329 | ); |
| 332 | - if (!isset($ExpectedLowpass[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio_lame['lowpass_frequency']]) && ($thisfile_mpeg_audio_lame['lowpass_frequency'] < 22050) && (round($thisfile_mpeg_audio_lame['lowpass_frequency'] / 1000) < round($thisfile_mpeg_audio['sample_rate'] / 2000))) { |
|
| 330 | + if ( ! isset($ExpectedLowpass[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio_lame['lowpass_frequency']]) && ($thisfile_mpeg_audio_lame['lowpass_frequency'] < 22050) && (round($thisfile_mpeg_audio_lame['lowpass_frequency'] / 1000) < round($thisfile_mpeg_audio['sample_rate'] / 2000))) { |
|
| 333 | 331 | $encoder_options .= ' --lowpass '.$thisfile_mpeg_audio_lame['lowpass_frequency']; |
| 334 | 332 | } |
| 335 | 333 | break; |
@@ -380,7 +378,7 @@ discard block |
||
| 380 | 378 | 'fm/radio|32000' => 32000, // 3.92 |
| 381 | 379 | 'fm|32000' => 32000, // 3.90 |
| 382 | 380 | 'voice|32000' => 32000); |
| 383 | - if (!isset($ExpectedResampledRate[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio['sample_rate']])) { |
|
| 381 | + if ( ! isset($ExpectedResampledRate[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio['sample_rate']])) { |
|
| 384 | 382 | $encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate']; |
| 385 | 383 | } |
| 386 | 384 | break; |
@@ -396,7 +394,7 @@ discard block |
||
| 396 | 394 | } |
| 397 | 395 | } |
| 398 | 396 | } |
| 399 | - if (empty($encoder_options) && !empty($info['audio']['bitrate']) && !empty($info['audio']['bitrate_mode'])) { |
|
| 397 | + if (empty($encoder_options) && ! empty($info['audio']['bitrate']) && ! empty($info['audio']['bitrate_mode'])) { |
|
| 400 | 398 | //$encoder_options = strtoupper($info['audio']['bitrate_mode']).ceil($info['audio']['bitrate'] / 1000); |
| 401 | 399 | $encoder_options = strtoupper($info['audio']['bitrate_mode']); |
| 402 | 400 | } |
@@ -405,7 +403,7 @@ discard block |
||
| 405 | 403 | } |
| 406 | 404 | |
| 407 | 405 | |
| 408 | - public function decodeMPEGaudioHeader($offset, &$info, $recursivesearch=true, $ScanAsCBR=false, $FastMPEGheaderScan=false) { |
|
| 406 | + public function decodeMPEGaudioHeader($offset, &$info, $recursivesearch = true, $ScanAsCBR = false, $FastMPEGheaderScan = false) { |
|
| 409 | 407 | static $MPEGaudioVersionLookup; |
| 410 | 408 | static $MPEGaudioLayerLookup; |
| 411 | 409 | static $MPEGaudioBitrateLookup; |
@@ -447,13 +445,13 @@ discard block |
||
| 447 | 445 | } |
| 448 | 446 | |
| 449 | 447 | static $MPEGaudioHeaderValidCache = array(); |
| 450 | - if (!isset($MPEGaudioHeaderValidCache[$head4])) { // Not in cache |
|
| 448 | + if ( ! isset($MPEGaudioHeaderValidCache[$head4])) { // Not in cache |
|
| 451 | 449 | //$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, true); // allow badly-formatted freeformat (from LAME 3.90 - 3.93.1) |
| 452 | 450 | $MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGheaderRawArray, false, false); |
| 453 | 451 | } |
| 454 | 452 | |
| 455 | 453 | // shortcut |
| 456 | - if (!isset($info['mpeg']['audio'])) { |
|
| 454 | + if ( ! isset($info['mpeg']['audio'])) { |
|
| 457 | 455 | $info['mpeg']['audio'] = array(); |
| 458 | 456 | } |
| 459 | 457 | $thisfile_mpeg_audio = &$info['mpeg']['audio']; |
@@ -466,14 +464,14 @@ discard block |
||
| 466 | 464 | return false; |
| 467 | 465 | } |
| 468 | 466 | |
| 469 | - if (!$FastMPEGheaderScan) { |
|
| 467 | + if ( ! $FastMPEGheaderScan) { |
|
| 470 | 468 | $thisfile_mpeg_audio['version'] = $MPEGaudioVersionLookup[$thisfile_mpeg_audio['raw']['version']]; |
| 471 | 469 | $thisfile_mpeg_audio['layer'] = $MPEGaudioLayerLookup[$thisfile_mpeg_audio['raw']['layer']]; |
| 472 | 470 | |
| 473 | 471 | $thisfile_mpeg_audio['channelmode'] = $MPEGaudioChannelModeLookup[$thisfile_mpeg_audio['raw']['channelmode']]; |
| 474 | 472 | $thisfile_mpeg_audio['channels'] = (($thisfile_mpeg_audio['channelmode'] == 'mono') ? 1 : 2); |
| 475 | 473 | $thisfile_mpeg_audio['sample_rate'] = $MPEGaudioFrequencyLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['raw']['sample_rate']]; |
| 476 | - $thisfile_mpeg_audio['protection'] = !$thisfile_mpeg_audio['raw']['protection']; |
|
| 474 | + $thisfile_mpeg_audio['protection'] = ! $thisfile_mpeg_audio['raw']['protection']; |
|
| 477 | 475 | $thisfile_mpeg_audio['private'] = (bool) $thisfile_mpeg_audio['raw']['private']; |
| 478 | 476 | $thisfile_mpeg_audio['modeextension'] = $MPEGaudioModeExtensionLookup[$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['modeextension']]; |
| 479 | 477 | $thisfile_mpeg_audio['copyright'] = (bool) $thisfile_mpeg_audio['raw']['copyright']; |
@@ -503,7 +501,7 @@ discard block |
||
| 503 | 501 | } |
| 504 | 502 | |
| 505 | 503 | // For Layer 2 there are some combinations of bitrate and mode which are not allowed. |
| 506 | - if (!$FastMPEGheaderScan && ($thisfile_mpeg_audio['layer'] == '2')) { |
|
| 504 | + if ( ! $FastMPEGheaderScan && ($thisfile_mpeg_audio['layer'] == '2')) { |
|
| 507 | 505 | |
| 508 | 506 | $info['audio']['dataformat'] = 'mp2'; |
| 509 | 507 | switch ($thisfile_mpeg_audio['channelmode']) { |
@@ -562,15 +560,15 @@ discard block |
||
| 562 | 560 | |
| 563 | 561 | $thisfile_mpeg_audio['bitrate_mode'] = 'vbr'; |
| 564 | 562 | $thisfile_mpeg_audio['VBR_method'] = 'Fraunhofer'; |
| 565 | - $info['audio']['codec'] = 'Fraunhofer'; |
|
| 563 | + $info['audio']['codec'] = 'Fraunhofer'; |
|
| 566 | 564 | |
| 567 | 565 | $SideInfoData = substr($headerstring, 4 + 2, 32); |
| 568 | 566 | |
| 569 | 567 | $FraunhoferVBROffset = 36; |
| 570 | 568 | |
| 571 | - $thisfile_mpeg_audio['VBR_encoder_version'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 4, 2)); // VbriVersion |
|
| 572 | - $thisfile_mpeg_audio['VBR_encoder_delay'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 6, 2)); // VbriDelay |
|
| 573 | - $thisfile_mpeg_audio['VBR_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 8, 2)); // VbriQuality |
|
| 569 | + $thisfile_mpeg_audio['VBR_encoder_version'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 4, 2)); // VbriVersion |
|
| 570 | + $thisfile_mpeg_audio['VBR_encoder_delay'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 6, 2)); // VbriDelay |
|
| 571 | + $thisfile_mpeg_audio['VBR_quality'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 8, 2)); // VbriQuality |
|
| 574 | 572 | $thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 10, 4)); // VbriStreamBytes |
| 575 | 573 | $thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 14, 4)); // VbriStreamFrames |
| 576 | 574 | $thisfile_mpeg_audio['VBR_seek_offsets'] = getid3_lib::BigEndian2Int(substr($headerstring, $FraunhoferVBROffset + 18, 2)); // VbriTableSize |
@@ -640,15 +638,15 @@ discard block |
||
| 640 | 638 | $thisfile_mpeg_audio['xing_flags']['vbr_scale'] = (bool) ($thisfile_mpeg_audio['xing_flags_raw'] & 0x00000008); |
| 641 | 639 | |
| 642 | 640 | if ($thisfile_mpeg_audio['xing_flags']['frames']) { |
| 643 | - $thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 8, 4)); |
|
| 641 | + $thisfile_mpeg_audio['VBR_frames'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 8, 4)); |
|
| 644 | 642 | //$thisfile_mpeg_audio['VBR_frames']--; // don't count header Xing/Info frame |
| 645 | 643 | } |
| 646 | 644 | if ($thisfile_mpeg_audio['xing_flags']['bytes']) { |
| 647 | - $thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 12, 4)); |
|
| 645 | + $thisfile_mpeg_audio['VBR_bytes'] = getid3_lib::BigEndian2Int(substr($headerstring, $VBRidOffset + 12, 4)); |
|
| 648 | 646 | } |
| 649 | 647 | |
| 650 | 648 | //if (($thisfile_mpeg_audio['bitrate'] == 'free') && !empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) { |
| 651 | - if (!empty($thisfile_mpeg_audio['VBR_frames']) && !empty($thisfile_mpeg_audio['VBR_bytes'])) { |
|
| 649 | + if ( ! empty($thisfile_mpeg_audio['VBR_frames']) && ! empty($thisfile_mpeg_audio['VBR_bytes'])) { |
|
| 652 | 650 | |
| 653 | 651 | $framelengthfloat = $thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']; |
| 654 | 652 | |
@@ -720,7 +718,7 @@ discard block |
||
| 720 | 718 | $LAMEtagRevisionVBRmethod = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xA5, 1)); |
| 721 | 719 | |
| 722 | 720 | $thisfile_mpeg_audio_lame['tag_revision'] = ($LAMEtagRevisionVBRmethod & 0xF0) >> 4; |
| 723 | - $thisfile_mpeg_audio_lame_raw['vbr_method'] = $LAMEtagRevisionVBRmethod & 0x0F; |
|
| 721 | + $thisfile_mpeg_audio_lame_raw['vbr_method'] = $LAMEtagRevisionVBRmethod & 0x0F; |
|
| 724 | 722 | $thisfile_mpeg_audio_lame['vbr_method'] = self::LAMEvbrMethodLookup($thisfile_mpeg_audio_lame_raw['vbr_method']); |
| 725 | 723 | $thisfile_mpeg_audio['bitrate_mode'] = substr($thisfile_mpeg_audio_lame['vbr_method'], 0, 3); // usually either 'cbr' or 'vbr', but truncates 'vbr-old / vbr-rh' to 'vbr' |
| 726 | 724 | |
@@ -745,8 +743,8 @@ discard block |
||
| 745 | 743 | $thisfile_mpeg_audio_lame_RGAD['peak_db'] = getid3_lib::RGADamplitude2dB($thisfile_mpeg_audio_lame_RGAD['peak_amplitude']); |
| 746 | 744 | } |
| 747 | 745 | |
| 748 | - $thisfile_mpeg_audio_lame_raw['RGAD_track'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAB, 2)); |
|
| 749 | - $thisfile_mpeg_audio_lame_raw['RGAD_album'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAD, 2)); |
|
| 746 | + $thisfile_mpeg_audio_lame_raw['RGAD_track'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAB, 2)); |
|
| 747 | + $thisfile_mpeg_audio_lame_raw['RGAD_album'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xAD, 2)); |
|
| 750 | 748 | |
| 751 | 749 | |
| 752 | 750 | if ($thisfile_mpeg_audio_lame_raw['RGAD_track'] != 0) { |
@@ -754,13 +752,13 @@ discard block |
||
| 754 | 752 | $thisfile_mpeg_audio_lame_RGAD_track['raw']['name'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0xE000) >> 13; |
| 755 | 753 | $thisfile_mpeg_audio_lame_RGAD_track['raw']['originator'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x1C00) >> 10; |
| 756 | 754 | $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit'] = ($thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x0200) >> 9; |
| 757 | - $thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x01FF; |
|
| 755 | + $thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'] = $thisfile_mpeg_audio_lame_raw['RGAD_track'] & 0x01FF; |
|
| 758 | 756 | $thisfile_mpeg_audio_lame_RGAD_track['name'] = getid3_lib::RGADnameLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['name']); |
| 759 | 757 | $thisfile_mpeg_audio_lame_RGAD_track['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['originator']); |
| 760 | 758 | $thisfile_mpeg_audio_lame_RGAD_track['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_track['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_track['raw']['sign_bit']); |
| 761 | 759 | |
| 762 | - if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) { |
|
| 763 | - $info['replay_gain']['track']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude']; |
|
| 760 | + if ( ! empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) { |
|
| 761 | + $info['replay_gain']['track']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude']; |
|
| 764 | 762 | } |
| 765 | 763 | $info['replay_gain']['track']['originator'] = $thisfile_mpeg_audio_lame_RGAD_track['originator']; |
| 766 | 764 | $info['replay_gain']['track']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_track['gain_db']; |
@@ -777,8 +775,8 @@ discard block |
||
| 777 | 775 | $thisfile_mpeg_audio_lame_RGAD_album['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['originator']); |
| 778 | 776 | $thisfile_mpeg_audio_lame_RGAD_album['gain_db'] = getid3_lib::RGADadjustmentLookup($thisfile_mpeg_audio_lame_RGAD_album['raw']['gain_adjust'], $thisfile_mpeg_audio_lame_RGAD_album['raw']['sign_bit']); |
| 779 | 777 | |
| 780 | - if (!empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) { |
|
| 781 | - $info['replay_gain']['album']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude']; |
|
| 778 | + if ( ! empty($thisfile_mpeg_audio_lame_RGAD['peak_amplitude'])) { |
|
| 779 | + $info['replay_gain']['album']['peak'] = $thisfile_mpeg_audio_lame_RGAD['peak_amplitude']; |
|
| 782 | 780 | } |
| 783 | 781 | $info['replay_gain']['album']['originator'] = $thisfile_mpeg_audio_lame_RGAD_album['originator']; |
| 784 | 782 | $info['replay_gain']['album']['adjustment'] = $thisfile_mpeg_audio_lame_RGAD_album['gain_db']; |
@@ -796,7 +794,7 @@ discard block |
||
| 796 | 794 | $thisfile_mpeg_audio_lame['encoding_flags']['nssafejoint'] = (bool) ($EncodingFlagsATHtype & 0x20); |
| 797 | 795 | $thisfile_mpeg_audio_lame['encoding_flags']['nogap_next'] = (bool) ($EncodingFlagsATHtype & 0x40); |
| 798 | 796 | $thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev'] = (bool) ($EncodingFlagsATHtype & 0x80); |
| 799 | - $thisfile_mpeg_audio_lame['ath_type'] = $EncodingFlagsATHtype & 0x0F; |
|
| 797 | + $thisfile_mpeg_audio_lame['ath_type'] = $EncodingFlagsATHtype & 0x0F; |
|
| 800 | 798 | |
| 801 | 799 | // byte $B0 if ABR {specified bitrate} else {minimal bitrate} |
| 802 | 800 | $thisfile_mpeg_audio_lame['raw']['abrbitrate_minbitrate'] = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB0, 1)); |
@@ -811,7 +809,7 @@ discard block |
||
| 811 | 809 | // bytes $B1-$B3 Encoder delays |
| 812 | 810 | $EncoderDelays = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB1, 3)); |
| 813 | 811 | $thisfile_mpeg_audio_lame['encoder_delay'] = ($EncoderDelays & 0xFFF000) >> 12; |
| 814 | - $thisfile_mpeg_audio_lame['end_padding'] = $EncoderDelays & 0x000FFF; |
|
| 812 | + $thisfile_mpeg_audio_lame['end_padding'] = $EncoderDelays & 0x000FFF; |
|
| 815 | 813 | |
| 816 | 814 | // byte $B4 Misc |
| 817 | 815 | $MiscByte = getid3_lib::BigEndian2Int(substr($headerstring, $LAMEtagOffsetContant + 0xB4, 1)); |
@@ -836,10 +834,10 @@ discard block |
||
| 836 | 834 | $thisfile_mpeg_audio_lame['surround_info'] = self::LAMEsurroundInfoLookup($thisfile_mpeg_audio_lame_raw['surround_info']); |
| 837 | 835 | $thisfile_mpeg_audio_lame['preset_used_id'] = ($PresetSurroundBytes & 0x07FF); |
| 838 | 836 | $thisfile_mpeg_audio_lame['preset_used'] = self::LAMEpresetUsedLookup($thisfile_mpeg_audio_lame); |
| 839 | - if (!empty($thisfile_mpeg_audio_lame['preset_used_id']) && empty($thisfile_mpeg_audio_lame['preset_used'])) { |
|
| 837 | + if ( ! empty($thisfile_mpeg_audio_lame['preset_used_id']) && empty($thisfile_mpeg_audio_lame['preset_used'])) { |
|
| 840 | 838 | $info['warning'][] = 'Unknown LAME preset used ('.$thisfile_mpeg_audio_lame['preset_used_id'].') - please report to [email protected]'; |
| 841 | 839 | } |
| 842 | - if (($thisfile_mpeg_audio_lame['short_version'] == 'LAME3.90.') && !empty($thisfile_mpeg_audio_lame['preset_used_id'])) { |
|
| 840 | + if (($thisfile_mpeg_audio_lame['short_version'] == 'LAME3.90.') && ! empty($thisfile_mpeg_audio_lame['preset_used_id'])) { |
|
| 843 | 841 | // this may change if 3.90.4 ever comes out |
| 844 | 842 | $thisfile_mpeg_audio_lame['short_version'] = 'LAME3.90.3'; |
| 845 | 843 | } |
@@ -948,7 +946,7 @@ discard block |
||
| 948 | 946 | } |
| 949 | 947 | $thisfile_mpeg_audio['VBR_bitrate'] = (isset($thisfile_mpeg_audio['VBR_bytes']) ? (($thisfile_mpeg_audio['VBR_bytes'] / $thisfile_mpeg_audio['VBR_frames']) * 8) * ($info['audio']['sample_rate'] / $bytes_per_frame) : 0); |
| 950 | 948 | if ($thisfile_mpeg_audio['VBR_bitrate'] > 0) { |
| 951 | - $info['audio']['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; |
|
| 949 | + $info['audio']['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; |
|
| 952 | 950 | $thisfile_mpeg_audio['bitrate'] = $thisfile_mpeg_audio['VBR_bitrate']; // to avoid confusion |
| 953 | 951 | } |
| 954 | 952 | break; |
@@ -960,7 +958,7 @@ discard block |
||
| 960 | 958 | |
| 961 | 959 | if ($recursivesearch) { |
| 962 | 960 | |
| 963 | - if (!$this->RecursiveFrameScanning($offset, $nextframetestoffset, $ScanAsCBR)) { |
|
| 961 | + if ( ! $this->RecursiveFrameScanning($offset, $nextframetestoffset, $ScanAsCBR)) { |
|
| 964 | 962 | return false; |
| 965 | 963 | } |
| 966 | 964 | |
@@ -1088,7 +1086,7 @@ discard block |
||
| 1088 | 1086 | if ($this->decodeMPEGaudioHeader($nextframetestoffset, $nextframetestarray, false)) { |
| 1089 | 1087 | if ($ScanAsCBR) { |
| 1090 | 1088 | // force CBR mode, used for trying to pick out invalid audio streams with valid(?) VBR headers, or VBR streams with no VBR header |
| 1091 | - if (!isset($nextframetestarray['mpeg']['audio']['bitrate']) || !isset($firstframetestarray['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $firstframetestarray['mpeg']['audio']['bitrate'])) { |
|
| 1089 | + if ( ! isset($nextframetestarray['mpeg']['audio']['bitrate']) || ! isset($firstframetestarray['mpeg']['audio']['bitrate']) || ($nextframetestarray['mpeg']['audio']['bitrate'] != $firstframetestarray['mpeg']['audio']['bitrate'])) { |
|
| 1092 | 1090 | return false; |
| 1093 | 1091 | } |
| 1094 | 1092 | } |
@@ -1102,7 +1100,7 @@ discard block |
||
| 1102 | 1100 | return false; |
| 1103 | 1101 | } |
| 1104 | 1102 | |
| 1105 | - } elseif (!empty($firstframetestarray['mpeg']['audio']['framelength']) && (($nextframetestoffset + $firstframetestarray['mpeg']['audio']['framelength']) > $info['avdataend'])) { |
|
| 1103 | + } elseif ( ! empty($firstframetestarray['mpeg']['audio']['framelength']) && (($nextframetestoffset + $firstframetestarray['mpeg']['audio']['framelength']) > $info['avdataend'])) { |
|
| 1106 | 1104 | |
| 1107 | 1105 | // it's not the end of the file, but there's not enough data left for another frame, so assume it's garbage/padding and return OK |
| 1108 | 1106 | return true; |
@@ -1118,7 +1116,7 @@ discard block |
||
| 1118 | 1116 | return true; |
| 1119 | 1117 | } |
| 1120 | 1118 | |
| 1121 | - public function FreeFormatFrameLength($offset, $deepscan=false) { |
|
| 1119 | + public function FreeFormatFrameLength($offset, $deepscan = false) { |
|
| 1122 | 1120 | $info = &$this->getid3->info; |
| 1123 | 1121 | |
| 1124 | 1122 | $this->fseek($offset); |
@@ -1140,7 +1138,7 @@ discard block |
||
| 1140 | 1138 | if (($framelength2 > 4) && ($framelength2 < $framelength1)) { |
| 1141 | 1139 | $framelength = $framelength2; |
| 1142 | 1140 | } |
| 1143 | - if (!$framelength) { |
|
| 1141 | + if ( ! $framelength) { |
|
| 1144 | 1142 | |
| 1145 | 1143 | // LAME 3.88 has a different value for modeextension on the first frame vs the rest |
| 1146 | 1144 | $framelength1 = strpos($MPEGaudioData, substr($SyncPattern1, 0, 3), 4); |
@@ -1152,7 +1150,7 @@ discard block |
||
| 1152 | 1150 | if (($framelength2 > 4) && ($framelength2 < $framelength1)) { |
| 1153 | 1151 | $framelength = $framelength2; |
| 1154 | 1152 | } |
| 1155 | - if (!$framelength) { |
|
| 1153 | + if ( ! $framelength) { |
|
| 1156 | 1154 | $info['error'][] = 'Cannot find next free-format synch pattern ('.getid3_lib::PrintHexBytes($SyncPattern1).' or '.getid3_lib::PrintHexBytes($SyncPattern2).') after offset '.$offset; |
| 1157 | 1155 | return false; |
| 1158 | 1156 | } else { |
@@ -1239,15 +1237,15 @@ discard block |
||
| 1239 | 1237 | } |
| 1240 | 1238 | continue; |
| 1241 | 1239 | } |
| 1242 | - if (!isset($MPEGaudioHeaderDecodeCache[$head4])) { |
|
| 1240 | + if ( ! isset($MPEGaudioHeaderDecodeCache[$head4])) { |
|
| 1243 | 1241 | $MPEGaudioHeaderDecodeCache[$head4] = self::MPEGaudioHeaderDecode($head4); |
| 1244 | 1242 | } |
| 1245 | - if (!isset($MPEGaudioHeaderValidCache[$head4])) { |
|
| 1243 | + if ( ! isset($MPEGaudioHeaderValidCache[$head4])) { |
|
| 1246 | 1244 | $MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false); |
| 1247 | 1245 | } |
| 1248 | 1246 | if ($MPEGaudioHeaderValidCache[$head4]) { |
| 1249 | 1247 | |
| 1250 | - if (!isset($MPEGaudioHeaderLengthCache[$head4])) { |
|
| 1248 | + if ( ! isset($MPEGaudioHeaderLengthCache[$head4])) { |
|
| 1251 | 1249 | $LongMPEGversionLookup[$head4] = $MPEGaudioVersionLookup[$MPEGaudioHeaderDecodeCache[$head4]['version']]; |
| 1252 | 1250 | $LongMPEGlayerLookup[$head4] = $MPEGaudioLayerLookup[$MPEGaudioHeaderDecodeCache[$head4]['layer']]; |
| 1253 | 1251 | $LongMPEGbitrateLookup[$head4] = $MPEGaudioBitrateLookup[$LongMPEGversionLookup[$head4]][$LongMPEGlayerLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['bitrate']]; |
@@ -1265,10 +1263,10 @@ discard block |
||
| 1265 | 1263 | $this->fseek($MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR); |
| 1266 | 1264 | $next4 = $this->fread(4); |
| 1267 | 1265 | if ($next4{0} == "\xFF") { |
| 1268 | - if (!isset($MPEGaudioHeaderDecodeCache[$next4])) { |
|
| 1266 | + if ( ! isset($MPEGaudioHeaderDecodeCache[$next4])) { |
|
| 1269 | 1267 | $MPEGaudioHeaderDecodeCache[$next4] = self::MPEGaudioHeaderDecode($next4); |
| 1270 | 1268 | } |
| 1271 | - if (!isset($MPEGaudioHeaderValidCache[$next4])) { |
|
| 1269 | + if ( ! isset($MPEGaudioHeaderValidCache[$next4])) { |
|
| 1272 | 1270 | $MPEGaudioHeaderValidCache[$next4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false); |
| 1273 | 1271 | } |
| 1274 | 1272 | if ($MPEGaudioHeaderValidCache[$next4]) { |
@@ -1324,7 +1322,7 @@ discard block |
||
| 1324 | 1322 | $bittotal += ($bitratevalue * $bitratecount); |
| 1325 | 1323 | } |
| 1326 | 1324 | } |
| 1327 | - $info['mpeg']['audio']['frame_count'] = array_sum($Distribution['bitrate']); |
|
| 1325 | + $info['mpeg']['audio']['frame_count'] = array_sum($Distribution['bitrate']); |
|
| 1328 | 1326 | if ($info['mpeg']['audio']['frame_count'] == 0) { |
| 1329 | 1327 | $info['error'][] = 'no MPEG audio frames found'; |
| 1330 | 1328 | return false; |
@@ -1343,7 +1341,7 @@ discard block |
||
| 1343 | 1341 | } |
| 1344 | 1342 | |
| 1345 | 1343 | |
| 1346 | - public function getOnlyMPEGaudioInfo($avdataoffset, $BitrateHistogram=false) { |
|
| 1344 | + public function getOnlyMPEGaudioInfo($avdataoffset, $BitrateHistogram = false) { |
|
| 1347 | 1345 | // looks for synch, decodes MPEG audio header |
| 1348 | 1346 | |
| 1349 | 1347 | $info = &$this->getid3->info; |
@@ -1368,7 +1366,7 @@ discard block |
||
| 1368 | 1366 | $sync_seek_buffer_size = strlen($header); |
| 1369 | 1367 | $SynchSeekOffset = 0; |
| 1370 | 1368 | while ($SynchSeekOffset < $sync_seek_buffer_size) { |
| 1371 | - if ((($avdataoffset + $SynchSeekOffset) < $info['avdataend']) && !feof($this->getid3->fp)) { |
|
| 1369 | + if ((($avdataoffset + $SynchSeekOffset) < $info['avdataend']) && ! feof($this->getid3->fp)) { |
|
| 1372 | 1370 | |
| 1373 | 1371 | if ($SynchSeekOffset > $sync_seek_buffer_size) { |
| 1374 | 1372 | // if a synch's not found within the first 128k bytes, then give up |
@@ -1393,7 +1391,7 @@ discard block |
||
| 1393 | 1391 | if (isset($info['mpeg']['audio'])) { |
| 1394 | 1392 | unset($info['mpeg']['audio']); |
| 1395 | 1393 | } |
| 1396 | - if (isset($info['mpeg']) && (!is_array($info['mpeg']) || (count($info['mpeg']) == 0))) { |
|
| 1394 | + if (isset($info['mpeg']) && ( ! is_array($info['mpeg']) || (count($info['mpeg']) == 0))) { |
|
| 1397 | 1395 | unset($info['mpeg']); |
| 1398 | 1396 | } |
| 1399 | 1397 | return false; |
@@ -1406,10 +1404,10 @@ discard block |
||
| 1406 | 1404 | } |
| 1407 | 1405 | |
| 1408 | 1406 | if (($header{$SynchSeekOffset} == "\xFF") && ($header{($SynchSeekOffset + 1)} > "\xE0")) { // synch detected |
| 1409 | - if (!isset($FirstFrameThisfileInfo) && !isset($info['mpeg']['audio'])) { |
|
| 1407 | + if ( ! isset($FirstFrameThisfileInfo) && ! isset($info['mpeg']['audio'])) { |
|
| 1410 | 1408 | $FirstFrameThisfileInfo = $info; |
| 1411 | 1409 | $FirstFrameAVDataOffset = $avdataoffset + $SynchSeekOffset; |
| 1412 | - if (!$this->decodeMPEGaudioHeader($FirstFrameAVDataOffset, $FirstFrameThisfileInfo, false)) { |
|
| 1410 | + if ( ! $this->decodeMPEGaudioHeader($FirstFrameAVDataOffset, $FirstFrameThisfileInfo, false)) { |
|
| 1413 | 1411 | // if this is the first valid MPEG-audio frame, save it in case it's a VBR header frame and there's |
| 1414 | 1412 | // garbage between this frame and a valid sequence of MPEG-audio frames, to be restored below |
| 1415 | 1413 | unset($FirstFrameThisfileInfo); |
@@ -1421,16 +1419,12 @@ discard block |
||
| 1421 | 1419 | $info = $dummy; |
| 1422 | 1420 | $info['avdataoffset'] = $avdataoffset + $SynchSeekOffset; |
| 1423 | 1421 | switch (isset($info['fileformat']) ? $info['fileformat'] : '') { |
| 1424 | - case '': |
|
| 1425 | - case 'id3': |
|
| 1426 | - case 'ape': |
|
| 1427 | - case 'mp3': |
|
| 1428 | - $info['fileformat'] = 'mp3'; |
|
| 1422 | + case '' : case 'id3' : case 'ape' : case 'mp3' : $info['fileformat'] = 'mp3'; |
|
| 1429 | 1423 | $info['audio']['dataformat'] = 'mp3'; |
| 1430 | 1424 | break; |
| 1431 | 1425 | } |
| 1432 | 1426 | if (isset($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode']) && ($FirstFrameThisfileInfo['mpeg']['audio']['bitrate_mode'] == 'vbr')) { |
| 1433 | - if (!(abs($info['audio']['bitrate'] - $FirstFrameThisfileInfo['audio']['bitrate']) <= 1)) { |
|
| 1427 | + if ( ! (abs($info['audio']['bitrate'] - $FirstFrameThisfileInfo['audio']['bitrate']) <= 1)) { |
|
| 1434 | 1428 | // If there is garbage data between a valid VBR header frame and a sequence |
| 1435 | 1429 | // of valid MPEG-audio frames the VBR data is no longer discarded. |
| 1436 | 1430 | $info = $FirstFrameThisfileInfo; |
@@ -1450,7 +1444,7 @@ discard block |
||
| 1450 | 1444 | } |
| 1451 | 1445 | } |
| 1452 | 1446 | } |
| 1453 | - if (isset($info['mpeg']['audio']['bitrate_mode']) && ($info['mpeg']['audio']['bitrate_mode'] == 'vbr') && !isset($info['mpeg']['audio']['VBR_method'])) { |
|
| 1447 | + if (isset($info['mpeg']['audio']['bitrate_mode']) && ($info['mpeg']['audio']['bitrate_mode'] == 'vbr') && ! isset($info['mpeg']['audio']['VBR_method'])) { |
|
| 1454 | 1448 | // VBR file with no VBR header |
| 1455 | 1449 | $BitrateHistogram = true; |
| 1456 | 1450 | } |
@@ -1479,7 +1473,7 @@ discard block |
||
| 1479 | 1473 | $this->fseek($info['avdataoffset']); |
| 1480 | 1474 | |
| 1481 | 1475 | // you can play with these numbers: |
| 1482 | - $max_frames_scan = 50000; |
|
| 1476 | + $max_frames_scan = 50000; |
|
| 1483 | 1477 | $max_scan_segments = 10; |
| 1484 | 1478 | |
| 1485 | 1479 | // don't play with these numbers: |
@@ -1541,7 +1535,7 @@ discard block |
||
| 1541 | 1535 | if ($pct_data_scanned > 0) { |
| 1542 | 1536 | $info['warning'][] = 'too many MPEG audio frames to scan, only scanned '.$frames_scanned.' frames in '.$max_scan_segments.' segments ('.number_format($pct_data_scanned * 100, 1).'% of file) and extrapolated distribution, playtime and bitrate may be incorrect.'; |
| 1543 | 1537 | foreach ($info['mpeg']['audio'] as $key1 => $value1) { |
| 1544 | - if (!preg_match('#_distribution$#i', $key1)) { |
|
| 1538 | + if ( ! preg_match('#_distribution$#i', $key1)) { |
|
| 1545 | 1539 | continue; |
| 1546 | 1540 | } |
| 1547 | 1541 | foreach ($value1 as $key2 => $value2) { |
@@ -1606,7 +1600,7 @@ discard block |
||
| 1606 | 1600 | if (isset($info['mpeg']['audio'])) { |
| 1607 | 1601 | unset($info['mpeg']['audio']); |
| 1608 | 1602 | } |
| 1609 | - if (isset($info['mpeg']) && (!is_array($info['mpeg']) || empty($info['mpeg']))) { |
|
| 1603 | + if (isset($info['mpeg']) && ( ! is_array($info['mpeg']) || empty($info['mpeg']))) { |
|
| 1610 | 1604 | unset($info['mpeg']); |
| 1611 | 1605 | } |
| 1612 | 1606 | return false; |
@@ -1636,14 +1630,14 @@ discard block |
||
| 1636 | 1630 | public static function MPEGaudioBitrateArray() { |
| 1637 | 1631 | static $MPEGaudioBitrate; |
| 1638 | 1632 | if (empty($MPEGaudioBitrate)) { |
| 1639 | - $MPEGaudioBitrate = array ( |
|
| 1640 | - '1' => array (1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000), |
|
| 1641 | - 2 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000), |
|
| 1642 | - 3 => array('free', 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000) |
|
| 1633 | + $MPEGaudioBitrate = array( |
|
| 1634 | + '1' => array(1 => array('free', 32000, 64000, 96000, 128000, 160000, 192000, 224000, 256000, 288000, 320000, 352000, 384000, 416000, 448000), |
|
| 1635 | + 2 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000, 384000), |
|
| 1636 | + 3 => array('free', 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000, 224000, 256000, 320000) |
|
| 1643 | 1637 | ), |
| 1644 | 1638 | |
| 1645 | - '2' => array (1 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000), |
|
| 1646 | - 2 => array('free', 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000), |
|
| 1639 | + '2' => array(1 => array('free', 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000, 176000, 192000, 224000, 256000), |
|
| 1640 | + 2 => array('free', 8000, 16000, 24000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000, 160000), |
|
| 1647 | 1641 | ) |
| 1648 | 1642 | ); |
| 1649 | 1643 | $MPEGaudioBitrate['2'][3] = $MPEGaudioBitrate['2'][2]; |
@@ -1655,10 +1649,10 @@ discard block |
||
| 1655 | 1649 | public static function MPEGaudioFrequencyArray() { |
| 1656 | 1650 | static $MPEGaudioFrequency; |
| 1657 | 1651 | if (empty($MPEGaudioFrequency)) { |
| 1658 | - $MPEGaudioFrequency = array ( |
|
| 1652 | + $MPEGaudioFrequency = array( |
|
| 1659 | 1653 | '1' => array(44100, 48000, 32000), |
| 1660 | 1654 | '2' => array(22050, 24000, 16000), |
| 1661 | - '2.5' => array(11025, 12000, 8000) |
|
| 1655 | + '2.5' => array(11025, 12000, 8000) |
|
| 1662 | 1656 | ); |
| 1663 | 1657 | } |
| 1664 | 1658 | return $MPEGaudioFrequency; |
@@ -1672,7 +1666,7 @@ discard block |
||
| 1672 | 1666 | public static function MPEGaudioModeExtensionArray() { |
| 1673 | 1667 | static $MPEGaudioModeExtension; |
| 1674 | 1668 | if (empty($MPEGaudioModeExtension)) { |
| 1675 | - $MPEGaudioModeExtension = array ( |
|
| 1669 | + $MPEGaudioModeExtension = array( |
|
| 1676 | 1670 | 1 => array('4-31', '8-31', '12-31', '16-31'), |
| 1677 | 1671 | 2 => array('4-31', '8-31', '12-31', '16-31'), |
| 1678 | 1672 | 3 => array('', 'IS', 'MS', 'IS+MS') |
@@ -1686,11 +1680,11 @@ discard block |
||
| 1686 | 1680 | return $MPEGaudioEmphasis; |
| 1687 | 1681 | } |
| 1688 | 1682 | |
| 1689 | - public static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15=false) { |
|
| 1683 | + public static function MPEGaudioHeaderBytesValid($head4, $allowBitrate15 = false) { |
|
| 1690 | 1684 | return self::MPEGaudioHeaderValid(self::MPEGaudioHeaderDecode($head4), false, $allowBitrate15); |
| 1691 | 1685 | } |
| 1692 | 1686 | |
| 1693 | - public static function MPEGaudioHeaderValid($rawarray, $echoerrors=false, $allowBitrate15=false) { |
|
| 1687 | + public static function MPEGaudioHeaderValid($rawarray, $echoerrors = false, $allowBitrate15 = false) { |
|
| 1694 | 1688 | if (($rawarray['synch'] & 0x0FFE) != 0x0FFE) { |
| 1695 | 1689 | return false; |
| 1696 | 1690 | } |
@@ -1724,31 +1718,31 @@ discard block |
||
| 1724 | 1718 | echo ($echoerrors ? "\n".'invalid Layer ('.$rawarray['layer'].')' : ''); |
| 1725 | 1719 | return false; |
| 1726 | 1720 | } |
| 1727 | - if (!isset($MPEGaudioBitrateLookup[$decodedVersion][$decodedLayer][$rawarray['bitrate']])) { |
|
| 1721 | + if ( ! isset($MPEGaudioBitrateLookup[$decodedVersion][$decodedLayer][$rawarray['bitrate']])) { |
|
| 1728 | 1722 | echo ($echoerrors ? "\n".'invalid Bitrate ('.$rawarray['bitrate'].')' : ''); |
| 1729 | 1723 | if ($rawarray['bitrate'] == 15) { |
| 1730 | 1724 | // known issue in LAME 3.90 - 3.93.1 where free-format has bitrate ID of 15 instead of 0 |
| 1731 | 1725 | // let it go through here otherwise file will not be identified |
| 1732 | - if (!$allowBitrate15) { |
|
| 1726 | + if ( ! $allowBitrate15) { |
|
| 1733 | 1727 | return false; |
| 1734 | 1728 | } |
| 1735 | 1729 | } else { |
| 1736 | 1730 | return false; |
| 1737 | 1731 | } |
| 1738 | 1732 | } |
| 1739 | - if (!isset($MPEGaudioFrequencyLookup[$decodedVersion][$rawarray['sample_rate']])) { |
|
| 1733 | + if ( ! isset($MPEGaudioFrequencyLookup[$decodedVersion][$rawarray['sample_rate']])) { |
|
| 1740 | 1734 | echo ($echoerrors ? "\n".'invalid Frequency ('.$rawarray['sample_rate'].')' : ''); |
| 1741 | 1735 | return false; |
| 1742 | 1736 | } |
| 1743 | - if (!isset($MPEGaudioChannelModeLookup[$rawarray['channelmode']])) { |
|
| 1737 | + if ( ! isset($MPEGaudioChannelModeLookup[$rawarray['channelmode']])) { |
|
| 1744 | 1738 | echo ($echoerrors ? "\n".'invalid ChannelMode ('.$rawarray['channelmode'].')' : ''); |
| 1745 | 1739 | return false; |
| 1746 | 1740 | } |
| 1747 | - if (!isset($MPEGaudioModeExtensionLookup[$decodedLayer][$rawarray['modeextension']])) { |
|
| 1741 | + if ( ! isset($MPEGaudioModeExtensionLookup[$decodedLayer][$rawarray['modeextension']])) { |
|
| 1748 | 1742 | echo ($echoerrors ? "\n".'invalid Mode Extension ('.$rawarray['modeextension'].')' : ''); |
| 1749 | 1743 | return false; |
| 1750 | 1744 | } |
| 1751 | - if (!isset($MPEGaudioEmphasisLookup[$rawarray['emphasis']])) { |
|
| 1745 | + if ( ! isset($MPEGaudioEmphasisLookup[$rawarray['emphasis']])) { |
|
| 1752 | 1746 | echo ($echoerrors ? "\n".'invalid Emphasis ('.$rawarray['emphasis'].')' : ''); |
| 1753 | 1747 | return false; |
| 1754 | 1748 | } |
@@ -1785,16 +1779,16 @@ discard block |
||
| 1785 | 1779 | $MPEGrawHeader['synch'] = (getid3_lib::BigEndian2Int(substr($Header4Bytes, 0, 2)) & 0xFFE0) >> 4; |
| 1786 | 1780 | $MPEGrawHeader['version'] = (ord($Header4Bytes{1}) & 0x18) >> 3; // BB |
| 1787 | 1781 | $MPEGrawHeader['layer'] = (ord($Header4Bytes{1}) & 0x06) >> 1; // CC |
| 1788 | - $MPEGrawHeader['protection'] = (ord($Header4Bytes{1}) & 0x01); // D |
|
| 1782 | + $MPEGrawHeader['protection'] = (ord($Header4Bytes{1}) & 0x01); // D |
|
| 1789 | 1783 | $MPEGrawHeader['bitrate'] = (ord($Header4Bytes{2}) & 0xF0) >> 4; // EEEE |
| 1790 | 1784 | $MPEGrawHeader['sample_rate'] = (ord($Header4Bytes{2}) & 0x0C) >> 2; // FF |
| 1791 | 1785 | $MPEGrawHeader['padding'] = (ord($Header4Bytes{2}) & 0x02) >> 1; // G |
| 1792 | - $MPEGrawHeader['private'] = (ord($Header4Bytes{2}) & 0x01); // H |
|
| 1786 | + $MPEGrawHeader['private'] = (ord($Header4Bytes{2}) & 0x01); // H |
|
| 1793 | 1787 | $MPEGrawHeader['channelmode'] = (ord($Header4Bytes{3}) & 0xC0) >> 6; // II |
| 1794 | 1788 | $MPEGrawHeader['modeextension'] = (ord($Header4Bytes{3}) & 0x30) >> 4; // JJ |
| 1795 | 1789 | $MPEGrawHeader['copyright'] = (ord($Header4Bytes{3}) & 0x08) >> 3; // K |
| 1796 | 1790 | $MPEGrawHeader['original'] = (ord($Header4Bytes{3}) & 0x04) >> 2; // L |
| 1797 | - $MPEGrawHeader['emphasis'] = (ord($Header4Bytes{3}) & 0x03); // MM |
|
| 1791 | + $MPEGrawHeader['emphasis'] = (ord($Header4Bytes{3}) & 0x03); // MM |
|
| 1798 | 1792 | |
| 1799 | 1793 | return $MPEGrawHeader; |
| 1800 | 1794 | } |
@@ -1802,7 +1796,7 @@ discard block |
||
| 1802 | 1796 | public static function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) { |
| 1803 | 1797 | static $AudioFrameLengthCache = array(); |
| 1804 | 1798 | |
| 1805 | - if (!isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) { |
|
| 1799 | + if ( ! isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) { |
|
| 1806 | 1800 | $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = false; |
| 1807 | 1801 | if ($bitrate != 'free') { |
| 1808 | 1802 | |
@@ -1861,10 +1855,10 @@ discard block |
||
| 1861 | 1855 | } |
| 1862 | 1856 | |
| 1863 | 1857 | public static function ClosestStandardMP3Bitrate($bit_rate) { |
| 1864 | - static $standard_bit_rates = array (320000, 256000, 224000, 192000, 160000, 128000, 112000, 96000, 80000, 64000, 56000, 48000, 40000, 32000, 24000, 16000, 8000); |
|
| 1865 | - static $bit_rate_table = array (0=>'-'); |
|
| 1858 | + static $standard_bit_rates = array(320000, 256000, 224000, 192000, 160000, 128000, 112000, 96000, 80000, 64000, 56000, 48000, 40000, 32000, 24000, 16000, 8000); |
|
| 1859 | + static $bit_rate_table = array(0=>'-'); |
|
| 1866 | 1860 | $round_bit_rate = intval(round($bit_rate, -3)); |
| 1867 | - if (!isset($bit_rate_table[$round_bit_rate])) { |
|
| 1861 | + if ( ! isset($bit_rate_table[$round_bit_rate])) { |
|
| 1868 | 1862 | if ($round_bit_rate > max($standard_bit_rates)) { |
| 1869 | 1863 | $bit_rate_table[$round_bit_rate] = round($bit_rate, 2 - strlen($bit_rate)); |
| 1870 | 1864 | } else { |
@@ -1883,20 +1877,20 @@ discard block |
||
| 1883 | 1877 | public static function XingVBRidOffset($version, $channelmode) { |
| 1884 | 1878 | static $XingVBRidOffsetCache = array(); |
| 1885 | 1879 | if (empty($XingVBRidOffset)) { |
| 1886 | - $XingVBRidOffset = array ( |
|
| 1887 | - '1' => array ('mono' => 0x15, // 4 + 17 = 21 |
|
| 1880 | + $XingVBRidOffset = array( |
|
| 1881 | + '1' => array('mono' => 0x15, // 4 + 17 = 21 |
|
| 1888 | 1882 | 'stereo' => 0x24, // 4 + 32 = 36 |
| 1889 | 1883 | 'joint stereo' => 0x24, |
| 1890 | 1884 | 'dual channel' => 0x24 |
| 1891 | 1885 | ), |
| 1892 | 1886 | |
| 1893 | - '2' => array ('mono' => 0x0D, // 4 + 9 = 13 |
|
| 1887 | + '2' => array('mono' => 0x0D, // 4 + 9 = 13 |
|
| 1894 | 1888 | 'stereo' => 0x15, // 4 + 17 = 21 |
| 1895 | 1889 | 'joint stereo' => 0x15, |
| 1896 | 1890 | 'dual channel' => 0x15 |
| 1897 | 1891 | ), |
| 1898 | 1892 | |
| 1899 | - '2.5' => array ('mono' => 0x15, |
|
| 1893 | + '2.5' => array('mono' => 0x15, |
|
| 1900 | 1894 | 'stereo' => 0x15, |
| 1901 | 1895 | 'joint stereo' => 0x15, |
| 1902 | 1896 | 'dual channel' => 0x15 |
@@ -1991,20 +1985,20 @@ discard block |
||
| 1991 | 1985 | $LAMEpresetUsedLookup[1007] = '--alt-preset fast medium'; |
| 1992 | 1986 | |
| 1993 | 1987 | // LAME 3.94 additions/changes |
| 1994 | - $LAMEpresetUsedLookup[1010] = '--preset portable'; // 3.94a15 Oct 21 2003 |
|
| 1995 | - $LAMEpresetUsedLookup[1015] = '--preset radio'; // 3.94a15 Oct 21 2003 |
|
| 1988 | + $LAMEpresetUsedLookup[1010] = '--preset portable'; // 3.94a15 Oct 21 2003 |
|
| 1989 | + $LAMEpresetUsedLookup[1015] = '--preset radio'; // 3.94a15 Oct 21 2003 |
|
| 1996 | 1990 | |
| 1997 | - $LAMEpresetUsedLookup[320] = '--preset insane'; // 3.94a15 Nov 12 2003 |
|
| 1991 | + $LAMEpresetUsedLookup[320] = '--preset insane'; // 3.94a15 Nov 12 2003 |
|
| 1998 | 1992 | $LAMEpresetUsedLookup[410] = '-V9'; |
| 1999 | 1993 | $LAMEpresetUsedLookup[420] = '-V8'; |
| 2000 | 1994 | $LAMEpresetUsedLookup[440] = '-V6'; |
| 2001 | - $LAMEpresetUsedLookup[430] = '--preset radio'; // 3.94a15 Nov 12 2003 |
|
| 2002 | - $LAMEpresetUsedLookup[450] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'portable'; // 3.94a15 Nov 12 2003 |
|
| 2003 | - $LAMEpresetUsedLookup[460] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'medium'; // 3.94a15 Nov 12 2003 |
|
| 2004 | - $LAMEpresetUsedLookup[470] = '--r3mix'; // 3.94b1 Dec 18 2003 |
|
| 2005 | - $LAMEpresetUsedLookup[480] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'standard'; // 3.94a15 Nov 12 2003 |
|
| 1995 | + $LAMEpresetUsedLookup[430] = '--preset radio'; // 3.94a15 Nov 12 2003 |
|
| 1996 | + $LAMEpresetUsedLookup[450] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'portable'; // 3.94a15 Nov 12 2003 |
|
| 1997 | + $LAMEpresetUsedLookup[460] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'medium'; // 3.94a15 Nov 12 2003 |
|
| 1998 | + $LAMEpresetUsedLookup[470] = '--r3mix'; // 3.94b1 Dec 18 2003 |
|
| 1999 | + $LAMEpresetUsedLookup[480] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'standard'; // 3.94a15 Nov 12 2003 |
|
| 2006 | 2000 | $LAMEpresetUsedLookup[490] = '-V1'; |
| 2007 | - $LAMEpresetUsedLookup[500] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'extreme'; // 3.94a15 Nov 12 2003 |
|
| 2001 | + $LAMEpresetUsedLookup[500] = '--preset '.(($LAMEtag['raw']['vbr_method'] == 4) ? 'fast ' : '').'extreme'; // 3.94a15 Nov 12 2003 |
|
| 2008 | 2002 | |
| 2009 | 2003 | return (isset($LAMEpresetUsedLookup[$LAMEtag['preset_used_id']]) ? $LAMEpresetUsedLookup[$LAMEtag['preset_used_id']] : 'new/unknown preset: '.$LAMEtag['preset_used_id'].' - report to [email protected]'); |
| 2010 | 2004 | } |
@@ -893,11 +893,9 @@ |
||
| 893 | 893 | if ($ExpectedNumberOfAudioBytes > ($info['avdataend'] - $info['avdataoffset'])) { |
| 894 | 894 | if ($this->isDependencyFor('matroska') || $this->isDependencyFor('riff')) { |
| 895 | 895 | // ignore, audio data is broken into chunks so will always be data "missing" |
| 896 | - } |
|
| 897 | - elseif (($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])) == 1) { |
|
| 896 | + } elseif (($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])) == 1) { |
|
| 898 | 897 | $this->warning('Last byte of data truncated (this is a known bug in Meracl ID3 Tag Writer before v1.3.5)'); |
| 899 | - } |
|
| 900 | - else { |
|
| 898 | + } else { |
|
| 901 | 899 | $this->warning('Probable truncated file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, only found '.($info['avdataend'] - $info['avdataoffset']).' (short by '.($ExpectedNumberOfAudioBytes - ($info['avdataend'] - $info['avdataoffset'])).' bytes)'); |
| 902 | 900 | } |
| 903 | 901 | } else { |
@@ -427,6 +427,11 @@ |
||
| 427 | 427 | } |
| 428 | 428 | |
| 429 | 429 | // http://tools.ietf.org/html/draft-ietf-codec-oggopus-03 |
| 430 | + |
|
| 431 | + /** |
|
| 432 | + * @param string $filedata |
|
| 433 | + * @param integer $filedataoffset |
|
| 434 | + */ |
|
| 430 | 435 | public function ParseOpusPageHeader(&$filedata, &$filedataoffset, &$oggpageinfo) { |
| 431 | 436 | $info = &$this->getid3->info; |
| 432 | 437 | $info['audio']['dataformat'] = 'opus'; |
@@ -528,7 +528,7 @@ |
||
| 528 | 528 | return $oggheader; |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | - // http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-810005 |
|
| 531 | + // http://xiph.org/vorbis/doc/Vorbis_I_spec.html#x1-810005 |
|
| 532 | 532 | public function ParseVorbisComments() { |
| 533 | 533 | $info = &$this->getid3->info; |
| 534 | 534 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | } elseif (substr($filedata, 0, 8) == 'OpusHead') { |
| 67 | 67 | |
| 68 | - if( $this->ParseOpusPageHeader($filedata, $filedataoffset, $oggpageinfo) == false ) { |
|
| 68 | + if ($this->ParseOpusPageHeader($filedata, $filedataoffset, $oggpageinfo) == false) { |
|
| 69 | 69 | return false; |
| 70 | 70 | } |
| 71 | 71 | |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | $info['audio']['bitrate_mode'] = 'abr'; |
| 79 | 79 | $info['audio']['lossless'] = false; |
| 80 | 80 | |
| 81 | - $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_string'] = substr($filedata, $filedataoffset, 8); // hard-coded to 'Speex ' |
|
| 81 | + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_string'] = substr($filedata, $filedataoffset, 8); // hard-coded to 'Speex ' |
|
| 82 | 82 | $filedataoffset += 8; |
| 83 | - $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version'] = substr($filedata, $filedataoffset, 20); |
|
| 83 | + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version'] = substr($filedata, $filedataoffset, 20); |
|
| 84 | 84 | $filedataoffset += 20; |
| 85 | 85 | $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['speex_version_id'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
| 86 | 86 | $filedataoffset += 4; |
@@ -125,45 +125,45 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | // http://www.theora.org/doc/Theora.pdf (section 6.2) |
| 127 | 127 | |
| 128 | - $info['ogg']['pageheader']['theora']['theora_magic'] = substr($filedata, $filedataoffset, 7); // hard-coded to "\x80.'theora' |
|
| 128 | + $info['ogg']['pageheader']['theora']['theora_magic'] = substr($filedata, $filedataoffset, 7); // hard-coded to "\x80.'theora' |
|
| 129 | 129 | $filedataoffset += 7; |
| 130 | - $info['ogg']['pageheader']['theora']['version_major'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 130 | + $info['ogg']['pageheader']['theora']['version_major'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 131 | 131 | $filedataoffset += 1; |
| 132 | - $info['ogg']['pageheader']['theora']['version_minor'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 132 | + $info['ogg']['pageheader']['theora']['version_minor'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 133 | 133 | $filedataoffset += 1; |
| 134 | - $info['ogg']['pageheader']['theora']['version_revision'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 134 | + $info['ogg']['pageheader']['theora']['version_revision'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 135 | 135 | $filedataoffset += 1; |
| 136 | - $info['ogg']['pageheader']['theora']['frame_width_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 136 | + $info['ogg']['pageheader']['theora']['frame_width_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 137 | 137 | $filedataoffset += 2; |
| 138 | - $info['ogg']['pageheader']['theora']['frame_height_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 138 | + $info['ogg']['pageheader']['theora']['frame_height_macroblocks'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 139 | 139 | $filedataoffset += 2; |
| 140 | - $info['ogg']['pageheader']['theora']['resolution_x'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); |
|
| 140 | + $info['ogg']['pageheader']['theora']['resolution_x'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); |
|
| 141 | 141 | $filedataoffset += 3; |
| 142 | - $info['ogg']['pageheader']['theora']['resolution_y'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); |
|
| 142 | + $info['ogg']['pageheader']['theora']['resolution_y'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); |
|
| 143 | 143 | $filedataoffset += 3; |
| 144 | - $info['ogg']['pageheader']['theora']['picture_offset_x'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 144 | + $info['ogg']['pageheader']['theora']['picture_offset_x'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 145 | 145 | $filedataoffset += 1; |
| 146 | - $info['ogg']['pageheader']['theora']['picture_offset_y'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 146 | + $info['ogg']['pageheader']['theora']['picture_offset_y'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 147 | 147 | $filedataoffset += 1; |
| 148 | - $info['ogg']['pageheader']['theora']['frame_rate_numerator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 148 | + $info['ogg']['pageheader']['theora']['frame_rate_numerator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 149 | 149 | $filedataoffset += 4; |
| 150 | - $info['ogg']['pageheader']['theora']['frame_rate_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 150 | + $info['ogg']['pageheader']['theora']['frame_rate_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 151 | 151 | $filedataoffset += 4; |
| 152 | - $info['ogg']['pageheader']['theora']['pixel_aspect_numerator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); |
|
| 152 | + $info['ogg']['pageheader']['theora']['pixel_aspect_numerator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); |
|
| 153 | 153 | $filedataoffset += 3; |
| 154 | - $info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); |
|
| 154 | + $info['ogg']['pageheader']['theora']['pixel_aspect_denominator'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); |
|
| 155 | 155 | $filedataoffset += 3; |
| 156 | - $info['ogg']['pageheader']['theora']['color_space_id'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 156 | + $info['ogg']['pageheader']['theora']['color_space_id'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 157 | 157 | $filedataoffset += 1; |
| 158 | - $info['ogg']['pageheader']['theora']['nominal_bitrate'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); |
|
| 158 | + $info['ogg']['pageheader']['theora']['nominal_bitrate'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 3)); |
|
| 159 | 159 | $filedataoffset += 3; |
| 160 | - $info['ogg']['pageheader']['theora']['flags'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 160 | + $info['ogg']['pageheader']['theora']['flags'] = getid3_lib::BigEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 161 | 161 | $filedataoffset += 2; |
| 162 | 162 | |
| 163 | 163 | $info['ogg']['pageheader']['theora']['quality'] = ($info['ogg']['pageheader']['theora']['flags'] & 0xFC00) >> 10; |
| 164 | - $info['ogg']['pageheader']['theora']['kfg_shift'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x03E0) >> 5; |
|
| 165 | - $info['ogg']['pageheader']['theora']['pixel_format_id'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0018) >> 3; |
|
| 166 | - $info['ogg']['pageheader']['theora']['reserved'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0007) >> 0; // should be 0 |
|
| 164 | + $info['ogg']['pageheader']['theora']['kfg_shift'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x03E0) >> 5; |
|
| 165 | + $info['ogg']['pageheader']['theora']['pixel_format_id'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0018) >> 3; |
|
| 166 | + $info['ogg']['pageheader']['theora']['reserved'] = ($info['ogg']['pageheader']['theora']['flags'] & 0x0007) >> 0; // should be 0 |
|
| 167 | 167 | $info['ogg']['pageheader']['theora']['color_space'] = self::TheoraColorSpace($info['ogg']['pageheader']['theora']['color_space_id']); |
| 168 | 168 | $info['ogg']['pageheader']['theora']['pixel_format'] = self::TheoraPixelFormat($info['ogg']['pageheader']['theora']['pixel_format_id']); |
| 169 | 169 | |
@@ -187,24 +187,24 @@ discard block |
||
| 187 | 187 | // Ogg Skeleton version 3.0 Format Specification |
| 188 | 188 | // http://xiph.org/ogg/doc/skeleton.html |
| 189 | 189 | $filedataoffset += 8; |
| 190 | - $info['ogg']['skeleton']['fishead']['raw']['version_major'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 190 | + $info['ogg']['skeleton']['fishead']['raw']['version_major'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 191 | 191 | $filedataoffset += 2; |
| 192 | - $info['ogg']['skeleton']['fishead']['raw']['version_minor'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 192 | + $info['ogg']['skeleton']['fishead']['raw']['version_minor'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 193 | 193 | $filedataoffset += 2; |
| 194 | - $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 194 | + $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 195 | 195 | $filedataoffset += 8; |
| 196 | - $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 196 | + $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 197 | 197 | $filedataoffset += 8; |
| 198 | - $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 198 | + $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 199 | 199 | $filedataoffset += 8; |
| 200 | - $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 200 | + $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 201 | 201 | $filedataoffset += 8; |
| 202 | 202 | $info['ogg']['skeleton']['fishead']['raw']['utc'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 20)); |
| 203 | 203 | $filedataoffset += 20; |
| 204 | 204 | |
| 205 | 205 | $info['ogg']['skeleton']['fishead']['version'] = $info['ogg']['skeleton']['fishead']['raw']['version_major'].'.'.$info['ogg']['skeleton']['fishead']['raw']['version_minor']; |
| 206 | 206 | $info['ogg']['skeleton']['fishead']['presentationtime'] = $info['ogg']['skeleton']['fishead']['raw']['presentationtime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['presentationtime_denominator']; |
| 207 | - $info['ogg']['skeleton']['fishead']['basetime'] = $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator']; |
|
| 207 | + $info['ogg']['skeleton']['fishead']['basetime'] = $info['ogg']['skeleton']['fishead']['raw']['basetime_numerator'] / $info['ogg']['skeleton']['fishead']['raw']['basetime_denominator']; |
|
| 208 | 208 | $info['ogg']['skeleton']['fishead']['utc'] = $info['ogg']['skeleton']['fishead']['raw']['utc']; |
| 209 | 209 | |
| 210 | 210 | |
@@ -218,23 +218,23 @@ discard block |
||
| 218 | 218 | if (substr($filedata, 0, 8) == "fisbone\x00") { |
| 219 | 219 | |
| 220 | 220 | $filedataoffset = 8; |
| 221 | - $info['ogg']['skeleton']['fisbone']['raw']['message_header_offset'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 221 | + $info['ogg']['skeleton']['fisbone']['raw']['message_header_offset'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 222 | 222 | $filedataoffset += 4; |
| 223 | - $info['ogg']['skeleton']['fisbone']['raw']['serial_number'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 223 | + $info['ogg']['skeleton']['fisbone']['raw']['serial_number'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 224 | 224 | $filedataoffset += 4; |
| 225 | - $info['ogg']['skeleton']['fisbone']['raw']['number_header_packets'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 225 | + $info['ogg']['skeleton']['fisbone']['raw']['number_header_packets'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 226 | 226 | $filedataoffset += 4; |
| 227 | - $info['ogg']['skeleton']['fisbone']['raw']['granulerate_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 227 | + $info['ogg']['skeleton']['fisbone']['raw']['granulerate_numerator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 228 | 228 | $filedataoffset += 8; |
| 229 | - $info['ogg']['skeleton']['fisbone']['raw']['granulerate_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 229 | + $info['ogg']['skeleton']['fisbone']['raw']['granulerate_denominator'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 230 | 230 | $filedataoffset += 8; |
| 231 | - $info['ogg']['skeleton']['fisbone']['raw']['basegranule'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 231 | + $info['ogg']['skeleton']['fisbone']['raw']['basegranule'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 8)); |
|
| 232 | 232 | $filedataoffset += 8; |
| 233 | - $info['ogg']['skeleton']['fisbone']['raw']['preroll'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 233 | + $info['ogg']['skeleton']['fisbone']['raw']['preroll'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 234 | 234 | $filedataoffset += 4; |
| 235 | - $info['ogg']['skeleton']['fisbone']['raw']['granuleshift'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 235 | + $info['ogg']['skeleton']['fisbone']['raw']['granuleshift'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 236 | 236 | $filedataoffset += 1; |
| 237 | - $info['ogg']['skeleton']['fisbone']['raw']['padding'] = substr($filedata, $filedataoffset, 3); |
|
| 237 | + $info['ogg']['skeleton']['fisbone']['raw']['padding'] = substr($filedata, $filedataoffset, 3); |
|
| 238 | 238 | $filedataoffset += 3; |
| 239 | 239 | |
| 240 | 240 | } elseif (substr($filedata, 1, 6) == 'theora') { |
@@ -276,14 +276,14 @@ discard block |
||
| 276 | 276 | case 'vorbis': |
| 277 | 277 | $filedata = $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); |
| 278 | 278 | $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['packet_type'] = getid3_lib::LittleEndian2Int(substr($filedata, 0, 1)); |
| 279 | - $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 1, 6); // hard-coded to 'vorbis' |
|
| 279 | + $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 1, 6); // hard-coded to 'vorbis' |
|
| 280 | 280 | |
| 281 | 281 | $this->ParseVorbisComments(); |
| 282 | 282 | break; |
| 283 | 283 | |
| 284 | 284 | case 'flac': |
| 285 | 285 | $flac = new getid3_flac($this->getid3); |
| 286 | - if (!$flac->parseMETAdata()) { |
|
| 286 | + if ( ! $flac->parseMETAdata()) { |
|
| 287 | 287 | $info['error'][] = 'Failed to parse FLAC headers'; |
| 288 | 288 | return false; |
| 289 | 289 | } |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | case 'opus': |
| 299 | 299 | $filedata = $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); |
| 300 | 300 | $info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['stream_type'] = substr($filedata, 0, 8); // hard-coded to 'OpusTags' |
| 301 | - if(substr($filedata, 0, 8) != 'OpusTags') { |
|
| 301 | + if (substr($filedata, 0, 8) != 'OpusTags') { |
|
| 302 | 302 | $info['error'][] = 'Expected "OpusTags" as header but got "'.substr($filedata, 0, 8).'"'; |
| 303 | 303 | return false; |
| 304 | 304 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | // Last Page - Number of Samples |
| 312 | - if (!getid3_lib::intValueSupported($info['avdataend'])) { |
|
| 312 | + if ( ! getid3_lib::intValueSupported($info['avdataend'])) { |
|
| 313 | 313 | |
| 314 | 314 | $info['warning'][] = 'Unable to parse Ogg end chunk file (PHP does not support file operations beyond '.round(PHP_INT_MAX / 1073741824).'GB)'; |
| 315 | 315 | |
@@ -321,26 +321,26 @@ discard block |
||
| 321 | 321 | $this->fseek($info['avdataend'] - ($LastOggSpostion + strlen('SggO'))); |
| 322 | 322 | $info['avdataend'] = $this->ftell(); |
| 323 | 323 | $info['ogg']['pageheader']['eos'] = $this->ParseOggPageHeader(); |
| 324 | - $info['ogg']['samples'] = $info['ogg']['pageheader']['eos']['pcm_abs_position']; |
|
| 324 | + $info['ogg']['samples'] = $info['ogg']['pageheader']['eos']['pcm_abs_position']; |
|
| 325 | 325 | if ($info['ogg']['samples'] == 0) { |
| 326 | 326 | $info['error'][] = 'Corrupt Ogg file: eos.number of samples == zero'; |
| 327 | 327 | return false; |
| 328 | 328 | } |
| 329 | - if (!empty($info['audio']['sample_rate'])) { |
|
| 329 | + if ( ! empty($info['audio']['sample_rate'])) { |
|
| 330 | 330 | $info['ogg']['bitrate_average'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / ($info['ogg']['samples'] / $info['audio']['sample_rate']); |
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if (!empty($info['ogg']['bitrate_average'])) { |
|
| 336 | + if ( ! empty($info['ogg']['bitrate_average'])) { |
|
| 337 | 337 | $info['audio']['bitrate'] = $info['ogg']['bitrate_average']; |
| 338 | - } elseif (!empty($info['ogg']['bitrate_nominal'])) { |
|
| 338 | + } elseif ( ! empty($info['ogg']['bitrate_nominal'])) { |
|
| 339 | 339 | $info['audio']['bitrate'] = $info['ogg']['bitrate_nominal']; |
| 340 | - } elseif (!empty($info['ogg']['bitrate_min']) && !empty($info['ogg']['bitrate_max'])) { |
|
| 340 | + } elseif ( ! empty($info['ogg']['bitrate_min']) && ! empty($info['ogg']['bitrate_max'])) { |
|
| 341 | 341 | $info['audio']['bitrate'] = ($info['ogg']['bitrate_min'] + $info['ogg']['bitrate_max']) / 2; |
| 342 | 342 | } |
| 343 | - if (isset($info['audio']['bitrate']) && !isset($info['playtime_seconds'])) { |
|
| 343 | + if (isset($info['audio']['bitrate']) && ! isset($info['playtime_seconds'])) { |
|
| 344 | 344 | if ($info['audio']['bitrate'] == 0) { |
| 345 | 345 | $info['error'][] = 'Corrupt Ogg file: bitrate_audio == zero'; |
| 346 | 346 | return false; |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | if ($info['audio']['dataformat'] == 'vorbis') { |
| 356 | 356 | |
| 357 | 357 | // Vorbis 1.0 starts with Xiph.Org |
| 358 | - if (preg_match('/^Xiph.Org/', $info['audio']['encoder'])) { |
|
| 358 | + if (preg_match('/^Xiph.Org/', $info['audio']['encoder'])) { |
|
| 359 | 359 | |
| 360 | 360 | if ($info['audio']['bitrate_mode'] == 'abr') { |
| 361 | 361 | |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | - if (empty($info['audio']['encoder_options']) && !empty($info['ogg']['bitrate_nominal'])) { |
|
| 372 | + if (empty($info['audio']['encoder_options']) && ! empty($info['ogg']['bitrate_nominal'])) { |
|
| 373 | 373 | $info['audio']['encoder_options'] = 'Nominal bitrate: '.intval(round($info['ogg']['bitrate_nominal'] / 1000)).'kbps'; |
| 374 | 374 | } |
| 375 | 375 | } |
@@ -407,7 +407,7 @@ discard block |
||
| 407 | 407 | $filedataoffset += 4; |
| 408 | 408 | $info['ogg']['bitrate_min'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
| 409 | 409 | $filedataoffset += 4; |
| 410 | - $info['ogg']['blocksize_small'] = pow(2, getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0x0F); |
|
| 410 | + $info['ogg']['blocksize_small'] = pow(2, getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0x0F); |
|
| 411 | 411 | $info['ogg']['blocksize_large'] = pow(2, (getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)) & 0xF0) >> 4); |
| 412 | 412 | $info['ogg']['stop_bit'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); // must be 1, marks end of packet |
| 413 | 413 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | $info['ogg']['pageheader']['opus']['opus_magic'] = substr($filedata, $filedataoffset, 8); // hard-coded to 'OpusHead' |
| 441 | 441 | $filedataoffset += 8; |
| 442 | - $info['ogg']['pageheader']['opus']['version'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 442 | + $info['ogg']['pageheader']['opus']['version'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 443 | 443 | $filedataoffset += 1; |
| 444 | 444 | |
| 445 | 445 | if ($info['ogg']['pageheader']['opus']['version'] < 1 || $info['ogg']['pageheader']['opus']['version'] > 15) { |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | return false; |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | - $info['ogg']['pageheader']['opus']['out_channel_count'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 450 | + $info['ogg']['pageheader']['opus']['out_channel_count'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 1)); |
|
| 451 | 451 | $filedataoffset += 1; |
| 452 | 452 | |
| 453 | 453 | if ($info['ogg']['pageheader']['opus']['out_channel_count'] == 0) { |
@@ -455,10 +455,10 @@ discard block |
||
| 455 | 455 | return false; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - $info['ogg']['pageheader']['opus']['pre_skip'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 458 | + $info['ogg']['pageheader']['opus']['pre_skip'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); |
|
| 459 | 459 | $filedataoffset += 2; |
| 460 | 460 | |
| 461 | - $info['ogg']['pageheader']['opus']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 461 | + $info['ogg']['pageheader']['opus']['sample_rate'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 4)); |
|
| 462 | 462 | $filedataoffset += 4; |
| 463 | 463 | |
| 464 | 464 | //$info['ogg']['pageheader']['opus']['output_gain'] = getid3_lib::LittleEndian2Int(substr($filedata, $filedataoffset, 2)); |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | case 'vorbis': |
| 541 | 541 | case 'speex': |
| 542 | 542 | case 'opus': |
| 543 | - $CommentStartOffset = $info['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset']; // Second Ogg page, after header block |
|
| 543 | + $CommentStartOffset = $info['ogg']['pageheader'][$VorbisCommentPage]['page_start_offset']; // Second Ogg page, after header block |
|
| 544 | 544 | $this->fseek($CommentStartOffset); |
| 545 | 545 | $commentdataoffset = 27 + $info['ogg']['pageheader'][$VorbisCommentPage]['page_segments']; |
| 546 | 546 | $commentdata = $this->fread(self::OggPageSegmentLength($info['ogg']['pageheader'][$VorbisCommentPage], 1) + $commentdataoffset); |
@@ -641,7 +641,7 @@ discard block |
||
| 641 | 641 | $commentdata .= $AsYetUnusedData; |
| 642 | 642 | |
| 643 | 643 | //$commentdata .= $this->fread($info['ogg']['pageheader'][$oggpageinfo['page_seqno']]['page_length']); |
| 644 | - if (!isset($info['ogg']['pageheader'][$VorbisCommentPage])) { |
|
| 644 | + if ( ! isset($info['ogg']['pageheader'][$VorbisCommentPage])) { |
|
| 645 | 645 | $info['warning'][] = 'undefined Vorbis Comment page "'.$VorbisCommentPage.'" at offset '.$this->ftell(); |
| 646 | 646 | break; |
| 647 | 647 | } |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | $commentstring = substr($commentdata, $commentdataoffset, $ThisFileInfo_ogg_comments_raw[$i]['size']); |
| 659 | 659 | $commentdataoffset += $ThisFileInfo_ogg_comments_raw[$i]['size']; |
| 660 | 660 | |
| 661 | - if (!$commentstring) { |
|
| 661 | + if ( ! $commentstring) { |
|
| 662 | 662 | |
| 663 | 663 | // no comment? |
| 664 | 664 | $info['warning'][] = 'Blank Ogg comment ['.$i.']'; |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | $this->notice('Found deprecated COVERART tag, it should be replaced in honor of METADATA_BLOCK_PICTURE structure'); |
| 687 | 687 | /** @todo use 'coverartmime' where available */ |
| 688 | 688 | $imageinfo = getid3_lib::GetDataImageSize($data); |
| 689 | - if ($imageinfo === false || !isset($imageinfo['mime'])) { |
|
| 689 | + if ($imageinfo === false || ! isset($imageinfo['mime'])) { |
|
| 690 | 690 | $this->warning('COVERART vorbiscomment tag contains invalid image'); |
| 691 | 691 | continue; |
| 692 | 692 | } |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | |
| 778 | - public static function OggPageSegmentLength($OggInfoArray, $SegmentNumber=1) { |
|
| 778 | + public static function OggPageSegmentLength($OggInfoArray, $SegmentNumber = 1) { |
|
| 779 | 779 | for ($i = 0; $i < $SegmentNumber; $i++) { |
| 780 | 780 | $segmentlength = 0; |
| 781 | 781 | foreach ($OggInfoArray['segment_table'] as $key => $value) { |
@@ -547,8 +547,7 @@ |
||
| 547 | 547 | |
| 548 | 548 | if ($info['audio']['dataformat'] == 'vorbis') { |
| 549 | 549 | $commentdataoffset += (strlen('vorbis') + 1); |
| 550 | - } |
|
| 551 | - else if ($info['audio']['dataformat'] == 'opus') { |
|
| 550 | + } else if ($info['audio']['dataformat'] == 'opus') { |
|
| 552 | 551 | $commentdataoffset += strlen('OpusTags'); |
| 553 | 552 | } |
| 554 | 553 | |
@@ -331,6 +331,9 @@ |
||
| 331 | 331 | return true; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | + /** |
|
| 335 | + * @param string $APEheaderFooterData |
|
| 336 | + */ |
|
| 334 | 337 | public function parseAPEheaderFooter($APEheaderFooterData) { |
| 335 | 338 | // http://www.uni-jena.de/~pfk/mpp/sv8/apeheader.html |
| 336 | 339 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | public function Analyze() { |
| 23 | 23 | $info = &$this->getid3->info; |
| 24 | 24 | |
| 25 | - if (!getid3_lib::intValueSupported($info['filesize'])) { |
|
| 25 | + if ( ! getid3_lib::intValueSupported($info['filesize'])) { |
|
| 26 | 26 | $info['warning'][] = 'Unable to check for APEtags because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'; |
| 27 | 27 | return false; |
| 28 | 28 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | } |
| 61 | - if (!isset($info['ape']['tag_offset_end'])) { |
|
| 61 | + if ( ! isset($info['ape']['tag_offset_end'])) { |
|
| 62 | 62 | |
| 63 | 63 | // APE tag not found |
| 64 | 64 | unset($info['ape']); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $this->fseek($thisfile_ape['tag_offset_end'] - $apetagheadersize); |
| 73 | 73 | $APEfooterData = $this->fread(32); |
| 74 | - if (!($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) { |
|
| 74 | + if ( ! ($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) { |
|
| 75 | 75 | $info['error'][] = 'Error parsing APE footer at offset '.$thisfile_ape['tag_offset_end']; |
| 76 | 76 | return false; |
| 77 | 77 | } |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | } elseif (is_string($this->inline_attachments)) { |
| 284 | 284 | $this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR); |
| 285 | - if (!is_dir($this->inline_attachments) || !is_writable($this->inline_attachments)) { |
|
| 285 | + if ( ! is_dir($this->inline_attachments) || ! is_writable($this->inline_attachments)) { |
|
| 286 | 286 | // cannot write, skip |
| 287 | 287 | $info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)'; |
| 288 | 288 | unset($thisfile_ape_items_current['data']); |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | // if we get this far, must be OK |
| 293 | 293 | if (is_string($this->inline_attachments)) { |
| 294 | 294 | $destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$thisfile_ape_items_current['data_offset']; |
| 295 | - if (!file_exists($destination_filename) || is_writable($destination_filename)) { |
|
| 295 | + if ( ! file_exists($destination_filename) || is_writable($destination_filename)) { |
|
| 296 | 296 | file_put_contents($destination_filename, $thisfile_ape_items_current['data']); |
| 297 | 297 | } else { |
| 298 | 298 | $info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)'; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | $thisfile_ape_items_current['data_filename'] = $destination_filename; |
| 301 | 301 | unset($thisfile_ape_items_current['data']); |
| 302 | 302 | } else { |
| 303 | - if (!isset($info['ape']['comments']['picture'])) { |
|
| 303 | + if ( ! isset($info['ape']['comments']['picture'])) { |
|
| 304 | 304 | $info['ape']['comments']['picture'] = array(); |
| 305 | 305 | } |
| 306 | 306 | $comments_picture_data = array(); |
@@ -338,17 +338,17 @@ discard block |
||
| 338 | 338 | $headerfooterinfo['raw'] = array(); |
| 339 | 339 | $headerfooterinfo_raw = &$headerfooterinfo['raw']; |
| 340 | 340 | |
| 341 | - $headerfooterinfo_raw['footer_tag'] = substr($APEheaderFooterData, 0, 8); |
|
| 341 | + $headerfooterinfo_raw['footer_tag'] = substr($APEheaderFooterData, 0, 8); |
|
| 342 | 342 | if ($headerfooterinfo_raw['footer_tag'] != 'APETAGEX') { |
| 343 | 343 | return false; |
| 344 | 344 | } |
| 345 | - $headerfooterinfo_raw['version'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 8, 4)); |
|
| 345 | + $headerfooterinfo_raw['version'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 8, 4)); |
|
| 346 | 346 | $headerfooterinfo_raw['tagsize'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 12, 4)); |
| 347 | 347 | $headerfooterinfo_raw['tag_items'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 16, 4)); |
| 348 | 348 | $headerfooterinfo_raw['global_flags'] = getid3_lib::LittleEndian2Int(substr($APEheaderFooterData, 20, 4)); |
| 349 | - $headerfooterinfo_raw['reserved'] = substr($APEheaderFooterData, 24, 8); |
|
| 349 | + $headerfooterinfo_raw['reserved'] = substr($APEheaderFooterData, 24, 8); |
|
| 350 | 350 | |
| 351 | - $headerfooterinfo['tag_version'] = $headerfooterinfo_raw['version'] / 1000; |
|
| 351 | + $headerfooterinfo['tag_version'] = $headerfooterinfo_raw['version'] / 1000; |
|
| 352 | 352 | if ($headerfooterinfo['tag_version'] >= 2) { |
| 353 | 353 | $headerfooterinfo['flags'] = $this->parseAPEtagFlags($headerfooterinfo_raw['global_flags']); |
| 354 | 354 | } |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | $flags['header'] = (bool) ($rawflagint & 0x80000000); |
| 363 | 363 | $flags['footer'] = (bool) ($rawflagint & 0x40000000); |
| 364 | 364 | $flags['this_is_header'] = (bool) ($rawflagint & 0x20000000); |
| 365 | - $flags['item_contents_raw'] = ($rawflagint & 0x00000006) >> 1; |
|
| 365 | + $flags['item_contents_raw'] = ($rawflagint & 0x00000006) >> 1; |
|
| 366 | 366 | $flags['read_only'] = (bool) ($rawflagint & 0x00000001); |
| 367 | 367 | |
| 368 | 368 | $flags['item_contents'] = $this->APEcontentTypeFlagLookup($flags['item_contents_raw']); |
@@ -2596,6 +2596,9 @@ discard block |
||
| 2596 | 2596 | |
| 2597 | 2597 | |
| 2598 | 2598 | |
| 2599 | + /** |
|
| 2600 | + * @param string $languagecode |
|
| 2601 | + */ |
|
| 2599 | 2602 | public static function LanguageLookup($languagecode, $casesensitive=false) { |
| 2600 | 2603 | |
| 2601 | 2604 | if (!$casesensitive) { |
@@ -3052,6 +3055,9 @@ discard block |
||
| 3052 | 3055 | } |
| 3053 | 3056 | |
| 3054 | 3057 | |
| 3058 | + /** |
|
| 3059 | + * @param string $index |
|
| 3060 | + */ |
|
| 3055 | 3061 | public static function ETCOEventLookup($index) { |
| 3056 | 3062 | if (($index >= 0x17) && ($index <= 0xDF)) { |
| 3057 | 3063 | return 'reserved for future use'; |
@@ -3095,6 +3101,9 @@ discard block |
||
| 3095 | 3101 | return (isset($EventLookup[$index]) ? $EventLookup[$index] : ''); |
| 3096 | 3102 | } |
| 3097 | 3103 | |
| 3104 | + /** |
|
| 3105 | + * @param integer $index |
|
| 3106 | + */ |
|
| 3098 | 3107 | public static function SYTLContentTypeLookup($index) { |
| 3099 | 3108 | static $SYTLContentTypeLookup = array( |
| 3100 | 3109 | 0x00 => 'other', |
@@ -3111,6 +3120,9 @@ discard block |
||
| 3111 | 3120 | return (isset($SYTLContentTypeLookup[$index]) ? $SYTLContentTypeLookup[$index] : ''); |
| 3112 | 3121 | } |
| 3113 | 3122 | |
| 3123 | + /** |
|
| 3124 | + * @param integer $index |
|
| 3125 | + */ |
|
| 3114 | 3126 | public static function APICPictureTypeLookup($index, $returnarray=false) { |
| 3115 | 3127 | static $APICPictureTypeLookup = array( |
| 3116 | 3128 | 0x00 => 'Other', |
@@ -3141,6 +3153,9 @@ discard block |
||
| 3141 | 3153 | return (isset($APICPictureTypeLookup[$index]) ? $APICPictureTypeLookup[$index] : ''); |
| 3142 | 3154 | } |
| 3143 | 3155 | |
| 3156 | + /** |
|
| 3157 | + * @param integer $index |
|
| 3158 | + */ |
|
| 3144 | 3159 | public static function COMRReceivedAsLookup($index) { |
| 3145 | 3160 | static $COMRReceivedAsLookup = array( |
| 3146 | 3161 | 0x00 => 'Other', |
@@ -3157,6 +3172,9 @@ discard block |
||
| 3157 | 3172 | return (isset($COMRReceivedAsLookup[$index]) ? $COMRReceivedAsLookup[$index] : ''); |
| 3158 | 3173 | } |
| 3159 | 3174 | |
| 3175 | + /** |
|
| 3176 | + * @param integer $index |
|
| 3177 | + */ |
|
| 3160 | 3178 | public static function RVA2ChannelTypeLookup($index) { |
| 3161 | 3179 | static $RVA2ChannelTypeLookup = array( |
| 3162 | 3180 | 0x00 => 'Other', |
@@ -3536,6 +3554,9 @@ discard block |
||
| 3536 | 3554 | return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_short'); |
| 3537 | 3555 | } |
| 3538 | 3556 | |
| 3557 | + /** |
|
| 3558 | + * @param integer $encoding |
|
| 3559 | + */ |
|
| 3539 | 3560 | public static function TextEncodingTerminatorLookup($encoding) { |
| 3540 | 3561 | // http://www.id3.org/id3v2.4.0-structure.txt |
| 3541 | 3562 | // Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings: |
@@ -3562,6 +3583,9 @@ discard block |
||
| 3562 | 3583 | return (isset($TextEncodingNameLookup[$encoding]) ? $TextEncodingNameLookup[$encoding] : 'ISO-8859-1'); |
| 3563 | 3584 | } |
| 3564 | 3585 | |
| 3586 | + /** |
|
| 3587 | + * @param string $framename |
|
| 3588 | + */ |
|
| 3565 | 3589 | public static function IsValidID3v2FrameName($framename, $id3v2majorversion) { |
| 3566 | 3590 | switch ($id3v2majorversion) { |
| 3567 | 3591 | case 2: |
@@ -3591,6 +3615,9 @@ discard block |
||
| 3591 | 3615 | return true; |
| 3592 | 3616 | } |
| 3593 | 3617 | |
| 3618 | + /** |
|
| 3619 | + * @param string $datestamp |
|
| 3620 | + */ |
|
| 3594 | 3621 | public static function IsValidDateStampString($datestamp) { |
| 3595 | 3622 | if (strlen($datestamp) != 8) { |
| 3596 | 3623 | return false; |
@@ -1972,9 +1972,9 @@ discard block |
||
| 1972 | 1972 | // Element ID <text string> $00 |
| 1973 | 1973 | // Start time $xx xx xx xx |
| 1974 | 1974 | // End time $xx xx xx xx |
| 1975 | - // Start offset $xx xx xx xx |
|
| 1976 | - // End offset $xx xx xx xx |
|
| 1977 | - // <Optional embedded sub-frames> |
|
| 1975 | + // Start offset $xx xx xx xx |
|
| 1976 | + // End offset $xx xx xx xx |
|
| 1977 | + // <Optional embedded sub-frames> |
|
| 1978 | 1978 | |
| 1979 | 1979 | $frame_offset = 0; |
| 1980 | 1980 | @list($parsedFrame['element_id']) = explode("\x00", $parsedFrame['data'], 2); |
@@ -2069,7 +2069,7 @@ discard block |
||
| 2069 | 2069 | // CTOC flags %xx |
| 2070 | 2070 | // Entry count $xx |
| 2071 | 2071 | // Child Element ID <string>$00 /* zero or more child CHAP or CTOC entries */ |
| 2072 | - // <Optional embedded sub-frames> |
|
| 2072 | + // <Optional embedded sub-frames> |
|
| 2073 | 2073 | |
| 2074 | 2074 | $frame_offset = 0; |
| 2075 | 2075 | @list($parsedFrame['element_id']) = explode("\x00", $parsedFrame['data'], 2); |
@@ -2392,8 +2392,7 @@ discard block |
||
| 2392 | 2392 | ZAR Rand |
| 2393 | 2393 | ZMK Kwacha |
| 2394 | 2394 | ZWD Zimbabwe Dollars |
| 2395 | - |
|
| 2396 | - */ |
|
| 2395 | + */ |
|
| 2397 | 2396 | |
| 2398 | 2397 | return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-units'); |
| 2399 | 2398 | } |
@@ -2588,8 +2587,7 @@ discard block |
||
| 2588 | 2587 | ZAR South Africa |
| 2589 | 2588 | ZMK Zambia |
| 2590 | 2589 | ZWD Zimbabwe |
| 2591 | - |
|
| 2592 | - */ |
|
| 2590 | + */ |
|
| 2593 | 2591 | |
| 2594 | 2592 | return getid3_lib::EmbeddedLookup($currencyid, $begin, __LINE__, __FILE__, 'id3v2-currency-country'); |
| 2595 | 2593 | } |
@@ -3045,8 +3043,7 @@ discard block |
||
| 3045 | 3043 | zho Chinese |
| 3046 | 3044 | zul Zulu |
| 3047 | 3045 | zun Zuni |
| 3048 | - |
|
| 3049 | - */ |
|
| 3046 | + */ |
|
| 3050 | 3047 | |
| 3051 | 3048 | return getid3_lib::EmbeddedLookup($languagecode, $begin, __LINE__, __FILE__, 'id3v2-languagecode'); |
| 3052 | 3049 | } |
@@ -3346,8 +3343,7 @@ discard block |
||
| 3346 | 3343 | TFEA Featured Artist |
| 3347 | 3344 | TSTU Recording Studio |
| 3348 | 3345 | rgad Replay Gain Adjustment |
| 3349 | - |
|
| 3350 | - */ |
|
| 3346 | + */ |
|
| 3351 | 3347 | |
| 3352 | 3348 | return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_long'); |
| 3353 | 3349 | |
@@ -3530,8 +3526,7 @@ discard block |
||
| 3530 | 3526 | TFEA featured_artist |
| 3531 | 3527 | TSTU recording_studio |
| 3532 | 3528 | rgad replay_gain_adjustment |
| 3533 | - |
|
| 3534 | - */ |
|
| 3529 | + */ |
|
| 3535 | 3530 | |
| 3536 | 3531 | return getid3_lib::EmbeddedLookup($framename, $begin, __LINE__, __FILE__, 'id3v2-framename_short'); |
| 3537 | 3532 | } |
@@ -48,13 +48,13 @@ discard block |
||
| 48 | 48 | // shortcuts |
| 49 | 49 | $info['id3v2']['header'] = true; |
| 50 | 50 | $thisfile_id3v2 = &$info['id3v2']; |
| 51 | - $thisfile_id3v2['flags'] = array(); |
|
| 51 | + $thisfile_id3v2['flags'] = array(); |
|
| 52 | 52 | $thisfile_id3v2_flags = &$thisfile_id3v2['flags']; |
| 53 | 53 | |
| 54 | 54 | |
| 55 | 55 | $this->fseek($this->StartingOffset); |
| 56 | 56 | $header = $this->fread(10); |
| 57 | - if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) { |
|
| 57 | + if (substr($header, 0, 3) == 'ID3' && strlen($header) == 10) { |
|
| 58 | 58 | |
| 59 | 59 | $thisfile_id3v2['majorversion'] = ord($header{3}); |
| 60 | 60 | $thisfile_id3v2['minorversion'] = ord($header{4}); |
@@ -124,10 +124,10 @@ discard block |
||
| 124 | 124 | // Flags $xx xx |
| 125 | 125 | |
| 126 | 126 | $sizeofframes = $thisfile_id3v2['headerlength'] - 10; // not including 10-byte initial header |
| 127 | - if (!empty($thisfile_id3v2['exthead']['length'])) { |
|
| 127 | + if ( ! empty($thisfile_id3v2['exthead']['length'])) { |
|
| 128 | 128 | $sizeofframes -= ($thisfile_id3v2['exthead']['length'] + 4); |
| 129 | 129 | } |
| 130 | - if (!empty($thisfile_id3v2_flags['isfooter'])) { |
|
| 130 | + if ( ! empty($thisfile_id3v2_flags['isfooter'])) { |
|
| 131 | 131 | $sizeofframes -= 10; // footer takes last 10 bytes of ID3v2 header, after frame data, before audio |
| 132 | 132 | } |
| 133 | 133 | if ($sizeofframes > 0) { |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | $framedata = $this->fread($sizeofframes); // read all frames from file into $framedata variable |
| 136 | 136 | |
| 137 | 137 | // if entire frame data is unsynched, de-unsynch it now (ID3v2.3.x) |
| 138 | - if (!empty($thisfile_id3v2_flags['unsynch']) && ($id3v2_majorversion <= 3)) { |
|
| 138 | + if ( ! empty($thisfile_id3v2_flags['unsynch']) && ($id3v2_majorversion <= 3)) { |
|
| 139 | 139 | $framedata = $this->DeUnsynchronise($framedata); |
| 140 | 140 | } |
| 141 | 141 | // [in ID3v2.4.0] Unsynchronisation [S:6.1] is done on frame level, instead |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | |
| 152 | 152 | // Extended Header |
| 153 | - if (!empty($thisfile_id3v2_flags['exthead'])) { |
|
| 153 | + if ( ! empty($thisfile_id3v2_flags['exthead'])) { |
|
| 154 | 154 | $extended_header_offset = 0; |
| 155 | 155 | |
| 156 | 156 | if ($id3v2_majorversion == 3) { |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | // Flags $xx xx |
| 273 | 273 | |
| 274 | 274 | $frame_header = substr($framedata, 0, 6); // take next 6 bytes for header |
| 275 | - $framedata = substr($framedata, 6); // and leave the rest in $framedata |
|
| 275 | + $framedata = substr($framedata, 6); // and leave the rest in $framedata |
|
| 276 | 276 | $frame_name = substr($frame_header, 0, 3); |
| 277 | 277 | $frame_size = getid3_lib::BigEndian2Int(substr($frame_header, 3, 3), 0); |
| 278 | 278 | $frame_flags = 0; // not used for anything in ID3v2.2, just set to avoid E_NOTICEs |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | // Flags $xx xx |
| 285 | 285 | |
| 286 | 286 | $frame_header = substr($framedata, 0, 10); // take next 10 bytes for header |
| 287 | - $framedata = substr($framedata, 10); // and leave the rest in $framedata |
|
| 287 | + $framedata = substr($framedata, 10); // and leave the rest in $framedata |
|
| 288 | 288 | |
| 289 | 289 | $frame_name = substr($frame_header, 0, 4); |
| 290 | 290 | if ($id3v2_majorversion == 3) { |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | $info['warning'][] = 'Invalid ID3v2 frame size, aborting.'; |
| 380 | 380 | |
| 381 | 381 | } |
| 382 | - if (!$this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) { |
|
| 382 | + if ( ! $this->IsValidID3v2FrameName($frame_name, $id3v2_majorversion)) { |
|
| 383 | 383 | |
| 384 | 384 | switch ($frame_name) { |
| 385 | 385 | case "\x00\x00".'MP': |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | break; |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - } elseif (!isset($framedata) || ($frame_size > strlen($framedata))) { |
|
| 400 | + } elseif ( ! isset($framedata) || ($frame_size > strlen($framedata))) { |
|
| 401 | 401 | |
| 402 | 402 | $info['error'][] = 'error parsing "'.$frame_name.'" ('.$framedataoffset.' bytes into the ID3v2.'.$id3v2_majorversion.' tag). (ERROR: $frame_size ('.$frame_size.') > strlen($framedata) ('.(isset($framedata) ? strlen($framedata) : 'null').')).'; |
| 403 | 403 | |
@@ -456,27 +456,27 @@ discard block |
||
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | - if (!isset($thisfile_id3v2['comments']['year']) && !empty($thisfile_id3v2['comments']['recording_time'][0]) && preg_match('#^([0-9]{4})#', trim($thisfile_id3v2['comments']['recording_time'][0]), $matches)) { |
|
| 459 | + if ( ! isset($thisfile_id3v2['comments']['year']) && ! empty($thisfile_id3v2['comments']['recording_time'][0]) && preg_match('#^([0-9]{4})#', trim($thisfile_id3v2['comments']['recording_time'][0]), $matches)) { |
|
| 460 | 460 | $thisfile_id3v2['comments']['year'] = array($matches[1]); |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | |
| 464 | - if (!empty($thisfile_id3v2['TXXX'])) { |
|
| 464 | + if ( ! empty($thisfile_id3v2['TXXX'])) { |
|
| 465 | 465 | // MediaMonkey does this, maybe others: write a blank RGAD frame, but put replay-gain adjustment values in TXXX frames |
| 466 | 466 | foreach ($thisfile_id3v2['TXXX'] as $txxx_array) { |
| 467 | 467 | switch ($txxx_array['description']) { |
| 468 | 468 | case 'replaygain_track_gain': |
| 469 | - if (empty($info['replay_gain']['track']['adjustment']) && !empty($txxx_array['data'])) { |
|
| 469 | + if (empty($info['replay_gain']['track']['adjustment']) && ! empty($txxx_array['data'])) { |
|
| 470 | 470 | $info['replay_gain']['track']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data']))); |
| 471 | 471 | } |
| 472 | 472 | break; |
| 473 | 473 | case 'replaygain_track_peak': |
| 474 | - if (empty($info['replay_gain']['track']['peak']) && !empty($txxx_array['data'])) { |
|
| 474 | + if (empty($info['replay_gain']['track']['peak']) && ! empty($txxx_array['data'])) { |
|
| 475 | 475 | $info['replay_gain']['track']['peak'] = floatval($txxx_array['data']); |
| 476 | 476 | } |
| 477 | 477 | break; |
| 478 | 478 | case 'replaygain_album_gain': |
| 479 | - if (empty($info['replay_gain']['album']['adjustment']) && !empty($txxx_array['data'])) { |
|
| 479 | + if (empty($info['replay_gain']['album']['adjustment']) && ! empty($txxx_array['data'])) { |
|
| 480 | 480 | $info['replay_gain']['album']['adjustment'] = floatval(trim(str_replace('dB', '', $txxx_array['data']))); |
| 481 | 481 | } |
| 482 | 482 | break; |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | $info = &$this->getid3->info; |
| 525 | 525 | $id3v2_majorversion = $info['id3v2']['majorversion']; |
| 526 | 526 | |
| 527 | - $parsedFrame['framenamelong'] = $this->FrameNameLongLookup($parsedFrame['frame_name']); |
|
| 527 | + $parsedFrame['framenamelong'] = $this->FrameNameLongLookup($parsedFrame['frame_name']); |
|
| 528 | 528 | if (empty($parsedFrame['framenamelong'])) { |
| 529 | 529 | unset($parsedFrame['framenamelong']); |
| 530 | 530 | } |
@@ -563,14 +563,14 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | if ($parsedFrame['flags']['DataLengthIndicator']) { |
| 565 | 565 | $parsedFrame['data_length_indicator'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4), 1); |
| 566 | - $parsedFrame['data'] = substr($parsedFrame['data'], 4); |
|
| 566 | + $parsedFrame['data'] = substr($parsedFrame['data'], 4); |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | // Frame-level de-compression |
| 571 | 571 | if ($parsedFrame['flags']['compression']) { |
| 572 | 572 | $parsedFrame['decompressed_size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4)); |
| 573 | - if (!function_exists('gzuncompress')) { |
|
| 573 | + if ( ! function_exists('gzuncompress')) { |
|
| 574 | 574 | $info['warning'][] = 'gzuncompress() support required to decompress ID3v2 frame "'.$parsedFrame['frame_name'].'"'; |
| 575 | 575 | } else { |
| 576 | 576 | if ($decompresseddata = @gzuncompress(substr($parsedFrame['data'], 4))) { |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | } |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | - if (!empty($parsedFrame['flags']['DataLengthIndicator'])) { |
|
| 587 | + if ( ! empty($parsedFrame['flags']['DataLengthIndicator'])) { |
|
| 588 | 588 | if ($parsedFrame['data_length_indicator'] != strlen($parsedFrame['data'])) { |
| 589 | 589 | $info['warning'][] = 'ID3v2 frame "'.$parsedFrame['frame_name'].'" should be '.$parsedFrame['data_length_indicator'].' bytes long according to DataLengthIndicator, but found '.strlen($parsedFrame['data']).' bytes of data'; |
| 590 | 590 | } |
@@ -643,9 +643,9 @@ discard block |
||
| 643 | 643 | |
| 644 | 644 | $parsedFrame['description'] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $frame_description)); |
| 645 | 645 | $parsedFrame['data'] = substr($parsedFrame['data'], $frame_terminatorpos + strlen($frame_textencoding_terminator)); |
| 646 | - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { |
|
| 646 | + if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) { |
|
| 647 | 647 | $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0)); |
| 648 | - if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) { |
|
| 648 | + if ( ! isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || ! array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) { |
|
| 649 | 649 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data'])); |
| 650 | 650 | } else { |
| 651 | 651 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = trim(getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data'])); |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | $parsedFrame['encodingid'] = $frame_textencoding; |
| 673 | 673 | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); |
| 674 | 674 | |
| 675 | - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { |
|
| 675 | + if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) { |
|
| 676 | 676 | // ID3v2.3 specs say that TPE1 (and others) can contain multiple artist values separated with / |
| 677 | 677 | // This of course breaks when an artist name contains slash character, e.g. "AC/DC" |
| 678 | 678 | // MP3tag (maybe others) implement alternative system where multiple artists are null-separated, which makes more sense |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | $Txxx_elements[] = substr($parsedFrame['data'], $Txxx_elements_start_offset, $i - $Txxx_elements_start_offset); |
| 701 | 701 | foreach ($Txxx_elements as $Txxx_element) { |
| 702 | 702 | $string = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $Txxx_element); |
| 703 | - if (!empty($string)) { |
|
| 703 | + if ( ! empty($string)) { |
|
| 704 | 704 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $string; |
| 705 | 705 | } |
| 706 | 706 | } |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | |
| 753 | 753 | $parsedFrame['url'] = $frame_urldata; |
| 754 | 754 | $parsedFrame['description'] = $frame_description; |
| 755 | - if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { |
|
| 755 | + if ( ! empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { |
|
| 756 | 756 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['url']); |
| 757 | 757 | } |
| 758 | 758 | unset($parsedFrame['data']); |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | // URL <text string> |
| 767 | 767 | |
| 768 | 768 | $parsedFrame['url'] = trim($parsedFrame['data']); |
| 769 | - if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { |
|
| 769 | + if ( ! empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { |
|
| 770 | 770 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['url']; |
| 771 | 771 | } |
| 772 | 772 | unset($parsedFrame['data']); |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | } |
| 848 | 848 | $parsedFrame['data'] = $IPLS_parts; |
| 849 | 849 | |
| 850 | - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { |
|
| 850 | + if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) { |
|
| 851 | 851 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data']; |
| 852 | 852 | } |
| 853 | 853 | |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | // <Header for 'Music CD identifier', ID: 'MCDI'> |
| 859 | 859 | // CD TOC <binary data> |
| 860 | 860 | |
| 861 | - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { |
|
| 861 | + if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) { |
|
| 862 | 862 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = $parsedFrame['data']; |
| 863 | 863 | } |
| 864 | 864 | |
@@ -983,7 +983,7 @@ discard block |
||
| 983 | 983 | $parsedFrame['language'] = $frame_language; |
| 984 | 984 | $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); |
| 985 | 985 | $parsedFrame['description'] = $frame_description; |
| 986 | - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { |
|
| 986 | + if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) { |
|
| 987 | 987 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); |
| 988 | 988 | } |
| 989 | 989 | unset($parsedFrame['data']); |
@@ -1091,9 +1091,9 @@ discard block |
||
| 1091 | 1091 | $parsedFrame['languagename'] = $this->LanguageLookup($frame_language, false); |
| 1092 | 1092 | $parsedFrame['description'] = $frame_description; |
| 1093 | 1093 | $parsedFrame['data'] = $frame_text; |
| 1094 | - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { |
|
| 1095 | - $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : (!empty($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0)); |
|
| 1096 | - if (!isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || !array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) { |
|
| 1094 | + if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) { |
|
| 1095 | + $commentkey = ($parsedFrame['description'] ? $parsedFrame['description'] : ( ! empty($info['id3v2']['comments'][$parsedFrame['framenameshort']]) ? count($info['id3v2']['comments'][$parsedFrame['framenameshort']]) : 0)); |
|
| 1096 | + if ( ! isset($info['id3v2']['comments'][$parsedFrame['framenameshort']]) || ! array_key_exists($commentkey, $info['id3v2']['comments'][$parsedFrame['framenameshort']])) { |
|
| 1097 | 1097 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][$commentkey] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); |
| 1098 | 1098 | } else { |
| 1099 | 1099 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | break; |
| 1137 | 1137 | } |
| 1138 | 1138 | $frame_bytespeakvolume = ceil($parsedFrame[$RVA2channelcounter]['bitspeakvolume'] / 8); |
| 1139 | - $parsedFrame[$RVA2channelcounter]['peakvolume'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, $frame_bytespeakvolume)); |
|
| 1139 | + $parsedFrame[$RVA2channelcounter]['peakvolume'] = getid3_lib::BigEndian2Int(substr($frame_remainingdata, $frame_offset, $frame_bytespeakvolume)); |
|
| 1140 | 1140 | $frame_remainingdata = substr($frame_remainingdata, $frame_offset + $frame_bytespeakvolume); |
| 1141 | 1141 | $RVA2channelcounter++; |
| 1142 | 1142 | } |
@@ -1404,7 +1404,7 @@ discard block |
||
| 1404 | 1404 | $imageinfo = array(); |
| 1405 | 1405 | $imagechunkcheck = getid3_lib::GetDataImageSize($parsedFrame['data'], $imageinfo); |
| 1406 | 1406 | if (($imagechunkcheck[2] >= 1) && ($imagechunkcheck[2] <= 3)) { |
| 1407 | - $parsedFrame['image_mime'] = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]); |
|
| 1407 | + $parsedFrame['image_mime'] = 'image/'.getid3_lib::ImageTypesLookup($imagechunkcheck[2]); |
|
| 1408 | 1408 | if ($imagechunkcheck[0]) { |
| 1409 | 1409 | $parsedFrame['image_width'] = $imagechunkcheck[0]; |
| 1410 | 1410 | } |
@@ -1432,7 +1432,7 @@ discard block |
||
| 1432 | 1432 | */ |
| 1433 | 1433 | } elseif (is_string($this->getid3->option_save_attachments)) { |
| 1434 | 1434 | $dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR); |
| 1435 | - if (!is_dir($dir) || !is_writable($dir)) { |
|
| 1435 | + if ( ! is_dir($dir) || ! is_writable($dir)) { |
|
| 1436 | 1436 | // cannot write, skip |
| 1437 | 1437 | $info['warning'][] = 'attachment at '.$frame_offset.' cannot be saved to "'.$dir.'" (not writable)'; |
| 1438 | 1438 | unset($parsedFrame['data']); |
@@ -1442,7 +1442,7 @@ discard block |
||
| 1442 | 1442 | // if we get this far, must be OK |
| 1443 | 1443 | if (is_string($this->getid3->option_save_attachments)) { |
| 1444 | 1444 | $destination_filename = $dir.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$frame_offset; |
| 1445 | - if (!file_exists($destination_filename) || is_writable($destination_filename)) { |
|
| 1445 | + if ( ! file_exists($destination_filename) || is_writable($destination_filename)) { |
|
| 1446 | 1446 | file_put_contents($destination_filename, $parsedFrame['data']); |
| 1447 | 1447 | } else { |
| 1448 | 1448 | $info['warning'][] = 'attachment at '.$frame_offset.' cannot be saved to "'.$destination_filename.'" (not writable)'; |
@@ -1450,8 +1450,8 @@ discard block |
||
| 1450 | 1450 | $parsedFrame['data_filename'] = $destination_filename; |
| 1451 | 1451 | unset($parsedFrame['data']); |
| 1452 | 1452 | } else { |
| 1453 | - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { |
|
| 1454 | - if (!isset($info['id3v2']['comments']['picture'])) { |
|
| 1453 | + if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) { |
|
| 1454 | + if ( ! isset($info['id3v2']['comments']['picture'])) { |
|
| 1455 | 1455 | $info['id3v2']['comments']['picture'] = array(); |
| 1456 | 1456 | } |
| 1457 | 1457 | $comments_picture_data = array(); |
@@ -1530,7 +1530,7 @@ discard block |
||
| 1530 | 1530 | // <Header for 'Play counter', ID: 'PCNT'> |
| 1531 | 1531 | // Counter $xx xx xx xx (xx ...) |
| 1532 | 1532 | |
| 1533 | - $parsedFrame['data'] = getid3_lib::BigEndian2Int($parsedFrame['data']); |
|
| 1533 | + $parsedFrame['data'] = getid3_lib::BigEndian2Int($parsedFrame['data']); |
|
| 1534 | 1534 | |
| 1535 | 1535 | |
| 1536 | 1536 | } elseif ((($id3v2_majorversion >= 3) && ($parsedFrame['frame_name'] == 'POPM')) || // 4.17 POPM Popularimeter |
@@ -1654,7 +1654,7 @@ discard block |
||
| 1654 | 1654 | $parsedFrame['url'] = $frame_url; |
| 1655 | 1655 | |
| 1656 | 1656 | $parsedFrame['additionaldata'] = (string) substr($parsedFrame['data'], $frame_offset); |
| 1657 | - if (!empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { |
|
| 1657 | + if ( ! empty($parsedFrame['framenameshort']) && $parsedFrame['url']) { |
|
| 1658 | 1658 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback_iso88591_utf8($parsedFrame['url']); |
| 1659 | 1659 | } |
| 1660 | 1660 | unset($parsedFrame['data']); |
@@ -1693,7 +1693,7 @@ discard block |
||
| 1693 | 1693 | $parsedFrame['encoding'] = $this->TextEncodingNameLookup($frame_textencoding); |
| 1694 | 1694 | |
| 1695 | 1695 | $parsedFrame['data'] = (string) substr($parsedFrame['data'], $frame_offset); |
| 1696 | - if (!empty($parsedFrame['framenameshort']) && !empty($parsedFrame['data'])) { |
|
| 1696 | + if ( ! empty($parsedFrame['framenameshort']) && ! empty($parsedFrame['data'])) { |
|
| 1697 | 1697 | $info['id3v2']['comments'][$parsedFrame['framenameshort']][] = getid3_lib::iconv_fallback($parsedFrame['encoding'], $info['id3v2']['encoding'], $parsedFrame['data']); |
| 1698 | 1698 | } |
| 1699 | 1699 | unset($parsedFrame['data']); |
@@ -1724,8 +1724,8 @@ discard block |
||
| 1724 | 1724 | $parsedFrame['pricepaid']['value'] = substr($frame_pricepaid, 3); |
| 1725 | 1725 | |
| 1726 | 1726 | $parsedFrame['purchasedate'] = substr($parsedFrame['data'], $frame_offset, 8); |
| 1727 | - if (!$this->IsValidDateStampString($parsedFrame['purchasedate'])) { |
|
| 1728 | - $parsedFrame['purchasedateunix'] = mktime (0, 0, 0, substr($parsedFrame['purchasedate'], 4, 2), substr($parsedFrame['purchasedate'], 6, 2), substr($parsedFrame['purchasedate'], 0, 4)); |
|
| 1727 | + if ( ! $this->IsValidDateStampString($parsedFrame['purchasedate'])) { |
|
| 1728 | + $parsedFrame['purchasedateunix'] = mktime(0, 0, 0, substr($parsedFrame['purchasedate'], 4, 2), substr($parsedFrame['purchasedate'], 6, 2), substr($parsedFrame['purchasedate'], 0, 4)); |
|
| 1729 | 1729 | } |
| 1730 | 1730 | $frame_offset += 8; |
| 1731 | 1731 | |
@@ -1896,7 +1896,7 @@ discard block |
||
| 1896 | 1896 | // Minimum offset to next tag $xx xx xx xx |
| 1897 | 1897 | |
| 1898 | 1898 | $frame_offset = 0; |
| 1899 | - $parsedFrame['data'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); |
|
| 1899 | + $parsedFrame['data'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); |
|
| 1900 | 1900 | |
| 1901 | 1901 | |
| 1902 | 1902 | } elseif (($id3v2_majorversion >= 4) && ($parsedFrame['frame_name'] == 'ASPI')) { // 4.30 ASPI Audio seek point index (ID3v2.4+ only) |
@@ -1990,7 +1990,7 @@ discard block |
||
| 1990 | 1990 | $frame_offset += 4; |
| 1991 | 1991 | if (substr($parsedFrame['data'], $frame_offset, 4) != "\xFF\xFF\xFF\xFF") { |
| 1992 | 1992 | // "If these bytes are all set to 0xFF then the value should be ignored and the start time value should be utilized." |
| 1993 | - $parsedFrame['offset_end'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); |
|
| 1993 | + $parsedFrame['offset_end'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); |
|
| 1994 | 1994 | } |
| 1995 | 1995 | $frame_offset += 4; |
| 1996 | 1996 | |
@@ -1999,7 +1999,7 @@ discard block |
||
| 1999 | 1999 | while ($frame_offset < strlen($parsedFrame['data'])) { |
| 2000 | 2000 | // <Optional embedded sub-frames> |
| 2001 | 2001 | $subframe = array(); |
| 2002 | - $subframe['name'] = substr($parsedFrame['data'], $frame_offset, 4); |
|
| 2002 | + $subframe['name'] = substr($parsedFrame['data'], $frame_offset, 4); |
|
| 2003 | 2003 | $frame_offset += 4; |
| 2004 | 2004 | $subframe['size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); |
| 2005 | 2005 | $frame_offset += 4; |
@@ -2013,9 +2013,9 @@ discard block |
||
| 2013 | 2013 | $frame_offset += $subframe['size']; |
| 2014 | 2014 | |
| 2015 | 2015 | $subframe['encodingid'] = ord(substr($subframe_rawdata, 0, 1)); |
| 2016 | - $subframe['text'] = substr($subframe_rawdata, 1); |
|
| 2016 | + $subframe['text'] = substr($subframe_rawdata, 1); |
|
| 2017 | 2017 | $subframe['encoding'] = $this->TextEncodingNameLookup($subframe['encodingid']); |
| 2018 | - $encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text']));; |
|
| 2018 | + $encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text'])); ; |
|
| 2019 | 2019 | switch (substr($encoding_converted_text, 0, 2)) { |
| 2020 | 2020 | case "\xFF\xFE": |
| 2021 | 2021 | case "\xFE\xFF": |
@@ -2055,7 +2055,7 @@ discard block |
||
| 2055 | 2055 | $id3v2_chapter_entry[$id3v2_chapter_key] = $parsedFrame[$id3v2_chapter_key]; |
| 2056 | 2056 | } |
| 2057 | 2057 | } |
| 2058 | - if (!isset($info['id3v2']['chapters'])) { |
|
| 2058 | + if ( ! isset($info['id3v2']['chapters'])) { |
|
| 2059 | 2059 | $info['id3v2']['chapters'] = array(); |
| 2060 | 2060 | } |
| 2061 | 2061 | $info['id3v2']['chapters'][] = $id3v2_chapter_entry; |
@@ -2096,7 +2096,7 @@ discard block |
||
| 2096 | 2096 | while ($frame_offset < strlen($parsedFrame['data'])) { |
| 2097 | 2097 | // <Optional embedded sub-frames> |
| 2098 | 2098 | $subframe = array(); |
| 2099 | - $subframe['name'] = substr($parsedFrame['data'], $frame_offset, 4); |
|
| 2099 | + $subframe['name'] = substr($parsedFrame['data'], $frame_offset, 4); |
|
| 2100 | 2100 | $frame_offset += 4; |
| 2101 | 2101 | $subframe['size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], $frame_offset, 4)); |
| 2102 | 2102 | $frame_offset += 4; |
@@ -2110,9 +2110,9 @@ discard block |
||
| 2110 | 2110 | $frame_offset += $subframe['size']; |
| 2111 | 2111 | |
| 2112 | 2112 | $subframe['encodingid'] = ord(substr($subframe_rawdata, 0, 1)); |
| 2113 | - $subframe['text'] = substr($subframe_rawdata, 1); |
|
| 2113 | + $subframe['text'] = substr($subframe_rawdata, 1); |
|
| 2114 | 2114 | $subframe['encoding'] = $this->TextEncodingNameLookup($subframe['encodingid']); |
| 2115 | - $encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text']));; |
|
| 2115 | + $encoding_converted_text = trim(getid3_lib::iconv_fallback($subframe['encoding'], $info['encoding'], $subframe['text'])); ; |
|
| 2116 | 2116 | switch (substr($encoding_converted_text, 0, 2)) { |
| 2117 | 2117 | case "\xFF\xFE": |
| 2118 | 2118 | case "\xFE\xFF": |
@@ -2596,9 +2596,9 @@ discard block |
||
| 2596 | 2596 | |
| 2597 | 2597 | |
| 2598 | 2598 | |
| 2599 | - public static function LanguageLookup($languagecode, $casesensitive=false) { |
|
| 2599 | + public static function LanguageLookup($languagecode, $casesensitive = false) { |
|
| 2600 | 2600 | |
| 2601 | - if (!$casesensitive) { |
|
| 2601 | + if ( ! $casesensitive) { |
|
| 2602 | 2602 | $languagecode = strtolower($languagecode); |
| 2603 | 2603 | } |
| 2604 | 2604 | |
@@ -3101,8 +3101,8 @@ discard block |
||
| 3101 | 3101 | 0x01 => 'lyrics', |
| 3102 | 3102 | 0x02 => 'text transcription', |
| 3103 | 3103 | 0x03 => 'movement/part name', // (e.g. 'Adagio') |
| 3104 | - 0x04 => 'events', // (e.g. 'Don Quijote enters the stage') |
|
| 3105 | - 0x05 => 'chord', // (e.g. 'Bb F Fsus') |
|
| 3104 | + 0x04 => 'events', // (e.g. 'Don Quijote enters the stage') |
|
| 3105 | + 0x05 => 'chord', // (e.g. 'Bb F Fsus') |
|
| 3106 | 3106 | 0x06 => 'trivia/\'pop up\' information', |
| 3107 | 3107 | 0x07 => 'URLs to webpages', |
| 3108 | 3108 | 0x08 => 'URLs to images' |
@@ -3111,7 +3111,7 @@ discard block |
||
| 3111 | 3111 | return (isset($SYTLContentTypeLookup[$index]) ? $SYTLContentTypeLookup[$index] : ''); |
| 3112 | 3112 | } |
| 3113 | 3113 | |
| 3114 | - public static function APICPictureTypeLookup($index, $returnarray=false) { |
|
| 3114 | + public static function APICPictureTypeLookup($index, $returnarray = false) { |
|
| 3115 | 3115 | static $APICPictureTypeLookup = array( |
| 3116 | 3116 | 0x00 => 'Other', |
| 3117 | 3117 | 0x01 => '32x32 pixels \'file icon\' (PNG only)', |
@@ -3540,10 +3540,10 @@ discard block |
||
| 3540 | 3540 | // http://www.id3.org/id3v2.4.0-structure.txt |
| 3541 | 3541 | // Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings: |
| 3542 | 3542 | static $TextEncodingTerminatorLookup = array( |
| 3543 | - 0 => "\x00", // $00 ISO-8859-1. Terminated with $00. |
|
| 3543 | + 0 => "\x00", // $00 ISO-8859-1. Terminated with $00. |
|
| 3544 | 3544 | 1 => "\x00\x00", // $01 UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00. |
| 3545 | 3545 | 2 => "\x00\x00", // $02 UTF-16BE encoded Unicode without BOM. Terminated with $00 00. |
| 3546 | - 3 => "\x00", // $03 UTF-8 encoded Unicode. Terminated with $00. |
|
| 3546 | + 3 => "\x00", // $03 UTF-8 encoded Unicode. Terminated with $00. |
|
| 3547 | 3547 | 255 => "\x00\x00" |
| 3548 | 3548 | ); |
| 3549 | 3549 | return (isset($TextEncodingTerminatorLookup[$encoding]) ? $TextEncodingTerminatorLookup[$encoding] : "\x00"); |
@@ -3554,9 +3554,9 @@ discard block |
||
| 3554 | 3554 | // Frames that allow different types of text encoding contains a text encoding description byte. Possible encodings: |
| 3555 | 3555 | static $TextEncodingNameLookup = array( |
| 3556 | 3556 | 0 => 'ISO-8859-1', // $00 ISO-8859-1. Terminated with $00. |
| 3557 | - 1 => 'UTF-16', // $01 UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00. |
|
| 3558 | - 2 => 'UTF-16BE', // $02 UTF-16BE encoded Unicode without BOM. Terminated with $00 00. |
|
| 3559 | - 3 => 'UTF-8', // $03 UTF-8 encoded Unicode. Terminated with $00. |
|
| 3557 | + 1 => 'UTF-16', // $01 UTF-16 encoded Unicode with BOM. All strings in the same frame SHALL have the same byteorder. Terminated with $00 00. |
|
| 3558 | + 2 => 'UTF-16BE', // $02 UTF-16BE encoded Unicode without BOM. Terminated with $00 00. |
|
| 3559 | + 3 => 'UTF-8', // $03 UTF-8 encoded Unicode. Terminated with $00. |
|
| 3560 | 3560 | 255 => 'UTF-16BE' |
| 3561 | 3561 | ); |
| 3562 | 3562 | return (isset($TextEncodingNameLookup[$encoding]) ? $TextEncodingNameLookup[$encoding] : 'ISO-8859-1'); |
@@ -3576,7 +3576,7 @@ discard block |
||
| 3576 | 3576 | return false; |
| 3577 | 3577 | } |
| 3578 | 3578 | |
| 3579 | - public static function IsANumber($numberstring, $allowdecimal=false, $allownegative=false) { |
|
| 3579 | + public static function IsANumber($numberstring, $allowdecimal = false, $allownegative = false) { |
|
| 3580 | 3580 | for ($i = 0; $i < strlen($numberstring); $i++) { |
| 3581 | 3581 | if ((chr($numberstring{$i}) < chr('0')) || (chr($numberstring{$i}) > chr('9'))) { |
| 3582 | 3582 | if (($numberstring{$i} == '.') && $allowdecimal) { |
@@ -3595,7 +3595,7 @@ discard block |
||
| 3595 | 3595 | if (strlen($datestamp) != 8) { |
| 3596 | 3596 | return false; |
| 3597 | 3597 | } |
| 3598 | - if (!self::IsANumber($datestamp, false)) { |
|
| 3598 | + if ( ! self::IsANumber($datestamp, false)) { |
|
| 3599 | 3599 | return false; |
| 3600 | 3600 | } |
| 3601 | 3601 | $year = substr($datestamp, 0, 4); |
@@ -126,6 +126,9 @@ discard block |
||
| 126 | 126 | return true; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | + /** |
|
| 130 | + * @param integer $version |
|
| 131 | + */ |
|
| 129 | 132 | public function getLyrics3Data($endoffset, $version, $length) { |
| 130 | 133 | // http://www.volweb.cz/str/tags.htm |
| 131 | 134 | |
@@ -287,6 +290,9 @@ discard block |
||
| 287 | 290 | return true; |
| 288 | 291 | } |
| 289 | 292 | |
| 293 | + /** |
|
| 294 | + * @param string $char |
|
| 295 | + */ |
|
| 290 | 296 | public function IntString2Bool($char) { |
| 291 | 297 | if ($char == '1') { |
| 292 | 298 | return true; |
@@ -23,15 +23,15 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | // http://www.volweb.cz/str/tags.htm |
| 25 | 25 | |
| 26 | - if (!getid3_lib::intValueSupported($info['filesize'])) { |
|
| 26 | + if ( ! getid3_lib::intValueSupported($info['filesize'])) { |
|
| 27 | 27 | $info['warning'][] = 'Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'; |
| 28 | 28 | return false; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - $this->fseek((0 - 128 - 9 - 6), SEEK_END); // end - ID3v1 - "LYRICSEND" - [Lyrics3size] |
|
| 31 | + $this->fseek((0 - 128 - 9 - 6), SEEK_END); // end - ID3v1 - "LYRICSEND" - [Lyrics3size] |
|
| 32 | 32 | $lyrics3_id3v1 = $this->fread(128 + 9 + 6); |
| 33 | - $lyrics3lsz = substr($lyrics3_id3v1, 0, 6); // Lyrics3size |
|
| 34 | - $lyrics3end = substr($lyrics3_id3v1, 6, 9); // LYRICSEND or LYRICS200 |
|
| 33 | + $lyrics3lsz = substr($lyrics3_id3v1, 0, 6); // Lyrics3size |
|
| 34 | + $lyrics3end = substr($lyrics3_id3v1, 6, 9); // LYRICSEND or LYRICS200 |
|
| 35 | 35 | $id3v1tag = substr($lyrics3_id3v1, 15, 128); // ID3v1 |
| 36 | 36 | |
| 37 | 37 | if ($lyrics3end == 'LYRICSEND') { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $info['avdataend'] = $lyrics3offset; |
| 101 | 101 | $this->getLyrics3Data($lyrics3offset, $lyrics3version, $lyrics3size); |
| 102 | 102 | |
| 103 | - if (!isset($info['ape'])) { |
|
| 103 | + if ( ! isset($info['ape'])) { |
|
| 104 | 104 | if (isset($info['lyrics3']['tag_offset_start'])) { |
| 105 | 105 | $GETID3_ERRORARRAY = &$info['warning']; |
| 106 | 106 | getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.apetag.php', __FILE__, true); |
@@ -109,10 +109,10 @@ discard block |
||
| 109 | 109 | $getid3_apetag = new getid3_apetag($getid3_temp); |
| 110 | 110 | $getid3_apetag->overrideendoffset = $info['lyrics3']['tag_offset_start']; |
| 111 | 111 | $getid3_apetag->Analyze(); |
| 112 | - if (!empty($getid3_temp->info['ape'])) { |
|
| 112 | + if ( ! empty($getid3_temp->info['ape'])) { |
|
| 113 | 113 | $info['ape'] = $getid3_temp->info['ape']; |
| 114 | 114 | } |
| 115 | - if (!empty($getid3_temp->info['replay_gain'])) { |
|
| 115 | + if ( ! empty($getid3_temp->info['replay_gain'])) { |
|
| 116 | 116 | $info['replay_gain'] = $getid3_temp->info['replay_gain']; |
| 117 | 117 | } |
| 118 | 118 | unset($getid3_temp, $getid3_apetag); |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $info = &$this->getid3->info; |
| 133 | 133 | |
| 134 | - if (!getid3_lib::intValueSupported($endoffset)) { |
|
| 134 | + if ( ! getid3_lib::intValueSupported($endoffset)) { |
|
| 135 | 135 | $info['warning'][] = 'Unable to check for Lyrics3 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'; |
| 136 | 136 | return false; |
| 137 | 137 | } |
@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | foreach ($imagestrings as $key => $imagestring) { |
| 212 | 212 | if (strpos($imagestring, '||') !== false) { |
| 213 | 213 | $imagearray = explode('||', $imagestring); |
| 214 | - $ParsedLyrics3['images'][$key]['filename'] = (isset($imagearray[0]) ? $imagearray[0] : ''); |
|
| 215 | - $ParsedLyrics3['images'][$key]['description'] = (isset($imagearray[1]) ? $imagearray[1] : ''); |
|
| 214 | + $ParsedLyrics3['images'][$key]['filename'] = (isset($imagearray[0]) ? $imagearray[0] : ''); |
|
| 215 | + $ParsedLyrics3['images'][$key]['description'] = (isset($imagearray[1]) ? $imagearray[1] : ''); |
|
| 216 | 216 | $ParsedLyrics3['images'][$key]['timestamp'] = $this->Lyrics3Timestamp2Seconds(isset($imagearray[2]) ? $imagearray[2] : ''); |
| 217 | 217 | } |
| 218 | 218 | } |