⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module.audio.mp3.php

📁 CMS系统 提供学习研究修改最好了 比流行的一些CMS简单 但是更容易理解 是帮助你学习PHPCMS系统的好东东哦
💻 PHP
📖 第 1 页 / 共 5 页
字号:
			} elseif (isset($KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']])) {				$encoder_options = $KnownEncoderValues['**'][$thisfile_mpeg_audio_lame['vbr_quality']][$thisfile_mpeg_audio_lame['raw']['vbr_method']][$thisfile_mpeg_audio_lame['raw']['noise_shaping']][$thisfile_mpeg_audio_lame['raw']['stereo_mode']][$thisfile_mpeg_audio_lame['ath_type']][$thisfile_mpeg_audio_lame['lowpass_frequency']];			} elseif ($ThisFileInfo['audio']['bitrate_mode'] == 'vbr') {				// http://gabriel.mp3-tech.org/mp3infotag.html				// int    Quality = (100 - 10 * gfp->VBR_q - gfp->quality)h				$LAME_V_value = 10 - ceil($thisfile_mpeg_audio_lame['vbr_quality'] / 10);				$LAME_q_value = 100 - $thisfile_mpeg_audio_lame['vbr_quality'] - ($LAME_V_value * 10);				$encoder_options = '-V'.$LAME_V_value.' -q'.$LAME_q_value;			} elseif ($ThisFileInfo['audio']['bitrate_mode'] == 'cbr') {				$encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']).ceil($ThisFileInfo['audio']['bitrate'] / 1000);			} else {				$encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']);			}		} elseif (!empty($thisfile_mpeg_audio_lame['bitrate_abr'])) {			$encoder_options = 'ABR'.$thisfile_mpeg_audio_lame['bitrate_abr'];		} elseif (!empty($ThisFileInfo['audio']['bitrate'])) {			if ($ThisFileInfo['audio']['bitrate_mode'] == 'cbr') {				$encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']).ceil($ThisFileInfo['audio']['bitrate'] / 1000);			} else {				$encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']);			}		}		if (!empty($thisfile_mpeg_audio_lame['bitrate_min'])) {			$encoder_options .= ' -b'.$thisfile_mpeg_audio_lame['bitrate_min'];		}		if (@$thisfile_mpeg_audio_lame['encoding_flags']['nogap_prev'] || @$thisfile_mpeg_audio_lame['encoding_flags']['nogap_next']) {			$encoder_options .= ' --nogap';		}		if (!empty($thisfile_mpeg_audio_lame['lowpass_frequency'])) {			$ExplodedOptions = explode(' ', $encoder_options, 4);			if ($ExplodedOptions[0] == '--r3mix') {				$ExplodedOptions[1] = 'r3mix';			}			switch ($ExplodedOptions[0]) {				case '--preset':				case '--alt-preset':				case '--r3mix':					if ($ExplodedOptions[1] == 'fast') {						$ExplodedOptions[1] .= ' '.$ExplodedOptions[2];					}					switch ($ExplodedOptions[1]) {						case 'portable':						case 'medium':						case 'standard':						case 'extreme':						case 'insane':						case 'fast portable':						case 'fast medium':						case 'fast standard':						case 'fast extreme':						case 'fast insane':						case 'r3mix':							static $ExpectedLowpass = array(									'insane|20500'        => 20500,									'insane|20600'        => 20600,  // 3.90.2, 3.90.3, 3.91									'medium|18000'        => 18000,									'fast medium|18000'   => 18000,									'extreme|19500'       => 19500,  // 3.90,   3.90.1, 3.92, 3.95									'extreme|19600'       => 19600,  // 3.90.2, 3.90.3, 3.91, 3.93.1									'fast extreme|19500'  => 19500,  // 3.90,   3.90.1, 3.92, 3.95									'fast extreme|19600'  => 19600,  // 3.90.2, 3.90.3, 3.91, 3.93.1									'standard|19000'      => 19000,									'fast standard|19000' => 19000,									'r3mix|19500'         => 19500,  // 3.90,   3.90.1, 3.92									'r3mix|19600'         => 19600,  // 3.90.2, 3.90.3, 3.91									'r3mix|18000'         => 18000); // 3.94,   3.95							if (!isset($ExpectedLowpass[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio_lame['lowpass_frequency']])) {								$encoder_options .= ' --lowpass '.$thisfile_mpeg_audio_lame['lowpass_frequency'];							}							break;						default:							break;					}					break;			}		}		if (isset($thisfile_mpeg_audio_lame['raw']['source_sample_freq'])) {			if (($thisfile_mpeg_audio['sample_rate'] == 44100) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 1)) {				$encoder_options .= ' --resample 44100';			} elseif (($thisfile_mpeg_audio['sample_rate'] == 48000) && ($thisfile_mpeg_audio_lame['raw']['source_sample_freq'] != 2)) {				$encoder_options .= ' --resample 48000';			} elseif ($thisfile_mpeg_audio['sample_rate'] < 44100) {				switch ($thisfile_mpeg_audio_lame['raw']['source_sample_freq']) {					case 0: // <= 32000						// may or may not be same as source frequency - ignore						break;					case 1: // 44100					case 2: // 48000					case 3: // 48000+						$ExplodedOptions = explode(' ', $encoder_options, 4);						switch ($ExplodedOptions[0]) {							case '--preset':							case '--alt-preset':								switch ($ExplodedOptions[1]) {									case 'fast':									case 'portable':									case 'medium':									case 'standard':									case 'extreme':									case 'insane':										$encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];										break;									default:										static $ExpectedResampledRate = array(												'phon+/lw/mw-eu/sw|16000' => 16000,												'mw-us|24000'             => 24000, // 3.95												'mw-us|32000'             => 32000, // 3.93												'mw-us|16000'             => 16000, // 3.92												'phone|16000'             => 16000,												'phone|11025'             => 11025, // 3.94a15												'radio|32000'             => 32000, // 3.94a15												'fm/radio|32000'          => 32000, // 3.92												'fm|32000'                => 32000, // 3.90												'voice|32000'             => 32000);										if (!isset($ExpectedResampledRate[$ExplodedOptions[1].'|'.$thisfile_mpeg_audio['sample_rate']])) {											$encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];										}										break;								}								break;							case '--r3mix':							default:								$encoder_options .= ' --resample '.$thisfile_mpeg_audio['sample_rate'];								break;						}						break;				}			}		}		if (empty($encoder_options) && !empty($ThisFileInfo['audio']['bitrate']) && !empty($ThisFileInfo['audio']['bitrate_mode'])) {			//$encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']).ceil($ThisFileInfo['audio']['bitrate'] / 1000);			$encoder_options = strtoupper($ThisFileInfo['audio']['bitrate_mode']);		}		return $encoder_options;	}	function decodeMPEGaudioHeader($fd, $offset, &$ThisFileInfo, $recursivesearch=true, $ScanAsCBR=false, $FastMPEGheaderScan=false) {		static $MPEGaudioVersionLookup;		static $MPEGaudioLayerLookup;		static $MPEGaudioBitrateLookup;		static $MPEGaudioFrequencyLookup;		static $MPEGaudioChannelModeLookup;		static $MPEGaudioModeExtensionLookup;		static $MPEGaudioEmphasisLookup;		if (empty($MPEGaudioVersionLookup)) {			$MPEGaudioVersionLookup       = getid3_mp3::MPEGaudioVersionArray();			$MPEGaudioLayerLookup         = getid3_mp3::MPEGaudioLayerArray();			$MPEGaudioBitrateLookup       = getid3_mp3::MPEGaudioBitrateArray();			$MPEGaudioFrequencyLookup     = getid3_mp3::MPEGaudioFrequencyArray();			$MPEGaudioChannelModeLookup   = getid3_mp3::MPEGaudioChannelModeArray();			$MPEGaudioModeExtensionLookup = getid3_mp3::MPEGaudioModeExtensionArray();			$MPEGaudioEmphasisLookup      = getid3_mp3::MPEGaudioEmphasisArray();		}		if ($offset >= $ThisFileInfo['avdataend']) {			$ThisFileInfo['error'][] = 'end of file encounter looking for MPEG synch';			return false;		}		fseek($fd, $offset, SEEK_SET);		//$headerstring = fread($fd, 1441); // worst-case max length = 32kHz @ 320kbps layer 3 = 1441 bytes/frame		$headerstring = fread($fd, 226); // LAME header at offset 36 + 190 bytes of Xing/LAME data		// MP3 audio frame structure:		// $aa $aa $aa $aa [$bb $bb] $cc...		// where $aa..$aa is the four-byte mpeg-audio header (below)		// $bb $bb is the optional 2-byte CRC		// and $cc... is the audio data		$head4 = substr($headerstring, 0, 4);		static $MPEGaudioHeaderDecodeCache = array();		if (isset($MPEGaudioHeaderDecodeCache[$head4])) {			$MPEGheaderRawArray = $MPEGaudioHeaderDecodeCache[$head4];		} else {			$MPEGheaderRawArray = getid3_mp3::MPEGaudioHeaderDecode($head4);			$MPEGaudioHeaderDecodeCache[$head4] = $MPEGheaderRawArray;		}		static $MPEGaudioHeaderValidCache = array();		// Not in cache		if (!isset($MPEGaudioHeaderValidCache[$head4])) {			//$MPEGaudioHeaderValidCache[$head4] = getid3_mp3::MPEGaudioHeaderValid($MPEGheaderRawArray, false, true);  // allow badly-formatted freeformat (from LAME 3.90 - 3.93.1)			$MPEGaudioHeaderValidCache[$head4] = getid3_mp3::MPEGaudioHeaderValid($MPEGheaderRawArray, false, false);		}		// shortcut		if (!isset($ThisFileInfo['mpeg']['audio'])) {			$ThisFileInfo['mpeg']['audio'] = array();		}		$thisfile_mpeg_audio = &$ThisFileInfo['mpeg']['audio'];		if ($MPEGaudioHeaderValidCache[$head4]) {			$thisfile_mpeg_audio['raw'] = $MPEGheaderRawArray;		} else {			$ThisFileInfo['error'][] = 'Invalid MPEG audio header at offset '.$offset;			return false;		}		if (!$FastMPEGheaderScan) {			$thisfile_mpeg_audio['version']       = $MPEGaudioVersionLookup[$thisfile_mpeg_audio['raw']['version']];			$thisfile_mpeg_audio['layer']         = $MPEGaudioLayerLookup[$thisfile_mpeg_audio['raw']['layer']];			$thisfile_mpeg_audio['channelmode']   = $MPEGaudioChannelModeLookup[$thisfile_mpeg_audio['raw']['channelmode']];			$thisfile_mpeg_audio['channels']      = (($thisfile_mpeg_audio['channelmode'] == 'mono') ? 1 : 2);			$thisfile_mpeg_audio['sample_rate']   = $MPEGaudioFrequencyLookup[$thisfile_mpeg_audio['version']][$thisfile_mpeg_audio['raw']['sample_rate']];			$thisfile_mpeg_audio['protection']    = !$thisfile_mpeg_audio['raw']['protection'];			$thisfile_mpeg_audio['private']       = (bool) $thisfile_mpeg_audio['raw']['private'];			$thisfile_mpeg_audio['modeextension'] = $MPEGaudioModeExtensionLookup[$thisfile_mpeg_audio['layer']][$thisfile_mpeg_audio['raw']['modeextension']];			$thisfile_mpeg_audio['copyright']     = (bool) $thisfile_mpeg_audio['raw']['copyright'];			$thisfile_mpeg_audio['original']      = (bool) $thisfile_mpeg_audio['raw']['original'];			$thisfile_mpeg_audio['emphasis']      = $MPEGaudioEmphasisLookup[$thisfile_mpeg_audio['raw']['emphasis']];			$ThisFileInfo['audio']['channels']    = $thisfile_mpeg_audio['channels'];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -