@@ -335,6 +335,10 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | // public: analyze file |
338 | + |
|
339 | + /** |
|
340 | + * @param string $filename |
|
341 | + */ |
|
338 | 342 | public function analyze($filename) { |
339 | 343 | try { |
340 | 344 | if (!$this->openfile($filename)) { |
@@ -486,6 +490,10 @@ discard block |
||
486 | 490 | |
487 | 491 | |
488 | 492 | // private: error handling |
493 | + |
|
494 | + /** |
|
495 | + * @param string $message |
|
496 | + */ |
|
489 | 497 | public function error($message) { |
490 | 498 | $this->CleanUp(); |
491 | 499 | if (!isset($this->info['error'])) { |
@@ -1097,6 +1105,9 @@ discard block |
||
1097 | 1105 | |
1098 | 1106 | |
1099 | 1107 | |
1108 | + /** |
|
1109 | + * @param string $filedata |
|
1110 | + */ |
|
1100 | 1111 | public function GetFileFormat(&$filedata, $filename='') { |
1101 | 1112 | // this function will determine the format of a file based on usually |
1102 | 1113 | // the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG, |
@@ -1136,6 +1147,10 @@ discard block |
||
1136 | 1147 | |
1137 | 1148 | |
1138 | 1149 | // converts array to $encoding charset from $this->encoding |
1150 | + |
|
1151 | + /** |
|
1152 | + * @param string $encoding |
|
1153 | + */ |
|
1139 | 1154 | public function CharConvert(&$array, $encoding) { |
1140 | 1155 | |
1141 | 1156 | // identical encoding - end here |
@@ -1280,6 +1295,9 @@ discard block |
||
1280 | 1295 | return true; |
1281 | 1296 | } |
1282 | 1297 | |
1298 | + /** |
|
1299 | + * @param string $algorithm |
|
1300 | + */ |
|
1283 | 1301 | public function getHashdata($algorithm) { |
1284 | 1302 | switch ($algorithm) { |
1285 | 1303 | case 'md5': |
@@ -1573,6 +1591,9 @@ discard block |
||
1573 | 1591 | return tempnam($this->tempdir, 'gI3'); |
1574 | 1592 | } |
1575 | 1593 | |
1594 | + /** |
|
1595 | + * @param string $name |
|
1596 | + */ |
|
1576 | 1597 | public function include_module($name) { |
1577 | 1598 | //if (!file_exists($this->include_path.'module.'.$name.'.php')) { |
1578 | 1599 | if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) { |
@@ -1600,6 +1621,9 @@ discard block |
||
1600 | 1621 | private $dependency_to = null; |
1601 | 1622 | |
1602 | 1623 | |
1624 | + /** |
|
1625 | + * @param string $call_module |
|
1626 | + */ |
|
1603 | 1627 | public function __construct(getID3 $getid3, $call_module=null) { |
1604 | 1628 | $this->getid3 = $getid3; |
1605 | 1629 | |
@@ -1664,6 +1688,9 @@ discard block |
||
1664 | 1688 | return fread($this->getid3->fp, $bytes); |
1665 | 1689 | } |
1666 | 1690 | |
1691 | + /** |
|
1692 | + * @param integer $whence |
|
1693 | + */ |
|
1667 | 1694 | protected function fseek($bytes, $whence=SEEK_SET) { |
1668 | 1695 | if ($this->data_string_flag) { |
1669 | 1696 | switch ($whence) { |
@@ -1701,20 +1728,32 @@ discard block |
||
1701 | 1728 | return feof($this->getid3->fp); |
1702 | 1729 | } |
1703 | 1730 | |
1731 | + /** |
|
1732 | + * @param string $module |
|
1733 | + */ |
|
1704 | 1734 | final protected function isDependencyFor($module) { |
1705 | 1735 | return $this->dependency_to == $module; |
1706 | 1736 | } |
1707 | 1737 | |
1738 | + /** |
|
1739 | + * @param string $text |
|
1740 | + */ |
|
1708 | 1741 | protected function error($text) { |
1709 | 1742 | $this->getid3->info['error'][] = $text; |
1710 | 1743 | |
1711 | 1744 | return false; |
1712 | 1745 | } |
1713 | 1746 | |
1747 | + /** |
|
1748 | + * @param string $text |
|
1749 | + */ |
|
1714 | 1750 | protected function warning($text) { |
1715 | 1751 | return $this->getid3->warning($text); |
1716 | 1752 | } |
1717 | 1753 | |
1754 | + /** |
|
1755 | + * @param string $text |
|
1756 | + */ |
|
1718 | 1757 | protected function notice($text) { |
1719 | 1758 | // does nothing for now |
1720 | 1759 | } |
@@ -1588,8 +1588,8 @@ |
||
1588 | 1588 | abstract class getid3_handler { |
1589 | 1589 | |
1590 | 1590 | /** |
1591 | - * @var getID3 |
|
1592 | - */ |
|
1591 | + * @var getID3 |
|
1592 | + */ |
|
1593 | 1593 | protected $getid3; // pointer |
1594 | 1594 | |
1595 | 1595 | protected $data_string_flag = false; // analyzing filepointer or string |
@@ -11,24 +11,24 @@ discard block |
||
11 | 11 | ///////////////////////////////////////////////////////////////// |
12 | 12 | |
13 | 13 | // define a constant rather than looking up every time it is needed |
14 | -if (!defined('GETID3_OS_ISWINDOWS')) { |
|
14 | +if ( ! defined('GETID3_OS_ISWINDOWS')) { |
|
15 | 15 | define('GETID3_OS_ISWINDOWS', (stripos(PHP_OS, 'WIN') === 0)); |
16 | 16 | } |
17 | 17 | // Get base path of getID3() - ONCE |
18 | -if (!defined('GETID3_INCLUDEPATH')) { |
|
18 | +if ( ! defined('GETID3_INCLUDEPATH')) { |
|
19 | 19 | define('GETID3_INCLUDEPATH', dirname(__FILE__).DIRECTORY_SEPARATOR); |
20 | 20 | } |
21 | 21 | // Workaround Bug #39923 (https://bugs.php.net/bug.php?id=39923) |
22 | -if (!defined('IMG_JPG') && defined('IMAGETYPE_JPEG')) { |
|
22 | +if ( ! defined('IMG_JPG') && defined('IMAGETYPE_JPEG')) { |
|
23 | 23 | define('IMG_JPG', IMAGETYPE_JPEG); |
24 | 24 | } |
25 | 25 | |
26 | 26 | // attempt to define temp dir as something flexible but reliable |
27 | 27 | $temp_dir = ini_get('upload_tmp_dir'); |
28 | -if ($temp_dir && (!is_dir($temp_dir) || !is_readable($temp_dir))) { |
|
28 | +if ($temp_dir && ( ! is_dir($temp_dir) || ! is_readable($temp_dir))) { |
|
29 | 29 | $temp_dir = ''; |
30 | 30 | } |
31 | -if (!$temp_dir && function_exists('sys_get_temp_dir')) { // sys_get_temp_dir added in PHP v5.2.1 |
|
31 | +if ( ! $temp_dir && function_exists('sys_get_temp_dir')) { // sys_get_temp_dir added in PHP v5.2.1 |
|
32 | 32 | // sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts |
33 | 33 | $temp_dir = sys_get_temp_dir(); |
34 | 34 | } |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | break; |
53 | 53 | } |
54 | 54 | } |
55 | - if (!$found_valid_tempdir) { |
|
55 | + if ( ! $found_valid_tempdir) { |
|
56 | 56 | $temp_dir = ''; |
57 | 57 | } |
58 | 58 | unset($open_basedirs, $found_valid_tempdir, $basedir); |
59 | 59 | } |
60 | -if (!$temp_dir) { |
|
60 | +if ( ! $temp_dir) { |
|
61 | 61 | $temp_dir = '*'; // invalid directory name should force tempnam() to use system default temp dir |
62 | 62 | } |
63 | 63 | // $temp_dir = '/something/else/'; // feel free to override temp dir here if it works better for your system |
64 | -if (!defined('GETID3_TEMP_DIR')) { |
|
64 | +if ( ! defined('GETID3_TEMP_DIR')) { |
|
65 | 65 | define('GETID3_TEMP_DIR', $temp_dir); |
66 | 66 | } |
67 | 67 | unset($open_basedir, $temp_dir); |
@@ -72,19 +72,19 @@ discard block |
||
72 | 72 | class getID3 |
73 | 73 | { |
74 | 74 | // public: Settings |
75 | - public $encoding = 'UTF-8'; // CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE |
|
76 | - public $encoding_id3v1 = 'ISO-8859-1'; // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252' |
|
75 | + public $encoding = 'UTF-8'; // CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE |
|
76 | + public $encoding_id3v1 = 'ISO-8859-1'; // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252' |
|
77 | 77 | |
78 | 78 | // public: Optional tag checks - disable for speed. |
79 | - public $option_tag_id3v1 = true; // Read and process ID3v1 tags |
|
80 | - public $option_tag_id3v2 = true; // Read and process ID3v2 tags |
|
81 | - public $option_tag_lyrics3 = true; // Read and process Lyrics3 tags |
|
82 | - public $option_tag_apetag = true; // Read and process APE tags |
|
83 | - public $option_tags_process = true; // Copy tags to root key 'tags' and encode to $this->encoding |
|
84 | - public $option_tags_html = true; // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities |
|
79 | + public $option_tag_id3v1 = true; // Read and process ID3v1 tags |
|
80 | + public $option_tag_id3v2 = true; // Read and process ID3v2 tags |
|
81 | + public $option_tag_lyrics3 = true; // Read and process Lyrics3 tags |
|
82 | + public $option_tag_apetag = true; // Read and process APE tags |
|
83 | + public $option_tags_process = true; // Copy tags to root key 'tags' and encode to $this->encoding |
|
84 | + public $option_tags_html = true; // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities |
|
85 | 85 | |
86 | 86 | // public: Optional tag/comment calucations |
87 | - public $option_extra_info = true; // Calculate additional info such as bitrate, channelmode etc |
|
87 | + public $option_extra_info = true; // Calculate additional info such as bitrate, channelmode etc |
|
88 | 88 | |
89 | 89 | // public: Optional handling of embedded attachments (e.g. images) |
90 | 90 | public $option_save_attachments = true; // defaults to true (ATTACHMENTS_INLINE) for backward compatibility |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | public $option_md5_data = false; // Get MD5 sum of data part - slow |
94 | 94 | public $option_md5_data_source = false; // Use MD5 of source file if availble - only FLAC and OptimFROG |
95 | 95 | public $option_sha1_data = false; // Get SHA1 sum of data part - slow |
96 | - public $option_max_2gb_check = null; // Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on PHP_INT_MAX) |
|
96 | + public $option_max_2gb_check = null; // Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on PHP_INT_MAX) |
|
97 | 97 | |
98 | 98 | // public: Read buffer size in bytes |
99 | 99 | public $option_fread_buffer_size = 32768; |
100 | 100 | |
101 | 101 | // Public variables |
102 | - public $filename; // Filename of file being analysed. |
|
103 | - public $fp; // Filepointer to file being analysed. |
|
104 | - public $info; // Result array. |
|
102 | + public $filename; // Filename of file being analysed. |
|
103 | + public $fp; // Filepointer to file being analysed. |
|
104 | + public $info; // Result array. |
|
105 | 105 | public $tempdir = GETID3_TEMP_DIR; |
106 | 106 | public $memory_limit = 0; |
107 | 107 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | // Load support library |
162 | - if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { |
|
162 | + if ( ! include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { |
|
163 | 163 | $this->startup_error .= 'getid3.lib.php is missing or corrupt'; |
164 | 164 | } |
165 | 165 | |
@@ -174,18 +174,18 @@ discard block |
||
174 | 174 | // This path cannot contain spaces, but the below code will attempt to get the |
175 | 175 | // 8.3-equivalent path automatically |
176 | 176 | // IMPORTANT: This path must include the trailing slash |
177 | - if (GETID3_OS_ISWINDOWS && !defined('GETID3_HELPERAPPSDIR')) { |
|
177 | + if (GETID3_OS_ISWINDOWS && ! defined('GETID3_HELPERAPPSDIR')) { |
|
178 | 178 | |
179 | 179 | $helperappsdir = GETID3_INCLUDEPATH.'..'.DIRECTORY_SEPARATOR.'helperapps'; // must not have any space in this path |
180 | 180 | |
181 | - if (!is_dir($helperappsdir)) { |
|
181 | + if ( ! is_dir($helperappsdir)) { |
|
182 | 182 | $this->startup_warning .= '"'.$helperappsdir.'" cannot be defined as GETID3_HELPERAPPSDIR because it does not exist'; |
183 | 183 | } elseif (strpos(realpath($helperappsdir), ' ') !== false) { |
184 | 184 | $DirPieces = explode(DIRECTORY_SEPARATOR, realpath($helperappsdir)); |
185 | 185 | $path_so_far = array(); |
186 | 186 | foreach ($DirPieces as $key => $value) { |
187 | 187 | if (strpos($value, ' ') !== false) { |
188 | - if (!empty($path_so_far)) { |
|
188 | + if ( ! empty($path_so_far)) { |
|
189 | 189 | $commandline = 'dir /x '.escapeshellarg(implode(DIRECTORY_SEPARATOR, $path_so_far)); |
190 | 190 | $dir_listing = `$commandline`; |
191 | 191 | $lines = explode("\n", $dir_listing); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | // public: setOption |
225 | 225 | public function setOption($optArray) { |
226 | - if (!is_array($optArray) || empty($optArray)) { |
|
226 | + if ( ! is_array($optArray) || empty($optArray)) { |
|
227 | 227 | return false; |
228 | 228 | } |
229 | 229 | foreach ($optArray as $opt => $val) { |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | |
239 | 239 | public function openfile($filename) { |
240 | 240 | try { |
241 | - if (!empty($this->startup_error)) { |
|
241 | + if ( ! empty($this->startup_error)) { |
|
242 | 242 | throw new getid3_exception($this->startup_error); |
243 | 243 | } |
244 | - if (!empty($this->startup_warning)) { |
|
244 | + if ( ! empty($this->startup_warning)) { |
|
245 | 245 | $this->warning($this->startup_warning); |
246 | 246 | } |
247 | 247 | |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | // great |
266 | 266 | } else { |
267 | 267 | $errormessagelist = array(); |
268 | - if (!is_readable($filename)) { |
|
268 | + if ( ! is_readable($filename)) { |
|
269 | 269 | $errormessagelist[] = '!is_readable'; |
270 | 270 | } |
271 | - if (!is_file($filename)) { |
|
271 | + if ( ! is_file($filename)) { |
|
272 | 272 | $errormessagelist[] = '!is_file'; |
273 | 273 | } |
274 | - if (!file_exists($filename)) { |
|
274 | + if ( ! file_exists($filename)) { |
|
275 | 275 | $errormessagelist[] = '!file_exists'; |
276 | 276 | } |
277 | 277 | if (empty($errormessagelist)) { |
@@ -317,14 +317,14 @@ discard block |
||
317 | 317 | // set more parameters |
318 | 318 | $this->info['avdataoffset'] = 0; |
319 | 319 | $this->info['avdataend'] = $this->info['filesize']; |
320 | - $this->info['fileformat'] = ''; // filled in later |
|
321 | - $this->info['audio']['dataformat'] = ''; // filled in later, unset if not used |
|
322 | - $this->info['video']['dataformat'] = ''; // filled in later, unset if not used |
|
323 | - $this->info['tags'] = array(); // filled in later, unset if not used |
|
324 | - $this->info['error'] = array(); // filled in later, unset if not used |
|
325 | - $this->info['warning'] = array(); // filled in later, unset if not used |
|
326 | - $this->info['comments'] = array(); // filled in later, unset if not used |
|
327 | - $this->info['encoding'] = $this->encoding; // required by id3v2 and iso modules - can be unset at the end if desired |
|
320 | + $this->info['fileformat'] = ''; // filled in later |
|
321 | + $this->info['audio']['dataformat'] = ''; // filled in later, unset if not used |
|
322 | + $this->info['video']['dataformat'] = ''; // filled in later, unset if not used |
|
323 | + $this->info['tags'] = array(); // filled in later, unset if not used |
|
324 | + $this->info['error'] = array(); // filled in later, unset if not used |
|
325 | + $this->info['warning'] = array(); // filled in later, unset if not used |
|
326 | + $this->info['comments'] = array(); // filled in later, unset if not used |
|
327 | + $this->info['encoding'] = $this->encoding; // required by id3v2 and iso modules - can be unset at the end if desired |
|
328 | 328 | |
329 | 329 | return true; |
330 | 330 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | // public: analyze file |
338 | 338 | public function analyze($filename) { |
339 | 339 | try { |
340 | - if (!$this->openfile($filename)) { |
|
340 | + if ( ! $this->openfile($filename)) { |
|
341 | 341 | return $this->info; |
342 | 342 | } |
343 | 343 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | } |
367 | 367 | |
368 | 368 | // ID3v2 detection (NOT parsing), even if ($this->option_tag_id3v2 == false) done to make fileformat easier |
369 | - if (!$this->option_tag_id3v2) { |
|
369 | + if ( ! $this->option_tag_id3v2) { |
|
370 | 370 | fseek($this->fp, 0); |
371 | 371 | $header = fread($this->fp, 10); |
372 | 372 | if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) { |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $determined_format = $this->GetFileFormat($formattest, $filename); |
386 | 386 | |
387 | 387 | // unable to determine file format |
388 | - if (!$determined_format) { |
|
388 | + if ( ! $determined_format) { |
|
389 | 389 | fclose($this->fp); |
390 | 390 | return $this->error('unable to determine file format'); |
391 | 391 | } |
@@ -414,14 +414,14 @@ discard block |
||
414 | 414 | $this->info['mime_type'] = $determined_format['mime_type']; |
415 | 415 | |
416 | 416 | // supported format signature pattern detected, but module deleted |
417 | - if (!file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) { |
|
417 | + if ( ! file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) { |
|
418 | 418 | fclose($this->fp); |
419 | 419 | return $this->error('Format not supported, module "'.$determined_format['include'].'" was removed.'); |
420 | 420 | } |
421 | 421 | |
422 | 422 | // module requires iconv support |
423 | 423 | // Check encoding/iconv support |
424 | - if (!empty($determined_format['iconv_req']) && !function_exists('iconv') && !in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) { |
|
424 | + if ( ! empty($determined_format['iconv_req']) && ! function_exists('iconv') && ! in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) { |
|
425 | 425 | $errormessage = 'iconv() support is required for this module ('.$determined_format['include'].') for encodings other than ISO-8859-1, UTF-8, UTF-16LE, UTF16-BE, UTF-16. '; |
426 | 426 | if (GETID3_OS_ISWINDOWS) { |
427 | 427 | $errormessage .= 'PHP does not have iconv() support. Please enable php_iconv.dll in php.ini, and copy iconv.dll from c:/php/dlls to c:/windows/system32'; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | |
437 | 437 | // instantiate module class |
438 | 438 | $class_name = 'getid3_'.$determined_format['module']; |
439 | - if (!class_exists($class_name)) { |
|
439 | + if ( ! class_exists($class_name)) { |
|
440 | 440 | return $this->error('Format not supported, module "'.$determined_format['include'].'" is corrupt.'); |
441 | 441 | } |
442 | 442 | $class = new $class_name($this); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | // get the MD5 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags |
464 | 464 | if ($this->option_md5_data) { |
465 | 465 | // do not calc md5_data if md5_data_source is present - set by flac only - future MPC/SV8 too |
466 | - if (!$this->option_md5_data_source || empty($this->info['md5_data_source'])) { |
|
466 | + if ( ! $this->option_md5_data_source || empty($this->info['md5_data_source'])) { |
|
467 | 467 | $this->getHashdata('md5'); |
468 | 468 | } |
469 | 469 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | // private: error handling |
489 | 489 | public function error($message) { |
490 | 490 | $this->CleanUp(); |
491 | - if (!isset($this->info['error'])) { |
|
491 | + if ( ! isset($this->info['error'])) { |
|
492 | 492 | $this->info['error'] = array(); |
493 | 493 | } |
494 | 494 | $this->info['error'][] = $message; |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | } |
519 | 519 | |
520 | 520 | // remove empty root keys |
521 | - if (!empty($this->info)) { |
|
521 | + if ( ! empty($this->info)) { |
|
522 | 522 | foreach ($this->info as $key => $value) { |
523 | 523 | if (empty($this->info[$key]) && ($this->info[$key] !== 0) && ($this->info[$key] !== '0')) { |
524 | 524 | unset($this->info[$key]); |
@@ -537,10 +537,10 @@ discard block |
||
537 | 537 | } |
538 | 538 | |
539 | 539 | // remove possible duplicated identical entries |
540 | - if (!empty($this->info['error'])) { |
|
540 | + if ( ! empty($this->info['error'])) { |
|
541 | 541 | $this->info['error'] = array_values(array_unique($this->info['error'])); |
542 | 542 | } |
543 | - if (!empty($this->info['warning'])) { |
|
543 | + if ( ! empty($this->info['warning'])) { |
|
544 | 544 | $this->info['warning'] = array_values(array_unique($this->info['warning'])); |
545 | 545 | } |
546 | 546 | |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | |
765 | 765 | // TTA - audio - TTA Lossless Audio Compressor (http://tta.corecodec.org) |
766 | 766 | 'tta' => array( |
767 | - 'pattern' => '^TTA', // could also be '^TTA(\x01|\x02|\x03|2|1)' |
|
767 | + 'pattern' => '^TTA', // could also be '^TTA(\x01|\x02|\x03|2|1)' |
|
768 | 768 | 'group' => 'audio', |
769 | 769 | 'module' => 'tta', |
770 | 770 | 'mime_type' => 'application/octet-stream', |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | // Misc other formats |
1053 | 1053 | |
1054 | 1054 | // PAR2 - data - Parity Volume Set Specification 2.0 |
1055 | - 'par2' => array ( |
|
1055 | + 'par2' => array( |
|
1056 | 1056 | 'pattern' => '^PAR2\x00PKT', |
1057 | 1057 | 'group' => 'misc', |
1058 | 1058 | 'module' => 'par2', |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | |
1098 | 1098 | |
1099 | 1099 | |
1100 | - public function GetFileFormat(&$filedata, $filename='') { |
|
1100 | + public function GetFileFormat(&$filedata, $filename = '') { |
|
1101 | 1101 | // this function will determine the format of a file based on usually |
1102 | 1102 | // the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG, |
1103 | 1103 | // and in the case of ISO CD image, 6 bytes offset 32kb from the start |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | foreach ($this->GetFileFormatArray() as $format_name => $info) { |
1108 | 1108 | // The /s switch on preg_match() forces preg_match() NOT to treat |
1109 | 1109 | // newline (0x0A) characters as special chars but do a binary match |
1110 | - if (!empty($info['pattern']) && preg_match('#'.$info['pattern'].'#s', $filedata)) { |
|
1110 | + if ( ! empty($info['pattern']) && preg_match('#'.$info['pattern'].'#s', $filedata)) { |
|
1111 | 1111 | $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; |
1112 | 1112 | return $info; |
1113 | 1113 | } |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | // and verify there's at least one instance of "TRACK xx AUDIO" in the file |
1128 | 1128 | $GetFileFormatArray = $this->GetFileFormatArray(); |
1129 | 1129 | $info = $GetFileFormatArray['cue']; |
1130 | - $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; |
|
1130 | + $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; |
|
1131 | 1131 | return $info; |
1132 | 1132 | } |
1133 | 1133 | |
@@ -1165,26 +1165,26 @@ discard block |
||
1165 | 1165 | static $tags; |
1166 | 1166 | if (empty($tags)) { |
1167 | 1167 | $tags = array( |
1168 | - 'asf' => array('asf' , 'UTF-16LE'), |
|
1169 | - 'midi' => array('midi' , 'ISO-8859-1'), |
|
1170 | - 'nsv' => array('nsv' , 'ISO-8859-1'), |
|
1171 | - 'ogg' => array('vorbiscomment' , 'UTF-8'), |
|
1172 | - 'png' => array('png' , 'UTF-8'), |
|
1173 | - 'tiff' => array('tiff' , 'ISO-8859-1'), |
|
1174 | - 'quicktime' => array('quicktime' , 'UTF-8'), |
|
1175 | - 'real' => array('real' , 'ISO-8859-1'), |
|
1176 | - 'vqf' => array('vqf' , 'ISO-8859-1'), |
|
1177 | - 'zip' => array('zip' , 'ISO-8859-1'), |
|
1178 | - 'riff' => array('riff' , 'ISO-8859-1'), |
|
1179 | - 'lyrics3' => array('lyrics3' , 'ISO-8859-1'), |
|
1180 | - 'id3v1' => array('id3v1' , $this->encoding_id3v1), |
|
1181 | - 'id3v2' => array('id3v2' , 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8 |
|
1182 | - 'ape' => array('ape' , 'UTF-8'), |
|
1183 | - 'cue' => array('cue' , 'ISO-8859-1'), |
|
1184 | - 'matroska' => array('matroska' , 'UTF-8'), |
|
1185 | - 'flac' => array('vorbiscomment' , 'UTF-8'), |
|
1186 | - 'divxtag' => array('divx' , 'ISO-8859-1'), |
|
1187 | - 'iptc' => array('iptc' , 'ISO-8859-1'), |
|
1168 | + 'asf' => array('asf', 'UTF-16LE'), |
|
1169 | + 'midi' => array('midi', 'ISO-8859-1'), |
|
1170 | + 'nsv' => array('nsv', 'ISO-8859-1'), |
|
1171 | + 'ogg' => array('vorbiscomment', 'UTF-8'), |
|
1172 | + 'png' => array('png', 'UTF-8'), |
|
1173 | + 'tiff' => array('tiff', 'ISO-8859-1'), |
|
1174 | + 'quicktime' => array('quicktime', 'UTF-8'), |
|
1175 | + 'real' => array('real', 'ISO-8859-1'), |
|
1176 | + 'vqf' => array('vqf', 'ISO-8859-1'), |
|
1177 | + 'zip' => array('zip', 'ISO-8859-1'), |
|
1178 | + 'riff' => array('riff', 'ISO-8859-1'), |
|
1179 | + 'lyrics3' => array('lyrics3', 'ISO-8859-1'), |
|
1180 | + 'id3v1' => array('id3v1', $this->encoding_id3v1), |
|
1181 | + 'id3v2' => array('id3v2', 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8 |
|
1182 | + 'ape' => array('ape', 'UTF-8'), |
|
1183 | + 'cue' => array('cue', 'ISO-8859-1'), |
|
1184 | + 'matroska' => array('matroska', 'UTF-8'), |
|
1185 | + 'flac' => array('vorbiscomment', 'UTF-8'), |
|
1186 | + 'divxtag' => array('divx', 'ISO-8859-1'), |
|
1187 | + 'iptc' => array('iptc', 'ISO-8859-1'), |
|
1188 | 1188 | ); |
1189 | 1189 | } |
1190 | 1190 | |
@@ -1193,19 +1193,19 @@ discard block |
||
1193 | 1193 | list($tag_name, $encoding) = $tagname_encoding_array; |
1194 | 1194 | |
1195 | 1195 | // fill in default encoding type if not already present |
1196 | - if (isset($this->info[$comment_name]) && !isset($this->info[$comment_name]['encoding'])) { |
|
1196 | + if (isset($this->info[$comment_name]) && ! isset($this->info[$comment_name]['encoding'])) { |
|
1197 | 1197 | $this->info[$comment_name]['encoding'] = $encoding; |
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | // copy comments if key name set |
1201 | - if (!empty($this->info[$comment_name]['comments'])) { |
|
1201 | + if ( ! empty($this->info[$comment_name]['comments'])) { |
|
1202 | 1202 | foreach ($this->info[$comment_name]['comments'] as $tag_key => $valuearray) { |
1203 | 1203 | foreach ($valuearray as $key => $value) { |
1204 | 1204 | if (is_string($value)) { |
1205 | 1205 | $value = trim($value, " \r\n\t"); // do not trim nulls from $value!! Unicode characters will get mangled if trailing nulls are removed! |
1206 | 1206 | } |
1207 | 1207 | if ($value) { |
1208 | - if (!is_numeric($key)) { |
|
1208 | + if ( ! is_numeric($key)) { |
|
1209 | 1209 | $this->info['tags'][trim($tag_name)][trim($tag_key)][$key] = $value; |
1210 | 1210 | } else { |
1211 | 1211 | $this->info['tags'][trim($tag_name)][trim($tag_key)][] = $value; |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | } |
1219 | 1219 | |
1220 | - if (!isset($this->info['tags'][$tag_name])) { |
|
1220 | + if ( ! isset($this->info['tags'][$tag_name])) { |
|
1221 | 1221 | // comments are set but contain nothing but empty strings, so skip |
1222 | 1222 | continue; |
1223 | 1223 | } |
@@ -1228,14 +1228,14 @@ discard block |
||
1228 | 1228 | } |
1229 | 1229 | } |
1230 | 1230 | |
1231 | - $this->CharConvert($this->info['tags'][$tag_name], $encoding); // only copy gets converted! |
|
1231 | + $this->CharConvert($this->info['tags'][$tag_name], $encoding); // only copy gets converted! |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | // pictures can take up a lot of space, and we don't need multiple copies of them |
1237 | 1237 | // let there be a single copy in [comments][picture], and not elsewhere |
1238 | - if (!empty($this->info['tags'])) { |
|
1238 | + if ( ! empty($this->info['tags'])) { |
|
1239 | 1239 | $unset_keys = array('tags', 'tags_html'); |
1240 | 1240 | foreach ($this->info['tags'] as $tagtype => $tagarray) { |
1241 | 1241 | foreach ($tagarray as $tagname => $tagdata) { |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | break; |
1292 | 1292 | } |
1293 | 1293 | |
1294 | - if (!empty($this->info['fileformat']) && !empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) { |
|
1294 | + if ( ! empty($this->info['fileformat']) && ! empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) { |
|
1295 | 1295 | |
1296 | 1296 | // We cannot get an identical md5_data value for Ogg files where the comments |
1297 | 1297 | // span more than 1 Ogg page (compared to the same audio data with smaller |
@@ -1350,7 +1350,7 @@ discard block |
||
1350 | 1350 | |
1351 | 1351 | } |
1352 | 1352 | |
1353 | - if (!empty($VorbisCommentError)) { |
|
1353 | + if ( ! empty($VorbisCommentError)) { |
|
1354 | 1354 | |
1355 | 1355 | $this->info['warning'][] = 'Failed making system call to vorbiscomment(.exe) - '.$algorithm.'_data will be incorrect. If vorbiscomment is unavailable, please download from http://www.vorbis.com/download.psp and put in the getID3() directory. Error returned: '.$VorbisCommentError; |
1356 | 1356 | $this->info[$algorithm.'_data'] = false; |
@@ -1380,7 +1380,7 @@ discard block |
||
1380 | 1380 | |
1381 | 1381 | } else { |
1382 | 1382 | |
1383 | - if (!empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) { |
|
1383 | + if ( ! empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) { |
|
1384 | 1384 | |
1385 | 1385 | // get hash from part of file |
1386 | 1386 | $this->info[$algorithm.'_data'] = getid3_lib::hash_data($this->info['filenamepath'], $this->info['avdataoffset'], $this->info['avdataend'], $algorithm); |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | public function ChannelsBitratePlaytimeCalculations() { |
1408 | 1408 | |
1409 | 1409 | // set channelmode on audio |
1410 | - if (!empty($this->info['audio']['channelmode']) || !isset($this->info['audio']['channels'])) { |
|
1410 | + if ( ! empty($this->info['audio']['channelmode']) || ! isset($this->info['audio']['channels'])) { |
|
1411 | 1411 | // ignore |
1412 | 1412 | } elseif ($this->info['audio']['channels'] == 1) { |
1413 | 1413 | $this->info['audio']['channelmode'] = 'mono'; |
@@ -1429,7 +1429,7 @@ discard block |
||
1429 | 1429 | //} |
1430 | 1430 | |
1431 | 1431 | // video bitrate undetermined, but calculable |
1432 | - if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && (!isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) { |
|
1432 | + if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && ( ! isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) { |
|
1433 | 1433 | // if video bitrate not set |
1434 | 1434 | if (isset($this->info['audio']['bitrate']) && ($this->info['audio']['bitrate'] > 0) && ($this->info['audio']['bitrate'] == $this->info['bitrate'])) { |
1435 | 1435 | // AND if audio bitrate is set to same as overall bitrate |
@@ -1445,11 +1445,11 @@ discard block |
||
1445 | 1445 | } |
1446 | 1446 | } |
1447 | 1447 | |
1448 | - if ((!isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && !empty($this->info['bitrate'])) { |
|
1448 | + if (( ! isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && ! empty($this->info['bitrate'])) { |
|
1449 | 1449 | $this->info['playtime_seconds'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['bitrate']; |
1450 | 1450 | } |
1451 | 1451 | |
1452 | - if (!isset($this->info['bitrate']) && !empty($this->info['playtime_seconds'])) { |
|
1452 | + if ( ! isset($this->info['bitrate']) && ! empty($this->info['playtime_seconds'])) { |
|
1453 | 1453 | $this->info['bitrate'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds']; |
1454 | 1454 | } |
1455 | 1455 | if (isset($this->info['bitrate']) && empty($this->info['audio']['bitrate']) && empty($this->info['video']['bitrate'])) { |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | } |
1464 | 1464 | |
1465 | 1465 | // Set playtime string |
1466 | - if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) { |
|
1466 | + if ( ! empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) { |
|
1467 | 1467 | $this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']); |
1468 | 1468 | } |
1469 | 1469 | } |
@@ -1493,17 +1493,17 @@ discard block |
||
1493 | 1493 | break; |
1494 | 1494 | |
1495 | 1495 | default: |
1496 | - if (!empty($this->info['video']['frame_rate'])) { |
|
1496 | + if ( ! empty($this->info['video']['frame_rate'])) { |
|
1497 | 1497 | $FrameRate = $this->info['video']['frame_rate']; |
1498 | 1498 | } else { |
1499 | 1499 | return false; |
1500 | 1500 | } |
1501 | - if (!empty($this->info['playtime_seconds'])) { |
|
1501 | + if ( ! empty($this->info['playtime_seconds'])) { |
|
1502 | 1502 | $PlaytimeSeconds = $this->info['playtime_seconds']; |
1503 | 1503 | } else { |
1504 | 1504 | return false; |
1505 | 1505 | } |
1506 | - if (!empty($this->info['video']['bitrate'])) { |
|
1506 | + if ( ! empty($this->info['video']['bitrate'])) { |
|
1507 | 1507 | $BitrateCompressed = $this->info['video']['bitrate']; |
1508 | 1508 | } else { |
1509 | 1509 | return false; |
@@ -1518,15 +1518,15 @@ discard block |
||
1518 | 1518 | |
1519 | 1519 | |
1520 | 1520 | public function CalculateCompressionRatioAudio() { |
1521 | - if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || !is_numeric($this->info['audio']['sample_rate'])) { |
|
1521 | + if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || ! is_numeric($this->info['audio']['sample_rate'])) { |
|
1522 | 1522 | return false; |
1523 | 1523 | } |
1524 | - $this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (!empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16)); |
|
1524 | + $this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * ( ! empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16)); |
|
1525 | 1525 | |
1526 | - if (!empty($this->info['audio']['streams'])) { |
|
1526 | + if ( ! empty($this->info['audio']['streams'])) { |
|
1527 | 1527 | foreach ($this->info['audio']['streams'] as $streamnumber => $streamdata) { |
1528 | - if (!empty($streamdata['bitrate']) && !empty($streamdata['channels']) && !empty($streamdata['sample_rate'])) { |
|
1529 | - $this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * (!empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16)); |
|
1528 | + if ( ! empty($streamdata['bitrate']) && ! empty($streamdata['channels']) && ! empty($streamdata['sample_rate'])) { |
|
1529 | + $this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * ( ! empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16)); |
|
1530 | 1530 | } |
1531 | 1531 | } |
1532 | 1532 | } |
@@ -1536,7 +1536,7 @@ discard block |
||
1536 | 1536 | |
1537 | 1537 | public function CalculateReplayGain() { |
1538 | 1538 | if (isset($this->info['replay_gain'])) { |
1539 | - if (!isset($this->info['replay_gain']['reference_volume'])) { |
|
1539 | + if ( ! isset($this->info['replay_gain']['reference_volume'])) { |
|
1540 | 1540 | $this->info['replay_gain']['reference_volume'] = (double) 89.0; |
1541 | 1541 | } |
1542 | 1542 | if (isset($this->info['replay_gain']['track']['adjustment'])) { |
@@ -1557,8 +1557,8 @@ discard block |
||
1557 | 1557 | } |
1558 | 1558 | |
1559 | 1559 | public function ProcessAudioStreams() { |
1560 | - if (!empty($this->info['audio']['bitrate']) || !empty($this->info['audio']['channels']) || !empty($this->info['audio']['sample_rate'])) { |
|
1561 | - if (!isset($this->info['audio']['streams'])) { |
|
1560 | + if ( ! empty($this->info['audio']['bitrate']) || ! empty($this->info['audio']['channels']) || ! empty($this->info['audio']['sample_rate'])) { |
|
1561 | + if ( ! isset($this->info['audio']['streams'])) { |
|
1562 | 1562 | foreach ($this->info['audio'] as $key => $value) { |
1563 | 1563 | if ($key != 'streams') { |
1564 | 1564 | $this->info['audio']['streams'][0][$key] = $value; |
@@ -1575,7 +1575,7 @@ discard block |
||
1575 | 1575 | |
1576 | 1576 | public function include_module($name) { |
1577 | 1577 | //if (!file_exists($this->include_path.'module.'.$name.'.php')) { |
1578 | - if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) { |
|
1578 | + if ( ! file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) { |
|
1579 | 1579 | throw new getid3_exception('Required module.'.$name.'.php is missing.'); |
1580 | 1580 | } |
1581 | 1581 | include_once(GETID3_INCLUDEPATH.'module.'.$name.'.php'); |
@@ -1590,17 +1590,17 @@ discard block |
||
1590 | 1590 | /** |
1591 | 1591 | * @var getID3 |
1592 | 1592 | */ |
1593 | - protected $getid3; // pointer |
|
1593 | + protected $getid3; // pointer |
|
1594 | 1594 | |
1595 | 1595 | protected $data_string_flag = false; // analyzing filepointer or string |
1596 | - protected $data_string = ''; // string to analyze |
|
1597 | - protected $data_string_position = 0; // seek position in string |
|
1598 | - protected $data_string_length = 0; // string length |
|
1596 | + protected $data_string = ''; // string to analyze |
|
1597 | + protected $data_string_position = 0; // seek position in string |
|
1598 | + protected $data_string_length = 0; // string length |
|
1599 | 1599 | |
1600 | 1600 | private $dependency_to = null; |
1601 | 1601 | |
1602 | 1602 | |
1603 | - public function __construct(getID3 $getid3, $call_module=null) { |
|
1603 | + public function __construct(getID3 $getid3, $call_module = null) { |
|
1604 | 1604 | $this->getid3 = $getid3; |
1605 | 1605 | |
1606 | 1606 | if ($call_module) { |
@@ -1658,13 +1658,13 @@ discard block |
||
1658 | 1658 | return substr($this->data_string, $this->data_string_position - $bytes, $bytes); |
1659 | 1659 | } |
1660 | 1660 | $pos = $this->ftell() + $bytes; |
1661 | - if (!getid3_lib::intValueSupported($pos)) { |
|
1661 | + if ( ! getid3_lib::intValueSupported($pos)) { |
|
1662 | 1662 | throw new getid3_exception('cannot fread('.$bytes.' from '.$this->ftell().') because beyond PHP filesystem limit', 10); |
1663 | 1663 | } |
1664 | 1664 | return fread($this->getid3->fp, $bytes); |
1665 | 1665 | } |
1666 | 1666 | |
1667 | - protected function fseek($bytes, $whence=SEEK_SET) { |
|
1667 | + protected function fseek($bytes, $whence = SEEK_SET) { |
|
1668 | 1668 | if ($this->data_string_flag) { |
1669 | 1669 | switch ($whence) { |
1670 | 1670 | case SEEK_SET: |
@@ -1687,7 +1687,7 @@ discard block |
||
1687 | 1687 | } elseif ($whence == SEEK_END) { |
1688 | 1688 | $pos = $this->getid3->info['filesize'] + $bytes; |
1689 | 1689 | } |
1690 | - if (!getid3_lib::intValueSupported($pos)) { |
|
1690 | + if ( ! getid3_lib::intValueSupported($pos)) { |
|
1691 | 1691 | throw new getid3_exception('cannot fseek('.$pos.') because beyond PHP filesystem limit', 10); |
1692 | 1692 | } |
1693 | 1693 | } |
@@ -1719,7 +1719,7 @@ discard block |
||
1719 | 1719 | // does nothing for now |
1720 | 1720 | } |
1721 | 1721 | |
1722 | - public function saveAttachment($name, $offset, $length, $image_mime=null) { |
|
1722 | + public function saveAttachment($name, $offset, $length, $image_mime = null) { |
|
1723 | 1723 | try { |
1724 | 1724 | |
1725 | 1725 | // do not extract at all |
@@ -1741,7 +1741,7 @@ discard block |
||
1741 | 1741 | |
1742 | 1742 | // set up destination path |
1743 | 1743 | $dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR); |
1744 | - if (!is_dir($dir) || !is_writable($dir)) { // check supplied directory |
|
1744 | + if ( ! is_dir($dir) || ! is_writable($dir)) { // check supplied directory |
|
1745 | 1745 | throw new Exception('supplied path ('.$dir.') does not exist, or is not writable'); |
1746 | 1746 | } |
1747 | 1747 | $dest = $dir.DIRECTORY_SEPARATOR.$name.($image_mime ? '.'.getid3_lib::ImageExtFromMime($image_mime) : ''); |
@@ -350,8 +350,7 @@ |
||
350 | 350 | $tag_class = 'getid3_'.$tag_name; |
351 | 351 | $tag = new $tag_class($this); |
352 | 352 | $tag->Analyze(); |
353 | - } |
|
354 | - catch (getid3_exception $e) { |
|
353 | + } catch (getid3_exception $e) { |
|
355 | 354 | throw $e; |
356 | 355 | } |
357 | 356 | } |
@@ -1684,6 +1684,10 @@ |
||
1684 | 1684 | return (isset($lookup[$WMpictureType]) ? $lookup[$WMpictureType] : ''); |
1685 | 1685 | } |
1686 | 1686 | |
1687 | + /** |
|
1688 | + * @param string $asf_header_extension_object_data |
|
1689 | + * @param integer $unhandled_sections |
|
1690 | + */ |
|
1687 | 1691 | public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) { |
1688 | 1692 | // http://msdn.microsoft.com/en-us/library/bb643323.aspx |
1689 | 1693 |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | class getid3_asf extends getid3_handler { |
20 | 20 | |
21 | 21 | public function __construct(getID3 $getid3) { |
22 | - parent::__construct($getid3); // extends getid3_handler::__construct() |
|
22 | + parent::__construct($getid3); // extends getid3_handler::__construct() |
|
23 | 23 | |
24 | 24 | // initialize all GUID constants |
25 | 25 | $GUIDarray = $this->KnownGUIDs(); |
26 | 26 | foreach ($GUIDarray as $GUIDname => $hexstringvalue) { |
27 | - if (!defined($GUIDname)) { |
|
27 | + if ( ! defined($GUIDname)) { |
|
28 | 28 | define($GUIDname, $this->GUIDtoBytestring($hexstringvalue)); |
29 | 29 | } |
30 | 30 | } |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | switch ($StreamPropertiesObjectData['stream_type']) { |
221 | 221 | |
222 | 222 | case GETID3_ASF_Audio_Media: |
223 | - $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); |
|
224 | - $thisfile_audio['bitrate_mode'] = (!empty($thisfile_audio['bitrate_mode']) ? $thisfile_audio['bitrate_mode'] : 'cbr'); |
|
223 | + $thisfile_audio['dataformat'] = ( ! empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); |
|
224 | + $thisfile_audio['bitrate_mode'] = ( ! empty($thisfile_audio['bitrate_mode']) ? $thisfile_audio['bitrate_mode'] : 'cbr'); |
|
225 | 225 | |
226 | 226 | $audiodata = getid3_riff::parseWAVEFORMATex(substr($StreamPropertiesObjectData['type_specific_data'], 0, 16)); |
227 | 227 | unset($audiodata['raw']); |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | break; |
230 | 230 | |
231 | 231 | case GETID3_ASF_Video_Media: |
232 | - $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); |
|
233 | - $thisfile_video['bitrate_mode'] = (!empty($thisfile_video['bitrate_mode']) ? $thisfile_video['bitrate_mode'] : 'cbr'); |
|
232 | + $thisfile_video['dataformat'] = ( ! empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); |
|
233 | + $thisfile_video['bitrate_mode'] = ( ! empty($thisfile_video['bitrate_mode']) ? $thisfile_video['bitrate_mode'] : 'cbr'); |
|
234 | 234 | break; |
235 | 235 | |
236 | 236 | case GETID3_ASF_Command_Media: |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | //return false; |
271 | 271 | break; |
272 | 272 | } |
273 | - $thisfile_asf_headerextensionobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); |
|
273 | + $thisfile_asf_headerextensionobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); |
|
274 | 274 | $offset += 2; |
275 | 275 | if ($thisfile_asf_headerextensionobject['reserved_2'] != 6) { |
276 | 276 | $info['warning'][] = 'header_extension_object.reserved_2 ('.getid3_lib::PrintHexBytes($thisfile_asf_headerextensionobject['reserved_2']).') does not match expected value of "6"'; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | $thisfile_asf_headerextensionobject['extension_data_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); |
281 | 281 | $offset += 4; |
282 | - $thisfile_asf_headerextensionobject['extension_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']); |
|
282 | + $thisfile_asf_headerextensionobject['extension_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']); |
|
283 | 283 | $unhandled_sections = 0; |
284 | 284 | $thisfile_asf_headerextensionobject['extension_data_parsed'] = $this->HeaderExtensionObjectDataParse($thisfile_asf_headerextensionobject['extension_data'], $unhandled_sections); |
285 | 285 | if ($unhandled_sections === 0) { |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | list($AudioCodecBitrate, $AudioCodecFrequency, $AudioCodecChannels) = explode(',', $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description'])); |
356 | 356 | $thisfile_audio['codec'] = $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['name']); |
357 | 357 | |
358 | - if (!isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) { |
|
358 | + if ( ! isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) { |
|
359 | 359 | $thisfile_audio['bitrate'] = (int) (trim(str_replace('kbps', '', $AudioCodecBitrate)) * 1000); |
360 | 360 | } |
361 | 361 | //if (!isset($thisfile_video['bitrate']) && isset($thisfile_audio['bitrate']) && isset($thisfile_asf['file_properties_object']['max_bitrate']) && ($thisfile_asf_codeclistobject['codec_entries_count'] > 1)) { |
362 | - if (empty($thisfile_video['bitrate']) && !empty($thisfile_audio['bitrate']) && !empty($info['bitrate'])) { |
|
362 | + if (empty($thisfile_video['bitrate']) && ! empty($thisfile_audio['bitrate']) && ! empty($info['bitrate'])) { |
|
363 | 363 | //$thisfile_video['bitrate'] = $thisfile_asf['file_properties_object']['max_bitrate'] - $thisfile_audio['bitrate']; |
364 | 364 | $thisfile_video['bitrate'] = $info['bitrate'] - $thisfile_audio['bitrate']; |
365 | 365 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | break; |
417 | 417 | } |
418 | 418 | |
419 | - if (!isset($thisfile_audio['channels'])) { |
|
419 | + if ( ! isset($thisfile_audio['channels'])) { |
|
420 | 420 | if (strstr($AudioCodecChannels, 'stereo')) { |
421 | 421 | $thisfile_audio['channels'] = 2; |
422 | 422 | } elseif (strstr($AudioCodecChannels, 'mono')) { |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $thisfile_asf_markerobject['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['name_length']); |
534 | 534 | $offset += $thisfile_asf_markerobject['name_length']; |
535 | 535 | for ($MarkersCounter = 0; $MarkersCounter < $thisfile_asf_markerobject['markers_count']; $MarkersCounter++) { |
536 | - $thisfile_asf_markerobject['markers'][$MarkersCounter]['offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); |
|
536 | + $thisfile_asf_markerobject['markers'][$MarkersCounter]['offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); |
|
537 | 537 | $offset += 8; |
538 | 538 | $thisfile_asf_markerobject['markers'][$MarkersCounter]['presentation_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); |
539 | 539 | $offset += 8; |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | $offset += 4; |
548 | 548 | $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']); |
549 | 549 | $offset += $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; |
550 | - $PaddingLength = $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] - 4 - 4 - 4 - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; |
|
550 | + $PaddingLength = $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] - 4 - 4 - 4 - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; |
|
551 | 551 | if ($PaddingLength > 0) { |
552 | - $thisfile_asf_markerobject['markers'][$MarkersCounter]['padding'] = substr($ASFHeaderData, $offset, $PaddingLength); |
|
552 | + $thisfile_asf_markerobject['markers'][$MarkersCounter]['padding'] = substr($ASFHeaderData, $offset, $PaddingLength); |
|
553 | 553 | $offset += $PaddingLength; |
554 | 554 | } |
555 | 555 | } |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | |
692 | 692 | $ASFcommentKeysToCopy = array('title'=>'title', 'author'=>'artist', 'copyright'=>'copyright', 'description'=>'comment', 'rating'=>'rating'); |
693 | 693 | foreach ($ASFcommentKeysToCopy as $keytocopyfrom => $keytocopyto) { |
694 | - if (!empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) { |
|
694 | + if ( ! empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) { |
|
695 | 695 | $thisfile_asf_comments[$keytocopyto][] = $this->TrimTerm($thisfile_asf_contentdescriptionobject[$keytocopyfrom]); |
696 | 696 | } |
697 | 697 | } |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | |
776 | 776 | case 'wm/albumtitle': |
777 | 777 | case 'album': |
778 | - $thisfile_asf_comments['album'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); |
|
778 | + $thisfile_asf_comments['album'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); |
|
779 | 779 | break; |
780 | 780 | |
781 | 781 | case 'wm/genre': |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | case 'wm/year': |
808 | 808 | case 'year': |
809 | 809 | case 'date': |
810 | - $thisfile_asf_comments['year'] = array( $this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); |
|
810 | + $thisfile_asf_comments['year'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); |
|
811 | 811 | break; |
812 | 812 | |
813 | 813 | case 'wm/lyrics': |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | break; |
1034 | 1034 | } |
1035 | 1035 | |
1036 | - if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { |
|
1036 | + if ( ! empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { |
|
1037 | 1037 | foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { |
1038 | 1038 | if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) { |
1039 | 1039 | $thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate']; |
@@ -1042,9 +1042,9 @@ discard block |
||
1042 | 1042 | } |
1043 | 1043 | } |
1044 | 1044 | } else { |
1045 | - if (!empty($thisfile_asf_audiomedia_currentstream['bytes_sec'])) { |
|
1045 | + if ( ! empty($thisfile_asf_audiomedia_currentstream['bytes_sec'])) { |
|
1046 | 1046 | $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bytes_sec'] * 8; |
1047 | - } elseif (!empty($thisfile_asf_audiomedia_currentstream['bitrate'])) { |
|
1047 | + } elseif ( ! empty($thisfile_asf_audiomedia_currentstream['bitrate'])) { |
|
1048 | 1048 | $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bitrate']; |
1049 | 1049 | } |
1050 | 1050 | } |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | $videomediaoffset += 4; |
1120 | 1120 | $thisfile_asf_videomedia_currentstream['format_data']['codec_data'] = substr($streamdata['type_specific_data'], $videomediaoffset); |
1121 | 1121 | |
1122 | - if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { |
|
1122 | + if ( ! empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { |
|
1123 | 1123 | foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { |
1124 | 1124 | if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) { |
1125 | 1125 | $thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate']; |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | $thisfile_asf_simpleindexobject['objectid_guid'] = $NextObjectGUIDtext; |
1226 | 1226 | $thisfile_asf_simpleindexobject['objectsize'] = $NextObjectSize; |
1227 | 1227 | |
1228 | - $thisfile_asf_simpleindexobject['fileid'] = substr($SimpleIndexObjectData, $offset, 16); |
|
1228 | + $thisfile_asf_simpleindexobject['fileid'] = substr($SimpleIndexObjectData, $offset, 16); |
|
1229 | 1229 | $offset += 16; |
1230 | 1230 | $thisfile_asf_simpleindexobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_simpleindexobject['fileid']); |
1231 | 1231 | $thisfile_asf_simpleindexobject['index_entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 8)); |
@@ -1379,8 +1379,7 @@ discard block |
||
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | switch (isset($thisfile_audio['codec']) ? $thisfile_audio['codec'] : '') { |
1382 | - case 'MPEG Layer-3': |
|
1383 | - $thisfile_audio['dataformat'] = 'mp3'; |
|
1382 | + case 'MPEG Layer-3' : $thisfile_audio['dataformat'] = 'mp3'; |
|
1384 | 1383 | break; |
1385 | 1384 | |
1386 | 1385 | default: |
@@ -1401,7 +1400,7 @@ discard block |
||
1401 | 1400 | // AH 2003-10-01 |
1402 | 1401 | $thisfile_audio['encoder_options'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][0]['description']); |
1403 | 1402 | |
1404 | - $thisfile_audio['codec'] = $thisfile_audio['encoder']; |
|
1403 | + $thisfile_audio['codec'] = $thisfile_audio['encoder']; |
|
1405 | 1404 | break; |
1406 | 1405 | |
1407 | 1406 | default: |
@@ -1413,15 +1412,15 @@ discard block |
||
1413 | 1412 | } |
1414 | 1413 | |
1415 | 1414 | if (isset($info['audio'])) { |
1416 | - $thisfile_audio['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); |
|
1417 | - $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); |
|
1415 | + $thisfile_audio['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); |
|
1416 | + $thisfile_audio['dataformat'] = ( ! empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); |
|
1418 | 1417 | } |
1419 | - if (!empty($thisfile_video['dataformat'])) { |
|
1420 | - $thisfile_video['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); |
|
1418 | + if ( ! empty($thisfile_video['dataformat'])) { |
|
1419 | + $thisfile_video['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); |
|
1421 | 1420 | $thisfile_video['pixel_aspect_ratio'] = (isset($thisfile_audio['pixel_aspect_ratio']) ? $thisfile_audio['pixel_aspect_ratio'] : (float) 1); |
1422 | - $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); |
|
1421 | + $thisfile_video['dataformat'] = ( ! empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); |
|
1423 | 1422 | } |
1424 | - if (!empty($thisfile_video['streams'])) { |
|
1423 | + if ( ! empty($thisfile_video['streams'])) { |
|
1425 | 1424 | $thisfile_video['resolution_x'] = 0; |
1426 | 1425 | $thisfile_video['resolution_y'] = 0; |
1427 | 1426 | foreach ($thisfile_video['streams'] as $key => $valuearray) { |
@@ -1433,7 +1432,7 @@ discard block |
||
1433 | 1432 | } |
1434 | 1433 | $info['bitrate'] = (isset($thisfile_audio['bitrate']) ? $thisfile_audio['bitrate'] : 0) + (isset($thisfile_video['bitrate']) ? $thisfile_video['bitrate'] : 0); |
1435 | 1434 | |
1436 | - if ((!isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) { |
|
1435 | + if (( ! isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) { |
|
1437 | 1436 | $info['playtime_seconds'] = ($info['filesize'] - $info['avdataoffset']) / ($info['bitrate'] / 8); |
1438 | 1437 | } |
1439 | 1438 | |
@@ -1593,13 +1592,13 @@ discard block |
||
1593 | 1592 | // AaBbCcDd-EeFf-GgHh-IiJj-KkLlMmNnOoPp is stored as this 16-byte string: |
1594 | 1593 | // $Dd $Cc $Bb $Aa $Ff $Ee $Hh $Gg $Ii $Jj $Kk $Ll $Mm $Nn $Oo $Pp |
1595 | 1594 | |
1596 | - $hexbytecharstring = chr(hexdec(substr($GUIDstring, 6, 2))); |
|
1597 | - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 4, 2))); |
|
1598 | - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 2, 2))); |
|
1599 | - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 0, 2))); |
|
1595 | + $hexbytecharstring = chr(hexdec(substr($GUIDstring, 6, 2))); |
|
1596 | + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 4, 2))); |
|
1597 | + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 2, 2))); |
|
1598 | + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 0, 2))); |
|
1600 | 1599 | |
1601 | 1600 | $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 11, 2))); |
1602 | - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 9, 2))); |
|
1601 | + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 9, 2))); |
|
1603 | 1602 | |
1604 | 1603 | $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 16, 2))); |
1605 | 1604 | $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 14, 2))); |
@@ -1618,19 +1617,19 @@ discard block |
||
1618 | 1617 | } |
1619 | 1618 | |
1620 | 1619 | public static function BytestringToGUID($Bytestring) { |
1621 | - $GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT); |
|
1622 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT); |
|
1623 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT); |
|
1624 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT); |
|
1620 | + $GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT); |
|
1621 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT); |
|
1622 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT); |
|
1623 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT); |
|
1625 | 1624 | $GUIDstring .= '-'; |
1626 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT); |
|
1627 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT); |
|
1625 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT); |
|
1626 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT); |
|
1628 | 1627 | $GUIDstring .= '-'; |
1629 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT); |
|
1630 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT); |
|
1628 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT); |
|
1629 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT); |
|
1631 | 1630 | $GUIDstring .= '-'; |
1632 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT); |
|
1633 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT); |
|
1631 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT); |
|
1632 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT); |
|
1634 | 1633 | $GUIDstring .= '-'; |
1635 | 1634 | $GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT); |
1636 | 1635 | $GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT); |
@@ -1642,7 +1641,7 @@ discard block |
||
1642 | 1641 | return strtoupper($GUIDstring); |
1643 | 1642 | } |
1644 | 1643 | |
1645 | - public static function FILETIMEtoUNIXtime($FILETIME, $round=true) { |
|
1644 | + public static function FILETIMEtoUNIXtime($FILETIME, $round = true) { |
|
1646 | 1645 | // FILETIME is a 64-bit unsigned integer representing |
1647 | 1646 | // the number of 100-nanosecond intervals since January 1, 1601 |
1648 | 1647 | // UNIX timestamp is number of seconds since January 1, 1970 |
@@ -1694,12 +1693,12 @@ discard block |
||
1694 | 1693 | $offset = $objectOffset; |
1695 | 1694 | $thisObject = array(); |
1696 | 1695 | |
1697 | - $thisObject['guid'] = substr($asf_header_extension_object_data, $offset, 16); |
|
1696 | + $thisObject['guid'] = substr($asf_header_extension_object_data, $offset, 16); |
|
1698 | 1697 | $offset += 16; |
1699 | 1698 | $thisObject['guid_text'] = $this->BytestringToGUID($thisObject['guid']); |
1700 | 1699 | $thisObject['guid_name'] = $this->GUIDname($thisObject['guid_text']); |
1701 | 1700 | |
1702 | - $thisObject['size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1701 | + $thisObject['size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1703 | 1702 | $offset += 8; |
1704 | 1703 | if ($thisObject['size'] <= 0) { |
1705 | 1704 | break; |
@@ -1707,67 +1706,67 @@ discard block |
||
1707 | 1706 | |
1708 | 1707 | switch ($thisObject['guid']) { |
1709 | 1708 | case GETID3_ASF_Extended_Stream_Properties_Object: |
1710 | - $thisObject['start_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1709 | + $thisObject['start_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1711 | 1710 | $offset += 8; |
1712 | 1711 | $thisObject['start_time_unix'] = $this->FILETIMEtoUNIXtime($thisObject['start_time']); |
1713 | 1712 | |
1714 | - $thisObject['end_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1713 | + $thisObject['end_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1715 | 1714 | $offset += 8; |
1716 | 1715 | $thisObject['end_time_unix'] = $this->FILETIMEtoUNIXtime($thisObject['end_time']); |
1717 | 1716 | |
1718 | - $thisObject['data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1717 | + $thisObject['data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1719 | 1718 | $offset += 4; |
1720 | 1719 | |
1721 | - $thisObject['buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1720 | + $thisObject['buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1722 | 1721 | $offset += 4; |
1723 | 1722 | |
1724 | - $thisObject['initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1723 | + $thisObject['initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1725 | 1724 | $offset += 4; |
1726 | 1725 | |
1727 | - $thisObject['alternate_data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1726 | + $thisObject['alternate_data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1728 | 1727 | $offset += 4; |
1729 | 1728 | |
1730 | - $thisObject['alternate_buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1729 | + $thisObject['alternate_buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1731 | 1730 | $offset += 4; |
1732 | 1731 | |
1733 | - $thisObject['alternate_initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1732 | + $thisObject['alternate_initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1734 | 1733 | $offset += 4; |
1735 | 1734 | |
1736 | - $thisObject['maximum_object_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1735 | + $thisObject['maximum_object_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1737 | 1736 | $offset += 4; |
1738 | 1737 | |
1739 | - $thisObject['flags_raw'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1738 | + $thisObject['flags_raw'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1740 | 1739 | $offset += 4; |
1741 | 1740 | $thisObject['flags']['reliable'] = (bool) $thisObject['flags_raw'] & 0x00000001; |
1742 | 1741 | $thisObject['flags']['seekable'] = (bool) $thisObject['flags_raw'] & 0x00000002; |
1743 | 1742 | $thisObject['flags']['no_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000004; |
1744 | 1743 | $thisObject['flags']['resend_live_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000008; |
1745 | 1744 | |
1746 | - $thisObject['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1745 | + $thisObject['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1747 | 1746 | $offset += 2; |
1748 | 1747 | |
1749 | - $thisObject['stream_language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1748 | + $thisObject['stream_language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1750 | 1749 | $offset += 2; |
1751 | 1750 | |
1752 | - $thisObject['average_time_per_frame'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1751 | + $thisObject['average_time_per_frame'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1753 | 1752 | $offset += 4; |
1754 | 1753 | |
1755 | - $thisObject['stream_name_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1754 | + $thisObject['stream_name_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1756 | 1755 | $offset += 2; |
1757 | 1756 | |
1758 | - $thisObject['payload_extension_system_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1757 | + $thisObject['payload_extension_system_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1759 | 1758 | $offset += 2; |
1760 | 1759 | |
1761 | 1760 | for ($i = 0; $i < $thisObject['stream_name_count']; $i++) { |
1762 | 1761 | $streamName = array(); |
1763 | 1762 | |
1764 | - $streamName['language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1763 | + $streamName['language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1765 | 1764 | $offset += 2; |
1766 | 1765 | |
1767 | - $streamName['stream_name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1766 | + $streamName['stream_name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1768 | 1767 | $offset += 2; |
1769 | 1768 | |
1770 | - $streamName['stream_name'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $streamName['stream_name_length'])); |
|
1769 | + $streamName['stream_name'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $streamName['stream_name_length'])); |
|
1771 | 1770 | $offset += $streamName['stream_name_length']; |
1772 | 1771 | |
1773 | 1772 | $thisObject['stream_names'][$i] = $streamName; |
@@ -1776,20 +1775,20 @@ discard block |
||
1776 | 1775 | for ($i = 0; $i < $thisObject['payload_extension_system_count']; $i++) { |
1777 | 1776 | $payloadExtensionSystem = array(); |
1778 | 1777 | |
1779 | - $payloadExtensionSystem['extension_system_id'] = substr($asf_header_extension_object_data, $offset, 16); |
|
1778 | + $payloadExtensionSystem['extension_system_id'] = substr($asf_header_extension_object_data, $offset, 16); |
|
1780 | 1779 | $offset += 16; |
1781 | 1780 | $payloadExtensionSystem['extension_system_id_text'] = $this->BytestringToGUID($payloadExtensionSystem['extension_system_id']); |
1782 | 1781 | |
1783 | - $payloadExtensionSystem['extension_system_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1782 | + $payloadExtensionSystem['extension_system_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1784 | 1783 | $offset += 2; |
1785 | 1784 | if ($payloadExtensionSystem['extension_system_size'] <= 0) { |
1786 | 1785 | break 2; |
1787 | 1786 | } |
1788 | 1787 | |
1789 | - $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1788 | + $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1790 | 1789 | $offset += 4; |
1791 | 1790 | |
1792 | - $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $payloadExtensionSystem['extension_system_info_length'])); |
|
1791 | + $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $payloadExtensionSystem['extension_system_info_length'])); |
|
1793 | 1792 | $offset += $payloadExtensionSystem['extension_system_info_length']; |
1794 | 1793 | |
1795 | 1794 | $thisObject['payload_extension_systems'][$i] = $payloadExtensionSystem; |
@@ -1802,32 +1801,32 @@ discard block |
||
1802 | 1801 | break; |
1803 | 1802 | |
1804 | 1803 | case GETID3_ASF_Metadata_Object: |
1805 | - $thisObject['description_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1804 | + $thisObject['description_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1806 | 1805 | $offset += 2; |
1807 | 1806 | |
1808 | 1807 | for ($i = 0; $i < $thisObject['description_record_counts']; $i++) { |
1809 | 1808 | $descriptionRecord = array(); |
1810 | 1809 | |
1811 | - $descriptionRecord['reserved_1'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); // must be zero |
|
1810 | + $descriptionRecord['reserved_1'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); // must be zero |
|
1812 | 1811 | $offset += 2; |
1813 | 1812 | |
1814 | - $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1813 | + $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1815 | 1814 | $offset += 2; |
1816 | 1815 | |
1817 | - $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1816 | + $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1818 | 1817 | $offset += 2; |
1819 | 1818 | |
1820 | - $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1819 | + $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1821 | 1820 | $offset += 2; |
1822 | 1821 | $descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']); |
1823 | 1822 | |
1824 | - $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1823 | + $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1825 | 1824 | $offset += 4; |
1826 | 1825 | |
1827 | - $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); |
|
1826 | + $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); |
|
1828 | 1827 | $offset += $descriptionRecord['name_length']; |
1829 | 1828 | |
1830 | - $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); |
|
1829 | + $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); |
|
1831 | 1830 | $offset += $descriptionRecord['data_length']; |
1832 | 1831 | switch ($descriptionRecord['data_type']) { |
1833 | 1832 | case 0x0000: // Unicode string |
@@ -1857,16 +1856,16 @@ discard block |
||
1857 | 1856 | break; |
1858 | 1857 | |
1859 | 1858 | case GETID3_ASF_Language_List_Object: |
1860 | - $thisObject['language_id_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1859 | + $thisObject['language_id_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1861 | 1860 | $offset += 2; |
1862 | 1861 | |
1863 | 1862 | for ($i = 0; $i < $thisObject['language_id_record_counts']; $i++) { |
1864 | 1863 | $languageIDrecord = array(); |
1865 | 1864 | |
1866 | - $languageIDrecord['language_id_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1)); |
|
1865 | + $languageIDrecord['language_id_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1)); |
|
1867 | 1866 | $offset += 1; |
1868 | 1867 | |
1869 | - $languageIDrecord['language_id'] = substr($asf_header_extension_object_data, $offset, $languageIDrecord['language_id_length']); |
|
1868 | + $languageIDrecord['language_id'] = substr($asf_header_extension_object_data, $offset, $languageIDrecord['language_id_length']); |
|
1870 | 1869 | $offset += $languageIDrecord['language_id_length']; |
1871 | 1870 | |
1872 | 1871 | $thisObject['language_id_record'][$i] = $languageIDrecord; |
@@ -1874,32 +1873,32 @@ discard block |
||
1874 | 1873 | break; |
1875 | 1874 | |
1876 | 1875 | case GETID3_ASF_Metadata_Library_Object: |
1877 | - $thisObject['description_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1876 | + $thisObject['description_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1878 | 1877 | $offset += 2; |
1879 | 1878 | |
1880 | 1879 | for ($i = 0; $i < $thisObject['description_records_count']; $i++) { |
1881 | 1880 | $descriptionRecord = array(); |
1882 | 1881 | |
1883 | - $descriptionRecord['language_list_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1882 | + $descriptionRecord['language_list_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1884 | 1883 | $offset += 2; |
1885 | 1884 | |
1886 | - $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1885 | + $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1887 | 1886 | $offset += 2; |
1888 | 1887 | |
1889 | - $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1888 | + $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1890 | 1889 | $offset += 2; |
1891 | 1890 | |
1892 | - $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1891 | + $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1893 | 1892 | $offset += 2; |
1894 | 1893 | $descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']); |
1895 | 1894 | |
1896 | - $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1895 | + $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1897 | 1896 | $offset += 4; |
1898 | 1897 | |
1899 | - $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); |
|
1898 | + $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); |
|
1900 | 1899 | $offset += $descriptionRecord['name_length']; |
1901 | 1900 | |
1902 | - $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); |
|
1901 | + $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); |
|
1903 | 1902 | $offset += $descriptionRecord['data_length']; |
1904 | 1903 | |
1905 | 1904 | if (preg_match('#^WM/Picture$#', str_replace("\x00", '', trim($descriptionRecord['name'])))) { |
@@ -1934,12 +1933,12 @@ discard block |
||
1934 | 1933 | public static function metadataLibraryObjectDataTypeLookup($id) { |
1935 | 1934 | static $lookup = array( |
1936 | 1935 | 0x0000 => 'Unicode string', // The data consists of a sequence of Unicode characters |
1937 | - 0x0001 => 'BYTE array', // The type of the data is implementation-specific |
|
1938 | - 0x0002 => 'BOOL', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values |
|
1939 | - 0x0003 => 'DWORD', // The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer |
|
1940 | - 0x0004 => 'QWORD', // The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer |
|
1941 | - 0x0005 => 'WORD', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer |
|
1942 | - 0x0006 => 'GUID', // The data is 16 bytes long and should be interpreted as a 128-bit GUID |
|
1936 | + 0x0001 => 'BYTE array', // The type of the data is implementation-specific |
|
1937 | + 0x0002 => 'BOOL', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values |
|
1938 | + 0x0003 => 'DWORD', // The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer |
|
1939 | + 0x0004 => 'QWORD', // The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer |
|
1940 | + 0x0005 => 'WORD', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer |
|
1941 | + 0x0006 => 'GUID', // The data is 16 bytes long and should be interpreted as a 128-bit GUID |
|
1943 | 1942 | ); |
1944 | 1943 | return (isset($lookup[$id]) ? $lookup[$id] : 'invalid'); |
1945 | 1944 | } |
@@ -1983,10 +1982,10 @@ discard block |
||
1983 | 1982 | $WMpicture['image_mime'] = ''; |
1984 | 1983 | $imagechunkcheck = getid3_lib::GetDataImageSize($WMpicture['data'], $imageinfo); |
1985 | 1984 | unset($imageinfo); |
1986 | - if (!empty($imagechunkcheck)) { |
|
1985 | + if ( ! empty($imagechunkcheck)) { |
|
1987 | 1986 | $WMpicture['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]); |
1988 | 1987 | } |
1989 | - if (!isset($this->getid3->info['asf']['comments']['picture'])) { |
|
1988 | + if ( ! isset($this->getid3->info['asf']['comments']['picture'])) { |
|
1990 | 1989 | $this->getid3->info['asf']['comments']['picture'] = array(); |
1991 | 1990 | } |
1992 | 1991 | $this->getid3->info['asf']['comments']['picture'][] = array('data'=>$WMpicture['data'], 'image_mime'=>$WMpicture['image_mime']); |
@@ -390,6 +390,9 @@ discard block |
||
390 | 390 | public $bytes; |
391 | 391 | public $pos; |
392 | 392 | |
393 | + /** |
|
394 | + * @param string $bytes |
|
395 | + */ |
|
393 | 396 | public function __construct(&$bytes) { |
394 | 397 | $this->bytes =& $bytes; |
395 | 398 | $this->pos = 0; |
@@ -473,6 +476,9 @@ discard block |
||
473 | 476 | class AMFReader { |
474 | 477 | public $stream; |
475 | 478 | |
479 | + /** |
|
480 | + * @param AMFStream $stream |
|
481 | + */ |
|
476 | 482 | public function __construct(&$stream) { |
477 | 483 | $this->stream =& $stream; |
478 | 484 | } |
@@ -635,6 +641,9 @@ discard block |
||
635 | 641 | public $width; |
636 | 642 | public $height; |
637 | 643 | |
644 | + /** |
|
645 | + * @param string $sps |
|
646 | + */ |
|
638 | 647 | public function __construct($sps) { |
639 | 648 | $this->sps = $sps; |
640 | 649 | } |
@@ -691,6 +700,9 @@ discard block |
||
691 | 700 | } |
692 | 701 | } |
693 | 702 | |
703 | + /** |
|
704 | + * @param integer $bits |
|
705 | + */ |
|
694 | 706 | public function skipBits($bits) { |
695 | 707 | $newBits = $this->currentBits + $bits; |
696 | 708 | $this->currentBytes += (int)floor($newBits / 8); |
@@ -703,6 +715,9 @@ discard block |
||
703 | 715 | return $result; |
704 | 716 | } |
705 | 717 | |
718 | + /** |
|
719 | + * @param integer $bits |
|
720 | + */ |
|
706 | 721 | public function getBits($bits) { |
707 | 722 | $result = 0; |
708 | 723 | for ($i = 0; $i < $bits; $i++) { |
@@ -52,25 +52,25 @@ discard block |
||
52 | 52 | // /// |
53 | 53 | ///////////////////////////////////////////////////////////////// |
54 | 54 | |
55 | -define('GETID3_FLV_TAG_AUDIO', 8); |
|
56 | -define('GETID3_FLV_TAG_VIDEO', 9); |
|
57 | -define('GETID3_FLV_TAG_META', 18); |
|
55 | +define('GETID3_FLV_TAG_AUDIO', 8); |
|
56 | +define('GETID3_FLV_TAG_VIDEO', 9); |
|
57 | +define('GETID3_FLV_TAG_META', 18); |
|
58 | 58 | |
59 | -define('GETID3_FLV_VIDEO_H263', 2); |
|
60 | -define('GETID3_FLV_VIDEO_SCREEN', 3); |
|
61 | -define('GETID3_FLV_VIDEO_VP6FLV', 4); |
|
59 | +define('GETID3_FLV_VIDEO_H263', 2); |
|
60 | +define('GETID3_FLV_VIDEO_SCREEN', 3); |
|
61 | +define('GETID3_FLV_VIDEO_VP6FLV', 4); |
|
62 | 62 | define('GETID3_FLV_VIDEO_VP6FLV_ALPHA', 5); |
63 | -define('GETID3_FLV_VIDEO_SCREENV2', 6); |
|
64 | -define('GETID3_FLV_VIDEO_H264', 7); |
|
65 | - |
|
66 | -define('H264_AVC_SEQUENCE_HEADER', 0); |
|
67 | -define('H264_PROFILE_BASELINE', 66); |
|
68 | -define('H264_PROFILE_MAIN', 77); |
|
69 | -define('H264_PROFILE_EXTENDED', 88); |
|
70 | -define('H264_PROFILE_HIGH', 100); |
|
71 | -define('H264_PROFILE_HIGH10', 110); |
|
72 | -define('H264_PROFILE_HIGH422', 122); |
|
73 | -define('H264_PROFILE_HIGH444', 144); |
|
63 | +define('GETID3_FLV_VIDEO_SCREENV2', 6); |
|
64 | +define('GETID3_FLV_VIDEO_H264', 7); |
|
65 | + |
|
66 | +define('H264_AVC_SEQUENCE_HEADER', 0); |
|
67 | +define('H264_PROFILE_BASELINE', 66); |
|
68 | +define('H264_PROFILE_MAIN', 77); |
|
69 | +define('H264_PROFILE_EXTENDED', 88); |
|
70 | +define('H264_PROFILE_HIGH', 100); |
|
71 | +define('H264_PROFILE_HIGH10', 110); |
|
72 | +define('H264_PROFILE_HIGH422', 122); |
|
73 | +define('H264_PROFILE_HIGH444', 144); |
|
74 | 74 | define('H264_PROFILE_HIGH444_PREDICTIVE', 244); |
75 | 75 | |
76 | 76 | class getid3_flv extends getid3_handler { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $FLVheader = $this->fread(5); |
89 | 89 | |
90 | 90 | $info['fileformat'] = 'flv'; |
91 | - $info['flv']['header']['signature'] = substr($FLVheader, 0, 3); |
|
91 | + $info['flv']['header']['signature'] = substr($FLVheader, 0, 3); |
|
92 | 92 | $info['flv']['header']['version'] = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1)); |
93 | 93 | $TypeFlags = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1)); |
94 | 94 | |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | $tagParseCount = 0; |
115 | 115 | $info['flv']['framecount'] = array('total'=>0, 'audio'=>0, 'video'=>0); |
116 | 116 | $flv_framecount = &$info['flv']['framecount']; |
117 | - while ((($this->ftell() + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || !$found_valid_meta_playtime)) { |
|
117 | + while ((($this->ftell() + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || ! $found_valid_meta_playtime)) { |
|
118 | 118 | $ThisTagHeader = $this->fread(16); |
119 | 119 | |
120 | - $PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 0, 4)); |
|
121 | - $TagType = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 4, 1)); |
|
122 | - $DataLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 5, 3)); |
|
123 | - $Timestamp = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 8, 3)); |
|
120 | + $PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 0, 4)); |
|
121 | + $TagType = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 4, 1)); |
|
122 | + $DataLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 5, 3)); |
|
123 | + $Timestamp = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 8, 3)); |
|
124 | 124 | $LastHeaderByte = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1)); |
125 | 125 | $NextOffset = $this->ftell() - 1 + $DataLength; |
126 | 126 | if ($Timestamp > $Duration) { |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | switch ($TagType) { |
132 | 132 | case GETID3_FLV_TAG_AUDIO: |
133 | 133 | $flv_framecount['audio']++; |
134 | - if (!$found_audio) { |
|
134 | + if ( ! $found_audio) { |
|
135 | 135 | $found_audio = true; |
136 | 136 | $info['flv']['audio']['audioFormat'] = ($LastHeaderByte >> 4) & 0x0F; |
137 | 137 | $info['flv']['audio']['audioRate'] = ($LastHeaderByte >> 2) & 0x03; |
138 | 138 | $info['flv']['audio']['audioSampleSize'] = ($LastHeaderByte >> 1) & 0x01; |
139 | - $info['flv']['audio']['audioType'] = $LastHeaderByte & 0x01; |
|
139 | + $info['flv']['audio']['audioType'] = $LastHeaderByte & 0x01; |
|
140 | 140 | } |
141 | 141 | break; |
142 | 142 | |
143 | 143 | case GETID3_FLV_TAG_VIDEO: |
144 | 144 | $flv_framecount['video']++; |
145 | - if (!$found_video) { |
|
145 | + if ( ! $found_video) { |
|
146 | 146 | $found_video = true; |
147 | 147 | $info['flv']['video']['videoCodec'] = $LastHeaderByte & 0x07; |
148 | 148 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $AVCPacketType = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 0, 1)); |
155 | 155 | if ($AVCPacketType == H264_AVC_SEQUENCE_HEADER) { |
156 | 156 | // read AVCDecoderConfigurationRecord |
157 | - $configurationVersion = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 1)); |
|
158 | - $AVCProfileIndication = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 1)); |
|
159 | - $profile_compatibility = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 1)); |
|
160 | - $lengthSizeMinusOne = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 1)); |
|
161 | - $numOfSequenceParameterSets = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 8, 1)); |
|
157 | + $configurationVersion = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 1)); |
|
158 | + $AVCProfileIndication = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 1)); |
|
159 | + $profile_compatibility = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 1)); |
|
160 | + $lengthSizeMinusOne = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 1)); |
|
161 | + $numOfSequenceParameterSets = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 8, 1)); |
|
162 | 162 | |
163 | 163 | if (($numOfSequenceParameterSets & 0x1F) != 0) { |
164 | 164 | // there is at least one SequenceParameterSet |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | |
237 | 237 | } |
238 | 238 | |
239 | - } elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_VP6FLV_ALPHA) { |
|
239 | + } elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_VP6FLV_ALPHA) { |
|
240 | 240 | |
241 | 241 | /* contributed by schouwerwouØgmail*com */ |
242 | - if (!isset($info['video']['resolution_x'])) { // only when meta data isn't set |
|
242 | + if ( ! isset($info['video']['resolution_x'])) { // only when meta data isn't set |
|
243 | 243 | $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2)); |
244 | 244 | $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 2)); |
245 | 245 | $info['video']['resolution_x'] = ($PictureSizeEnc['x'] & 0xFF) << 3; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | /* end schouwerwouØgmail*com */ |
249 | 249 | |
250 | 250 | } |
251 | - if (!empty($info['video']['resolution_x']) && !empty($info['video']['resolution_y'])) { |
|
251 | + if ( ! empty($info['video']['resolution_x']) && ! empty($info['video']['resolution_y'])) { |
|
252 | 252 | $info['video']['pixel_aspect_ratio'] = $info['video']['resolution_x'] / $info['video']['resolution_y']; |
253 | 253 | } |
254 | 254 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | // Meta tag |
258 | 258 | case GETID3_FLV_TAG_META: |
259 | - if (!$found_meta) { |
|
259 | + if ( ! $found_meta) { |
|
260 | 260 | $found_meta = true; |
261 | 261 | $this->fseek(-1, SEEK_CUR); |
262 | 262 | $datachunk = $this->fread($DataLength); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
288 | - if (!empty($info['flv']['meta']['onMetaData']['duration'])) { |
|
288 | + if ( ! empty($info['flv']['meta']['onMetaData']['duration'])) { |
|
289 | 289 | $found_valid_meta_playtime = true; |
290 | 290 | } |
291 | 291 | } |
@@ -304,22 +304,22 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | if ($info['flv']['header']['hasAudio']) { |
307 | - $info['audio']['codec'] = self::audioFormatLookup($info['flv']['audio']['audioFormat']); |
|
308 | - $info['audio']['sample_rate'] = self::audioRateLookup($info['flv']['audio']['audioRate']); |
|
307 | + $info['audio']['codec'] = self::audioFormatLookup($info['flv']['audio']['audioFormat']); |
|
308 | + $info['audio']['sample_rate'] = self::audioRateLookup($info['flv']['audio']['audioRate']); |
|
309 | 309 | $info['audio']['bits_per_sample'] = self::audioBitDepthLookup($info['flv']['audio']['audioSampleSize']); |
310 | 310 | |
311 | - $info['audio']['channels'] = $info['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo |
|
311 | + $info['audio']['channels'] = $info['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo |
|
312 | 312 | $info['audio']['lossless'] = ($info['flv']['audio']['audioFormat'] ? false : true); // 0=uncompressed |
313 | 313 | $info['audio']['dataformat'] = 'flv'; |
314 | 314 | } |
315 | - if (!empty($info['flv']['header']['hasVideo'])) { |
|
315 | + if ( ! empty($info['flv']['header']['hasVideo'])) { |
|
316 | 316 | $info['video']['codec'] = self::videoCodecLookup($info['flv']['video']['videoCodec']); |
317 | 317 | $info['video']['dataformat'] = 'flv'; |
318 | 318 | $info['video']['lossless'] = false; |
319 | 319 | } |
320 | 320 | |
321 | 321 | // Set information from meta |
322 | - if (!empty($info['flv']['meta']['onMetaData']['duration'])) { |
|
322 | + if ( ! empty($info['flv']['meta']['onMetaData']['duration'])) { |
|
323 | 323 | $info['playtime_seconds'] = $info['flv']['meta']['onMetaData']['duration']; |
324 | 324 | $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; |
325 | 325 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | public $pos; |
392 | 392 | |
393 | 393 | public function __construct(&$bytes) { |
394 | - $this->bytes =& $bytes; |
|
394 | + $this->bytes = & $bytes; |
|
395 | 395 | $this->pos = 0; |
396 | 396 | } |
397 | 397 | |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | public $stream; |
475 | 475 | |
476 | 476 | public function __construct(&$stream) { |
477 | - $this->stream =& $stream; |
|
477 | + $this->stream = & $stream; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | public function readData() { |
@@ -642,35 +642,35 @@ discard block |
||
642 | 642 | public function readData() { |
643 | 643 | $this->skipBits(8); |
644 | 644 | $this->skipBits(8); |
645 | - $profile = $this->getBits(8); // read profile |
|
645 | + $profile = $this->getBits(8); // read profile |
|
646 | 646 | if ($profile > 0) { |
647 | 647 | $this->skipBits(8); |
648 | - $level_idc = $this->getBits(8); // level_idc |
|
649 | - $this->expGolombUe(); // seq_parameter_set_id // sps |
|
650 | - $this->expGolombUe(); // log2_max_frame_num_minus4 |
|
651 | - $picOrderType = $this->expGolombUe(); // pic_order_cnt_type |
|
648 | + $level_idc = $this->getBits(8); // level_idc |
|
649 | + $this->expGolombUe(); // seq_parameter_set_id // sps |
|
650 | + $this->expGolombUe(); // log2_max_frame_num_minus4 |
|
651 | + $picOrderType = $this->expGolombUe(); // pic_order_cnt_type |
|
652 | 652 | if ($picOrderType == 0) { |
653 | - $this->expGolombUe(); // log2_max_pic_order_cnt_lsb_minus4 |
|
653 | + $this->expGolombUe(); // log2_max_pic_order_cnt_lsb_minus4 |
|
654 | 654 | } elseif ($picOrderType == 1) { |
655 | - $this->skipBits(1); // delta_pic_order_always_zero_flag |
|
656 | - $this->expGolombSe(); // offset_for_non_ref_pic |
|
657 | - $this->expGolombSe(); // offset_for_top_to_bottom_field |
|
655 | + $this->skipBits(1); // delta_pic_order_always_zero_flag |
|
656 | + $this->expGolombSe(); // offset_for_non_ref_pic |
|
657 | + $this->expGolombSe(); // offset_for_top_to_bottom_field |
|
658 | 658 | $num_ref_frames_in_pic_order_cnt_cycle = $this->expGolombUe(); // num_ref_frames_in_pic_order_cnt_cycle |
659 | 659 | for ($i = 0; $i < $num_ref_frames_in_pic_order_cnt_cycle; $i++) { |
660 | - $this->expGolombSe(); // offset_for_ref_frame[ i ] |
|
660 | + $this->expGolombSe(); // offset_for_ref_frame[ i ] |
|
661 | 661 | } |
662 | 662 | } |
663 | - $this->expGolombUe(); // num_ref_frames |
|
664 | - $this->skipBits(1); // gaps_in_frame_num_value_allowed_flag |
|
665 | - $pic_width_in_mbs_minus1 = $this->expGolombUe(); // pic_width_in_mbs_minus1 |
|
663 | + $this->expGolombUe(); // num_ref_frames |
|
664 | + $this->skipBits(1); // gaps_in_frame_num_value_allowed_flag |
|
665 | + $pic_width_in_mbs_minus1 = $this->expGolombUe(); // pic_width_in_mbs_minus1 |
|
666 | 666 | $pic_height_in_map_units_minus1 = $this->expGolombUe(); // pic_height_in_map_units_minus1 |
667 | 667 | |
668 | - $frame_mbs_only_flag = $this->getBits(1); // frame_mbs_only_flag |
|
668 | + $frame_mbs_only_flag = $this->getBits(1); // frame_mbs_only_flag |
|
669 | 669 | if ($frame_mbs_only_flag == 0) { |
670 | - $this->skipBits(1); // mb_adaptive_frame_field_flag |
|
670 | + $this->skipBits(1); // mb_adaptive_frame_field_flag |
|
671 | 671 | } |
672 | - $this->skipBits(1); // direct_8x8_inference_flag |
|
673 | - $frame_cropping_flag = $this->getBits(1); // frame_cropping_flag |
|
672 | + $this->skipBits(1); // direct_8x8_inference_flag |
|
673 | + $frame_cropping_flag = $this->getBits(1); // frame_cropping_flag |
|
674 | 674 | |
675 | 675 | $frame_crop_left_offset = 0; |
676 | 676 | $frame_crop_right_offset = 0; |
@@ -678,12 +678,12 @@ discard block |
||
678 | 678 | $frame_crop_bottom_offset = 0; |
679 | 679 | |
680 | 680 | if ($frame_cropping_flag) { |
681 | - $frame_crop_left_offset = $this->expGolombUe(); // frame_crop_left_offset |
|
682 | - $frame_crop_right_offset = $this->expGolombUe(); // frame_crop_right_offset |
|
683 | - $frame_crop_top_offset = $this->expGolombUe(); // frame_crop_top_offset |
|
684 | - $frame_crop_bottom_offset = $this->expGolombUe(); // frame_crop_bottom_offset |
|
681 | + $frame_crop_left_offset = $this->expGolombUe(); // frame_crop_left_offset |
|
682 | + $frame_crop_right_offset = $this->expGolombUe(); // frame_crop_right_offset |
|
683 | + $frame_crop_top_offset = $this->expGolombUe(); // frame_crop_top_offset |
|
684 | + $frame_crop_bottom_offset = $this->expGolombUe(); // frame_crop_bottom_offset |
|
685 | 685 | } |
686 | - $this->skipBits(1); // vui_parameters_present_flag |
|
686 | + $this->skipBits(1); // vui_parameters_present_flag |
|
687 | 687 | // etc |
688 | 688 | |
689 | 689 | $this->width = (($pic_width_in_mbs_minus1 + 1) * 16) - ($frame_crop_left_offset * 2) - ($frame_crop_right_offset * 2); |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | |
694 | 694 | public function skipBits($bits) { |
695 | 695 | $newBits = $this->currentBits + $bits; |
696 | - $this->currentBytes += (int)floor($newBits / 8); |
|
696 | + $this->currentBytes += (int) floor($newBits / 8); |
|
697 | 697 | $this->currentBits = $newBits % 8; |
698 | 698 | } |
699 | 699 |
@@ -1289,6 +1289,10 @@ discard block |
||
1289 | 1289 | return true; |
1290 | 1290 | } |
1291 | 1291 | |
1292 | + /** |
|
1293 | + * @param string $type |
|
1294 | + * @param integer $line |
|
1295 | + */ |
|
1292 | 1296 | private function unhandledElement($type, $line, $element) { |
1293 | 1297 | // warn only about unknown and missed elements, not about unuseful |
1294 | 1298 | if (!in_array($element['id'], $this->unuseful_elements)) { |
@@ -1345,6 +1349,9 @@ discard block |
||
1345 | 1349 | return $simpletag_entry; |
1346 | 1350 | } |
1347 | 1351 | |
1352 | + /** |
|
1353 | + * @param integer $block_type |
|
1354 | + */ |
|
1348 | 1355 | private function HandleEMBLClusterBlock($element, $block_type, &$info) { |
1349 | 1356 | // http://www.matroska.org/technical/specs/index.html#block_structure |
1350 | 1357 | // http://www.matroska.org/technical/specs/index.html#simpleblock_structure |
@@ -15,196 +15,196 @@ discard block |
||
15 | 15 | ///////////////////////////////////////////////////////////////// |
16 | 16 | |
17 | 17 | |
18 | -define('EBML_ID_CHAPTERS', 0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation. |
|
19 | -define('EBML_ID_SEEKHEAD', 0x014D9B74); // [11][4D][9B][74] -- Contains the position of other level 1 elements. |
|
20 | -define('EBML_ID_TAGS', 0x0254C367); // [12][54][C3][67] -- Element containing elements specific to Tracks/Chapters. A list of valid tags can be found <http://www.matroska.org/technical/specs/tagging/index.html>. |
|
21 | -define('EBML_ID_INFO', 0x0549A966); // [15][49][A9][66] -- Contains miscellaneous general information and statistics on the file. |
|
22 | -define('EBML_ID_TRACKS', 0x0654AE6B); // [16][54][AE][6B] -- A top-level block of information with many tracks described. |
|
23 | -define('EBML_ID_SEGMENT', 0x08538067); // [18][53][80][67] -- This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment. |
|
24 | -define('EBML_ID_ATTACHMENTS', 0x0941A469); // [19][41][A4][69] -- Contain attached files. |
|
25 | -define('EBML_ID_EBML', 0x0A45DFA3); // [1A][45][DF][A3] -- Set the EBML characteristics of the data to follow. Each EBML document has to start with this. |
|
26 | -define('EBML_ID_CUES', 0x0C53BB6B); // [1C][53][BB][6B] -- A top-level element to speed seeking access. All entries are local to the segment. |
|
27 | -define('EBML_ID_CLUSTER', 0x0F43B675); // [1F][43][B6][75] -- The lower level element containing the (monolithic) Block structure. |
|
28 | -define('EBML_ID_LANGUAGE', 0x02B59C); // [22][B5][9C] -- Specifies the language of the track in the Matroska languages form. |
|
29 | -define('EBML_ID_TRACKTIMECODESCALE', 0x03314F); // [23][31][4F] -- The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs). |
|
30 | -define('EBML_ID_DEFAULTDURATION', 0x03E383); // [23][E3][83] -- Number of nanoseconds (i.e. not scaled) per frame. |
|
31 | -define('EBML_ID_CODECNAME', 0x058688); // [25][86][88] -- A human-readable string specifying the codec. |
|
32 | -define('EBML_ID_CODECDOWNLOADURL', 0x06B240); // [26][B2][40] -- A URL to download about the codec used. |
|
33 | -define('EBML_ID_TIMECODESCALE', 0x0AD7B1); // [2A][D7][B1] -- Timecode scale in nanoseconds (1.000.000 means all timecodes in the segment are expressed in milliseconds). |
|
34 | -define('EBML_ID_COLOURSPACE', 0x0EB524); // [2E][B5][24] -- Same value as in AVI (32 bits). |
|
35 | -define('EBML_ID_GAMMAVALUE', 0x0FB523); // [2F][B5][23] -- Gamma Value. |
|
36 | -define('EBML_ID_CODECSETTINGS', 0x1A9697); // [3A][96][97] -- A string describing the encoding setting used. |
|
37 | -define('EBML_ID_CODECINFOURL', 0x1B4040); // [3B][40][40] -- A URL to find information about the codec used. |
|
38 | -define('EBML_ID_PREVFILENAME', 0x1C83AB); // [3C][83][AB] -- An escaped filename corresponding to the previous segment. |
|
39 | -define('EBML_ID_PREVUID', 0x1CB923); // [3C][B9][23] -- A unique ID to identify the previous chained segment (128 bits). |
|
40 | -define('EBML_ID_NEXTFILENAME', 0x1E83BB); // [3E][83][BB] -- An escaped filename corresponding to the next segment. |
|
41 | -define('EBML_ID_NEXTUID', 0x1EB923); // [3E][B9][23] -- A unique ID to identify the next chained segment (128 bits). |
|
42 | -define('EBML_ID_CONTENTCOMPALGO', 0x0254); // [42][54] -- The compression algorithm used. Algorithms that have been specified so far are: |
|
43 | -define('EBML_ID_CONTENTCOMPSETTINGS', 0x0255); // [42][55] -- Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track. |
|
44 | -define('EBML_ID_DOCTYPE', 0x0282); // [42][82] -- A string that describes the type of document that follows this EBML header ('matroska' in our case). |
|
45 | -define('EBML_ID_DOCTYPEREADVERSION', 0x0285); // [42][85] -- The minimum DocType version an interpreter has to support to read this file. |
|
46 | -define('EBML_ID_EBMLVERSION', 0x0286); // [42][86] -- The version of EBML parser used to create the file. |
|
47 | -define('EBML_ID_DOCTYPEVERSION', 0x0287); // [42][87] -- The version of DocType interpreter used to create the file. |
|
48 | -define('EBML_ID_EBMLMAXIDLENGTH', 0x02F2); // [42][F2] -- The maximum length of the IDs you'll find in this file (4 or less in Matroska). |
|
49 | -define('EBML_ID_EBMLMAXSIZELENGTH', 0x02F3); // [42][F3] -- The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid. |
|
50 | -define('EBML_ID_EBMLREADVERSION', 0x02F7); // [42][F7] -- The minimum EBML version a parser has to support to read this file. |
|
51 | -define('EBML_ID_CHAPLANGUAGE', 0x037C); // [43][7C] -- The languages corresponding to the string, in the bibliographic ISO-639-2 form. |
|
52 | -define('EBML_ID_CHAPCOUNTRY', 0x037E); // [43][7E] -- The countries corresponding to the string, same 2 octets as in Internet domains. |
|
53 | -define('EBML_ID_SEGMENTFAMILY', 0x0444); // [44][44] -- A randomly generated unique ID that all segments related to each other must use (128 bits). |
|
54 | -define('EBML_ID_DATEUTC', 0x0461); // [44][61] -- Date of the origin of timecode (value 0), i.e. production date. |
|
55 | -define('EBML_ID_TAGLANGUAGE', 0x047A); // [44][7A] -- Specifies the language of the tag specified, in the Matroska languages form. |
|
56 | -define('EBML_ID_TAGDEFAULT', 0x0484); // [44][84] -- Indication to know if this is the default/original language to use for the given tag. |
|
57 | -define('EBML_ID_TAGBINARY', 0x0485); // [44][85] -- The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString. |
|
58 | -define('EBML_ID_TAGSTRING', 0x0487); // [44][87] -- The value of the Tag. |
|
59 | -define('EBML_ID_DURATION', 0x0489); // [44][89] -- Duration of the segment (based on TimecodeScale). |
|
60 | -define('EBML_ID_CHAPPROCESSPRIVATE', 0x050D); // [45][0D] -- Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent. |
|
61 | -define('EBML_ID_CHAPTERFLAGENABLED', 0x0598); // [45][98] -- Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter. |
|
62 | -define('EBML_ID_TAGNAME', 0x05A3); // [45][A3] -- The name of the Tag that is going to be stored. |
|
63 | -define('EBML_ID_EDITIONENTRY', 0x05B9); // [45][B9] -- Contains all information about a segment edition. |
|
64 | -define('EBML_ID_EDITIONUID', 0x05BC); // [45][BC] -- A unique ID to identify the edition. It's useful for tagging an edition. |
|
65 | -define('EBML_ID_EDITIONFLAGHIDDEN', 0x05BD); // [45][BD] -- If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
66 | -define('EBML_ID_EDITIONFLAGDEFAULT', 0x05DB); // [45][DB] -- If a flag is set (1) the edition should be used as the default one. |
|
67 | -define('EBML_ID_EDITIONFLAGORDERED', 0x05DD); // [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced. |
|
68 | -define('EBML_ID_FILEDATA', 0x065C); // [46][5C] -- The data of the file. |
|
69 | -define('EBML_ID_FILEMIMETYPE', 0x0660); // [46][60] -- MIME type of the file. |
|
70 | -define('EBML_ID_FILENAME', 0x066E); // [46][6E] -- Filename of the attached file. |
|
71 | -define('EBML_ID_FILEREFERRAL', 0x0675); // [46][75] -- A binary value that a track/codec can refer to when the attachment is needed. |
|
72 | -define('EBML_ID_FILEDESCRIPTION', 0x067E); // [46][7E] -- A human-friendly name for the attached file. |
|
73 | -define('EBML_ID_FILEUID', 0x06AE); // [46][AE] -- Unique ID representing the file, as random as possible. |
|
74 | -define('EBML_ID_CONTENTENCALGO', 0x07E1); // [47][E1] -- The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: |
|
75 | -define('EBML_ID_CONTENTENCKEYID', 0x07E2); // [47][E2] -- For public key algorithms this is the ID of the public key the the data was encrypted with. |
|
76 | -define('EBML_ID_CONTENTSIGNATURE', 0x07E3); // [47][E3] -- A cryptographic signature of the contents. |
|
77 | -define('EBML_ID_CONTENTSIGKEYID', 0x07E4); // [47][E4] -- This is the ID of the private key the data was signed with. |
|
78 | -define('EBML_ID_CONTENTSIGALGO', 0x07E5); // [47][E5] -- The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
79 | -define('EBML_ID_CONTENTSIGHASHALGO', 0x07E6); // [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
80 | -define('EBML_ID_MUXINGAPP', 0x0D80); // [4D][80] -- Muxing application or library ("libmatroska-0.4.3"). |
|
81 | -define('EBML_ID_SEEK', 0x0DBB); // [4D][BB] -- Contains a single seek entry to an EBML element. |
|
82 | -define('EBML_ID_CONTENTENCODINGORDER', 0x1031); // [50][31] -- Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment. |
|
83 | -define('EBML_ID_CONTENTENCODINGSCOPE', 0x1032); // [50][32] -- A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: |
|
84 | -define('EBML_ID_CONTENTENCODINGTYPE', 0x1033); // [50][33] -- A value describing what kind of transformation has been done. Possible values: |
|
85 | -define('EBML_ID_CONTENTCOMPRESSION', 0x1034); // [50][34] -- Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking. |
|
86 | -define('EBML_ID_CONTENTENCRYPTION', 0x1035); // [50][35] -- Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise. |
|
87 | -define('EBML_ID_CUEREFNUMBER', 0x135F); // [53][5F] -- Number of the referenced Block of Track X in the specified Cluster. |
|
88 | -define('EBML_ID_NAME', 0x136E); // [53][6E] -- A human-readable track name. |
|
89 | -define('EBML_ID_CUEBLOCKNUMBER', 0x1378); // [53][78] -- Number of the Block in the specified Cluster. |
|
90 | -define('EBML_ID_TRACKOFFSET', 0x137F); // [53][7F] -- A value to add to the Block's Timecode. This can be used to adjust the playback offset of a track. |
|
91 | -define('EBML_ID_SEEKID', 0x13AB); // [53][AB] -- The binary ID corresponding to the element name. |
|
92 | -define('EBML_ID_SEEKPOSITION', 0x13AC); // [53][AC] -- The position of the element in the segment in octets (0 = first level 1 element). |
|
93 | -define('EBML_ID_STEREOMODE', 0x13B8); // [53][B8] -- Stereo-3D video mode. |
|
94 | -define('EBML_ID_OLDSTEREOMODE', 0x13B9); // [53][B9] -- Bogus StereoMode value used in old versions of libmatroska. DO NOT USE. (0: mono, 1: right eye, 2: left eye, 3: both eyes). |
|
95 | -define('EBML_ID_PIXELCROPBOTTOM', 0x14AA); // [54][AA] -- The number of video pixels to remove at the bottom of the image (for HDTV content). |
|
96 | -define('EBML_ID_DISPLAYWIDTH', 0x14B0); // [54][B0] -- Width of the video frames to display. |
|
97 | -define('EBML_ID_DISPLAYUNIT', 0x14B2); // [54][B2] -- Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches). |
|
98 | -define('EBML_ID_ASPECTRATIOTYPE', 0x14B3); // [54][B3] -- Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed). |
|
99 | -define('EBML_ID_DISPLAYHEIGHT', 0x14BA); // [54][BA] -- Height of the video frames to display. |
|
100 | -define('EBML_ID_PIXELCROPTOP', 0x14BB); // [54][BB] -- The number of video pixels to remove at the top of the image. |
|
101 | -define('EBML_ID_PIXELCROPLEFT', 0x14CC); // [54][CC] -- The number of video pixels to remove on the left of the image. |
|
102 | -define('EBML_ID_PIXELCROPRIGHT', 0x14DD); // [54][DD] -- The number of video pixels to remove on the right of the image. |
|
103 | -define('EBML_ID_FLAGFORCED', 0x15AA); // [55][AA] -- Set if that track MUST be used during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. |
|
104 | -define('EBML_ID_MAXBLOCKADDITIONID', 0x15EE); // [55][EE] -- The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track. |
|
105 | -define('EBML_ID_WRITINGAPP', 0x1741); // [57][41] -- Writing application ("mkvmerge-0.3.3"). |
|
106 | -define('EBML_ID_CLUSTERSILENTTRACKS', 0x1854); // [58][54] -- The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use. |
|
107 | -define('EBML_ID_CLUSTERSILENTTRACKNUMBER', 0x18D7); // [58][D7] -- One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster. |
|
108 | -define('EBML_ID_ATTACHEDFILE', 0x21A7); // [61][A7] -- An attached file. |
|
109 | -define('EBML_ID_CONTENTENCODING', 0x2240); // [62][40] -- Settings for one content encoding like compression or encryption. |
|
110 | -define('EBML_ID_BITDEPTH', 0x2264); // [62][64] -- Bits per sample, mostly used for PCM. |
|
111 | -define('EBML_ID_CODECPRIVATE', 0x23A2); // [63][A2] -- Private data only known to the codec. |
|
112 | -define('EBML_ID_TARGETS', 0x23C0); // [63][C0] -- Contain all UIDs where the specified meta data apply. It is void to describe everything in the segment. |
|
113 | -define('EBML_ID_CHAPTERPHYSICALEQUIV', 0x23C3); // [63][C3] -- Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values. |
|
114 | -define('EBML_ID_TAGCHAPTERUID', 0x23C4); // [63][C4] -- A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment. |
|
115 | -define('EBML_ID_TAGTRACKUID', 0x23C5); // [63][C5] -- A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment. |
|
116 | -define('EBML_ID_TAGATTACHMENTUID', 0x23C6); // [63][C6] -- A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment. |
|
117 | -define('EBML_ID_TAGEDITIONUID', 0x23C9); // [63][C9] -- A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment. |
|
118 | -define('EBML_ID_TARGETTYPE', 0x23CA); // [63][CA] -- An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType). |
|
119 | -define('EBML_ID_TRACKTRANSLATE', 0x2624); // [66][24] -- The track identification for the given Chapter Codec. |
|
120 | -define('EBML_ID_TRACKTRANSLATETRACKID', 0x26A5); // [66][A5] -- The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
121 | -define('EBML_ID_TRACKTRANSLATECODEC', 0x26BF); // [66][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
122 | -define('EBML_ID_TRACKTRANSLATEEDITIONUID', 0x26FC); // [66][FC] -- Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment. |
|
123 | -define('EBML_ID_SIMPLETAG', 0x27C8); // [67][C8] -- Contains general information about the target. |
|
124 | -define('EBML_ID_TARGETTYPEVALUE', 0x28CA); // [68][CA] -- A number to indicate the logical level of the target (see TargetType). |
|
125 | -define('EBML_ID_CHAPPROCESSCOMMAND', 0x2911); // [69][11] -- Contains all the commands associated to the Atom. |
|
126 | -define('EBML_ID_CHAPPROCESSTIME', 0x2922); // [69][22] -- Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter). |
|
127 | -define('EBML_ID_CHAPTERTRANSLATE', 0x2924); // [69][24] -- A tuple of corresponding ID used by chapter codecs to represent this segment. |
|
128 | -define('EBML_ID_CHAPPROCESSDATA', 0x2933); // [69][33] -- Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands. |
|
129 | -define('EBML_ID_CHAPPROCESS', 0x2944); // [69][44] -- Contains all the commands associated to the Atom. |
|
130 | -define('EBML_ID_CHAPPROCESSCODECID', 0x2955); // [69][55] -- Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later. |
|
131 | -define('EBML_ID_CHAPTERTRANSLATEID', 0x29A5); // [69][A5] -- The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
132 | -define('EBML_ID_CHAPTERTRANSLATECODEC', 0x29BF); // [69][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
133 | -define('EBML_ID_CHAPTERTRANSLATEEDITIONUID', 0x29FC); // [69][FC] -- Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment. |
|
134 | -define('EBML_ID_CONTENTENCODINGS', 0x2D80); // [6D][80] -- Settings for several content encoding mechanisms like compression or encryption. |
|
135 | -define('EBML_ID_MINCACHE', 0x2DE7); // [6D][E7] -- The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used. |
|
136 | -define('EBML_ID_MAXCACHE', 0x2DF8); // [6D][F8] -- The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed. |
|
137 | -define('EBML_ID_CHAPTERSEGMENTUID', 0x2E67); // [6E][67] -- A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used. |
|
138 | -define('EBML_ID_CHAPTERSEGMENTEDITIONUID', 0x2EBC); // [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID. |
|
139 | -define('EBML_ID_TRACKOVERLAY', 0x2FAB); // [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc. |
|
140 | -define('EBML_ID_TAG', 0x3373); // [73][73] -- Element containing elements specific to Tracks/Chapters. |
|
141 | -define('EBML_ID_SEGMENTFILENAME', 0x3384); // [73][84] -- A filename corresponding to this segment. |
|
142 | -define('EBML_ID_SEGMENTUID', 0x33A4); // [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits). |
|
143 | -define('EBML_ID_CHAPTERUID', 0x33C4); // [73][C4] -- A unique ID to identify the Chapter. |
|
144 | -define('EBML_ID_TRACKUID', 0x33C5); // [73][C5] -- A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file. |
|
145 | -define('EBML_ID_ATTACHMENTLINK', 0x3446); // [74][46] -- The UID of an attachment that is used by this codec. |
|
146 | -define('EBML_ID_CLUSTERBLOCKADDITIONS', 0x35A1); // [75][A1] -- Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data. |
|
147 | -define('EBML_ID_CHANNELPOSITIONS', 0x347B); // [7D][7B] -- Table of horizontal angles for each successive channel, see appendix. |
|
148 | -define('EBML_ID_OUTPUTSAMPLINGFREQUENCY', 0x38B5); // [78][B5] -- Real output sampling frequency in Hz (used for SBR techniques). |
|
149 | -define('EBML_ID_TITLE', 0x3BA9); // [7B][A9] -- General name of the segment. |
|
150 | -define('EBML_ID_CHAPTERDISPLAY', 0x00); // [80] -- Contains all possible strings to use for the chapter display. |
|
151 | -define('EBML_ID_TRACKTYPE', 0x03); // [83] -- A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control). |
|
152 | -define('EBML_ID_CHAPSTRING', 0x05); // [85] -- Contains the string to use as the chapter atom. |
|
153 | -define('EBML_ID_CODECID', 0x06); // [86] -- An ID corresponding to the codec, see the codec page for more info. |
|
154 | -define('EBML_ID_FLAGDEFAULT', 0x08); // [88] -- Set if that track (audio, video or subs) SHOULD be used if no language found matches the user preference. |
|
155 | -define('EBML_ID_CHAPTERTRACKNUMBER', 0x09); // [89] -- UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks. |
|
156 | -define('EBML_ID_CLUSTERSLICES', 0x0E); // [8E] -- Contains slices description. |
|
157 | -define('EBML_ID_CHAPTERTRACK', 0x0F); // [8F] -- List of tracks on which the chapter applies. If this element is not present, all tracks apply |
|
158 | -define('EBML_ID_CHAPTERTIMESTART', 0x11); // [91] -- Timecode of the start of Chapter (not scaled). |
|
159 | -define('EBML_ID_CHAPTERTIMEEND', 0x12); // [92] -- Timecode of the end of Chapter (timecode excluded, not scaled). |
|
160 | -define('EBML_ID_CUEREFTIME', 0x16); // [96] -- Timecode of the referenced Block. |
|
161 | -define('EBML_ID_CUEREFCLUSTER', 0x17); // [97] -- Position of the Cluster containing the referenced Block. |
|
162 | -define('EBML_ID_CHAPTERFLAGHIDDEN', 0x18); // [98] -- If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
163 | -define('EBML_ID_FLAGINTERLACED', 0x1A); // [9A] -- Set if the video is interlaced. |
|
164 | -define('EBML_ID_CLUSTERBLOCKDURATION', 0x1B); // [9B] -- The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track. When not written and with no DefaultDuration, the value is assumed to be the difference between the timecode of this Block and the timecode of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. |
|
165 | -define('EBML_ID_FLAGLACING', 0x1C); // [9C] -- Set if the track may contain blocks using lacing. |
|
166 | -define('EBML_ID_CHANNELS', 0x1F); // [9F] -- Numbers of channels in the track. |
|
167 | -define('EBML_ID_CLUSTERBLOCKGROUP', 0x20); // [A0] -- Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock. |
|
168 | -define('EBML_ID_CLUSTERBLOCK', 0x21); // [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode. |
|
169 | -define('EBML_ID_CLUSTERBLOCKVIRTUAL', 0x22); // [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order. |
|
170 | -define('EBML_ID_CLUSTERSIMPLEBLOCK', 0x23); // [A3] -- Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed. |
|
171 | -define('EBML_ID_CLUSTERCODECSTATE', 0x24); // [A4] -- The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry. |
|
172 | -define('EBML_ID_CLUSTERBLOCKADDITIONAL', 0x25); // [A5] -- Interpreted by the codec as it wishes (using the BlockAddID). |
|
173 | -define('EBML_ID_CLUSTERBLOCKMORE', 0x26); // [A6] -- Contain the BlockAdditional and some parameters. |
|
174 | -define('EBML_ID_CLUSTERPOSITION', 0x27); // [A7] -- Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams. |
|
175 | -define('EBML_ID_CODECDECODEALL', 0x2A); // [AA] -- The codec can decode potentially damaged data. |
|
176 | -define('EBML_ID_CLUSTERPREVSIZE', 0x2B); // [AB] -- Size of the previous Cluster, in octets. Can be useful for backward playing. |
|
177 | -define('EBML_ID_TRACKENTRY', 0x2E); // [AE] -- Describes a track with all elements. |
|
178 | -define('EBML_ID_CLUSTERENCRYPTEDBLOCK', 0x2F); // [AF] -- Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed). |
|
179 | -define('EBML_ID_PIXELWIDTH', 0x30); // [B0] -- Width of the encoded video frames in pixels. |
|
180 | -define('EBML_ID_CUETIME', 0x33); // [B3] -- Absolute timecode according to the segment time base. |
|
181 | -define('EBML_ID_SAMPLINGFREQUENCY', 0x35); // [B5] -- Sampling frequency in Hz. |
|
182 | -define('EBML_ID_CHAPTERATOM', 0x36); // [B6] -- Contains the atom information to use as the chapter atom (apply to all tracks). |
|
183 | -define('EBML_ID_CUETRACKPOSITIONS', 0x37); // [B7] -- Contain positions for different tracks corresponding to the timecode. |
|
184 | -define('EBML_ID_FLAGENABLED', 0x39); // [B9] -- Set if the track is used. |
|
185 | -define('EBML_ID_PIXELHEIGHT', 0x3A); // [BA] -- Height of the encoded video frames in pixels. |
|
186 | -define('EBML_ID_CUEPOINT', 0x3B); // [BB] -- Contains all information relative to a seek point in the segment. |
|
187 | -define('EBML_ID_CRC32', 0x3F); // [BF] -- The CRC is computed on all the data of the Master element it's in, regardless of its position. It's recommended to put the CRC value at the beggining of the Master element for easier reading. All level 1 elements should include a CRC-32. |
|
188 | -define('EBML_ID_CLUSTERBLOCKADDITIONID', 0x4B); // [CB] -- The ID of the BlockAdditional element (0 is the main Block). |
|
189 | -define('EBML_ID_CLUSTERLACENUMBER', 0x4C); // [CC] -- The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
190 | -define('EBML_ID_CLUSTERFRAMENUMBER', 0x4D); // [CD] -- The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame). |
|
191 | -define('EBML_ID_CLUSTERDELAY', 0x4E); // [CE] -- The (scaled) delay to apply to the element. |
|
192 | -define('EBML_ID_CLUSTERDURATION', 0x4F); // [CF] -- The (scaled) duration to apply to the element. |
|
193 | -define('EBML_ID_TRACKNUMBER', 0x57); // [D7] -- The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number). |
|
194 | -define('EBML_ID_CUEREFERENCE', 0x5B); // [DB] -- The Clusters containing the required referenced Blocks. |
|
195 | -define('EBML_ID_VIDEO', 0x60); // [E0] -- Video settings. |
|
196 | -define('EBML_ID_AUDIO', 0x61); // [E1] -- Audio settings. |
|
197 | -define('EBML_ID_CLUSTERTIMESLICE', 0x68); // [E8] -- Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
198 | -define('EBML_ID_CUECODECSTATE', 0x6A); // [EA] -- The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry. |
|
199 | -define('EBML_ID_CUEREFCODECSTATE', 0x6B); // [EB] -- The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry. |
|
200 | -define('EBML_ID_VOID', 0x6C); // [EC] -- Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use. |
|
201 | -define('EBML_ID_CLUSTERTIMECODE', 0x67); // [E7] -- Absolute timecode of the cluster (based on TimecodeScale). |
|
202 | -define('EBML_ID_CLUSTERBLOCKADDID', 0x6E); // [EE] -- An ID to identify the BlockAdditional level. |
|
203 | -define('EBML_ID_CUECLUSTERPOSITION', 0x71); // [F1] -- The position of the Cluster containing the required Block. |
|
204 | -define('EBML_ID_CUETRACK', 0x77); // [F7] -- The track for which a position is given. |
|
205 | -define('EBML_ID_CLUSTERREFERENCEPRIORITY', 0x7A); // [FA] -- This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced. |
|
206 | -define('EBML_ID_CLUSTERREFERENCEBLOCK', 0x7B); // [FB] -- Timecode of another frame used as a reference (ie: B or P frame). The timecode is relative to the block it's attached to. |
|
207 | -define('EBML_ID_CLUSTERREFERENCEVIRTUAL', 0x7D); // [FD] -- Relative position of the data that should be in position of the virtual block. |
|
18 | +define('EBML_ID_CHAPTERS', 0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation. |
|
19 | +define('EBML_ID_SEEKHEAD', 0x014D9B74); // [11][4D][9B][74] -- Contains the position of other level 1 elements. |
|
20 | +define('EBML_ID_TAGS', 0x0254C367); // [12][54][C3][67] -- Element containing elements specific to Tracks/Chapters. A list of valid tags can be found <http://www.matroska.org/technical/specs/tagging/index.html>. |
|
21 | +define('EBML_ID_INFO', 0x0549A966); // [15][49][A9][66] -- Contains miscellaneous general information and statistics on the file. |
|
22 | +define('EBML_ID_TRACKS', 0x0654AE6B); // [16][54][AE][6B] -- A top-level block of information with many tracks described. |
|
23 | +define('EBML_ID_SEGMENT', 0x08538067); // [18][53][80][67] -- This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment. |
|
24 | +define('EBML_ID_ATTACHMENTS', 0x0941A469); // [19][41][A4][69] -- Contain attached files. |
|
25 | +define('EBML_ID_EBML', 0x0A45DFA3); // [1A][45][DF][A3] -- Set the EBML characteristics of the data to follow. Each EBML document has to start with this. |
|
26 | +define('EBML_ID_CUES', 0x0C53BB6B); // [1C][53][BB][6B] -- A top-level element to speed seeking access. All entries are local to the segment. |
|
27 | +define('EBML_ID_CLUSTER', 0x0F43B675); // [1F][43][B6][75] -- The lower level element containing the (monolithic) Block structure. |
|
28 | +define('EBML_ID_LANGUAGE', 0x02B59C); // [22][B5][9C] -- Specifies the language of the track in the Matroska languages form. |
|
29 | +define('EBML_ID_TRACKTIMECODESCALE', 0x03314F); // [23][31][4F] -- The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs). |
|
30 | +define('EBML_ID_DEFAULTDURATION', 0x03E383); // [23][E3][83] -- Number of nanoseconds (i.e. not scaled) per frame. |
|
31 | +define('EBML_ID_CODECNAME', 0x058688); // [25][86][88] -- A human-readable string specifying the codec. |
|
32 | +define('EBML_ID_CODECDOWNLOADURL', 0x06B240); // [26][B2][40] -- A URL to download about the codec used. |
|
33 | +define('EBML_ID_TIMECODESCALE', 0x0AD7B1); // [2A][D7][B1] -- Timecode scale in nanoseconds (1.000.000 means all timecodes in the segment are expressed in milliseconds). |
|
34 | +define('EBML_ID_COLOURSPACE', 0x0EB524); // [2E][B5][24] -- Same value as in AVI (32 bits). |
|
35 | +define('EBML_ID_GAMMAVALUE', 0x0FB523); // [2F][B5][23] -- Gamma Value. |
|
36 | +define('EBML_ID_CODECSETTINGS', 0x1A9697); // [3A][96][97] -- A string describing the encoding setting used. |
|
37 | +define('EBML_ID_CODECINFOURL', 0x1B4040); // [3B][40][40] -- A URL to find information about the codec used. |
|
38 | +define('EBML_ID_PREVFILENAME', 0x1C83AB); // [3C][83][AB] -- An escaped filename corresponding to the previous segment. |
|
39 | +define('EBML_ID_PREVUID', 0x1CB923); // [3C][B9][23] -- A unique ID to identify the previous chained segment (128 bits). |
|
40 | +define('EBML_ID_NEXTFILENAME', 0x1E83BB); // [3E][83][BB] -- An escaped filename corresponding to the next segment. |
|
41 | +define('EBML_ID_NEXTUID', 0x1EB923); // [3E][B9][23] -- A unique ID to identify the next chained segment (128 bits). |
|
42 | +define('EBML_ID_CONTENTCOMPALGO', 0x0254); // [42][54] -- The compression algorithm used. Algorithms that have been specified so far are: |
|
43 | +define('EBML_ID_CONTENTCOMPSETTINGS', 0x0255); // [42][55] -- Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track. |
|
44 | +define('EBML_ID_DOCTYPE', 0x0282); // [42][82] -- A string that describes the type of document that follows this EBML header ('matroska' in our case). |
|
45 | +define('EBML_ID_DOCTYPEREADVERSION', 0x0285); // [42][85] -- The minimum DocType version an interpreter has to support to read this file. |
|
46 | +define('EBML_ID_EBMLVERSION', 0x0286); // [42][86] -- The version of EBML parser used to create the file. |
|
47 | +define('EBML_ID_DOCTYPEVERSION', 0x0287); // [42][87] -- The version of DocType interpreter used to create the file. |
|
48 | +define('EBML_ID_EBMLMAXIDLENGTH', 0x02F2); // [42][F2] -- The maximum length of the IDs you'll find in this file (4 or less in Matroska). |
|
49 | +define('EBML_ID_EBMLMAXSIZELENGTH', 0x02F3); // [42][F3] -- The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid. |
|
50 | +define('EBML_ID_EBMLREADVERSION', 0x02F7); // [42][F7] -- The minimum EBML version a parser has to support to read this file. |
|
51 | +define('EBML_ID_CHAPLANGUAGE', 0x037C); // [43][7C] -- The languages corresponding to the string, in the bibliographic ISO-639-2 form. |
|
52 | +define('EBML_ID_CHAPCOUNTRY', 0x037E); // [43][7E] -- The countries corresponding to the string, same 2 octets as in Internet domains. |
|
53 | +define('EBML_ID_SEGMENTFAMILY', 0x0444); // [44][44] -- A randomly generated unique ID that all segments related to each other must use (128 bits). |
|
54 | +define('EBML_ID_DATEUTC', 0x0461); // [44][61] -- Date of the origin of timecode (value 0), i.e. production date. |
|
55 | +define('EBML_ID_TAGLANGUAGE', 0x047A); // [44][7A] -- Specifies the language of the tag specified, in the Matroska languages form. |
|
56 | +define('EBML_ID_TAGDEFAULT', 0x0484); // [44][84] -- Indication to know if this is the default/original language to use for the given tag. |
|
57 | +define('EBML_ID_TAGBINARY', 0x0485); // [44][85] -- The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString. |
|
58 | +define('EBML_ID_TAGSTRING', 0x0487); // [44][87] -- The value of the Tag. |
|
59 | +define('EBML_ID_DURATION', 0x0489); // [44][89] -- Duration of the segment (based on TimecodeScale). |
|
60 | +define('EBML_ID_CHAPPROCESSPRIVATE', 0x050D); // [45][0D] -- Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent. |
|
61 | +define('EBML_ID_CHAPTERFLAGENABLED', 0x0598); // [45][98] -- Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter. |
|
62 | +define('EBML_ID_TAGNAME', 0x05A3); // [45][A3] -- The name of the Tag that is going to be stored. |
|
63 | +define('EBML_ID_EDITIONENTRY', 0x05B9); // [45][B9] -- Contains all information about a segment edition. |
|
64 | +define('EBML_ID_EDITIONUID', 0x05BC); // [45][BC] -- A unique ID to identify the edition. It's useful for tagging an edition. |
|
65 | +define('EBML_ID_EDITIONFLAGHIDDEN', 0x05BD); // [45][BD] -- If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
66 | +define('EBML_ID_EDITIONFLAGDEFAULT', 0x05DB); // [45][DB] -- If a flag is set (1) the edition should be used as the default one. |
|
67 | +define('EBML_ID_EDITIONFLAGORDERED', 0x05DD); // [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced. |
|
68 | +define('EBML_ID_FILEDATA', 0x065C); // [46][5C] -- The data of the file. |
|
69 | +define('EBML_ID_FILEMIMETYPE', 0x0660); // [46][60] -- MIME type of the file. |
|
70 | +define('EBML_ID_FILENAME', 0x066E); // [46][6E] -- Filename of the attached file. |
|
71 | +define('EBML_ID_FILEREFERRAL', 0x0675); // [46][75] -- A binary value that a track/codec can refer to when the attachment is needed. |
|
72 | +define('EBML_ID_FILEDESCRIPTION', 0x067E); // [46][7E] -- A human-friendly name for the attached file. |
|
73 | +define('EBML_ID_FILEUID', 0x06AE); // [46][AE] -- Unique ID representing the file, as random as possible. |
|
74 | +define('EBML_ID_CONTENTENCALGO', 0x07E1); // [47][E1] -- The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: |
|
75 | +define('EBML_ID_CONTENTENCKEYID', 0x07E2); // [47][E2] -- For public key algorithms this is the ID of the public key the the data was encrypted with. |
|
76 | +define('EBML_ID_CONTENTSIGNATURE', 0x07E3); // [47][E3] -- A cryptographic signature of the contents. |
|
77 | +define('EBML_ID_CONTENTSIGKEYID', 0x07E4); // [47][E4] -- This is the ID of the private key the data was signed with. |
|
78 | +define('EBML_ID_CONTENTSIGALGO', 0x07E5); // [47][E5] -- The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
79 | +define('EBML_ID_CONTENTSIGHASHALGO', 0x07E6); // [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
80 | +define('EBML_ID_MUXINGAPP', 0x0D80); // [4D][80] -- Muxing application or library ("libmatroska-0.4.3"). |
|
81 | +define('EBML_ID_SEEK', 0x0DBB); // [4D][BB] -- Contains a single seek entry to an EBML element. |
|
82 | +define('EBML_ID_CONTENTENCODINGORDER', 0x1031); // [50][31] -- Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment. |
|
83 | +define('EBML_ID_CONTENTENCODINGSCOPE', 0x1032); // [50][32] -- A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: |
|
84 | +define('EBML_ID_CONTENTENCODINGTYPE', 0x1033); // [50][33] -- A value describing what kind of transformation has been done. Possible values: |
|
85 | +define('EBML_ID_CONTENTCOMPRESSION', 0x1034); // [50][34] -- Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking. |
|
86 | +define('EBML_ID_CONTENTENCRYPTION', 0x1035); // [50][35] -- Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise. |
|
87 | +define('EBML_ID_CUEREFNUMBER', 0x135F); // [53][5F] -- Number of the referenced Block of Track X in the specified Cluster. |
|
88 | +define('EBML_ID_NAME', 0x136E); // [53][6E] -- A human-readable track name. |
|
89 | +define('EBML_ID_CUEBLOCKNUMBER', 0x1378); // [53][78] -- Number of the Block in the specified Cluster. |
|
90 | +define('EBML_ID_TRACKOFFSET', 0x137F); // [53][7F] -- A value to add to the Block's Timecode. This can be used to adjust the playback offset of a track. |
|
91 | +define('EBML_ID_SEEKID', 0x13AB); // [53][AB] -- The binary ID corresponding to the element name. |
|
92 | +define('EBML_ID_SEEKPOSITION', 0x13AC); // [53][AC] -- The position of the element in the segment in octets (0 = first level 1 element). |
|
93 | +define('EBML_ID_STEREOMODE', 0x13B8); // [53][B8] -- Stereo-3D video mode. |
|
94 | +define('EBML_ID_OLDSTEREOMODE', 0x13B9); // [53][B9] -- Bogus StereoMode value used in old versions of libmatroska. DO NOT USE. (0: mono, 1: right eye, 2: left eye, 3: both eyes). |
|
95 | +define('EBML_ID_PIXELCROPBOTTOM', 0x14AA); // [54][AA] -- The number of video pixels to remove at the bottom of the image (for HDTV content). |
|
96 | +define('EBML_ID_DISPLAYWIDTH', 0x14B0); // [54][B0] -- Width of the video frames to display. |
|
97 | +define('EBML_ID_DISPLAYUNIT', 0x14B2); // [54][B2] -- Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches). |
|
98 | +define('EBML_ID_ASPECTRATIOTYPE', 0x14B3); // [54][B3] -- Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed). |
|
99 | +define('EBML_ID_DISPLAYHEIGHT', 0x14BA); // [54][BA] -- Height of the video frames to display. |
|
100 | +define('EBML_ID_PIXELCROPTOP', 0x14BB); // [54][BB] -- The number of video pixels to remove at the top of the image. |
|
101 | +define('EBML_ID_PIXELCROPLEFT', 0x14CC); // [54][CC] -- The number of video pixels to remove on the left of the image. |
|
102 | +define('EBML_ID_PIXELCROPRIGHT', 0x14DD); // [54][DD] -- The number of video pixels to remove on the right of the image. |
|
103 | +define('EBML_ID_FLAGFORCED', 0x15AA); // [55][AA] -- Set if that track MUST be used during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. |
|
104 | +define('EBML_ID_MAXBLOCKADDITIONID', 0x15EE); // [55][EE] -- The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track. |
|
105 | +define('EBML_ID_WRITINGAPP', 0x1741); // [57][41] -- Writing application ("mkvmerge-0.3.3"). |
|
106 | +define('EBML_ID_CLUSTERSILENTTRACKS', 0x1854); // [58][54] -- The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use. |
|
107 | +define('EBML_ID_CLUSTERSILENTTRACKNUMBER', 0x18D7); // [58][D7] -- One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster. |
|
108 | +define('EBML_ID_ATTACHEDFILE', 0x21A7); // [61][A7] -- An attached file. |
|
109 | +define('EBML_ID_CONTENTENCODING', 0x2240); // [62][40] -- Settings for one content encoding like compression or encryption. |
|
110 | +define('EBML_ID_BITDEPTH', 0x2264); // [62][64] -- Bits per sample, mostly used for PCM. |
|
111 | +define('EBML_ID_CODECPRIVATE', 0x23A2); // [63][A2] -- Private data only known to the codec. |
|
112 | +define('EBML_ID_TARGETS', 0x23C0); // [63][C0] -- Contain all UIDs where the specified meta data apply. It is void to describe everything in the segment. |
|
113 | +define('EBML_ID_CHAPTERPHYSICALEQUIV', 0x23C3); // [63][C3] -- Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values. |
|
114 | +define('EBML_ID_TAGCHAPTERUID', 0x23C4); // [63][C4] -- A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment. |
|
115 | +define('EBML_ID_TAGTRACKUID', 0x23C5); // [63][C5] -- A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment. |
|
116 | +define('EBML_ID_TAGATTACHMENTUID', 0x23C6); // [63][C6] -- A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment. |
|
117 | +define('EBML_ID_TAGEDITIONUID', 0x23C9); // [63][C9] -- A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment. |
|
118 | +define('EBML_ID_TARGETTYPE', 0x23CA); // [63][CA] -- An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType). |
|
119 | +define('EBML_ID_TRACKTRANSLATE', 0x2624); // [66][24] -- The track identification for the given Chapter Codec. |
|
120 | +define('EBML_ID_TRACKTRANSLATETRACKID', 0x26A5); // [66][A5] -- The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
121 | +define('EBML_ID_TRACKTRANSLATECODEC', 0x26BF); // [66][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
122 | +define('EBML_ID_TRACKTRANSLATEEDITIONUID', 0x26FC); // [66][FC] -- Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment. |
|
123 | +define('EBML_ID_SIMPLETAG', 0x27C8); // [67][C8] -- Contains general information about the target. |
|
124 | +define('EBML_ID_TARGETTYPEVALUE', 0x28CA); // [68][CA] -- A number to indicate the logical level of the target (see TargetType). |
|
125 | +define('EBML_ID_CHAPPROCESSCOMMAND', 0x2911); // [69][11] -- Contains all the commands associated to the Atom. |
|
126 | +define('EBML_ID_CHAPPROCESSTIME', 0x2922); // [69][22] -- Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter). |
|
127 | +define('EBML_ID_CHAPTERTRANSLATE', 0x2924); // [69][24] -- A tuple of corresponding ID used by chapter codecs to represent this segment. |
|
128 | +define('EBML_ID_CHAPPROCESSDATA', 0x2933); // [69][33] -- Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands. |
|
129 | +define('EBML_ID_CHAPPROCESS', 0x2944); // [69][44] -- Contains all the commands associated to the Atom. |
|
130 | +define('EBML_ID_CHAPPROCESSCODECID', 0x2955); // [69][55] -- Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later. |
|
131 | +define('EBML_ID_CHAPTERTRANSLATEID', 0x29A5); // [69][A5] -- The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
132 | +define('EBML_ID_CHAPTERTRANSLATECODEC', 0x29BF); // [69][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
133 | +define('EBML_ID_CHAPTERTRANSLATEEDITIONUID', 0x29FC); // [69][FC] -- Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment. |
|
134 | +define('EBML_ID_CONTENTENCODINGS', 0x2D80); // [6D][80] -- Settings for several content encoding mechanisms like compression or encryption. |
|
135 | +define('EBML_ID_MINCACHE', 0x2DE7); // [6D][E7] -- The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used. |
|
136 | +define('EBML_ID_MAXCACHE', 0x2DF8); // [6D][F8] -- The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed. |
|
137 | +define('EBML_ID_CHAPTERSEGMENTUID', 0x2E67); // [6E][67] -- A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used. |
|
138 | +define('EBML_ID_CHAPTERSEGMENTEDITIONUID', 0x2EBC); // [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID. |
|
139 | +define('EBML_ID_TRACKOVERLAY', 0x2FAB); // [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc. |
|
140 | +define('EBML_ID_TAG', 0x3373); // [73][73] -- Element containing elements specific to Tracks/Chapters. |
|
141 | +define('EBML_ID_SEGMENTFILENAME', 0x3384); // [73][84] -- A filename corresponding to this segment. |
|
142 | +define('EBML_ID_SEGMENTUID', 0x33A4); // [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits). |
|
143 | +define('EBML_ID_CHAPTERUID', 0x33C4); // [73][C4] -- A unique ID to identify the Chapter. |
|
144 | +define('EBML_ID_TRACKUID', 0x33C5); // [73][C5] -- A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file. |
|
145 | +define('EBML_ID_ATTACHMENTLINK', 0x3446); // [74][46] -- The UID of an attachment that is used by this codec. |
|
146 | +define('EBML_ID_CLUSTERBLOCKADDITIONS', 0x35A1); // [75][A1] -- Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data. |
|
147 | +define('EBML_ID_CHANNELPOSITIONS', 0x347B); // [7D][7B] -- Table of horizontal angles for each successive channel, see appendix. |
|
148 | +define('EBML_ID_OUTPUTSAMPLINGFREQUENCY', 0x38B5); // [78][B5] -- Real output sampling frequency in Hz (used for SBR techniques). |
|
149 | +define('EBML_ID_TITLE', 0x3BA9); // [7B][A9] -- General name of the segment. |
|
150 | +define('EBML_ID_CHAPTERDISPLAY', 0x00); // [80] -- Contains all possible strings to use for the chapter display. |
|
151 | +define('EBML_ID_TRACKTYPE', 0x03); // [83] -- A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control). |
|
152 | +define('EBML_ID_CHAPSTRING', 0x05); // [85] -- Contains the string to use as the chapter atom. |
|
153 | +define('EBML_ID_CODECID', 0x06); // [86] -- An ID corresponding to the codec, see the codec page for more info. |
|
154 | +define('EBML_ID_FLAGDEFAULT', 0x08); // [88] -- Set if that track (audio, video or subs) SHOULD be used if no language found matches the user preference. |
|
155 | +define('EBML_ID_CHAPTERTRACKNUMBER', 0x09); // [89] -- UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks. |
|
156 | +define('EBML_ID_CLUSTERSLICES', 0x0E); // [8E] -- Contains slices description. |
|
157 | +define('EBML_ID_CHAPTERTRACK', 0x0F); // [8F] -- List of tracks on which the chapter applies. If this element is not present, all tracks apply |
|
158 | +define('EBML_ID_CHAPTERTIMESTART', 0x11); // [91] -- Timecode of the start of Chapter (not scaled). |
|
159 | +define('EBML_ID_CHAPTERTIMEEND', 0x12); // [92] -- Timecode of the end of Chapter (timecode excluded, not scaled). |
|
160 | +define('EBML_ID_CUEREFTIME', 0x16); // [96] -- Timecode of the referenced Block. |
|
161 | +define('EBML_ID_CUEREFCLUSTER', 0x17); // [97] -- Position of the Cluster containing the referenced Block. |
|
162 | +define('EBML_ID_CHAPTERFLAGHIDDEN', 0x18); // [98] -- If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
163 | +define('EBML_ID_FLAGINTERLACED', 0x1A); // [9A] -- Set if the video is interlaced. |
|
164 | +define('EBML_ID_CLUSTERBLOCKDURATION', 0x1B); // [9B] -- The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track. When not written and with no DefaultDuration, the value is assumed to be the difference between the timecode of this Block and the timecode of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. |
|
165 | +define('EBML_ID_FLAGLACING', 0x1C); // [9C] -- Set if the track may contain blocks using lacing. |
|
166 | +define('EBML_ID_CHANNELS', 0x1F); // [9F] -- Numbers of channels in the track. |
|
167 | +define('EBML_ID_CLUSTERBLOCKGROUP', 0x20); // [A0] -- Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock. |
|
168 | +define('EBML_ID_CLUSTERBLOCK', 0x21); // [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode. |
|
169 | +define('EBML_ID_CLUSTERBLOCKVIRTUAL', 0x22); // [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order. |
|
170 | +define('EBML_ID_CLUSTERSIMPLEBLOCK', 0x23); // [A3] -- Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed. |
|
171 | +define('EBML_ID_CLUSTERCODECSTATE', 0x24); // [A4] -- The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry. |
|
172 | +define('EBML_ID_CLUSTERBLOCKADDITIONAL', 0x25); // [A5] -- Interpreted by the codec as it wishes (using the BlockAddID). |
|
173 | +define('EBML_ID_CLUSTERBLOCKMORE', 0x26); // [A6] -- Contain the BlockAdditional and some parameters. |
|
174 | +define('EBML_ID_CLUSTERPOSITION', 0x27); // [A7] -- Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams. |
|
175 | +define('EBML_ID_CODECDECODEALL', 0x2A); // [AA] -- The codec can decode potentially damaged data. |
|
176 | +define('EBML_ID_CLUSTERPREVSIZE', 0x2B); // [AB] -- Size of the previous Cluster, in octets. Can be useful for backward playing. |
|
177 | +define('EBML_ID_TRACKENTRY', 0x2E); // [AE] -- Describes a track with all elements. |
|
178 | +define('EBML_ID_CLUSTERENCRYPTEDBLOCK', 0x2F); // [AF] -- Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed). |
|
179 | +define('EBML_ID_PIXELWIDTH', 0x30); // [B0] -- Width of the encoded video frames in pixels. |
|
180 | +define('EBML_ID_CUETIME', 0x33); // [B3] -- Absolute timecode according to the segment time base. |
|
181 | +define('EBML_ID_SAMPLINGFREQUENCY', 0x35); // [B5] -- Sampling frequency in Hz. |
|
182 | +define('EBML_ID_CHAPTERATOM', 0x36); // [B6] -- Contains the atom information to use as the chapter atom (apply to all tracks). |
|
183 | +define('EBML_ID_CUETRACKPOSITIONS', 0x37); // [B7] -- Contain positions for different tracks corresponding to the timecode. |
|
184 | +define('EBML_ID_FLAGENABLED', 0x39); // [B9] -- Set if the track is used. |
|
185 | +define('EBML_ID_PIXELHEIGHT', 0x3A); // [BA] -- Height of the encoded video frames in pixels. |
|
186 | +define('EBML_ID_CUEPOINT', 0x3B); // [BB] -- Contains all information relative to a seek point in the segment. |
|
187 | +define('EBML_ID_CRC32', 0x3F); // [BF] -- The CRC is computed on all the data of the Master element it's in, regardless of its position. It's recommended to put the CRC value at the beggining of the Master element for easier reading. All level 1 elements should include a CRC-32. |
|
188 | +define('EBML_ID_CLUSTERBLOCKADDITIONID', 0x4B); // [CB] -- The ID of the BlockAdditional element (0 is the main Block). |
|
189 | +define('EBML_ID_CLUSTERLACENUMBER', 0x4C); // [CC] -- The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
190 | +define('EBML_ID_CLUSTERFRAMENUMBER', 0x4D); // [CD] -- The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame). |
|
191 | +define('EBML_ID_CLUSTERDELAY', 0x4E); // [CE] -- The (scaled) delay to apply to the element. |
|
192 | +define('EBML_ID_CLUSTERDURATION', 0x4F); // [CF] -- The (scaled) duration to apply to the element. |
|
193 | +define('EBML_ID_TRACKNUMBER', 0x57); // [D7] -- The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number). |
|
194 | +define('EBML_ID_CUEREFERENCE', 0x5B); // [DB] -- The Clusters containing the required referenced Blocks. |
|
195 | +define('EBML_ID_VIDEO', 0x60); // [E0] -- Video settings. |
|
196 | +define('EBML_ID_AUDIO', 0x61); // [E1] -- Audio settings. |
|
197 | +define('EBML_ID_CLUSTERTIMESLICE', 0x68); // [E8] -- Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
198 | +define('EBML_ID_CUECODECSTATE', 0x6A); // [EA] -- The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry. |
|
199 | +define('EBML_ID_CUEREFCODECSTATE', 0x6B); // [EB] -- The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry. |
|
200 | +define('EBML_ID_VOID', 0x6C); // [EC] -- Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use. |
|
201 | +define('EBML_ID_CLUSTERTIMECODE', 0x67); // [E7] -- Absolute timecode of the cluster (based on TimecodeScale). |
|
202 | +define('EBML_ID_CLUSTERBLOCKADDID', 0x6E); // [EE] -- An ID to identify the BlockAdditional level. |
|
203 | +define('EBML_ID_CUECLUSTERPOSITION', 0x71); // [F1] -- The position of the Cluster containing the required Block. |
|
204 | +define('EBML_ID_CUETRACK', 0x77); // [F7] -- The track for which a position is given. |
|
205 | +define('EBML_ID_CLUSTERREFERENCEPRIORITY', 0x7A); // [FA] -- This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced. |
|
206 | +define('EBML_ID_CLUSTERREFERENCEBLOCK', 0x7B); // [FB] -- Timecode of another frame used as a reference (ie: B or P frame). The timecode is relative to the block it's attached to. |
|
207 | +define('EBML_ID_CLUSTERREFERENCEVIRTUAL', 0x7D); // [FD] -- Relative position of the data that should be in position of the virtual block. |
|
208 | 208 | |
209 | 209 | |
210 | 210 | /** |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | class getid3_matroska extends getid3_handler |
217 | 217 | { |
218 | 218 | // public options |
219 | - public static $hide_clusters = true; // if true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful [default: TRUE] |
|
219 | + public static $hide_clusters = true; // if true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful [default: TRUE] |
|
220 | 220 | public static $parse_whole_file = false; // true to parse the whole file, not only header [default: FALSE] |
221 | 221 | |
222 | 222 | // private parser settings/placeholders |
@@ -274,11 +274,11 @@ discard block |
||
274 | 274 | $track_info['display_y'] = (isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight']); |
275 | 275 | |
276 | 276 | if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; } |
277 | - if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; } |
|
278 | - if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; } |
|
279 | - if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; } |
|
277 | + if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; } |
|
278 | + if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; } |
|
279 | + if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; } |
|
280 | 280 | if (isset($trackarray['DefaultDuration'])) { $track_info['frame_rate'] = round(1000000000 / $trackarray['DefaultDuration'], 3); } |
281 | - if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } |
|
281 | + if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } |
|
282 | 282 | |
283 | 283 | switch ($trackarray['CodecID']) { |
284 | 284 | case 'V_MS/VFW/FOURCC': |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $track_info['sample_rate'] = (isset($trackarray['SamplingFrequency']) ? $trackarray['SamplingFrequency'] : 8000.0); |
321 | 321 | $track_info['channels'] = (isset($trackarray['Channels']) ? $trackarray['Channels'] : 1); |
322 | 322 | $track_info['language'] = (isset($trackarray['Language']) ? $trackarray['Language'] : 'eng'); |
323 | - if (isset($trackarray['BitDepth'])) { $track_info['bits_per_sample'] = $trackarray['BitDepth']; } |
|
323 | + if (isset($trackarray['BitDepth'])) { $track_info['bits_per_sample'] = $trackarray['BitDepth']; } |
|
324 | 324 | if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } |
325 | 325 | |
326 | 326 | switch ($trackarray['CodecID']) { |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | case 'A_FLAC': |
337 | 337 | getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.'.($track_info['dataformat'] == 'mp2' ? 'mp3' : $track_info['dataformat']).'.php', __FILE__, true); |
338 | 338 | |
339 | - if (!isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) { |
|
339 | + if ( ! isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) { |
|
340 | 340 | $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because $info[matroska][track_data_offsets]['.$trackarray['TrackNumber'].'] not set'); |
341 | 341 | break; |
342 | 342 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | else { |
362 | 362 | $getid3_audio->Analyze(); |
363 | 363 | } |
364 | - if (!empty($getid3_temp->info[$header_data_key])) { |
|
364 | + if ( ! empty($getid3_temp->info[$header_data_key])) { |
|
365 | 365 | $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info[$header_data_key]; |
366 | 366 | if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) { |
367 | 367 | foreach ($getid3_temp->info['audio'] as $key => $value) { |
@@ -374,12 +374,12 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | // copy errors and warnings |
377 | - if (!empty($getid3_temp->info['error'])) { |
|
377 | + if ( ! empty($getid3_temp->info['error'])) { |
|
378 | 378 | foreach ($getid3_temp->info['error'] as $newerror) { |
379 | 379 | $this->warning($class.'() says: ['.$newerror.']'); |
380 | 380 | } |
381 | 381 | } |
382 | - if (!empty($getid3_temp->info['warning'])) { |
|
382 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
383 | 383 | foreach ($getid3_temp->info['warning'] as $newerror) { |
384 | 384 | $this->warning($class.'() says: ['.$newerror.']'); |
385 | 385 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | break; |
397 | 397 | |
398 | 398 | case 'A_VORBIS': |
399 | - if (!isset($trackarray['CodecPrivate'])) { |
|
399 | + if ( ! isset($trackarray['CodecPrivate'])) { |
|
400 | 400 | $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data not set'); |
401 | 401 | break; |
402 | 402 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $getid3_ogg = new getid3_ogg($getid3_temp); |
417 | 417 | $oggpageinfo['page_seqno'] = 0; |
418 | 418 | $getid3_ogg->ParseVorbisPageHeader($trackarray['CodecPrivate'], $vorbis_offset, $oggpageinfo); |
419 | - if (!empty($getid3_temp->info['ogg'])) { |
|
419 | + if ( ! empty($getid3_temp->info['ogg'])) { |
|
420 | 420 | $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info['ogg']; |
421 | 421 | if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) { |
422 | 422 | foreach ($getid3_temp->info['audio'] as $key => $value) { |
@@ -426,18 +426,18 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | // copy errors and warnings |
429 | - if (!empty($getid3_temp->info['error'])) { |
|
429 | + if ( ! empty($getid3_temp->info['error'])) { |
|
430 | 430 | foreach ($getid3_temp->info['error'] as $newerror) { |
431 | 431 | $this->warning('getid3_ogg() says: ['.$newerror.']'); |
432 | 432 | } |
433 | 433 | } |
434 | - if (!empty($getid3_temp->info['warning'])) { |
|
434 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
435 | 435 | foreach ($getid3_temp->info['warning'] as $newerror) { |
436 | 436 | $this->warning('getid3_ogg() says: ['.$newerror.']'); |
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | - if (!empty($getid3_temp->info['ogg']['bitrate_nominal'])) { |
|
440 | + if ( ! empty($getid3_temp->info['ogg']['bitrate_nominal'])) { |
|
441 | 441 | $track_info['bitrate'] = $getid3_temp->info['ogg']['bitrate_nominal']; |
442 | 442 | } |
443 | 443 | unset($getid3_temp, $getid3_ogg, $oggpageinfo, $vorbis_offset); |
@@ -464,10 +464,10 @@ discard block |
||
464 | 464 | } |
465 | 465 | } |
466 | 466 | |
467 | - if (!empty($info['video']['streams'])) { |
|
467 | + if ( ! empty($info['video']['streams'])) { |
|
468 | 468 | $info['video'] = self::getDefaultStreamInfo($info['video']['streams']); |
469 | 469 | } |
470 | - if (!empty($info['audio']['streams'])) { |
|
470 | + if ( ! empty($info['audio']['streams'])) { |
|
471 | 471 | $info['audio'] = self::getDefaultStreamInfo($info['audio']['streams']); |
472 | 472 | } |
473 | 473 | } |
@@ -475,16 +475,16 @@ discard block |
||
475 | 475 | // process attachments |
476 | 476 | if (isset($info['matroska']['attachments']) && $this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE) { |
477 | 477 | foreach ($info['matroska']['attachments'] as $i => $entry) { |
478 | - if (strpos($entry['FileMimeType'], 'image/') === 0 && !empty($entry['FileData'])) { |
|
478 | + if (strpos($entry['FileMimeType'], 'image/') === 0 && ! empty($entry['FileData'])) { |
|
479 | 479 | $info['matroska']['comments']['picture'][] = array('data' => $entry['FileData'], 'image_mime' => $entry['FileMimeType'], 'filename' => $entry['FileName']); |
480 | 480 | } |
481 | 481 | } |
482 | 482 | } |
483 | 483 | |
484 | 484 | // determine mime type |
485 | - if (!empty($info['video']['streams'])) { |
|
485 | + if ( ! empty($info['video']['streams'])) { |
|
486 | 486 | $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'video/webm' : 'video/x-matroska'); |
487 | - } elseif (!empty($info['audio']['streams'])) { |
|
487 | + } elseif ( ! empty($info['audio']['streams'])) { |
|
488 | 488 | $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'audio/webm' : 'audio/x-matroska'); |
489 | 489 | } elseif (isset($info['mime_type'])) { |
490 | 490 | unset($info['mime_type']); |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $info['matroska']['segment'][0]['length'] = $top_element['length']; |
537 | 537 | |
538 | 538 | while ($this->getEBMLelement($element_data, $top_element['end'])) { |
539 | - if ($element_data['id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required |
|
539 | + if ($element_data['id'] != EBML_ID_CLUSTER || ! self::$hide_clusters) { // collect clusters only if required |
|
540 | 540 | $info['matroska']['segments'][] = $element_data; |
541 | 541 | } |
542 | 542 | switch ($element_data['id']) { |
@@ -561,10 +561,10 @@ discard block |
||
561 | 561 | break; |
562 | 562 | |
563 | 563 | default: |
564 | - $this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry); } |
|
564 | + $this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry); } |
|
565 | 565 | } |
566 | 566 | |
567 | - if ($seek_entry['target_id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required |
|
567 | + if ($seek_entry['target_id'] != EBML_ID_CLUSTER || ! self::$hide_clusters) { // collect clusters only if required |
|
568 | 568 | $info['matroska']['seek'][] = $seek_entry; |
569 | 569 | } |
570 | 570 | break; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | break; |
641 | 641 | |
642 | 642 | case EBML_ID_FLAGINTERLACED: |
643 | - $track_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
643 | + $track_entry[$sub_subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
644 | 644 | break; |
645 | 645 | |
646 | 646 | case EBML_ID_GAMMAVALUE: |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | case EBML_ID_EDITIONFLAGHIDDEN: |
1015 | 1015 | case EBML_ID_EDITIONFLAGDEFAULT: |
1016 | 1016 | case EBML_ID_EDITIONFLAGORDERED: |
1017 | - $editionentry_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
1017 | + $editionentry_entry[$sub_subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
1018 | 1018 | break; |
1019 | 1019 | |
1020 | 1020 | case EBML_ID_CHAPTERATOM: |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | |
1031 | 1031 | case EBML_ID_CHAPTERFLAGENABLED: |
1032 | 1032 | case EBML_ID_CHAPTERFLAGHIDDEN: |
1033 | - $chapteratom_entry[$sub_sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_sub_subelement['data']); |
|
1033 | + $chapteratom_entry[$sub_sub_subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($sub_sub_subelement['data']); |
|
1034 | 1034 | break; |
1035 | 1035 | |
1036 | 1036 | case EBML_ID_CHAPTERUID: |
@@ -1163,12 +1163,12 @@ discard block |
||
1163 | 1163 | } |
1164 | 1164 | $this->current_offset = $subelement['end']; |
1165 | 1165 | } |
1166 | - if (!self::$hide_clusters) { |
|
1166 | + if ( ! self::$hide_clusters) { |
|
1167 | 1167 | $info['matroska']['cluster'][] = $cluster_entry; |
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | // check to see if all the data we need exists already, if so, break out of the loop |
1171 | - if (!self::$parse_whole_file) { |
|
1171 | + if ( ! self::$parse_whole_file) { |
|
1172 | 1172 | if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) { |
1173 | 1173 | if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) { |
1174 | 1174 | if (count($info['matroska']['track_data_offsets']) == count($info['matroska']['tracks']['tracks'])) { |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | } |
1192 | 1192 | } |
1193 | 1193 | |
1194 | - private function EnsureBufferHasEnoughData($min_data=1024) { |
|
1194 | + private function EnsureBufferHasEnoughData($min_data = 1024) { |
|
1195 | 1195 | if (($this->current_offset - $this->EBMLbuffer_offset) >= ($this->EBMLbuffer_length - $min_data)) { |
1196 | 1196 | $read_bytes = max($min_data, $this->getid3->fread_buffer_size()); |
1197 | 1197 | |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | |
1218 | 1218 | // get length of integer |
1219 | 1219 | $first_byte_int = ord($this->EBMLbuffer[$actual_offset]); |
1220 | - if (0x80 & $first_byte_int) { |
|
1220 | + if (0x80 & $first_byte_int) { |
|
1221 | 1221 | $length = 1; |
1222 | 1222 | } elseif (0x40 & $first_byte_int) { |
1223 | 1223 | $length = 2; |
@@ -1244,8 +1244,8 @@ discard block |
||
1244 | 1244 | return $int_value; |
1245 | 1245 | } |
1246 | 1246 | |
1247 | - private function readEBMLelementData($length, $check_buffer=false) { |
|
1248 | - if ($check_buffer && !$this->EnsureBufferHasEnoughData($length)) { |
|
1247 | + private function readEBMLelementData($length, $check_buffer = false) { |
|
1248 | + if ($check_buffer && ! $this->EnsureBufferHasEnoughData($length)) { |
|
1249 | 1249 | return false; |
1250 | 1250 | } |
1251 | 1251 | $data = substr($this->EBMLbuffer, $this->current_offset - $this->EBMLbuffer_offset, $length); |
@@ -1253,12 +1253,12 @@ discard block |
||
1253 | 1253 | return $data; |
1254 | 1254 | } |
1255 | 1255 | |
1256 | - private function getEBMLelement(&$element, $parent_end, $get_data=false) { |
|
1256 | + private function getEBMLelement(&$element, $parent_end, $get_data = false) { |
|
1257 | 1257 | if ($this->current_offset >= $parent_end) { |
1258 | 1258 | return false; |
1259 | 1259 | } |
1260 | 1260 | |
1261 | - if (!$this->EnsureBufferHasEnoughData()) { |
|
1261 | + if ( ! $this->EnsureBufferHasEnoughData()) { |
|
1262 | 1262 | $this->current_offset = PHP_INT_MAX; // do not exit parser right now, allow to finish current loop to gather maximum information |
1263 | 1263 | return false; |
1264 | 1264 | } |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | |
1283 | 1283 | // get raw data |
1284 | 1284 | $dont_parse = (in_array($element['id'], $this->unuseful_elements) || $element['id_name'] == dechex($element['id'])); |
1285 | - if (($get_data === true || (is_array($get_data) && !in_array($element['id'], $get_data))) && !$dont_parse) { |
|
1285 | + if (($get_data === true || (is_array($get_data) && ! in_array($element['id'], $get_data))) && ! $dont_parse) { |
|
1286 | 1286 | $element['data'] = $this->readEBMLelementData($element['length'], $element); |
1287 | 1287 | } |
1288 | 1288 | |
@@ -1291,23 +1291,23 @@ discard block |
||
1291 | 1291 | |
1292 | 1292 | private function unhandledElement($type, $line, $element) { |
1293 | 1293 | // warn only about unknown and missed elements, not about unuseful |
1294 | - if (!in_array($element['id'], $this->unuseful_elements)) { |
|
1294 | + if ( ! in_array($element['id'], $this->unuseful_elements)) { |
|
1295 | 1295 | $this->warning('Unhandled '.$type.' element ['.basename(__FILE__).':'.$line.'] ('.$element['id'].'::'.$element['id_name'].' ['.$element['length'].' bytes]) at '.$element['offset']); |
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | // increase offset for unparsed elements |
1299 | - if (!isset($element['data'])) { |
|
1299 | + if ( ! isset($element['data'])) { |
|
1300 | 1300 | $this->current_offset = $element['end']; |
1301 | 1301 | } |
1302 | 1302 | } |
1303 | 1303 | |
1304 | 1304 | private function ExtractCommentsSimpleTag($SimpleTagArray) { |
1305 | - if (!empty($SimpleTagArray['SimpleTag'])) { |
|
1305 | + if ( ! empty($SimpleTagArray['SimpleTag'])) { |
|
1306 | 1306 | foreach ($SimpleTagArray['SimpleTag'] as $SimpleTagKey => $SimpleTagData) { |
1307 | - if (!empty($SimpleTagData['TagName']) && !empty($SimpleTagData['TagString'])) { |
|
1307 | + if ( ! empty($SimpleTagData['TagName']) && ! empty($SimpleTagData['TagString'])) { |
|
1308 | 1308 | $this->getid3->info['matroska']['comments'][strtolower($SimpleTagData['TagName'])][] = $SimpleTagData['TagString']; |
1309 | 1309 | } |
1310 | - if (!empty($SimpleTagData['SimpleTag'])) { |
|
1310 | + if ( ! empty($SimpleTagData['SimpleTag'])) { |
|
1311 | 1311 | $this->ExtractCommentsSimpleTag($SimpleTagData); |
1312 | 1312 | } |
1313 | 1313 | } |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | break; |
1335 | 1335 | |
1336 | 1336 | case EBML_ID_TAGDEFAULT: |
1337 | - $simpletag_entry[$element['id_name']] = (bool)getid3_lib::BigEndian2Int($element['data']); |
|
1337 | + $simpletag_entry[$element['id_name']] = (bool) getid3_lib::BigEndian2Int($element['data']); |
|
1338 | 1338 | break; |
1339 | 1339 | |
1340 | 1340 | default: |
@@ -1355,14 +1355,14 @@ discard block |
||
1355 | 1355 | $block_data['flags_raw'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)); |
1356 | 1356 | |
1357 | 1357 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1358 | - $block_data['flags']['keyframe'] = (($block_data['flags_raw'] & 0x80) >> 7); |
|
1358 | + $block_data['flags']['keyframe'] = (($block_data['flags_raw'] & 0x80) >> 7); |
|
1359 | 1359 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0x70) >> 4); |
1360 | 1360 | } |
1361 | 1361 | else { |
1362 | 1362 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0xF0) >> 4); |
1363 | 1363 | } |
1364 | - $block_data['flags']['invisible'] = (bool)(($block_data['flags_raw'] & 0x08) >> 3); |
|
1365 | - $block_data['flags']['lacing'] = (($block_data['flags_raw'] & 0x06) >> 1); // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing |
|
1364 | + $block_data['flags']['invisible'] = (bool) (($block_data['flags_raw'] & 0x08) >> 3); |
|
1365 | + $block_data['flags']['lacing'] = (($block_data['flags_raw'] & 0x06) >> 1); // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing |
|
1366 | 1366 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1367 | 1367 | $block_data['flags']['discardable'] = (($block_data['flags_raw'] & 0x01)); |
1368 | 1368 | } |
@@ -1375,7 +1375,7 @@ discard block |
||
1375 | 1375 | if ($block_data['flags']['lacing'] > 0) { |
1376 | 1376 | $block_data['lace_frames'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)) + 1; // Number of frames in the lace-1 (uint8) |
1377 | 1377 | if ($block_data['flags']['lacing'] != 0x02) { |
1378 | - for ($i = 1; $i < $block_data['lace_frames']; $i ++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace). |
|
1378 | + for ($i = 1; $i < $block_data['lace_frames']; $i++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace). |
|
1379 | 1379 | if ($block_data['flags']['lacing'] == 0x03) { // EBML lacing |
1380 | 1380 | $block_data['lace_frames_size'][$i] = $this->readEBMLint(); // TODO: read size correctly, calc size for the last frame. For now offsets are deteminded OK with readEBMLint() and that's the most important thing. |
1381 | 1381 | } |
@@ -1394,7 +1394,7 @@ discard block |
||
1394 | 1394 | } |
1395 | 1395 | } |
1396 | 1396 | |
1397 | - if (!isset($info['matroska']['track_data_offsets'][$block_data['tracknumber']])) { |
|
1397 | + if ( ! isset($info['matroska']['track_data_offsets'][$block_data['tracknumber']])) { |
|
1398 | 1398 | $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['offset'] = $this->current_offset; |
1399 | 1399 | $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['length'] = $element['end'] - $this->current_offset; |
1400 | 1400 | //$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['total_length'] = 0; |
@@ -1460,13 +1460,13 @@ discard block |
||
1460 | 1460 | // http://www.matroska.org/technical/specs/tagging/index.html |
1461 | 1461 | static $TargetTypeValue = array(); |
1462 | 1462 | if (empty($TargetTypeValue)) { |
1463 | - $TargetTypeValue[10] = 'A: ~ V:shot'; // the lowest hierarchy found in music or movies |
|
1464 | - $TargetTypeValue[20] = 'A:subtrack/part/movement ~ V:scene'; // corresponds to parts of a track for audio (like a movement) |
|
1465 | - $TargetTypeValue[30] = 'A:track/song ~ V:chapter'; // the common parts of an album or a movie |
|
1466 | - $TargetTypeValue[40] = 'A:part/session ~ V:part/session'; // when an album or episode has different logical parts |
|
1467 | - $TargetTypeValue[50] = 'A:album/opera/concert ~ V:movie/episode/concert'; // the most common grouping level of music and video (equals to an episode for TV series) |
|
1468 | - $TargetTypeValue[60] = 'A:edition/issue/volume/opus ~ V:season/sequel/volume'; // a list of lower levels grouped together |
|
1469 | - $TargetTypeValue[70] = 'A:collection ~ V:collection'; // the high hierarchy consisting of many different lower items |
|
1463 | + $TargetTypeValue[10] = 'A: ~ V:shot'; // the lowest hierarchy found in music or movies |
|
1464 | + $TargetTypeValue[20] = 'A:subtrack/part/movement ~ V:scene'; // corresponds to parts of a track for audio (like a movement) |
|
1465 | + $TargetTypeValue[30] = 'A:track/song ~ V:chapter'; // the common parts of an album or a movie |
|
1466 | + $TargetTypeValue[40] = 'A:part/session ~ V:part/session'; // when an album or episode has different logical parts |
|
1467 | + $TargetTypeValue[50] = 'A:album/opera/concert ~ V:movie/episode/concert'; // the most common grouping level of music and video (equals to an episode for TV series) |
|
1468 | + $TargetTypeValue[60] = 'A:edition/issue/volume/opus ~ V:season/sequel/volume'; // a list of lower levels grouped together |
|
1469 | + $TargetTypeValue[70] = 'A:collection ~ V:collection'; // the high hierarchy consisting of many different lower items |
|
1470 | 1470 | } |
1471 | 1471 | return (isset($TargetTypeValue[$target_type]) ? $TargetTypeValue[$target_type] : $target_type); |
1472 | 1472 | } |
@@ -1495,8 +1495,8 @@ discard block |
||
1495 | 1495 | $CodecIDlist['A_MPEG/L1'] = 'mp1'; |
1496 | 1496 | $CodecIDlist['A_MPEG/L2'] = 'mp2'; |
1497 | 1497 | $CodecIDlist['A_MPEG/L3'] = 'mp3'; |
1498 | - $CodecIDlist['A_PCM/INT/LIT'] = 'pcm'; // PCM Integer Little Endian |
|
1499 | - $CodecIDlist['A_PCM/INT/BIG'] = 'pcm'; // PCM Integer Big Endian |
|
1498 | + $CodecIDlist['A_PCM/INT/LIT'] = 'pcm'; // PCM Integer Little Endian |
|
1499 | + $CodecIDlist['A_PCM/INT/BIG'] = 'pcm'; // PCM Integer Big Endian |
|
1500 | 1500 | $CodecIDlist['A_QUICKTIME/QDMC'] = 'quicktime'; // Quicktime: QDesign Music |
1501 | 1501 | $CodecIDlist['A_QUICKTIME/QDM2'] = 'quicktime'; // Quicktime: QDesign Music v2 |
1502 | 1502 | $CodecIDlist['A_VORBIS'] = 'vorbis'; |
@@ -357,8 +357,7 @@ discard block |
||
357 | 357 | $getid3_audio = new $class($getid3_temp, __CLASS__); |
358 | 358 | if ($track_info['dataformat'] == 'flac') { |
359 | 359 | $getid3_audio->AnalyzeString($trackarray['CodecPrivate']); |
360 | - } |
|
361 | - else { |
|
360 | + } else { |
|
362 | 361 | $getid3_audio->Analyze(); |
363 | 362 | } |
364 | 363 | if (!empty($getid3_temp->info[$header_data_key])) { |
@@ -368,8 +367,7 @@ discard block |
||
368 | 367 | $track_info[$key] = $value; |
369 | 368 | } |
370 | 369 | } |
371 | - } |
|
372 | - else { |
|
370 | + } else { |
|
373 | 371 | $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because '.$class.'::Analyze() failed at offset '.$getid3_temp->info['avdataoffset']); |
374 | 372 | } |
375 | 373 | |
@@ -1357,16 +1355,14 @@ discard block |
||
1357 | 1355 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1358 | 1356 | $block_data['flags']['keyframe'] = (($block_data['flags_raw'] & 0x80) >> 7); |
1359 | 1357 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0x70) >> 4); |
1360 | - } |
|
1361 | - else { |
|
1358 | + } else { |
|
1362 | 1359 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0xF0) >> 4); |
1363 | 1360 | } |
1364 | 1361 | $block_data['flags']['invisible'] = (bool)(($block_data['flags_raw'] & 0x08) >> 3); |
1365 | 1362 | $block_data['flags']['lacing'] = (($block_data['flags_raw'] & 0x06) >> 1); // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing |
1366 | 1363 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1367 | 1364 | $block_data['flags']['discardable'] = (($block_data['flags_raw'] & 0x01)); |
1368 | - } |
|
1369 | - else { |
|
1365 | + } else { |
|
1370 | 1366 | //$block_data['flags']['reserved2'] = (($block_data['flags_raw'] & 0x01) >> 0); |
1371 | 1367 | } |
1372 | 1368 | $block_data['flags']['lacing_type'] = self::BlockLacingType($block_data['flags']['lacing']); |
@@ -1378,8 +1374,7 @@ discard block |
||
1378 | 1374 | for ($i = 1; $i < $block_data['lace_frames']; $i ++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace). |
1379 | 1375 | if ($block_data['flags']['lacing'] == 0x03) { // EBML lacing |
1380 | 1376 | $block_data['lace_frames_size'][$i] = $this->readEBMLint(); // TODO: read size correctly, calc size for the last frame. For now offsets are deteminded OK with readEBMLint() and that's the most important thing. |
1381 | - } |
|
1382 | - else { // Xiph lacing |
|
1377 | + } else { // Xiph lacing |
|
1383 | 1378 | $block_data['lace_frames_size'][$i] = 0; |
1384 | 1379 | do { |
1385 | 1380 | $size = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)); |
@@ -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 { |