209 $info = &$this->getid3->info;
211 $atom_parent = array_pop($atomHierarchy);
212 array_push($atomHierarchy, $atomname);
213 $atom_structure[
'hierarchy'] = implode(
' ', $atomHierarchy);
214 $atom_structure[
'name'] = $atomname;
215 $atom_structure[
'size'] = $atomsize;
216 $atom_structure[
'offset'] = $baseoffset;
241 $allnumericnames =
true;
242 foreach ($atom_structure[
'subatoms'] as $subatomarray) {
243 if (!is_integer($subatomarray[
'name']) || (count($subatomarray[
'subatoms']) != 1)) {
244 $allnumericnames =
false;
248 if ($allnumericnames) {
250 foreach ($atom_structure[
'subatoms'] as $subatomarray) {
251 foreach ($subatomarray[
'subatoms'] as $newData_subatomarray) {
252 unset($newData_subatomarray[
'hierarchy'], $newData_subatomarray[
'name']);
253 $newData[$subatomarray[
'name']] = $newData_subatomarray;
257 $atom_structure[
'data'] = $newData;
258 unset($atom_structure[
'subatoms']);
262 case "\x00\x00\x00\x01":
263 case "\x00\x00\x00\x02":
264 case "\x00\x00\x00\x03":
265 case "\x00\x00\x00\x04":
266 case "\x00\x00\x00\x05":
268 $atom_structure[
'name'] = $atomname;
277 foreach ($atom_structure[
'subatoms'] as $key => $value_array) {
278 if (isset($value_array[
'sample_description_table'])) {
279 foreach ($value_array[
'sample_description_table'] as $key2 => $value_array2) {
280 if (isset($value_array2[
'data_format'])) {
281 switch ($value_array2[
'data_format']) {
293 } elseif (isset($value_array[
'time_to_sample_table'])) {
294 foreach ($value_array[
'time_to_sample_table'] as $key2 => $value_array2) {
295 if (isset($value_array2[
'sample_count']) && isset($value_array2[
'sample_duration']) && ($value_array2[
'sample_duration'] > 0)) {
296 $framerate = round(
$info[
'quicktime'][
'time_scale'] / $value_array2[
'sample_duration'], 3);
297 $framecount = $value_array2[
'sample_count'];
302 if ($isVideo && $framerate) {
303 $info[
'quicktime'][
'video'][
'frame_rate'] = $framerate;
304 $info[
'video'][
'frame_rate'] =
$info[
'quicktime'][
'video'][
'frame_rate'];
306 if ($isVideo && $framecount) {
307 $info[
'quicktime'][
'video'][
'frame_count'] = $framecount;
386 if ($atom_parent ==
'udta') {
390 $atom_structure[
'data'] = substr($atom_data, 4);
393 if (empty(
$info[
'comments'][
'language']) || (!in_array($atom_structure[
'language'],
$info[
'comments'][
'language']))) {
394 $info[
'comments'][
'language'][] = $atom_structure[
'language'];
399 if (substr($atom_data, 2, 2) ==
"\x10\xB5") {
402 while ($atomoffset < strlen($atom_data)) {
404 $boxsmalltype = substr($atom_data, $atomoffset + 2, 2);
405 $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize);
406 switch ($boxsmalltype) {
408 $atom_structure[
'data'] = $boxsmalldata;
411 $info[
'warning'][] =
'Unknown QuickTime smallbox type: "'.Helper::PrintHexBytes($boxsmalltype).
'" at offset '.$baseoffset;
412 $atom_structure[
'data'] = $atom_data;
415 $atomoffset += (4 + $boxsmallsize);
418 while ($atomoffset < strlen($atom_data)) {
420 $boxtype = substr($atom_data, $atomoffset + 4, 4);
421 $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8);
423 $info[
'warning'][] =
'Invalid QuickTime atom box size "'.$boxsize.
'" in atom "'.$atomname.
'" at offset: '.($atom_structure[
'offset'] + $atomoffset);
424 $atom_structure[
'data'] = null;
425 $atomoffset = strlen($atom_data);
428 $atomoffset += $boxsize;
433 $atom_structure[$boxtype] = substr($boxdata, 4);
439 switch ($atom_structure[
'flags_raw']) {
457 $atom_structure[
'data'] = empty($num) ?
'' : $num;
458 $atom_structure[
'data'] .= empty($num_total) ?
'' :
'/'.$num_total;
483 $atom_structure[
'data'] = substr($boxdata, 8);
494 $atom_structure[
'data'] = substr($boxdata, 8);
501 $info[
'warning'][] =
'Unknown QuickTime box type: "'.Helper::PrintHexBytes($boxtype).
'" at offset '.$baseoffset;
502 $atom_structure[
'data'] = $atom_data;
514 $info[
'quicktime'][
'autoplay'] = $atom_structure[
'autoplay'];
532 $atom_structure[
'data'] = $atom_data;
540 $CompressedFileData = substr($atom_data, 4);
541 if ($UncompressedHeader = @gzuncompress($CompressedFileData)) {
544 $info[
'warning'][] =
'Error decompressing compressed MOV atom at offset '.$atom_structure[
'offset'];
549 $atom_structure[
'compression_id'] = $atom_data;
556 $atom_structure[
'flags'][
'internal_data'] = (bool) ($atom_structure[
'flags_raw'] & 0x000001);
558 $atom_structure[
'reference_type_name'] = substr($atom_data, 4, 4);
560 switch ($atom_structure[
'reference_type_name']) {
562 $atom_structure[
'url'] = $this->
NoNullString(substr($atom_data, 12));
566 $atom_structure[
'file_alias'] = substr($atom_data, 12);
570 $atom_structure[
'resource_alias'] = substr($atom_data, 12);
574 $atom_structure[
'data'] = substr($atom_data, 12);
592 $atom_structure[
'gestalt_selector'] = substr($atom_data, 4, 4);
601 $atom_structure[
'component_type'] = substr($atom_data, 4, 4);
602 $atom_structure[
'component_subtype'] = substr($atom_data, 8, 4);
603 $atom_structure[
'component_manufacturer'] = substr($atom_data, 12, 4);
614 $atom_structure[
'data_rate_bps'] = $atom_structure[
'data_rate'] * 10;
623 if (empty(
$info[
'comments'][
'language']) || (!in_array($atom_structure[
'language'],
$info[
'comments'][
'language']))) {
624 $info[
'comments'][
'language'][] = $atom_structure[
'language'];
642 $atom_structure[
'flags'][
'play_on_open'] = (bool) $atom_structure[
'play_on_open_flag'];
643 $atom_structure[
'flags'][
'slide_show'] = (bool) $atom_structure[
'slide_show_flag'];
645 $ptv_lookup[0] =
'normal';
646 $ptv_lookup[1] =
'double';
647 $ptv_lookup[2] =
'half';
648 $ptv_lookup[3] =
'full';
649 $ptv_lookup[4] =
'current';
650 if (isset($ptv_lookup[$atom_structure[
'display_size_raw']])) {
651 $atom_structure[
'display_size'] = $ptv_lookup[$atom_structure[
'display_size_raw']];
653 $info[
'warning'][] =
'unknown "ptv " display constant ('.$atom_structure[
'display_size_raw'].
')';
662 $stsdEntriesDataOffset = 8;
663 for ($i = 0; $i < $atom_structure[
'number_entries']; $i++) {
664 $atom_structure[
'sample_description_table'][$i][
'size'] =
Helper::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 4));
665 $stsdEntriesDataOffset += 4;
666 $atom_structure[
'sample_description_table'][$i][
'data_format'] = substr($atom_data, $stsdEntriesDataOffset, 4);
667 $stsdEntriesDataOffset += 4;
668 $atom_structure[
'sample_description_table'][$i][
'reserved'] =
Helper::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 6));
669 $stsdEntriesDataOffset += 6;
670 $atom_structure[
'sample_description_table'][$i][
'reference_index'] =
Helper::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 2));
671 $stsdEntriesDataOffset += 2;
672 $atom_structure[
'sample_description_table'][$i][
'data'] = substr($atom_data, $stsdEntriesDataOffset, ($atom_structure[
'sample_description_table'][$i][
'size'] - 4 - 4 - 6 - 2));
673 $stsdEntriesDataOffset += ($atom_structure[
'sample_description_table'][$i][
'size'] - 4 - 4 - 6 - 2);
675 $atom_structure[
'sample_description_table'][$i][
'encoder_version'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 0, 2));
676 $atom_structure[
'sample_description_table'][$i][
'encoder_revision'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 2, 2));
677 $atom_structure[
'sample_description_table'][$i][
'encoder_vendor'] = substr($atom_structure[
'sample_description_table'][$i][
'data'], 4, 4);
679 switch ($atom_structure[
'sample_description_table'][$i][
'encoder_vendor']) {
681 case "\x00\x00\x00\x00":
683 $atom_structure[
'sample_description_table'][$i][
'audio_channels'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 8, 2));
684 $atom_structure[
'sample_description_table'][$i][
'audio_bit_depth'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 10, 2));
685 $atom_structure[
'sample_description_table'][$i][
'audio_compression_id'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 12, 2));
686 $atom_structure[
'sample_description_table'][$i][
'audio_packet_size'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 14, 2));
687 $atom_structure[
'sample_description_table'][$i][
'audio_sample_rate'] =
Helper::FixedPoint16_16(substr($atom_structure[
'sample_description_table'][$i][
'data'], 16, 4));
689 switch ($atom_structure[
'sample_description_table'][$i][
'data_format']) {
692 $info[
'fileformat'] =
'mp4';
693 $info[
'video'][
'fourcc'] = $atom_structure[
'sample_description_table'][$i][
'data_format'];
698 $info[
'video'][
'dataformat'] =
'quicktimevr';
704 $info[
'quicktime'][
'audio'][
'sample_rate'] = $atom_structure[
'sample_description_table'][$i][
'audio_sample_rate'];
705 $info[
'quicktime'][
'audio'][
'channels'] = $atom_structure[
'sample_description_table'][$i][
'audio_channels'];
706 $info[
'quicktime'][
'audio'][
'bit_depth'] = $atom_structure[
'sample_description_table'][$i][
'audio_bit_depth'];
707 $info[
'audio'][
'codec'] =
$info[
'quicktime'][
'audio'][
'codec'];
708 $info[
'audio'][
'sample_rate'] =
$info[
'quicktime'][
'audio'][
'sample_rate'];
709 $info[
'audio'][
'channels'] =
$info[
'quicktime'][
'audio'][
'channels'];
710 $info[
'audio'][
'bits_per_sample'] =
$info[
'quicktime'][
'audio'][
'bit_depth'];
711 switch ($atom_structure[
'sample_description_table'][$i][
'data_format']) {
714 $info[
'audio'][
'lossless'] =
true;
717 $info[
'audio'][
'lossless'] =
false;
725 switch ($atom_structure[
'sample_description_table'][$i][
'data_format']) {
727 $info[
'fileformat'] =
'mp4';
732 $atom_structure[
'sample_description_table'][$i][
'video_temporal_quality'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 8, 4));
733 $atom_structure[
'sample_description_table'][$i][
'video_spatial_quality'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 12, 4));
734 $atom_structure[
'sample_description_table'][$i][
'video_frame_width'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 16, 2));
735 $atom_structure[
'sample_description_table'][$i][
'video_frame_height'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 18, 2));
736 $atom_structure[
'sample_description_table'][$i][
'video_resolution_x'] =
Helper::FixedPoint16_16(substr($atom_structure[
'sample_description_table'][$i][
'data'], 20, 4));
737 $atom_structure[
'sample_description_table'][$i][
'video_resolution_y'] =
Helper::FixedPoint16_16(substr($atom_structure[
'sample_description_table'][$i][
'data'], 24, 4));
738 $atom_structure[
'sample_description_table'][$i][
'video_data_size'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 28, 4));
739 $atom_structure[
'sample_description_table'][$i][
'video_frame_count'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 32, 2));
740 $atom_structure[
'sample_description_table'][$i][
'video_encoder_name_len'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 34, 1));
741 $atom_structure[
'sample_description_table'][$i][
'video_encoder_name'] = substr($atom_structure[
'sample_description_table'][$i][
'data'], 35, $atom_structure[
'sample_description_table'][$i][
'video_encoder_name_len']);
742 $atom_structure[
'sample_description_table'][$i][
'video_pixel_color_depth'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 66, 2));
743 $atom_structure[
'sample_description_table'][$i][
'video_color_table_id'] =
Helper::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 68, 2));
745 $atom_structure[
'sample_description_table'][$i][
'video_pixel_color_type'] = (($atom_structure[
'sample_description_table'][$i][
'video_pixel_color_depth'] > 32) ?
'grayscale' :
'color');
746 $atom_structure[
'sample_description_table'][$i][
'video_pixel_color_name'] = $this->
QuicktimeColorNameLookup($atom_structure[
'sample_description_table'][$i][
'video_pixel_color_depth']);
748 if ($atom_structure[
'sample_description_table'][$i][
'video_pixel_color_name'] !=
'invalid') {
749 $info[
'quicktime'][
'video'][
'codec_fourcc'] = $atom_structure[
'sample_description_table'][$i][
'data_format'];
750 $info[
'quicktime'][
'video'][
'codec_fourcc_lookup'] = $this->
QuicktimeVideoCodecLookup($atom_structure[
'sample_description_table'][$i][
'data_format']);
751 $info[
'quicktime'][
'video'][
'codec'] = (($atom_structure[
'sample_description_table'][$i][
'video_encoder_name_len'] > 0) ? $atom_structure[
'sample_description_table'][$i][
'video_encoder_name'] : $atom_structure[
'sample_description_table'][$i][
'data_format']);
752 $info[
'quicktime'][
'video'][
'color_depth'] = $atom_structure[
'sample_description_table'][$i][
'video_pixel_color_depth'];
753 $info[
'quicktime'][
'video'][
'color_depth_name'] = $atom_structure[
'sample_description_table'][$i][
'video_pixel_color_name'];
755 $info[
'video'][
'codec'] =
$info[
'quicktime'][
'video'][
'codec'];
756 $info[
'video'][
'bits_per_sample'] =
$info[
'quicktime'][
'video'][
'color_depth'];
758 $info[
'video'][
'lossless'] =
false;
759 $info[
'video'][
'pixel_aspect_ratio'] = (float) 1;
764 switch (strtolower($atom_structure[
'sample_description_table'][$i][
'data_format'])) {
766 $info[
'audio'][
'dataformat'] =
'mp4';
767 $info[
'quicktime'][
'audio'][
'codec'] =
'mp4';
773 $info[
'video'][
'dataformat'] =
'3ivx';
777 $info[
'video'][
'dataformat'] =
'xvid';
781 $info[
'video'][
'dataformat'] =
'mpeg4';
791 $info[
'video'][
'dataformat'] =
'divx';
798 unset($atom_structure[
'sample_description_table'][$i][
'data']);
806 $sttsEntriesDataOffset = 8;
809 for ($i = 0; $i < $atom_structure[
'number_entries']; $i++) {
810 $atom_structure[
'time_to_sample_table'][$i][
'sample_count'] =
Helper::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
811 $sttsEntriesDataOffset += 4;
812 $atom_structure[
'time_to_sample_table'][$i][
'sample_duration'] =
Helper::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
813 $sttsEntriesDataOffset += 4;
815 $frames_count += $atom_structure[
'time_to_sample_table'][$i][
'sample_count'];
828 $info[
'quicktime'][
'stts_framecount'][] = $frames_count;
853 $stssEntriesDataOffset = 8;
854 for ($i = 0; $i < $atom_structure[
'number_entries']; $i++) {
855 $atom_structure[
'time_to_sample_table'][$i] =
Helper::BigEndian2Int(substr($atom_data, $stssEntriesDataOffset, 4));
856 $stssEntriesDataOffset += 4;
866 $stscEntriesDataOffset = 8;
867 for ($i = 0; $i < $atom_structure[
'number_entries']; $i++) {
868 $atom_structure[
'sample_to_chunk_table'][$i][
'first_chunk'] =
Helper::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
869 $stscEntriesDataOffset += 4;
870 $atom_structure[
'sample_to_chunk_table'][$i][
'samples_per_chunk'] =
Helper::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
871 $stscEntriesDataOffset += 4;
872 $atom_structure[
'sample_to_chunk_table'][$i][
'sample_description'] =
Helper::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
873 $stscEntriesDataOffset += 4;
884 $stszEntriesDataOffset = 12;
885 if ($atom_structure[
'sample_size'] == 0) {
886 for ($i = 0; $i < $atom_structure[
'number_entries']; $i++) {
887 $atom_structure[
'sample_size_table'][$i] =
Helper::BigEndian2Int(substr($atom_data, $stszEntriesDataOffset, 4));
888 $stszEntriesDataOffset += 4;
899 $stcoEntriesDataOffset = 8;
900 for ($i = 0; $i < $atom_structure[
'number_entries']; $i++) {
901 $atom_structure[
'chunk_offset_table'][$i] =
Helper::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 4));
902 $stcoEntriesDataOffset += 4;
912 $stcoEntriesDataOffset = 8;
913 for ($i = 0; $i < $atom_structure[
'number_entries']; $i++) {
914 $atom_structure[
'chunk_offset_table'][$i] =
Helper::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 8));
915 $stcoEntriesDataOffset += 8;
925 for ($i = 0; $i < $atom_structure[
'number_entries']; $i++) {
926 $atom_structure[
'data_references'][$i][
'size'] =
Helper::BigEndian2Int(substr($atom_data, $drefDataOffset, 4));
927 $drefDataOffset += 4;
928 $atom_structure[
'data_references'][$i][
'type'] = substr($atom_data, $drefDataOffset, 4);
929 $drefDataOffset += 4;
930 $atom_structure[
'data_references'][$i][
'version'] =
Helper::BigEndian2Int(substr($atom_data, $drefDataOffset, 1));
931 $drefDataOffset += 1;
932 $atom_structure[
'data_references'][$i][
'flags_raw'] =
Helper::BigEndian2Int(substr($atom_data, $drefDataOffset, 3));
933 $drefDataOffset += 3;
934 $atom_structure[
'data_references'][$i][
'data'] = substr($atom_data, $drefDataOffset, ($atom_structure[
'data_references'][$i][
'size'] - 4 - 4 - 1 - 3));
935 $drefDataOffset += ($atom_structure[
'data_references'][$i][
'size'] - 4 - 4 - 1 - 3);
937 $atom_structure[
'data_references'][$i][
'flags'][
'self_reference'] = (bool) ($atom_structure[
'data_references'][$i][
'flags_raw'] & 0x001);
967 $atom_structure[
'flags'][
'no_lean_ahead'] = (bool) ($atom_structure[
'flags_raw'] & 0x001);
973 $atom_structure[
'component_type'] = substr($atom_data, 4, 4);
974 $atom_structure[
'component_subtype'] = substr($atom_data, 8, 4);
975 $atom_structure[
'component_manufacturer'] = substr($atom_data, 12, 4);
978 $atom_structure[
'component_name'] = $this->
Pascal2String(substr($atom_data, 24));
980 if (($atom_structure[
'component_subtype'] ==
'STpn') && ($atom_structure[
'component_manufacturer'] ==
'zzzz')) {
981 $info[
'video'][
'dataformat'] =
'quicktimevr';
995 if ($atom_structure[
'time_scale'] == 0) {
996 $info[
'error'][] =
'Corrupt Quicktime file: mdhd.time_scale == zero';
1000 $info[
'quicktime'][
'time_scale'] = (isset(
$info[
'quicktime'][
'time_scale']) ? max(
$info[
'quicktime'][
'time_scale'], $atom_structure[
'time_scale']) : $atom_structure[
'time_scale']);
1002 $atom_structure[
'creation_time_unix'] =
Helper::DateMac2Unix($atom_structure[
'creation_time']);
1004 $atom_structure[
'playtime_seconds'] = $atom_structure[
'duration'] / $atom_structure[
'time_scale'];
1006 if (empty(
$info[
'comments'][
'language']) || (!in_array($atom_structure[
'language'],
$info[
'comments'][
'language']))) {
1007 $info[
'comments'][
'language'][] = $atom_structure[
'language'];
1014 $atom_structure[
'atom_type'] = substr($atom_data, 6, 4);
1017 $atom_structure[
'modification_date_unix'] =
Helper::DateMac2Unix($atom_structure[
'modification_date']);
1023 $atom_structure[
'clipping_data'] = substr($atom_data, 10);
1032 $atom_structure[
'default_hints'][
'double_buffer'] = (bool) ($atom_structure[
'default_hints_raw'] & 0x0020);
1033 $atom_structure[
'default_hints'][
'high_quality'] = (bool) ($atom_structure[
'default_hints_raw'] & 0x0100);
1041 for ($i = 0; $i < (strlen($atom_data) % 4); $i++) {
1050 for ($i = 0; $i < $atom_structure[
'number_entries']; $i++) {
1051 $atom_structure[
'edit_list'][$i][
'track_duration'] =
Helper::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4));
1052 $atom_structure[
'edit_list'][$i][
'media_time'] =
Helper::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4));
1053 $atom_structure[
'edit_list'][$i][
'media_rate'] =
Helper::FixedPoint16_16(substr($atom_data, 8 + ($i * 12) + 8, 4));
1060 $atom_structure[
'matte_data_raw'] = substr($atom_data, 4);
1067 for ($colortableentry = 0; $colortableentry < $atom_structure[
'color_table_size']; $colortableentry++) {
1068 $atom_structure[
'color_table'][$colortableentry][
'alpha'] =
Helper::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 0, 2));
1069 $atom_structure[
'color_table'][$colortableentry][
'red'] =
Helper::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 2, 2));
1070 $atom_structure[
'color_table'][$colortableentry][
'green'] =
Helper::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 4, 2));
1071 $atom_structure[
'color_table'][$colortableentry][
'blue'] =
Helper::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 6, 2));
1084 $atom_structure[
'reserved'] = substr($atom_data, 26, 10);
1102 if ($atom_structure[
'time_scale'] == 0) {
1103 $info[
'error'][] =
'Corrupt Quicktime file: mvhd.time_scale == zero';
1107 $atom_structure[
'creation_time_unix'] =
Helper::DateMac2Unix($atom_structure[
'creation_time']);
1109 $info[
'quicktime'][
'time_scale'] = (isset(
$info[
'quicktime'][
'time_scale']) ? max(
$info[
'quicktime'][
'time_scale'], $atom_structure[
'time_scale']) : $atom_structure[
'time_scale']);
1110 $info[
'quicktime'][
'display_scale'] = $atom_structure[
'matrix_a'];
1111 $info[
'playtime_seconds'] = $atom_structure[
'duration'] / $atom_structure[
'time_scale'];
1139 $atom_structure[
'flags'][
'enabled'] = (bool) ($atom_structure[
'flags_raw'] & 0x0001);
1140 $atom_structure[
'flags'][
'in_movie'] = (bool) ($atom_structure[
'flags_raw'] & 0x0002);
1141 $atom_structure[
'flags'][
'in_preview'] = (bool) ($atom_structure[
'flags_raw'] & 0x0004);
1142 $atom_structure[
'flags'][
'in_poster'] = (bool) ($atom_structure[
'flags_raw'] & 0x0008);
1143 $atom_structure[
'creation_time_unix'] =
Helper::DateMac2Unix($atom_structure[
'creation_time']);
1146 if ($atom_structure[
'flags'][
'enabled'] == 1) {
1147 if (!isset(
$info[
'video'][
'resolution_x']) || !isset(
$info[
'video'][
'resolution_y'])) {
1148 $info[
'video'][
'resolution_x'] = $atom_structure[
'width'];
1149 $info[
'video'][
'resolution_y'] = $atom_structure[
'height'];
1151 $info[
'video'][
'resolution_x'] = max(
$info[
'video'][
'resolution_x'], $atom_structure[
'width']);
1152 $info[
'video'][
'resolution_y'] = max(
$info[
'video'][
'resolution_y'], $atom_structure[
'height']);
1153 $info[
'quicktime'][
'video'][
'resolution_x'] =
$info[
'video'][
'resolution_x'];
1154 $info[
'quicktime'][
'video'][
'resolution_y'] =
$info[
'video'][
'resolution_y'];
1156 if (isset(
$info[
'video'][
'resolution_x'])) { unset(
$info[
'video'][
'resolution_x']); }
1157 if (isset(
$info[
'video'][
'resolution_y'])) { unset(
$info[
'video'][
'resolution_y']); }
1158 if (isset(
$info[
'quicktime'][
'video'])) { unset(
$info[
'quicktime'][
'video']); }
1187 $atom_structure[
'num_iods_tracks'] = ($atom_structure[
'length'] - 7) / 6;
1188 for ($i = 0; $i < $atom_structure[
'num_iods_tracks']; $i++) {
1189 $atom_structure[
'track'][$i][
'ES_ID_IncTag'] =
Helper::BigEndian2Int(substr($atom_data, $offset, 1));
1202 $atom_structure[
'signature'] = substr($atom_data, 0, 4);
1204 $atom_structure[
'fourcc'] = substr($atom_data, 8, 4);
1234 $atom_structure[
'ctyp'] = substr($atom_data, 0, 4);
1235 $info[
'quicktime'][
'controller'] = $atom_structure[
'ctyp'];
1236 switch ($atom_structure[
'ctyp']) {
1238 $info[
'video'][
'dataformat'] =
'quicktimevr';
1251 $info[
'quicktime'][
'hinting'] =
true;
1255 for ($i = 0; $i < ($atom_structure[
'size'] - 8); $i += 4) {
1278 $atom_structure[
'data'] = $atom_data;
1279 if (preg_match(
'#([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)?/$#i', $atom_data, $matches)) {
1280 @list($all, $latitude, $longitude, $altitude) = $matches;
1281 $info[
'quicktime'][
'comments'][
'gps_latitude'][] = floatval($latitude);
1282 $info[
'quicktime'][
'comments'][
'gps_longitude'][] = floatval($longitude);
1283 if (!empty($altitude)) {
1284 $info[
'quicktime'][
'comments'][
'gps_altitude'][] = floatval($altitude);
1287 $info[
'warning'][] =
'QuickTime atom "©xyz" data does not match expected data pattern at offset '.$baseoffset.
'. Please report as GetId3Core() bug.';
1299 if (preg_match(
'/^\xFF\xD8\xFF/', $atom_data)) {
1300 $atom_structure[
'data'] = $atom_data;
1301 $atom_structure[
'image_mime'] =
'image/jpeg';
1302 $atom_structure[
'description'] = (($atomname ==
'NCTH') ?
'Nikon Camera Thumbnail Image' : (($atomname ==
'NCVW') ?
'Nikon Camera Preview Image' :
'Nikon preview image'));
1303 $info[
'quicktime'][
'comments'][
'picture'][] =
array(
'image_mime'=>$atom_structure[
'image_mime'],
'data'=>$atom_data,
'description'=>$atom_structure[
'description']);
1308 $atom_structure[
'data'] = $atom_data;
1316 $atom_structure[
'data'] = $atom_data;
1319 case "\x00\x00\x00\x00":
1333 $atom_structure[
'language'] = substr($atom_data, 4 + 0, 2);
1335 $atom_structure[
'data'] = substr($atom_data, 4 + 4);
1339 $info[
'warning'][] =
'Unknown QuickTime atom type: "'.$atomname.
'" ('.trim(
Helper::PrintHexBytes($atomname)).
') at offset '.$baseoffset;
1340 $atom_structure[
'data'] = $atom_data;
1343 array_pop($atomHierarchy);
1345 return $atom_structure;
static DateMac2Unix($macdate)
QuicktimeContentRatingLookup($rtng)
array $QuicktimeContentRatingLookup
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
QuicktimeIODSvideoProfileName($video_profile_id)
array $QuicktimeIODSvideoProfileNameLookup
QuicktimeStoreFrontCodeLookup($sfid)
array $QuicktimeStoreFrontCodeLookup
QuicktimeLanguageLookup($languageid)
array $QuicktimeLanguageLookup
Pascal2String($pascalstring)
static LookupGenreName($genreid, $allowSCMPXextended=true)
QuicktimeColorNameLookup($colordepthid)
array $QuicktimeColorNameLookup
static FixedPoint2_30($rawdata)
QuicktimeIODSaudioProfileName($audio_profile_id)
array $QuicktimeIODSaudioProfileNameLookup
NoNullString($nullterminatedstring)
QuicktimeAudioCodecLookup($codecid)
array $QuicktimeAudioCodecLookup
QuicktimeDCOMLookup($compressionid)
array $QuicktimeDCOMLookup
quicktime_read_mp4_descr_length($data, &$offset)
Create styles array
The data for the language used.
static FixedPoint8_8($rawdata)
static BigEndian2Int($byteword, $synchsafe=false, $signed=false)
QuicktimeSTIKLookup($stik)
array $QuicktimeSTIKLookup
QuicktimeParseNikonNCTG($atom_data)
CopyToAppropriateCommentsSection($keyname, $data, $boxname='')
array $handyatomtranslatorarray
QuicktimeVideoCodecLookup($codecid)
array $QuicktimeVideoCodecLookup
static FixedPoint16_16($rawdata)
QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms)