156 parent::__construct($getid3);
158 $GUIDarray = self::KnownGUIDs();
159 foreach ($GUIDarray as $GUIDname => $hexstringvalue) {
160 if (property_exists($this, $GUIDname)) {
161 self::$$GUIDname = self::GUIDtoBytestring($hexstringvalue);
172 $info = &$this->getid3->info;
175 $thisfile_audio = &
$info[
'audio'];
176 $thisfile_video = &
$info[
'video'];
178 $thisfile_asf = &
$info[
'asf'];
179 $thisfile_asf[
'comments'] =
array();
180 $thisfile_asf_comments = &$thisfile_asf[
'comments'];
181 $thisfile_asf[
'header_object'] =
array();
182 $thisfile_asf_headerobject = &$thisfile_asf[
'header_object'];
203 $info[
'fileformat'] =
'asf';
205 fseek($this->getid3->fp,
$info[
'avdataoffset'], SEEK_SET);
206 $HeaderObjectData =
fread($this->getid3->fp, 30);
208 $thisfile_asf_headerobject[
'objectid'] = substr($HeaderObjectData, 0, 16);
209 $thisfile_asf_headerobject[
'objectid_guid'] = self::BytestringToGUID($thisfile_asf_headerobject[
'objectid']);
210 if ($thisfile_asf_headerobject[
'objectid'] != self::$GETID3_ASF_Header_Object) {
211 $info[
'warning'][] =
'ASF header GUID {' . self::BytestringToGUID($thisfile_asf_headerobject[
'objectid']) .
'} does not match expected "GETID3_ASF_Header_Object" GUID {' . self::BytestringToGUID(self::$GETID3_ASF_Header_Object) .
'}';
212 unset(
$info[
'fileformat']);
230 $NextObjectOffset =
ftell($this->getid3->fp);
231 $ASFHeaderData =
fread($this->getid3->fp,
232 $thisfile_asf_headerobject[
'objectsize'] - 30);
235 for ($HeaderObjectsCounter = 0;
236 $HeaderObjectsCounter < $thisfile_asf_headerobject[
'headerobjects'];
237 $HeaderObjectsCounter++) {
238 $NextObjectGUID = substr($ASFHeaderData, $offset, 16);
240 $NextObjectGUIDtext = self::BytestringToGUID($NextObjectGUID);
245 switch ($NextObjectGUID) {
247 case self::$GETID3_ASF_File_Properties_Object:
267 $thisfile_asf[
'file_properties_object'] =
array();
268 $thisfile_asf_filepropertiesobject = &$thisfile_asf[
'file_properties_object'];
270 $thisfile_asf_filepropertiesobject[
'offset'] = $NextObjectOffset + $offset;
271 $thisfile_asf_filepropertiesobject[
'objectid'] = $NextObjectGUID;
272 $thisfile_asf_filepropertiesobject[
'objectid_guid'] = $NextObjectGUIDtext;
273 $thisfile_asf_filepropertiesobject[
'objectsize'] = $NextObjectSize;
274 $thisfile_asf_filepropertiesobject[
'fileid'] = substr($ASFHeaderData,
278 $thisfile_asf_filepropertiesobject[
'fileid_guid'] = self::BytestringToGUID($thisfile_asf_filepropertiesobject[
'fileid']);
286 $thisfile_asf_filepropertiesobject[
'creation_date_unix'] = self::FILETIMEtoUNIXtime($thisfile_asf_filepropertiesobject[
'creation_date']);
308 $thisfile_asf_filepropertiesobject[
'flags'][
'broadcast'] = (bool) ($thisfile_asf_filepropertiesobject[
'flags_raw'] & 0x0001);
309 $thisfile_asf_filepropertiesobject[
'flags'][
'seekable'] = (bool) ($thisfile_asf_filepropertiesobject[
'flags_raw'] & 0x0002);
324 if ($thisfile_asf_filepropertiesobject[
'flags'][
'broadcast']) {
327 unset($thisfile_asf_filepropertiesobject[
'filesize']);
328 unset($thisfile_asf_filepropertiesobject[
'data_packets']);
329 unset($thisfile_asf_filepropertiesobject[
'play_duration']);
330 unset($thisfile_asf_filepropertiesobject[
'send_duration']);
331 unset($thisfile_asf_filepropertiesobject[
'min_packet_size']);
332 unset($thisfile_asf_filepropertiesobject[
'max_packet_size']);
336 $info[
'playtime_seconds'] = ($thisfile_asf_filepropertiesobject[
'play_duration'] / 10000000) - ($thisfile_asf_filepropertiesobject[
'preroll'] / 1000);
339 $info[
'bitrate'] = ((isset($thisfile_asf_filepropertiesobject[
'filesize']) ? $thisfile_asf_filepropertiesobject[
'filesize'] :
$info[
'filesize']) * 8) /
$info[
'playtime_seconds'];
343 case self::$GETID3_ASF_Stream_Properties_Object:
363 $StreamPropertiesObjectData =
array();
364 $StreamPropertiesObjectData[
'offset'] = $NextObjectOffset + $offset;
365 $StreamPropertiesObjectData[
'objectid'] = $NextObjectGUID;
366 $StreamPropertiesObjectData[
'objectid_guid'] = $NextObjectGUIDtext;
367 $StreamPropertiesObjectData[
'objectsize'] = $NextObjectSize;
368 $StreamPropertiesObjectData[
'stream_type'] = substr($ASFHeaderData,
372 $StreamPropertiesObjectData[
'stream_type_guid'] = self::BytestringToGUID($StreamPropertiesObjectData[
'stream_type']);
373 $StreamPropertiesObjectData[
'error_correct_type'] = substr($ASFHeaderData,
377 $StreamPropertiesObjectData[
'error_correct_guid'] = self::BytestringToGUID($StreamPropertiesObjectData[
'error_correct_type']);
394 $StreamPropertiesObjectStreamNumber = $StreamPropertiesObjectData[
'flags_raw'] & 0x007F;
395 $StreamPropertiesObjectData[
'flags'][
'encrypted'] = (bool) ($StreamPropertiesObjectData[
'flags_raw'] & 0x8000);
398 $StreamPropertiesObjectData[
'type_specific_data'] = substr($ASFHeaderData,
400 $StreamPropertiesObjectData[
'type_data_length']);
401 $offset += $StreamPropertiesObjectData[
'type_data_length'];
402 $StreamPropertiesObjectData[
'error_correct_data'] = substr($ASFHeaderData,
404 $StreamPropertiesObjectData[
'error_data_length']);
405 $offset += $StreamPropertiesObjectData[
'error_data_length'];
407 switch ($StreamPropertiesObjectData[
'stream_type']) {
409 case self::$GETID3_ASF_Audio_Media:
410 $thisfile_audio[
'dataformat'] = (!empty($thisfile_audio[
'dataformat']) ? $thisfile_audio[
'dataformat'] :
'asf');
411 $thisfile_audio[
'bitrate_mode'] = (!empty($thisfile_audio[
'bitrate_mode']) ? $thisfile_audio[
'bitrate_mode'] :
'cbr');
416 unset($audiodata[
'raw']);
421 case self::$GETID3_ASF_Video_Media:
422 $thisfile_video[
'dataformat'] = (!empty($thisfile_video[
'dataformat']) ? $thisfile_video[
'dataformat'] :
'asf');
423 $thisfile_video[
'bitrate_mode'] = (!empty($thisfile_video[
'bitrate_mode']) ? $thisfile_video[
'bitrate_mode'] :
'cbr');
426 case self::$GETID3_ASF_Command_Media:
432 $thisfile_asf[
'stream_properties_object'][$StreamPropertiesObjectStreamNumber] = $StreamPropertiesObjectData;
433 unset($StreamPropertiesObjectData);
436 case self::$GETID3_ASF_Header_Extension_Object:
446 $thisfile_asf[
'header_extension_object'] =
array();
447 $thisfile_asf_headerextensionobject = &$thisfile_asf[
'header_extension_object'];
449 $thisfile_asf_headerextensionobject[
'offset'] = $NextObjectOffset + $offset;
450 $thisfile_asf_headerextensionobject[
'objectid'] = $NextObjectGUID;
451 $thisfile_asf_headerextensionobject[
'objectid_guid'] = $NextObjectGUIDtext;
452 $thisfile_asf_headerextensionobject[
'objectsize'] = $NextObjectSize;
453 $thisfile_asf_headerextensionobject[
'reserved_1'] = substr($ASFHeaderData,
457 $thisfile_asf_headerextensionobject[
'reserved_1_guid'] = self::BytestringToGUID($thisfile_asf_headerextensionobject[
'reserved_1']);
458 if ($thisfile_asf_headerextensionobject[
'reserved_1'] != self::$GETID3_ASF_Reserved_1) {
459 $info[
'warning'][] =
'header_extension_object.reserved_1 GUID (' . self::BytestringToGUID($thisfile_asf_headerextensionobject[
'reserved_1']) .
') does not match expected "GETID3_ASF_Reserved_1" GUID (' . self::BytestringToGUID(self::$GETID3_ASF_Reserved_1) .
')';
467 if ($thisfile_asf_headerextensionobject[
'reserved_2'] != 6) {
468 $info[
'warning'][] =
'header_extension_object.reserved_2 (' .
Helper::PrintHexBytes($thisfile_asf_headerextensionobject[
'reserved_2']) .
') does not match expected value of "6"';
476 $thisfile_asf_headerextensionobject[
'extension_data'] = substr($ASFHeaderData,
478 $thisfile_asf_headerextensionobject[
'extension_data_size']);
479 $unhandled_sections = 0;
481 $unhandled_sections);
482 if ($unhandled_sections === 0) {
483 unset($thisfile_asf_headerextensionobject[
'extension_data']);
485 $offset += $thisfile_asf_headerextensionobject[
'extension_data_size'];
488 case self::$GETID3_ASF_Codec_List_Object:
504 $thisfile_asf[
'codec_list_object'] =
array();
505 $thisfile_asf_codeclistobject = &$thisfile_asf[
'codec_list_object'];
507 $thisfile_asf_codeclistobject[
'offset'] = $NextObjectOffset + $offset;
508 $thisfile_asf_codeclistobject[
'objectid'] = $NextObjectGUID;
509 $thisfile_asf_codeclistobject[
'objectid_guid'] = $NextObjectGUIDtext;
510 $thisfile_asf_codeclistobject[
'objectsize'] = $NextObjectSize;
511 $thisfile_asf_codeclistobject[
'reserved'] = substr($ASFHeaderData,
515 $thisfile_asf_codeclistobject[
'reserved_guid'] = self::BytestringToGUID($thisfile_asf_codeclistobject[
'reserved']);
516 if ($thisfile_asf_codeclistobject[
'reserved'] != self::GUIDtoBytestring(
'86D15241-311D-11D0-A3A4-00A0C90348F6')) {
517 $info[
'warning'][] =
'codec_list_object.reserved GUID {' . self::BytestringToGUID($thisfile_asf_codeclistobject[
'reserved']) .
'} does not match expected "GETID3_ASF_Reserved_1" GUID {86D15241-311D-11D0-A3A4-00A0C90348F6}';
525 for ($CodecEntryCounter = 0;
526 $CodecEntryCounter < $thisfile_asf_codeclistobject[
'codec_entries_count'];
527 $CodecEntryCounter++) {
529 $thisfile_asf_codeclistobject[
'codec_entries'][$CodecEntryCounter] =
array();
530 $thisfile_asf_codeclistobject_codecentries_current = &$thisfile_asf_codeclistobject[
'codec_entries'][$CodecEntryCounter];
536 $thisfile_asf_codeclistobject_codecentries_current[
'type'] = $this->
ASFCodecListObjectTypeLookup($thisfile_asf_codeclistobject_codecentries_current[
'type_raw']);
542 $thisfile_asf_codeclistobject_codecentries_current[
'name'] = substr($ASFHeaderData,
545 $offset += $CodecNameLength;
551 $thisfile_asf_codeclistobject_codecentries_current[
'description'] = substr($ASFHeaderData,
553 $CodecDescriptionLength);
554 $offset += $CodecDescriptionLength;
560 $thisfile_asf_codeclistobject_codecentries_current[
'information'] = substr($ASFHeaderData,
562 $CodecInformationLength);
563 $offset += $CodecInformationLength;
565 if ($thisfile_asf_codeclistobject_codecentries_current[
'type_raw'] == 2) {
566 if (strpos($thisfile_asf_codeclistobject_codecentries_current[
'description'],
568 $info[
'warning'][] =
'[asf][codec_list_object][codec_entries][' . $CodecEntryCounter .
'][description] expected to contain comma-seperated list of parameters: "' . $thisfile_asf_codeclistobject_codecentries_current[
'description'] .
'"';
571 list($AudioCodecBitrate, $AudioCodecFrequency, $AudioCodecChannels) = explode(
',',
572 self::TrimConvert($thisfile_asf_codeclistobject_codecentries_current[
'description']));
573 $thisfile_audio[
'codec'] = self::TrimConvert($thisfile_asf_codeclistobject_codecentries_current[
'name']);
575 if (!isset($thisfile_audio[
'bitrate']) && strstr($AudioCodecBitrate,
577 $thisfile_audio[
'bitrate'] = (int) (trim(str_replace(
'kbps',
579 $AudioCodecBitrate)) * 1000);
582 if (empty($thisfile_video[
'bitrate']) && !empty($thisfile_audio[
'bitrate']) && !empty(
$info[
'bitrate'])) {
584 $thisfile_video[
'bitrate'] =
$info[
'bitrate'] - $thisfile_audio[
'bitrate'];
587 $AudioCodecFrequency = (int) trim(str_replace(
'kHz',
589 $AudioCodecFrequency));
590 switch ($AudioCodecFrequency) {
593 $thisfile_audio[
'sample_rate'] = 8000;
598 $thisfile_audio[
'sample_rate'] = 11025;
603 $thisfile_audio[
'sample_rate'] = 12000;
608 $thisfile_audio[
'sample_rate'] = 16000;
613 $thisfile_audio[
'sample_rate'] = 22050;
618 $thisfile_audio[
'sample_rate'] = 24000;
623 $thisfile_audio[
'sample_rate'] = 32000;
628 $thisfile_audio[
'sample_rate'] = 44100;
633 $thisfile_audio[
'sample_rate'] = 48000;
637 $info[
'warning'][] =
'unknown frequency: "' . $AudioCodecFrequency .
'" (' . self::TrimConvert($thisfile_asf_codeclistobject_codecentries_current[
'description']) .
')';
641 if (!isset($thisfile_audio[
'channels'])) {
642 if (strstr($AudioCodecChannels,
'stereo')) {
643 $thisfile_audio[
'channels'] = 2;
644 } elseif (strstr($AudioCodecChannels,
'mono')) {
645 $thisfile_audio[
'channels'] = 1;
653 case self::$GETID3_ASF_Script_Command_Object:
670 $thisfile_asf[
'script_command_object'] =
array();
671 $thisfile_asf_scriptcommandobject = &$thisfile_asf[
'script_command_object'];
673 $thisfile_asf_scriptcommandobject[
'offset'] = $NextObjectOffset + $offset;
674 $thisfile_asf_scriptcommandobject[
'objectid'] = $NextObjectGUID;
675 $thisfile_asf_scriptcommandobject[
'objectid_guid'] = $NextObjectGUIDtext;
676 $thisfile_asf_scriptcommandobject[
'objectsize'] = $NextObjectSize;
677 $thisfile_asf_scriptcommandobject[
'reserved'] = substr($ASFHeaderData,
681 $thisfile_asf_scriptcommandobject[
'reserved_guid'] = self::BytestringToGUID($thisfile_asf_scriptcommandobject[
'reserved']);
682 if ($thisfile_asf_scriptcommandobject[
'reserved'] != self::GUIDtoBytestring(
'4B1ACBE3-100B-11D0-A39B-00A0C90348F6')) {
683 $info[
'warning'][] =
'script_command_object.reserved GUID {' . self::BytestringToGUID($thisfile_asf_scriptcommandobject[
'reserved']) .
'} does not match expected "GETID3_ASF_Reserved_1" GUID {4B1ACBE3-100B-11D0-A39B-00A0C90348F6}';
695 for ($CommandTypesCounter = 0;
696 $CommandTypesCounter < $thisfile_asf_scriptcommandobject[
'command_types_count'];
697 $CommandTypesCounter++) {
702 $thisfile_asf_scriptcommandobject[
'command_types'][$CommandTypesCounter][
'name'] = substr($ASFHeaderData,
704 $CommandTypeNameLength);
705 $offset += $CommandTypeNameLength;
707 for ($CommandsCounter = 0;
708 $CommandsCounter < $thisfile_asf_scriptcommandobject[
'commands_count'];
709 $CommandsCounter++) {
710 $thisfile_asf_scriptcommandobject[
'commands'][$CommandsCounter][
'presentation_time'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
714 $thisfile_asf_scriptcommandobject[
'commands'][$CommandsCounter][
'type_index'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
723 $thisfile_asf_scriptcommandobject[
'commands'][$CommandsCounter][
'name'] = substr($ASFHeaderData,
725 $CommandTypeNameLength);
726 $offset += $CommandTypeNameLength;
730 case self::$GETID3_ASF_Marker_Object:
750 $thisfile_asf[
'marker_object'] =
array();
751 $thisfile_asf_markerobject = &$thisfile_asf[
'marker_object'];
753 $thisfile_asf_markerobject[
'offset'] = $NextObjectOffset + $offset;
754 $thisfile_asf_markerobject[
'objectid'] = $NextObjectGUID;
755 $thisfile_asf_markerobject[
'objectid_guid'] = $NextObjectGUIDtext;
756 $thisfile_asf_markerobject[
'objectsize'] = $NextObjectSize;
757 $thisfile_asf_markerobject[
'reserved'] = substr($ASFHeaderData,
760 $thisfile_asf_markerobject[
'reserved_guid'] = self::BytestringToGUID($thisfile_asf_markerobject[
'reserved']);
761 if ($thisfile_asf_markerobject[
'reserved'] != self::GUIDtoBytestring(
'4CFEDB20-75F6-11CF-9C0F-00A0C90349CB')) {
762 $info[
'warning'][] =
'marker_object.reserved GUID {' . self::BytestringToGUID($thisfile_asf_markerobject[
'reserved_1']) .
'} does not match expected "GETID3_ASF_Reserved_1" GUID {4CFEDB20-75F6-11CF-9C0F-00A0C90349CB}';
773 if ($thisfile_asf_markerobject[
'reserved_2'] != 0) {
774 $info[
'warning'][] =
'marker_object.reserved_2 (' .
Helper::PrintHexBytes($thisfile_asf_markerobject[
'reserved_2']) .
') does not match expected value of "0"';
781 $thisfile_asf_markerobject[
'name'] = substr($ASFHeaderData,
783 $thisfile_asf_markerobject[
'name_length']);
784 $offset += $thisfile_asf_markerobject[
'name_length'];
785 for ($MarkersCounter = 0;
786 $MarkersCounter < $thisfile_asf_markerobject[
'markers_count'];
792 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'presentation_time'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
796 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'entry_length'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
800 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'send_time'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
808 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'marker_description_length'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
812 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'marker_description'] = substr($ASFHeaderData,
814 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'marker_description_length']);
815 $offset += $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'marker_description_length'];
816 $PaddingLength = $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'entry_length'] - 4 - 4 - 4 - $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'marker_description_length'];
817 if ($PaddingLength > 0) {
818 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'padding'] = substr($ASFHeaderData,
821 $offset += $PaddingLength;
826 case self::$GETID3_ASF_Bitrate_Mutual_Exclusion_Object:
835 $thisfile_asf[
'bitrate_mutual_exclusion_object'] =
array();
836 $thisfile_asf_bitratemutualexclusionobject = &$thisfile_asf[
'bitrate_mutual_exclusion_object'];
838 $thisfile_asf_bitratemutualexclusionobject[
'offset'] = $NextObjectOffset + $offset;
839 $thisfile_asf_bitratemutualexclusionobject[
'objectid'] = $NextObjectGUID;
840 $thisfile_asf_bitratemutualexclusionobject[
'objectid_guid'] = $NextObjectGUIDtext;
841 $thisfile_asf_bitratemutualexclusionobject[
'objectsize'] = $NextObjectSize;
842 $thisfile_asf_bitratemutualexclusionobject[
'reserved'] = substr($ASFHeaderData,
845 $thisfile_asf_bitratemutualexclusionobject[
'reserved_guid'] = self::BytestringToGUID($thisfile_asf_bitratemutualexclusionobject[
'reserved']);
847 if (($thisfile_asf_bitratemutualexclusionobject[
'reserved'] != self::$GETID3_ASF_Mutex_Bitrate) && ($thisfile_asf_bitratemutualexclusionobject[
'reserved'] != self::$GETID3_ASF_Mutex_Unknown)) {
848 $info[
'warning'][] =
'bitrate_mutual_exclusion_object.reserved GUID {' . self::BytestringToGUID($thisfile_asf_bitratemutualexclusionobject[
'reserved']) .
'} does not match expected "GETID3_ASF_Mutex_Bitrate" GUID {' . self::BytestringToGUID(self::$GETID3_ASF_Mutex_Bitrate) .
'} or "GETID3_ASF_Mutex_Unknown" GUID {' . self::BytestringToGUID(self::$GETID3_ASF_Mutex_Unknown) .
'}';
852 $thisfile_asf_bitratemutualexclusionobject[
'stream_numbers_count'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
856 for ($StreamNumberCounter = 0;
857 $StreamNumberCounter < $thisfile_asf_bitratemutualexclusionobject[
'stream_numbers_count'];
858 $StreamNumberCounter++) {
859 $thisfile_asf_bitratemutualexclusionobject[
'stream_numbers'][$StreamNumberCounter] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
866 case self::$GETID3_ASF_Error_Correction_Object:
875 $thisfile_asf[
'error_correction_object'] =
array();
876 $thisfile_asf_errorcorrectionobject = &$thisfile_asf[
'error_correction_object'];
878 $thisfile_asf_errorcorrectionobject[
'offset'] = $NextObjectOffset + $offset;
879 $thisfile_asf_errorcorrectionobject[
'objectid'] = $NextObjectGUID;
880 $thisfile_asf_errorcorrectionobject[
'objectid_guid'] = $NextObjectGUIDtext;
881 $thisfile_asf_errorcorrectionobject[
'objectsize'] = $NextObjectSize;
882 $thisfile_asf_errorcorrectionobject[
'error_correction_type'] = substr($ASFHeaderData,
886 $thisfile_asf_errorcorrectionobject[
'error_correction_guid'] = self::BytestringToGUID($thisfile_asf_errorcorrectionobject[
'error_correction_type']);
887 $thisfile_asf_errorcorrectionobject[
'error_correction_data_length'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
891 switch ($thisfile_asf_errorcorrectionobject[
'error_correction_type']) {
892 case self::$GETID3_ASF_No_Error_Correction:
894 $offset += $thisfile_asf_errorcorrectionobject[
'error_correction_data_length'];
897 case self::$GETID3_ASF_Audio_Spread:
921 $thisfile_asf_errorcorrectionobject[
'silence_data'] = substr($ASFHeaderData,
923 $thisfile_asf_errorcorrectionobject[
'silence_data_length']);
924 $offset += $thisfile_asf_errorcorrectionobject[
'silence_data_length'];
928 $info[
'warning'][] =
'error_correction_object.error_correction_type GUID {' . self::BytestringToGUID($thisfile_asf_errorcorrectionobject[
'reserved']) .
'} does not match expected "GETID3_ASF_No_Error_Correction" GUID {' . self::BytestringToGUID(self::$GETID3_ASF_No_Error_Correction) .
'} or "GETID3_ASF_Audio_Spread" GUID {' . self::BytestringToGUID(self::$GETID3_ASF_Audio_Spread) .
'}';
935 case self::$GETID3_ASF_Content_Description_Object:
951 $thisfile_asf[
'content_description_object'] =
array();
952 $thisfile_asf_contentdescriptionobject = &$thisfile_asf[
'content_description_object'];
954 $thisfile_asf_contentdescriptionobject[
'offset'] = $NextObjectOffset + $offset;
955 $thisfile_asf_contentdescriptionobject[
'objectid'] = $NextObjectGUID;
956 $thisfile_asf_contentdescriptionobject[
'objectid_guid'] = $NextObjectGUIDtext;
957 $thisfile_asf_contentdescriptionobject[
'objectsize'] = $NextObjectSize;
978 $thisfile_asf_contentdescriptionobject[
'title'] = substr($ASFHeaderData,
980 $thisfile_asf_contentdescriptionobject[
'title_length']);
981 $offset += $thisfile_asf_contentdescriptionobject[
'title_length'];
982 $thisfile_asf_contentdescriptionobject[
'author'] = substr($ASFHeaderData,
984 $thisfile_asf_contentdescriptionobject[
'author_length']);
985 $offset += $thisfile_asf_contentdescriptionobject[
'author_length'];
986 $thisfile_asf_contentdescriptionobject[
'copyright'] = substr($ASFHeaderData,
988 $thisfile_asf_contentdescriptionobject[
'copyright_length']);
989 $offset += $thisfile_asf_contentdescriptionobject[
'copyright_length'];
990 $thisfile_asf_contentdescriptionobject[
'description'] = substr($ASFHeaderData,
992 $thisfile_asf_contentdescriptionobject[
'description_length']);
993 $offset += $thisfile_asf_contentdescriptionobject[
'description_length'];
994 $thisfile_asf_contentdescriptionobject[
'rating'] = substr($ASFHeaderData,
996 $thisfile_asf_contentdescriptionobject[
'rating_length']);
997 $offset += $thisfile_asf_contentdescriptionobject[
'rating_length'];
999 $ASFcommentKeysToCopy =
array(
'title' =>
'title',
'author' =>
'artist',
'copyright' =>
'copyright',
'description' =>
'comment',
'rating' =>
'rating');
1000 foreach ($ASFcommentKeysToCopy as $keytocopyfrom => $keytocopyto) {
1001 if (!empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) {
1002 $thisfile_asf_comments[$keytocopyto][] = self::TrimTerm($thisfile_asf_contentdescriptionobject[$keytocopyfrom]);
1007 case self::$GETID3_ASF_Extended_Content_Description_Object:
1026 $thisfile_asf[
'extended_content_description_object'] =
array();
1027 $thisfile_asf_extendedcontentdescriptionobject = &$thisfile_asf[
'extended_content_description_object'];
1029 $thisfile_asf_extendedcontentdescriptionobject[
'offset'] = $NextObjectOffset + $offset;
1030 $thisfile_asf_extendedcontentdescriptionobject[
'objectid'] = $NextObjectGUID;
1031 $thisfile_asf_extendedcontentdescriptionobject[
'objectid_guid'] = $NextObjectGUIDtext;
1032 $thisfile_asf_extendedcontentdescriptionobject[
'objectsize'] = $NextObjectSize;
1033 $thisfile_asf_extendedcontentdescriptionobject[
'content_descriptors_count'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
1037 for ($ExtendedContentDescriptorsCounter = 0;
1038 $ExtendedContentDescriptorsCounter < $thisfile_asf_extendedcontentdescriptionobject[
'content_descriptors_count'];
1039 $ExtendedContentDescriptorsCounter++) {
1041 $thisfile_asf_extendedcontentdescriptionobject[
'content_descriptors'][$ExtendedContentDescriptorsCounter] =
array();
1042 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current = &$thisfile_asf_extendedcontentdescriptionobject[
'content_descriptors'][$ExtendedContentDescriptorsCounter];
1044 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'base_offset'] = $offset + 30;
1045 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name_length'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
1049 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name'] = substr($ASFHeaderData,
1051 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name_length']);
1052 $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name_length'];
1053 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_type'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
1057 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_length'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
1061 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value'] = substr($ASFHeaderData,
1063 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_length']);
1064 $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_length'];
1065 switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_type']) {
1074 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value'] = (bool)
Helper::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']);
1080 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value'] =
Helper::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']);
1084 $info[
'warning'][] =
'extended_content_description.content_descriptors.' . $ExtendedContentDescriptorsCounter .
'.value_type is invalid (' . $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_type'] .
')';
1088 switch (self::TrimConvert(strtolower($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name']))) {
1090 case 'wm/albumartist':
1093 $thisfile_asf_comments[
'albumartist'] =
array(self::TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
1096 case 'wm/albumtitle':
1098 $thisfile_asf_comments[
'album'] =
array(self::TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
1103 $thisfile_asf_comments[
'genre'] =
array(self::TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
1106 case 'wm/partofset':
1107 $thisfile_asf_comments[
'partofset'] =
array(self::TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
1110 case 'wm/tracknumber':
1113 $thisfile_asf_comments[
'track'] =
array(self::TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
1114 foreach ($thisfile_asf_comments[
'track'] as $key => $value) {
1115 if (preg_match(
'/^[0-9\x00]+$/', $value)) {
1116 $thisfile_asf_comments[
'track'][$key] = intval(str_replace(
"\x00",
1124 if (empty($thisfile_asf_comments[
'track'])) {
1125 $thisfile_asf_comments[
'track'] =
array(1 + self::TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
1132 $thisfile_asf_comments[
'year'] =
array(self::TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
1137 $thisfile_asf_comments[
'lyrics'] =
array(self::TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
1141 if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']) {
1142 $thisfile_audio[
'bitrate_mode'] =
'vbr';
1143 $thisfile_video[
'bitrate_mode'] =
'vbr';
1149 if (class_exists(
'getid3_id3v2')) {
1152 $tempfilehandle = fopen($tempfile,
'wb');
1153 $tempThisfileInfo =
array(
'encoding' =>
$info[
'encoding']);
1154 fwrite($tempfilehandle,
1155 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']);
1156 fclose($tempfilehandle);
1159 $getid3_temp->openfile($tempfile);
1160 $getid3_id3v2 =
new Id3v2($getid3_temp);
1161 $getid3_id3v2->analyze();
1162 $info[
'id3v2'] = $getid3_temp->info[
'id3v2'];
1163 unset($getid3_temp, $getid3_id3v2);
1169 case 'wm/encodingtime':
1170 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'encoding_time_unix'] = self::FILETIMEtoUNIXtime($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']);
1171 $thisfile_asf_comments[
'encoding_time_unix'] =
array($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'encoding_time_unix']);
1175 $WMpicture = $this->
ASF_WMpicture($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']);
1176 foreach ($WMpicture as $key => $value) {
1177 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[$key] = $value;
1221 switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_type']) {
1223 if (substr(self::TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name']),
1225 $thisfile_asf_comments[str_replace(
'wm/',
1227 strtolower(self::TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name'])))] =
array(self::TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
1239 case self::$GETID3_ASF_Stream_Bitrate_Properties_Object:
1251 $thisfile_asf[
'stream_bitrate_properties_object'] =
array();
1252 $thisfile_asf_streambitratepropertiesobject = &$thisfile_asf[
'stream_bitrate_properties_object'];
1254 $thisfile_asf_streambitratepropertiesobject[
'offset'] = $NextObjectOffset + $offset;
1255 $thisfile_asf_streambitratepropertiesobject[
'objectid'] = $NextObjectGUID;
1256 $thisfile_asf_streambitratepropertiesobject[
'objectid_guid'] = $NextObjectGUIDtext;
1257 $thisfile_asf_streambitratepropertiesobject[
'objectsize'] = $NextObjectSize;
1258 $thisfile_asf_streambitratepropertiesobject[
'bitrate_records_count'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
1262 for ($BitrateRecordsCounter = 0;
1263 $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject[
'bitrate_records_count'];
1264 $BitrateRecordsCounter++) {
1265 $thisfile_asf_streambitratepropertiesobject[
'bitrate_records'][$BitrateRecordsCounter][
'flags_raw'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
1269 $thisfile_asf_streambitratepropertiesobject[
'bitrate_records'][$BitrateRecordsCounter][
'flags'][
'stream_number'] = $thisfile_asf_streambitratepropertiesobject[
'bitrate_records'][$BitrateRecordsCounter][
'flags_raw'] & 0x007F;
1270 $thisfile_asf_streambitratepropertiesobject[
'bitrate_records'][$BitrateRecordsCounter][
'bitrate'] =
Helper::LittleEndian2Int(substr($ASFHeaderData,
1277 case self::$GETID3_ASF_Padding_Object:
1284 $thisfile_asf[
'padding_object'] =
array();
1285 $thisfile_asf_paddingobject = &$thisfile_asf[
'padding_object'];
1287 $thisfile_asf_paddingobject[
'offset'] = $NextObjectOffset + $offset;
1288 $thisfile_asf_paddingobject[
'objectid'] = $NextObjectGUID;
1289 $thisfile_asf_paddingobject[
'objectid_guid'] = $NextObjectGUIDtext;
1290 $thisfile_asf_paddingobject[
'objectsize'] = $NextObjectSize;
1291 $thisfile_asf_paddingobject[
'padding_length'] = $thisfile_asf_paddingobject[
'objectsize'] - 16 - 8;
1292 $thisfile_asf_paddingobject[
'padding'] = substr($ASFHeaderData,
1294 $thisfile_asf_paddingobject[
'padding_length']);
1295 $offset += ($NextObjectSize - 16 - 8);
1298 case self::$GETID3_ASF_Extended_Content_Encryption_Object:
1299 case self::$GETID3_ASF_Content_Encryption_Object:
1301 $offset += ($NextObjectSize - 16 - 8);
1306 if (self::GUIDname($NextObjectGUIDtext)) {
1307 $info[
'warning'][] =
'unhandled GUID "' . self::GUIDname($NextObjectGUIDtext) .
'" {' . $NextObjectGUIDtext .
'} in ASF header at offset ' . ($offset - 16 - 8);
1309 $info[
'warning'][] =
'unknown GUID {' . $NextObjectGUIDtext .
'} in ASF header at offset ' . ($offset - 16 - 8);
1311 $offset += ($NextObjectSize - 16 - 8);
1315 if (isset($thisfile_asf_streambitrateproperties[
'bitrate_records_count'])) {
1316 $ASFbitrateAudio = 0;
1317 $ASFbitrateVideo = 0;
1318 for ($BitrateRecordsCounter = 0;
1319 $BitrateRecordsCounter < $thisfile_asf_streambitrateproperties[
'bitrate_records_count'];
1320 $BitrateRecordsCounter++) {
1321 if (isset($thisfile_asf_codeclistobject[
'codec_entries'][$BitrateRecordsCounter])) {
1322 switch ($thisfile_asf_codeclistobject[
'codec_entries'][$BitrateRecordsCounter][
'type_raw']) {
1324 $ASFbitrateVideo += $thisfile_asf_streambitrateproperties[
'bitrate_records'][$BitrateRecordsCounter][
'bitrate'];
1328 $ASFbitrateAudio += $thisfile_asf_streambitrateproperties[
'bitrate_records'][$BitrateRecordsCounter][
'bitrate'];
1337 if ($ASFbitrateAudio > 0) {
1338 $thisfile_audio[
'bitrate'] = $ASFbitrateAudio;
1340 if ($ASFbitrateVideo > 0) {
1341 $thisfile_video[
'bitrate'] = $ASFbitrateVideo;
1344 if (isset($thisfile_asf[
'stream_properties_object']) && is_array($thisfile_asf[
'stream_properties_object'])) {
1346 $thisfile_audio[
'bitrate'] = 0;
1347 $thisfile_video[
'bitrate'] = 0;
1349 foreach ($thisfile_asf[
'stream_properties_object'] as $streamnumber => $streamdata) {
1351 switch ($streamdata[
'stream_type']) {
1352 case self::$GETID3_ASF_Audio_Media:
1363 $thisfile_asf[
'audio_media'][$streamnumber] =
array();
1364 $thisfile_asf_audiomedia_currentstream = &$thisfile_asf[
'audio_media'][$streamnumber];
1366 $audiomediaoffset = 0;
1371 $audiomediaoffset += 16;
1373 $thisfile_audio[
'lossless'] =
false;
1374 switch ($thisfile_asf_audiomedia_currentstream[
'raw'][
'wFormatTag']) {
1377 $thisfile_audio[
'lossless'] =
true;
1381 if (!empty($thisfile_asf[
'stream_bitrate_properties_object'][
'bitrate_records'])) {
1382 foreach ($thisfile_asf[
'stream_bitrate_properties_object'][
'bitrate_records'] as $dummy => $dataarray) {
1383 if (isset($dataarray[
'flags'][
'stream_number']) && ($dataarray[
'flags'][
'stream_number'] == $streamnumber)) {
1384 $thisfile_asf_audiomedia_currentstream[
'bitrate'] = $dataarray[
'bitrate'];
1385 $thisfile_audio[
'bitrate'] += $dataarray[
'bitrate'];
1390 if (!empty($thisfile_asf_audiomedia_currentstream[
'bytes_sec'])) {
1391 $thisfile_audio[
'bitrate'] += $thisfile_asf_audiomedia_currentstream[
'bytes_sec'] * 8;
1392 } elseif (!empty($thisfile_asf_audiomedia_currentstream[
'bitrate'])) {
1393 $thisfile_audio[
'bitrate'] += $thisfile_asf_audiomedia_currentstream[
'bitrate'];
1396 $thisfile_audio[
'streams'][$streamnumber] = $thisfile_asf_audiomedia_currentstream;
1397 $thisfile_audio[
'streams'][$streamnumber][
'wformattag'] = $thisfile_asf_audiomedia_currentstream[
'raw'][
'wFormatTag'];
1398 $thisfile_audio[
'streams'][$streamnumber][
'lossless'] = $thisfile_audio[
'lossless'];
1399 $thisfile_audio[
'streams'][$streamnumber][
'bitrate'] = $thisfile_audio[
'bitrate'];
1400 $thisfile_audio[
'streams'][$streamnumber][
'dataformat'] =
'wma';
1401 unset($thisfile_audio[
'streams'][$streamnumber][
'raw']);
1403 $thisfile_asf_audiomedia_currentstream[
'codec_data_size'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1406 $audiomediaoffset += 2;
1407 $thisfile_asf_audiomedia_currentstream[
'codec_data'] = substr($streamdata[
'type_specific_data'],
1409 $thisfile_asf_audiomedia_currentstream[
'codec_data_size']);
1410 $audiomediaoffset += $thisfile_asf_audiomedia_currentstream[
'codec_data_size'];
1414 case self::$GETID3_ASF_Video_Media:
1434 $thisfile_asf[
'video_media'][$streamnumber] =
array();
1435 $thisfile_asf_videomedia_currentstream = &$thisfile_asf[
'video_media'][$streamnumber];
1437 $videomediaoffset = 0;
1438 $thisfile_asf_videomedia_currentstream[
'image_width'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1441 $videomediaoffset += 4;
1442 $thisfile_asf_videomedia_currentstream[
'image_height'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1445 $videomediaoffset += 4;
1446 $thisfile_asf_videomedia_currentstream[
'flags'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1449 $videomediaoffset += 1;
1450 $thisfile_asf_videomedia_currentstream[
'format_data_size'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1453 $videomediaoffset += 2;
1454 $thisfile_asf_videomedia_currentstream[
'format_data'][
'format_data_size'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1457 $videomediaoffset += 4;
1458 $thisfile_asf_videomedia_currentstream[
'format_data'][
'image_width'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1461 $videomediaoffset += 4;
1462 $thisfile_asf_videomedia_currentstream[
'format_data'][
'image_height'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1465 $videomediaoffset += 4;
1466 $thisfile_asf_videomedia_currentstream[
'format_data'][
'reserved'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1469 $videomediaoffset += 2;
1470 $thisfile_asf_videomedia_currentstream[
'format_data'][
'bits_per_pixel'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1473 $videomediaoffset += 2;
1474 $thisfile_asf_videomedia_currentstream[
'format_data'][
'codec_fourcc'] = substr($streamdata[
'type_specific_data'],
1477 $videomediaoffset += 4;
1478 $thisfile_asf_videomedia_currentstream[
'format_data'][
'image_size'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1481 $videomediaoffset += 4;
1482 $thisfile_asf_videomedia_currentstream[
'format_data'][
'horizontal_pels'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1485 $videomediaoffset += 4;
1486 $thisfile_asf_videomedia_currentstream[
'format_data'][
'vertical_pels'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1489 $videomediaoffset += 4;
1490 $thisfile_asf_videomedia_currentstream[
'format_data'][
'colors_used'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1493 $videomediaoffset += 4;
1494 $thisfile_asf_videomedia_currentstream[
'format_data'][
'colors_important'] =
Helper::LittleEndian2Int(substr($streamdata[
'type_specific_data'],
1497 $videomediaoffset += 4;
1498 $thisfile_asf_videomedia_currentstream[
'format_data'][
'codec_data'] = substr($streamdata[
'type_specific_data'],
1501 if (!empty($thisfile_asf[
'stream_bitrate_properties_object'][
'bitrate_records'])) {
1502 foreach ($thisfile_asf[
'stream_bitrate_properties_object'][
'bitrate_records'] as $dummy => $dataarray) {
1503 if (isset($dataarray[
'flags'][
'stream_number']) && ($dataarray[
'flags'][
'stream_number'] == $streamnumber)) {
1504 $thisfile_asf_videomedia_currentstream[
'bitrate'] = $dataarray[
'bitrate'];
1505 $thisfile_video[
'streams'][$streamnumber][
'bitrate'] = $dataarray[
'bitrate'];
1506 $thisfile_video[
'bitrate'] += $dataarray[
'bitrate'];
1512 $thisfile_asf_videomedia_currentstream[
'format_data'][
'codec'] =
Riff::RIFFfourccLookup($thisfile_asf_videomedia_currentstream[
'format_data'][
'codec_fourcc']);
1514 $thisfile_video[
'streams'][$streamnumber][
'fourcc'] = $thisfile_asf_videomedia_currentstream[
'format_data'][
'codec_fourcc'];
1515 $thisfile_video[
'streams'][$streamnumber][
'codec'] = $thisfile_asf_videomedia_currentstream[
'format_data'][
'codec'];
1516 $thisfile_video[
'streams'][$streamnumber][
'resolution_x'] = $thisfile_asf_videomedia_currentstream[
'image_width'];
1517 $thisfile_video[
'streams'][$streamnumber][
'resolution_y'] = $thisfile_asf_videomedia_currentstream[
'image_height'];
1518 $thisfile_video[
'streams'][$streamnumber][
'bits_per_sample'] = $thisfile_asf_videomedia_currentstream[
'format_data'][
'bits_per_pixel'];
1525 }
while (
ftell($this->getid3->fp) <
$info[
'avdataend']) {
1526 $NextObjectDataHeader =
fread($this->getid3->fp, 24);
1528 $NextObjectGUID = substr($NextObjectDataHeader, 0, 16);
1530 $NextObjectGUIDtext = self::BytestringToGUID($NextObjectGUID);
1536 switch ($NextObjectGUID) {
1537 case self::$GETID3_ASF_Data_Object:
1546 $thisfile_asf[
'data_object'] =
array();
1547 $thisfile_asf_dataobject = &$thisfile_asf[
'data_object'];
1549 $DataObjectData = $NextObjectDataHeader .
fread($this->getid3->fp,
1553 $thisfile_asf_dataobject[
'objectid'] = $NextObjectGUID;
1554 $thisfile_asf_dataobject[
'objectid_guid'] = $NextObjectGUIDtext;
1555 $thisfile_asf_dataobject[
'objectsize'] = $NextObjectSize;
1557 $thisfile_asf_dataobject[
'fileid'] = substr($DataObjectData,
1560 $thisfile_asf_dataobject[
'fileid_guid'] = self::BytestringToGUID($thisfile_asf_dataobject[
'fileid']);
1569 if ($thisfile_asf_dataobject[
'reserved'] != 0x0101) {
1570 $info[
'warning'][] =
'data_object.reserved (' .
Helper::PrintHexBytes($thisfile_asf_dataobject[
'reserved']) .
') does not match expected value of "0x0101"';
1583 $info[
'avdataoffset'] =
ftell($this->getid3->fp);
1584 fseek($this->getid3->fp,
1585 ($thisfile_asf_dataobject[
'objectsize'] - 50),
1587 $info[
'avdataend'] =
ftell($this->getid3->fp);
1590 case self::$GETID3_ASF_Simple_Index_Object:
1603 $thisfile_asf[
'simple_index_object'] =
array();
1604 $thisfile_asf_simpleindexobject = &$thisfile_asf[
'simple_index_object'];
1606 $SimpleIndexObjectData = $NextObjectDataHeader .
fread($this->getid3->fp,
1610 $thisfile_asf_simpleindexobject[
'objectid'] = $NextObjectGUID;
1611 $thisfile_asf_simpleindexobject[
'objectid_guid'] = $NextObjectGUIDtext;
1612 $thisfile_asf_simpleindexobject[
'objectsize'] = $NextObjectSize;
1614 $thisfile_asf_simpleindexobject[
'fileid'] = substr($SimpleIndexObjectData,
1618 $thisfile_asf_simpleindexobject[
'fileid_guid'] = self::BytestringToGUID($thisfile_asf_simpleindexobject[
'fileid']);
1619 $thisfile_asf_simpleindexobject[
'index_entry_time_interval'] =
Helper::LittleEndian2Int(substr($SimpleIndexObjectData,
1632 $IndexEntriesData = $SimpleIndexObjectData .
fread($this->getid3->fp,
1633 6 * $thisfile_asf_simpleindexobject[
'index_entries_count']);
1634 for ($IndexEntriesCounter = 0;
1635 $IndexEntriesCounter < $thisfile_asf_simpleindexobject[
'index_entries_count'];
1636 $IndexEntriesCounter++) {
1637 $thisfile_asf_simpleindexobject[
'index_entries'][$IndexEntriesCounter][
'packet_number'] =
Helper::LittleEndian2Int(substr($IndexEntriesData,
1641 $thisfile_asf_simpleindexobject[
'index_entries'][$IndexEntriesCounter][
'packet_count'] =
Helper::LittleEndian2Int(substr($IndexEntriesData,
1649 case self::$GETID3_ASF_Index_Object:
1671 $thisfile_asf[
'asf_index_object'] =
array();
1672 $thisfile_asf_asfindexobject = &$thisfile_asf[
'asf_index_object'];
1674 $ASFIndexObjectData = $NextObjectDataHeader .
fread($this->getid3->fp,
1678 $thisfile_asf_asfindexobject[
'objectid'] = $NextObjectGUID;
1679 $thisfile_asf_asfindexobject[
'objectid_guid'] = $NextObjectGUIDtext;
1680 $thisfile_asf_asfindexobject[
'objectsize'] = $NextObjectSize;
1695 $ASFIndexObjectData .=
fread($this->getid3->fp,
1696 4 * $thisfile_asf_asfindexobject[
'index_specifiers_count']);
1697 for ($IndexSpecifiersCounter = 0;
1698 $IndexSpecifiersCounter < $thisfile_asf_asfindexobject[
'index_specifiers_count'];
1699 $IndexSpecifiersCounter++) {
1704 $thisfile_asf_asfindexobject[
'index_specifiers'][$IndexSpecifiersCounter][
'stream_number'] = $IndexSpecifierStreamNumber;
1705 $thisfile_asf_asfindexobject[
'index_specifiers'][$IndexSpecifiersCounter][
'index_type'] =
Helper::LittleEndian2Int(substr($ASFIndexObjectData,
1709 $thisfile_asf_asfindexobject[
'index_specifiers'][$IndexSpecifiersCounter][
'index_type_text'] = $this->
ASFIndexObjectIndexTypeLookup($thisfile_asf_asfindexobject[
'index_specifiers'][$IndexSpecifiersCounter][
'index_type']);
1712 $ASFIndexObjectData .=
fread($this->getid3->fp, 4);
1718 $ASFIndexObjectData .=
fread($this->getid3->fp,
1719 8 * $thisfile_asf_asfindexobject[
'index_specifiers_count']);
1720 for ($IndexSpecifiersCounter = 0;
1721 $IndexSpecifiersCounter < $thisfile_asf_asfindexobject[
'index_specifiers_count'];
1722 $IndexSpecifiersCounter++) {
1723 $thisfile_asf_asfindexobject[
'block_positions'][$IndexSpecifiersCounter] =
Helper::LittleEndian2Int(substr($ASFIndexObjectData,
1729 $ASFIndexObjectData .=
fread($this->getid3->fp,
1730 4 * $thisfile_asf_asfindexobject[
'index_specifiers_count'] * $thisfile_asf_asfindexobject[
'index_entry_count']);
1731 for ($IndexEntryCounter = 0;
1732 $IndexEntryCounter < $thisfile_asf_asfindexobject[
'index_entry_count'];
1733 $IndexEntryCounter++) {
1734 for ($IndexSpecifiersCounter = 0;
1735 $IndexSpecifiersCounter < $thisfile_asf_asfindexobject[
'index_specifiers_count'];
1736 $IndexSpecifiersCounter++) {
1737 $thisfile_asf_asfindexobject[
'offsets'][$IndexSpecifiersCounter][$IndexEntryCounter] =
Helper::LittleEndian2Int(substr($ASFIndexObjectData,
1748 if (self::GUIDname($NextObjectGUIDtext)) {
1749 $info[
'warning'][] =
'unhandled GUID "' . self::GUIDname($NextObjectGUIDtext) .
'" {' . $NextObjectGUIDtext .
'} in ASF body at offset ' . ($offset - 16 - 8);
1751 $info[
'warning'][] =
'unknown GUID {' . $NextObjectGUIDtext .
'} in ASF body at offset ' . (
ftell($this->getid3->fp) - 16 - 8);
1753 fseek($this->getid3->fp, ($NextObjectSize - 16 - 8),
1759 if (isset($thisfile_asf_codeclistobject[
'codec_entries']) && is_array($thisfile_asf_codeclistobject[
'codec_entries'])) {
1760 foreach ($thisfile_asf_codeclistobject[
'codec_entries'] as $streamnumber => $streamdata) {
1761 switch ($streamdata[
'information']) {
1771 $thisfile_video[
'dataformat'] =
'wmv';
1772 $info[
'mime_type'] =
'video/x-ms-wmv';
1779 $thisfile_video[
'dataformat'] =
'asf';
1780 $info[
'mime_type'] =
'video/x-ms-asf';
1784 switch ($streamdata[
'type_raw']) {
1786 if (strstr(self::TrimConvert($streamdata[
'name']),
1788 $thisfile_video[
'dataformat'] =
'wmv';
1789 if (
$info[
'mime_type'] ==
'video/x-ms-asf') {
1790 $info[
'mime_type'] =
'video/x-ms-wmv';
1796 if (strstr(self::TrimConvert($streamdata[
'name']),
1798 $thisfile_audio[
'dataformat'] =
'wma';
1799 if (
$info[
'mime_type'] ==
'video/x-ms-asf') {
1800 $info[
'mime_type'] =
'audio/x-ms-wma';
1810 switch (isset($thisfile_audio[
'codec']) ? $thisfile_audio[
'codec'] :
'') {
1811 case 'MPEG Layer-3':
1812 $thisfile_audio[
'dataformat'] =
'mp3';
1819 if (isset($thisfile_asf_codeclistobject[
'codec_entries'])) {
1820 foreach ($thisfile_asf_codeclistobject[
'codec_entries'] as $streamnumber => $streamdata) {
1821 switch ($streamdata[
'type_raw']) {
1824 $thisfile_video[
'encoder'] = self::TrimConvert($thisfile_asf_codeclistobject[
'codec_entries'][$streamnumber][
'name']);
1828 $thisfile_audio[
'encoder'] = self::TrimConvert($thisfile_asf_codeclistobject[
'codec_entries'][$streamnumber][
'name']);
1831 $thisfile_audio[
'encoder_options'] = self::TrimConvert($thisfile_asf_codeclistobject[
'codec_entries'][0][
'description']);
1833 $thisfile_audio[
'codec'] = $thisfile_audio[
'encoder'];
1837 $info[
'warning'][] =
'Unknown streamtype: [codec_list_object][codec_entries][' . $streamnumber .
'][type_raw] == ' . $streamdata[
'type_raw'];
1843 if (isset(
$info[
'audio'])) {
1844 $thisfile_audio[
'lossless'] = (isset($thisfile_audio[
'lossless']) ? $thisfile_audio[
'lossless'] :
false);
1845 $thisfile_audio[
'dataformat'] = (!empty($thisfile_audio[
'dataformat']) ? $thisfile_audio[
'dataformat'] :
'asf');
1847 if (!empty($thisfile_video[
'dataformat'])) {
1848 $thisfile_video[
'lossless'] = (isset($thisfile_audio[
'lossless']) ? $thisfile_audio[
'lossless'] :
false);
1849 $thisfile_video[
'pixel_aspect_ratio'] = (isset($thisfile_audio[
'pixel_aspect_ratio']) ? $thisfile_audio[
'pixel_aspect_ratio'] : (float) 1);
1850 $thisfile_video[
'dataformat'] = (!empty($thisfile_video[
'dataformat']) ? $thisfile_video[
'dataformat'] :
'asf');
1852 if (!empty($thisfile_video[
'streams'])) {
1853 $thisfile_video[
'streams'][
'resolution_x'] = 0;
1854 $thisfile_video[
'streams'][
'resolution_y'] = 0;
1855 foreach ($thisfile_video[
'streams'] as $key => $valuearray) {
1856 if (($valuearray[
'resolution_x'] > $thisfile_video[
'streams'][
'resolution_x']) || ($valuearray[
'resolution_y'] > $thisfile_video[
'streams'][
'resolution_y'])) {
1857 $thisfile_video[
'resolution_x'] = $valuearray[
'resolution_x'];
1858 $thisfile_video[
'resolution_y'] = $valuearray[
'resolution_y'];
1862 $info[
'bitrate'] = (isset($thisfile_audio[
'bitrate']) ? $thisfile_audio[
'bitrate'] : 0) + (isset($thisfile_video[
'bitrate']) ? $thisfile_video[
'bitrate'] : 0);
1864 if ((!isset(
$info[
'playtime_seconds']) || (
$info[
'playtime_seconds'] <= 0)) && (
$info[
'bitrate'] > 0)) {
1865 $info[
'playtime_seconds'] = (
$info[
'filesize'] -
$info[
'avdataoffset']) / (
$info[
'bitrate'] / 8);
1873 static $ASFCodecListObjectTypeLookup =
array();
1874 if (empty($ASFCodecListObjectTypeLookup)) {
1875 $ASFCodecListObjectTypeLookup[0x0001] =
'Video Codec';
1876 $ASFCodecListObjectTypeLookup[0x0002] =
'Audio Codec';
1877 $ASFCodecListObjectTypeLookup[0xFFFF] =
'Unknown Codec';
1880 return (isset($ASFCodecListObjectTypeLookup[$CodecListType]) ? $ASFCodecListObjectTypeLookup[$CodecListType] :
'Invalid Codec Type');
1885 static $GUIDarray =
array(
1886 'GETID3_ASF_Extended_Stream_Properties_Object' =>
'14E6A5CB-C672-4332-8399-A96952065B5A',
1887 'GETID3_ASF_Padding_Object' =>
'1806D474-CADF-4509-A4BA-9AABCB96AAE8',
1888 'GETID3_ASF_Payload_Ext_Syst_Pixel_Aspect_Ratio' =>
'1B1EE554-F9EA-4BC8-821A-376B74E4C4B8',
1889 'GETID3_ASF_Script_Command_Object' =>
'1EFB1A30-0B62-11D0-A39B-00A0C90348F6',
1890 'GETID3_ASF_No_Error_Correction' =>
'20FB5700-5B55-11CF-A8FD-00805F5C442B',
1891 'GETID3_ASF_Content_Branding_Object' =>
'2211B3FA-BD23-11D2-B4B7-00A0C955FC6E',
1892 'GETID3_ASF_Content_Encryption_Object' =>
'2211B3FB-BD23-11D2-B4B7-00A0C955FC6E',
1893 'GETID3_ASF_Digital_Signature_Object' =>
'2211B3FC-BD23-11D2-B4B7-00A0C955FC6E',
1894 'GETID3_ASF_Extended_Content_Encryption_Object' =>
'298AE614-2622-4C17-B935-DAE07EE9289C',
1895 'GETID3_ASF_Simple_Index_Object' =>
'33000890-E5B1-11CF-89F4-00A0C90349CB',
1896 'GETID3_ASF_Degradable_JPEG_Media' =>
'35907DE0-E415-11CF-A917-00805F5C442B',
1897 'GETID3_ASF_Payload_Extension_System_Timecode' =>
'399595EC-8667-4E2D-8FDB-98814CE76C1E',
1898 'GETID3_ASF_Binary_Media' =>
'3AFB65E2-47EF-40F2-AC2C-70A90D71D343',
1899 'GETID3_ASF_Timecode_Index_Object' =>
'3CB73FD0-0C4A-4803-953D-EDF7B6228F0C',
1900 'GETID3_ASF_Metadata_Library_Object' =>
'44231C94-9498-49D1-A141-1D134E457054',
1901 'GETID3_ASF_Reserved_3' =>
'4B1ACBE3-100B-11D0-A39B-00A0C90348F6',
1902 'GETID3_ASF_Reserved_4' =>
'4CFEDB20-75F6-11CF-9C0F-00A0C90349CB',
1903 'GETID3_ASF_Command_Media' =>
'59DACFC0-59E6-11D0-A3AC-00A0C90348F6',
1904 'GETID3_ASF_Header_Extension_Object' =>
'5FBF03B5-A92E-11CF-8EE3-00C00C205365',
1905 'GETID3_ASF_Media_Object_Index_Parameters_Obj' =>
'6B203BAD-3F11-4E84-ACA8-D7613DE2CFA7',
1906 'GETID3_ASF_Header_Object' =>
'75B22630-668E-11CF-A6D9-00AA0062CE6C',
1907 'GETID3_ASF_Content_Description_Object' =>
'75B22633-668E-11CF-A6D9-00AA0062CE6C',
1908 'GETID3_ASF_Error_Correction_Object' =>
'75B22635-668E-11CF-A6D9-00AA0062CE6C',
1909 'GETID3_ASF_Data_Object' =>
'75B22636-668E-11CF-A6D9-00AA0062CE6C',
1910 'GETID3_ASF_Web_Stream_Media_Subtype' =>
'776257D4-C627-41CB-8F81-7AC7FF1C40CC',
1911 'GETID3_ASF_Stream_Bitrate_Properties_Object' =>
'7BF875CE-468D-11D1-8D82-006097C9A2B2',
1912 'GETID3_ASF_Language_List_Object' =>
'7C4346A9-EFE0-4BFC-B229-393EDE415C85',
1913 'GETID3_ASF_Codec_List_Object' =>
'86D15240-311D-11D0-A3A4-00A0C90348F6',
1914 'GETID3_ASF_Reserved_2' =>
'86D15241-311D-11D0-A3A4-00A0C90348F6',
1915 'GETID3_ASF_File_Properties_Object' =>
'8CABDCA1-A947-11CF-8EE4-00C00C205365',
1916 'GETID3_ASF_File_Transfer_Media' =>
'91BD222C-F21C-497A-8B6D-5AA86BFC0185',
1917 'GETID3_ASF_Old_RTP_Extension_Data' =>
'96800C63-4C94-11D1-837B-0080C7A37F95',
1918 'GETID3_ASF_Advanced_Mutual_Exclusion_Object' =>
'A08649CF-4775-4670-8A16-6E35357566CD',
1919 'GETID3_ASF_Bandwidth_Sharing_Object' =>
'A69609E6-517B-11D2-B6AF-00C04FD908E9',
1920 'GETID3_ASF_Reserved_1' =>
'ABD3D211-A9BA-11cf-8EE6-00C00C205365',
1921 'GETID3_ASF_Bandwidth_Sharing_Exclusive' =>
'AF6060AA-5197-11D2-B6AF-00C04FD908E9',
1922 'GETID3_ASF_Bandwidth_Sharing_Partial' =>
'AF6060AB-5197-11D2-B6AF-00C04FD908E9',
1923 'GETID3_ASF_JFIF_Media' =>
'B61BE100-5B4E-11CF-A8FD-00805F5C442B',
1924 'GETID3_ASF_Stream_Properties_Object' =>
'B7DC0791-A9B7-11CF-8EE6-00C00C205365',
1925 'GETID3_ASF_Video_Media' =>
'BC19EFC0-5B4D-11CF-A8FD-00805F5C442B',
1926 'GETID3_ASF_Audio_Spread' =>
'BFC3CD50-618F-11CF-8BB2-00AA00B4E220',
1927 'GETID3_ASF_Metadata_Object' =>
'C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA',
1928 'GETID3_ASF_Payload_Ext_Syst_Sample_Duration' =>
'C6BD9450-867F-4907-83A3-C77921B733AD',
1929 'GETID3_ASF_Group_Mutual_Exclusion_Object' =>
'D1465A40-5A79-4338-B71B-E36B8FD6C249',
1930 'GETID3_ASF_Extended_Content_Description_Object' =>
'D2D0A440-E307-11D2-97F0-00A0C95EA850',
1931 'GETID3_ASF_Stream_Prioritization_Object' =>
'D4FED15B-88D3-454F-81F0-ED5C45999E24',
1932 'GETID3_ASF_Payload_Ext_System_Content_Type' =>
'D590DC20-07BC-436C-9CF7-F3BBFBF1A4DC',
1933 'GETID3_ASF_Old_File_Properties_Object' =>
'D6E229D0-35DA-11D1-9034-00A0C90349BE',
1934 'GETID3_ASF_Old_ASF_Header_Object' =>
'D6E229D1-35DA-11D1-9034-00A0C90349BE',
1935 'GETID3_ASF_Old_ASF_Data_Object' =>
'D6E229D2-35DA-11D1-9034-00A0C90349BE',
1936 'GETID3_ASF_Index_Object' =>
'D6E229D3-35DA-11D1-9034-00A0C90349BE',
1937 'GETID3_ASF_Old_Stream_Properties_Object' =>
'D6E229D4-35DA-11D1-9034-00A0C90349BE',
1938 'GETID3_ASF_Old_Content_Description_Object' =>
'D6E229D5-35DA-11D1-9034-00A0C90349BE',
1939 'GETID3_ASF_Old_Script_Command_Object' =>
'D6E229D6-35DA-11D1-9034-00A0C90349BE',
1940 'GETID3_ASF_Old_Marker_Object' =>
'D6E229D7-35DA-11D1-9034-00A0C90349BE',
1941 'GETID3_ASF_Old_Component_Download_Object' =>
'D6E229D8-35DA-11D1-9034-00A0C90349BE',
1942 'GETID3_ASF_Old_Stream_Group_Object' =>
'D6E229D9-35DA-11D1-9034-00A0C90349BE',
1943 'GETID3_ASF_Old_Scalable_Object' =>
'D6E229DA-35DA-11D1-9034-00A0C90349BE',
1944 'GETID3_ASF_Old_Prioritization_Object' =>
'D6E229DB-35DA-11D1-9034-00A0C90349BE',
1945 'GETID3_ASF_Bitrate_Mutual_Exclusion_Object' =>
'D6E229DC-35DA-11D1-9034-00A0C90349BE',
1946 'GETID3_ASF_Old_Inter_Media_Dependency_Object' =>
'D6E229DD-35DA-11D1-9034-00A0C90349BE',
1947 'GETID3_ASF_Old_Rating_Object' =>
'D6E229DE-35DA-11D1-9034-00A0C90349BE',
1948 'GETID3_ASF_Index_Parameters_Object' =>
'D6E229DF-35DA-11D1-9034-00A0C90349BE',
1949 'GETID3_ASF_Old_Color_Table_Object' =>
'D6E229E0-35DA-11D1-9034-00A0C90349BE',
1950 'GETID3_ASF_Old_Language_List_Object' =>
'D6E229E1-35DA-11D1-9034-00A0C90349BE',
1951 'GETID3_ASF_Old_Audio_Media' =>
'D6E229E2-35DA-11D1-9034-00A0C90349BE',
1952 'GETID3_ASF_Old_Video_Media' =>
'D6E229E3-35DA-11D1-9034-00A0C90349BE',
1953 'GETID3_ASF_Old_Image_Media' =>
'D6E229E4-35DA-11D1-9034-00A0C90349BE',
1954 'GETID3_ASF_Old_Timecode_Media' =>
'D6E229E5-35DA-11D1-9034-00A0C90349BE',
1955 'GETID3_ASF_Old_Text_Media' =>
'D6E229E6-35DA-11D1-9034-00A0C90349BE',
1956 'GETID3_ASF_Old_MIDI_Media' =>
'D6E229E7-35DA-11D1-9034-00A0C90349BE',
1957 'GETID3_ASF_Old_Command_Media' =>
'D6E229E8-35DA-11D1-9034-00A0C90349BE',
1958 'GETID3_ASF_Old_No_Error_Concealment' =>
'D6E229EA-35DA-11D1-9034-00A0C90349BE',
1959 'GETID3_ASF_Old_Scrambled_Audio' =>
'D6E229EB-35DA-11D1-9034-00A0C90349BE',
1960 'GETID3_ASF_Old_No_Color_Table' =>
'D6E229EC-35DA-11D1-9034-00A0C90349BE',
1961 'GETID3_ASF_Old_SMPTE_Time' =>
'D6E229ED-35DA-11D1-9034-00A0C90349BE',
1962 'GETID3_ASF_Old_ASCII_Text' =>
'D6E229EE-35DA-11D1-9034-00A0C90349BE',
1963 'GETID3_ASF_Old_Unicode_Text' =>
'D6E229EF-35DA-11D1-9034-00A0C90349BE',
1964 'GETID3_ASF_Old_HTML_Text' =>
'D6E229F0-35DA-11D1-9034-00A0C90349BE',
1965 'GETID3_ASF_Old_URL_Command' =>
'D6E229F1-35DA-11D1-9034-00A0C90349BE',
1966 'GETID3_ASF_Old_Filename_Command' =>
'D6E229F2-35DA-11D1-9034-00A0C90349BE',
1967 'GETID3_ASF_Old_ACM_Codec' =>
'D6E229F3-35DA-11D1-9034-00A0C90349BE',
1968 'GETID3_ASF_Old_VCM_Codec' =>
'D6E229F4-35DA-11D1-9034-00A0C90349BE',
1969 'GETID3_ASF_Old_QuickTime_Codec' =>
'D6E229F5-35DA-11D1-9034-00A0C90349BE',
1970 'GETID3_ASF_Old_DirectShow_Transform_Filter' =>
'D6E229F6-35DA-11D1-9034-00A0C90349BE',
1971 'GETID3_ASF_Old_DirectShow_Rendering_Filter' =>
'D6E229F7-35DA-11D1-9034-00A0C90349BE',
1972 'GETID3_ASF_Old_No_Enhancement' =>
'D6E229F8-35DA-11D1-9034-00A0C90349BE',
1973 'GETID3_ASF_Old_Unknown_Enhancement_Type' =>
'D6E229F9-35DA-11D1-9034-00A0C90349BE',
1974 'GETID3_ASF_Old_Temporal_Enhancement' =>
'D6E229FA-35DA-11D1-9034-00A0C90349BE',
1975 'GETID3_ASF_Old_Spatial_Enhancement' =>
'D6E229FB-35DA-11D1-9034-00A0C90349BE',
1976 'GETID3_ASF_Old_Quality_Enhancement' =>
'D6E229FC-35DA-11D1-9034-00A0C90349BE',
1977 'GETID3_ASF_Old_Number_of_Channels_Enhancement' =>
'D6E229FD-35DA-11D1-9034-00A0C90349BE',
1978 'GETID3_ASF_Old_Frequency_Response_Enhancement' =>
'D6E229FE-35DA-11D1-9034-00A0C90349BE',
1979 'GETID3_ASF_Old_Media_Object' =>
'D6E229FF-35DA-11D1-9034-00A0C90349BE',
1980 'GETID3_ASF_Mutex_Language' =>
'D6E22A00-35DA-11D1-9034-00A0C90349BE',
1981 'GETID3_ASF_Mutex_Bitrate' =>
'D6E22A01-35DA-11D1-9034-00A0C90349BE',
1982 'GETID3_ASF_Mutex_Unknown' =>
'D6E22A02-35DA-11D1-9034-00A0C90349BE',
1983 'GETID3_ASF_Old_ASF_Placeholder_Object' =>
'D6E22A0E-35DA-11D1-9034-00A0C90349BE',
1984 'GETID3_ASF_Old_Data_Unit_Extension_Object' =>
'D6E22A0F-35DA-11D1-9034-00A0C90349BE',
1985 'GETID3_ASF_Web_Stream_Format' =>
'DA1E6B13-8359-4050-B398-388E965BF00C',
1986 'GETID3_ASF_Payload_Ext_System_File_Name' =>
'E165EC0E-19ED-45D7-B4A7-25CBD1E28E9B',
1987 'GETID3_ASF_Marker_Object' =>
'F487CD01-A951-11CF-8EE6-00C00C205365',
1988 'GETID3_ASF_Timecode_Index_Parameters_Object' =>
'F55E496D-9797-4B5D-8C8B-604DFE9BFB24',
1989 'GETID3_ASF_Audio_Media' =>
'F8699E40-5B4D-11CF-A8FD-00805F5C442B',
1990 'GETID3_ASF_Media_Object_Index_Object' =>
'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C',
1991 'GETID3_ASF_Alt_Extended_Content_Encryption_Obj' =>
'FF889EF1-ADEE-40DA-9E71-98704BB928CE',
1992 'GETID3_ASF_Index_Placeholder_Object' =>
'D9AADE20-7C17-4F9C-BC28-8555DD98E2A2',
1993 'GETID3_ASF_Compatibility_Object' =>
'26F18B5D-4584-47EC-9F5F-0E651F0452C9',
2001 static $GUIDarray =
array();
2002 if (empty($GUIDarray)) {
2003 $GUIDarray = self::KnownGUIDs();
2006 return array_search($GUIDstring, $GUIDarray);
2011 static $ASFIndexObjectIndexTypeLookup =
array();
2012 if (empty($ASFIndexObjectIndexTypeLookup)) {
2013 $ASFIndexObjectIndexTypeLookup[1] =
'Nearest Past Data Packet';
2014 $ASFIndexObjectIndexTypeLookup[2] =
'Nearest Past Media Object';
2015 $ASFIndexObjectIndexTypeLookup[3] =
'Nearest Past Cleanpoint';
2018 return (isset($ASFIndexObjectIndexTypeLookup[$id]) ? $ASFIndexObjectIndexTypeLookup[$id] :
'invalid');
2032 $hexbytecharstring = chr(hexdec(substr($GUIDstring, 6, 2)));
2033 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 4, 2)));
2034 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 2, 2)));
2035 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 0, 2)));
2037 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 11, 2)));
2038 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 9, 2)));
2040 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 16, 2)));
2041 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 14, 2)));
2043 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 19, 2)));
2044 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 21, 2)));
2046 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 24, 2)));
2047 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 26, 2)));
2048 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 28, 2)));
2049 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 30, 2)));
2050 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 32, 2)));
2051 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 34, 2)));
2053 return $hexbytecharstring;
2058 $GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2,
'0', STR_PAD_LEFT);
2059 $GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2,
'0', STR_PAD_LEFT);
2060 $GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2,
'0', STR_PAD_LEFT);
2061 $GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2,
'0', STR_PAD_LEFT);
2063 $GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2,
'0', STR_PAD_LEFT);
2064 $GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2,
'0', STR_PAD_LEFT);
2066 $GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2,
'0', STR_PAD_LEFT);
2067 $GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2,
'0', STR_PAD_LEFT);
2069 $GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2,
'0', STR_PAD_LEFT);
2070 $GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2,
'0', STR_PAD_LEFT);
2072 $GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2,
'0',
2074 $GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2,
'0',
2076 $GUIDstring .= str_pad(dechex(ord($Bytestring{12})), 2,
'0',
2078 $GUIDstring .= str_pad(dechex(ord($Bytestring{13})), 2,
'0',
2080 $GUIDstring .= str_pad(dechex(ord($Bytestring{14})), 2,
'0',
2082 $GUIDstring .= str_pad(dechex(ord($Bytestring{15})), 2,
'0',
2085 return strtoupper($GUIDstring);
2095 return intval(round(($FILETIME - 116444736000000000) / 10000000));
2098 return ($FILETIME - 116444736000000000) / 10000000;
2103 static $WMpictureTypeLookup =
array();
2104 if (empty($WMpictureTypeLookup)) {
2140 'Recording Location');
2143 'During Recording');
2146 'During Performance');
2149 'Video Screen Capture');
2158 'Publisher Logotype');
2161 return (isset($WMpictureTypeLookup[$WMpictureType]) ? $WMpictureTypeLookup[$WMpictureType] :
'');
2172 &$unhandled_sections)
2176 $HeaderExtensionObjectParsed =
array();
2177 while ($objectOffset < strlen($asf_header_extension_object_data)) {
2178 $offset = $objectOffset;
2179 $thisObject =
array();
2181 $thisObject[
'guid'] = substr($asf_header_extension_object_data,
2184 $thisObject[
'guid_text'] = self::BytestringToGUID($thisObject[
'guid']);
2185 $thisObject[
'guid_name'] = self::GUIDname($thisObject[
'guid_text']);
2191 if ($thisObject[
'size'] <= 0) {
2195 switch ($thisObject[
'guid']) {
2196 case self::$GETID3_ASF_Extended_Stream_Properties_Object:
2201 $thisObject[
'start_time_unix'] = self::FILETIMEtoUNIXtime($thisObject[
'start_time']);
2207 $thisObject[
'end_time_unix'] = self::FILETIMEtoUNIXtime($thisObject[
'end_time']);
2234 $thisObject[
'alternate_initial_buffer_fullness'] =
Helper::LittleEndian2Int(substr($asf_header_extension_object_data,
2248 $thisObject[
'flags'][
'reliable'] = (bool) $thisObject[
'flags_raw'] & 0x00000001;
2249 $thisObject[
'flags'][
'seekable'] = (bool) $thisObject[
'flags_raw'] & 0x00000002;
2250 $thisObject[
'flags'][
'no_cleanpoints'] = (bool) $thisObject[
'flags_raw'] & 0x00000004;
2251 $thisObject[
'flags'][
'resend_live_cleanpoints'] = (bool) $thisObject[
'flags_raw'] & 0x00000008;
2278 for ($i = 0; $i < $thisObject[
'stream_name_count']; $i++) {
2279 $streamName =
array();
2293 $streamName[
'stream_name_length']));
2294 $offset += $streamName[
'stream_name_length'];
2296 $thisObject[
'stream_names'][$i] = $streamName;
2300 $i < $thisObject[
'payload_extension_system_count'];
2302 $payloadExtensionSystem =
array();
2304 $payloadExtensionSystem[
'extension_system_id'] = substr($asf_header_extension_object_data,
2308 $payloadExtensionSystem[
'extension_system_id_text'] = self::BytestringToGUID($payloadExtensionSystem[
'extension_system_id']);
2310 $payloadExtensionSystem[
'extension_system_size'] =
Helper::LittleEndian2Int(substr($asf_header_extension_object_data,
2314 if ($payloadExtensionSystem[
'extension_system_size'] <= 0) {
2318 $payloadExtensionSystem[
'extension_system_info_length'] =
Helper::LittleEndian2Int(substr($asf_header_extension_object_data,
2323 $payloadExtensionSystem[
'extension_system_info_length'] =
Helper::LittleEndian2Int(substr($asf_header_extension_object_data,
2325 $payloadExtensionSystem[
'extension_system_info_length']));
2326 $offset += $payloadExtensionSystem[
'extension_system_info_length'];
2328 $thisObject[
'payload_extension_systems'][$i] = $payloadExtensionSystem;
2333 case self::$GETID3_ASF_Padding_Object:
2337 case self::$GETID3_ASF_Metadata_Object:
2343 for ($i = 0; $i < $thisObject[
'description_record_counts'];
2345 $descriptionRecord =
array();
2366 $descriptionRecord[
'data_type_text'] = self::ASFmetadataLibraryObjectDataTypeLookup($descriptionRecord[
'data_type']);
2373 $descriptionRecord[
'name'] = substr($asf_header_extension_object_data,
2375 $descriptionRecord[
'name_length']);
2376 $offset += $descriptionRecord[
'name_length'];
2378 $descriptionRecord[
'data'] = substr($asf_header_extension_object_data,
2380 $descriptionRecord[
'data_length']);
2381 $offset += $descriptionRecord[
'data_length'];
2382 switch ($descriptionRecord[
'data_type']) {
2401 $descriptionRecord[
'data_text'] = self::BytestringToGUID($descriptionRecord[
'data']);
2405 $thisObject[
'description_record'][$i] = $descriptionRecord;
2409 case self::$GETID3_ASF_Language_List_Object:
2415 for ($i = 0; $i < $thisObject[
'language_id_record_counts'];
2417 $languageIDrecord =
array();
2424 $languageIDrecord[
'language_id'] = substr($asf_header_extension_object_data,
2426 $languageIDrecord[
'language_id_length']);
2427 $offset += $languageIDrecord[
'language_id_length'];
2429 $thisObject[
'language_id_record'][$i] = $languageIDrecord;
2433 case self::$GETID3_ASF_Metadata_Library_Object:
2439 for ($i = 0; $i < $thisObject[
'description_records_count'];
2441 $descriptionRecord =
array();
2462 $descriptionRecord[
'data_type_text'] = self::ASFmetadataLibraryObjectDataTypeLookup($descriptionRecord[
'data_type']);
2469 $descriptionRecord[
'name'] = substr($asf_header_extension_object_data,
2471 $descriptionRecord[
'name_length']);
2472 $offset += $descriptionRecord[
'name_length'];
2474 $descriptionRecord[
'data'] = substr($asf_header_extension_object_data,
2476 $descriptionRecord[
'data_length']);
2477 $offset += $descriptionRecord[
'data_length'];
2479 if (preg_match(
'#^WM/Picture$#',
2480 str_replace(
"\x00",
'',
2481 trim($descriptionRecord[
'name'])))) {
2482 $WMpicture = $this->
ASF_WMpicture($descriptionRecord[
'data']);
2483 foreach ($WMpicture as $key => $value) {
2484 $descriptionRecord[
'data'] = $WMpicture;
2489 $thisObject[
'description_record'][$i] = $descriptionRecord;
2494 $unhandled_sections++;
2495 if (self::GUIDname($thisObject[
'guid_text'])) {
2496 $this->getid3->info[
'warning'][] =
'unhandled Header Extension Object GUID "' . self::GUIDname($thisObject[
'guid_text']) .
'" {' . $thisObject[
'guid_text'] .
'} at offset ' . ($offset - 16 - 8);
2498 $this->getid3->info[
'warning'][] =
'unknown Header Extension Object GUID {' . $thisObject[
'guid_text'] .
'} in at offset ' . ($offset - 16 - 8);
2502 $HeaderExtensionObjectParsed[] = $thisObject;
2504 $objectOffset += $thisObject[
'size'];
2507 return $HeaderExtensionObjectParsed;
2512 static $ASFmetadataLibraryObjectDataTypeLookup =
array(
2513 0x0000 =>
'Unicode string',
2514 0x0001 =>
'BYTE array',
2522 return (isset($ASFmetadataLibraryObjectDataTypeLookup[$id]) ? $ASFmetadataLibraryObjectDataTypeLookup[$id] :
'invalid');
2535 $WMpicture =
array();
2548 $WMpicture[
'image_mime'] =
'';
2550 $next_byte_pair = substr(
$data, $offset, 2);
2552 $WMpicture[
'image_mime'] .= $next_byte_pair;
2553 }
while ($next_byte_pair !==
"\x00\x00");
2555 $WMpicture[
'image_description'] =
'';
2557 $next_byte_pair = substr(
$data, $offset, 2);
2559 $WMpicture[
'image_description'] .= $next_byte_pair;
2560 }
while ($next_byte_pair !==
"\x00\x00");
2562 $WMpicture[
'dataoffset'] = $offset;
2563 $WMpicture[
'data'] = substr(
$data, $offset);
2565 $imageinfo =
array();
2566 $WMpicture[
'image_mime'] =
'';
2570 if (!empty($imagechunkcheck)) {
2571 $WMpicture[
'image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
2573 if (!isset($this->getid3->info[
'asf'][
'comments'][
'picture'])) {
2574 $this->getid3->info[
'asf'][
'comments'][
'picture'] =
array();
2576 $this->getid3->info[
'asf'][
'comments'][
'picture'][] =
array(
'data' => $WMpicture[
'data'],
'image_mime' => $WMpicture[
'image_mime']);
2585 self::TrimTerm($string)),
2593 if (substr($string, -2) ===
"\x00\x00") {
2594 $string = substr($string, 0, -2);
static $GETID3_ASF_Digital_Signature_Object
static $GETID3_ASF_Extended_Content_Encryption_Object
static $GETID3_ASF_Codec_List_Object
static GetDataImageSize($imgData, &$imageinfo)
string $tempdir
static $GETID3_ASF_Old_VCM_Codec
static $GETID3_ASF_Old_No_Enhancement
static $GETID3_ASF_Metadata_Library_Object
static $GETID3_ASF_Old_ASF_Header_Object
static $GETID3_ASF_Old_Unknown_Enhancement_Type
static $GETID3_ASF_Header_Object
GetId3() by James Heinrich info@getid3.org //.
static $GETID3_ASF_Old_Script_Command_Object
static $GETID3_ASF_Old_Media_Object
static $GETID3_ASF_Audio_Media
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
static $GETID3_ASF_File_Properties_Object
static ASFmetadataLibraryObjectDataTypeLookup($id)
static $GETID3_ASF_Reserved_1
static $GETID3_ASF_Old_QuickTime_Codec
static $GETID3_ASF_Payload_Ext_Syst_Sample_Duration
static $GETID3_ASF_Old_Frequency_Response_Enhancement
GetId3() by James Heinrich info@getid3.org //.
static $GETID3_ASF_File_Transfer_Media
static WMpictureTypeLookup($WMpictureType)
static TrimConvert($string)
static $GETID3_ASF_Content_Description_Object
static $GETID3_ASF_Stream_Properties_Object
static $GETID3_ASF_Old_MIDI_Media
static $GETID3_ASF_Stream_Prioritization_Object
static $GETID3_ASF_Old_Stream_Properties_Object
static $GETID3_ASF_Payload_Ext_System_Content_Type
static $GETID3_ASF_Compatibility_Object
static $GETID3_ASF_Old_Scrambled_Audio
static $GETID3_ASF_Payload_Ext_System_File_Name
__construct(GetId3Core $getid3)
static $GETID3_ASF_Old_No_Error_Concealment
static $GETID3_ASF_Old_Color_Table_Object
static $GETID3_ASF_JFIF_Media
static $GETID3_ASF_Old_Language_List_Object
static $GETID3_ASF_Audio_Spread
static $GETID3_ASF_Old_Component_Download_Object
static $GETID3_ASF_Web_Stream_Format
static $GETID3_ASF_Old_Text_Media
static $GETID3_ASF_Language_List_Object
static RIFFparseWAVEFORMATex($WaveFormatExData)
static $GETID3_ASF_Reserved_3
static $GETID3_ASF_Old_No_Color_Table
static $GETID3_ASF_Bandwidth_Sharing_Partial
static RIFFfourccLookup($fourcc)
static $GETID3_ASF_Timecode_Index_Object
static $GETID3_ASF_Script_Command_Object
GetId3() by James Heinrich info@getid3.org //.
static $GETID3_ASF_Old_HTML_Text
fseek($bytes, $whence=SEEK_SET)
static $GETID3_ASF_Old_File_Properties_Object
static $GETID3_ASF_Content_Branding_Object
static $GETID3_ASF_Old_Marker_Object
static $GETID3_ASF_Old_RTP_Extension_Data
static $GETID3_ASF_Old_Video_Media
GetId3() by James Heinrich info@getid3.org //.
static $GETID3_ASF_Simple_Index_Object
static $GETID3_ASF_Old_ASF_Placeholder_Object
static $GETID3_ASF_Stream_Bitrate_Properties_Object
static $GETID3_ASF_Video_Media
static $GETID3_ASF_Mutex_Unknown
static $GETID3_ASF_Extended_Stream_Properties_Object
static $GETID3_ASF_Old_ASF_Data_Object
static $GETID3_ASF_Reserved_4
static $GETID3_ASF_Media_Object_Index_Object
static $GETID3_ASF_Old_Quality_Enhancement
static $GETID3_ASF_Degradable_JPEG_Media
static $GETID3_ASF_Bandwidth_Sharing_Object
static $GETID3_ASF_Index_Placeholder_Object
static $GETID3_ASF_Timecode_Index_Parameters_Object
static $GETID3_ASF_Payload_Extension_System_Timecode
static $GETID3_ASF_Old_ASCII_Text
static ASFIndexObjectIndexTypeLookup($id)
static $GETID3_ASF_Content_Encryption_Object
static $GETID3_ASF_Bandwidth_Sharing_Exclusive
static $GETID3_ASF_Alt_Extended_Content_Encryption_Obj
static $GETID3_ASF_Old_Temporal_Enhancement
static $GETID3_ASF_Binary_Media
Create styles array
The data for the language used.
static $GETID3_ASF_Old_URL_Command
static $GETID3_ASF_Old_Number_of_Channels_Enhancement
static $GETID3_ASF_Index_Object
static ASFCodecListObjectTypeLookup($CodecListType)
static $GETID3_ASF_Old_Image_Media
ASF_HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections)
static $GETID3_ASF_Old_Prioritization_Object
static GUIDname($GUIDstring)
static $GETID3_ASF_Error_Correction_Object
static $GETID3_ASF_Metadata_Object
static $GETID3_ASF_Old_DirectShow_Transform_Filter
static $GETID3_ASF_Web_Stream_Media_Subtype
static $GETID3_ASF_Reserved_2
static $GETID3_ASF_Header_Extension_Object
static LittleEndian2Int($byteword, $signed=false)
static $GETID3_ASF_Extended_Content_Description_Object
static $GETID3_ASF_Padding_Object
static $GETID3_ASF_Media_Object_Index_Parameters_Obj
static $GETID3_ASF_Old_Content_Description_Object
static $GETID3_ASF_Old_Unicode_Text
static GUIDtoBytestring($GUIDstring)
static $GETID3_ASF_Marker_Object
static $GETID3_ASF_Old_Stream_Group_Object
static $GETID3_ASF_No_Error_Correction
static FILETIMEtoUNIXtime($FILETIME, $round=true)
static $GETID3_ASF_Old_Command_Media
static array_merge_noclobber($array1, $array2)
static $GETID3_ASF_Advanced_Mutual_Exclusion_Object
static $GETID3_ASF_Old_ACM_Codec
static $GETID3_ASF_Mutex_Bitrate
static $GETID3_ASF_Command_Media
static $GETID3_ASF_Old_Rating_Object
static $GETID3_ASF_Payload_Ext_Syst_Pixel_Aspect_Ratio
static $GETID3_ASF_Old_SMPTE_Time
static $GETID3_ASF_Old_Audio_Media
static $GETID3_ASF_Old_Inter_Media_Dependency_Object
static $GETID3_ASF_Group_Mutual_Exclusion_Object
static $GETID3_ASF_Bitrate_Mutual_Exclusion_Object
static $GETID3_ASF_Index_Parameters_Object
static $GETID3_ASF_Old_Scalable_Object
static $GETID3_ASF_Old_Data_Unit_Extension_Object
static $GETID3_ASF_Old_Timecode_Media
static BytestringToGUID($Bytestring)
static $GETID3_ASF_Old_DirectShow_Rendering_Filter
static $GETID3_ASF_Old_Spatial_Enhancement
static $GETID3_ASF_Data_Object
static iconv_fallback($in_charset, $out_charset, $string)
array $ConversionFunctionList
static $GETID3_ASF_Mutex_Language
static $GETID3_ASF_Old_Filename_Command