28 $info = &$this->getid3->info;
30 $info[
'fileformat'] =
'quicktime';
31 $info[
'quicktime'][
'hinting'] =
false;
32 $info[
'quicktime'][
'controller'] =
'standard';
38 $atom_data_read_buffer_size = max($this->getid3->option_fread_buffer_size * 1024, (
$info[
'php_memory_limit'] ? round(
$info[
'php_memory_limit'] / 4) : 1024));
39 while ($offset <
$info[
'avdataend']) {
41 $this->
error(
'Unable to parse atom at offset '.$offset.
' because beyond '.round(PHP_INT_MAX / 1073741824).
'GB limit of PHP filesystem functions');
44 $this->
fseek($offset);
45 $AtomHeader = $this->
fread(8);
48 $atomname = substr($AtomHeader, 4, 4);
55 $info[
'quicktime'][$atomname][
'name'] = $atomname;
56 $info[
'quicktime'][$atomname][
'size'] = $atomsize;
57 $info[
'quicktime'][$atomname][
'offset'] = $offset;
59 if (($offset + $atomsize) >
$info[
'avdataend']) {
60 $this->
error(
'Atom at offset '.$offset.
' claims to go beyond end-of-file (length: '.$atomsize.
' bytes)');
70 $atomHierarchy = array();
71 $info[
'quicktime'][$atomname] = $this->
QuicktimeParseAtom($atomname, $atomsize, $this->
fread(min($atomsize, $atom_data_read_buffer_size)), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);
77 if (!empty(
$info[
'avdataend_tmp'])) {
81 unset(
$info[
'avdataend_tmp']);
84 if (!empty(
$info[
'quicktime'][
'comments'][
'chapters']) && is_array(
$info[
'quicktime'][
'comments'][
'chapters']) && (count(
$info[
'quicktime'][
'comments'][
'chapters']) > 0)) {
86 for (
$i = 0;
$i < count(
$info[
'quicktime'][
'comments'][
'chapters']);
$i++) {
88 $bookmark[
'title'] =
$info[
'quicktime'][
'comments'][
'chapters'][
$i];
89 if (isset($durations[
$i])) {
90 $bookmark[
'duration_sample'] = $durations[
$i][
'sample_duration'];
92 $bookmark[
'start_sample'] =
$info[
'quicktime'][
'bookmarks'][($i - 1)][
'start_sample'] +
$info[
'quicktime'][
'bookmarks'][($i - 1)][
'duration_sample'];
94 $bookmark[
'start_sample'] = 0;
97 $bookmark[
'duration_seconds'] = $bookmark[
'duration_sample'] / $time_scale;
98 $bookmark[
'start_seconds'] = $bookmark[
'start_sample'] / $time_scale;
101 $info[
'quicktime'][
'bookmarks'][] = $bookmark;
105 if (isset(
$info[
'quicktime'][
'temp_meta_key_names'])) {
106 unset(
$info[
'quicktime'][
'temp_meta_key_names']);
109 if (!empty(
$info[
'quicktime'][
'comments'][
'location.ISO6709'])) {
111 foreach (
$info[
'quicktime'][
'comments'][
'location.ISO6709'] as $ISO6709string) {
115 if (preg_match(
'#^([\\+\\-])([0-9]{2}|[0-9]{4}|[0-9]{6})(\\.[0-9]+)?([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?(([\\+\\-])([0-9]{3}|[0-9]{5}|[0-9]{7})(\\.[0-9]+)?)?/$#', $ISO6709string, $matches)) {
116 @list($dummy, $lat_sign, $lat_deg, $lat_deg_dec, $lon_sign, $lon_deg, $lon_deg_dec, $dummy, $alt_sign, $alt_deg, $alt_deg_dec) = $matches;
118 if (strlen($lat_deg) == 2) {
119 $latitude = floatval(ltrim($lat_deg,
'0').$lat_deg_dec);
120 } elseif (strlen($lat_deg) == 4) {
121 $latitude = floatval(ltrim(substr($lat_deg, 0, 2),
'0')) + floatval(ltrim(substr($lat_deg, 2, 2),
'0').$lat_deg_dec / 60);
122 } elseif (strlen($lat_deg) == 6) {
123 $latitude = floatval(ltrim(substr($lat_deg, 0, 2),
'0')) + floatval(ltrim(substr($lat_deg, 2, 2),
'0') / 60) + floatval(ltrim(substr($lat_deg, 4, 2),
'0').$lat_deg_dec / 3600);
126 if (strlen($lon_deg) == 3) {
127 $longitude = floatval(ltrim($lon_deg,
'0').$lon_deg_dec);
128 } elseif (strlen($lon_deg) == 5) {
129 $longitude = floatval(ltrim(substr($lon_deg, 0, 2),
'0')) + floatval(ltrim(substr($lon_deg, 2, 2),
'0').$lon_deg_dec / 60);
130 } elseif (strlen($lon_deg) == 7) {
131 $longitude = floatval(ltrim(substr($lon_deg, 0, 2),
'0')) + floatval(ltrim(substr($lon_deg, 2, 2),
'0') / 60) + floatval(ltrim(substr($lon_deg, 4, 2),
'0').$lon_deg_dec / 3600);
134 if (strlen($alt_deg) == 3) {
135 $altitude = floatval(ltrim($alt_deg,
'0').$alt_deg_dec);
136 } elseif (strlen($alt_deg) == 5) {
137 $altitude = floatval(ltrim(substr($alt_deg, 0, 2),
'0')) + floatval(ltrim(substr($alt_deg, 2, 2),
'0').$alt_deg_dec / 60);
138 } elseif (strlen($alt_deg) == 7) {
139 $altitude = floatval(ltrim(substr($alt_deg, 0, 2),
'0')) + floatval(ltrim(substr($alt_deg, 2, 2),
'0') / 60) + floatval(ltrim(substr($alt_deg, 4, 2),
'0').$alt_deg_dec / 3600);
142 if ($latitude !==
false) {
143 $info[
'quicktime'][
'comments'][
'gps_latitude'][] = (($lat_sign ==
'-') ? -1 : 1) * floatval($latitude);
145 if ($longitude !==
false) {
146 $info[
'quicktime'][
'comments'][
'gps_longitude'][] = (($lon_sign ==
'-') ? -1 : 1) * floatval($longitude);
148 if ($altitude !==
false) {
149 $info[
'quicktime'][
'comments'][
'gps_altitude'][] = (($alt_sign ==
'-') ? -1 : 1) * floatval($altitude);
152 if ($latitude ===
false) {
153 $this->
warning(
'location.ISO6709 string not parsed correctly: "'.$ISO6709string.
'", please submit as a bug');
159 if (!isset(
$info[
'bitrate']) && isset(
$info[
'playtime_seconds'])) {
160 $info[
'bitrate'] = ((
$info[
'avdataend'] -
$info[
'avdataoffset']) * 8) /
$info[
'playtime_seconds'];
162 if (isset(
$info[
'bitrate']) && !isset(
$info[
'audio'][
'bitrate']) && !isset(
$info[
'quicktime'][
'video'])) {
165 if (!empty(
$info[
'playtime_seconds']) && !isset(
$info[
'video'][
'frame_rate']) && !empty(
$info[
'quicktime'][
'stts_framecount'])) {
166 foreach (
$info[
'quicktime'][
'stts_framecount'] as
$key => $samples_count) {
167 $samples_per_second = $samples_count /
$info[
'playtime_seconds'];
168 if ($samples_per_second > 240) {
171 $info[
'video'][
'frame_rate'] = $samples_per_second;
176 if (
$info[
'audio'][
'dataformat'] ==
'mp4') {
177 $info[
'fileformat'] =
'mp4';
178 if (empty(
$info[
'video'][
'resolution_x'])) {
179 $info[
'mime_type'] =
'audio/mp4';
180 unset(
$info[
'video'][
'dataformat']);
182 $info[
'mime_type'] =
'video/mp4';
186 if (!$this->ReturnAtomData) {
187 unset(
$info[
'quicktime'][
'moov']);
190 if (empty(
$info[
'audio'][
'dataformat']) && !empty(
$info[
'quicktime'][
'audio'])) {
191 $info[
'audio'][
'dataformat'] =
'quicktime';
193 if (empty(
$info[
'video'][
'dataformat']) && !empty(
$info[
'quicktime'][
'video'])) {
194 $info[
'video'][
'dataformat'] =
'quicktime';
204 $info = &$this->getid3->info;
206 $atom_parent = end($atomHierarchy);
207 array_push($atomHierarchy, $atomname);
208 $atom_structure[
'hierarchy'] = implode(
' ', $atomHierarchy);
209 $atom_structure[
'name'] = $atomname;
210 $atom_structure[
'size'] = $atomsize;
211 $atom_structure[
'offset'] = $baseoffset;
233 $allnumericnames =
true;
234 foreach ($atom_structure[
'subatoms'] as $subatomarray) {
235 if (!is_integer($subatomarray[
'name']) || (count($subatomarray[
'subatoms']) != 1)) {
236 $allnumericnames =
false;
240 if ($allnumericnames) {
242 foreach ($atom_structure[
'subatoms'] as $subatomarray) {
243 foreach ($subatomarray[
'subatoms'] as $newData_subatomarray) {
244 unset($newData_subatomarray[
'hierarchy'], $newData_subatomarray[
'name']);
245 $newData[$subatomarray[
'name']] = $newData_subatomarray;
249 $atom_structure[
'data'] = $newData;
250 unset($atom_structure[
'subatoms']);
255 case "\x00\x00\x00\x01":
256 case "\x00\x00\x00\x02":
257 case "\x00\x00\x00\x03":
258 case "\x00\x00\x00\x04":
259 case "\x00\x00\x00\x05":
261 $atom_structure[
'name'] = $atomname;
270 foreach ($atom_structure[
'subatoms'] as
$key => $value_array) {
271 if (isset($value_array[
'sample_description_table'])) {
272 foreach ($value_array[
'sample_description_table'] as $key2 => $value_array2) {
273 if (isset($value_array2[
'data_format'])) {
274 switch ($value_array2[
'data_format']) {
286 } elseif (isset($value_array[
'time_to_sample_table'])) {
287 foreach ($value_array[
'time_to_sample_table'] as $key2 => $value_array2) {
288 if (isset($value_array2[
'sample_count']) && isset($value_array2[
'sample_duration']) && ($value_array2[
'sample_duration'] > 0)) {
289 $framerate = round(
$info[
'quicktime'][
'time_scale'] / $value_array2[
'sample_duration'], 3);
290 $framecount = $value_array2[
'sample_count'];
295 if ($isVideo && $framerate) {
296 $info[
'quicktime'][
'video'][
'frame_rate'] = $framerate;
297 $info[
'video'][
'frame_rate'] =
$info[
'quicktime'][
'video'][
'frame_rate'];
299 if ($isVideo && $framecount) {
300 $info[
'quicktime'][
'video'][
'frame_count'] = $framecount;
387 if ($atom_parent ==
'udta') {
391 $atom_structure[
'data'] = substr($atom_data, 4);
394 if (empty(
$info[
'comments'][
'language']) || (!in_array($atom_structure[
'language'],
$info[
'comments'][
'language']))) {
395 $info[
'comments'][
'language'][] = $atom_structure[
'language'];
400 if (substr($atom_data, 2, 2) ==
"\x10\xB5") {
403 while ($atomoffset < strlen($atom_data)) {
405 $boxsmalltype = substr($atom_data, $atomoffset + 2, 2);
406 $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize);
407 if ($boxsmallsize <= 1) {
408 $this->
warning(
'Invalid QuickTime atom smallbox size "'.$boxsmallsize.
'" in atom "'.preg_replace(
'#[^a-zA-Z0-9 _\\-]#',
'?', $atomname).
'" at offset: '.($atom_structure[
'offset'] + $atomoffset));
409 $atom_structure[
'data'] = null;
410 $atomoffset = strlen($atom_data);
413 switch ($boxsmalltype) {
415 $atom_structure[
'data'] = $boxsmalldata;
418 $this->
warning(
'Unknown QuickTime smallbox type: "'.preg_replace(
'#[^a-zA-Z0-9 _\\-]#',
'?', $boxsmalltype).
'" ('.trim(
getid3_lib::PrintHexBytes($boxsmalltype)).
') at offset '.$baseoffset);
419 $atom_structure[
'data'] = $atom_data;
422 $atomoffset += (4 + $boxsmallsize);
425 while ($atomoffset < strlen($atom_data)) {
427 $boxtype = substr($atom_data, $atomoffset + 4, 4);
428 $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8);
430 $this->
warning(
'Invalid QuickTime atom box size "'.$boxsize.
'" in atom "'.preg_replace(
'#[^a-zA-Z0-9 _\\-]#',
'?', $atomname).
'" at offset: '.($atom_structure[
'offset'] + $atomoffset));
431 $atom_structure[
'data'] = null;
432 $atomoffset = strlen($atom_data);
435 $atomoffset += $boxsize;
440 $atom_structure[$boxtype] = substr($boxdata, 4);
446 switch ($atom_structure[
'flags_raw']) {
468 $atom_structure[
'data'] = empty($num) ?
'' : $num;
469 $atom_structure[
'data'] .= empty($num_total) ?
'' :
'/'.$num_total;
498 $atom_structure[
'data'] = substr($boxdata, 8);
507 $atom_structure[
'data'] = substr($boxdata, 8);
509 if (preg_match(
'#^\\xFF\\xD8\\xFF#', $atom_structure[
'data'])) {
510 $atom_structure[
'image_mime'] =
'image/jpeg';
511 } elseif (preg_match(
'#^\\x89\\x50\\x4E\\x47\\x0D\\x0A\\x1A\\x0A#', $atom_structure[
'data'])) {
512 $atom_structure[
'image_mime'] =
'image/png';
513 } elseif (preg_match(
'#^GIF#', $atom_structure[
'data'])) {
514 $atom_structure[
'image_mime'] =
'image/gif';
532 $atom_structure[
'data'] = substr($boxdata, 8);
533 if ($atomname ==
'covr') {
535 if (preg_match(
'#^\\xFF\\xD8\\xFF#', $atom_structure[
'data'])) {
536 $atom_structure[
'image_mime'] =
'image/jpeg';
537 } elseif (preg_match(
'#^\\x89\\x50\\x4E\\x47\\x0D\\x0A\\x1A\\x0A#', $atom_structure[
'data'])) {
538 $atom_structure[
'image_mime'] =
'image/png';
539 } elseif (preg_match(
'#^GIF#', $atom_structure[
'data'])) {
540 $atom_structure[
'image_mime'] =
'image/gif';
549 $this->
warning(
'Unknown QuickTime box type: "'.preg_replace(
'#[^a-zA-Z0-9 _\\-]#',
'?', $boxtype).
'" ('.trim(
getid3_lib::PrintHexBytes($boxtype)).
') at offset '.$baseoffset);
550 $atom_structure[
'data'] = $atom_data;
563 $info[
'quicktime'][
'autoplay'] = $atom_structure[
'autoplay'];
584 $atom_structure[
'data'] = $atom_data;
593 $CompressedFileData = substr($atom_data, 4);
594 if ($UncompressedHeader = @gzuncompress($CompressedFileData)) {
597 $this->
warning(
'Error decompressing compressed MOV atom at offset '.$atom_structure[
'offset']);
603 $atom_structure[
'compression_id'] = $atom_data;
611 $atom_structure[
'flags'][
'internal_data'] = (bool) ($atom_structure[
'flags_raw'] & 0x000001);
613 $atom_structure[
'reference_type_name'] = substr($atom_data, 4, 4);
615 switch ($atom_structure[
'reference_type_name']) {
617 $atom_structure[
'url'] = $this->
NoNullString(substr($atom_data, 12));
621 $atom_structure[
'file_alias'] = substr($atom_data, 12);
625 $atom_structure[
'resource_alias'] = substr($atom_data, 12);
629 $atom_structure[
'data'] = substr($atom_data, 12);
650 $atom_structure[
'gestalt_selector'] = substr($atom_data, 4, 4);
660 $atom_structure[
'component_type'] = substr($atom_data, 4, 4);
661 $atom_structure[
'component_subtype'] = substr($atom_data, 8, 4);
662 $atom_structure[
'component_manufacturer'] = substr($atom_data, 12, 4);
674 $atom_structure[
'data_rate_bps'] = $atom_structure[
'data_rate'] * 10;
684 if (empty(
$info[
'comments'][
'language']) || (!in_array($atom_structure[
'language'],
$info[
'comments'][
'language']))) {
685 $info[
'comments'][
'language'][] = $atom_structure[
'language'];
705 $atom_structure[
'flags'][
'play_on_open'] = (bool) $atom_structure[
'play_on_open_flag'];
706 $atom_structure[
'flags'][
'slide_show'] = (bool) $atom_structure[
'slide_show_flag'];
708 $ptv_lookup[0] =
'normal';
709 $ptv_lookup[1] =
'double';
710 $ptv_lookup[2] =
'half';
711 $ptv_lookup[3] =
'full';
712 $ptv_lookup[4] =
'current';
713 if (isset($ptv_lookup[$atom_structure[
'display_size_raw']])) {
714 $atom_structure[
'display_size'] = $ptv_lookup[$atom_structure[
'display_size_raw']];
716 $this->
warning(
'unknown "ptv " display constant ('.$atom_structure[
'display_size_raw'].
')');
725 $stsdEntriesDataOffset = 8;
726 for (
$i = 0;
$i < $atom_structure[
'number_entries'];
$i++) {
727 $atom_structure[
'sample_description_table'][
$i][
'size'] =
getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 4));
728 $stsdEntriesDataOffset += 4;
729 $atom_structure[
'sample_description_table'][
$i][
'data_format'] = substr($atom_data, $stsdEntriesDataOffset, 4);
730 $stsdEntriesDataOffset += 4;
731 $atom_structure[
'sample_description_table'][
$i][
'reserved'] =
getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 6));
732 $stsdEntriesDataOffset += 6;
733 $atom_structure[
'sample_description_table'][
$i][
'reference_index'] =
getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 2));
734 $stsdEntriesDataOffset += 2;
735 $atom_structure[
'sample_description_table'][
$i][
'data'] = substr($atom_data, $stsdEntriesDataOffset, ($atom_structure[
'sample_description_table'][
$i][
'size'] - 4 - 4 - 6 - 2));
736 $stsdEntriesDataOffset += ($atom_structure[
'sample_description_table'][
$i][
'size'] - 4 - 4 - 6 - 2);
738 $atom_structure[
'sample_description_table'][
$i][
'encoder_version'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][
$i][
'data'], 0, 2));
739 $atom_structure[
'sample_description_table'][
$i][
'encoder_revision'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 2, 2));
740 $atom_structure[
'sample_description_table'][
$i][
'encoder_vendor'] = substr($atom_structure[
'sample_description_table'][$i][
'data'], 4, 4);
742 switch ($atom_structure[
'sample_description_table'][$i][
'encoder_vendor']) {
744 case "\x00\x00\x00\x00":
746 $atom_structure[
'sample_description_table'][
$i][
'audio_channels'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 8, 2));
747 $atom_structure[
'sample_description_table'][
$i][
'audio_bit_depth'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 10, 2));
748 $atom_structure[
'sample_description_table'][
$i][
'audio_compression_id'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 12, 2));
749 $atom_structure[
'sample_description_table'][
$i][
'audio_packet_size'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 14, 2));
750 $atom_structure[
'sample_description_table'][
$i][
'audio_sample_rate'] =
getid3_lib::FixedPoint16_16(substr($atom_structure[
'sample_description_table'][$i][
'data'], 16, 4));
754 $atom_structure[
'sample_description_table'][
$i][
'temporal_quality'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 8, 4));
755 $atom_structure[
'sample_description_table'][
$i][
'spatial_quality'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 12, 4));
756 $atom_structure[
'sample_description_table'][
$i][
'width'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 16, 2));
757 $atom_structure[
'sample_description_table'][
$i][
'height'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 18, 2));
758 $atom_structure[
'sample_description_table'][
$i][
'resolution_x'] =
getid3_lib::FixedPoint16_16(substr($atom_structure[
'sample_description_table'][$i][
'data'], 24, 4));
759 $atom_structure[
'sample_description_table'][
$i][
'resolution_y'] =
getid3_lib::FixedPoint16_16(substr($atom_structure[
'sample_description_table'][$i][
'data'], 28, 4));
760 $atom_structure[
'sample_description_table'][
$i][
'data_size'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 32, 4));
761 $atom_structure[
'sample_description_table'][
$i][
'frame_count'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 36, 2));
762 $atom_structure[
'sample_description_table'][
$i][
'compressor_name'] = substr($atom_structure[
'sample_description_table'][$i][
'data'], 38, 4);
763 $atom_structure[
'sample_description_table'][
$i][
'pixel_depth'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 42, 2));
764 $atom_structure[
'sample_description_table'][
$i][
'color_table_id'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 44, 2));
766 switch ($atom_structure[
'sample_description_table'][$i][
'data_format']) {
793 $info[
'fileformat'] =
'mp4';
794 $info[
'video'][
'fourcc'] = $atom_structure[
'sample_description_table'][
$i][
'data_format'];
797 if (!empty($atom_structure[
'sample_description_table'][$i][
'width']) && !empty($atom_structure[
'sample_description_table'][$i][
'height'])) {
799 $info[
'video'][
'resolution_x'] = $atom_structure[
'sample_description_table'][
$i][
'width'];
800 $info[
'video'][
'resolution_y'] = $atom_structure[
'sample_description_table'][
$i][
'height'];
801 $info[
'quicktime'][
'video'][
'resolution_x'] =
$info[
'video'][
'resolution_x'];
802 $info[
'quicktime'][
'video'][
'resolution_y'] =
$info[
'video'][
'resolution_y'];
807 $info[
'video'][
'dataformat'] =
'quicktimevr';
813 $info[
'quicktime'][
'audio'][
'sample_rate'] = $atom_structure[
'sample_description_table'][
$i][
'audio_sample_rate'];
814 $info[
'quicktime'][
'audio'][
'channels'] = $atom_structure[
'sample_description_table'][
$i][
'audio_channels'];
815 $info[
'quicktime'][
'audio'][
'bit_depth'] = $atom_structure[
'sample_description_table'][
$i][
'audio_bit_depth'];
816 $info[
'audio'][
'codec'] =
$info[
'quicktime'][
'audio'][
'codec'];
817 $info[
'audio'][
'sample_rate'] =
$info[
'quicktime'][
'audio'][
'sample_rate'];
818 $info[
'audio'][
'channels'] =
$info[
'quicktime'][
'audio'][
'channels'];
819 $info[
'audio'][
'bits_per_sample'] =
$info[
'quicktime'][
'audio'][
'bit_depth'];
820 switch ($atom_structure[
'sample_description_table'][$i][
'data_format']) {
823 $info[
'audio'][
'lossless'] =
true;
826 $info[
'audio'][
'lossless'] =
false;
834 switch ($atom_structure[
'sample_description_table'][$i][
'data_format']) {
836 $info[
'fileformat'] =
'mp4';
841 $atom_structure[
'sample_description_table'][
$i][
'video_temporal_quality'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 8, 4));
842 $atom_structure[
'sample_description_table'][
$i][
'video_spatial_quality'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 12, 4));
843 $atom_structure[
'sample_description_table'][
$i][
'video_frame_width'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 16, 2));
844 $atom_structure[
'sample_description_table'][
$i][
'video_frame_height'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 18, 2));
845 $atom_structure[
'sample_description_table'][
$i][
'video_resolution_x'] =
getid3_lib::FixedPoint16_16(substr($atom_structure[
'sample_description_table'][$i][
'data'], 20, 4));
846 $atom_structure[
'sample_description_table'][
$i][
'video_resolution_y'] =
getid3_lib::FixedPoint16_16(substr($atom_structure[
'sample_description_table'][$i][
'data'], 24, 4));
847 $atom_structure[
'sample_description_table'][
$i][
'video_data_size'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 28, 4));
848 $atom_structure[
'sample_description_table'][
$i][
'video_frame_count'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 32, 2));
849 $atom_structure[
'sample_description_table'][
$i][
'video_encoder_name_len'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 34, 1));
850 $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']);
851 $atom_structure[
'sample_description_table'][
$i][
'video_pixel_color_depth'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 66, 2));
852 $atom_structure[
'sample_description_table'][
$i][
'video_color_table_id'] =
getid3_lib::BigEndian2Int(substr($atom_structure[
'sample_description_table'][$i][
'data'], 68, 2));
854 $atom_structure[
'sample_description_table'][
$i][
'video_pixel_color_type'] = (($atom_structure[
'sample_description_table'][
$i][
'video_pixel_color_depth'] > 32) ?
'grayscale' :
'color');
855 $atom_structure[
'sample_description_table'][
$i][
'video_pixel_color_name'] = $this->
QuicktimeColorNameLookup($atom_structure[
'sample_description_table'][$i][
'video_pixel_color_depth']);
857 if ($atom_structure[
'sample_description_table'][$i][
'video_pixel_color_name'] !=
'invalid') {
858 $info[
'quicktime'][
'video'][
'codec_fourcc'] = $atom_structure[
'sample_description_table'][
$i][
'data_format'];
859 $info[
'quicktime'][
'video'][
'codec_fourcc_lookup'] = $this->
QuicktimeVideoCodecLookup($atom_structure[
'sample_description_table'][$i][
'data_format']);
860 $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']);
861 $info[
'quicktime'][
'video'][
'color_depth'] = $atom_structure[
'sample_description_table'][
$i][
'video_pixel_color_depth'];
862 $info[
'quicktime'][
'video'][
'color_depth_name'] = $atom_structure[
'sample_description_table'][
$i][
'video_pixel_color_name'];
864 $info[
'video'][
'codec'] =
$info[
'quicktime'][
'video'][
'codec'];
865 $info[
'video'][
'bits_per_sample'] =
$info[
'quicktime'][
'video'][
'color_depth'];
867 $info[
'video'][
'lossless'] =
false;
868 $info[
'video'][
'pixel_aspect_ratio'] = (float) 1;
873 switch (strtolower($atom_structure[
'sample_description_table'][$i][
'data_format'])) {
875 $info[
'audio'][
'dataformat'] =
'mp4';
876 $info[
'quicktime'][
'audio'][
'codec'] =
'mp4';
882 $info[
'video'][
'dataformat'] =
'3ivx';
886 $info[
'video'][
'dataformat'] =
'xvid';
890 $info[
'video'][
'dataformat'] =
'mpeg4';
900 $info[
'video'][
'dataformat'] =
'divx';
907 unset($atom_structure[
'sample_description_table'][$i][
'data']);
916 $sttsEntriesDataOffset = 8;
920 $max_stts_entries_to_scan = (
$info[
'php_memory_limit'] ? min(floor($this->getid3->memory_limit / 10000), $atom_structure[
'number_entries']) : $atom_structure[
'number_entries']);
921 if ($max_stts_entries_to_scan < $atom_structure[
'number_entries']) {
922 $this->
warning(
'QuickTime atom "stts" has '.$atom_structure[
'number_entries'].
' but only scanning the first '.$max_stts_entries_to_scan.
' entries due to limited PHP memory available ('.floor($atom_structure[
'number_entries'] / 1048576).
'MB).');
924 for (
$i = 0;
$i < $max_stts_entries_to_scan;
$i++) {
925 $atom_structure[
'time_to_sample_table'][
$i][
'sample_count'] =
getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
926 $sttsEntriesDataOffset += 4;
927 $atom_structure[
'time_to_sample_table'][
$i][
'sample_duration'] =
getid3_lib::BigEndian2Int(substr($atom_data, $sttsEntriesDataOffset, 4));
928 $sttsEntriesDataOffset += 4;
930 $frames_count += $atom_structure[
'time_to_sample_table'][
$i][
'sample_count'];
943 $info[
'quicktime'][
'stts_framecount'][] = $frames_count;
969 $stssEntriesDataOffset = 8;
970 for (
$i = 0;
$i < $atom_structure[
'number_entries'];
$i++) {
972 $stssEntriesDataOffset += 4;
983 $stscEntriesDataOffset = 8;
984 for (
$i = 0;
$i < $atom_structure[
'number_entries'];
$i++) {
985 $atom_structure[
'sample_to_chunk_table'][
$i][
'first_chunk'] =
getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
986 $stscEntriesDataOffset += 4;
987 $atom_structure[
'sample_to_chunk_table'][
$i][
'samples_per_chunk'] =
getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
988 $stscEntriesDataOffset += 4;
989 $atom_structure[
'sample_to_chunk_table'][
$i][
'sample_description'] =
getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4));
990 $stscEntriesDataOffset += 4;
1002 $stszEntriesDataOffset = 12;
1003 if ($atom_structure[
'sample_size'] == 0) {
1004 for (
$i = 0;
$i < $atom_structure[
'number_entries'];
$i++) {
1006 $stszEntriesDataOffset += 4;
1018 $stcoEntriesDataOffset = 8;
1019 for (
$i = 0;
$i < $atom_structure[
'number_entries'];
$i++) {
1021 $stcoEntriesDataOffset += 4;
1032 $stcoEntriesDataOffset = 8;
1033 for (
$i = 0;
$i < $atom_structure[
'number_entries'];
$i++) {
1035 $stcoEntriesDataOffset += 8;
1045 $drefDataOffset = 8;
1046 for (
$i = 0;
$i < $atom_structure[
'number_entries'];
$i++) {
1048 $drefDataOffset += 4;
1049 $atom_structure[
'data_references'][
$i][
'type'] = substr($atom_data, $drefDataOffset, 4);
1050 $drefDataOffset += 4;
1052 $drefDataOffset += 1;
1054 $drefDataOffset += 3;
1055 $atom_structure[
'data_references'][
$i][
'data'] = substr($atom_data, $drefDataOffset, ($atom_structure[
'data_references'][
$i][
'size'] - 4 - 4 - 1 - 3));
1056 $drefDataOffset += ($atom_structure[
'data_references'][
$i][
'size'] - 4 - 4 - 1 - 3);
1058 $atom_structure[
'data_references'][
$i][
'flags'][
'self_reference'] = (bool) ($atom_structure[
'data_references'][
$i][
'flags_raw'] & 0x001);
1091 $atom_structure[
'flags'][
'no_lean_ahead'] = (bool) ($atom_structure[
'flags_raw'] & 0x001);
1098 $atom_structure[
'component_type'] = substr($atom_data, 4, 4);
1099 $atom_structure[
'component_subtype'] = substr($atom_data, 8, 4);
1100 $atom_structure[
'component_manufacturer'] = substr($atom_data, 12, 4);
1103 $atom_structure[
'component_name'] = $this->
Pascal2String(substr($atom_data, 24));
1105 if (($atom_structure[
'component_subtype'] ==
'STpn') && ($atom_structure[
'component_manufacturer'] ==
'zzzz')) {
1106 $info[
'video'][
'dataformat'] =
'quicktimevr';
1121 if ($atom_structure[
'time_scale'] == 0) {
1122 $this->
error(
'Corrupt Quicktime file: mdhd.time_scale == zero');
1125 $info[
'quicktime'][
'time_scale'] = ((isset(
$info[
'quicktime'][
'time_scale']) && (
$info[
'quicktime'][
'time_scale'] < 1000)) ? max(
$info[
'quicktime'][
'time_scale'], $atom_structure[
'time_scale']) : $atom_structure[
'time_scale']);
1129 $atom_structure[
'playtime_seconds'] = $atom_structure[
'duration'] / $atom_structure[
'time_scale'];
1131 if (empty(
$info[
'comments'][
'language']) || (!in_array($atom_structure[
'language'],
$info[
'comments'][
'language']))) {
1132 $info[
'comments'][
'language'][] = $atom_structure[
'language'];
1140 $atom_structure[
'atom_type'] = substr($atom_data, 6, 4);
1150 $atom_structure[
'clipping_data'] = substr($atom_data, 10);
1160 $atom_structure[
'default_hints'][
'double_buffer'] = (bool) ($atom_structure[
'default_hints_raw'] & 0x0020);
1161 $atom_structure[
'default_hints'][
'high_quality'] = (bool) ($atom_structure[
'default_hints_raw'] & 0x0100);
1170 for (
$i = 0;
$i < strlen($atom_data);
$i += 4) {
1180 for (
$i = 0;
$i < $atom_structure[
'number_entries'];
$i++ ) {
1191 $atom_structure[
'matte_data_raw'] = substr($atom_data, 4);
1199 for ($colortableentry = 0; $colortableentry < $atom_structure[
'color_table_size']; $colortableentry++) {
1200 $atom_structure[
'color_table'][$colortableentry][
'alpha'] =
getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 0, 2));
1201 $atom_structure[
'color_table'][$colortableentry][
'red'] =
getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 2, 2));
1202 $atom_structure[
'color_table'][$colortableentry][
'green'] =
getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 4, 2));
1203 $atom_structure[
'color_table'][$colortableentry][
'blue'] =
getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 6, 2));
1217 $atom_structure[
'reserved'] = substr($atom_data, 26, 10);
1235 if ($atom_structure[
'time_scale'] == 0) {
1236 $this->
error(
'Corrupt Quicktime file: mvhd.time_scale == zero');
1241 $info[
'quicktime'][
'time_scale'] = ((isset(
$info[
'quicktime'][
'time_scale']) && (
$info[
'quicktime'][
'time_scale'] < 1000)) ? max(
$info[
'quicktime'][
'time_scale'], $atom_structure[
'time_scale']) : $atom_structure[
'time_scale']);
1242 $info[
'quicktime'][
'display_scale'] = $atom_structure[
'matrix_a'];
1243 $info[
'playtime_seconds'] = $atom_structure[
'duration'] / $atom_structure[
'time_scale'];
1273 $atom_structure[
'flags'][
'enabled'] = (bool) ($atom_structure[
'flags_raw'] & 0x0001);
1274 $atom_structure[
'flags'][
'in_movie'] = (bool) ($atom_structure[
'flags_raw'] & 0x0002);
1275 $atom_structure[
'flags'][
'in_preview'] = (bool) ($atom_structure[
'flags_raw'] & 0x0004);
1276 $atom_structure[
'flags'][
'in_poster'] = (bool) ($atom_structure[
'flags_raw'] & 0x0008);
1280 if ($atom_structure[
'flags'][
'enabled'] == 1) {
1281 if (!isset(
$info[
'video'][
'resolution_x']) || !isset(
$info[
'video'][
'resolution_y'])) {
1282 $info[
'video'][
'resolution_x'] = $atom_structure[
'width'];
1283 $info[
'video'][
'resolution_y'] = $atom_structure[
'height'];
1285 $info[
'video'][
'resolution_x'] = max(
$info[
'video'][
'resolution_x'], $atom_structure[
'width']);
1286 $info[
'video'][
'resolution_y'] = max(
$info[
'video'][
'resolution_y'], $atom_structure[
'height']);
1287 $info[
'quicktime'][
'video'][
'resolution_x'] =
$info[
'video'][
'resolution_x'];
1288 $info[
'quicktime'][
'video'][
'resolution_y'] =
$info[
'video'][
'resolution_y'];
1323 $atom_structure[
'num_iods_tracks'] = ($atom_structure[
'length'] - 7) / 6;
1324 for (
$i = 0;
$i < $atom_structure[
'num_iods_tracks'];
$i++) {
1338 $atom_structure[
'signature'] = substr($atom_data, 0, 4);
1340 $atom_structure[
'fourcc'] = substr($atom_data, 8, 4);
1351 if (substr($atom_data, $mdat_offset, 8) ==
"\x00\x00\x00\x08".
'wide') {
1353 } elseif (substr($atom_data, $mdat_offset, 8) ==
"\x00\x00\x00\x00".
'mdat') {
1361 while (($mdat_offset < (strlen($atom_data) - 8))
1363 && ($chapter_string_length < 1000)
1364 && ($chapter_string_length <= (strlen($atom_data) - $mdat_offset - 2))
1365 && preg_match(
'#^([\x00-\xFF]{2})([\x20-\xFF]+)$#', substr($atom_data, $mdat_offset, $chapter_string_length + 2), $chapter_matches)) {
1366 list($dummy, $chapter_string_length_hex, $chapter_string) = $chapter_matches;
1367 $mdat_offset += (2 + $chapter_string_length);
1368 @
$info[
'quicktime'][
'comments'][
'chapters'][] = $chapter_string;
1371 if (substr($atom_data, $mdat_offset, 12) ==
"\x00\x00\x00\x0C\x65\x6E\x63\x64\x00\x00\x01\x00") {
1377 if (($atomsize > 8) && (!isset(
$info[
'avdataend_tmp']) || (
$info[
'quicktime'][$atomname][
'size'] > (
$info[
'avdataend_tmp'] -
$info[
'avdataoffset'])))) {
1379 $info[
'avdataoffset'] = $atom_structure[
'offset'] + 8;
1380 $OldAVDataEnd =
$info[
'avdataend'];
1381 $info[
'avdataend'] = $atom_structure[
'offset'] + $atom_structure[
'size'];
1383 $getid3_temp =
new getID3();
1384 $getid3_temp->openfile($this->getid3->filename);
1385 $getid3_temp->info[
'avdataoffset'] =
$info[
'avdataoffset'];
1386 $getid3_temp->info[
'avdataend'] =
$info[
'avdataend'];
1388 if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode($this->fread(4)))) {
1389 $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info[
'avdataoffset'],
false);
1390 if (!empty($getid3_temp->info[
'warning'])) {
1391 foreach ($getid3_temp->info[
'warning'] as $value) {
1395 if (!empty($getid3_temp->info[
'mpeg'])) {
1396 $info[
'mpeg'] = $getid3_temp->info[
'mpeg'];
1397 if (isset(
$info[
'mpeg'][
'audio'])) {
1398 $info[
'audio'][
'dataformat'] =
'mp3';
1399 $info[
'audio'][
'codec'] = (!empty(
$info[
'mpeg'][
'audio'][
'encoder']) ?
$info[
'mpeg'][
'audio'][
'encoder'] : (!empty(
$info[
'mpeg'][
'audio'][
'codec']) ?
$info[
'mpeg'][
'audio'][
'codec'] : (!empty(
$info[
'mpeg'][
'audio'][
'LAME']) ?
'LAME' :
'mp3')));
1400 $info[
'audio'][
'sample_rate'] =
$info[
'mpeg'][
'audio'][
'sample_rate'];
1401 $info[
'audio'][
'channels'] =
$info[
'mpeg'][
'audio'][
'channels'];
1402 $info[
'audio'][
'bitrate'] =
$info[
'mpeg'][
'audio'][
'bitrate'];
1403 $info[
'audio'][
'bitrate_mode'] = strtolower(
$info[
'mpeg'][
'audio'][
'bitrate_mode']);
1404 $info[
'bitrate'] =
$info[
'audio'][
'bitrate'];
1408 unset($getid3_mp3, $getid3_temp);
1409 $info[
'avdataend'] = $OldAVDataEnd;
1410 unset($OldAVDataEnd);
1414 unset($mdat_offset, $chapter_string_length, $chapter_matches);
1442 $atom_structure[
'ctyp'] = substr($atom_data, 0, 4);
1443 $info[
'quicktime'][
'controller'] = $atom_structure[
'ctyp'];
1444 switch ($atom_structure[
'ctyp']) {
1446 $info[
'video'][
'dataformat'] =
'quicktimevr';
1459 $info[
'quicktime'][
'hinting'] =
true;
1463 for (
$i = 0;
$i < ($atom_structure[
'size'] - 8);
$i += 4) {
1486 $atom_structure[
'data'] = $atom_data;
1487 if (preg_match(
'#([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)([\\+\\-][0-9\\.]+)?/$#i', $atom_data, $matches)) {
1488 @list($all, $latitude, $longitude, $altitude) = $matches;
1489 $info[
'quicktime'][
'comments'][
'gps_latitude'][] = floatval($latitude);
1490 $info[
'quicktime'][
'comments'][
'gps_longitude'][] = floatval($longitude);
1491 if (!empty($altitude)) {
1492 $info[
'quicktime'][
'comments'][
'gps_altitude'][] = floatval($altitude);
1495 $this->
warning(
'QuickTime atom "©xyz" data does not match expected data pattern at offset '.$baseoffset.
'. Please report as getID3() bug.');
1507 if (preg_match(
'/^\xFF\xD8\xFF/', $atom_data)) {
1508 $atom_structure[
'data'] = $atom_data;
1509 $atom_structure[
'image_mime'] =
'image/jpeg';
1510 $atom_structure[
'description'] = (($atomname ==
'NCTH') ?
'Nikon Camera Thumbnail Image' : (($atomname ==
'NCVW') ?
'Nikon Camera Preview Image' :
'Nikon preview image'));
1511 $info[
'quicktime'][
'comments'][
'picture'][] = array(
'image_mime'=>$atom_structure[
'image_mime'],
'data'=>$atom_data,
'description'=>$atom_structure[
'description']);
1520 $atom_structure[
'data'] = $atom_data;
1523 case "\x00\x00\x00\x00":
1543 static $metaDATAkey = 1;
1545 $atom_structure[
'language'] = substr($atom_data, 4 + 0, 2);
1547 $atom_structure[
'data'] = substr($atom_data, 4 + 4);
1548 $atom_structure[
'key_name'] = @
$info[
'quicktime'][
'temp_meta_key_names'][$metaDATAkey++];
1550 if ($atom_structure[
'key_name'] && $atom_structure[
'data']) {
1551 @
$info[
'quicktime'][
'comments'][str_replace(
'com.apple.quicktime.',
'', $atom_structure[
'key_name'])][] = $atom_structure[
'data'];
1562 $keys_atom_offset = 8;
1563 for ($i = 1; $i <= $atom_structure[
'entry_count']; $i++) {
1565 $atom_structure[
'keys'][
$i][
'key_namespace'] = substr($atom_data, $keys_atom_offset + 4, 4);
1566 $atom_structure[
'keys'][
$i][
'key_value'] = substr($atom_data, $keys_atom_offset + 8, $atom_structure[
'keys'][$i][
'key_size'] - 8);
1567 $keys_atom_offset += $atom_structure[
'keys'][
$i][
'key_size'];
1569 $info[
'quicktime'][
'temp_meta_key_names'][
$i] = $atom_structure[
'keys'][
$i][
'key_value'];
1574 $this->
warning(
'Unknown QuickTime atom type: "'.preg_replace(
'#[^a-zA-Z0-9 _\\-]#',
'?', $atomname).
'" ('.trim(
getid3_lib::PrintHexBytes($atomname)).
') at offset '.$baseoffset);
1575 $atom_structure[
'data'] = $atom_data;
1578 array_pop($atomHierarchy);
1579 return $atom_structure;
1584 $atom_structure =
false;
1586 $subatomcounter = 0;
1590 while ($subatomoffset < strlen($atom_data)) {
1592 $subatomname = substr($atom_data, $subatomoffset + 4, 4);
1593 $subatomdata = substr($atom_data, $subatomoffset + 8, $subatomsize - 8);
1594 if ($subatomsize == 0) {
1598 if (strlen($atom_data) > 12) {
1599 $subatomoffset += 4;
1602 return $atom_structure;
1607 $subatomoffset += $subatomsize;
1610 return $atom_structure;
1619 $b = ord(substr(
$data, $offset++, 1));
1620 $length = ($length << 7) | ($b & 0x7F);
1621 }
while (($b & 0x80) && ($num_bytes++ < 4));
1628 static $QuicktimeLanguageLookup = array();
1629 if (empty($QuicktimeLanguageLookup)) {
1630 $QuicktimeLanguageLookup[0] =
'English';
1631 $QuicktimeLanguageLookup[1] =
'French';
1632 $QuicktimeLanguageLookup[2] =
'German';
1633 $QuicktimeLanguageLookup[3] =
'Italian';
1634 $QuicktimeLanguageLookup[4] =
'Dutch';
1635 $QuicktimeLanguageLookup[5] =
'Swedish';
1636 $QuicktimeLanguageLookup[6] =
'Spanish';
1637 $QuicktimeLanguageLookup[7] =
'Danish';
1638 $QuicktimeLanguageLookup[8] =
'Portuguese';
1639 $QuicktimeLanguageLookup[9] =
'Norwegian';
1640 $QuicktimeLanguageLookup[10] =
'Hebrew';
1641 $QuicktimeLanguageLookup[11] =
'Japanese';
1642 $QuicktimeLanguageLookup[12] =
'Arabic';
1643 $QuicktimeLanguageLookup[13] =
'Finnish';
1644 $QuicktimeLanguageLookup[14] =
'Greek';
1645 $QuicktimeLanguageLookup[15] =
'Icelandic';
1646 $QuicktimeLanguageLookup[16] =
'Maltese';
1647 $QuicktimeLanguageLookup[17] =
'Turkish';
1648 $QuicktimeLanguageLookup[18] =
'Croatian';
1649 $QuicktimeLanguageLookup[19] =
'Chinese (Traditional)';
1650 $QuicktimeLanguageLookup[20] =
'Urdu';
1651 $QuicktimeLanguageLookup[21] =
'Hindi';
1652 $QuicktimeLanguageLookup[22] =
'Thai';
1653 $QuicktimeLanguageLookup[23] =
'Korean';
1654 $QuicktimeLanguageLookup[24] =
'Lithuanian';
1655 $QuicktimeLanguageLookup[25] =
'Polish';
1656 $QuicktimeLanguageLookup[26] =
'Hungarian';
1657 $QuicktimeLanguageLookup[27] =
'Estonian';
1658 $QuicktimeLanguageLookup[28] =
'Lettish';
1659 $QuicktimeLanguageLookup[28] =
'Latvian';
1660 $QuicktimeLanguageLookup[29] =
'Saamisk';
1661 $QuicktimeLanguageLookup[29] =
'Lappish';
1662 $QuicktimeLanguageLookup[30] =
'Faeroese';
1663 $QuicktimeLanguageLookup[31] =
'Farsi';
1664 $QuicktimeLanguageLookup[31] =
'Persian';
1665 $QuicktimeLanguageLookup[32] =
'Russian';
1666 $QuicktimeLanguageLookup[33] =
'Chinese (Simplified)';
1667 $QuicktimeLanguageLookup[34] =
'Flemish';
1668 $QuicktimeLanguageLookup[35] =
'Irish';
1669 $QuicktimeLanguageLookup[36] =
'Albanian';
1670 $QuicktimeLanguageLookup[37] =
'Romanian';
1671 $QuicktimeLanguageLookup[38] =
'Czech';
1672 $QuicktimeLanguageLookup[39] =
'Slovak';
1673 $QuicktimeLanguageLookup[40] =
'Slovenian';
1674 $QuicktimeLanguageLookup[41] =
'Yiddish';
1675 $QuicktimeLanguageLookup[42] =
'Serbian';
1676 $QuicktimeLanguageLookup[43] =
'Macedonian';
1677 $QuicktimeLanguageLookup[44] =
'Bulgarian';
1678 $QuicktimeLanguageLookup[45] =
'Ukrainian';
1679 $QuicktimeLanguageLookup[46] =
'Byelorussian';
1680 $QuicktimeLanguageLookup[47] =
'Uzbek';
1681 $QuicktimeLanguageLookup[48] =
'Kazakh';
1682 $QuicktimeLanguageLookup[49] =
'Azerbaijani';
1683 $QuicktimeLanguageLookup[50] =
'AzerbaijanAr';
1684 $QuicktimeLanguageLookup[51] =
'Armenian';
1685 $QuicktimeLanguageLookup[52] =
'Georgian';
1686 $QuicktimeLanguageLookup[53] =
'Moldavian';
1687 $QuicktimeLanguageLookup[54] =
'Kirghiz';
1688 $QuicktimeLanguageLookup[55] =
'Tajiki';
1689 $QuicktimeLanguageLookup[56] =
'Turkmen';
1690 $QuicktimeLanguageLookup[57] =
'Mongolian';
1691 $QuicktimeLanguageLookup[58] =
'MongolianCyr';
1692 $QuicktimeLanguageLookup[59] =
'Pashto';
1693 $QuicktimeLanguageLookup[60] =
'Kurdish';
1694 $QuicktimeLanguageLookup[61] =
'Kashmiri';
1695 $QuicktimeLanguageLookup[62] =
'Sindhi';
1696 $QuicktimeLanguageLookup[63] =
'Tibetan';
1697 $QuicktimeLanguageLookup[64] =
'Nepali';
1698 $QuicktimeLanguageLookup[65] =
'Sanskrit';
1699 $QuicktimeLanguageLookup[66] =
'Marathi';
1700 $QuicktimeLanguageLookup[67] =
'Bengali';
1701 $QuicktimeLanguageLookup[68] =
'Assamese';
1702 $QuicktimeLanguageLookup[69] =
'Gujarati';
1703 $QuicktimeLanguageLookup[70] =
'Punjabi';
1704 $QuicktimeLanguageLookup[71] =
'Oriya';
1705 $QuicktimeLanguageLookup[72] =
'Malayalam';
1706 $QuicktimeLanguageLookup[73] =
'Kannada';
1707 $QuicktimeLanguageLookup[74] =
'Tamil';
1708 $QuicktimeLanguageLookup[75] =
'Telugu';
1709 $QuicktimeLanguageLookup[76] =
'Sinhalese';
1710 $QuicktimeLanguageLookup[77] =
'Burmese';
1711 $QuicktimeLanguageLookup[78] =
'Khmer';
1712 $QuicktimeLanguageLookup[79] =
'Lao';
1713 $QuicktimeLanguageLookup[80] =
'Vietnamese';
1714 $QuicktimeLanguageLookup[81] =
'Indonesian';
1715 $QuicktimeLanguageLookup[82] =
'Tagalog';
1716 $QuicktimeLanguageLookup[83] =
'MalayRoman';
1717 $QuicktimeLanguageLookup[84] =
'MalayArabic';
1718 $QuicktimeLanguageLookup[85] =
'Amharic';
1719 $QuicktimeLanguageLookup[86] =
'Tigrinya';
1720 $QuicktimeLanguageLookup[87] =
'Galla';
1721 $QuicktimeLanguageLookup[87] =
'Oromo';
1722 $QuicktimeLanguageLookup[88] =
'Somali';
1723 $QuicktimeLanguageLookup[89] =
'Swahili';
1724 $QuicktimeLanguageLookup[90] =
'Ruanda';
1725 $QuicktimeLanguageLookup[91] =
'Rundi';
1726 $QuicktimeLanguageLookup[92] =
'Chewa';
1727 $QuicktimeLanguageLookup[93] =
'Malagasy';
1728 $QuicktimeLanguageLookup[94] =
'Esperanto';
1729 $QuicktimeLanguageLookup[128] =
'Welsh';
1730 $QuicktimeLanguageLookup[129] =
'Basque';
1731 $QuicktimeLanguageLookup[130] =
'Catalan';
1732 $QuicktimeLanguageLookup[131] =
'Latin';
1733 $QuicktimeLanguageLookup[132] =
'Quechua';
1734 $QuicktimeLanguageLookup[133] =
'Guarani';
1735 $QuicktimeLanguageLookup[134] =
'Aymara';
1736 $QuicktimeLanguageLookup[135] =
'Tatar';
1737 $QuicktimeLanguageLookup[136] =
'Uighur';
1738 $QuicktimeLanguageLookup[137] =
'Dzongkha';
1739 $QuicktimeLanguageLookup[138] =
'JavaneseRom';
1740 $QuicktimeLanguageLookup[32767] =
'Unspecified';
1742 if (($languageid > 138) && ($languageid < 32767)) {
1754 $iso_language_id =
'';
1755 $iso_language_id .= chr((($languageid & 0x7C00) >> 10) + 0x60);
1756 $iso_language_id .= chr((($languageid & 0x03E0) >> 5) + 0x60);
1757 $iso_language_id .= chr((($languageid & 0x001F) >> 0) + 0x60);
1760 return (isset($QuicktimeLanguageLookup[$languageid]) ? $QuicktimeLanguageLookup[$languageid] :
'invalid');
1764 static $QuicktimeVideoCodecLookup = array();
1765 if (empty($QuicktimeVideoCodecLookup)) {
1766 $QuicktimeVideoCodecLookup[
'.SGI'] =
'SGI';
1767 $QuicktimeVideoCodecLookup[
'3IV1'] =
'3ivx MPEG-4 v1';
1768 $QuicktimeVideoCodecLookup[
'3IV2'] =
'3ivx MPEG-4 v2';
1769 $QuicktimeVideoCodecLookup[
'3IVX'] =
'3ivx MPEG-4';
1770 $QuicktimeVideoCodecLookup[
'8BPS'] =
'Planar RGB';
1771 $QuicktimeVideoCodecLookup[
'avc1'] =
'H.264/MPEG-4 AVC';
1772 $QuicktimeVideoCodecLookup[
'avr '] =
'AVR-JPEG';
1773 $QuicktimeVideoCodecLookup[
'b16g'] =
'16Gray';
1774 $QuicktimeVideoCodecLookup[
'b32a'] =
'32AlphaGray';
1775 $QuicktimeVideoCodecLookup[
'b48r'] =
'48RGB';
1776 $QuicktimeVideoCodecLookup[
'b64a'] =
'64ARGB';
1777 $QuicktimeVideoCodecLookup[
'base'] =
'Base';
1778 $QuicktimeVideoCodecLookup[
'clou'] =
'Cloud';
1779 $QuicktimeVideoCodecLookup[
'cmyk'] =
'CMYK';
1780 $QuicktimeVideoCodecLookup[
'cvid'] =
'Cinepak';
1781 $QuicktimeVideoCodecLookup[
'dmb1'] =
'OpenDML JPEG';
1782 $QuicktimeVideoCodecLookup[
'dvc '] =
'DVC-NTSC';
1783 $QuicktimeVideoCodecLookup[
'dvcp'] =
'DVC-PAL';
1784 $QuicktimeVideoCodecLookup[
'dvpn'] =
'DVCPro-NTSC';
1785 $QuicktimeVideoCodecLookup[
'dvpp'] =
'DVCPro-PAL';
1786 $QuicktimeVideoCodecLookup[
'fire'] =
'Fire';
1787 $QuicktimeVideoCodecLookup[
'flic'] =
'FLC';
1788 $QuicktimeVideoCodecLookup[
'gif '] =
'GIF';
1789 $QuicktimeVideoCodecLookup[
'h261'] =
'H261';
1790 $QuicktimeVideoCodecLookup[
'h263'] =
'H263';
1791 $QuicktimeVideoCodecLookup[
'IV41'] =
'Indeo4';
1792 $QuicktimeVideoCodecLookup[
'jpeg'] =
'JPEG';
1793 $QuicktimeVideoCodecLookup[
'kpcd'] =
'PhotoCD';
1794 $QuicktimeVideoCodecLookup[
'mjpa'] =
'Motion JPEG-A';
1795 $QuicktimeVideoCodecLookup[
'mjpb'] =
'Motion JPEG-B';
1796 $QuicktimeVideoCodecLookup[
'msvc'] =
'Microsoft Video1';
1797 $QuicktimeVideoCodecLookup[
'myuv'] =
'MPEG YUV420';
1798 $QuicktimeVideoCodecLookup[
'path'] =
'Vector';
1799 $QuicktimeVideoCodecLookup[
'png '] =
'PNG';
1800 $QuicktimeVideoCodecLookup[
'PNTG'] =
'MacPaint';
1801 $QuicktimeVideoCodecLookup[
'qdgx'] =
'QuickDrawGX';
1802 $QuicktimeVideoCodecLookup[
'qdrw'] =
'QuickDraw';
1803 $QuicktimeVideoCodecLookup[
'raw '] =
'RAW';
1804 $QuicktimeVideoCodecLookup[
'ripl'] =
'WaterRipple';
1805 $QuicktimeVideoCodecLookup[
'rpza'] =
'Video';
1806 $QuicktimeVideoCodecLookup[
'smc '] =
'Graphics';
1807 $QuicktimeVideoCodecLookup[
'SVQ1'] =
'Sorenson Video 1';
1808 $QuicktimeVideoCodecLookup[
'SVQ1'] =
'Sorenson Video 3';
1809 $QuicktimeVideoCodecLookup[
'syv9'] =
'Sorenson YUV9';
1810 $QuicktimeVideoCodecLookup[
'tga '] =
'Targa';
1811 $QuicktimeVideoCodecLookup[
'tiff'] =
'TIFF';
1812 $QuicktimeVideoCodecLookup[
'WRAW'] =
'Windows RAW';
1813 $QuicktimeVideoCodecLookup[
'WRLE'] =
'BMP';
1814 $QuicktimeVideoCodecLookup[
'y420'] =
'YUV420';
1815 $QuicktimeVideoCodecLookup[
'yuv2'] =
'ComponentVideo';
1816 $QuicktimeVideoCodecLookup[
'yuvs'] =
'ComponentVideoUnsigned';
1817 $QuicktimeVideoCodecLookup[
'yuvu'] =
'ComponentVideoSigned';
1819 return (isset($QuicktimeVideoCodecLookup[$codecid]) ? $QuicktimeVideoCodecLookup[$codecid] :
'');
1823 static $QuicktimeAudioCodecLookup = array();
1824 if (empty($QuicktimeAudioCodecLookup)) {
1825 $QuicktimeAudioCodecLookup[
'.mp3'] =
'Fraunhofer MPEG Layer-III alias';
1826 $QuicktimeAudioCodecLookup[
'aac '] =
'ISO/IEC 14496-3 AAC';
1827 $QuicktimeAudioCodecLookup[
'agsm'] =
'Apple GSM 10:1';
1828 $QuicktimeAudioCodecLookup[
'alac'] =
'Apple Lossless Audio Codec';
1829 $QuicktimeAudioCodecLookup[
'alaw'] =
'A-law 2:1';
1830 $QuicktimeAudioCodecLookup[
'conv'] =
'Sample Format';
1831 $QuicktimeAudioCodecLookup[
'dvca'] =
'DV';
1832 $QuicktimeAudioCodecLookup[
'dvi '] =
'DV 4:1';
1833 $QuicktimeAudioCodecLookup[
'eqal'] =
'Frequency Equalizer';
1834 $QuicktimeAudioCodecLookup[
'fl32'] =
'32-bit Floating Point';
1835 $QuicktimeAudioCodecLookup[
'fl64'] =
'64-bit Floating Point';
1836 $QuicktimeAudioCodecLookup[
'ima4'] =
'Interactive Multimedia Association 4:1';
1837 $QuicktimeAudioCodecLookup[
'in24'] =
'24-bit Integer';
1838 $QuicktimeAudioCodecLookup[
'in32'] =
'32-bit Integer';
1839 $QuicktimeAudioCodecLookup[
'lpc '] =
'LPC 23:1';
1840 $QuicktimeAudioCodecLookup[
'MAC3'] =
'Macintosh Audio Compression/Expansion (MACE) 3:1';
1841 $QuicktimeAudioCodecLookup[
'MAC6'] =
'Macintosh Audio Compression/Expansion (MACE) 6:1';
1842 $QuicktimeAudioCodecLookup[
'mixb'] =
'8-bit Mixer';
1843 $QuicktimeAudioCodecLookup[
'mixw'] =
'16-bit Mixer';
1844 $QuicktimeAudioCodecLookup[
'mp4a'] =
'ISO/IEC 14496-3 AAC';
1845 $QuicktimeAudioCodecLookup[
'MS'.
"\x00\x02"] =
'Microsoft ADPCM';
1846 $QuicktimeAudioCodecLookup[
'MS'.
"\x00\x11"] =
'DV IMA';
1847 $QuicktimeAudioCodecLookup[
'MS'.
"\x00\x55"] =
'Fraunhofer MPEG Layer III';
1848 $QuicktimeAudioCodecLookup[
'NONE'] =
'No Encoding';
1849 $QuicktimeAudioCodecLookup[
'Qclp'] =
'Qualcomm PureVoice';
1850 $QuicktimeAudioCodecLookup[
'QDM2'] =
'QDesign Music 2';
1851 $QuicktimeAudioCodecLookup[
'QDMC'] =
'QDesign Music 1';
1852 $QuicktimeAudioCodecLookup[
'ratb'] =
'8-bit Rate';
1853 $QuicktimeAudioCodecLookup[
'ratw'] =
'16-bit Rate';
1854 $QuicktimeAudioCodecLookup[
'raw '] =
'raw PCM';
1855 $QuicktimeAudioCodecLookup[
'sour'] =
'Sound Source';
1856 $QuicktimeAudioCodecLookup[
'sowt'] =
'signed/two\'s complement (Little Endian)';
1857 $QuicktimeAudioCodecLookup[
'str1'] =
'Iomega MPEG layer II';
1858 $QuicktimeAudioCodecLookup[
'str2'] =
'Iomega MPEG *layer II';
1859 $QuicktimeAudioCodecLookup[
'str3'] =
'Iomega MPEG **layer II';
1860 $QuicktimeAudioCodecLookup[
'str4'] =
'Iomega MPEG ***layer II';
1861 $QuicktimeAudioCodecLookup[
'twos'] =
'signed/two\'s complement (Big Endian)';
1862 $QuicktimeAudioCodecLookup[
'ulaw'] =
'mu-law 2:1';
1864 return (isset($QuicktimeAudioCodecLookup[$codecid]) ? $QuicktimeAudioCodecLookup[$codecid] :
'');
1868 static $QuicktimeDCOMLookup = array();
1869 if (empty($QuicktimeDCOMLookup)) {
1870 $QuicktimeDCOMLookup[
'zlib'] =
'ZLib Deflate';
1871 $QuicktimeDCOMLookup[
'adec'] =
'Apple Compression';
1873 return (isset($QuicktimeDCOMLookup[$compressionid]) ? $QuicktimeDCOMLookup[$compressionid] :
'');
1877 static $QuicktimeColorNameLookup = array();
1878 if (empty($QuicktimeColorNameLookup)) {
1879 $QuicktimeColorNameLookup[1] =
'2-color (monochrome)';
1880 $QuicktimeColorNameLookup[2] =
'4-color';
1881 $QuicktimeColorNameLookup[4] =
'16-color';
1882 $QuicktimeColorNameLookup[8] =
'256-color';
1883 $QuicktimeColorNameLookup[16] =
'thousands (16-bit color)';
1884 $QuicktimeColorNameLookup[24] =
'millions (24-bit color)';
1885 $QuicktimeColorNameLookup[32] =
'millions+ (32-bit color)';
1886 $QuicktimeColorNameLookup[33] =
'black & white';
1887 $QuicktimeColorNameLookup[34] =
'4-gray';
1888 $QuicktimeColorNameLookup[36] =
'16-gray';
1889 $QuicktimeColorNameLookup[40] =
'256-gray';
1891 return (isset($QuicktimeColorNameLookup[$colordepthid]) ? $QuicktimeColorNameLookup[$colordepthid] :
'invalid');
1895 static $QuicktimeSTIKLookup = array();
1896 if (empty($QuicktimeSTIKLookup)) {
1897 $QuicktimeSTIKLookup[0] =
'Movie';
1898 $QuicktimeSTIKLookup[1] =
'Normal';
1899 $QuicktimeSTIKLookup[2] =
'Audiobook';
1900 $QuicktimeSTIKLookup[5] =
'Whacked Bookmark';
1901 $QuicktimeSTIKLookup[6] =
'Music Video';
1902 $QuicktimeSTIKLookup[9] =
'Short Film';
1903 $QuicktimeSTIKLookup[10] =
'TV Show';
1904 $QuicktimeSTIKLookup[11] =
'Booklet';
1905 $QuicktimeSTIKLookup[14] =
'Ringtone';
1906 $QuicktimeSTIKLookup[21] =
'Podcast';
1908 return (isset($QuicktimeSTIKLookup[$stik]) ? $QuicktimeSTIKLookup[$stik] :
'invalid');
1912 static $QuicktimeIODSaudioProfileNameLookup = array();
1913 if (empty($QuicktimeIODSaudioProfileNameLookup)) {
1914 $QuicktimeIODSaudioProfileNameLookup = array(
1915 0x00 =>
'ISO Reserved (0x00)',
1916 0x01 =>
'Main Audio Profile @ Level 1',
1917 0x02 =>
'Main Audio Profile @ Level 2',
1918 0x03 =>
'Main Audio Profile @ Level 3',
1919 0x04 =>
'Main Audio Profile @ Level 4',
1920 0x05 =>
'Scalable Audio Profile @ Level 1',
1921 0x06 =>
'Scalable Audio Profile @ Level 2',
1922 0x07 =>
'Scalable Audio Profile @ Level 3',
1923 0x08 =>
'Scalable Audio Profile @ Level 4',
1924 0x09 =>
'Speech Audio Profile @ Level 1',
1925 0x0A =>
'Speech Audio Profile @ Level 2',
1926 0x0B =>
'Synthetic Audio Profile @ Level 1',
1927 0x0C =>
'Synthetic Audio Profile @ Level 2',
1928 0x0D =>
'Synthetic Audio Profile @ Level 3',
1929 0x0E =>
'High Quality Audio Profile @ Level 1',
1930 0x0F =>
'High Quality Audio Profile @ Level 2',
1931 0x10 =>
'High Quality Audio Profile @ Level 3',
1932 0x11 =>
'High Quality Audio Profile @ Level 4',
1933 0x12 =>
'High Quality Audio Profile @ Level 5',
1934 0x13 =>
'High Quality Audio Profile @ Level 6',
1935 0x14 =>
'High Quality Audio Profile @ Level 7',
1936 0x15 =>
'High Quality Audio Profile @ Level 8',
1937 0x16 =>
'Low Delay Audio Profile @ Level 1',
1938 0x17 =>
'Low Delay Audio Profile @ Level 2',
1939 0x18 =>
'Low Delay Audio Profile @ Level 3',
1940 0x19 =>
'Low Delay Audio Profile @ Level 4',
1941 0x1A =>
'Low Delay Audio Profile @ Level 5',
1942 0x1B =>
'Low Delay Audio Profile @ Level 6',
1943 0x1C =>
'Low Delay Audio Profile @ Level 7',
1944 0x1D =>
'Low Delay Audio Profile @ Level 8',
1945 0x1E =>
'Natural Audio Profile @ Level 1',
1946 0x1F =>
'Natural Audio Profile @ Level 2',
1947 0x20 =>
'Natural Audio Profile @ Level 3',
1948 0x21 =>
'Natural Audio Profile @ Level 4',
1949 0x22 =>
'Mobile Audio Internetworking Profile @ Level 1',
1950 0x23 =>
'Mobile Audio Internetworking Profile @ Level 2',
1951 0x24 =>
'Mobile Audio Internetworking Profile @ Level 3',
1952 0x25 =>
'Mobile Audio Internetworking Profile @ Level 4',
1953 0x26 =>
'Mobile Audio Internetworking Profile @ Level 5',
1954 0x27 =>
'Mobile Audio Internetworking Profile @ Level 6',
1955 0x28 =>
'AAC Profile @ Level 1',
1956 0x29 =>
'AAC Profile @ Level 2',
1957 0x2A =>
'AAC Profile @ Level 4',
1958 0x2B =>
'AAC Profile @ Level 5',
1959 0x2C =>
'High Efficiency AAC Profile @ Level 2',
1960 0x2D =>
'High Efficiency AAC Profile @ Level 3',
1961 0x2E =>
'High Efficiency AAC Profile @ Level 4',
1962 0x2F =>
'High Efficiency AAC Profile @ Level 5',
1963 0xFE =>
'Not part of MPEG-4 audio profiles',
1964 0xFF =>
'No audio capability required',
1967 return (isset($QuicktimeIODSaudioProfileNameLookup[$audio_profile_id]) ? $QuicktimeIODSaudioProfileNameLookup[$audio_profile_id] :
'ISO Reserved / User Private');
1972 static $QuicktimeIODSvideoProfileNameLookup = array();
1973 if (empty($QuicktimeIODSvideoProfileNameLookup)) {
1974 $QuicktimeIODSvideoProfileNameLookup = array(
1975 0x00 =>
'Reserved (0x00) Profile',
1976 0x01 =>
'Simple Profile @ Level 1',
1977 0x02 =>
'Simple Profile @ Level 2',
1978 0x03 =>
'Simple Profile @ Level 3',
1979 0x08 =>
'Simple Profile @ Level 0',
1980 0x10 =>
'Simple Scalable Profile @ Level 0',
1981 0x11 =>
'Simple Scalable Profile @ Level 1',
1982 0x12 =>
'Simple Scalable Profile @ Level 2',
1983 0x15 =>
'AVC/H264 Profile',
1984 0x21 =>
'Core Profile @ Level 1',
1985 0x22 =>
'Core Profile @ Level 2',
1986 0x32 =>
'Main Profile @ Level 2',
1987 0x33 =>
'Main Profile @ Level 3',
1988 0x34 =>
'Main Profile @ Level 4',
1989 0x42 =>
'N-bit Profile @ Level 2',
1990 0x51 =>
'Scalable Texture Profile @ Level 1',
1991 0x61 =>
'Simple Face Animation Profile @ Level 1',
1992 0x62 =>
'Simple Face Animation Profile @ Level 2',
1993 0x63 =>
'Simple FBA Profile @ Level 1',
1994 0x64 =>
'Simple FBA Profile @ Level 2',
1995 0x71 =>
'Basic Animated Texture Profile @ Level 1',
1996 0x72 =>
'Basic Animated Texture Profile @ Level 2',
1997 0x81 =>
'Hybrid Profile @ Level 1',
1998 0x82 =>
'Hybrid Profile @ Level 2',
1999 0x91 =>
'Advanced Real Time Simple Profile @ Level 1',
2000 0x92 =>
'Advanced Real Time Simple Profile @ Level 2',
2001 0x93 =>
'Advanced Real Time Simple Profile @ Level 3',
2002 0x94 =>
'Advanced Real Time Simple Profile @ Level 4',
2003 0xA1 =>
'Core Scalable Profile @ Level1',
2004 0xA2 =>
'Core Scalable Profile @ Level2',
2005 0xA3 =>
'Core Scalable Profile @ Level3',
2006 0xB1 =>
'Advanced Coding Efficiency Profile @ Level 1',
2007 0xB2 =>
'Advanced Coding Efficiency Profile @ Level 2',
2008 0xB3 =>
'Advanced Coding Efficiency Profile @ Level 3',
2009 0xB4 =>
'Advanced Coding Efficiency Profile @ Level 4',
2010 0xC1 =>
'Advanced Core Profile @ Level 1',
2011 0xC2 =>
'Advanced Core Profile @ Level 2',
2012 0xD1 =>
'Advanced Scalable Texture @ Level1',
2013 0xD2 =>
'Advanced Scalable Texture @ Level2',
2014 0xE1 =>
'Simple Studio Profile @ Level 1',
2015 0xE2 =>
'Simple Studio Profile @ Level 2',
2016 0xE3 =>
'Simple Studio Profile @ Level 3',
2017 0xE4 =>
'Simple Studio Profile @ Level 4',
2018 0xE5 =>
'Core Studio Profile @ Level 1',
2019 0xE6 =>
'Core Studio Profile @ Level 2',
2020 0xE7 =>
'Core Studio Profile @ Level 3',
2021 0xE8 =>
'Core Studio Profile @ Level 4',
2022 0xF0 =>
'Advanced Simple Profile @ Level 0',
2023 0xF1 =>
'Advanced Simple Profile @ Level 1',
2024 0xF2 =>
'Advanced Simple Profile @ Level 2',
2025 0xF3 =>
'Advanced Simple Profile @ Level 3',
2026 0xF4 =>
'Advanced Simple Profile @ Level 4',
2027 0xF5 =>
'Advanced Simple Profile @ Level 5',
2028 0xF7 =>
'Advanced Simple Profile @ Level 3b',
2029 0xF8 =>
'Fine Granularity Scalable Profile @ Level 0',
2030 0xF9 =>
'Fine Granularity Scalable Profile @ Level 1',
2031 0xFA =>
'Fine Granularity Scalable Profile @ Level 2',
2032 0xFB =>
'Fine Granularity Scalable Profile @ Level 3',
2033 0xFC =>
'Fine Granularity Scalable Profile @ Level 4',
2034 0xFD =>
'Fine Granularity Scalable Profile @ Level 5',
2035 0xFE =>
'Not part of MPEG-4 Visual profiles',
2036 0xFF =>
'No visual capability required',
2039 return (isset($QuicktimeIODSvideoProfileNameLookup[$video_profile_id]) ? $QuicktimeIODSvideoProfileNameLookup[$video_profile_id] :
'ISO Reserved Profile');
2044 static $QuicktimeContentRatingLookup = array();
2045 if (empty($QuicktimeContentRatingLookup)) {
2046 $QuicktimeContentRatingLookup[0] =
'None';
2047 $QuicktimeContentRatingLookup[2] =
'Clean';
2048 $QuicktimeContentRatingLookup[4] =
'Explicit';
2050 return (isset($QuicktimeContentRatingLookup[$rtng]) ? $QuicktimeContentRatingLookup[$rtng] :
'invalid');
2054 static $QuicktimeStoreAccountTypeLookup = array();
2055 if (empty($QuicktimeStoreAccountTypeLookup)) {
2056 $QuicktimeStoreAccountTypeLookup[0] =
'iTunes';
2057 $QuicktimeStoreAccountTypeLookup[1] =
'AOL';
2059 return (isset($QuicktimeStoreAccountTypeLookup[$akid]) ? $QuicktimeStoreAccountTypeLookup[$akid] :
'invalid');
2063 static $QuicktimeStoreFrontCodeLookup = array();
2064 if (empty($QuicktimeStoreFrontCodeLookup)) {
2065 $QuicktimeStoreFrontCodeLookup[143460] =
'Australia';
2066 $QuicktimeStoreFrontCodeLookup[143445] =
'Austria';
2067 $QuicktimeStoreFrontCodeLookup[143446] =
'Belgium';
2068 $QuicktimeStoreFrontCodeLookup[143455] =
'Canada';
2069 $QuicktimeStoreFrontCodeLookup[143458] =
'Denmark';
2070 $QuicktimeStoreFrontCodeLookup[143447] =
'Finland';
2071 $QuicktimeStoreFrontCodeLookup[143442] =
'France';
2072 $QuicktimeStoreFrontCodeLookup[143443] =
'Germany';
2073 $QuicktimeStoreFrontCodeLookup[143448] =
'Greece';
2074 $QuicktimeStoreFrontCodeLookup[143449] =
'Ireland';
2075 $QuicktimeStoreFrontCodeLookup[143450] =
'Italy';
2076 $QuicktimeStoreFrontCodeLookup[143462] =
'Japan';
2077 $QuicktimeStoreFrontCodeLookup[143451] =
'Luxembourg';
2078 $QuicktimeStoreFrontCodeLookup[143452] =
'Netherlands';
2079 $QuicktimeStoreFrontCodeLookup[143461] =
'New Zealand';
2080 $QuicktimeStoreFrontCodeLookup[143457] =
'Norway';
2081 $QuicktimeStoreFrontCodeLookup[143453] =
'Portugal';
2082 $QuicktimeStoreFrontCodeLookup[143454] =
'Spain';
2083 $QuicktimeStoreFrontCodeLookup[143456] =
'Sweden';
2084 $QuicktimeStoreFrontCodeLookup[143459] =
'Switzerland';
2085 $QuicktimeStoreFrontCodeLookup[143444] =
'United Kingdom';
2086 $QuicktimeStoreFrontCodeLookup[143441] =
'United States';
2088 return (isset($QuicktimeStoreFrontCodeLookup[$sfid]) ? $QuicktimeStoreFrontCodeLookup[$sfid] :
'invalid');
2108 $NCTGtagName = array(
2109 0x00000001 =>
'Make',
2110 0x00000002 =>
'Model',
2111 0x00000003 =>
'Software',
2112 0x00000011 =>
'CreateDate',
2113 0x00000012 =>
'DateTimeOriginal',
2114 0x00000013 =>
'FrameCount',
2115 0x00000016 =>
'FrameRate',
2116 0x00000022 =>
'FrameWidth',
2117 0x00000023 =>
'FrameHeight',
2118 0x00000032 =>
'AudioChannels',
2119 0x00000033 =>
'AudioBitsPerSample',
2120 0x00000034 =>
'AudioSampleRate',
2121 0x02000001 =>
'MakerNoteVersion',
2122 0x02000005 =>
'WhiteBalance',
2123 0x0200000b =>
'WhiteBalanceFineTune',
2124 0x0200001e =>
'ColorSpace',
2125 0x02000023 =>
'PictureControlData',
2126 0x02000024 =>
'WorldTime',
2127 0x02000032 =>
'UnknownInfo',
2128 0x02000083 =>
'LensType',
2129 0x02000084 =>
'Lens',
2133 $datalength = strlen($atom_data);
2135 while ($offset < $datalength) {
2140 switch ($data_size_type) {
2143 $offset += ($data_size * 1);
2146 $data = substr($atom_data, $offset, $data_size * 1);
2147 $offset += ($data_size * 1);
2152 for (
$i = $data_size - 1;
$i >= 0;
$i--) {
2153 $data .= substr($atom_data, $offset + (
$i * 2), 2);
2156 $offset += ($data_size * 2);
2160 for (
$i = $data_size - 1;
$i >= 0;
$i--) {
2161 $data .= substr($atom_data, $offset + (
$i * 4), 4);
2164 $offset += ($data_size * 4);
2168 for (
$i = 0;
$i < $data_size;
$i++) {
2171 if ($denomninator == 0) {
2174 $data[
$i] = (double) $numerator / $denomninator;
2177 $offset += (8 * $data_size);
2178 if (count(
$data) == 1) {
2183 $data = substr($atom_data, $offset, $data_size * 1);
2184 $offset += ($data_size * 1);
2187 $data = substr($atom_data, $offset, $data_size * 2);
2188 $offset += ($data_size * 2);
2191 echo 'QuicktimeParseNikonNCTG()::unknown $data_size_type: '.$data_size_type.
'<br>';
2195 switch ($record_type) {
2206 $data =
'Adobe RGB';
2211 $PictureControlAdjust = array(0=>
'default', 1=>
'quick', 2=>
'full');
2212 $FilterEffect = array(0x80=>
'off', 0x81=>
'yellow', 0x82=>
'orange', 0x83=>
'red', 0x84=>
'green', 0xff=>
'n/a');
2213 $ToningEffect = array(0x80=>
'b&w', 0x81=>
'sepia', 0x82=>
'cyanotype', 0x83=>
'red', 0x84=>
'yellow', 0x85=>
'green', 0x86=>
'blue-green', 0x87=>
'blue', 0x88=>
'purple-blue', 0x89=>
'red-purple', 0xff=>
'n/a');
2215 'PictureControlVersion' => substr(
$data, 0, 4),
2216 'PictureControlName' => rtrim(substr(
$data, 4, 20),
"\x00"),
2217 'PictureControlBase' => rtrim(substr(
$data, 24, 20),
"\x00"),
2219 'PictureControlAdjust' => $PictureControlAdjust[ord(substr(
$data, 48, 1))],
2220 'PictureControlQuickAdjust' => ord(substr(
$data, 49, 1)),
2221 'Sharpness' => ord(substr(
$data, 50, 1)),
2222 'Contrast' => ord(substr(
$data, 51, 1)),
2223 'Brightness' => ord(substr(
$data, 52, 1)),
2224 'Saturation' => ord(substr(
$data, 53, 1)),
2225 'HueAdjustment' => ord(substr(
$data, 54, 1)),
2226 'FilterEffect' => $FilterEffect[ord(substr(
$data, 55, 1))],
2227 'ToningEffect' => $ToningEffect[ord(substr(
$data, 56, 1))],
2228 'ToningSaturation' => ord(substr(
$data, 57, 1)),
2235 if ($timezone & 0x8000) {
2236 $timezone = 0 - (0x10000 - $timezone);
2243 $datedisplayformat =
'D/M/Y';
break;
2245 $datedisplayformat =
'M/D/Y';
break;
2248 $datedisplayformat =
'Y/M/D';
break;
2251 $data = array(
'timezone'=>floatval($timezone),
'dst'=>
$dst,
'display'=>$datedisplayformat);
2256 'mf' => (
bool) (
$data & 0x01),
2257 'd' => (
bool) (
$data & 0x02),
2258 'g' => (
bool) (
$data & 0x04),
2259 'vr' => (
bool) (
$data & 0x08),
2263 $tag_name = (isset($NCTGtagName[$record_type]) ? $NCTGtagName[$record_type] :
'0x'.str_pad(dechex($record_type), 8,
'0', STR_PAD_LEFT));
2264 $parsed[$tag_name] =
$data;
2271 static $handyatomtranslatorarray = array();
2272 if (empty($handyatomtranslatorarray)) {
2277 $handyatomtranslatorarray[
"\xA9".
'alb'] =
'album';
2278 $handyatomtranslatorarray[
"\xA9".
'ART'] =
'artist';
2279 $handyatomtranslatorarray[
"\xA9".
'art'] =
'artist';
2280 $handyatomtranslatorarray[
"\xA9".
'aut'] =
'author';
2281 $handyatomtranslatorarray[
"\xA9".
'cmt'] =
'comment';
2282 $handyatomtranslatorarray[
"\xA9".
'com'] =
'comment';
2283 $handyatomtranslatorarray[
"\xA9".
'cpy'] =
'copyright';
2284 $handyatomtranslatorarray[
"\xA9".
'day'] =
'creation_date';
2285 $handyatomtranslatorarray[
"\xA9".
'dir'] =
'director';
2286 $handyatomtranslatorarray[
"\xA9".
'ed1'] =
'edit1';
2287 $handyatomtranslatorarray[
"\xA9".
'ed2'] =
'edit2';
2288 $handyatomtranslatorarray[
"\xA9".
'ed3'] =
'edit3';
2289 $handyatomtranslatorarray[
"\xA9".
'ed4'] =
'edit4';
2290 $handyatomtranslatorarray[
"\xA9".
'ed5'] =
'edit5';
2291 $handyatomtranslatorarray[
"\xA9".
'ed6'] =
'edit6';
2292 $handyatomtranslatorarray[
"\xA9".
'ed7'] =
'edit7';
2293 $handyatomtranslatorarray[
"\xA9".
'ed8'] =
'edit8';
2294 $handyatomtranslatorarray[
"\xA9".
'ed9'] =
'edit9';
2295 $handyatomtranslatorarray[
"\xA9".
'enc'] =
'encoded_by';
2296 $handyatomtranslatorarray[
"\xA9".
'fmt'] =
'format';
2297 $handyatomtranslatorarray[
"\xA9".
'gen'] =
'genre';
2298 $handyatomtranslatorarray[
"\xA9".
'grp'] =
'grouping';
2299 $handyatomtranslatorarray[
"\xA9".
'hst'] =
'host_computer';
2300 $handyatomtranslatorarray[
"\xA9".
'inf'] =
'information';
2301 $handyatomtranslatorarray[
"\xA9".
'lyr'] =
'lyrics';
2302 $handyatomtranslatorarray[
"\xA9".
'mak'] =
'make';
2303 $handyatomtranslatorarray[
"\xA9".
'mod'] =
'model';
2304 $handyatomtranslatorarray[
"\xA9".
'nam'] =
'title';
2305 $handyatomtranslatorarray[
"\xA9".
'ope'] =
'composer';
2306 $handyatomtranslatorarray[
"\xA9".
'prd'] =
'producer';
2307 $handyatomtranslatorarray[
"\xA9".
'PRD'] =
'product';
2308 $handyatomtranslatorarray[
"\xA9".
'prf'] =
'performers';
2309 $handyatomtranslatorarray[
"\xA9".
'req'] =
'system_requirements';
2310 $handyatomtranslatorarray[
"\xA9".
'src'] =
'source_credit';
2311 $handyatomtranslatorarray[
"\xA9".
'swr'] =
'software';
2312 $handyatomtranslatorarray[
"\xA9".
'too'] =
'encoding_tool';
2313 $handyatomtranslatorarray[
"\xA9".
'trk'] =
'track';
2314 $handyatomtranslatorarray[
"\xA9".
'url'] =
'url';
2315 $handyatomtranslatorarray[
"\xA9".
'wrn'] =
'warning';
2316 $handyatomtranslatorarray[
"\xA9".
'wrt'] =
'composer';
2317 $handyatomtranslatorarray[
'aART'] =
'album_artist';
2318 $handyatomtranslatorarray[
'apID'] =
'purchase_account';
2319 $handyatomtranslatorarray[
'catg'] =
'category';
2320 $handyatomtranslatorarray[
'covr'] =
'picture';
2321 $handyatomtranslatorarray[
'cpil'] =
'compilation';
2322 $handyatomtranslatorarray[
'cprt'] =
'copyright';
2323 $handyatomtranslatorarray[
'desc'] =
'description';
2324 $handyatomtranslatorarray[
'disk'] =
'disc_number';
2325 $handyatomtranslatorarray[
'egid'] =
'episode_guid';
2326 $handyatomtranslatorarray[
'gnre'] =
'genre';
2327 $handyatomtranslatorarray[
'hdvd'] =
'hd_video';
2328 $handyatomtranslatorarray[
'ldes'] =
'description_long';
2329 $handyatomtranslatorarray[
'keyw'] =
'keyword';
2330 $handyatomtranslatorarray[
'pcst'] =
'podcast';
2331 $handyatomtranslatorarray[
'pgap'] =
'gapless_playback';
2332 $handyatomtranslatorarray[
'purd'] =
'purchase_date';
2333 $handyatomtranslatorarray[
'purl'] =
'podcast_url';
2334 $handyatomtranslatorarray[
'rtng'] =
'rating';
2335 $handyatomtranslatorarray[
'soaa'] =
'sort_album_artist';
2336 $handyatomtranslatorarray[
'soal'] =
'sort_album';
2337 $handyatomtranslatorarray[
'soar'] =
'sort_artist';
2338 $handyatomtranslatorarray[
'soco'] =
'sort_composer';
2339 $handyatomtranslatorarray[
'sonm'] =
'sort_title';
2340 $handyatomtranslatorarray[
'sosn'] =
'sort_show';
2341 $handyatomtranslatorarray[
'stik'] =
'stik';
2342 $handyatomtranslatorarray[
'tmpo'] =
'bpm';
2343 $handyatomtranslatorarray[
'trkn'] =
'track_number';
2344 $handyatomtranslatorarray[
'tven'] =
'tv_episode_id';
2345 $handyatomtranslatorarray[
'tves'] =
'tv_episode';
2346 $handyatomtranslatorarray[
'tvnn'] =
'tv_network_name';
2347 $handyatomtranslatorarray[
'tvsh'] =
'tv_show_name';
2348 $handyatomtranslatorarray[
'tvsn'] =
'tv_season';
2370 $info = &$this->getid3->info;
2372 if ($boxname && ($boxname != $keyname)) {
2373 $comment_key = (isset($handyatomtranslatorarray[$boxname]) ? $handyatomtranslatorarray[$boxname] : $boxname);
2374 } elseif (isset($handyatomtranslatorarray[$keyname])) {
2375 $comment_key = $handyatomtranslatorarray[$keyname];
2378 if ($comment_key ==
'picture') {
2379 if (!is_array(
$data)) {
2381 if (preg_match(
'#^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A#',
$data)) {
2382 $image_mime =
'image/png';
2383 } elseif (preg_match(
'#^\xFF\xD8\xFF#',
$data)) {
2384 $image_mime =
'image/jpeg';
2385 } elseif (preg_match(
'#^GIF#',
$data)) {
2386 $image_mime =
'image/gif';
2387 } elseif (preg_match(
'#^BM#',
$data)) {
2388 $image_mime =
'image/bmp';
2390 $data = array(
'data'=>
$data,
'image_mime'=>$image_mime);
2393 $gooddata = array(
$data);
2394 if ($comment_key ==
'genre') {
2396 $gooddata = explode(
';',
$data);
2398 foreach ($gooddata as
$data) {
2399 $info[
'quicktime'][
'comments'][$comment_key][] =
$data;
2407 if (substr($nullterminatedstring, strlen($nullterminatedstring) - 1, 1) ===
"\x00") {
2408 return substr($nullterminatedstring, 0, strlen($nullterminatedstring) - 1);
2410 return $nullterminatedstring;
2415 return substr($pascalstring, 1);
2425 $key_history = $history.
'/'.
$key;
2429 if (is_array($value)) {
2438 $key_history = $history.
'/'.
$key;
2439 if ((
$key === $k) && ($value === $v)) {
2442 if (is_array($value)) {
2452 foreach (
$res as $value) {
2453 $stbl_res = array();
2455 if (count($stbl_res) > 0) {
2456 $stts_res = array();
2457 $this->
search_tag_by_key($value[1],
'time_to_sample_table', $value[0], $stts_res);
2458 if (count($stts_res) > 0) {
2459 return $stts_res[0][1][
'time_to_sample_table'];
2471 foreach (
$res as $value) {
2472 $stbl_res = array();
2474 if (count($stbl_res) > 0) {
2477 foreach ($ts_res as $value) {
2478 $prefix = substr($value[0], 0, -12);
2479 if ((substr($stbl_res[0][0], 0, strlen($prefix)) === $prefix) && ($ts_prefix_len < strlen($prefix))) {
2480 $time_scale = $value[1][
'time_scale'];
2481 $ts_prefix_len = strlen($prefix);
search_tag_by_key($info, $tag, $history, &$result)
QuicktimeSTIKLookup($stik)
QuicktimeIODSaudioProfileName($audio_profile_id)
CopyToAppropriateCommentsSection($keyname, $data, $boxname='')
QuicktimeAudioCodecLookup($codecid)
search_tag_by_pair($info, $k, $v, $history, &$result)
QuicktimeStoreFrontCodeLookup($sfid)
static intValueSupported($num)
QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms)
QuicktimeIODSvideoProfileName($video_profile_id)
quicktime_read_mp4_descr_length($data, &$offset)
static LanguageLookup($languagecode, $casesensitive=false)
static LookupGenreName($genreid, $allowSCMPXextended=true)
QuicktimeColorNameLookup($colordepthid)
NoNullString($nullterminatedstring)
static IncludeDependency($filename, $sourcefile, $DieOnFailure=false)
Pascal2String($pascalstring)
QuicktimeContentRatingLookup($rtng)
foreach($_POST as $key=> $value) $res
QuicktimeLanguageLookup($languageid)
static DateMac2Unix($macdate)
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
static FixedPoint2_30($rawdata)
QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms)
quicktime_time_to_sample_table($info)
quicktime_bookmark_time_scale($info)
QuicktimeVideoCodecLookup($codecid)
QuicktimeStoreAccountTypeLookup($akid)
static FixedPoint8_8($rawdata)
fseek($bytes, $whence=SEEK_SET)
QuicktimeDCOMLookup($compressionid)
static BigEndian2Int($byteword, $synchsafe=false, $signed=false)
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
QuicktimeParseNikonNCTG($atom_data)
static FixedPoint16_16($rawdata)