Changeset 46112 for trunk/src/wp-includes/ID3/module.audio-video.asf.php
- Timestamp:
- 09/14/2019 07:06:09 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/module.audio-video.asf.php
r41196 r46112 2 2 ///////////////////////////////////////////////////////////////// 3 3 /// getID3() by James Heinrich <info@getid3.org> // 4 // available at http://getid3.sourceforge.net // 5 // or http://www.getid3.org // 6 // also https://github.com/JamesHeinrich/getID3 // 7 ///////////////////////////////////////////////////////////////// 8 // See readme.txt for more details // 4 // available at https://github.com/JamesHeinrich/getID3 // 5 // or https://www.getid3.org // 6 // or http://getid3.sourceforge.net // 7 // see readme.txt for more details // 9 8 ///////////////////////////////////////////////////////////////// 10 9 // // … … 17 16 getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true); 18 17 19 class getid3_asf extends getid3_handler { 20 18 class getid3_asf extends getid3_handler 19 { 20 /** 21 * @param getID3 $getid3 22 */ 21 23 public function __construct(getID3 $getid3) { 22 24 parent::__construct($getid3); // extends getid3_handler::__construct() … … 31 33 } 32 34 35 /** 36 * @return bool 37 */ 33 38 public function Analyze() { 34 39 $info = &$this->getid3->info; … … 84 89 $ASFHeaderData = $this->fread($thisfile_asf_headerobject['objectsize'] - 30); 85 90 $offset = 0; 91 $thisfile_asf_streambitratepropertiesobject = array(); 92 $thisfile_asf_codeclistobject = array(); 86 93 87 94 for ($HeaderObjectsCounter = 0; $HeaderObjectsCounter < $thisfile_asf_headerobject['headerobjects']; $HeaderObjectsCounter++) { … … 791 798 case 'tracknumber': 792 799 // be careful casting to int: casting unicode strings to int gives unexpected results (stops parsing at first non-numeric character) 793 $thisfile_asf_comments['track '] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));794 foreach ($thisfile_asf_comments['track '] as $key => $value) {800 $thisfile_asf_comments['track_number'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); 801 foreach ($thisfile_asf_comments['track_number'] as $key => $value) { 795 802 if (preg_match('/^[0-9\x00]+$/', $value)) { 796 $thisfile_asf_comments['track '][$key] = intval(str_replace("\x00", '', $value));803 $thisfile_asf_comments['track_number'][$key] = intval(str_replace("\x00", '', $value)); 797 804 } 798 805 } … … 800 807 801 808 case 'wm/track': 802 if (empty($thisfile_asf_comments['track '])) {803 $thisfile_asf_comments['track '] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value']));809 if (empty($thisfile_asf_comments['track_number'])) { 810 $thisfile_asf_comments['track_number'] = array(1 + $this->TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); 804 811 } 805 812 break; … … 971 978 } 972 979 } 973 if (isset($thisfile_asf_streambitrateproperties ['bitrate_records_count'])) {980 if (isset($thisfile_asf_streambitratepropertiesobject['bitrate_records_count'])) { 974 981 $ASFbitrateAudio = 0; 975 982 $ASFbitrateVideo = 0; 976 for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitrateproperties ['bitrate_records_count']; $BitrateRecordsCounter++) {983 for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject['bitrate_records_count']; $BitrateRecordsCounter++) { 977 984 if (isset($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter])) { 978 985 switch ($thisfile_asf_codeclistobject['codec_entries'][$BitrateRecordsCounter]['type_raw']) { 979 986 case 1: 980 $ASFbitrateVideo += $thisfile_asf_streambitrateproperties ['bitrate_records'][$BitrateRecordsCounter]['bitrate'];987 $ASFbitrateVideo += $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['bitrate']; 981 988 break; 982 989 983 990 case 2: 984 $ASFbitrateAudio += $thisfile_asf_streambitrateproperties ['bitrate_records'][$BitrateRecordsCounter]['bitrate'];991 $ASFbitrateAudio += $thisfile_asf_streambitratepropertiesobject['bitrate_records'][$BitrateRecordsCounter]['bitrate']; 985 992 break; 986 993 … … 1441 1448 } 1442 1449 1450 /** 1451 * @param int $CodecListType 1452 * 1453 * @return string 1454 */ 1443 1455 public static function codecListObjectTypeLookup($CodecListType) { 1444 1456 static $lookup = array( … … 1451 1463 } 1452 1464 1465 /** 1466 * @return array 1467 */ 1453 1468 public static function KnownGUIDs() { 1454 1469 static $GUIDarray = array( … … 1565 1580 } 1566 1581 1582 /** 1583 * @param string $GUIDstring 1584 * 1585 * @return string|false 1586 */ 1567 1587 public static function GUIDname($GUIDstring) { 1568 1588 static $GUIDarray = array(); … … 1573 1593 } 1574 1594 1595 /** 1596 * @param int $id 1597 * 1598 * @return string 1599 */ 1575 1600 public static function ASFIndexObjectIndexTypeLookup($id) { 1576 1601 static $ASFIndexObjectIndexTypeLookup = array(); … … 1583 1608 } 1584 1609 1610 /** 1611 * @param string $GUIDstring 1612 * 1613 * @return string 1614 */ 1585 1615 public static function GUIDtoBytestring($GUIDstring) { 1586 1616 // Microsoft defines these 16-byte (128-bit) GUIDs in the strangest way: … … 1618 1648 } 1619 1649 1650 /** 1651 * @param string $Bytestring 1652 * 1653 * @return string 1654 */ 1620 1655 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);1656 $GUIDstring = str_pad(dechex(ord($Bytestring[3])), 2, '0', STR_PAD_LEFT); 1657 $GUIDstring .= str_pad(dechex(ord($Bytestring[2])), 2, '0', STR_PAD_LEFT); 1658 $GUIDstring .= str_pad(dechex(ord($Bytestring[1])), 2, '0', STR_PAD_LEFT); 1659 $GUIDstring .= str_pad(dechex(ord($Bytestring[0])), 2, '0', STR_PAD_LEFT); 1625 1660 $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);1661 $GUIDstring .= str_pad(dechex(ord($Bytestring[5])), 2, '0', STR_PAD_LEFT); 1662 $GUIDstring .= str_pad(dechex(ord($Bytestring[4])), 2, '0', STR_PAD_LEFT); 1628 1663 $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);1664 $GUIDstring .= str_pad(dechex(ord($Bytestring[7])), 2, '0', STR_PAD_LEFT); 1665 $GUIDstring .= str_pad(dechex(ord($Bytestring[6])), 2, '0', STR_PAD_LEFT); 1631 1666 $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);1667 $GUIDstring .= str_pad(dechex(ord($Bytestring[8])), 2, '0', STR_PAD_LEFT); 1668 $GUIDstring .= str_pad(dechex(ord($Bytestring[9])), 2, '0', STR_PAD_LEFT); 1634 1669 $GUIDstring .= '-'; 1635 $GUIDstring .= str_pad(dechex(ord($Bytestring {10})), 2, '0', STR_PAD_LEFT);1636 $GUIDstring .= str_pad(dechex(ord($Bytestring {11})), 2, '0', STR_PAD_LEFT);1637 $GUIDstring .= str_pad(dechex(ord($Bytestring {12})), 2, '0', STR_PAD_LEFT);1638 $GUIDstring .= str_pad(dechex(ord($Bytestring {13})), 2, '0', STR_PAD_LEFT);1639 $GUIDstring .= str_pad(dechex(ord($Bytestring {14})), 2, '0', STR_PAD_LEFT);1640 $GUIDstring .= str_pad(dechex(ord($Bytestring {15})), 2, '0', STR_PAD_LEFT);1670 $GUIDstring .= str_pad(dechex(ord($Bytestring[10])), 2, '0', STR_PAD_LEFT); 1671 $GUIDstring .= str_pad(dechex(ord($Bytestring[11])), 2, '0', STR_PAD_LEFT); 1672 $GUIDstring .= str_pad(dechex(ord($Bytestring[12])), 2, '0', STR_PAD_LEFT); 1673 $GUIDstring .= str_pad(dechex(ord($Bytestring[13])), 2, '0', STR_PAD_LEFT); 1674 $GUIDstring .= str_pad(dechex(ord($Bytestring[14])), 2, '0', STR_PAD_LEFT); 1675 $GUIDstring .= str_pad(dechex(ord($Bytestring[15])), 2, '0', STR_PAD_LEFT); 1641 1676 1642 1677 return strtoupper($GUIDstring); 1643 1678 } 1644 1679 1680 /** 1681 * @param int $FILETIME 1682 * @param bool $round 1683 * 1684 * @return float|int 1685 */ 1645 1686 public static function FILETIMEtoUNIXtime($FILETIME, $round=true) { 1646 1687 // FILETIME is a 64-bit unsigned integer representing … … 1654 1695 } 1655 1696 1697 /** 1698 * @param int $WMpictureType 1699 * 1700 * @return string 1701 */ 1656 1702 public static function WMpictureTypeLookup($WMpictureType) { 1657 1703 static $lookup = null; … … 1685 1731 } 1686 1732 1733 /** 1734 * @param string $asf_header_extension_object_data 1735 * @param int $unhandled_sections 1736 * 1737 * @return array 1738 */ 1687 1739 public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) { 1688 1740 // http://msdn.microsoft.com/en-us/library/bb643323.aspx … … 1931 1983 } 1932 1984 1933 1985 /** 1986 * @param int $id 1987 * 1988 * @return string 1989 */ 1934 1990 public static function metadataLibraryObjectDataTypeLookup($id) { 1935 1991 static $lookup = array( … … 1945 2001 } 1946 2002 2003 /** 2004 * @param string $data 2005 * 2006 * @return array 2007 */ 1947 2008 public function ASF_WMpicture(&$data) { 1948 2009 //typedef struct _WMPicture{ … … 1995 2056 } 1996 2057 1997 1998 // Remove terminator 00 00 and convert UTF-16LE to Latin-1 2058 /** 2059 * Remove terminator 00 00 and convert UTF-16LE to Latin-1. 2060 * 2061 * @param string $string 2062 * 2063 * @return string 2064 */ 1999 2065 public static function TrimConvert($string) { 2000 2066 return trim(getid3_lib::iconv_fallback('UTF-16LE', 'ISO-8859-1', self::TrimTerm($string)), ' '); 2001 2067 } 2002 2068 2003 2004 // Remove terminator 00 00 2069 /** 2070 * Remove terminator 00 00. 2071 * 2072 * @param string $string 2073 * 2074 * @return string 2075 */ 2005 2076 public static function TrimTerm($string) { 2006 2077 // remove terminator, only if present (it should be, but...)
Note: See TracChangeset
for help on using the changeset viewer.