getid3_quicktime::QuicktimeLanguageLookup

Advertisement

Syntax Syntax

getid3_quicktime::QuicktimeLanguageLookup( int $languageid )

Parameters Parameters

$languageid

(int) (Required)

Return Return

(string)

Source Source

File: wp-includes/ID3/module.audio-video.quicktime.php

										'heading'   => (float) $GPS_this_GPRMC['heading'],
									);

								} else {
									$this->warning('Unhandled GPS format in "free" atom at offset '.$gps_pointer['offset']);
								}
							}
							$this->fseek($previous_offset);

						} else {
							$this->warning('QuickTime atom "'.$atomname.'" is not mod-8 bytes long ('.$atomsize.' bytes) at offset '.$baseoffset);
						}
					} else {
						$this->warning('QuickTime atom "'.$atomname.'" is zero bytes long at offset '.$baseoffset);
					}
					break;

				case 'loci':// 3GP location (El Loco)
					$loffset = 0;
					$info['quicktime']['comments']['gps_flags']     = array(  getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)));
					$info['quicktime']['comments']['gps_lang']      = array(  getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)));
					$info['quicktime']['comments']['gps_location']  = array(          $this->LociString(substr($atom_data, 6), $loffset));
					$loci_data = substr($atom_data, 6 + $loffset);
					$info['quicktime']['comments']['gps_role']      = array(  getid3_lib::BigEndian2Int(substr($loci_data, 0, 1)));
					$info['quicktime']['comments']['gps_longitude'] = array(getid3_lib::FixedPoint16_16(substr($loci_data, 1, 4)));
					$info['quicktime']['comments']['gps_latitude']  = array(getid3_lib::FixedPoint16_16(substr($loci_data, 5, 4)));
					$info['quicktime']['comments']['gps_altitude']  = array(getid3_lib::FixedPoint16_16(substr($loci_data, 9, 4)));
					$info['quicktime']['comments']['gps_body']      = array(          $this->LociString(substr($loci_data, 13           ), $loffset));
					$info['quicktime']['comments']['gps_notes']     = array(          $this->LociString(substr($loci_data, 13 + $loffset), $loffset));
					break;

				case 'chpl': // CHaPter List
					// https://www.adobe.com/content/dam/Adobe/en/devnet/flv/pdfs/video_file_format_spec_v10.pdf
					$chpl_version = getid3_lib::BigEndian2Int(substr($atom_data, 4, 1)); // Expected to be 0
					$chpl_flags   = getid3_lib::BigEndian2Int(substr($atom_data, 5, 3)); // Reserved, set to 0
					$chpl_count   = getid3_lib::BigEndian2Int(substr($atom_data, 8, 1));
					$chpl_offset = 9;
					for ($i = 0; $i < $chpl_count; $i++) {
						if (($chpl_offset + 9) >= strlen($atom_data)) {
							$this->warning('QuickTime chapter '.$i.' extends beyond end of "chpl" atom');
							break;
						}
						$info['quicktime']['chapters'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($atom_data, $chpl_offset, 8)) / 10000000; // timestamps are stored as 100-nanosecond units
						$chpl_offset += 8;
						$chpl_title_size = getid3_lib::BigEndian2Int(substr($atom_data, $chpl_offset, 1));
						$chpl_offset += 1;
						$info['quicktime']['chapters'][$i]['title']     =                           substr($atom_data, $chpl_offset, $chpl_title_size);
						$chpl_offset += $chpl_title_size;
					}
					break;

				case 'FIRM': // FIRMware version(?), seen on GoPro Hero4
					$info['quicktime']['camera']['firmware'] = $atom_data;
					break;

				case 'CAME': // FIRMware version(?), seen on GoPro Hero4
					$info['quicktime']['camera']['serial_hash'] = unpack('H*', $atom_data);
					break;

				case 'dscp':
				case 'rcif':
					// https://www.getid3.org/phpBB3/viewtopic.php?t=1908
					if (substr($atom_data, 0, 7) == "\x00\x00\x00\x00\x55\xC4".'{') {
						if ($json_decoded = @json_decode(rtrim(substr($atom_data, 6), "\x00"), true)) {
							$info['quicktime']['camera'][$atomname] = $json_decoded;
							if (($atomname == 'rcif') && isset($info['quicktime']['camera']['rcif']['wxcamera']['rotate'])) {
								$info['video']['rotate'] = $info['quicktime']['video']['rotate'] = $info['quicktime']['camera']['rcif']['wxcamera']['rotate'];
							}
						} else {
							$this->warning('Failed to JSON decode atom "'.$atomname.'"');
							$atom_structure['data'] = $atom_data;
						}
						unset($json_decoded);
					} else {
						$this->warning('Expecting 55 C4 7B at start of atom "'.$atomname.'", found '.getid3_lib::PrintHexBytes(substr($atom_data, 4, 3)).' instead');
						$atom_structure['data'] = $atom_data;
					}
					break;

				case 'frea':
					// https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Kodak.html#frea
					// may contain "scra" (PreviewImage) and/or "thma" (ThumbnailImage)
					$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 4, $atomHierarchy, $ParseAllPossibleAtoms);
					break;
				case 'tima': // subatom to "frea"
					// no idea what this does, the one sample file I've seen has a value of 0x00000027
					$atom_structure['data'] = $atom_data;
					break;
				case 'ver ': // subatom to "frea"
					// some kind of version number, the one sample file I've seen has a value of "3.00.073"
					$atom_structure['data'] = $atom_data;
					break;
				case 'thma': // subatom to "frea" -- "ThumbnailImage"
					// https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Kodak.html#frea
					if (strlen($atom_data) > 0) {
						$info['quicktime']['comments']['picture'][] = array('data'=>$atom_data, 'image_mime'=>'image/jpeg', 'description'=>'ThumbnailImage');
					}
					break;
				case 'scra': // subatom to "frea" -- "PreviewImage"
					// https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/Kodak.html#frea
					// but the only sample file I've seen has no useful data here
					if (strlen($atom_data) > 0) {
						$info['quicktime']['comments']['picture'][] = array('data'=>$atom_data, 'image_mime'=>'image/jpeg', 'description'=>'PreviewImage');
					}
					break;

				case 'cdsc': // timed metadata reference
					// A QuickTime movie can contain none, one, or several timed metadata tracks. Timed metadata tracks can refer to multiple tracks.
					// Metadata tracks are linked to the tracks they describe using a track-reference of type 'cdsc'. The metadata track holds the 'cdsc' track reference.
					$atom_structure['track_number'] = getid3_lib::BigEndian2Int($atom_data);
					break;

				default:
					$this->warning('Unknown QuickTime atom type: "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" ('.trim(getid3_lib::PrintHexBytes($atomname)).'), '.$atomsize.' bytes at offset '.$baseoffset);
					$atom_structure['data'] = $atom_data;
					break;
			}
		}
		array_pop($atomHierarchy);
		return $atom_structure;
	}

	/**
	 * @param string $atom_data
	 * @param int    $baseoffset
	 * @param array  $atomHierarchy
	 * @param bool   $ParseAllPossibleAtoms
	 *
	 * @return array|false
	 */
	public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) {
		$atom_structure  = false;
		$subatomoffset  = 0;
		$subatomcounter = 0;
		if ((strlen($atom_data) == 4) && (getid3_lib::BigEndian2Int($atom_data) == 0x00000000)) {
			return false;

Advertisement

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.