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

📄 module.audio-video.riff.php

📁 CMS系统 提供学习研究修改最好了 比流行的一些CMS简单 但是更容易理解 是帮助你学习PHPCMS系统的好东东哦
💻 PHP
📖 第 1 页 / 共 5 页
字号:
					$thisfile_riff_WAVE_cart_0['version']              =                  substr($thisfile_riff_WAVE_cart_0['data'],    0,    4);					$thisfile_riff_WAVE_cart_0['title']                =             trim(substr($thisfile_riff_WAVE_cart_0['data'],    4,   64));					$thisfile_riff_WAVE_cart_0['artist']               =             trim(substr($thisfile_riff_WAVE_cart_0['data'],   68,   64));					$thisfile_riff_WAVE_cart_0['cut_id']               =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  132,   64));					$thisfile_riff_WAVE_cart_0['client_id']            =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  196,   64));					$thisfile_riff_WAVE_cart_0['category']             =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  260,   64));					$thisfile_riff_WAVE_cart_0['classification']       =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  324,   64));					$thisfile_riff_WAVE_cart_0['out_cue']              =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  388,   64));					$thisfile_riff_WAVE_cart_0['start_date']           =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  452,   10));					$thisfile_riff_WAVE_cart_0['start_time']           =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  462,    8));					$thisfile_riff_WAVE_cart_0['end_date']             =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  470,   10));					$thisfile_riff_WAVE_cart_0['end_time']             =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  480,    8));					$thisfile_riff_WAVE_cart_0['producer_app_id']      =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  488,   64));					$thisfile_riff_WAVE_cart_0['producer_app_version'] =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  552,   64));					$thisfile_riff_WAVE_cart_0['user_defined_text']    =             trim(substr($thisfile_riff_WAVE_cart_0['data'],  616,   64));					$thisfile_riff_WAVE_cart_0['zero_db_reference']    = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'],  680,    4), true);					for ($i = 0; $i < 8; $i++) {						$thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] =                  substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4);						$thisfile_riff_WAVE_cart_0['post_time'][$i]['timer_value']  = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8) + 4, 4));					}					$thisfile_riff_WAVE_cart_0['url']              =                 trim(substr($thisfile_riff_WAVE_cart_0['data'],  748, 1024));					$thisfile_riff_WAVE_cart_0['tag_text']         = explode("\r\n", trim(substr($thisfile_riff_WAVE_cart_0['data'], 1772)));					$thisfile_riff['comments']['artist'][] = $thisfile_riff_WAVE_cart_0['artist'];					$thisfile_riff['comments']['title'][]  = $thisfile_riff_WAVE_cart_0['title'];				}				if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) {					$thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate'];					$ThisFileInfo['playtime_seconds'] = (float) ((($thisfile_avdataend - $thisfile_avdataoffset) * 8) / $thisfile_audio['bitrate']);				}				if (!empty($ThisFileInfo['wavpack'])) {					$thisfile_audio_dataformat   = 'wavpack';					$thisfile_audio['bitrate_mode'] = 'vbr';					$thisfile_audio['encoder']      = 'WavPack v'.$ThisFileInfo['wavpack']['version'];					// Reset to the way it was - RIFF parsing will have messed this up					$thisfile_avdataend        = $Original['avdataend'];					$thisfile_audio['bitrate'] = (($thisfile_avdataend - $thisfile_avdataoffset) * 8) / $ThisFileInfo['playtime_seconds'];					fseek($fd, $thisfile_avdataoffset - 44, SEEK_SET);					$RIFFdata = fread($fd, 44);					$OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata,  4, 4)) +  8;					$OrignalRIFFdataSize   = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44;					if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) {						$thisfile_avdataend -= ($OrignalRIFFheaderSize - $OrignalRIFFdataSize);						fseek($fd, $thisfile_avdataend, SEEK_SET);						$RIFFdata .= fread($fd, $OrignalRIFFheaderSize - $OrignalRIFFdataSize);					}					// move the data chunk after all other chunks (if any)					// so that the RIFF parser doesn't see EOF when trying					// to skip over the data chunk					$RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8);					getid3_riff::ParseRIFFdata($RIFFdata, $ThisFileInfo);				}				if (isset($thisfile_riff_raw['fmt ']['wFormatTag'])) {					switch ($thisfile_riff_raw['fmt ']['wFormatTag']) {						case 0x08AE: // ClearJump LiteWave							$thisfile_audio['bitrate_mode'] = 'vbr';							$thisfile_audio_dataformat   = 'litewave';							//typedef struct tagSLwFormat {							//  WORD    m_wCompFormat;     // low byte defines compression method, high byte is compression flags							//  DWORD   m_dwScale;         // scale factor for lossy compression							//  DWORD   m_dwBlockSize;     // number of samples in encoded blocks							//  WORD    m_wQuality;        // alias for the scale factor							//  WORD    m_wMarkDistance;   // distance between marks in bytes							//  WORD    m_wReserved;							//							//  //following paramters are ignored if CF_FILESRC is not set							//  DWORD   m_dwOrgSize;       // original file size in bytes							//  WORD    m_bFactExists;     // indicates if 'fact' chunk exists in the original file							//  DWORD   m_dwRiffChunkSize; // riff chunk size in the original file							//							//  PCMWAVEFORMAT m_OrgWf;     // original wave format							// }SLwFormat, *PSLwFormat;							// shortcut							$thisfile_riff['litewave']['raw'] = array();							$thisfile_riff_litewave     = &$thisfile_riff['litewave'];							$thisfile_riff_litewave_raw = &$thisfile_riff_litewave['raw'];							$thisfile_riff_litewave_raw['compression_method'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 18, 1));							$thisfile_riff_litewave_raw['compression_flags']  = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 19, 1));							$thisfile_riff_litewave_raw['m_dwScale']          = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 20, 4));							$thisfile_riff_litewave_raw['m_dwBlockSize']      = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 24, 4));							$thisfile_riff_litewave_raw['m_wQuality']         = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 28, 2));							$thisfile_riff_litewave_raw['m_wMarkDistance']    = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 30, 2));							$thisfile_riff_litewave_raw['m_wReserved']        = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 32, 2));							$thisfile_riff_litewave_raw['m_dwOrgSize']        = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 34, 4));							$thisfile_riff_litewave_raw['m_bFactExists']      = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 38, 2));							$thisfile_riff_litewave_raw['m_dwRiffChunkSize']  = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 40, 4));							//$thisfile_riff_litewave['quality_factor'] = intval(round((2000 - $thisfile_riff_litewave_raw['m_dwScale']) / 20));							$thisfile_riff_litewave['quality_factor'] = $thisfile_riff_litewave_raw['m_wQuality'];							$thisfile_riff_litewave['flags']['raw_source']    = ($thisfile_riff_litewave_raw['compression_flags'] & 0x01) ? false : true;							$thisfile_riff_litewave['flags']['vbr_blocksize'] = ($thisfile_riff_litewave_raw['compression_flags'] & 0x02) ? false : true;							$thisfile_riff_litewave['flags']['seekpoints']    =        (bool) ($thisfile_riff_litewave_raw['compression_flags'] & 0x04);							$thisfile_audio['lossless']        = (($thisfile_riff_litewave_raw['m_wQuality'] == 100) ? true : false);							$thisfile_audio['encoder_options'] = '-q'.$thisfile_riff_litewave['quality_factor'];							break;						default:							break;					}				}				if ($thisfile_avdataend > $ThisFileInfo['filesize']) {					switch (@$thisfile_audio_dataformat) {						case 'wavpack': // WavPack						case 'lpac':    // LPAC						case 'ofr':     // OptimFROG						case 'ofs':     // OptimFROG DualStream							// lossless compressed audio formats that keep original RIFF headers - skip warning							break;						case 'litewave':							if (($thisfile_avdataend - $ThisFileInfo['filesize']) == 1) {								// LiteWave appears to incorrectly *not* pad actual output file								// to nearest WORD boundary so may appear to be short by one								// byte, in which case - skip warning							} else {								// Short by more than one byte, throw warning								$ThisFileInfo['warning'][] = 'Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($ThisFileInfo['filesize'] - $thisfile_avdataoffset)).' bytes)';								$thisfile_avdataend = $ThisFileInfo['filesize'];							}							break;						default:							if ((($thisfile_avdataend - $ThisFileInfo['filesize']) == 1) && (($thisfile_riff[$RIFFsubtype]['data'][0]['size'] % 2) == 0) && ((($ThisFileInfo['filesize'] - $thisfile_avdataoffset) % 2) == 1)) {								// output file appears to be incorrectly *not* padded to nearest WORD boundary								// Output less severe warning								$ThisFileInfo['warning'][] = 'File should probably be padded to nearest WORD boundary, but it is not (expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' therefore short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($ThisFileInfo['filesize'] - $thisfile_avdataoffset)).' bytes)';								$thisfile_avdataend = $ThisFileInfo['filesize'];								break;							}							// Short by more than one byte, throw warning							$ThisFileInfo['warning'][] = 'Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['data'][0]['size'].' bytes of data, only found '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' (short by '.($thisfile_riff[$RIFFsubtype]['data'][0]['size'] - ($ThisFileInfo['filesize'] - $thisfile_avdataoffset)).' bytes)';							$thisfile_avdataend = $ThisFileInfo['filesize'];							break;					}				}				if (!empty($ThisFileInfo['mpeg']['audio']['LAME']['audio_bytes'])) {					if ((($thisfile_avdataend - $thisfile_avdataoffset) - $ThisFileInfo['mpeg']['audio']['LAME']['audio_bytes']) == 1) {						$thisfile_avdataend--;						$ThisFileInfo['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored';					}				}				if (@$thisfile_audio_dataformat == 'ac3') {					unset($thisfile_audio['bits_per_sample']);					if (!empty($ThisFileInfo['ac3']['bitrate']) && ($ThisFileInfo['ac3']['bitrate'] != $thisfile_audio['bitrate'])) {						$thisfile_audio['bitrate'] = $ThisFileInfo['ac3']['bitrate'];					}				}				break;			case 'AVI ':				$thisfile_video['bitrate_mode'] = 'vbr'; // maybe not, but probably				$thisfile_video['dataformat']   = 'avi';				$ThisFileInfo['mime_type']      = 'video/avi';				if (isset($thisfile_riff[$RIFFsubtype]['movi']['offset'])) {					$thisfile_avdataoffset = $thisfile_riff[$RIFFsubtype]['movi']['offset'] + 8;					$thisfile_avdataend    = $thisfile_avdataoffset + $thisfile_riff[$RIFFsubtype]['movi']['size'];					if ($thisfile_avdataend > $ThisFileInfo['filesize']) {						$ThisFileInfo['warning'][] = 'Probably truncated file - expecting '.$thisfile_riff[$RIFFsubtype]['movi']['size'].' bytes of data, only found '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' (short by '.($thisfile_riff[$RIFFsubtype]['movi']['size'] - ($ThisFileInfo['filesize'] - $thisfile_avdataoffset)).' bytes)';						$thisfile_avdataend = $ThisFileInfo['filesize'];					}				}				if (isset($thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data'])) {					$avihData = $thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data'];					// shortcut					$thisfile_riff_raw['avih'] = array();					$thisfile_riff_raw_avih = &$thisfile_riff_raw['avih'];					$thisfile_riff_raw_avih['dwMicroSecPerFrame']    = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData,  0, 4)); // frame display rate (or 0L)					if ($thisfile_riff_raw_avih['dwMicroSecPerFrame'] == 0) {						$ThisFileInfo['error'][] = 'Corrupt RIFF file: avih.dwMicroSecPerFrame == zero';						return false;					}					$thisfile_riff_raw_avih['dwMaxBytesPerSec']      = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData,  4, 4)); // max. transfer rate					$thisfile_riff_raw_avih['dwPaddingGranularity']  = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData,  8, 4)); // pad to multiples of this size; normally 2K.					$thisfile_riff_raw_avih['dwFlags']               = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 12, 4)); // the ever-present flags					$thisfile_riff_raw_avih['dwTotalFrames']         = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 16, 4)); // # frames in file					$thisfile_riff_raw_avih['dwInitialFrames']       = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 20, 4));					$thisfile_riff_raw_avih['dwStreams']             = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 24, 4));					$thisfile_riff_raw_avih['dwSuggestedBufferSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 28, 4));					$thisfile_riff_raw_avih['dwWidth']               = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 32, 4));					$thisfile_riff_raw_avih['dwHeight']              = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 36, 4));					$thisfile_riff_raw_avih['dwScale']               = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 40, 4));					$thisfile_riff_raw_avih['dwRate']                = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 44, 4));					$thisfile_riff_raw_avih['dwStart']               = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 48, 4));					$thisfile_riff_raw_avih['dwLength']              = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 52, 4));					$thisfile_riff_raw_avih['flags']['hasindex']     = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000010);					$thisfile_riff_raw_avih['flags']['mustuseindex'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000020);					$thisfile_riff_raw_avih['flags']['interleaved']  = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000100);					$thisfile_riff_raw_avih['flags']['trustcktype']  = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000800);					$thisfile_riff_raw_avih['flags']['capturedfile'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00010000);					$thisfile_riff_raw_avih['flags']['copyrighted']  = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00020010);					// shortcut					$thisfile_riff_video[$streamindex] = array();					$thisfile_riff_video_current = &$thisfile_riff_video[$streamindex];					if ($thisfile_riff_raw_avih['dwWidth'] > 0) {						$thisfile_riff_video_current['frame_width'] = $thisfile_riff_raw_avih['dwWidth'];						$thisfile_video['resolution_x']             = $thisfile_riff_video_current['frame_width'];					}					if ($thisfile_riff_raw_avih['dwHeight'] > 0) {						$thisfile_riff_video_current['frame_height'] = $thisfile_riff_raw_avih['dwHeight'];						$thisfile_video['resolution_y']              = $thisfile_riff_video_current['frame_height'];					}					if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) {						$thisfile_riff_video_current['total_frames'] = $thisfile_riff_raw_avih['dwTotalFrames'];						$thisfile_video['total_frames']              = $thisfile_riff_video_current['total_frames'];					}					$thisfile_riff_video_current['frame_rate'] = round(1000000 / $thisfile_riff_raw_avih['dwMicroSecPerFrame'], 3);					$thisfile_video['frame_rate'] = $thisfile_riff_video_current['frame_rate'];				}				if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][0]['data'])) {					if (is_array($thisfile_riff['AVI ']['hdrl']['strl']['strh'])) {						for ($i = 0; $i < count($thisfile_riff['AVI ']['hdrl']['strl']['strh']); $i++) {							if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) {								$strhData = $thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'];								$strhfccType = substr($strhData,  0, 4);								if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) {									$strfData = $thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'];

⌨️ 快捷键说明

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