WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

getid3_quicktime::Analyze() public WP 1.0

Это метод класса: getid3_quicktime{}

Хуков нет.

Возвращает

true/false.

Использование

$getid3_quicktime = new getid3_quicktime();
$getid3_quicktime->Analyze();

Код getid3_quicktime::Analyze() WP 5.5.1

<?php
public function Analyze() {
	$info = &$this->getid3->info;

	$info['fileformat'] = 'quicktime';
	$info['quicktime']['hinting']    = false;
	$info['quicktime']['controller'] = 'standard'; // may be overridden if 'ctyp' atom is present

	$this->fseek($info['avdataoffset']);

	$offset      = 0;
	$atomcounter = 0;
	$atom_data_read_buffer_size = $info['php_memory_limit'] ? round($info['php_memory_limit'] / 4) : $this->getid3->option_fread_buffer_size * 1024; // set read buffer to 25% of PHP memory limit (if one is specified), otherwise use option_fread_buffer_size [default: 32MB]
	while ($offset < $info['avdataend']) {
		if (!getid3_lib::intValueSupported($offset)) {
			$this->error('Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions');
			break;
		}
		$this->fseek($offset);
		$AtomHeader = $this->fread(8);

		$atomsize = getid3_lib::BigEndian2Int(substr($AtomHeader, 0, 4));
		$atomname = substr($AtomHeader, 4, 4);

		// 64-bit MOV patch by jlegateØktnc*com
		if ($atomsize == 1) {
			$atomsize = getid3_lib::BigEndian2Int($this->fread(8));
		}

		if (($offset + $atomsize) > $info['avdataend']) {
			$info['quicktime'][$atomname]['name']   = $atomname;
			$info['quicktime'][$atomname]['size']   = $atomsize;
			$info['quicktime'][$atomname]['offset'] = $offset;
			$this->error('Atom at offset '.$offset.' claims to go beyond end-of-file (length: '.$atomsize.' bytes)');
			return false;
		}
		if ($atomsize == 0) {
			// Furthermore, for historical reasons the list of atoms is optionally
			// terminated by a 32-bit integer set to 0. If you are writing a program
			// to read user data atoms, you should allow for the terminating 0.
			$info['quicktime'][$atomname]['name']   = $atomname;
			$info['quicktime'][$atomname]['size']   = $atomsize;
			$info['quicktime'][$atomname]['offset'] = $offset;
			break;
		}

		$atomHierarchy = array();
		$parsedAtomData = $this->QuicktimeParseAtom($atomname, $atomsize, $this->fread(min($atomsize, $atom_data_read_buffer_size)), $offset, $atomHierarchy, $this->ParseAllPossibleAtoms);
		$parsedAtomData['name']   = $atomname;
		$parsedAtomData['size']   = $atomsize;
		$parsedAtomData['offset'] = $offset;
		if (in_array($atomname, array('uuid'))) {
			@$info['quicktime'][$atomname][] = $parsedAtomData;
		} else {
			$info['quicktime'][$atomname] = $parsedAtomData;
		}

		$offset += $atomsize;
		$atomcounter++;
	}

	if (!empty($info['avdataend_tmp'])) {
		// this value is assigned to a temp value and then erased because
		// otherwise any atoms beyond the 'mdat' atom would not get parsed
		$info['avdataend'] = $info['avdataend_tmp'];
		unset($info['avdataend_tmp']);
	}

	if (!empty($info['quicktime']['comments']['chapters']) && is_array($info['quicktime']['comments']['chapters']) && (count($info['quicktime']['comments']['chapters']) > 0)) {
		$durations = $this->quicktime_time_to_sample_table($info);
		for ($i = 0; $i < count($info['quicktime']['comments']['chapters']); $i++) {
			$bookmark = array();
			$bookmark['title'] = $info['quicktime']['comments']['chapters'][$i];
			if (isset($durations[$i])) {
				$bookmark['duration_sample'] = $durations[$i]['sample_duration'];
				if ($i > 0) {
					$bookmark['start_sample'] = $info['quicktime']['bookmarks'][($i - 1)]['start_sample'] + $info['quicktime']['bookmarks'][($i - 1)]['duration_sample'];
				} else {
					$bookmark['start_sample'] = 0;
				}
				if ($time_scale = $this->quicktime_bookmark_time_scale($info)) {
					$bookmark['duration_seconds'] = $bookmark['duration_sample'] / $time_scale;
					$bookmark['start_seconds']    = $bookmark['start_sample']    / $time_scale;
				}
			}
			$info['quicktime']['bookmarks'][] = $bookmark;
		}
	}

	if (isset($info['quicktime']['temp_meta_key_names'])) {
		unset($info['quicktime']['temp_meta_key_names']);
	}

	if (!empty($info['quicktime']['comments']['location.ISO6709'])) {
		// https://en.wikipedia.org/wiki/ISO_6709
		foreach ($info['quicktime']['comments']['location.ISO6709'] as $ISO6709string) {
			$ISO6709parsed = array('latitude'=>false, 'longitude'=>false, 'altitude'=>false);
			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)) {
				// phpcs:ignore PHPCompatibility.Lists.AssignmentOrder.Affected
				@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;

				if (strlen($lat_deg) == 2) {        // [+-]DD.D
					$ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim($lat_deg, '0').$lat_deg_dec);
				} elseif (strlen($lat_deg) == 4) {  // [+-]DDMM.M
					$ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lat_deg, 0, 2), '0')) + floatval(ltrim(substr($lat_deg, 2, 2), '0').$lat_deg_dec / 60);
				} elseif (strlen($lat_deg) == 6) {  // [+-]DDMMSS.S
					$ISO6709parsed['latitude'] = (($lat_sign == '-') ? -1 : 1) * 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);
				}

				if (strlen($lon_deg) == 3) {        // [+-]DDD.D
					$ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim($lon_deg, '0').$lon_deg_dec);
				} elseif (strlen($lon_deg) == 5) {  // [+-]DDDMM.M
					$ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * floatval(ltrim(substr($lon_deg, 0, 2), '0')) + floatval(ltrim(substr($lon_deg, 2, 2), '0').$lon_deg_dec / 60);
				} elseif (strlen($lon_deg) == 7) {  // [+-]DDDMMSS.S
					$ISO6709parsed['longitude'] = (($lon_sign == '-') ? -1 : 1) * 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);
				}

				if (strlen($alt_deg) == 3) {        // [+-]DDD.D
					$ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim($alt_deg, '0').$alt_deg_dec);
				} elseif (strlen($alt_deg) == 5) {  // [+-]DDDMM.M
					$ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * floatval(ltrim(substr($alt_deg, 0, 2), '0')) + floatval(ltrim(substr($alt_deg, 2, 2), '0').$alt_deg_dec / 60);
				} elseif (strlen($alt_deg) == 7) {  // [+-]DDDMMSS.S
					$ISO6709parsed['altitude'] = (($alt_sign == '-') ? -1 : 1) * 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);
				}

				foreach (array('latitude', 'longitude', 'altitude') as $key) {
					if ($ISO6709parsed[$key] !== false) {
						$value = (($lat_sign == '-') ? -1 : 1) * floatval($ISO6709parsed[$key]);
						if (!isset($info['quicktime']['comments']['gps_'.$key]) || !in_array($value, $info['quicktime']['comments']['gps_'.$key])) {
							@$info['quicktime']['comments']['gps_'.$key][] = (($lat_sign == '-') ? -1 : 1) * floatval($ISO6709parsed[$key]);
						}
					}
				}
			}
			if ($ISO6709parsed['latitude'] === false) {
				$this->warning('location.ISO6709 string not parsed correctly: "'.$ISO6709string.'", please submit as a bug');
			}
			break;
		}
	}

	if (!isset($info['bitrate']) && isset($info['playtime_seconds'])) {
		$info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
	}
	if (isset($info['bitrate']) && !isset($info['audio']['bitrate']) && !isset($info['quicktime']['video'])) {
		$info['audio']['bitrate'] = $info['bitrate'];
	}
	if (!empty($info['bitrate']) && !empty($info['audio']['bitrate']) && empty($info['video']['bitrate']) && !empty($info['video']['frame_rate']) && !empty($info['video']['resolution_x']) && ($info['bitrate'] > $info['audio']['bitrate'])) {
		$info['video']['bitrate'] = $info['bitrate'] - $info['audio']['bitrate'];
	}
	if (!empty($info['playtime_seconds']) && !isset($info['video']['frame_rate']) && !empty($info['quicktime']['stts_framecount'])) {
		foreach ($info['quicktime']['stts_framecount'] as $key => $samples_count) {
			$samples_per_second = $samples_count / $info['playtime_seconds'];
			if ($samples_per_second > 240) {
				// has to be audio samples
			} else {
				$info['video']['frame_rate'] = $samples_per_second;
				break;
			}
		}
	}
	if ($info['audio']['dataformat'] == 'mp4') {
		$info['fileformat'] = 'mp4';
		if (empty($info['video']['resolution_x'])) {
			$info['mime_type']  = 'audio/mp4';
			unset($info['video']['dataformat']);
		} else {
			$info['mime_type']  = 'video/mp4';
		}
	}

	if (!$this->ReturnAtomData) {
		unset($info['quicktime']['moov']);
	}

	if (empty($info['audio']['dataformat']) && !empty($info['quicktime']['audio'])) {
		$info['audio']['dataformat'] = 'quicktime';
	}
	if (empty($info['video']['dataformat']) && !empty($info['quicktime']['video'])) {
		$info['video']['dataformat'] = 'quicktime';
	}
	if (isset($info['video']) && ($info['mime_type'] == 'audio/mp4') && empty($info['video']['resolution_x']) && empty($info['video']['resolution_y']))  {
		unset($info['video']);
	}

	return true;
}