本文整理匯總了PHP中getid3_lib::array_max方法的典型用法代碼示例。如果您正苦於以下問題:PHP getid3_lib::array_max方法的具體用法?PHP getid3_lib::array_max怎麽用?PHP getid3_lib::array_max使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類getid3_lib
的用法示例。
在下文中一共展示了getid3_lib::array_max方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getOnlyMPEGaudioInfoBruteForce
//.........這裏部分代碼省略.........
}
if ($head4[0] != "ÿ") {
for ($i = 1; $i < 4; $i++) {
if ($head4[$i] == "ÿ") {
$this->fseek($i - 4, SEEK_CUR);
continue 2;
}
}
continue;
}
if (!isset($MPEGaudioHeaderDecodeCache[$head4])) {
$MPEGaudioHeaderDecodeCache[$head4] = self::MPEGaudioHeaderDecode($head4);
}
if (!isset($MPEGaudioHeaderValidCache[$head4])) {
$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false);
}
if ($MPEGaudioHeaderValidCache[$head4]) {
if (!isset($MPEGaudioHeaderLengthCache[$head4])) {
$LongMPEGversionLookup[$head4] = $MPEGaudioVersionLookup[$MPEGaudioHeaderDecodeCache[$head4]['version']];
$LongMPEGlayerLookup[$head4] = $MPEGaudioLayerLookup[$MPEGaudioHeaderDecodeCache[$head4]['layer']];
$LongMPEGbitrateLookup[$head4] = $MPEGaudioBitrateLookup[$LongMPEGversionLookup[$head4]][$LongMPEGlayerLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['bitrate']];
$LongMPEGpaddingLookup[$head4] = (bool) $MPEGaudioHeaderDecodeCache[$head4]['padding'];
$LongMPEGfrequencyLookup[$head4] = $MPEGaudioFrequencyLookup[$LongMPEGversionLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['sample_rate']];
$MPEGaudioHeaderLengthCache[$head4] = self::MPEGaudioFrameLength($LongMPEGbitrateLookup[$head4], $LongMPEGversionLookup[$head4], $LongMPEGlayerLookup[$head4], $LongMPEGpaddingLookup[$head4], $LongMPEGfrequencyLookup[$head4]);
}
if ($MPEGaudioHeaderLengthCache[$head4] > 4) {
$WhereWeWere = $this->ftell();
$this->fseek($MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR);
$next4 = $this->fread(4);
if ($next4[0] == "ÿ") {
if (!isset($MPEGaudioHeaderDecodeCache[$next4])) {
$MPEGaudioHeaderDecodeCache[$next4] = self::MPEGaudioHeaderDecode($next4);
}
if (!isset($MPEGaudioHeaderValidCache[$next4])) {
$MPEGaudioHeaderValidCache[$next4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false);
}
if ($MPEGaudioHeaderValidCache[$next4]) {
$this->fseek(-4, SEEK_CUR);
getid3_lib::safe_inc($Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]);
getid3_lib::safe_inc($Distribution['layer'][$LongMPEGlayerLookup[$head4]]);
getid3_lib::safe_inc($Distribution['version'][$LongMPEGversionLookup[$head4]]);
getid3_lib::safe_inc($Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]);
getid3_lib::safe_inc($Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]);
if ($max_frames_scan && ++$frames_scanned >= $max_frames_scan) {
$pct_data_scanned = ($this->ftell() - $info['avdataoffset']) / ($info['avdataend'] - $info['avdataoffset']);
$info['warning'][] = 'too many MPEG audio frames to scan, only scanned first ' . $max_frames_scan . ' frames (' . number_format($pct_data_scanned * 100, 1) . '% of file) and extrapolated distribution, playtime and bitrate may be incorrect.';
foreach ($Distribution as $key1 => $value1) {
foreach ($value1 as $key2 => $value2) {
$Distribution[$key1][$key2] = round($value2 / $pct_data_scanned);
}
}
break;
}
continue;
}
}
unset($next4);
$this->fseek($WhereWeWere - 3);
}
}
}
foreach ($Distribution as $key => $value) {
ksort($Distribution[$key], SORT_NUMERIC);
}
ksort($Distribution['version'], SORT_STRING);
$info['mpeg']['audio']['bitrate_distribution'] = $Distribution['bitrate'];
$info['mpeg']['audio']['frequency_distribution'] = $Distribution['frequency'];
$info['mpeg']['audio']['layer_distribution'] = $Distribution['layer'];
$info['mpeg']['audio']['version_distribution'] = $Distribution['version'];
$info['mpeg']['audio']['padding_distribution'] = $Distribution['padding'];
if (count($Distribution['version']) > 1) {
$info['error'][] = 'Corrupt file - more than one MPEG version detected';
}
if (count($Distribution['layer']) > 1) {
$info['error'][] = 'Corrupt file - more than one MPEG layer detected';
}
if (count($Distribution['frequency']) > 1) {
$info['error'][] = 'Corrupt file - more than one MPEG sample rate detected';
}
$bittotal = 0;
foreach ($Distribution['bitrate'] as $bitratevalue => $bitratecount) {
if ($bitratevalue != 'free') {
$bittotal += $bitratevalue * $bitratecount;
}
}
$info['mpeg']['audio']['frame_count'] = array_sum($Distribution['bitrate']);
if ($info['mpeg']['audio']['frame_count'] == 0) {
$info['error'][] = 'no MPEG audio frames found';
return false;
}
$info['mpeg']['audio']['bitrate'] = $bittotal / $info['mpeg']['audio']['frame_count'];
$info['mpeg']['audio']['bitrate_mode'] = count($Distribution['bitrate']) > 0 ? 'vbr' : 'cbr';
$info['mpeg']['audio']['sample_rate'] = getid3_lib::array_max($Distribution['frequency'], true);
$info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate'];
$info['audio']['bitrate_mode'] = $info['mpeg']['audio']['bitrate_mode'];
$info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate'];
$info['audio']['dataformat'] = 'mp' . getid3_lib::array_max($Distribution['layer'], true);
$info['fileformat'] = $info['audio']['dataformat'];
return true;
}
示例2: getOnlyMPEGaudioInfoBruteForce
//.........這裏部分代碼省略.........
$Distribution['layer'] = array();
$Distribution['version'] = array();
$Distribution['padding'] = array();
fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET);
$previousvalidframe = $ThisFileInfo['avdataoffset'];
while (ftell($fd) < $ThisFileInfo['avdataend']) {
set_time_limit(30);
$head4 = fread($fd, 4);
if (strlen($head4) < 4) {
break;
}
if ($head4[0] != "ÿ") {
for ($i = 1; $i < 4; $i++) {
if ($head4[$i] == "ÿ") {
fseek($fd, $i - 4, SEEK_CUR);
continue 2;
}
}
continue;
}
if (!isset($MPEGaudioHeaderDecodeCache[$head4])) {
$MPEGaudioHeaderDecodeCache[$head4] = getid3_mp3::MPEGaudioHeaderDecode($head4);
}
if (!isset($MPEGaudioHeaderValidCache[$head4])) {
$MPEGaudioHeaderValidCache[$head4] = getid3_mp3::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false);
}
if ($MPEGaudioHeaderValidCache[$head4]) {
if (!isset($MPEGaudioHeaderLengthCache[$head4])) {
$LongMPEGversionLookup[$head4] = $MPEGaudioVersionLookup[$MPEGaudioHeaderDecodeCache[$head4]['version']];
$LongMPEGlayerLookup[$head4] = $MPEGaudioLayerLookup[$MPEGaudioHeaderDecodeCache[$head4]['layer']];
$LongMPEGbitrateLookup[$head4] = $MPEGaudioBitrateLookup[$LongMPEGversionLookup[$head4]][$LongMPEGlayerLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['bitrate']];
$LongMPEGpaddingLookup[$head4] = (bool) $MPEGaudioHeaderDecodeCache[$head4]['padding'];
$LongMPEGfrequencyLookup[$head4] = $MPEGaudioFrequencyLookup[$LongMPEGversionLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['sample_rate']];
$MPEGaudioHeaderLengthCache[$head4] = getid3_mp3::MPEGaudioFrameLength($LongMPEGbitrateLookup[$head4], $LongMPEGversionLookup[$head4], $LongMPEGlayerLookup[$head4], $LongMPEGpaddingLookup[$head4], $LongMPEGfrequencyLookup[$head4]);
}
if ($MPEGaudioHeaderLengthCache[$head4] > 4) {
$WhereWeWere = ftell($fd);
fseek($fd, $MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR);
$next4 = fread($fd, 4);
if ($next4[0] == "ÿ") {
if (!isset($MPEGaudioHeaderDecodeCache[$next4])) {
$MPEGaudioHeaderDecodeCache[$next4] = getid3_mp3::MPEGaudioHeaderDecode($next4);
}
if (!isset($MPEGaudioHeaderValidCache[$next4])) {
$MPEGaudioHeaderValidCache[$next4] = getid3_mp3::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false);
}
if ($MPEGaudioHeaderValidCache[$next4]) {
fseek($fd, -4, SEEK_CUR);
@$Distribution['bitrate'][$LongMPEGbitrateLookup[$head4]]++;
@$Distribution['layer'][$LongMPEGlayerLookup[$head4]]++;
@$Distribution['version'][$LongMPEGversionLookup[$head4]]++;
@$Distribution['padding'][intval($LongMPEGpaddingLookup[$head4])]++;
@$Distribution['frequency'][$LongMPEGfrequencyLookup[$head4]]++;
continue;
}
}
unset($next4);
fseek($fd, $WhereWeWere - 3, SEEK_SET);
}
}
}
foreach ($Distribution as $key => $value) {
ksort($Distribution[$key], SORT_NUMERIC);
}
ksort($Distribution['version'], SORT_STRING);
$ThisFileInfo['mpeg']['audio']['bitrate_distribution'] = $Distribution['bitrate'];
$ThisFileInfo['mpeg']['audio']['frequency_distribution'] = $Distribution['frequency'];
$ThisFileInfo['mpeg']['audio']['layer_distribution'] = $Distribution['layer'];
$ThisFileInfo['mpeg']['audio']['version_distribution'] = $Distribution['version'];
$ThisFileInfo['mpeg']['audio']['padding_distribution'] = $Distribution['padding'];
if (count($Distribution['version']) > 1) {
$ThisFileInfo['error'][] = 'Corrupt file - more than one MPEG version detected';
}
if (count($Distribution['layer']) > 1) {
$ThisFileInfo['error'][] = 'Corrupt file - more than one MPEG layer detected';
}
if (count($Distribution['frequency']) > 1) {
$ThisFileInfo['error'][] = 'Corrupt file - more than one MPEG sample rate detected';
}
$bittotal = 0;
foreach ($Distribution['bitrate'] as $bitratevalue => $bitratecount) {
if ($bitratevalue != 'free') {
$bittotal += $bitratevalue * $bitratecount;
}
}
$ThisFileInfo['mpeg']['audio']['frame_count'] = array_sum($Distribution['bitrate']);
if ($ThisFileInfo['mpeg']['audio']['frame_count'] == 0) {
$ThisFileInfo['error'][] = 'no MPEG audio frames found';
return false;
}
$ThisFileInfo['mpeg']['audio']['bitrate'] = $bittotal / $ThisFileInfo['mpeg']['audio']['frame_count'];
$ThisFileInfo['mpeg']['audio']['bitrate_mode'] = count($Distribution['bitrate']) > 0 ? 'vbr' : 'cbr';
$ThisFileInfo['mpeg']['audio']['sample_rate'] = getid3_lib::array_max($Distribution['frequency'], true);
$ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['mpeg']['audio']['bitrate'];
$ThisFileInfo['audio']['bitrate_mode'] = $ThisFileInfo['mpeg']['audio']['bitrate_mode'];
$ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['mpeg']['audio']['sample_rate'];
$ThisFileInfo['audio']['dataformat'] = 'mp' . getid3_lib::array_max($Distribution['layer'], true);
$ThisFileInfo['fileformat'] = $ThisFileInfo['audio']['dataformat'];
return true;
}