@@ -99,6 +99,9 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | |
102 | + /** |
|
103 | + * @param string $binarynumerator |
|
104 | + */ |
|
102 | 105 | public static function DecimalBinary2Float($binarynumerator) { |
103 | 106 | $numerator = self::Bin2Dec($binarynumerator); |
104 | 107 | $denominator = self::Bin2Dec('1'.str_repeat('0', strlen($binarynumerator))); |
@@ -106,6 +109,9 @@ discard block |
||
106 | 109 | } |
107 | 110 | |
108 | 111 | |
112 | + /** |
|
113 | + * @param string $binarypointnumber |
|
114 | + */ |
|
109 | 115 | public static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) { |
110 | 116 | // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html |
111 | 117 | if (strpos($binarypointnumber, '.') === false) { |
@@ -146,6 +152,9 @@ discard block |
||
146 | 152 | } |
147 | 153 | |
148 | 154 | |
155 | + /** |
|
156 | + * @param integer $bits |
|
157 | + */ |
|
149 | 158 | public static function Float2String($floatvalue, $bits) { |
150 | 159 | // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee-expl.html |
151 | 160 | switch ($bits) { |
@@ -177,6 +186,9 @@ discard block |
||
177 | 186 | } |
178 | 187 | |
179 | 188 | |
189 | + /** |
|
190 | + * @param string $byteword |
|
191 | + */ |
|
180 | 192 | public static function LittleEndian2Float($byteword) { |
181 | 193 | return self::BigEndian2Float(strrev($byteword)); |
182 | 194 | } |
@@ -293,6 +305,9 @@ discard block |
||
293 | 305 | return self::BigEndian2Int(strrev($byteword), false, $signed); |
294 | 306 | } |
295 | 307 | |
308 | + /** |
|
309 | + * @param string $byteword |
|
310 | + */ |
|
296 | 311 | public static function LittleEndian2Bin($byteword) { |
297 | 312 | return self::BigEndian2Bin(strrev($byteword)); |
298 | 313 | } |
@@ -358,6 +373,9 @@ discard block |
||
358 | 373 | } |
359 | 374 | |
360 | 375 | |
376 | + /** |
|
377 | + * @param string $binstring |
|
378 | + */ |
|
361 | 379 | public static function Bin2String($binstring) { |
362 | 380 | // return 'hi' for input of '0110100001101001' |
363 | 381 | $string = ''; |
@@ -369,6 +387,9 @@ discard block |
||
369 | 387 | } |
370 | 388 | |
371 | 389 | |
390 | + /** |
|
391 | + * @param integer $number |
|
392 | + */ |
|
372 | 393 | public static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) { |
373 | 394 | $intstring = ''; |
374 | 395 | while ($number > 0) { |
@@ -475,22 +496,34 @@ discard block |
||
475 | 496 | } |
476 | 497 | |
477 | 498 | |
499 | + /** |
|
500 | + * @param string $rawdata |
|
501 | + */ |
|
478 | 502 | public static function FixedPoint8_8($rawdata) { |
479 | 503 | return self::BigEndian2Int(substr($rawdata, 0, 1)) + (float) (self::BigEndian2Int(substr($rawdata, 1, 1)) / pow(2, 8)); |
480 | 504 | } |
481 | 505 | |
482 | 506 | |
507 | + /** |
|
508 | + * @param string $rawdata |
|
509 | + */ |
|
483 | 510 | public static function FixedPoint16_16($rawdata) { |
484 | 511 | return self::BigEndian2Int(substr($rawdata, 0, 2)) + (float) (self::BigEndian2Int(substr($rawdata, 2, 2)) / pow(2, 16)); |
485 | 512 | } |
486 | 513 | |
487 | 514 | |
515 | + /** |
|
516 | + * @param string $rawdata |
|
517 | + */ |
|
488 | 518 | public static function FixedPoint2_30($rawdata) { |
489 | 519 | $binarystring = self::BigEndian2Bin($rawdata); |
490 | 520 | return self::Bin2Dec(substr($binarystring, 0, 2)) + (float) (self::Bin2Dec(substr($binarystring, 2, 30)) / pow(2, 30)); |
491 | 521 | } |
492 | 522 | |
493 | 523 | |
524 | + /** |
|
525 | + * @param string $Separator |
|
526 | + */ |
|
494 | 527 | public static function CreateDeepArray($ArrayPath, $Separator, $Value) { |
495 | 528 | // assigns $Value to a nested array path: |
496 | 529 | // $foo = self::CreateDeepArray('/path/to/my', '/', 'file.txt') |
@@ -548,6 +581,9 @@ discard block |
||
548 | 581 | return false; |
549 | 582 | } |
550 | 583 | |
584 | + /** |
|
585 | + * @param SimpleXMLElement $XMLobject |
|
586 | + */ |
|
551 | 587 | public static function SimpleXMLelement2array($XMLobject) { |
552 | 588 | if (!is_object($XMLobject) && !is_array($XMLobject)) { |
553 | 589 | return $XMLobject; |
@@ -648,6 +684,9 @@ discard block |
||
648 | 684 | return $result; |
649 | 685 | } |
650 | 686 | |
687 | + /** |
|
688 | + * @param string $filename_dest |
|
689 | + */ |
|
651 | 690 | public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) { |
652 | 691 | if (!self::intValueSupported($offset + $length)) { |
653 | 692 | throw new Exception('cannot copy file portion, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit'); |
@@ -880,6 +919,10 @@ discard block |
||
880 | 919 | } |
881 | 920 | |
882 | 921 | // UTF-16BE => UTF-8 |
922 | + |
|
923 | + /** |
|
924 | + * @param string $string |
|
925 | + */ |
|
883 | 926 | public static function iconv_fallback_utf16be_utf8($string) { |
884 | 927 | if (substr($string, 0, 2) == "\xFE\xFF") { |
885 | 928 | // strip BOM |
@@ -894,6 +937,10 @@ discard block |
||
894 | 937 | } |
895 | 938 | |
896 | 939 | // UTF-16LE => UTF-8 |
940 | + |
|
941 | + /** |
|
942 | + * @param string $string |
|
943 | + */ |
|
897 | 944 | public static function iconv_fallback_utf16le_utf8($string) { |
898 | 945 | if (substr($string, 0, 2) == "\xFF\xFE") { |
899 | 946 | // strip BOM |
@@ -908,6 +955,10 @@ discard block |
||
908 | 955 | } |
909 | 956 | |
910 | 957 | // UTF-16BE => ISO-8859-1 |
958 | + |
|
959 | + /** |
|
960 | + * @param string $string |
|
961 | + */ |
|
911 | 962 | public static function iconv_fallback_utf16be_iso88591($string) { |
912 | 963 | if (substr($string, 0, 2) == "\xFE\xFF") { |
913 | 964 | // strip BOM |
@@ -922,6 +973,10 @@ discard block |
||
922 | 973 | } |
923 | 974 | |
924 | 975 | // UTF-16LE => ISO-8859-1 |
976 | + |
|
977 | + /** |
|
978 | + * @param string $string |
|
979 | + */ |
|
925 | 980 | public static function iconv_fallback_utf16le_iso88591($string) { |
926 | 981 | if (substr($string, 0, 2) == "\xFF\xFE") { |
927 | 982 | // strip BOM |
@@ -947,6 +1002,10 @@ discard block |
||
947 | 1002 | } |
948 | 1003 | |
949 | 1004 | // UTF-16 (BOM) => UTF-8 |
1005 | + |
|
1006 | + /** |
|
1007 | + * @param string $string |
|
1008 | + */ |
|
950 | 1009 | public static function iconv_fallback_utf16_utf8($string) { |
951 | 1010 | $bom = substr($string, 0, 2); |
952 | 1011 | if ($bom == "\xFE\xFF") { |
@@ -1327,6 +1386,12 @@ discard block |
||
1327 | 1386 | } |
1328 | 1387 | |
1329 | 1388 | |
1389 | + /** |
|
1390 | + * @param integer $begin |
|
1391 | + * @param integer $end |
|
1392 | + * @param string $file |
|
1393 | + * @param string $name |
|
1394 | + */ |
|
1330 | 1395 | public static function EmbeddedLookup($key, $begin, $end, $file, $name) { |
1331 | 1396 | |
1332 | 1397 | // Cached |
@@ -1373,6 +1438,10 @@ discard block |
||
1373 | 1438 | return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : ''); |
1374 | 1439 | } |
1375 | 1440 | |
1441 | + /** |
|
1442 | + * @param string $filename |
|
1443 | + * @param string $sourcefile |
|
1444 | + */ |
|
1376 | 1445 | public static function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) { |
1377 | 1446 | global $GETID3_ERRORARRAY; |
1378 | 1447 |
@@ -200,6 +200,10 @@ discard block |
||
200 | 200 | return true; |
201 | 201 | } |
202 | 202 | |
203 | + /** |
|
204 | + * @param string $atomname |
|
205 | + * @param string $atom_data |
|
206 | + */ |
|
203 | 207 | public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { |
204 | 208 | // http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/INDEX/atomalphaindex.htm |
205 | 209 | // https://code.google.com/p/mp4v2/wiki/iTunesMetadata |
@@ -1742,6 +1746,9 @@ discard block |
||
1742 | 1746 | return $atom_structure; |
1743 | 1747 | } |
1744 | 1748 | |
1749 | + /** |
|
1750 | + * @param integer $baseoffset |
|
1751 | + */ |
|
1745 | 1752 | public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { |
1746 | 1753 | //echo 'QuicktimeParseContainerAtom('.substr($atom_data, 4, 4).') @ '.$baseoffset.'<br><br>'; |
1747 | 1754 | $atom_structure = false; |
@@ -1774,6 +1781,9 @@ discard block |
||
1774 | 1781 | } |
1775 | 1782 | |
1776 | 1783 | |
1784 | + /** |
|
1785 | + * @param integer $offset |
|
1786 | + */ |
|
1777 | 1787 | public function quicktime_read_mp4_descr_length($data, &$offset) { |
1778 | 1788 | // http://libquicktime.sourcearchive.com/documentation/2:1.0.2plus-pdebian-2build1/esds_8c-source.html |
1779 | 1789 | $num_bytes = 0; |
@@ -2565,6 +2575,9 @@ discard block |
||
2565 | 2575 | return true; |
2566 | 2576 | } |
2567 | 2577 | |
2578 | + /** |
|
2579 | + * @param string $lstring |
|
2580 | + */ |
|
2568 | 2581 | public function LociString($lstring, &$count) { |
2569 | 2582 | // Loci strings are UTF-8 or UTF-16 and null (x00/x0000) terminated. UTF-16 has a BOM |
2570 | 2583 | // Also need to return the number of bytes the string occupied so additional fields can be extracted |
@@ -2598,6 +2611,9 @@ discard block |
||
2598 | 2611 | } |
2599 | 2612 | } |
2600 | 2613 | |
2614 | + /** |
|
2615 | + * @param string $nullterminatedstring |
|
2616 | + */ |
|
2601 | 2617 | public function NoNullString($nullterminatedstring) { |
2602 | 2618 | // remove the single null terminator on null terminated strings |
2603 | 2619 | if (substr($nullterminatedstring, strlen($nullterminatedstring) - 1, 1) === "\x00") { |
@@ -2606,6 +2622,9 @@ discard block |
||
2606 | 2622 | return $nullterminatedstring; |
2607 | 2623 | } |
2608 | 2624 | |
2625 | + /** |
|
2626 | + * @param string $pascalstring |
|
2627 | + */ |
|
2609 | 2628 | public function Pascal2String($pascalstring) { |
2610 | 2629 | // Pascal strings have 1 unsigned byte at the beginning saying how many chars (1-255) are in the string |
2611 | 2630 | return substr($pascalstring, 1); |
@@ -2616,6 +2635,10 @@ discard block |
||
2616 | 2635 | // helper functions for m4b audiobook chapters |
2617 | 2636 | // code by Steffen Hartmann 2015-Nov-08 |
2618 | 2637 | */ |
2638 | + |
|
2639 | + /** |
|
2640 | + * @param string $tag |
|
2641 | + */ |
|
2619 | 2642 | public function search_tag_by_key($info, $tag, $history, &$result) { |
2620 | 2643 | foreach ($info as $key => $value) { |
2621 | 2644 | $key_history = $history.'/'.$key; |
@@ -2629,6 +2652,10 @@ discard block |
||
2629 | 2652 | } |
2630 | 2653 | } |
2631 | 2654 | |
2655 | + /** |
|
2656 | + * @param string $k |
|
2657 | + * @param string $v |
|
2658 | + */ |
|
2632 | 2659 | public function search_tag_by_pair($info, $k, $v, $history, &$result) { |
2633 | 2660 | foreach ($info as $key => $value) { |
2634 | 2661 | $key_history = $history.'/'.$key; |