wp/wp-includes/ID3/module.audio-video.asf.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
    18 }
    18 }
    19 getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
    19 getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.riff.php', __FILE__, true);
    20 
    20 
    21 class getid3_asf extends getid3_handler
    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 	 * @param getID3 $getid3
    42 	 * @param getID3 $getid3
    25 	 */
    43 	 */
    26 	public function __construct(getID3 $getid3) {
    44 	public function __construct(getID3 $getid3) {
    27 		parent::__construct($getid3);  // extends getid3_handler::__construct()
    45 		parent::__construct($getid3);  // extends getid3_handler::__construct()
   173 
   191 
   174 						// broadcast flag NOT set, perform calculations
   192 						// broadcast flag NOT set, perform calculations
   175 						$info['playtime_seconds'] = ($thisfile_asf_filepropertiesobject['play_duration'] / 10000000) - ($thisfile_asf_filepropertiesobject['preroll'] / 1000);
   193 						$info['playtime_seconds'] = ($thisfile_asf_filepropertiesobject['play_duration'] / 10000000) - ($thisfile_asf_filepropertiesobject['preroll'] / 1000);
   176 
   194 
   177 						//$info['bitrate'] = $thisfile_asf_filepropertiesobject['max_bitrate'];
   195 						//$info['bitrate'] = $thisfile_asf_filepropertiesobject['max_bitrate'];
   178 						$info['bitrate'] = ((isset($thisfile_asf_filepropertiesobject['filesize']) ? $thisfile_asf_filepropertiesobject['filesize'] : $info['filesize']) * 8) / $info['playtime_seconds'];
   196 						$info['bitrate'] = getid3_lib::SafeDiv($thisfile_asf_filepropertiesobject['filesize'] * 8, $info['playtime_seconds']);
   179 					}
   197 					}
   180 					break;
   198 					break;
   181 
   199 
   182 				case GETID3_ASF_Stream_Properties_Object:
   200 				case GETID3_ASF_Stream_Properties_Object:
   183 					// Stream Properties Object: (mandatory, one per media stream)
   201 					// Stream Properties Object: (mandatory, one per media stream)
   315 					// * Codec Information Length   WORD         16              // number of Unicode characters stored in the Codec Information field
   333 					// * Codec Information Length   WORD         16              // number of Unicode characters stored in the Codec Information field
   316 					// * Codec Information          BYTESTREAM   variable        // opaque array of information bytes about the codec used to create the content
   334 					// * Codec Information          BYTESTREAM   variable        // opaque array of information bytes about the codec used to create the content
   317 
   335 
   318 					// shortcut
   336 					// shortcut
   319 					$thisfile_asf['codec_list_object'] = array();
   337 					$thisfile_asf['codec_list_object'] = array();
       
   338 					/** @var mixed[] $thisfile_asf_codeclistobject */
   320 					$thisfile_asf_codeclistobject      = &$thisfile_asf['codec_list_object'];
   339 					$thisfile_asf_codeclistobject      = &$thisfile_asf['codec_list_object'];
   321 
   340 
   322 					$thisfile_asf_codeclistobject['offset']                    = $NextObjectOffset + $offset;
   341 					$thisfile_asf_codeclistobject['offset']                    = $NextObjectOffset + $offset;
   323 					$thisfile_asf_codeclistobject['objectid']                  = $NextObjectGUID;
   342 					$thisfile_asf_codeclistobject['objectid']                  = $NextObjectGUID;
   324 					$thisfile_asf_codeclistobject['objectid_guid']             = $NextObjectGUIDtext;
   343 					$thisfile_asf_codeclistobject['objectid_guid']             = $NextObjectGUIDtext;
   330 						$this->warning('codec_list_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {86D15241-311D-11D0-A3A4-00A0C90348F6}');
   349 						$this->warning('codec_list_object.reserved GUID {'.$this->BytestringToGUID($thisfile_asf_codeclistobject['reserved']).'} does not match expected "GETID3_ASF_Reserved_1" GUID {86D15241-311D-11D0-A3A4-00A0C90348F6}');
   331 						//return false;
   350 						//return false;
   332 						break;
   351 						break;
   333 					}
   352 					}
   334 					$thisfile_asf_codeclistobject['codec_entries_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
   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 					$offset += 4;
   357 					$offset += 4;
   336 					for ($CodecEntryCounter = 0; $CodecEntryCounter < $thisfile_asf_codeclistobject['codec_entries_count']; $CodecEntryCounter++) {
   358 					for ($CodecEntryCounter = 0; $CodecEntryCounter < $thisfile_asf_codeclistobject['codec_entries_count']; $CodecEntryCounter++) {
   337 						// shortcut
   359 						// shortcut
   338 						$thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter] = array();
   360 						$thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter] = array();
   339 						$thisfile_asf_codeclistobject_codecentries_current = &$thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter];
   361 						$thisfile_asf_codeclistobject_codecentries_current = &$thisfile_asf_codeclistobject['codec_entries'][$CodecEntryCounter];
   526 					$thisfile_asf_markerobject['objectsize']           = $NextObjectSize;
   548 					$thisfile_asf_markerobject['objectsize']           = $NextObjectSize;
   527 					$thisfile_asf_markerobject['reserved']             = substr($ASFHeaderData, $offset, 16);
   549 					$thisfile_asf_markerobject['reserved']             = substr($ASFHeaderData, $offset, 16);
   528 					$offset += 16;
   550 					$offset += 16;
   529 					$thisfile_asf_markerobject['reserved_guid']        = $this->BytestringToGUID($thisfile_asf_markerobject['reserved']);
   551 					$thisfile_asf_markerobject['reserved_guid']        = $this->BytestringToGUID($thisfile_asf_markerobject['reserved']);
   530 					if ($thisfile_asf_markerobject['reserved'] != $this->GUIDtoBytestring('4CFEDB20-75F6-11CF-9C0F-00A0C90349CB')) {
   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 						break;
   554 						break;
   533 					}
   555 					}
   534 					$thisfile_asf_markerobject['markers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
   556 					$thisfile_asf_markerobject['markers_count'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
   535 					$offset += 4;
   557 					$offset += 4;
   536 					$thisfile_asf_markerobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
   558 					$thisfile_asf_markerobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
   646 							$thisfile_asf_errorcorrectionobject['silence_data']          = substr($ASFHeaderData, $offset, $thisfile_asf_errorcorrectionobject['silence_data_length']);
   668 							$thisfile_asf_errorcorrectionobject['silence_data']          = substr($ASFHeaderData, $offset, $thisfile_asf_errorcorrectionobject['silence_data_length']);
   647 							$offset += $thisfile_asf_errorcorrectionobject['silence_data_length'];
   669 							$offset += $thisfile_asf_errorcorrectionobject['silence_data_length'];
   648 							break;
   670 							break;
   649 
   671 
   650 						default:
   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 							//return false;
   674 							//return false;
   653 							break;
   675 							break;
   654 					}
   676 					}
   655 
   677 
   656 					break;
   678 					break;
  1042 							case 0x0163: // WMA9 Lossless
  1064 							case 0x0163: // WMA9 Lossless
  1043 								$thisfile_audio['lossless'] = true;
  1065 								$thisfile_audio['lossless'] = true;
  1044 								break;
  1066 								break;
  1045 						}
  1067 						}
  1046 
  1068 
  1047 						if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
  1069 						if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { // @phpstan-ignore-line
  1048 							foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
  1070 							foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
  1049 								if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
  1071 								if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
  1050 									$thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate'];
  1072 									$thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate'];
  1051 									$thisfile_audio['bitrate'] += $dataarray['bitrate'];
  1073 									$thisfile_audio['bitrate'] += $dataarray['bitrate'];
  1052 									break;
  1074 									break;
  1128 						$videomediaoffset += 4;
  1150 						$videomediaoffset += 4;
  1129 						$thisfile_asf_videomedia_currentstream['format_data']['colors_important'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
  1151 						$thisfile_asf_videomedia_currentstream['format_data']['colors_important'] = getid3_lib::LittleEndian2Int(substr($streamdata['type_specific_data'], $videomediaoffset, 4));
  1130 						$videomediaoffset += 4;
  1152 						$videomediaoffset += 4;
  1131 						$thisfile_asf_videomedia_currentstream['format_data']['codec_data']       = substr($streamdata['type_specific_data'], $videomediaoffset);
  1153 						$thisfile_asf_videomedia_currentstream['format_data']['codec_data']       = substr($streamdata['type_specific_data'], $videomediaoffset);
  1132 
  1154 
  1133 						if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
  1155 						if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { // @phpstan-ignore-line
  1134 							foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
  1156 							foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
  1135 								if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
  1157 								if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
  1136 									$thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate'];
  1158 									$thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate'];
  1137 									$thisfile_video['streams'][$streamnumber]['bitrate'] = $dataarray['bitrate'];
  1159 									$thisfile_video['streams'][$streamnumber]['bitrate'] = $dataarray['bitrate'];
  1138 									$thisfile_video['bitrate'] += $dataarray['bitrate'];
  1160 									$thisfile_video['bitrate'] += $dataarray['bitrate'];
  1440 					$thisfile_video['resolution_x'] = $valuearray['resolution_x'];
  1462 					$thisfile_video['resolution_x'] = $valuearray['resolution_x'];
  1441 					$thisfile_video['resolution_y'] = $valuearray['resolution_y'];
  1463 					$thisfile_video['resolution_y'] = $valuearray['resolution_y'];
  1442 				}
  1464 				}
  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 		if ((!isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) {
  1469 		if ((!isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) {
  1448 			$info['playtime_seconds'] = ($info['filesize'] - $info['avdataoffset']) / ($info['bitrate'] / 8);
  1470 			$info['playtime_seconds'] = ($info['filesize'] - $info['avdataoffset']) / ($info['bitrate'] / 8);
  1449 		}
  1471 		}
  1450 
  1472 
  1575 			'GETID3_ASF_Marker_Object'                       => 'F487CD01-A951-11CF-8EE6-00C00C205365',
  1597 			'GETID3_ASF_Marker_Object'                       => 'F487CD01-A951-11CF-8EE6-00C00C205365',
  1576 			'GETID3_ASF_Timecode_Index_Parameters_Object'    => 'F55E496D-9797-4B5D-8C8B-604DFE9BFB24',
  1598 			'GETID3_ASF_Timecode_Index_Parameters_Object'    => 'F55E496D-9797-4B5D-8C8B-604DFE9BFB24',
  1577 			'GETID3_ASF_Audio_Media'                         => 'F8699E40-5B4D-11CF-A8FD-00805F5C442B',
  1599 			'GETID3_ASF_Audio_Media'                         => 'F8699E40-5B4D-11CF-A8FD-00805F5C442B',
  1578 			'GETID3_ASF_Media_Object_Index_Object'           => 'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C',
  1600 			'GETID3_ASF_Media_Object_Index_Object'           => 'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C',
  1579 			'GETID3_ASF_Alt_Extended_Content_Encryption_Obj' => 'FF889EF1-ADEE-40DA-9E71-98704BB928CE',
  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
  1602 			'GETID3_ASF_Index_Placeholder_Object'            => 'D9AADE20-7C17-4F9C-BC28-8555DD98E2A2', // https://metacpan.org/dist/Audio-WMA/source/WMA.pm
  1581 			'GETID3_ASF_Compatibility_Object'                => '26F18B5D-4584-47EC-9F5F-0E651F0452C9', // http://cpan.uwinnipeg.ca/htdocs/Audio-WMA/Audio/WMA.pm.html
  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 		return $GUIDarray;
  1606 		return $GUIDarray;
  1584 	}
  1607 	}
  1585 
  1608 
  1586 	/**
  1609 	/**
  1739 	 * @param int    $unhandled_sections
  1762 	 * @param int    $unhandled_sections
  1740 	 *
  1763 	 *
  1741 	 * @return array
  1764 	 * @return array
  1742 	 */
  1765 	 */
  1743 	public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
  1766 	public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
  1744 		// http://msdn.microsoft.com/en-us/library/bb643323.aspx
  1767 		// https://web.archive.org/web/20140419205228/http://msdn.microsoft.com/en-us/library/bb643323.aspx
  1745 
  1768 
  1746 		$offset = 0;
  1769 		$offset = 0;
  1747 		$objectOffset = 0;
  1770 		$objectOffset = 0;
  1748 		$HeaderExtensionObjectParsed = array();
  1771 		$HeaderExtensionObjectParsed = array();
  1749 		while ($objectOffset < strlen($asf_header_extension_object_data)) {
  1772 		while ($objectOffset < strlen($asf_header_extension_object_data)) {
  1803 					$offset += 2;
  1826 					$offset += 2;
  1804 
  1827 
  1805 					$thisObject['stream_language_id_index']          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
  1828 					$thisObject['stream_language_id_index']          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
  1806 					$offset += 2;
  1829 					$offset += 2;
  1807 
  1830 
  1808 					$thisObject['average_time_per_frame']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
  1831 					$thisObject['average_time_per_frame']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  8));
  1809 					$offset += 4;
  1832 					$offset += 8;
  1810 
  1833 
  1811 					$thisObject['stream_name_count']                 = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
  1834 					$thisObject['stream_name_count']                 = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
  1812 					$offset += 2;
  1835 					$offset += 2;
  1813 
  1836 
  1814 					$thisObject['payload_extension_system_count']    = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
  1837 					$thisObject['payload_extension_system_count']    = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
  1821 						$offset += 2;
  1844 						$offset += 2;
  1822 
  1845 
  1823 						$streamName['stream_name_length']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
  1846 						$streamName['stream_name_length']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
  1824 						$offset += 2;
  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 						$offset += $streamName['stream_name_length'];
  1850 						$offset += $streamName['stream_name_length'];
  1828 
  1851 
  1829 						$thisObject['stream_names'][$i] = $streamName;
  1852 						$thisObject['stream_names'][$i] = $streamName;
  1830 					}
  1853 					}
  1831 
  1854 
  1843 						}
  1866 						}
  1844 
  1867 
  1845 						$payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
  1868 						$payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
  1846 						$offset += 4;
  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 						$offset += $payloadExtensionSystem['extension_system_info_length'];
  1872 						$offset += $payloadExtensionSystem['extension_system_info_length'];
  1850 
  1873 
  1851 						$thisObject['payload_extension_systems'][$i] = $payloadExtensionSystem;
  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 
  1854 					break;
  1911 					break;
  1855 
  1912 
  1856 				case GETID3_ASF_Padding_Object:
  1913 				case GETID3_ASF_Padding_Object:
  1966 							unset($WMpicture);
  2023 							unset($WMpicture);
  1967 						}
  2024 						}
  1968 
  2025 
  1969 						$thisObject['description_record'][$i] = $descriptionRecord;
  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 					break;
  2125 					break;
  1972 
  2126 
  1973 				default:
  2127 				default:
  1974 					$unhandled_sections++;
  2128 					$unhandled_sections++;
  1975 					if ($this->GUIDname($thisObject['guid_text'])) {
  2129 					if ($this->GUIDname($thisObject['guid_text'])) {