Changeset 54376 for trunk/src/wp-includes/ID3/module.audio-video.asf.php
- Timestamp:
- 10/04/2022 02:06:29 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/module.audio-video.asf.php
r52254 r54376 21 21 class getid3_asf extends getid3_handler 22 22 { 23 protected static $ASFIndexParametersObjectIndexSpecifiersIndexTypes = array( 24 1 => 'Nearest Past Data Packet', 25 2 => 'Nearest Past Media Object', 26 3 => 'Nearest Past Cleanpoint' 27 ); 28 29 protected static $ASFMediaObjectIndexParametersObjectIndexSpecifiersIndexTypes = array( 30 1 => 'Nearest Past Data Packet', 31 2 => 'Nearest Past Media Object', 32 3 => 'Nearest Past Cleanpoint', 33 0xFF => 'Frame Number Offset' 34 ); 35 36 protected static $ASFTimecodeIndexParametersObjectIndexSpecifiersIndexTypes = array( 37 2 => 'Nearest Past Media Object', 38 3 => 'Nearest Past Cleanpoint' 39 ); 40 23 41 /** 24 42 * @param getID3 $getid3 … … 318 336 // shortcut 319 337 $thisfile_asf['codec_list_object'] = array(); 338 /** @var mixed[] $thisfile_asf_codeclistobject */ 320 339 $thisfile_asf_codeclistobject = &$thisfile_asf['codec_list_object']; 321 340 … … 333 352 } 334 353 $thisfile_asf_codeclistobject['codec_entries_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); 354 if ($thisfile_asf_codeclistobject['codec_entries_count'] > 0) { 355 $thisfile_asf_codeclistobject['codec_entries'] = array(); 356 } 335 357 $offset += 4; 336 358 for ($CodecEntryCounter = 0; $CodecEntryCounter < $thisfile_asf_codeclistobject['codec_entries_count']; $CodecEntryCounter++) { … … 529 551 $thisfile_asf_markerobject['reserved_guid'] = $this->BytestringToGUID($thisfile_asf_markerobject['reserved']); 530 552 if ($thisfile_asf_markerobject['reserved'] != $this->GUIDtoBytestring('4CFEDB20-75F6-11CF-9C0F-00A0C90349CB')) { 531 $this->warning('marker_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_markerobject['reserved _1']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4CFEDB20-75F6-11CF-9C0F-00A0C90349CB}');553 $this->warning('marker_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_markerobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {4CFEDB20-75F6-11CF-9C0F-00A0C90349CB}'); 532 554 break; 533 555 } … … 649 671 650 672 default: 651 $this->warning('error_correction_object.error_correction_type GUID {'.$this->BytestringToGUID($thisfile_asf_errorcorrectionobject[' reserved']).'} does not match expected "GETID3_ASF_No_Error_Correction" GUID {'.$this->BytestringToGUID(GETID3_ASF_No_Error_Correction).'} or "GETID3_ASF_Audio_Spread" GUID {'.$this->BytestringToGUID(GETID3_ASF_Audio_Spread).'}');673 $this->warning('error_correction_object.error_correction_type GUID {'.$this->BytestringToGUID($thisfile_asf_errorcorrectionobject['error_correction_type']).'} does not match expected "GETID3_ASF_No_Error_Correction" GUID {'.$this->BytestringToGUID(GETID3_ASF_No_Error_Correction).'} or "GETID3_ASF_Audio_Spread" GUID {'.$this->BytestringToGUID(GETID3_ASF_Audio_Spread).'}'); 652 674 //return false; 653 675 break; … … 1443 1465 } 1444 1466 } 1445 $info['bitrate'] = (isset($thisfile_audio['bitrate']) ? $thisfile_audio['bitrate'] : 0) + (isset($thisfile_video['bitrate']) ? $thisfile_video['bitrate'] : 0);1467 $info['bitrate'] = 0 + (isset($thisfile_audio['bitrate']) ? $thisfile_audio['bitrate'] : 0) + (isset($thisfile_video['bitrate']) ? $thisfile_video['bitrate'] : 0); 1446 1468 1447 1469 if ((!isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) { … … 1578 1600 'GETID3_ASF_Media_Object_Index_Object' => 'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C', 1579 1601 'GETID3_ASF_Alt_Extended_Content_Encryption_Obj' => 'FF889EF1-ADEE-40DA-9E71-98704BB928CE', 1580 'GETID3_ASF_Index_Placeholder_Object' => 'D9AADE20-7C17-4F9C-BC28-8555DD98E2A2', // http://cpan.uwinnipeg.ca/htdocs/Audio-WMA/Audio/WMA.pm.html 1581 'GETID3_ASF_Compatibility_Object' => '26F18B5D-4584-47EC-9F5F-0E651F0452C9', // http://cpan.uwinnipeg.ca/htdocs/Audio-WMA/Audio/WMA.pm.html 1602 'GETID3_ASF_Index_Placeholder_Object' => 'D9AADE20-7C17-4F9C-BC28-8555DD98E2A2', // https://metacpan.org/dist/Audio-WMA/source/WMA.pm 1603 'GETID3_ASF_Compatibility_Object' => '26F18B5D-4584-47EC-9F5F-0E651F0452C9', // https://metacpan.org/dist/Audio-WMA/source/WMA.pm 1604 'GETID3_ASF_Media_Object_Index_Parameters_Object'=> '6B203BAD-3F11-48E4-ACA8-D7613DE2CFA7', 1582 1605 ); 1583 1606 return $GUIDarray; … … 1742 1765 */ 1743 1766 public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) { 1744 // http ://msdn.microsoft.com/en-us/library/bb643323.aspx1767 // https://web.archive.org/web/20140419205228/http://msdn.microsoft.com/en-us/library/bb643323.aspx 1745 1768 1746 1769 $offset = 0; … … 1806 1829 $offset += 2; 1807 1830 1808 $thisObject['average_time_per_frame'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));1809 $offset += 4;1831 $thisObject['average_time_per_frame'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); 1832 $offset += 8; 1810 1833 1811 1834 $thisObject['stream_name_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); … … 1824 1847 $offset += 2; 1825 1848 1826 $streamName['stream_name'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $streamName['stream_name_length']));1849 $streamName['stream_name'] = substr($asf_header_extension_object_data, $offset, $streamName['stream_name_length']); 1827 1850 $offset += $streamName['stream_name_length']; 1828 1851 … … 1846 1869 $offset += 4; 1847 1870 1848 $payloadExtensionSystem['extension_system_info _length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $payloadExtensionSystem['extension_system_info_length']));1871 $payloadExtensionSystem['extension_system_info'] = substr($asf_header_extension_object_data, $offset, $payloadExtensionSystem['extension_system_info_length']); 1849 1872 $offset += $payloadExtensionSystem['extension_system_info_length']; 1850 1873 1851 1874 $thisObject['payload_extension_systems'][$i] = $payloadExtensionSystem; 1875 } 1876 1877 break; 1878 1879 case GETID3_ASF_Advanced_Mutual_Exclusion_Object: 1880 $thisObject['exclusion_type'] = substr($asf_header_extension_object_data, $offset, 16); 1881 $offset += 16; 1882 $thisObject['exclusion_type_text'] = $this->BytestringToGUID($thisObject['exclusion_type']); 1883 1884 $thisObject['stream_numbers_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 1885 $offset += 2; 1886 1887 for ($i = 0; $i < $thisObject['stream_numbers_count']; $i++) { 1888 $thisObject['stream_numbers'][$i] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 1889 $offset += 2; 1890 } 1891 1892 break; 1893 1894 case GETID3_ASF_Stream_Prioritization_Object: 1895 $thisObject['priority_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 1896 $offset += 2; 1897 1898 for ($i = 0; $i < $thisObject['priority_records_count']; $i++) { 1899 $priorityRecord = array(); 1900 1901 $priorityRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 1902 $offset += 2; 1903 1904 $priorityRecord['flags_raw'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 1905 $offset += 2; 1906 $priorityRecord['flags']['mandatory'] = (bool) $priorityRecord['flags_raw'] & 0x00000001; 1907 1908 $thisObject['priority_records'][$i] = $priorityRecord; 1852 1909 } 1853 1910 … … 1969 2026 $thisObject['description_record'][$i] = $descriptionRecord; 1970 2027 } 2028 break; 2029 2030 case GETID3_ASF_Index_Parameters_Object: 2031 $thisObject['index_entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); 2032 $offset += 4; 2033 2034 $thisObject['index_specifiers_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 2035 $offset += 2; 2036 2037 for ($i = 0; $i < $thisObject['index_specifiers_count']; $i++) { 2038 $indexSpecifier = array(); 2039 2040 $indexSpecifier['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 2041 $offset += 2; 2042 2043 $indexSpecifier['index_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 2044 $offset += 2; 2045 $indexSpecifier['index_type_text'] = isset(static::$ASFIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']]) 2046 ? static::$ASFIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']] 2047 : 'invalid' 2048 ; 2049 2050 $thisObject['index_specifiers'][$i] = $indexSpecifier; 2051 } 2052 2053 break; 2054 2055 case GETID3_ASF_Media_Object_Index_Parameters_Object: 2056 $thisObject['index_entry_count_interval'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); 2057 $offset += 4; 2058 2059 $thisObject['index_specifiers_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 2060 $offset += 2; 2061 2062 for ($i = 0; $i < $thisObject['index_specifiers_count']; $i++) { 2063 $indexSpecifier = array(); 2064 2065 $indexSpecifier['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 2066 $offset += 2; 2067 2068 $indexSpecifier['index_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 2069 $offset += 2; 2070 $indexSpecifier['index_type_text'] = isset(static::$ASFMediaObjectIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']]) 2071 ? static::$ASFMediaObjectIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']] 2072 : 'invalid' 2073 ; 2074 2075 $thisObject['index_specifiers'][$i] = $indexSpecifier; 2076 } 2077 2078 break; 2079 2080 case GETID3_ASF_Timecode_Index_Parameters_Object: 2081 // 4.11 Timecode Index Parameters Object (mandatory only if TIMECODE index is present in file, 0 or 1) 2082 // Field name Field type Size (bits) 2083 // Object ID GUID 128 // GUID for the Timecode Index Parameters Object - ASF_Timecode_Index_Parameters_Object 2084 // Object Size QWORD 64 // Specifies the size, in bytes, of the Timecode Index Parameters Object. Valid values are at least 34 bytes. 2085 // Index Entry Count Interval DWORD 32 // This value is ignored for the Timecode Index Parameters Object. 2086 // Index Specifiers Count WORD 16 // Specifies the number of entries in the Index Specifiers list. Valid values are 1 and greater. 2087 // Index Specifiers array of: varies // 2088 // * Stream Number WORD 16 // Specifies the stream number that the Index Specifiers refer to. Valid values are between 1 and 127. 2089 // * Index Type WORD 16 // Specifies the type of index. Values are defined as follows (1 is not a valid value): 2090 // 2 = Nearest Past Media Object - indexes point to the closest data packet containing an entire video frame or the first fragment of a video frame 2091 // 3 = Nearest Past Cleanpoint - indexes point to the closest data packet containing an entire video frame (or first fragment of a video frame) that is a key frame. 2092 // Nearest Past Media Object is the most common value 2093 2094 $thisObject['index_entry_count_interval'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); 2095 $offset += 4; 2096 2097 $thisObject['index_specifiers_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 2098 $offset += 2; 2099 2100 for ($i = 0; $i < $thisObject['index_specifiers_count']; $i++) { 2101 $indexSpecifier = array(); 2102 2103 $indexSpecifier['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 2104 $offset += 2; 2105 2106 $indexSpecifier['index_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); 2107 $offset += 2; 2108 $indexSpecifier['index_type_text'] = isset(static::$ASFTimecodeIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']]) 2109 ? static::$ASFTimecodeIndexParametersObjectIndexSpecifiersIndexTypes[$indexSpecifier['index_type']] 2110 : 'invalid' 2111 ; 2112 2113 $thisObject['index_specifiers'][$i] = $indexSpecifier; 2114 } 2115 2116 break; 2117 2118 case GETID3_ASF_Compatibility_Object: 2119 $thisObject['profile'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1)); 2120 $offset += 1; 2121 2122 $thisObject['mode'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1)); 2123 $offset += 1; 2124 1971 2125 break; 1972 2126
Note: See TracChangeset
for help on using the changeset viewer.