22 parent::__construct($getid3);
26 foreach ($GUIDarray as $GUIDname => $hexstringvalue) {
34 $info = &$this->getid3->info;
37 $thisfile_audio = &
$info[
'audio'];
38 $thisfile_video = &
$info[
'video'];
40 $thisfile_asf = &
$info[
'asf'];
41 $thisfile_asf[
'comments'] =
array();
42 $thisfile_asf_comments = &$thisfile_asf[
'comments'];
43 $thisfile_asf[
'header_object'] =
array();
44 $thisfile_asf_headerobject = &$thisfile_asf[
'header_object'];
67 $info[
'fileformat'] =
'asf';
70 $HeaderObjectData = $this->
fread(30);
72 $thisfile_asf_headerobject[
'objectid'] = substr($HeaderObjectData, 0, 16);
73 $thisfile_asf_headerobject[
'objectid_guid'] = $this->
BytestringToGUID($thisfile_asf_headerobject[
'objectid']);
74 if ($thisfile_asf_headerobject[
'objectid'] != GETID3_ASF_Header_Object) {
76 return $this->
error(
'ASF header GUID {'.$this->
BytestringToGUID($thisfile_asf_headerobject[
'objectid']).
'} does not match expected "GETID3_ASF_Header_Object" GUID {'.$this->
BytestringToGUID(GETID3_ASF_Header_Object).
'}');
83 $NextObjectOffset = $this->
ftell();
84 $ASFHeaderData = $this->
fread($thisfile_asf_headerobject[
'objectsize'] - 30);
87 for ($HeaderObjectsCounter = 0; $HeaderObjectsCounter < $thisfile_asf_headerobject[
'headerobjects']; $HeaderObjectsCounter++) {
88 $NextObjectGUID = substr($ASFHeaderData, $offset, 16);
93 switch ($NextObjectGUID) {
95 case GETID3_ASF_File_Properties_Object:
116 $thisfile_asf[
'file_properties_object'] =
array();
117 $thisfile_asf_filepropertiesobject = &$thisfile_asf[
'file_properties_object'];
119 $thisfile_asf_filepropertiesobject[
'offset'] = $NextObjectOffset + $offset;
120 $thisfile_asf_filepropertiesobject[
'objectid'] = $NextObjectGUID;
121 $thisfile_asf_filepropertiesobject[
'objectid_guid'] = $NextObjectGUIDtext;
122 $thisfile_asf_filepropertiesobject[
'objectsize'] = $NextObjectSize;
123 $thisfile_asf_filepropertiesobject[
'fileid'] = substr($ASFHeaderData, $offset, 16);
125 $thisfile_asf_filepropertiesobject[
'fileid_guid'] = $this->
BytestringToGUID($thisfile_asf_filepropertiesobject[
'fileid']);
129 $thisfile_asf_filepropertiesobject[
'creation_date_unix'] = $this->
FILETIMEtoUNIXtime($thisfile_asf_filepropertiesobject[
'creation_date']);
141 $thisfile_asf_filepropertiesobject[
'flags'][
'broadcast'] = (bool) ($thisfile_asf_filepropertiesobject[
'flags_raw'] & 0x0001);
142 $thisfile_asf_filepropertiesobject[
'flags'][
'seekable'] = (bool) ($thisfile_asf_filepropertiesobject[
'flags_raw'] & 0x0002);
151 if ($thisfile_asf_filepropertiesobject[
'flags'][
'broadcast']) {
154 unset($thisfile_asf_filepropertiesobject[
'filesize']);
155 unset($thisfile_asf_filepropertiesobject[
'data_packets']);
156 unset($thisfile_asf_filepropertiesobject[
'play_duration']);
157 unset($thisfile_asf_filepropertiesobject[
'send_duration']);
158 unset($thisfile_asf_filepropertiesobject[
'min_packet_size']);
159 unset($thisfile_asf_filepropertiesobject[
'max_packet_size']);
164 $info[
'playtime_seconds'] = ($thisfile_asf_filepropertiesobject[
'play_duration'] / 10000000) - ($thisfile_asf_filepropertiesobject[
'preroll'] / 1000);
167 $info[
'bitrate'] = ((isset($thisfile_asf_filepropertiesobject[
'filesize']) ? $thisfile_asf_filepropertiesobject[
'filesize'] :
$info[
'filesize']) * 8) /
$info[
'playtime_seconds'];
171 case GETID3_ASF_Stream_Properties_Object:
193 $StreamPropertiesObjectData[
'offset'] = $NextObjectOffset + $offset;
194 $StreamPropertiesObjectData[
'objectid'] = $NextObjectGUID;
195 $StreamPropertiesObjectData[
'objectid_guid'] = $NextObjectGUIDtext;
196 $StreamPropertiesObjectData[
'objectsize'] = $NextObjectSize;
197 $StreamPropertiesObjectData[
'stream_type'] = substr($ASFHeaderData, $offset, 16);
199 $StreamPropertiesObjectData[
'stream_type_guid'] = $this->
BytestringToGUID($StreamPropertiesObjectData[
'stream_type']);
200 $StreamPropertiesObjectData[
'error_correct_type'] = substr($ASFHeaderData, $offset, 16);
202 $StreamPropertiesObjectData[
'error_correct_guid'] = $this->
BytestringToGUID($StreamPropertiesObjectData[
'error_correct_type']);
211 $StreamPropertiesObjectStreamNumber = $StreamPropertiesObjectData[
'flags_raw'] & 0x007F;
212 $StreamPropertiesObjectData[
'flags'][
'encrypted'] = (bool) ($StreamPropertiesObjectData[
'flags_raw'] & 0x8000);
215 $StreamPropertiesObjectData[
'type_specific_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData[
'type_data_length']);
216 $offset += $StreamPropertiesObjectData[
'type_data_length'];
217 $StreamPropertiesObjectData[
'error_correct_data'] = substr($ASFHeaderData, $offset, $StreamPropertiesObjectData[
'error_data_length']);
218 $offset += $StreamPropertiesObjectData[
'error_data_length'];
220 switch ($StreamPropertiesObjectData[
'stream_type']) {
222 case GETID3_ASF_Audio_Media:
223 $thisfile_audio[
'dataformat'] = (!empty($thisfile_audio[
'dataformat']) ? $thisfile_audio[
'dataformat'] :
'asf');
224 $thisfile_audio[
'bitrate_mode'] = (!empty($thisfile_audio[
'bitrate_mode']) ? $thisfile_audio[
'bitrate_mode'] :
'cbr');
227 unset($audiodata[
'raw']);
231 case GETID3_ASF_Video_Media:
232 $thisfile_video[
'dataformat'] = (!empty($thisfile_video[
'dataformat']) ? $thisfile_video[
'dataformat'] :
'asf');
233 $thisfile_video[
'bitrate_mode'] = (!empty($thisfile_video[
'bitrate_mode']) ? $thisfile_video[
'bitrate_mode'] :
'cbr');
236 case GETID3_ASF_Command_Media:
243 $thisfile_asf[
'stream_properties_object'][$StreamPropertiesObjectStreamNumber] = $StreamPropertiesObjectData;
244 unset($StreamPropertiesObjectData);
247 case GETID3_ASF_Header_Extension_Object:
258 $thisfile_asf[
'header_extension_object'] =
array();
259 $thisfile_asf_headerextensionobject = &$thisfile_asf[
'header_extension_object'];
261 $thisfile_asf_headerextensionobject[
'offset'] = $NextObjectOffset + $offset;
262 $thisfile_asf_headerextensionobject[
'objectid'] = $NextObjectGUID;
263 $thisfile_asf_headerextensionobject[
'objectid_guid'] = $NextObjectGUIDtext;
264 $thisfile_asf_headerextensionobject[
'objectsize'] = $NextObjectSize;
265 $thisfile_asf_headerextensionobject[
'reserved_1'] = substr($ASFHeaderData, $offset, 16);
267 $thisfile_asf_headerextensionobject[
'reserved_1_guid'] = $this->
BytestringToGUID($thisfile_asf_headerextensionobject[
'reserved_1']);
268 if ($thisfile_asf_headerextensionobject[
'reserved_1'] != GETID3_ASF_Reserved_1) {
269 $this->
warning(
'header_extension_object.reserved_1 GUID ('.$this->
BytestringToGUID($thisfile_asf_headerextensionobject[
'reserved_1']).
') does not match expected "GETID3_ASF_Reserved_1" GUID ('.$this->
BytestringToGUID(GETID3_ASF_Reserved_1).
')');
275 if ($thisfile_asf_headerextensionobject[
'reserved_2'] != 6) {
276 $this->
warning(
'header_extension_object.reserved_2 ('.
getid3_lib::PrintHexBytes($thisfile_asf_headerextensionobject[
'reserved_2']).
') does not match expected value of "6"');
282 $thisfile_asf_headerextensionobject[
'extension_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject[
'extension_data_size']);
283 $unhandled_sections = 0;
284 $thisfile_asf_headerextensionobject[
'extension_data_parsed'] = $this->
HeaderExtensionObjectDataParse($thisfile_asf_headerextensionobject[
'extension_data'], $unhandled_sections);
285 if ($unhandled_sections === 0) {
286 unset($thisfile_asf_headerextensionobject[
'extension_data']);
288 $offset += $thisfile_asf_headerextensionobject[
'extension_data_size'];
291 case GETID3_ASF_Codec_List_Object:
308 $thisfile_asf[
'codec_list_object'] =
array();
309 $thisfile_asf_codeclistobject = &$thisfile_asf[
'codec_list_object'];
311 $thisfile_asf_codeclistobject[
'offset'] = $NextObjectOffset + $offset;
312 $thisfile_asf_codeclistobject[
'objectid'] = $NextObjectGUID;
313 $thisfile_asf_codeclistobject[
'objectid_guid'] = $NextObjectGUIDtext;
314 $thisfile_asf_codeclistobject[
'objectsize'] = $NextObjectSize;
315 $thisfile_asf_codeclistobject[
'reserved'] = substr($ASFHeaderData, $offset, 16);
317 $thisfile_asf_codeclistobject[
'reserved_guid'] = $this->
BytestringToGUID($thisfile_asf_codeclistobject[
'reserved']);
318 if ($thisfile_asf_codeclistobject[
'reserved'] != $this->
GUIDtoBytestring(
'86D15241-311D-11D0-A3A4-00A0C90348F6')) {
319 $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}');
325 for ($CodecEntryCounter = 0; $CodecEntryCounter < $thisfile_asf_codeclistobject[
'codec_entries_count']; $CodecEntryCounter++) {
327 $thisfile_asf_codeclistobject[
'codec_entries'][$CodecEntryCounter] =
array();
328 $thisfile_asf_codeclistobject_codecentries_current = &$thisfile_asf_codeclistobject[
'codec_entries'][$CodecEntryCounter];
332 $thisfile_asf_codeclistobject_codecentries_current[
'type'] = self::codecListObjectTypeLookup($thisfile_asf_codeclistobject_codecentries_current[
'type_raw']);
336 $thisfile_asf_codeclistobject_codecentries_current[
'name'] = substr($ASFHeaderData, $offset, $CodecNameLength);
337 $offset += $CodecNameLength;
341 $thisfile_asf_codeclistobject_codecentries_current[
'description'] = substr($ASFHeaderData, $offset, $CodecDescriptionLength);
342 $offset += $CodecDescriptionLength;
346 $thisfile_asf_codeclistobject_codecentries_current[
'information'] = substr($ASFHeaderData, $offset, $CodecInformationLength);
347 $offset += $CodecInformationLength;
349 if ($thisfile_asf_codeclistobject_codecentries_current[
'type_raw'] == 2) {
351 if (strpos($thisfile_asf_codeclistobject_codecentries_current[
'description'],
',') ===
false) {
352 $this->
warning(
'[asf][codec_list_object][codec_entries]['.$CodecEntryCounter.
'][description] expected to contain comma-separated list of parameters: "'.$thisfile_asf_codeclistobject_codecentries_current[
'description'].
'"');
355 list($AudioCodecBitrate, $AudioCodecFrequency, $AudioCodecChannels) = explode(
',', $this->
TrimConvert($thisfile_asf_codeclistobject_codecentries_current[
'description']));
356 $thisfile_audio[
'codec'] = $this->
TrimConvert($thisfile_asf_codeclistobject_codecentries_current[
'name']);
358 if (!isset($thisfile_audio[
'bitrate']) && strstr($AudioCodecBitrate,
'kbps')) {
359 $thisfile_audio[
'bitrate'] = (int) (trim(str_replace(
'kbps',
'', $AudioCodecBitrate)) * 1000);
362 if (empty($thisfile_video[
'bitrate']) && !empty($thisfile_audio[
'bitrate']) && !empty(
$info[
'bitrate'])) {
364 $thisfile_video[
'bitrate'] =
$info[
'bitrate'] - $thisfile_audio[
'bitrate'];
367 $AudioCodecFrequency = (int) trim(str_replace(
'kHz',
'', $AudioCodecFrequency));
368 switch ($AudioCodecFrequency) {
371 $thisfile_audio[
'sample_rate'] = 8000;
376 $thisfile_audio[
'sample_rate'] = 11025;
381 $thisfile_audio[
'sample_rate'] = 12000;
386 $thisfile_audio[
'sample_rate'] = 16000;
391 $thisfile_audio[
'sample_rate'] = 22050;
396 $thisfile_audio[
'sample_rate'] = 24000;
401 $thisfile_audio[
'sample_rate'] = 32000;
406 $thisfile_audio[
'sample_rate'] = 44100;
411 $thisfile_audio[
'sample_rate'] = 48000;
415 $this->
warning(
'unknown frequency: "'.$AudioCodecFrequency.
'" ('.$this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current[
'description']).
')');
419 if (!isset($thisfile_audio[
'channels'])) {
420 if (strstr($AudioCodecChannels,
'stereo')) {
421 $thisfile_audio[
'channels'] = 2;
422 } elseif (strstr($AudioCodecChannels,
'mono')) {
423 $thisfile_audio[
'channels'] = 1;
432 case GETID3_ASF_Script_Command_Object:
450 $thisfile_asf[
'script_command_object'] =
array();
451 $thisfile_asf_scriptcommandobject = &$thisfile_asf[
'script_command_object'];
453 $thisfile_asf_scriptcommandobject[
'offset'] = $NextObjectOffset + $offset;
454 $thisfile_asf_scriptcommandobject[
'objectid'] = $NextObjectGUID;
455 $thisfile_asf_scriptcommandobject[
'objectid_guid'] = $NextObjectGUIDtext;
456 $thisfile_asf_scriptcommandobject[
'objectsize'] = $NextObjectSize;
457 $thisfile_asf_scriptcommandobject[
'reserved'] = substr($ASFHeaderData, $offset, 16);
459 $thisfile_asf_scriptcommandobject[
'reserved_guid'] = $this->
BytestringToGUID($thisfile_asf_scriptcommandobject[
'reserved']);
460 if ($thisfile_asf_scriptcommandobject[
'reserved'] != $this->
GUIDtoBytestring(
'4B1ACBE3-100B-11D0-A39B-00A0C90348F6')) {
461 $this->
warning(
'script_command_object.reserved GUID {'.$this->
BytestringToGUID($thisfile_asf_scriptcommandobject[
'reserved']).
'} does not match expected "GETID3_ASF_Reserved_1" GUID {4B1ACBE3-100B-11D0-A39B-00A0C90348F6}');
469 for ($CommandTypesCounter = 0; $CommandTypesCounter < $thisfile_asf_scriptcommandobject[
'command_types_count']; $CommandTypesCounter++) {
472 $thisfile_asf_scriptcommandobject[
'command_types'][$CommandTypesCounter][
'name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength);
473 $offset += $CommandTypeNameLength;
475 for ($CommandsCounter = 0; $CommandsCounter < $thisfile_asf_scriptcommandobject[
'commands_count']; $CommandsCounter++) {
476 $thisfile_asf_scriptcommandobject[
'commands'][$CommandsCounter][
'presentation_time'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
478 $thisfile_asf_scriptcommandobject[
'commands'][$CommandsCounter][
'type_index'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
483 $thisfile_asf_scriptcommandobject[
'commands'][$CommandsCounter][
'name'] = substr($ASFHeaderData, $offset, $CommandTypeNameLength);
484 $offset += $CommandTypeNameLength;
488 case GETID3_ASF_Marker_Object:
509 $thisfile_asf[
'marker_object'] =
array();
510 $thisfile_asf_markerobject = &$thisfile_asf[
'marker_object'];
512 $thisfile_asf_markerobject[
'offset'] = $NextObjectOffset + $offset;
513 $thisfile_asf_markerobject[
'objectid'] = $NextObjectGUID;
514 $thisfile_asf_markerobject[
'objectid_guid'] = $NextObjectGUIDtext;
515 $thisfile_asf_markerobject[
'objectsize'] = $NextObjectSize;
516 $thisfile_asf_markerobject[
'reserved'] = substr($ASFHeaderData, $offset, 16);
518 $thisfile_asf_markerobject[
'reserved_guid'] = $this->
BytestringToGUID($thisfile_asf_markerobject[
'reserved']);
519 if ($thisfile_asf_markerobject[
'reserved'] != $this->
GUIDtoBytestring(
'4CFEDB20-75F6-11CF-9C0F-00A0C90349CB')) {
520 $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}');
527 if ($thisfile_asf_markerobject[
'reserved_2'] != 0) {
533 $thisfile_asf_markerobject[
'name'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject[
'name_length']);
534 $offset += $thisfile_asf_markerobject[
'name_length'];
535 for ($MarkersCounter = 0; $MarkersCounter < $thisfile_asf_markerobject[
'markers_count']; $MarkersCounter++) {
538 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'presentation_time'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
540 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'entry_length'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
546 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'marker_description_length'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
548 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'marker_description'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'marker_description_length']);
549 $offset += $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'marker_description_length'];
550 $PaddingLength = $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'entry_length'] - 4 - 4 - 4 - $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'marker_description_length'];
551 if ($PaddingLength > 0) {
552 $thisfile_asf_markerobject[
'markers'][$MarkersCounter][
'padding'] = substr($ASFHeaderData, $offset, $PaddingLength);
553 $offset += $PaddingLength;
558 case GETID3_ASF_Bitrate_Mutual_Exclusion_Object:
568 $thisfile_asf[
'bitrate_mutual_exclusion_object'] =
array();
569 $thisfile_asf_bitratemutualexclusionobject = &$thisfile_asf[
'bitrate_mutual_exclusion_object'];
571 $thisfile_asf_bitratemutualexclusionobject[
'offset'] = $NextObjectOffset + $offset;
572 $thisfile_asf_bitratemutualexclusionobject[
'objectid'] = $NextObjectGUID;
573 $thisfile_asf_bitratemutualexclusionobject[
'objectid_guid'] = $NextObjectGUIDtext;
574 $thisfile_asf_bitratemutualexclusionobject[
'objectsize'] = $NextObjectSize;
575 $thisfile_asf_bitratemutualexclusionobject[
'reserved'] = substr($ASFHeaderData, $offset, 16);
576 $thisfile_asf_bitratemutualexclusionobject[
'reserved_guid'] = $this->
BytestringToGUID($thisfile_asf_bitratemutualexclusionobject[
'reserved']);
578 if (($thisfile_asf_bitratemutualexclusionobject[
'reserved'] != GETID3_ASF_Mutex_Bitrate) && ($thisfile_asf_bitratemutualexclusionobject[
'reserved'] != GETID3_ASF_Mutex_Unknown)) {
579 $this->
warning(
'bitrate_mutual_exclusion_object.reserved GUID {'.$this->
BytestringToGUID($thisfile_asf_bitratemutualexclusionobject[
'reserved']).
'} does not match expected "GETID3_ASF_Mutex_Bitrate" GUID {'.$this->
BytestringToGUID(GETID3_ASF_Mutex_Bitrate).
'} or "GETID3_ASF_Mutex_Unknown" GUID {'.$this->
BytestringToGUID(GETID3_ASF_Mutex_Unknown).
'}');
585 for ($StreamNumberCounter = 0; $StreamNumberCounter < $thisfile_asf_bitratemutualexclusionobject[
'stream_numbers_count']; $StreamNumberCounter++) {
586 $thisfile_asf_bitratemutualexclusionobject[
'stream_numbers'][$StreamNumberCounter] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
591 case GETID3_ASF_Error_Correction_Object:
601 $thisfile_asf[
'error_correction_object'] =
array();
602 $thisfile_asf_errorcorrectionobject = &$thisfile_asf[
'error_correction_object'];
604 $thisfile_asf_errorcorrectionobject[
'offset'] = $NextObjectOffset + $offset;
605 $thisfile_asf_errorcorrectionobject[
'objectid'] = $NextObjectGUID;
606 $thisfile_asf_errorcorrectionobject[
'objectid_guid'] = $NextObjectGUIDtext;
607 $thisfile_asf_errorcorrectionobject[
'objectsize'] = $NextObjectSize;
608 $thisfile_asf_errorcorrectionobject[
'error_correction_type'] = substr($ASFHeaderData, $offset, 16);
610 $thisfile_asf_errorcorrectionobject[
'error_correction_guid'] = $this->
BytestringToGUID($thisfile_asf_errorcorrectionobject[
'error_correction_type']);
613 switch ($thisfile_asf_errorcorrectionobject[
'error_correction_type']) {
614 case GETID3_ASF_No_Error_Correction:
616 $offset += $thisfile_asf_errorcorrectionobject[
'error_correction_data_length'];
619 case GETID3_ASF_Audio_Spread:
635 $thisfile_asf_errorcorrectionobject[
'silence_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_errorcorrectionobject[
'silence_data_length']);
636 $offset += $thisfile_asf_errorcorrectionobject[
'silence_data_length'];
640 $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).
'}');
647 case GETID3_ASF_Content_Description_Object:
664 $thisfile_asf[
'content_description_object'] =
array();
665 $thisfile_asf_contentdescriptionobject = &$thisfile_asf[
'content_description_object'];
667 $thisfile_asf_contentdescriptionobject[
'offset'] = $NextObjectOffset + $offset;
668 $thisfile_asf_contentdescriptionobject[
'objectid'] = $NextObjectGUID;
669 $thisfile_asf_contentdescriptionobject[
'objectid_guid'] = $NextObjectGUIDtext;
670 $thisfile_asf_contentdescriptionobject[
'objectsize'] = $NextObjectSize;
681 $thisfile_asf_contentdescriptionobject[
'title'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject[
'title_length']);
682 $offset += $thisfile_asf_contentdescriptionobject[
'title_length'];
683 $thisfile_asf_contentdescriptionobject[
'author'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject[
'author_length']);
684 $offset += $thisfile_asf_contentdescriptionobject[
'author_length'];
685 $thisfile_asf_contentdescriptionobject[
'copyright'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject[
'copyright_length']);
686 $offset += $thisfile_asf_contentdescriptionobject[
'copyright_length'];
687 $thisfile_asf_contentdescriptionobject[
'description'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject[
'description_length']);
688 $offset += $thisfile_asf_contentdescriptionobject[
'description_length'];
689 $thisfile_asf_contentdescriptionobject[
'rating'] = substr($ASFHeaderData, $offset, $thisfile_asf_contentdescriptionobject[
'rating_length']);
690 $offset += $thisfile_asf_contentdescriptionobject[
'rating_length'];
692 $ASFcommentKeysToCopy =
array(
'title'=>
'title',
'author'=>
'artist',
'copyright'=>
'copyright',
'description'=>
'comment',
'rating'=>
'rating');
693 foreach ($ASFcommentKeysToCopy as $keytocopyfrom => $keytocopyto) {
694 if (!empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) {
695 $thisfile_asf_comments[$keytocopyto][] = $this->
TrimTerm($thisfile_asf_contentdescriptionobject[$keytocopyfrom]);
700 case GETID3_ASF_Extended_Content_Description_Object:
720 $thisfile_asf[
'extended_content_description_object'] =
array();
721 $thisfile_asf_extendedcontentdescriptionobject = &$thisfile_asf[
'extended_content_description_object'];
723 $thisfile_asf_extendedcontentdescriptionobject[
'offset'] = $NextObjectOffset + $offset;
724 $thisfile_asf_extendedcontentdescriptionobject[
'objectid'] = $NextObjectGUID;
725 $thisfile_asf_extendedcontentdescriptionobject[
'objectid_guid'] = $NextObjectGUIDtext;
726 $thisfile_asf_extendedcontentdescriptionobject[
'objectsize'] = $NextObjectSize;
727 $thisfile_asf_extendedcontentdescriptionobject[
'content_descriptors_count'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
729 for ($ExtendedContentDescriptorsCounter = 0; $ExtendedContentDescriptorsCounter < $thisfile_asf_extendedcontentdescriptionobject[
'content_descriptors_count']; $ExtendedContentDescriptorsCounter++) {
731 $thisfile_asf_extendedcontentdescriptionobject[
'content_descriptors'][$ExtendedContentDescriptorsCounter] =
array();
732 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current = &$thisfile_asf_extendedcontentdescriptionobject[
'content_descriptors'][$ExtendedContentDescriptorsCounter];
734 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'base_offset'] = $offset + 30;
735 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name_length'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
737 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name'] = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name_length']);
738 $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name_length'];
739 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_type'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
741 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_length'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
743 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value'] = substr($ASFHeaderData, $offset, $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_length']);
744 $offset += $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_length'];
745 switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_type']) {
754 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value'] = (bool)
getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']);
760 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value'] =
getid3_lib::LittleEndian2Int($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']);
764 $this->
warning(
'extended_content_description.content_descriptors.'.$ExtendedContentDescriptorsCounter.
'.value_type is invalid ('.$thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_type'].
')');
768 switch ($this->
TrimConvert(strtolower($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name']))) {
770 case 'wm/albumartist':
773 $thisfile_asf_comments[
'albumartist'] =
array($this->
TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
776 case 'wm/albumtitle':
778 $thisfile_asf_comments[
'album'] =
array($this->
TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
783 $thisfile_asf_comments[
'genre'] =
array($this->
TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
787 $thisfile_asf_comments[
'partofset'] =
array($this->
TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
790 case 'wm/tracknumber':
793 $thisfile_asf_comments[
'track'] =
array($this->
TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
794 foreach ($thisfile_asf_comments[
'track'] as
$key => $value) {
795 if (preg_match(
'/^[0-9\x00]+$/', $value)) {
796 $thisfile_asf_comments[
'track'][
$key] = intval(str_replace(
"\x00",
'', $value));
802 if (empty($thisfile_asf_comments[
'track'])) {
803 $thisfile_asf_comments[
'track'] =
array(1 + $this->
TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
810 $thisfile_asf_comments[
'year'] =
array( $this->
TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
815 $thisfile_asf_comments[
'lyrics'] =
array($this->
TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
819 if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']) {
820 $thisfile_audio[
'bitrate_mode'] =
'vbr';
821 $thisfile_video[
'bitrate_mode'] =
'vbr';
826 $this->getid3->include_module(
'tag.id3v2');
829 $getid3_id3v2->AnalyzeString($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']);
830 unset($getid3_id3v2);
832 if ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_length'] > 1024) {
833 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value'] =
'<value too large to display>';
837 case 'wm/encodingtime':
838 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'encoding_time_unix'] = $this->
FILETIMEtoUNIXtime($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']);
839 $thisfile_asf_comments[
'encoding_time_unix'] =
array($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'encoding_time_unix']);
843 $WMpicture = $this->
ASF_WMpicture($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']);
844 foreach ($WMpicture as
$key => $value) {
845 $thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
$key] = $value;
889 switch ($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value_type']) {
891 if (substr($this->
TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name']), 0, 3) ==
'WM/') {
892 $thisfile_asf_comments[str_replace(
'wm/',
'', strtolower($this->
TrimConvert($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'name'])))] =
array($this->
TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current[
'value']));
905 case GETID3_ASF_Stream_Bitrate_Properties_Object:
918 $thisfile_asf[
'stream_bitrate_properties_object'] =
array();
919 $thisfile_asf_streambitratepropertiesobject = &$thisfile_asf[
'stream_bitrate_properties_object'];
921 $thisfile_asf_streambitratepropertiesobject[
'offset'] = $NextObjectOffset + $offset;
922 $thisfile_asf_streambitratepropertiesobject[
'objectid'] = $NextObjectGUID;
923 $thisfile_asf_streambitratepropertiesobject[
'objectid_guid'] = $NextObjectGUIDtext;
924 $thisfile_asf_streambitratepropertiesobject[
'objectsize'] = $NextObjectSize;
925 $thisfile_asf_streambitratepropertiesobject[
'bitrate_records_count'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
927 for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitratepropertiesobject[
'bitrate_records_count']; $BitrateRecordsCounter++) {
928 $thisfile_asf_streambitratepropertiesobject[
'bitrate_records'][$BitrateRecordsCounter][
'flags_raw'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2));
930 $thisfile_asf_streambitratepropertiesobject[
'bitrate_records'][$BitrateRecordsCounter][
'flags'][
'stream_number'] = $thisfile_asf_streambitratepropertiesobject[
'bitrate_records'][$BitrateRecordsCounter][
'flags_raw'] & 0x007F;
931 $thisfile_asf_streambitratepropertiesobject[
'bitrate_records'][$BitrateRecordsCounter][
'bitrate'] =
getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4));
936 case GETID3_ASF_Padding_Object:
944 $thisfile_asf[
'padding_object'] =
array();
945 $thisfile_asf_paddingobject = &$thisfile_asf[
'padding_object'];
947 $thisfile_asf_paddingobject[
'offset'] = $NextObjectOffset + $offset;
948 $thisfile_asf_paddingobject[
'objectid'] = $NextObjectGUID;
949 $thisfile_asf_paddingobject[
'objectid_guid'] = $NextObjectGUIDtext;
950 $thisfile_asf_paddingobject[
'objectsize'] = $NextObjectSize;
951 $thisfile_asf_paddingobject[
'padding_length'] = $thisfile_asf_paddingobject[
'objectsize'] - 16 - 8;
952 $thisfile_asf_paddingobject[
'padding'] = substr($ASFHeaderData, $offset, $thisfile_asf_paddingobject[
'padding_length']);
953 $offset += ($NextObjectSize - 16 - 8);
956 case GETID3_ASF_Extended_Content_Encryption_Object:
957 case GETID3_ASF_Content_Encryption_Object:
959 $offset += ($NextObjectSize - 16 - 8);
964 if ($this->
GUIDname($NextObjectGUIDtext)) {
965 $this->
warning(
'unhandled GUID "'.$this->
GUIDname($NextObjectGUIDtext).
'" {'.$NextObjectGUIDtext.
'} in ASF header at offset '.($offset - 16 - 8));
967 $this->
warning(
'unknown GUID {'.$NextObjectGUIDtext.
'} in ASF header at offset '.($offset - 16 - 8));
969 $offset += ($NextObjectSize - 16 - 8);
973 if (isset($thisfile_asf_streambitrateproperties[
'bitrate_records_count'])) {
974 $ASFbitrateAudio = 0;
975 $ASFbitrateVideo = 0;
976 for ($BitrateRecordsCounter = 0; $BitrateRecordsCounter < $thisfile_asf_streambitrateproperties[
'bitrate_records_count']; $BitrateRecordsCounter++) {
977 if (isset($thisfile_asf_codeclistobject[
'codec_entries'][$BitrateRecordsCounter])) {
978 switch ($thisfile_asf_codeclistobject[
'codec_entries'][$BitrateRecordsCounter][
'type_raw']) {
980 $ASFbitrateVideo += $thisfile_asf_streambitrateproperties[
'bitrate_records'][$BitrateRecordsCounter][
'bitrate'];
984 $ASFbitrateAudio += $thisfile_asf_streambitrateproperties[
'bitrate_records'][$BitrateRecordsCounter][
'bitrate'];
993 if ($ASFbitrateAudio > 0) {
994 $thisfile_audio[
'bitrate'] = $ASFbitrateAudio;
996 if ($ASFbitrateVideo > 0) {
997 $thisfile_video[
'bitrate'] = $ASFbitrateVideo;
1000 if (isset($thisfile_asf[
'stream_properties_object']) && is_array($thisfile_asf[
'stream_properties_object'])) {
1002 $thisfile_audio[
'bitrate'] = 0;
1003 $thisfile_video[
'bitrate'] = 0;
1005 foreach ($thisfile_asf[
'stream_properties_object'] as $streamnumber => $streamdata) {
1007 switch ($streamdata[
'stream_type']) {
1008 case GETID3_ASF_Audio_Media:
1020 $thisfile_asf[
'audio_media'][$streamnumber] =
array();
1021 $thisfile_asf_audiomedia_currentstream = &$thisfile_asf[
'audio_media'][$streamnumber];
1023 $audiomediaoffset = 0;
1026 $audiomediaoffset += 16;
1028 $thisfile_audio[
'lossless'] =
false;
1029 switch ($thisfile_asf_audiomedia_currentstream[
'raw'][
'wFormatTag']) {
1032 $thisfile_audio[
'lossless'] =
true;
1036 if (!empty($thisfile_asf[
'stream_bitrate_properties_object'][
'bitrate_records'])) {
1037 foreach ($thisfile_asf[
'stream_bitrate_properties_object'][
'bitrate_records'] as $dummy => $dataarray) {
1038 if (isset($dataarray[
'flags'][
'stream_number']) && ($dataarray[
'flags'][
'stream_number'] == $streamnumber)) {
1039 $thisfile_asf_audiomedia_currentstream[
'bitrate'] = $dataarray[
'bitrate'];
1040 $thisfile_audio[
'bitrate'] += $dataarray[
'bitrate'];
1045 if (!empty($thisfile_asf_audiomedia_currentstream[
'bytes_sec'])) {
1046 $thisfile_audio[
'bitrate'] += $thisfile_asf_audiomedia_currentstream[
'bytes_sec'] * 8;
1047 } elseif (!empty($thisfile_asf_audiomedia_currentstream[
'bitrate'])) {
1048 $thisfile_audio[
'bitrate'] += $thisfile_asf_audiomedia_currentstream[
'bitrate'];
1051 $thisfile_audio[
'streams'][$streamnumber] = $thisfile_asf_audiomedia_currentstream;
1052 $thisfile_audio[
'streams'][$streamnumber][
'wformattag'] = $thisfile_asf_audiomedia_currentstream[
'raw'][
'wFormatTag'];
1053 $thisfile_audio[
'streams'][$streamnumber][
'lossless'] = $thisfile_audio[
'lossless'];
1054 $thisfile_audio[
'streams'][$streamnumber][
'bitrate'] = $thisfile_audio[
'bitrate'];
1055 $thisfile_audio[
'streams'][$streamnumber][
'dataformat'] =
'wma';
1056 unset($thisfile_audio[
'streams'][$streamnumber][
'raw']);
1058 $thisfile_asf_audiomedia_currentstream[
'codec_data_size'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $audiomediaoffset, 2));
1059 $audiomediaoffset += 2;
1060 $thisfile_asf_audiomedia_currentstream[
'codec_data'] = substr($streamdata[
'type_specific_data'], $audiomediaoffset, $thisfile_asf_audiomedia_currentstream[
'codec_data_size']);
1061 $audiomediaoffset += $thisfile_asf_audiomedia_currentstream[
'codec_data_size'];
1065 case GETID3_ASF_Video_Media:
1086 $thisfile_asf[
'video_media'][$streamnumber] =
array();
1087 $thisfile_asf_videomedia_currentstream = &$thisfile_asf[
'video_media'][$streamnumber];
1089 $videomediaoffset = 0;
1090 $thisfile_asf_videomedia_currentstream[
'image_width'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 4));
1091 $videomediaoffset += 4;
1092 $thisfile_asf_videomedia_currentstream[
'image_height'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 4));
1093 $videomediaoffset += 4;
1094 $thisfile_asf_videomedia_currentstream[
'flags'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 1));
1095 $videomediaoffset += 1;
1096 $thisfile_asf_videomedia_currentstream[
'format_data_size'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 2));
1097 $videomediaoffset += 2;
1098 $thisfile_asf_videomedia_currentstream[
'format_data'][
'format_data_size'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 4));
1099 $videomediaoffset += 4;
1100 $thisfile_asf_videomedia_currentstream[
'format_data'][
'image_width'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 4));
1101 $videomediaoffset += 4;
1102 $thisfile_asf_videomedia_currentstream[
'format_data'][
'image_height'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 4));
1103 $videomediaoffset += 4;
1104 $thisfile_asf_videomedia_currentstream[
'format_data'][
'reserved'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 2));
1105 $videomediaoffset += 2;
1106 $thisfile_asf_videomedia_currentstream[
'format_data'][
'bits_per_pixel'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 2));
1107 $videomediaoffset += 2;
1108 $thisfile_asf_videomedia_currentstream[
'format_data'][
'codec_fourcc'] = substr($streamdata[
'type_specific_data'], $videomediaoffset, 4);
1109 $videomediaoffset += 4;
1110 $thisfile_asf_videomedia_currentstream[
'format_data'][
'image_size'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 4));
1111 $videomediaoffset += 4;
1112 $thisfile_asf_videomedia_currentstream[
'format_data'][
'horizontal_pels'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 4));
1113 $videomediaoffset += 4;
1114 $thisfile_asf_videomedia_currentstream[
'format_data'][
'vertical_pels'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 4));
1115 $videomediaoffset += 4;
1116 $thisfile_asf_videomedia_currentstream[
'format_data'][
'colors_used'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 4));
1117 $videomediaoffset += 4;
1118 $thisfile_asf_videomedia_currentstream[
'format_data'][
'colors_important'] =
getid3_lib::LittleEndian2Int(substr($streamdata[
'type_specific_data'], $videomediaoffset, 4));
1119 $videomediaoffset += 4;
1120 $thisfile_asf_videomedia_currentstream[
'format_data'][
'codec_data'] = substr($streamdata[
'type_specific_data'], $videomediaoffset);
1122 if (!empty($thisfile_asf[
'stream_bitrate_properties_object'][
'bitrate_records'])) {
1123 foreach ($thisfile_asf[
'stream_bitrate_properties_object'][
'bitrate_records'] as $dummy => $dataarray) {
1124 if (isset($dataarray[
'flags'][
'stream_number']) && ($dataarray[
'flags'][
'stream_number'] == $streamnumber)) {
1125 $thisfile_asf_videomedia_currentstream[
'bitrate'] = $dataarray[
'bitrate'];
1126 $thisfile_video[
'streams'][$streamnumber][
'bitrate'] = $dataarray[
'bitrate'];
1127 $thisfile_video[
'bitrate'] += $dataarray[
'bitrate'];
1133 $thisfile_asf_videomedia_currentstream[
'format_data'][
'codec'] =
getid3_riff::fourccLookup($thisfile_asf_videomedia_currentstream[
'format_data'][
'codec_fourcc']);
1135 $thisfile_video[
'streams'][$streamnumber][
'fourcc'] = $thisfile_asf_videomedia_currentstream[
'format_data'][
'codec_fourcc'];
1136 $thisfile_video[
'streams'][$streamnumber][
'codec'] = $thisfile_asf_videomedia_currentstream[
'format_data'][
'codec'];
1137 $thisfile_video[
'streams'][$streamnumber][
'resolution_x'] = $thisfile_asf_videomedia_currentstream[
'image_width'];
1138 $thisfile_video[
'streams'][$streamnumber][
'resolution_y'] = $thisfile_asf_videomedia_currentstream[
'image_height'];
1139 $thisfile_video[
'streams'][$streamnumber][
'bits_per_sample'] = $thisfile_asf_videomedia_currentstream[
'format_data'][
'bits_per_pixel'];
1148 while ($this->
ftell() <
$info[
'avdataend']) {
1149 $NextObjectDataHeader = $this->
fread(24);
1151 $NextObjectGUID = substr($NextObjectDataHeader, 0, 16);
1157 switch ($NextObjectGUID) {
1158 case GETID3_ASF_Data_Object:
1168 $thisfile_asf[
'data_object'] =
array();
1169 $thisfile_asf_dataobject = &$thisfile_asf[
'data_object'];
1171 $DataObjectData = $NextObjectDataHeader.$this->fread(50 - 24);
1174 $thisfile_asf_dataobject[
'objectid'] = $NextObjectGUID;
1175 $thisfile_asf_dataobject[
'objectid_guid'] = $NextObjectGUIDtext;
1176 $thisfile_asf_dataobject[
'objectsize'] = $NextObjectSize;
1178 $thisfile_asf_dataobject[
'fileid'] = substr($DataObjectData, $offset, 16);
1180 $thisfile_asf_dataobject[
'fileid_guid'] = $this->
BytestringToGUID($thisfile_asf_dataobject[
'fileid']);
1185 if ($thisfile_asf_dataobject[
'reserved'] != 0x0101) {
1200 $this->
fseek(($thisfile_asf_dataobject[
'objectsize'] - 50), SEEK_CUR);
1204 case GETID3_ASF_Simple_Index_Object:
1218 $thisfile_asf[
'simple_index_object'] =
array();
1219 $thisfile_asf_simpleindexobject = &$thisfile_asf[
'simple_index_object'];
1221 $SimpleIndexObjectData = $NextObjectDataHeader.$this->fread(56 - 24);
1224 $thisfile_asf_simpleindexobject[
'objectid'] = $NextObjectGUID;
1225 $thisfile_asf_simpleindexobject[
'objectid_guid'] = $NextObjectGUIDtext;
1226 $thisfile_asf_simpleindexobject[
'objectsize'] = $NextObjectSize;
1228 $thisfile_asf_simpleindexobject[
'fileid'] = substr($SimpleIndexObjectData, $offset, 16);
1230 $thisfile_asf_simpleindexobject[
'fileid_guid'] = $this->
BytestringToGUID($thisfile_asf_simpleindexobject[
'fileid']);
1231 $thisfile_asf_simpleindexobject[
'index_entry_time_interval'] =
getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 8));
1238 $IndexEntriesData = $SimpleIndexObjectData.$this->fread(6 * $thisfile_asf_simpleindexobject[
'index_entries_count']);
1239 for ($IndexEntriesCounter = 0; $IndexEntriesCounter < $thisfile_asf_simpleindexobject[
'index_entries_count']; $IndexEntriesCounter++) {
1240 $thisfile_asf_simpleindexobject[
'index_entries'][$IndexEntriesCounter][
'packet_number'] =
getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4));
1242 $thisfile_asf_simpleindexobject[
'index_entries'][$IndexEntriesCounter][
'packet_count'] =
getid3_lib::LittleEndian2Int(substr($IndexEntriesData, $offset, 4));
1248 case GETID3_ASF_Index_Object:
1272 $thisfile_asf[
'asf_index_object'] =
array();
1273 $thisfile_asf_asfindexobject = &$thisfile_asf[
'asf_index_object'];
1275 $ASFIndexObjectData = $NextObjectDataHeader.$this->fread(34 - 24);
1278 $thisfile_asf_asfindexobject[
'objectid'] = $NextObjectGUID;
1279 $thisfile_asf_asfindexobject[
'objectid_guid'] = $NextObjectGUIDtext;
1280 $thisfile_asf_asfindexobject[
'objectsize'] = $NextObjectSize;
1289 $ASFIndexObjectData .= $this->
fread(4 * $thisfile_asf_asfindexobject[
'index_specifiers_count']);
1290 for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject[
'index_specifiers_count']; $IndexSpecifiersCounter++) {
1293 $thisfile_asf_asfindexobject[
'index_specifiers'][$IndexSpecifiersCounter][
'stream_number'] = $IndexSpecifierStreamNumber;
1294 $thisfile_asf_asfindexobject[
'index_specifiers'][$IndexSpecifiersCounter][
'index_type'] =
getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 2));
1296 $thisfile_asf_asfindexobject[
'index_specifiers'][$IndexSpecifiersCounter][
'index_type_text'] = $this->
ASFIndexObjectIndexTypeLookup($thisfile_asf_asfindexobject[
'index_specifiers'][$IndexSpecifiersCounter][
'index_type']);
1299 $ASFIndexObjectData .= $this->
fread(4);
1303 $ASFIndexObjectData .= $this->
fread(8 * $thisfile_asf_asfindexobject[
'index_specifiers_count']);
1304 for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject[
'index_specifiers_count']; $IndexSpecifiersCounter++) {
1305 $thisfile_asf_asfindexobject[
'block_positions'][$IndexSpecifiersCounter] =
getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 8));
1309 $ASFIndexObjectData .= $this->
fread(4 * $thisfile_asf_asfindexobject[
'index_specifiers_count'] * $thisfile_asf_asfindexobject[
'index_entry_count']);
1310 for ($IndexEntryCounter = 0; $IndexEntryCounter < $thisfile_asf_asfindexobject[
'index_entry_count']; $IndexEntryCounter++) {
1311 for ($IndexSpecifiersCounter = 0; $IndexSpecifiersCounter < $thisfile_asf_asfindexobject[
'index_specifiers_count']; $IndexSpecifiersCounter++) {
1312 $thisfile_asf_asfindexobject[
'offsets'][$IndexSpecifiersCounter][$IndexEntryCounter] =
getid3_lib::LittleEndian2Int(substr($ASFIndexObjectData, $offset, 4));
1321 if ($this->
GUIDname($NextObjectGUIDtext)) {
1322 $this->
warning(
'unhandled GUID "'.$this->
GUIDname($NextObjectGUIDtext).
'" {'.$NextObjectGUIDtext.
'} in ASF body at offset '.($offset - 16 - 8));
1324 $this->
warning(
'unknown GUID {'.$NextObjectGUIDtext.
'} in ASF body at offset '.($this->ftell() - 16 - 8));
1326 $this->
fseek(($NextObjectSize - 16 - 8), SEEK_CUR);
1331 if (isset($thisfile_asf_codeclistobject[
'codec_entries']) && is_array($thisfile_asf_codeclistobject[
'codec_entries'])) {
1332 foreach ($thisfile_asf_codeclistobject[
'codec_entries'] as $streamnumber => $streamdata) {
1333 switch ($streamdata[
'information']) {
1343 $thisfile_video[
'dataformat'] =
'wmv';
1344 $info[
'mime_type'] =
'video/x-ms-wmv';
1351 $thisfile_video[
'dataformat'] =
'asf';
1352 $info[
'mime_type'] =
'video/x-ms-asf';
1356 switch ($streamdata[
'type_raw']) {
1358 if (strstr($this->
TrimConvert($streamdata[
'name']),
'Windows Media')) {
1359 $thisfile_video[
'dataformat'] =
'wmv';
1360 if (
$info[
'mime_type'] ==
'video/x-ms-asf') {
1361 $info[
'mime_type'] =
'video/x-ms-wmv';
1367 if (strstr($this->
TrimConvert($streamdata[
'name']),
'Windows Media')) {
1368 $thisfile_audio[
'dataformat'] =
'wma';
1369 if (
$info[
'mime_type'] ==
'video/x-ms-asf') {
1370 $info[
'mime_type'] =
'audio/x-ms-wma';
1381 switch (isset($thisfile_audio[
'codec']) ? $thisfile_audio[
'codec'] :
'') {
1382 case 'MPEG Layer-3':
1383 $thisfile_audio[
'dataformat'] =
'mp3';
1390 if (isset($thisfile_asf_codeclistobject[
'codec_entries'])) {
1391 foreach ($thisfile_asf_codeclistobject[
'codec_entries'] as $streamnumber => $streamdata) {
1392 switch ($streamdata[
'type_raw']) {
1395 $thisfile_video[
'encoder'] = $this->
TrimConvert($thisfile_asf_codeclistobject[
'codec_entries'][$streamnumber][
'name']);
1399 $thisfile_audio[
'encoder'] = $this->
TrimConvert($thisfile_asf_codeclistobject[
'codec_entries'][$streamnumber][
'name']);
1402 $thisfile_audio[
'encoder_options'] = $this->
TrimConvert($thisfile_asf_codeclistobject[
'codec_entries'][0][
'description']);
1404 $thisfile_audio[
'codec'] = $thisfile_audio[
'encoder'];
1408 $this->
warning(
'Unknown streamtype: [codec_list_object][codec_entries]['.$streamnumber.
'][type_raw] == '.$streamdata[
'type_raw']);
1415 if (isset(
$info[
'audio'])) {
1416 $thisfile_audio[
'lossless'] = (isset($thisfile_audio[
'lossless']) ? $thisfile_audio[
'lossless'] :
false);
1417 $thisfile_audio[
'dataformat'] = (!empty($thisfile_audio[
'dataformat']) ? $thisfile_audio[
'dataformat'] :
'asf');
1419 if (!empty($thisfile_video[
'dataformat'])) {
1420 $thisfile_video[
'lossless'] = (isset($thisfile_audio[
'lossless']) ? $thisfile_audio[
'lossless'] :
false);
1421 $thisfile_video[
'pixel_aspect_ratio'] = (isset($thisfile_audio[
'pixel_aspect_ratio']) ? $thisfile_audio[
'pixel_aspect_ratio'] : (float) 1);
1422 $thisfile_video[
'dataformat'] = (!empty($thisfile_video[
'dataformat']) ? $thisfile_video[
'dataformat'] :
'asf');
1424 if (!empty($thisfile_video[
'streams'])) {
1425 $thisfile_video[
'resolution_x'] = 0;
1426 $thisfile_video[
'resolution_y'] = 0;
1427 foreach ($thisfile_video[
'streams'] as
$key => $valuearray) {
1428 if (($valuearray[
'resolution_x'] > $thisfile_video[
'resolution_x']) || ($valuearray[
'resolution_y'] > $thisfile_video[
'resolution_y'])) {
1429 $thisfile_video[
'resolution_x'] = $valuearray[
'resolution_x'];
1430 $thisfile_video[
'resolution_y'] = $valuearray[
'resolution_y'];
1434 $info[
'bitrate'] = (isset($thisfile_audio[
'bitrate']) ? $thisfile_audio[
'bitrate'] : 0) + (isset($thisfile_video[
'bitrate']) ? $thisfile_video[
'bitrate'] : 0);
1436 if ((!isset(
$info[
'playtime_seconds']) || (
$info[
'playtime_seconds'] <= 0)) && (
$info[
'bitrate'] > 0)) {
1437 $info[
'playtime_seconds'] = (
$info[
'filesize'] -
$info[
'avdataoffset']) / (
$info[
'bitrate'] / 8);
1444 static $lookup =
array(
1445 0x0001 =>
'Video Codec',
1446 0x0002 =>
'Audio Codec',
1447 0xFFFF =>
'Unknown Codec' 1450 return (isset($lookup[$CodecListType]) ? $lookup[$CodecListType] :
'Invalid Codec Type');
1454 static $GUIDarray =
array(
1455 'GETID3_ASF_Extended_Stream_Properties_Object' =>
'14E6A5CB-C672-4332-8399-A96952065B5A',
1456 'GETID3_ASF_Padding_Object' =>
'1806D474-CADF-4509-A4BA-9AABCB96AAE8',
1457 'GETID3_ASF_Payload_Ext_Syst_Pixel_Aspect_Ratio' =>
'1B1EE554-F9EA-4BC8-821A-376B74E4C4B8',
1458 'GETID3_ASF_Script_Command_Object' =>
'1EFB1A30-0B62-11D0-A39B-00A0C90348F6',
1459 'GETID3_ASF_No_Error_Correction' =>
'20FB5700-5B55-11CF-A8FD-00805F5C442B',
1460 'GETID3_ASF_Content_Branding_Object' =>
'2211B3FA-BD23-11D2-B4B7-00A0C955FC6E',
1461 'GETID3_ASF_Content_Encryption_Object' =>
'2211B3FB-BD23-11D2-B4B7-00A0C955FC6E',
1462 'GETID3_ASF_Digital_Signature_Object' =>
'2211B3FC-BD23-11D2-B4B7-00A0C955FC6E',
1463 'GETID3_ASF_Extended_Content_Encryption_Object' =>
'298AE614-2622-4C17-B935-DAE07EE9289C',
1464 'GETID3_ASF_Simple_Index_Object' =>
'33000890-E5B1-11CF-89F4-00A0C90349CB',
1465 'GETID3_ASF_Degradable_JPEG_Media' =>
'35907DE0-E415-11CF-A917-00805F5C442B',
1466 'GETID3_ASF_Payload_Extension_System_Timecode' =>
'399595EC-8667-4E2D-8FDB-98814CE76C1E',
1467 'GETID3_ASF_Binary_Media' =>
'3AFB65E2-47EF-40F2-AC2C-70A90D71D343',
1468 'GETID3_ASF_Timecode_Index_Object' =>
'3CB73FD0-0C4A-4803-953D-EDF7B6228F0C',
1469 'GETID3_ASF_Metadata_Library_Object' =>
'44231C94-9498-49D1-A141-1D134E457054',
1470 'GETID3_ASF_Reserved_3' =>
'4B1ACBE3-100B-11D0-A39B-00A0C90348F6',
1471 'GETID3_ASF_Reserved_4' =>
'4CFEDB20-75F6-11CF-9C0F-00A0C90349CB',
1472 'GETID3_ASF_Command_Media' =>
'59DACFC0-59E6-11D0-A3AC-00A0C90348F6',
1473 'GETID3_ASF_Header_Extension_Object' =>
'5FBF03B5-A92E-11CF-8EE3-00C00C205365',
1474 'GETID3_ASF_Media_Object_Index_Parameters_Obj' =>
'6B203BAD-3F11-4E84-ACA8-D7613DE2CFA7',
1475 'GETID3_ASF_Header_Object' =>
'75B22630-668E-11CF-A6D9-00AA0062CE6C',
1476 'GETID3_ASF_Content_Description_Object' =>
'75B22633-668E-11CF-A6D9-00AA0062CE6C',
1477 'GETID3_ASF_Error_Correction_Object' =>
'75B22635-668E-11CF-A6D9-00AA0062CE6C',
1478 'GETID3_ASF_Data_Object' =>
'75B22636-668E-11CF-A6D9-00AA0062CE6C',
1479 'GETID3_ASF_Web_Stream_Media_Subtype' =>
'776257D4-C627-41CB-8F81-7AC7FF1C40CC',
1480 'GETID3_ASF_Stream_Bitrate_Properties_Object' =>
'7BF875CE-468D-11D1-8D82-006097C9A2B2',
1481 'GETID3_ASF_Language_List_Object' =>
'7C4346A9-EFE0-4BFC-B229-393EDE415C85',
1482 'GETID3_ASF_Codec_List_Object' =>
'86D15240-311D-11D0-A3A4-00A0C90348F6',
1483 'GETID3_ASF_Reserved_2' =>
'86D15241-311D-11D0-A3A4-00A0C90348F6',
1484 'GETID3_ASF_File_Properties_Object' =>
'8CABDCA1-A947-11CF-8EE4-00C00C205365',
1485 'GETID3_ASF_File_Transfer_Media' =>
'91BD222C-F21C-497A-8B6D-5AA86BFC0185',
1486 'GETID3_ASF_Old_RTP_Extension_Data' =>
'96800C63-4C94-11D1-837B-0080C7A37F95',
1487 'GETID3_ASF_Advanced_Mutual_Exclusion_Object' =>
'A08649CF-4775-4670-8A16-6E35357566CD',
1488 'GETID3_ASF_Bandwidth_Sharing_Object' =>
'A69609E6-517B-11D2-B6AF-00C04FD908E9',
1489 'GETID3_ASF_Reserved_1' =>
'ABD3D211-A9BA-11cf-8EE6-00C00C205365',
1490 'GETID3_ASF_Bandwidth_Sharing_Exclusive' =>
'AF6060AA-5197-11D2-B6AF-00C04FD908E9',
1491 'GETID3_ASF_Bandwidth_Sharing_Partial' =>
'AF6060AB-5197-11D2-B6AF-00C04FD908E9',
1492 'GETID3_ASF_JFIF_Media' =>
'B61BE100-5B4E-11CF-A8FD-00805F5C442B',
1493 'GETID3_ASF_Stream_Properties_Object' =>
'B7DC0791-A9B7-11CF-8EE6-00C00C205365',
1494 'GETID3_ASF_Video_Media' =>
'BC19EFC0-5B4D-11CF-A8FD-00805F5C442B',
1495 'GETID3_ASF_Audio_Spread' =>
'BFC3CD50-618F-11CF-8BB2-00AA00B4E220',
1496 'GETID3_ASF_Metadata_Object' =>
'C5F8CBEA-5BAF-4877-8467-AA8C44FA4CCA',
1497 'GETID3_ASF_Payload_Ext_Syst_Sample_Duration' =>
'C6BD9450-867F-4907-83A3-C77921B733AD',
1498 'GETID3_ASF_Group_Mutual_Exclusion_Object' =>
'D1465A40-5A79-4338-B71B-E36B8FD6C249',
1499 'GETID3_ASF_Extended_Content_Description_Object' =>
'D2D0A440-E307-11D2-97F0-00A0C95EA850',
1500 'GETID3_ASF_Stream_Prioritization_Object' =>
'D4FED15B-88D3-454F-81F0-ED5C45999E24',
1501 'GETID3_ASF_Payload_Ext_System_Content_Type' =>
'D590DC20-07BC-436C-9CF7-F3BBFBF1A4DC',
1502 'GETID3_ASF_Old_File_Properties_Object' =>
'D6E229D0-35DA-11D1-9034-00A0C90349BE',
1503 'GETID3_ASF_Old_ASF_Header_Object' =>
'D6E229D1-35DA-11D1-9034-00A0C90349BE',
1504 'GETID3_ASF_Old_ASF_Data_Object' =>
'D6E229D2-35DA-11D1-9034-00A0C90349BE',
1505 'GETID3_ASF_Index_Object' =>
'D6E229D3-35DA-11D1-9034-00A0C90349BE',
1506 'GETID3_ASF_Old_Stream_Properties_Object' =>
'D6E229D4-35DA-11D1-9034-00A0C90349BE',
1507 'GETID3_ASF_Old_Content_Description_Object' =>
'D6E229D5-35DA-11D1-9034-00A0C90349BE',
1508 'GETID3_ASF_Old_Script_Command_Object' =>
'D6E229D6-35DA-11D1-9034-00A0C90349BE',
1509 'GETID3_ASF_Old_Marker_Object' =>
'D6E229D7-35DA-11D1-9034-00A0C90349BE',
1510 'GETID3_ASF_Old_Component_Download_Object' =>
'D6E229D8-35DA-11D1-9034-00A0C90349BE',
1511 'GETID3_ASF_Old_Stream_Group_Object' =>
'D6E229D9-35DA-11D1-9034-00A0C90349BE',
1512 'GETID3_ASF_Old_Scalable_Object' =>
'D6E229DA-35DA-11D1-9034-00A0C90349BE',
1513 'GETID3_ASF_Old_Prioritization_Object' =>
'D6E229DB-35DA-11D1-9034-00A0C90349BE',
1514 'GETID3_ASF_Bitrate_Mutual_Exclusion_Object' =>
'D6E229DC-35DA-11D1-9034-00A0C90349BE',
1515 'GETID3_ASF_Old_Inter_Media_Dependency_Object' =>
'D6E229DD-35DA-11D1-9034-00A0C90349BE',
1516 'GETID3_ASF_Old_Rating_Object' =>
'D6E229DE-35DA-11D1-9034-00A0C90349BE',
1517 'GETID3_ASF_Index_Parameters_Object' =>
'D6E229DF-35DA-11D1-9034-00A0C90349BE',
1518 'GETID3_ASF_Old_Color_Table_Object' =>
'D6E229E0-35DA-11D1-9034-00A0C90349BE',
1519 'GETID3_ASF_Old_Language_List_Object' =>
'D6E229E1-35DA-11D1-9034-00A0C90349BE',
1520 'GETID3_ASF_Old_Audio_Media' =>
'D6E229E2-35DA-11D1-9034-00A0C90349BE',
1521 'GETID3_ASF_Old_Video_Media' =>
'D6E229E3-35DA-11D1-9034-00A0C90349BE',
1522 'GETID3_ASF_Old_Image_Media' =>
'D6E229E4-35DA-11D1-9034-00A0C90349BE',
1523 'GETID3_ASF_Old_Timecode_Media' =>
'D6E229E5-35DA-11D1-9034-00A0C90349BE',
1524 'GETID3_ASF_Old_Text_Media' =>
'D6E229E6-35DA-11D1-9034-00A0C90349BE',
1525 'GETID3_ASF_Old_MIDI_Media' =>
'D6E229E7-35DA-11D1-9034-00A0C90349BE',
1526 'GETID3_ASF_Old_Command_Media' =>
'D6E229E8-35DA-11D1-9034-00A0C90349BE',
1527 'GETID3_ASF_Old_No_Error_Concealment' =>
'D6E229EA-35DA-11D1-9034-00A0C90349BE',
1528 'GETID3_ASF_Old_Scrambled_Audio' =>
'D6E229EB-35DA-11D1-9034-00A0C90349BE',
1529 'GETID3_ASF_Old_No_Color_Table' =>
'D6E229EC-35DA-11D1-9034-00A0C90349BE',
1530 'GETID3_ASF_Old_SMPTE_Time' =>
'D6E229ED-35DA-11D1-9034-00A0C90349BE',
1531 'GETID3_ASF_Old_ASCII_Text' =>
'D6E229EE-35DA-11D1-9034-00A0C90349BE',
1532 'GETID3_ASF_Old_Unicode_Text' =>
'D6E229EF-35DA-11D1-9034-00A0C90349BE',
1533 'GETID3_ASF_Old_HTML_Text' =>
'D6E229F0-35DA-11D1-9034-00A0C90349BE',
1534 'GETID3_ASF_Old_URL_Command' =>
'D6E229F1-35DA-11D1-9034-00A0C90349BE',
1535 'GETID3_ASF_Old_Filename_Command' =>
'D6E229F2-35DA-11D1-9034-00A0C90349BE',
1536 'GETID3_ASF_Old_ACM_Codec' =>
'D6E229F3-35DA-11D1-9034-00A0C90349BE',
1537 'GETID3_ASF_Old_VCM_Codec' =>
'D6E229F4-35DA-11D1-9034-00A0C90349BE',
1538 'GETID3_ASF_Old_QuickTime_Codec' =>
'D6E229F5-35DA-11D1-9034-00A0C90349BE',
1539 'GETID3_ASF_Old_DirectShow_Transform_Filter' =>
'D6E229F6-35DA-11D1-9034-00A0C90349BE',
1540 'GETID3_ASF_Old_DirectShow_Rendering_Filter' =>
'D6E229F7-35DA-11D1-9034-00A0C90349BE',
1541 'GETID3_ASF_Old_No_Enhancement' =>
'D6E229F8-35DA-11D1-9034-00A0C90349BE',
1542 'GETID3_ASF_Old_Unknown_Enhancement_Type' =>
'D6E229F9-35DA-11D1-9034-00A0C90349BE',
1543 'GETID3_ASF_Old_Temporal_Enhancement' =>
'D6E229FA-35DA-11D1-9034-00A0C90349BE',
1544 'GETID3_ASF_Old_Spatial_Enhancement' =>
'D6E229FB-35DA-11D1-9034-00A0C90349BE',
1545 'GETID3_ASF_Old_Quality_Enhancement' =>
'D6E229FC-35DA-11D1-9034-00A0C90349BE',
1546 'GETID3_ASF_Old_Number_of_Channels_Enhancement' =>
'D6E229FD-35DA-11D1-9034-00A0C90349BE',
1547 'GETID3_ASF_Old_Frequency_Response_Enhancement' =>
'D6E229FE-35DA-11D1-9034-00A0C90349BE',
1548 'GETID3_ASF_Old_Media_Object' =>
'D6E229FF-35DA-11D1-9034-00A0C90349BE',
1549 'GETID3_ASF_Mutex_Language' =>
'D6E22A00-35DA-11D1-9034-00A0C90349BE',
1550 'GETID3_ASF_Mutex_Bitrate' =>
'D6E22A01-35DA-11D1-9034-00A0C90349BE',
1551 'GETID3_ASF_Mutex_Unknown' =>
'D6E22A02-35DA-11D1-9034-00A0C90349BE',
1552 'GETID3_ASF_Old_ASF_Placeholder_Object' =>
'D6E22A0E-35DA-11D1-9034-00A0C90349BE',
1553 'GETID3_ASF_Old_Data_Unit_Extension_Object' =>
'D6E22A0F-35DA-11D1-9034-00A0C90349BE',
1554 'GETID3_ASF_Web_Stream_Format' =>
'DA1E6B13-8359-4050-B398-388E965BF00C',
1555 'GETID3_ASF_Payload_Ext_System_File_Name' =>
'E165EC0E-19ED-45D7-B4A7-25CBD1E28E9B',
1556 'GETID3_ASF_Marker_Object' =>
'F487CD01-A951-11CF-8EE6-00C00C205365',
1557 'GETID3_ASF_Timecode_Index_Parameters_Object' =>
'F55E496D-9797-4B5D-8C8B-604DFE9BFB24',
1558 'GETID3_ASF_Audio_Media' =>
'F8699E40-5B4D-11CF-A8FD-00805F5C442B',
1559 'GETID3_ASF_Media_Object_Index_Object' =>
'FEB103F8-12AD-4C64-840F-2A1D2F7AD48C',
1560 'GETID3_ASF_Alt_Extended_Content_Encryption_Obj' =>
'FF889EF1-ADEE-40DA-9E71-98704BB928CE',
1561 'GETID3_ASF_Index_Placeholder_Object' =>
'D9AADE20-7C17-4F9C-BC28-8555DD98E2A2',
1562 'GETID3_ASF_Compatibility_Object' =>
'26F18B5D-4584-47EC-9F5F-0E651F0452C9',
1568 static $GUIDarray =
array();
1569 if (empty($GUIDarray)) {
1570 $GUIDarray = self::KnownGUIDs();
1572 return array_search($GUIDstring, $GUIDarray);
1576 static $ASFIndexObjectIndexTypeLookup =
array();
1577 if (empty($ASFIndexObjectIndexTypeLookup)) {
1578 $ASFIndexObjectIndexTypeLookup[1] =
'Nearest Past Data Packet';
1579 $ASFIndexObjectIndexTypeLookup[2] =
'Nearest Past Media Object';
1580 $ASFIndexObjectIndexTypeLookup[3] =
'Nearest Past Cleanpoint';
1582 return (isset($ASFIndexObjectIndexTypeLookup[
$id]) ? $ASFIndexObjectIndexTypeLookup[$id] :
'invalid');
1596 $hexbytecharstring = chr(hexdec(substr($GUIDstring, 6, 2)));
1597 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 4, 2)));
1598 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 2, 2)));
1599 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 0, 2)));
1601 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 11, 2)));
1602 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 9, 2)));
1604 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 16, 2)));
1605 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 14, 2)));
1607 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 19, 2)));
1608 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 21, 2)));
1610 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 24, 2)));
1611 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 26, 2)));
1612 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 28, 2)));
1613 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 30, 2)));
1614 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 32, 2)));
1615 $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 34, 2)));
1617 return $hexbytecharstring;
1621 $GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2,
'0', STR_PAD_LEFT);
1622 $GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2,
'0', STR_PAD_LEFT);
1623 $GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2,
'0', STR_PAD_LEFT);
1624 $GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2,
'0', STR_PAD_LEFT);
1626 $GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2,
'0', STR_PAD_LEFT);
1627 $GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2,
'0', STR_PAD_LEFT);
1629 $GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2,
'0', STR_PAD_LEFT);
1630 $GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2,
'0', STR_PAD_LEFT);
1632 $GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2,
'0', STR_PAD_LEFT);
1633 $GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2,
'0', STR_PAD_LEFT);
1635 $GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2,
'0', STR_PAD_LEFT);
1636 $GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2,
'0', STR_PAD_LEFT);
1637 $GUIDstring .= str_pad(dechex(ord($Bytestring{12})), 2,
'0', STR_PAD_LEFT);
1638 $GUIDstring .= str_pad(dechex(ord($Bytestring{13})), 2,
'0', STR_PAD_LEFT);
1639 $GUIDstring .= str_pad(dechex(ord($Bytestring{14})), 2,
'0', STR_PAD_LEFT);
1640 $GUIDstring .= str_pad(dechex(ord($Bytestring{15})), 2,
'0', STR_PAD_LEFT);
1642 return strtoupper($GUIDstring);
1651 return intval(round(($FILETIME - 116444736000000000) / 10000000));
1653 return ($FILETIME - 116444736000000000) / 10000000;
1657 static $lookup = null;
1658 if ($lookup === null) {
1660 0x03 =>
'Front Cover',
1661 0x04 =>
'Back Cover',
1662 0x00 =>
'User Defined',
1663 0x05 =>
'Leaflet Page',
1664 0x06 =>
'Media Label',
1665 0x07 =>
'Lead Artist',
1667 0x09 =>
'Conductor',
1671 0x0D =>
'Recording Location',
1672 0x0E =>
'During Recording',
1673 0x0F =>
'During Performance',
1674 0x10 =>
'Video Screen Capture',
1675 0x12 =>
'Illustration',
1676 0x13 =>
'Band Logotype',
1677 0x14 =>
'Publisher Logotype' 1679 $lookup = array_map(
function($str) {
1684 return (isset($lookup[$WMpictureType]) ? $lookup[$WMpictureType] :
'');
1692 $HeaderExtensionObjectParsed =
array();
1693 while ($objectOffset < strlen($asf_header_extension_object_data)) {
1694 $offset = $objectOffset;
1695 $thisObject =
array();
1697 $thisObject[
'guid'] = substr($asf_header_extension_object_data, $offset, 16);
1700 $thisObject[
'guid_name'] = $this->
GUIDname($thisObject[
'guid_text']);
1704 if ($thisObject[
'size'] <= 0) {
1708 switch ($thisObject[
'guid']) {
1709 case GETID3_ASF_Extended_Stream_Properties_Object:
1712 $thisObject[
'start_time_unix'] = $this->
FILETIMEtoUNIXtime($thisObject[
'start_time']);
1733 $thisObject[
'alternate_initial_buffer_fullness'] =
getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1741 $thisObject[
'flags'][
'reliable'] = (bool) $thisObject[
'flags_raw'] & 0x00000001;
1742 $thisObject[
'flags'][
'seekable'] = (bool) $thisObject[
'flags_raw'] & 0x00000002;
1743 $thisObject[
'flags'][
'no_cleanpoints'] = (bool) $thisObject[
'flags_raw'] & 0x00000004;
1744 $thisObject[
'flags'][
'resend_live_cleanpoints'] = (bool) $thisObject[
'flags_raw'] & 0x00000008;
1761 for (
$i = 0;
$i < $thisObject[
'stream_name_count'];
$i++) {
1762 $streamName =
array();
1770 $streamName[
'stream_name'] =
getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $streamName[
'stream_name_length']));
1771 $offset += $streamName[
'stream_name_length'];
1773 $thisObject[
'stream_names'][
$i] = $streamName;
1776 for (
$i = 0;
$i < $thisObject[
'payload_extension_system_count'];
$i++) {
1777 $payloadExtensionSystem =
array();
1779 $payloadExtensionSystem[
'extension_system_id'] = substr($asf_header_extension_object_data, $offset, 16);
1781 $payloadExtensionSystem[
'extension_system_id_text'] = $this->
BytestringToGUID($payloadExtensionSystem[
'extension_system_id']);
1783 $payloadExtensionSystem[
'extension_system_size'] =
getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2));
1785 if ($payloadExtensionSystem[
'extension_system_size'] <= 0) {
1789 $payloadExtensionSystem[
'extension_system_info_length'] =
getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4));
1792 $payloadExtensionSystem[
'extension_system_info_length'] =
getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $payloadExtensionSystem[
'extension_system_info_length']));
1793 $offset += $payloadExtensionSystem[
'extension_system_info_length'];
1795 $thisObject[
'payload_extension_systems'][
$i] = $payloadExtensionSystem;
1800 case GETID3_ASF_Padding_Object:
1804 case GETID3_ASF_Metadata_Object:
1808 for (
$i = 0;
$i < $thisObject[
'description_record_counts'];
$i++) {
1809 $descriptionRecord =
array();
1822 $descriptionRecord[
'data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord[
'data_type']);
1827 $descriptionRecord[
'name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord[
'name_length']);
1828 $offset += $descriptionRecord[
'name_length'];
1830 $descriptionRecord[
'data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord[
'data_length']);
1831 $offset += $descriptionRecord[
'data_length'];
1832 switch ($descriptionRecord[
'data_type']) {
1851 $descriptionRecord[
'data_text'] = $this->
BytestringToGUID($descriptionRecord[
'data']);
1855 $thisObject[
'description_record'][
$i] = $descriptionRecord;
1859 case GETID3_ASF_Language_List_Object:
1863 for (
$i = 0;
$i < $thisObject[
'language_id_record_counts'];
$i++) {
1864 $languageIDrecord =
array();
1869 $languageIDrecord[
'language_id'] = substr($asf_header_extension_object_data, $offset, $languageIDrecord[
'language_id_length']);
1870 $offset += $languageIDrecord[
'language_id_length'];
1872 $thisObject[
'language_id_record'][
$i] = $languageIDrecord;
1876 case GETID3_ASF_Metadata_Library_Object:
1880 for (
$i = 0;
$i < $thisObject[
'description_records_count'];
$i++) {
1881 $descriptionRecord =
array();
1894 $descriptionRecord[
'data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord[
'data_type']);
1899 $descriptionRecord[
'name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord[
'name_length']);
1900 $offset += $descriptionRecord[
'name_length'];
1902 $descriptionRecord[
'data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord[
'data_length']);
1903 $offset += $descriptionRecord[
'data_length'];
1905 if (preg_match(
'#^WM/Picture$#', str_replace(
"\x00",
'', trim($descriptionRecord[
'name'])))) {
1906 $WMpicture = $this->
ASF_WMpicture($descriptionRecord[
'data']);
1907 foreach ($WMpicture as
$key => $value) {
1908 $descriptionRecord[
'data'] = $WMpicture;
1913 $thisObject[
'description_record'][
$i] = $descriptionRecord;
1918 $unhandled_sections++;
1919 if ($this->
GUIDname($thisObject[
'guid_text'])) {
1920 $this->
warning(
'unhandled Header Extension Object GUID "'.$this->
GUIDname($thisObject[
'guid_text']).
'" {'.$thisObject[
'guid_text'].
'} at offset '.($offset - 16 - 8));
1922 $this->
warning(
'unknown Header Extension Object GUID {'.$thisObject[
'guid_text'].
'} in at offset '.($offset - 16 - 8));
1926 $HeaderExtensionObjectParsed[] = $thisObject;
1928 $objectOffset += $thisObject[
'size'];
1930 return $HeaderExtensionObjectParsed;
1935 static $lookup =
array(
1936 0x0000 =>
'Unicode string',
1937 0x0001 =>
'BYTE array',
1944 return (isset($lookup[
$id]) ? $lookup[$id] :
'invalid');
1956 $WMpicture =
array();
1961 $WMpicture[
'image_type'] = self::WMpictureTypeLookup($WMpicture[
'image_type_id']);
1965 $WMpicture[
'image_mime'] =
'';
1967 $next_byte_pair = substr(
$data, $offset, 2);
1969 $WMpicture[
'image_mime'] .= $next_byte_pair;
1970 }
while ($next_byte_pair !==
"\x00\x00");
1972 $WMpicture[
'image_description'] =
'';
1974 $next_byte_pair = substr(
$data, $offset, 2);
1976 $WMpicture[
'image_description'] .= $next_byte_pair;
1977 }
while ($next_byte_pair !==
"\x00\x00");
1979 $WMpicture[
'dataoffset'] = $offset;
1980 $WMpicture[
'data'] = substr(
$data, $offset);
1982 $imageinfo =
array();
1983 $WMpicture[
'image_mime'] =
'';
1986 if (!empty($imagechunkcheck)) {
1987 $WMpicture[
'image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);
1989 if (!isset($this->getid3->info[
'asf'][
'comments'][
'picture'])) {
1990 $this->getid3->info[
'asf'][
'comments'][
'picture'] =
array();
1992 $this->getid3->info[
'asf'][
'comments'][
'picture'][] =
array(
'data'=>$WMpicture[
'data'],
'image_mime'=>$WMpicture[
'image_mime']);
2007 if (substr($string, -2) ===
"\x00\x00") {
2008 $string = substr($string, 0, -2);
static metadataLibraryObjectDataTypeLookup($id)
__construct(getID3 $getid3)
static codecListObjectTypeLookup($CodecListType)
HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections)
static FILETIMEtoUNIXtime($FILETIME, $round=true)
if(!array_key_exists('StateId', $_REQUEST)) $id
static parseWAVEFORMATex($WaveFormatExData)
static iconv_fallback($in_charset, $out_charset, $string)
static LittleEndian2Int($byteword, $signed=false)
static IncludeDependency($filename, $sourcefile, $DieOnFailure=false)
static GUIDtoBytestring($GUIDstring)
static fourccLookup($fourcc)
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
static BytestringToGUID($Bytestring)
static GetDataImageSize($imgData, &$imageinfo=array())
Create styles array
The data for the language used.
static ASFIndexObjectIndexTypeLookup($id)
static TrimConvert($string)
static GUIDname($GUIDstring)
fseek($bytes, $whence=SEEK_SET)
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
static WMpictureTypeLookup($WMpictureType)
static array_merge_noclobber($array1, $array2)