WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

getid3_asf::HeaderExtensionObjectDataParse() public WP 1.0

Это метод класса: getid3_asf{}

Хуков нет.

Возвращает

Массив.

Использование

$getid3_asf = new getid3_asf();
$getid3_asf->HeaderExtensionObjectDataParse( $asf_header_extension_object_data, $unhandled_sections );
$asf_header_extension_object_data(строка) (обязательный) (передается по ссылке — &)
$unhandled_sections(число) (обязательный) (передается по ссылке — &)

Код getid3_asf::HeaderExtensionObjectDataParse() WP 5.5.1

wp-includes/ID3/module.audio-video.asf.php
<?php
public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) {
	// http://msdn.microsoft.com/en-us/library/bb643323.aspx

	$offset = 0;
	$objectOffset = 0;
	$HeaderExtensionObjectParsed = array();
	while ($objectOffset < strlen($asf_header_extension_object_data)) {
		$offset = $objectOffset;
		$thisObject = array();

		$thisObject['guid']                              =                              substr($asf_header_extension_object_data, $offset, 16);
		$offset += 16;
		$thisObject['guid_text'] = $this->BytestringToGUID($thisObject['guid']);
		$thisObject['guid_name'] = $this->GUIDname($thisObject['guid_text']);

		$thisObject['size']                              = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  8));
		$offset += 8;
		if ($thisObject['size'] <= 0) {
			break;
		}

		switch ($thisObject['guid']) {
			case GETID3_ASF_Extended_Stream_Properties_Object:
				$thisObject['start_time']                        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  8));
				$offset += 8;
				$thisObject['start_time_unix']                   = $this->FILETIMEtoUNIXtime($thisObject['start_time']);

				$thisObject['end_time']                          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  8));
				$offset += 8;
				$thisObject['end_time_unix']                     = $this->FILETIMEtoUNIXtime($thisObject['end_time']);

				$thisObject['data_bitrate']                      = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
				$offset += 4;

				$thisObject['buffer_size']                       = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
				$offset += 4;

				$thisObject['initial_buffer_fullness']           = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
				$offset += 4;

				$thisObject['alternate_data_bitrate']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
				$offset += 4;

				$thisObject['alternate_buffer_size']             = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
				$offset += 4;

				$thisObject['alternate_initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
				$offset += 4;

				$thisObject['maximum_object_size']               = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
				$offset += 4;

				$thisObject['flags_raw']                         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
				$offset += 4;
				$thisObject['flags']['reliable']                = (bool) $thisObject['flags_raw'] & 0x00000001;
				$thisObject['flags']['seekable']                = (bool) $thisObject['flags_raw'] & 0x00000002;
				$thisObject['flags']['no_cleanpoints']          = (bool) $thisObject['flags_raw'] & 0x00000004;
				$thisObject['flags']['resend_live_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000008;

				$thisObject['stream_number']                     = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
				$offset += 2;

				$thisObject['stream_language_id_index']          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
				$offset += 2;

				$thisObject['average_time_per_frame']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
				$offset += 4;

				$thisObject['stream_name_count']                 = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
				$offset += 2;

				$thisObject['payload_extension_system_count']    = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
				$offset += 2;

				for ($i = 0; $i < $thisObject['stream_name_count']; $i++) {
					$streamName = array();

					$streamName['language_id_index']             = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
					$offset += 2;

					$streamName['stream_name_length']            = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
					$offset += 2;

					$streamName['stream_name']                   = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  $streamName['stream_name_length']));
					$offset += $streamName['stream_name_length'];

					$thisObject['stream_names'][$i] = $streamName;
				}

				for ($i = 0; $i < $thisObject['payload_extension_system_count']; $i++) {
					$payloadExtensionSystem = array();

					$payloadExtensionSystem['extension_system_id']   =                              substr($asf_header_extension_object_data, $offset, 16);
					$offset += 16;
					$payloadExtensionSystem['extension_system_id_text'] = $this->BytestringToGUID($payloadExtensionSystem['extension_system_id']);

					$payloadExtensionSystem['extension_system_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
					$offset += 2;
					if ($payloadExtensionSystem['extension_system_size'] <= 0) {
						break 2;
					}

					$payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
					$offset += 4;

					$payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  $payloadExtensionSystem['extension_system_info_length']));
					$offset += $payloadExtensionSystem['extension_system_info_length'];

					$thisObject['payload_extension_systems'][$i] = $payloadExtensionSystem;
				}

				break;

			case GETID3_ASF_Padding_Object:
				// padding, skip it
				break;

			case GETID3_ASF_Metadata_Object:
				$thisObject['description_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
				$offset += 2;

				for ($i = 0; $i < $thisObject['description_record_counts']; $i++) {
					$descriptionRecord = array();

					$descriptionRecord['reserved_1']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2)); // must be zero
					$offset += 2;

					$descriptionRecord['stream_number']      = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
					$offset += 2;

					$descriptionRecord['name_length']        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
					$offset += 2;

					$descriptionRecord['data_type']          = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
					$offset += 2;
					$descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);

					$descriptionRecord['data_length']        = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
					$offset += 4;

					$descriptionRecord['name']               =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['name_length']);
					$offset += $descriptionRecord['name_length'];

					$descriptionRecord['data']               =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['data_length']);
					$offset += $descriptionRecord['data_length'];
					switch ($descriptionRecord['data_type']) {
						case 0x0000: // Unicode string
							break;

						case 0x0001: // BYTE array
							// do nothing
							break;

						case 0x0002: // BOOL
							$descriptionRecord['data'] = (bool) getid3_lib::LittleEndian2Int($descriptionRecord['data']);
							break;

						case 0x0003: // DWORD
						case 0x0004: // QWORD
						case 0x0005: // WORD
							$descriptionRecord['data'] = getid3_lib::LittleEndian2Int($descriptionRecord['data']);
							break;

						case 0x0006: // GUID
							$descriptionRecord['data_text'] = $this->BytestringToGUID($descriptionRecord['data']);
							break;
					}

					$thisObject['description_record'][$i] = $descriptionRecord;
				}
				break;

			case GETID3_ASF_Language_List_Object:
				$thisObject['language_id_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
				$offset += 2;

				for ($i = 0; $i < $thisObject['language_id_record_counts']; $i++) {
					$languageIDrecord = array();

					$languageIDrecord['language_id_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  1));
					$offset += 1;

					$languageIDrecord['language_id']                =                              substr($asf_header_extension_object_data, $offset,  $languageIDrecord['language_id_length']);
					$offset += $languageIDrecord['language_id_length'];

					$thisObject['language_id_record'][$i] = $languageIDrecord;
				}
				break;

			case GETID3_ASF_Metadata_Library_Object:
				$thisObject['description_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
				$offset += 2;

				for ($i = 0; $i < $thisObject['description_records_count']; $i++) {
					$descriptionRecord = array();

					$descriptionRecord['language_list_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
					$offset += 2;

					$descriptionRecord['stream_number']       = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
					$offset += 2;

					$descriptionRecord['name_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
					$offset += 2;

					$descriptionRecord['data_type']           = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  2));
					$offset += 2;
					$descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']);

					$descriptionRecord['data_length']         = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset,  4));
					$offset += 4;

					$descriptionRecord['name']                =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['name_length']);
					$offset += $descriptionRecord['name_length'];

					$descriptionRecord['data']                =                              substr($asf_header_extension_object_data, $offset,  $descriptionRecord['data_length']);
					$offset += $descriptionRecord['data_length'];

					if (preg_match('#^WM/Picture$#', str_replace("\x00", '', trim($descriptionRecord['name'])))) {
						$WMpicture = $this->ASF_WMpicture($descriptionRecord['data']);
						foreach ($WMpicture as $key => $value) {
							$descriptionRecord['data'] = $WMpicture;
						}
						unset($WMpicture);
					}

					$thisObject['description_record'][$i] = $descriptionRecord;
				}
				break;

			default:
				$unhandled_sections++;
				if ($this->GUIDname($thisObject['guid_text'])) {
					$this->warning('unhandled Header Extension Object GUID "'.$this->GUIDname($thisObject['guid_text']).'" {'.$thisObject['guid_text'].'} at offset '.($offset - 16 - 8));
				} else {
					$this->warning('unknown Header Extension Object GUID {'.$thisObject['guid_text'].'} in at offset '.($offset - 16 - 8));
				}
				break;
		}
		$HeaderExtensionObjectParsed[] = $thisObject;

		$objectOffset += $thisObject['size'];
	}
	return $HeaderExtensionObjectParsed;
}