| [ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 ///////////////////////////////////////////////////////////////// 3 /// getID3() by James Heinrich <info@getid3.org> // 4 // available at http://getid3.sourceforge.net // 5 // or http://www.getid3.org // 6 ///////////////////////////////////////////////////////////////// 7 // See readme.txt for more details // 8 ///////////////////////////////////////////////////////////////// 9 // // 10 // module.audio-video.riff.php // 11 // module for analyzing RIFF files // 12 // multiple formats supported by this module: // 13 // Wave, AVI, AIFF/AIFC, (MP3,AC3)/RIFF, Wavpack v3, 8SVX // 14 // dependencies: module.audio.mp3.php // 15 // module.audio.ac3.php (optional) // 16 // /// 17 ///////////////////////////////////////////////////////////////// 18 19 getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.mp3.php', __FILE__, true); 20 21 class getid3_riff 22 { 23 24 function getid3_riff(&$fd, &$ThisFileInfo) { 25 26 // initialize these values to an empty array, otherwise they default to NULL 27 // and you can't append array values to a NULL value 28 $ThisFileInfo['riff'] = array('raw'=>array()); 29 30 // Shortcuts 31 $thisfile_riff = &$ThisFileInfo['riff']; 32 $thisfile_riff_raw = &$thisfile_riff['raw']; 33 $thisfile_audio = &$ThisFileInfo['audio']; 34 $thisfile_video = &$ThisFileInfo['video']; 35 $thisfile_avdataoffset = &$ThisFileInfo['avdataoffset']; 36 $thisfile_avdataend = &$ThisFileInfo['avdataend']; 37 $thisfile_audio_dataformat = &$thisfile_audio['dataformat']; 38 $thisfile_riff_audio = &$thisfile_riff['audio']; 39 $thisfile_riff_video = &$thisfile_riff['video']; 40 41 42 $Original['avdataoffset'] = $thisfile_avdataoffset; 43 $Original['avdataend'] = $thisfile_avdataend; 44 45 fseek($fd, $thisfile_avdataoffset, SEEK_SET); 46 $RIFFheader = fread($fd, 12); 47 $RIFFsubtype = substr($RIFFheader, 8, 4); 48 switch (substr($RIFFheader, 0, 4)) { 49 case 'FORM': 50 $ThisFileInfo['fileformat'] = 'aiff'; 51 $RIFFheaderSize = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($RIFFheader, 4, 4)); 52 $thisfile_riff[$RIFFsubtype] = getid3_riff::ParseRIFF($fd, $thisfile_avdataoffset + 12, $thisfile_avdataoffset + $RIFFheaderSize, $ThisFileInfo); 53 $thisfile_riff['header_size'] = $RIFFheaderSize; 54 break; 55 56 case 'RIFF': 57 case 'SDSS': // SDSS is identical to RIFF, just renamed. Used by SmartSound QuickTracks (www.smartsound.com) 58 case 'RMP3': // RMP3 is identical to RIFF, just renamed. Used by [unknown program] when creating RIFF-MP3s 59 if ($RIFFsubtype == 'RMP3') { 60 // RMP3 is identical to WAVE, just renamed. Used by [unknown program] when creating RIFF-MP3s 61 $RIFFsubtype = 'WAVE'; 62 } 63 64 $ThisFileInfo['fileformat'] = 'riff'; 65 $RIFFheaderSize = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($RIFFheader, 4, 4)); 66 $thisfile_riff[$RIFFsubtype] = getid3_riff::ParseRIFF($fd, $thisfile_avdataoffset + 12, $thisfile_avdataoffset + $RIFFheaderSize, $ThisFileInfo); 67 $thisfile_riff['header_size'] = $RIFFheaderSize; 68 if ($RIFFsubtype == 'WAVE') { 69 $thisfile_riff_WAVE = &$thisfile_riff['WAVE']; 70 } 71 break; 72 73 default: 74 $ThisFileInfo['error'][] = 'Cannot parse RIFF (this is maybe not a RIFF / WAV / AVI file?) - expecting "FORM|RIFF|SDSS|RMP3" found "'.$RIFFsubtype.'" instead'; 75 unset($ThisFileInfo['fileformat']); 76 return false; 77 break; 78 } 79 80 $streamindex = 0; 81 switch ($RIFFsubtype) { 82 case 'WAVE': 83 if (empty($thisfile_audio['bitrate_mode'])) { 84 $thisfile_audio['bitrate_mode'] = 'cbr'; 85 } 86 if (empty($thisfile_audio_dataformat)) { 87 $thisfile_audio_dataformat = 'wav'; 88 } 89 90 if (isset($thisfile_riff_WAVE['data'][0]['offset'])) { 91 $thisfile_avdataoffset = $thisfile_riff_WAVE['data'][0]['offset'] + 8; 92 $thisfile_avdataend = $thisfile_avdataoffset + $thisfile_riff_WAVE['data'][0]['size']; 93 } 94 if (isset($thisfile_riff_WAVE['fmt '][0]['data'])) { 95 96 $thisfile_riff_audio[$streamindex] = getid3_riff::RIFFparseWAVEFORMATex($thisfile_riff_WAVE['fmt '][0]['data']); 97 $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag']; 98 if (@$thisfile_riff_audio[$streamindex]['bitrate'] == 0) { 99 $ThisFileInfo['error'][] = 'Corrupt RIFF file: bitrate_audio == zero'; 100 return false; 101 } 102 $thisfile_riff_raw['fmt '] = $thisfile_riff_audio[$streamindex]['raw']; 103 unset($thisfile_riff_audio[$streamindex]['raw']); 104 $thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex]; 105 106 $thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]); 107 if (substr($thisfile_audio['codec'], 0, strlen('unknown: 0x')) == 'unknown: 0x') { 108 $ThisFileInfo['warning'][] = 'Audio codec = '.$thisfile_audio['codec']; 109 } 110 $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; 111 112 $ThisFileInfo['playtime_seconds'] = (float) ((($thisfile_avdataend - $thisfile_avdataoffset) * 8) / $thisfile_audio['bitrate']); 113 114 $thisfile_audio['lossless'] = false; 115 if (isset($thisfile_riff_WAVE['data'][0]['offset']) && isset($thisfile_riff_raw['fmt ']['wFormatTag'])) { 116 switch ($thisfile_riff_raw['fmt ']['wFormatTag']) { 117 118 case 0x0001: // PCM 119 $thisfile_audio['lossless'] = true; 120 break; 121 122 case 0x2000: // AC-3 123 $thisfile_audio_dataformat = 'ac3'; 124 break; 125 126 default: 127 // do nothing 128 break; 129 130 } 131 } 132 $thisfile_audio['streams'][$streamindex]['wformattag'] = $thisfile_audio['wformattag']; 133 $thisfile_audio['streams'][$streamindex]['bitrate_mode'] = $thisfile_audio['bitrate_mode']; 134 $thisfile_audio['streams'][$streamindex]['lossless'] = $thisfile_audio['lossless']; 135 $thisfile_audio['streams'][$streamindex]['dataformat'] = $thisfile_audio_dataformat; 136 } 137 138 if (isset($thisfile_riff_WAVE['rgad'][0]['data'])) { 139 140 // shortcuts 141 $rgadData = &$thisfile_riff_WAVE['rgad'][0]['data']; 142 $thisfile_riff_raw['rgad'] = array('track'=>array(), 'album'=>array()); 143 $thisfile_riff_raw_rgad = &$thisfile_riff_raw['rgad']; 144 $thisfile_riff_raw_rgad_track = &$thisfile_riff_raw_rgad['track']; 145 $thisfile_riff_raw_rgad_album = &$thisfile_riff_raw_rgad['album']; 146 147 $thisfile_riff_raw_rgad['fPeakAmplitude'] = getid3_lib::LittleEndian2Float(substr($rgadData, 0, 4)); 148 $thisfile_riff_raw_rgad['nRadioRgAdjust'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($rgadData, 4, 2)); 149 $thisfile_riff_raw_rgad['nAudiophileRgAdjust'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($rgadData, 6, 2)); 150 151 $nRadioRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nRadioRgAdjust']), 16, '0', STR_PAD_LEFT); 152 $nAudiophileRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nAudiophileRgAdjust']), 16, '0', STR_PAD_LEFT); 153 $thisfile_riff_raw_rgad_track['name'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 0, 3)); 154 $thisfile_riff_raw_rgad_track['originator'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 3, 3)); 155 $thisfile_riff_raw_rgad_track['signbit'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 6, 1)); 156 $thisfile_riff_raw_rgad_track['adjustment'] = getid3_lib::Bin2Dec(substr($nRadioRgAdjustBitstring, 7, 9)); 157 $thisfile_riff_raw_rgad_album['name'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 0, 3)); 158 $thisfile_riff_raw_rgad_album['originator'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 3, 3)); 159 $thisfile_riff_raw_rgad_album['signbit'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 6, 1)); 160 $thisfile_riff_raw_rgad_album['adjustment'] = getid3_lib::Bin2Dec(substr($nAudiophileRgAdjustBitstring, 7, 9)); 161 162 $thisfile_riff['rgad']['peakamplitude'] = $thisfile_riff_raw_rgad['fPeakAmplitude']; 163 if (($thisfile_riff_raw_rgad_track['name'] != 0) && ($thisfile_riff_raw_rgad_track['originator'] != 0)) { 164 $thisfile_riff['rgad']['track']['name'] = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_track['name']); 165 $thisfile_riff['rgad']['track']['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_track['originator']); 166 $thisfile_riff['rgad']['track']['adjustment'] = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_track['adjustment'], $thisfile_riff_raw_rgad_track['signbit']); 167 } 168 if (($thisfile_riff_raw_rgad_album['name'] != 0) && ($thisfile_riff_raw_rgad_album['originator'] != 0)) { 169 $thisfile_riff['rgad']['album']['name'] = getid3_lib::RGADnameLookup($thisfile_riff_raw_rgad_album['name']); 170 $thisfile_riff['rgad']['album']['originator'] = getid3_lib::RGADoriginatorLookup($thisfile_riff_raw_rgad_album['originator']); 171 $thisfile_riff['rgad']['album']['adjustment'] = getid3_lib::RGADadjustmentLookup($thisfile_riff_raw_rgad_album['adjustment'], $thisfile_riff_raw_rgad_album['signbit']); 172 } 173 } 174 175 if (isset($thisfile_riff_WAVE['fact'][0]['data'])) { 176 $thisfile_riff_raw['fact']['NumberOfSamples'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_WAVE['fact'][0]['data'], 0, 4)); 177 178 // This should be a good way of calculating exact playtime, 179 // but some sample files have had incorrect number of samples, 180 // so cannot use this method 181 182 // if (!empty($thisfile_riff_raw['fmt ']['nSamplesPerSec'])) { 183 // $ThisFileInfo['playtime_seconds'] = (float) $thisfile_riff_raw['fact']['NumberOfSamples'] / $thisfile_riff_raw['fmt ']['nSamplesPerSec']; 184 // } 185 } 186 if (!empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) { 187 $thisfile_audio['bitrate'] = getid3_lib::CastAsInt($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'] * 8); 188 } 189 190 if (isset($thisfile_riff_WAVE['bext'][0]['data'])) { 191 // shortcut 192 $thisfile_riff_WAVE_bext_0 = &$thisfile_riff_WAVE['bext'][0]; 193 194 $thisfile_riff_WAVE_bext_0['title'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 0, 256)); 195 $thisfile_riff_WAVE_bext_0['author'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 256, 32)); 196 $thisfile_riff_WAVE_bext_0['reference'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 288, 32)); 197 $thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10); 198 $thisfile_riff_WAVE_bext_0['origin_time'] = substr($thisfile_riff_WAVE_bext_0['data'], 330, 8); 199 $thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338, 8)); 200 $thisfile_riff_WAVE_bext_0['bwf_version'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346, 1)); 201 $thisfile_riff_WAVE_bext_0['reserved'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 347, 254)); 202 $thisfile_riff_WAVE_bext_0['coding_history'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601))); 203 204 $thisfile_riff_WAVE_bext_0['origin_date_unix'] = gmmktime( 205 substr($thisfile_riff_WAVE_bext_0['origin_time'], 0, 2), 206 substr($thisfile_riff_WAVE_bext_0['origin_time'], 3, 2), 207 substr($thisfile_riff_WAVE_bext_0['origin_time'], 6, 2), 208 substr($thisfile_riff_WAVE_bext_0['origin_date'], 5, 2), 209 substr($thisfile_riff_WAVE_bext_0['origin_date'], 8, 2), 210 substr($thisfile_riff_WAVE_bext_0['origin_date'], 0, 4)); 211 212 $thisfile_riff['comments']['author'][] = $thisfile_riff_WAVE_bext_0['author']; 213 $thisfile_riff['comments']['title'][] = $thisfile_riff_WAVE_bext_0['title']; 214 } 215 216 if (isset($thisfile_riff_WAVE['MEXT'][0]['data'])) { 217 // shortcut 218 $thisfile_riff_WAVE_MEXT_0 = &$thisfile_riff_WAVE['MEXT'][0]; 219 220 $thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 0, 2)); 221 $thisfile_riff_WAVE_MEXT_0['flags']['homogenous'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0001); 222 if ($thisfile_riff_WAVE_MEXT_0['flags']['homogenous']) { 223 $thisfile_riff_WAVE_MEXT_0['flags']['padding'] = ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0002) ? false : true; 224 $thisfile_riff_WAVE_MEXT_0['flags']['22_or_44'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004); 225 $thisfile_riff_WAVE_MEXT_0['flags']['free_format'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008); 226 227 $thisfile_riff_WAVE_MEXT_0['nominal_frame_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 2, 2)); 228 } 229 $thisfile_riff_WAVE_MEXT_0['anciliary_data_length'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 6, 2)); 230 $thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 8, 2)); 231 $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_left'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0001); 232 $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_free'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0002); 233 $thisfile_riff_WAVE_MEXT_0['flags']['anciliary_data_right'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['anciliary_data_def'] & 0x0004); 234 } 235 236 if (isset($thisfile_riff_WAVE['cart'][0]['data'])) { 237 // shortcut 238 $thisfile_riff_WAVE_cart_0 = &$thisfile_riff_WAVE['cart'][0]; 239 240 $thisfile_riff_WAVE_cart_0['version'] = substr($thisfile_riff_WAVE_cart_0['data'], 0, 4); 241 $thisfile_riff_WAVE_cart_0['title'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 4, 64)); 242 $thisfile_riff_WAVE_cart_0['artist'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 68, 64)); 243 $thisfile_riff_WAVE_cart_0['cut_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64)); 244 $thisfile_riff_WAVE_cart_0['client_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64)); 245 $thisfile_riff_WAVE_cart_0['category'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64)); 246 $thisfile_riff_WAVE_cart_0['classification'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64)); 247 $thisfile_riff_WAVE_cart_0['out_cue'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64)); 248 $thisfile_riff_WAVE_cart_0['start_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10)); 249 $thisfile_riff_WAVE_cart_0['start_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 462, 8)); 250 $thisfile_riff_WAVE_cart_0['end_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10)); 251 $thisfile_riff_WAVE_cart_0['end_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 480, 8)); 252 $thisfile_riff_WAVE_cart_0['producer_app_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64)); 253 $thisfile_riff_WAVE_cart_0['producer_app_version'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64)); 254 $thisfile_riff_WAVE_cart_0['user_defined_text'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64)); 255 $thisfile_riff_WAVE_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680, 4), true); 256 for ($i = 0; $i < 8; $i++) { 257 $thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] = substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4); 258 $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)); 259 } 260 $thisfile_riff_WAVE_cart_0['url'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 748, 1024)); 261 $thisfile_riff_WAVE_cart_0['tag_text'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_cart_0['data'], 1772))); 262 263 $thisfile_riff['comments']['artist'][] = $thisfile_riff_WAVE_cart_0['artist']; 264 $thisfile_riff['comments']['title'][] = $thisfile_riff_WAVE_cart_0['title']; 265 } 266 267 if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) { 268 $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; 269 $ThisFileInfo['playtime_seconds'] = (float) ((($thisfile_avdataend - $thisfile_avdataoffset) * 8) / $thisfile_audio['bitrate']); 270 } 271 272 if (!empty($ThisFileInfo['wavpack'])) { 273 $thisfile_audio_dataformat = 'wavpack'; 274 $thisfile_audio['bitrate_mode'] = 'vbr'; 275 $thisfile_audio['encoder'] = 'WavPack v'.$ThisFileInfo['wavpack']['version']; 276 277 // Reset to the way it was - RIFF parsing will have messed this up 278 $thisfile_avdataend = $Original['avdataend']; 279 $thisfile_audio['bitrate'] = (($thisfile_avdataend - $thisfile_avdataoffset) * 8) / $ThisFileInfo['playtime_seconds']; 280 281 fseek($fd, $thisfile_avdataoffset - 44, SEEK_SET); 282 $RIFFdata = fread($fd, 44); 283 $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; 284 $OrignalRIFFdataSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44; 285 286 if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) { 287 $thisfile_avdataend -= ($OrignalRIFFheaderSize - $OrignalRIFFdataSize); 288 fseek($fd, $thisfile_avdataend, SEEK_SET); 289 $RIFFdata .= fread($fd, $OrignalRIFFheaderSize - $OrignalRIFFdataSize); 290 } 291 292 // move the data chunk after all other chunks (if any) 293 // so that the RIFF parser doesn't see EOF when trying 294 // to skip over the data chunk 295 $RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8); 296 getid3_riff::ParseRIFFdata($RIFFdata, $ThisFileInfo); 297 } 298 299 if (isset($thisfile_riff_raw['fmt ']['wFormatTag'])) { 300 switch ($thisfile_riff_raw['fmt ']['wFormatTag']) { 301 case 0x08AE: // ClearJump LiteWave 302 $thisfile_audio['bitrate_mode'] = 'vbr'; 303 $thisfile_audio_dataformat = 'litewave'; 304 305 //typedef struct tagSLwFormat { 306 // WORD m_wCompFormat; // low byte defines compression method, high byte is compression flags 307 // DWORD m_dwScale; // scale factor for lossy compression 308 // DWORD m_dwBlockSize; // number of samples in encoded blocks 309 // WORD m_wQuality; // alias for the scale factor 310 // WORD m_wMarkDistance; // distance between marks in bytes 311 // WORD m_wReserved; 312 // 313 // //following paramters are ignored if CF_FILESRC is not set 314 // DWORD m_dwOrgSize; // original file size in bytes 315 // WORD m_bFactExists; // indicates if 'fact' chunk exists in the original file 316 // DWORD m_dwRiffChunkSize; // riff chunk size in the original file 317 // 318 // PCMWAVEFORMAT m_OrgWf; // original wave format 319 // }SLwFormat, *PSLwFormat; 320 321 // shortcut 322 $thisfile_riff['litewave']['raw'] = array(); 323 $thisfile_riff_litewave = &$thisfile_riff['litewave']; 324 $thisfile_riff_litewave_raw = &$thisfile_riff_litewave['raw']; 325 326 $thisfile_riff_litewave_raw['compression_method'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 18, 1)); 327 $thisfile_riff_litewave_raw['compression_flags'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 19, 1)); 328 $thisfile_riff_litewave_raw['m_dwScale'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 20, 4)); 329 $thisfile_riff_litewave_raw['m_dwBlockSize'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 24, 4)); 330 $thisfile_riff_litewave_raw['m_wQuality'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 28, 2)); 331 $thisfile_riff_litewave_raw['m_wMarkDistance'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 30, 2)); 332 $thisfile_riff_litewave_raw['m_wReserved'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 32, 2)); 333 $thisfile_riff_litewave_raw['m_dwOrgSize'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 34, 4)); 334 $thisfile_riff_litewave_raw['m_bFactExists'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 38, 2)); 335 $thisfile_riff_litewave_raw['m_dwRiffChunkSize'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE['fmt '][0]['data'], 40, 4)); 336 337 //$thisfile_riff_litewave['quality_factor'] = intval(round((2000 - $thisfile_riff_litewave_raw['m_dwScale']) / 20)); 338 $thisfile_riff_litewave['quality_factor'] = $thisfile_riff_litewave_raw['m_wQuality']; 339 340 $thisfile_riff_litewave['flags']['raw_source'] = ($thisfile_riff_litewave_raw['compression_flags'] & 0x01) ? false : true; 341 $thisfile_riff_litewave['flags']['vbr_blocksize'] = ($thisfile_riff_litewave_raw['compression_flags'] & 0x02) ? false : true; 342 $thisfile_riff_litewave['flags']['seekpoints'] = (bool) ($thisfile_riff_litewave_raw['compression_flags'] & 0x04); 343 344 $thisfile_audio['lossless'] = (($thisfile_riff_litewave_raw['m_wQuality'] == 100) ? true : false); 345 $thisfile_audio['encoder_options'] = '-q'.$thisfile_riff_litewave['quality_factor']; 346 break; 347 348 default: 349 break; 350 } 351 } 352 if ($thisfile_avdataend > $ThisFileInfo['filesize']) { 353 switch (@$thisfile_audio_dataformat) { 354 case 'wavpack': // WavPack 355 case 'lpac': // LPAC 356 case 'ofr': // OptimFROG 357 case 'ofs': // OptimFROG DualStream 358 // lossless compressed audio formats that keep original RIFF headers - skip warning 359 break; 360 361 case 'litewave': 362 if (($thisfile_avdataend - $ThisFileInfo['filesize']) == 1) { 363 // LiteWave appears to incorrectly *not* pad actual output file 364 // to nearest WORD boundary so may appear to be short by one 365 // byte, in which case - skip warning 366 } else { 367 // Short by more than one byte, throw warning 368 $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)'; 369 $thisfile_avdataend = $ThisFileInfo['filesize']; 370 } 371 break; 372 373 default: 374 if ((($thisfile_avdataend - $ThisFileInfo['filesize']) == 1) && (($thisfile_riff[$RIFFsubtype]['data'][0]['size'] % 2) == 0) && ((($ThisFileInfo['filesize'] - $thisfile_avdataoffset) % 2) == 1)) { 375 // output file appears to be incorrectly *not* padded to nearest WORD boundary 376 // Output less severe warning 377 $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)'; 378 $thisfile_avdataend = $ThisFileInfo['filesize']; 379 break; 380 } 381 // Short by more than one byte, throw warning 382 $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)'; 383 $thisfile_avdataend = $ThisFileInfo['filesize']; 384 break; 385 } 386 } 387 if (!empty($ThisFileInfo['mpeg']['audio']['LAME']['audio_bytes'])) { 388 if ((($thisfile_avdataend - $thisfile_avdataoffset) - $ThisFileInfo['mpeg']['audio']['LAME']['audio_bytes']) == 1) { 389 $thisfile_avdataend--; 390 $ThisFileInfo['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored'; 391 } 392 } 393 if (@$thisfile_audio_dataformat == 'ac3') { 394 unset($thisfile_audio['bits_per_sample']); 395 if (!empty($ThisFileInfo['ac3']['bitrate']) && ($ThisFileInfo['ac3']['bitrate'] != $thisfile_audio['bitrate'])) { 396 $thisfile_audio['bitrate'] = $ThisFileInfo['ac3']['bitrate']; 397 } 398 } 399 break; 400 401 case 'AVI ': 402 $thisfile_video['bitrate_mode'] = 'vbr'; // maybe not, but probably 403 $thisfile_video['dataformat'] = 'avi'; 404 $ThisFileInfo['mime_type'] = 'video/avi'; 405 406 if (isset($thisfile_riff[$RIFFsubtype]['movi']['offset'])) { 407 $thisfile_avdataoffset = $thisfile_riff[$RIFFsubtype]['movi']['offset'] + 8; 408 $thisfile_avdataend = $thisfile_avdataoffset + $thisfile_riff[$RIFFsubtype]['movi']['size']; 409 if ($thisfile_avdataend > $ThisFileInfo['filesize']) { 410 $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)'; 411 $thisfile_avdataend = $ThisFileInfo['filesize']; 412 } 413 } 414 415 if (isset($thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data'])) { 416 $avihData = $thisfile_riff['AVI ']['hdrl']['avih'][$streamindex]['data']; 417 418 // shortcut 419 $thisfile_riff_raw['avih'] = array(); 420 $thisfile_riff_raw_avih = &$thisfile_riff_raw['avih']; 421 422 $thisfile_riff_raw_avih['dwMicroSecPerFrame'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 0, 4)); // frame display rate (or 0L) 423 if ($thisfile_riff_raw_avih['dwMicroSecPerFrame'] == 0) { 424 $ThisFileInfo['error'][] = 'Corrupt RIFF file: avih.dwMicroSecPerFrame == zero'; 425 return false; 426 } 427 $thisfile_riff_raw_avih['dwMaxBytesPerSec'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 4, 4)); // max. transfer rate 428 $thisfile_riff_raw_avih['dwPaddingGranularity'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 8, 4)); // pad to multiples of this size; normally 2K. 429 $thisfile_riff_raw_avih['dwFlags'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 12, 4)); // the ever-present flags 430 $thisfile_riff_raw_avih['dwTotalFrames'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 16, 4)); // # frames in file 431 $thisfile_riff_raw_avih['dwInitialFrames'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 20, 4)); 432 $thisfile_riff_raw_avih['dwStreams'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 24, 4)); 433 $thisfile_riff_raw_avih['dwSuggestedBufferSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 28, 4)); 434 $thisfile_riff_raw_avih['dwWidth'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 32, 4)); 435 $thisfile_riff_raw_avih['dwHeight'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 36, 4)); 436 $thisfile_riff_raw_avih['dwScale'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 40, 4)); 437 $thisfile_riff_raw_avih['dwRate'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 44, 4)); 438 $thisfile_riff_raw_avih['dwStart'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 48, 4)); 439 $thisfile_riff_raw_avih['dwLength'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($avihData, 52, 4)); 440 441 $thisfile_riff_raw_avih['flags']['hasindex'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000010); 442 $thisfile_riff_raw_avih['flags']['mustuseindex'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000020); 443 $thisfile_riff_raw_avih['flags']['interleaved'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000100); 444 $thisfile_riff_raw_avih['flags']['trustcktype'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00000800); 445 $thisfile_riff_raw_avih['flags']['capturedfile'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00010000); 446 $thisfile_riff_raw_avih['flags']['copyrighted'] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & 0x00020010); 447 448 // shortcut 449 $thisfile_riff_video[$streamindex] = array(); 450 $thisfile_riff_video_current = &$thisfile_riff_video[$streamindex]; 451 452 if ($thisfile_riff_raw_avih['dwWidth'] > 0) { 453 $thisfile_riff_video_current['frame_width'] = $thisfile_riff_raw_avih['dwWidth']; 454 $thisfile_video['resolution_x'] = $thisfile_riff_video_current['frame_width']; 455 } 456 if ($thisfile_riff_raw_avih['dwHeight'] > 0) { 457 $thisfile_riff_video_current['frame_height'] = $thisfile_riff_raw_avih['dwHeight']; 458 $thisfile_video['resolution_y'] = $thisfile_riff_video_current['frame_height']; 459 } 460 if ($thisfile_riff_raw_avih['dwTotalFrames'] > 0) { 461 $thisfile_riff_video_current['total_frames'] = $thisfile_riff_raw_avih['dwTotalFrames']; 462 $thisfile_video['total_frames'] = $thisfile_riff_video_current['total_frames']; 463 } 464 465 $thisfile_riff_video_current['frame_rate'] = round(1000000 / $thisfile_riff_raw_avih['dwMicroSecPerFrame'], 3); 466 $thisfile_video['frame_rate'] = $thisfile_riff_video_current['frame_rate']; 467 } 468 if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][0]['data'])) { 469 if (is_array($thisfile_riff['AVI ']['hdrl']['strl']['strh'])) { 470 for ($i = 0; $i < count($thisfile_riff['AVI ']['hdrl']['strl']['strh']); $i++) { 471 if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) { 472 $strhData = $thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data']; 473 $strhfccType = substr($strhData, 0, 4); 474 475 if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) { 476 $strfData = $thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data']; 477 478 // shortcut 479 $thisfile_riff_raw_strf_strhfccType_streamindex = &$thisfile_riff_raw['strf'][$strhfccType][$streamindex]; 480 481 switch ($strhfccType) { 482 case 'auds': 483 $thisfile_audio['bitrate_mode'] = 'cbr'; 484 $thisfile_audio_dataformat = 'wav'; 485 if (isset($thisfile_riff_audio) && is_array($thisfile_riff_audio)) { 486 $streamindex = count($thisfile_riff_audio); 487 } 488 489 $thisfile_riff_audio[$streamindex] = getid3_riff::RIFFparseWAVEFORMATex($strfData); 490 $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag']; 491 492 // shortcut 493 $thisfile_audio['streams'][$streamindex] = $thisfile_riff_audio[$streamindex]; 494 $thisfile_audio_streams_currentstream = &$thisfile_audio['streams'][$streamindex]; 495 496 if ($thisfile_audio_streams_currentstream['bits_per_sample'] == 0) { 497 unset($thisfile_audio_streams_currentstream['bits_per_sample']); 498 } 499 $thisfile_audio_streams_currentstream['wformattag'] = $thisfile_audio_streams_currentstream['raw']['wFormatTag']; 500 unset($thisfile_audio_streams_currentstream['raw']); 501 502 // shortcut 503 $thisfile_riff_raw['strf'][$strhfccType][$streamindex] = $thisfile_riff_audio[$streamindex]['raw']; 504 505 unset($thisfile_riff_audio[$streamindex]['raw']); 506 $thisfile_audio = getid3_lib::array_merge_noclobber($thisfile_audio, $thisfile_riff_audio[$streamindex]); 507 508 $thisfile_audio['lossless'] = false; 509 switch ($thisfile_riff_raw_strf_strhfccType_streamindex['wFormatTag']) { 510 case 0x0001: // PCM 511 $thisfile_audio_dataformat = 'wav'; 512 $thisfile_audio['lossless'] = true; 513 break; 514 515 case 0x0050: // MPEG Layer 2 or Layer 1 516 $thisfile_audio_dataformat = 'mp2'; // Assume Layer-2 517 break; 518 519 case 0x0055: // MPEG Layer 3 520 $thisfile_audio_dataformat = 'mp3'; 521 break; 522 523 case 0x00FF: // AAC 524 $thisfile_audio_dataformat = 'aac'; 525 break; 526 527 case 0x0161: // Windows Media v7 / v8 / v9 528 case 0x0162: // Windows Media Professional v9 529 case 0x0163: // Windows Media Lossess v9 530 $thisfile_audio_dataformat = 'wma'; 531 break; 532 533 case 0x2000: // AC-3 534 $thisfile_audio_dataformat = 'ac3'; 535 break; 536 537 case 0x2001: // DTS 538 $thisfile_audio_dataformat = 'dts'; 539 break; 540 541 default: 542 $thisfile_audio_dataformat = 'wav'; 543 break; 544 } 545 $thisfile_audio_streams_currentstream['dataformat'] = $thisfile_audio_dataformat; 546 $thisfile_audio_streams_currentstream['lossless'] = $thisfile_audio['lossless']; 547 $thisfile_audio_streams_currentstream['bitrate_mode'] = $thisfile_audio['bitrate_mode']; 548 break; 549 550 551 case 'iavs': 552 case 'vids': 553 // shortcut 554 $thisfile_riff_raw['strh'][$i] = array(); 555 $thisfile_riff_raw_strh_current = &$thisfile_riff_raw['strh'][$i]; 556 557 $thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); // same as $strhfccType; 558 $thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4); 559 $thisfile_riff_raw_strh_current['dwFlags'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 8, 4)); // Contains AVITF_* flags 560 $thisfile_riff_raw_strh_current['wPriority'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 12, 2)); 561 $thisfile_riff_raw_strh_current['wLanguage'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 14, 2)); 562 $thisfile_riff_raw_strh_current['dwInitialFrames'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 16, 4)); 563 $thisfile_riff_raw_strh_current['dwScale'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 20, 4)); 564 $thisfile_riff_raw_strh_current['dwRate'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 24, 4)); 565 $thisfile_riff_raw_strh_current['dwStart'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 28, 4)); 566 $thisfile_riff_raw_strh_current['dwLength'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 32, 4)); 567 $thisfile_riff_raw_strh_current['dwSuggestedBufferSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 36, 4)); 568 $thisfile_riff_raw_strh_current['dwQuality'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 40, 4)); 569 $thisfile_riff_raw_strh_current['dwSampleSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 44, 4)); 570 $thisfile_riff_raw_strh_current['rcFrame'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strhData, 48, 4)); 571 572 $thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strh_current['fccHandler']); 573 $thisfile_video['fourcc'] = $thisfile_riff_raw_strh_current['fccHandler']; 574 if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { 575 $thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']); 576 $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']; 577 } 578 $thisfile_video['codec'] = $thisfile_riff_video_current['codec']; 579 $thisfile_video['pixel_aspect_ratio'] = (float) 1; 580 switch ($thisfile_riff_raw_strh_current['fccHandler']) { 581 case 'HFYU': // Huffman Lossless Codec 582 case 'IRAW': // Intel YUV Uncompressed 583 case 'YUY2': // Uncompressed YUV 4:2:2 584 $thisfile_video['lossless'] = true; 585 break; 586 587 default: 588 $thisfile_video['lossless'] = false; 589 break; 590 } 591 592 switch ($strhfccType) { 593 case 'vids': 594 $thisfile_riff_raw_strf_strhfccType_streamindex['biSize'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 0, 4)); // number of bytes required by the BITMAPINFOHEADER structure 595 $thisfile_riff_raw_strf_strhfccType_streamindex['biWidth'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 4, 4)); // width of the bitmap in pixels 596 $thisfile_riff_raw_strf_strhfccType_streamindex['biHeight'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 8, 4)); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner 597 $thisfile_riff_raw_strf_strhfccType_streamindex['biPlanes'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 12, 2)); // number of color planes on the target device. In most cases this value must be set to 1 598 $thisfile_riff_raw_strf_strhfccType_streamindex['biBitCount'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 14, 2)); // Specifies the number of bits per pixels 599 $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'] = substr($strfData, 16, 4); // 600 $thisfile_riff_raw_strf_strhfccType_streamindex['biSizeImage'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 20, 4)); // size of the bitmap data section of the image (the actual pixel data, excluding BITMAPINFOHEADER and RGBQUAD structures) 601 $thisfile_riff_raw_strf_strhfccType_streamindex['biXPelsPerMeter'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 24, 4)); // horizontal resolution, in pixels per metre, of the target device 602 $thisfile_riff_raw_strf_strhfccType_streamindex['biYPelsPerMeter'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 28, 4)); // vertical resolution, in pixels per metre, of the target device 603 $thisfile_riff_raw_strf_strhfccType_streamindex['biClrUsed'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 32, 4)); // actual number of color indices in the color table used by the bitmap. If this value is zero, the bitmap uses the maximum number of colors corresponding to the value of the biBitCount member for the compression mode specified by biCompression 604 $thisfile_riff_raw_strf_strhfccType_streamindex['biClrImportant'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($strfData, 36, 4)); // number of color indices that are considered important for displaying the bitmap. If this value is zero, all colors are important 605 606 $thisfile_video['bits_per_sample'] = $thisfile_riff_raw_strf_strhfccType_streamindex['biBitCount']; 607 608 if ($thisfile_riff_video_current['codec'] == 'DV') { 609 $thisfile_riff_video_current['dv_type'] = 2; 610 } 611 break; 612 613 case 'iavs': 614 $thisfile_riff_video_current['dv_type'] = 1; 615 break; 616 } 617 break; 618 619 default: 620 $ThisFileInfo['warning'][] = 'Unhandled fccType for stream ('.$i.'): "'.$strhfccType.'"'; 621 break; 622 623 } 624 } 625 } 626 627 if (isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { 628 629 $thisfile_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']); 630 $thisfile_video['codec'] = $thisfile_riff_video_current['codec']; 631 $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']; 632 633 switch ($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) { 634 case 'HFYU': // Huffman Lossless Codec 635 case 'IRAW': // Intel YUV Uncompressed 636 case 'YUY2': // Uncompressed YUV 4:2:2 637 $thisfile_video['lossless'] = true; 638 $thisfile_video['bits_per_sample'] = 24; 639 break; 640 641 default: 642 $thisfile_video['lossless'] = false; 643 $thisfile_video['bits_per_sample'] = 24; 644 break; 645 } 646 647 } 648 } 649 } 650 } 651 break; 652 653 case 'CDDA': 654 $thisfile_audio['bitrate_mode'] = 'cbr'; 655 $thisfile_audio_dataformat = 'cda'; 656 $thisfile_audio['lossless'] = true; 657 unset($ThisFileInfo['mime_type']); 658 659 $thisfile_avdataoffset = 44; 660 661 if (isset($thisfile_riff['CDDA']['fmt '][0]['data'])) { 662 // shortcut 663 $thisfile_riff_CDDA_fmt_0 = &$thisfile_riff['CDDA']['fmt '][0]; 664 665 $thisfile_riff_CDDA_fmt_0['unknown1'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2)); 666 $thisfile_riff_CDDA_fmt_0['track_num'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2)); 667 $thisfile_riff_CDDA_fmt_0['disc_id'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4)); 668 $thisfile_riff_CDDA_fmt_0['start_offset_frame'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4)); 669 $thisfile_riff_CDDA_fmt_0['playtime_frames'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 12, 4)); 670 $thisfile_riff_CDDA_fmt_0['unknown6'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 16, 4)); 671 $thisfile_riff_CDDA_fmt_0['unknown7'] = getid3_riff::EitherEndian2Int($ThisFileInfo, substr($thisfile_riff_CDDA_fmt_0['data'], 20, 4)); 672 673 $thisfile_riff_CDDA_fmt_0['start_offset_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['start_offset_frame'] / 75; 674 $thisfile_riff_CDDA_fmt_0['playtime_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['playtime_frames'] / 75; 675 $ThisFileInfo['comments']['track'] = $thisfile_riff_CDDA_fmt_0['track_num']; 676 $ThisFileInfo['playtime_seconds'] = $thisfile_riff_CDDA_fmt_0['playtime_seconds']; 677 678 // hardcoded data for CD-audio 679 $thisfile_audio['sample_rate'] = 44100; 680 $thisfile_audio['channels'] = 2; 681 $thisfile_audio['bits_per_sample'] = 16; 682 $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $thisfile_audio['channels'] * $thisfile_audio['bits_per_sample']; 683 $thisfile_audio['bitrate_mode'] = 'cbr'; 684 } 685 break; 686 687 688 case 'AIFF': 689 case 'AIFC': 690 $thisfile_audio['bitrate_mode'] = 'cbr'; 691 $thisfile_audio_dataformat = 'aiff'; 692 $thisfile_audio['lossless'] = true; 693 $ThisFileInfo['mime_type'] = 'audio/x-aiff'; 694 695 if (isset($thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'])) { 696 $thisfile_avdataoffset = $thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'] + 8; 697 $thisfile_avdataend = $thisfile_avdataoffset + $thisfile_riff[$RIFFsubtype]['SSND'][0]['size']; 698 if ($thisfile_avdataend > $ThisFileInfo['filesize']) { 699 if (($thisfile_avdataend == ($ThisFileInfo['filesize'] + 1)) && (($ThisFileInfo['filesize'] % 2) == 1)) { 700 // structures rounded to 2-byte boundary, but dumb encoders 701 // forget to pad end of file to make this actually work 702 } else { 703 $ThisFileInfo['warning'][] = 'Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['SSND'][0]['size'].' bytes of audio data, only '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' bytes found'; 704 } 705 $thisfile_avdataend = $ThisFileInfo['filesize']; 706 } 707 } 708 709 if (isset($thisfile_riff[$RIFFsubtype]['COMM'][0]['data'])) { 710 711 // shortcut 712 $thisfile_riff_RIFFsubtype_COMM_0_data = &$thisfile_riff[$RIFFsubtype]['COMM'][0]['data']; 713 714 $thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true); 715 $thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false); 716 $thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true); 717 $thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10)); 718 719 if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) { 720 $thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4); 721 $CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false); 722 $thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize); 723 switch ($thisfile_riff_audio['codec_name']) { 724 case 'NONE': 725 $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)'; 726 $thisfile_audio['lossless'] = true; 727 break; 728 729 case '': 730 switch ($thisfile_riff_audio['codec_fourcc']) { 731 // http://developer.apple.com/qa/snd/snd07.html 732 case 'sowt': 733 $thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM'; 734 $thisfile_audio['lossless'] = true; 735 break; 736 737 case 'twos': 738 $thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Big-Endian PCM'; 739 $thisfile_audio['lossless'] = true; 740 break; 741 742 default: 743 break; 744 } 745 break; 746 747 default: 748 $thisfile_audio['codec'] = $thisfile_riff_audio['codec_name']; 749 $thisfile_audio['lossless'] = false; 750 break; 751 } 752 } 753 754 $thisfile_audio['channels'] = $thisfile_riff_audio['channels']; 755 if ($thisfile_riff_audio['bits_per_sample'] > 0) { 756 $thisfile_audio['bits_per_sample'] = $thisfile_riff_audio['bits_per_sample']; 757 } 758 $thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate']; 759 if ($thisfile_audio['sample_rate'] == 0) { 760 $ThisFileInfo['error'][] = 'Corrupted AIFF file: sample_rate == zero'; 761 return false; 762 } 763 $ThisFileInfo['playtime_seconds'] = $thisfile_riff_audio['total_samples'] / $thisfile_audio['sample_rate']; 764 } 765 766 if (isset($thisfile_riff[$RIFFsubtype]['COMT'])) { 767 $offset = 0; 768 $CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); 769 $offset += 2; 770 for ($i = 0; $i < $CommentCount; $i++) { 771 $ThisFileInfo['comments_raw'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 4), false); 772 $offset += 4; 773 $ThisFileInfo['comments_raw'][$i]['marker_id'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), true); 774 $offset += 2; 775 $CommentLength = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); 776 $offset += 2; 777 $ThisFileInfo['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength); 778 $offset += $CommentLength; 779 780 $ThisFileInfo['comments_raw'][$i]['timestamp_unix'] = getid3_lib::DateMac2Unix($ThisFileInfo['comments_raw'][$i]['timestamp']); 781 $thisfile_riff['comments']['comment'][] = $ThisFileInfo['comments_raw'][$i]['comment']; 782 } 783 } 784 785 $CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment'); 786 foreach ($CommentsChunkNames as $key => $value) { 787 if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) { 788 $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data']; 789 } 790 } 791 break; 792 793 case '8SVX': 794 $thisfile_audio['bitrate_mode'] = 'cbr'; 795 $thisfile_audio_dataformat = '8svx'; 796 $thisfile_audio['bits_per_sample'] = 8; 797 $thisfile_audio['channels'] = 1; // overridden below, if need be 798 $ThisFileInfo['mime_type'] = 'audio/x-aiff'; 799 800 if (isset($thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'])) { 801 $thisfile_avdataoffset = $thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'] + 8; 802 $thisfile_avdataend = $thisfile_avdataoffset + $thisfile_riff[$RIFFsubtype]['BODY'][0]['size']; 803 if ($thisfile_avdataend > $ThisFileInfo['filesize']) { 804 $ThisFileInfo['warning'][] = 'Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['BODY'][0]['size'].' bytes of audio data, only '.($ThisFileInfo['filesize'] - $thisfile_avdataoffset).' bytes found'; 805 } 806 } 807 808 if (isset($thisfile_riff[$RIFFsubtype]['VHDR'][0]['offset'])) { 809 // shortcut 810 $thisfile_riff_RIFFsubtype_VHDR_0 = &$thisfile_riff[$RIFFsubtype]['VHDR'][0]; 811 812 $thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4)); 813 $thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4)); 814 $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4)); 815 $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2)); 816 $thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1)); 817 $thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1)); 818 $thisfile_riff_RIFFsubtype_VHDR_0['Volume'] = getid3_lib::FixedPoint16_16(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 16, 4)); 819 820 $thisfile_audio['sample_rate'] = $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec']; 821 822 switch ($thisfile_riff_RIFFsubtype_VHDR_0['sCompression']) { 823 case 0: 824 $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)'; 825 $thisfile_audio['lossless'] = true; 826 $ActualBitsPerSample = 8; 827 break; 828 829 case 1: 830 $thisfile_audio['codec'] = 'Fibonacci-delta encoding'; 831 $thisfile_audio['lossless'] = false; 832 $ActualBitsPerSample = 4; 833 break; 834 835 default: 836 $ThisFileInfo['warning'][] = 'Unexpected sCompression value in 8SVX.VHDR chunk - expecting 0 or 1, found "'.sCompression.'"'; 837 break; 838 } 839 } 840 841 if (isset($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'])) { 842 $ChannelsIndex = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'], 0, 4)); 843 switch ($ChannelsIndex) { 844 case 6: // Stereo 845 $thisfile_audio['channels'] = 2; 846 break; 847 848 case 2: // Left channel only 849 case 4: // Right channel only 850 $thisfile_audio['channels'] = 1; 851 break; 852 853 default: 854 $ThisFileInfo['warning'][] = 'Unexpected value in 8SVX.CHAN chunk - expecting 2 or 4 or 6, found "'.$ChannelsIndex.'"'; 855 break; 856 } 857 858 } 859 860 $CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment'); 861 foreach ($CommentsChunkNames as $key => $value) { 862 if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) { 863 $thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data']; 864 } 865 } 866 867 $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $ActualBitsPerSample * $thisfile_audio['channels']; 868 if (!empty($thisfile_audio['bitrate'])) { 869 $ThisFileInfo['playtime_seconds'] = ($thisfile_avdataend - $thisfile_avdataoffset) / ($thisfile_audio['bitrate'] / 8); 870 } 871 break; 872 873 874 case 'CDXA': 875 $ThisFileInfo['mime_type'] = 'video/mpeg'; 876 if (!empty($thisfile_riff['CDXA']['data'][0]['size'])) { 877 $GETID3_ERRORARRAY = &$ThisFileInfo['warning']; 878 if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, false)) { 879 $dummy = $ThisFileInfo; 880 $dummy['error'] = array(); 881 $mpeg_scanner = new getid3_mpeg($fd, $dummy); 882 if (empty($dummy['error'])) { 883 $ThisFileInfo['audio'] = $dummy['audio']; 884 $ThisFileInfo['video'] = $dummy['video']; 885 $ThisFileInfo['mpeg'] = $dummy['mpeg']; 886 $ThisFileInfo['warning'] = $dummy['warning']; 887 } 888 } 889 } 890 break; 891 892 893 default: 894 $ThisFileInfo['error'][] = 'Unknown RIFF type: expecting one of (WAVE|RMP3|AVI |CDDA|AIFF|AIFC|8SVX|CDXA), found "'.$RIFFsubtype.'" instead'; 895 unset($ThisFileInfo['fileformat']); 896 break; 897 } 898 899 if (isset($thisfile_riff_WAVE['DISP']) && is_array($thisfile_riff_WAVE['DISP'])) { 900 $thisfile_riff['comments']['title'][] = trim(substr($thisfile_riff_WAVE['DISP'][count($thisfile_riff_WAVE['DISP']) - 1]['data'], 4)); 901 } 902 if (isset($thisfile_riff_WAVE['INFO']) && is_array($thisfile_riff_WAVE['INFO'])) { 903 $this->RIFFcommentsParse($thisfile_riff_WAVE['INFO'], $thisfile_riff['comments']); 904 } 905 906 if (empty($thisfile_audio['encoder']) && !empty($ThisFileInfo['mpeg']['audio']['LAME']['short_version'])) { 907 $thisfile_audio['encoder'] = $ThisFileInfo['mpeg']['audio']['LAME']['short_version']; 908 } 909 910 if (!isset($ThisFileInfo['playtime_seconds'])) { 911 $ThisFileInfo['playtime_seconds'] = 0; 912 } 913 if (isset($thisfile_riff_raw['avih']['dwTotalFrames']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { 914 $ThisFileInfo['playtime_seconds'] = $thisfile_riff_raw['avih']['dwTotalFrames'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000); 915 } 916 917 if ($ThisFileInfo['playtime_seconds'] > 0) { 918 if (isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { 919 920 if (!isset($ThisFileInfo['bitrate'])) { 921 $ThisFileInfo['bitrate'] = ((($thisfile_avdataend - $thisfile_avdataoffset) / $ThisFileInfo['playtime_seconds']) * 8); 922 } 923 924 } elseif (isset($thisfile_riff_audio) && !isset($thisfile_riff_video)) { 925 926 if (!isset($thisfile_audio['bitrate'])) { 927 $thisfile_audio['bitrate'] = ((($thisfile_avdataend - $thisfile_avdataoffset) / $ThisFileInfo['playtime_seconds']) * 8); 928 } 929 930 } elseif (!isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { 931 932 if (!isset($thisfile_video['bitrate'])) { 933 $thisfile_video['bitrate'] = ((($thisfile_avdataend - $thisfile_avdataoffset) / $ThisFileInfo['playtime_seconds']) * 8); 934 } 935 936 } 937 } 938 939 940 if (isset($thisfile_riff_video) && isset($thisfile_audio['bitrate']) && ($thisfile_audio['bitrate'] > 0) && ($ThisFileInfo['playtime_seconds'] > 0)) { 941 942 $ThisFileInfo['bitrate'] = ((($thisfile_avdataend - $thisfile_avdataoffset) / $ThisFileInfo['playtime_seconds']) * 8); 943 $thisfile_audio['bitrate'] = 0; 944 $thisfile_video['bitrate'] = $ThisFileInfo['bitrate']; 945 foreach ($thisfile_riff_audio as $channelnumber => $audioinfoarray) { 946 $thisfile_video['bitrate'] -= $audioinfoarray['bitrate']; 947 $thisfile_audio['bitrate'] += $audioinfoarray['bitrate']; 948 } 949 if ($thisfile_video['bitrate'] <= 0) { 950 unset($thisfile_video['bitrate']); 951 } 952 if ($thisfile_audio['bitrate'] <= 0) { 953 unset($thisfile_audio['bitrate']); 954 } 955 } 956 957 if (isset($ThisFileInfo['mpeg']['audio'])) { 958 $thisfile_audio_dataformat = 'mp'.$ThisFileInfo['mpeg']['audio']['layer']; 959 $thisfile_audio['sample_rate'] = $ThisFileInfo['mpeg']['audio']['sample_rate']; 960 $thisfile_audio['channels'] = $ThisFileInfo['mpeg']['audio']['channels']; 961 $thisfile_audio['bitrate'] = $ThisFileInfo['mpeg']['audio']['bitrate']; 962 $thisfile_audio['bitrate_mode'] = strtolower($ThisFileInfo['mpeg']['audio']['bitrate_mode']); 963 if (!empty($ThisFileInfo['mpeg']['audio']['codec'])) { 964 $thisfile_audio['codec'] = $ThisFileInfo['mpeg']['audio']['codec'].' '.$thisfile_audio['codec']; 965 } 966 if (!empty($thisfile_audio['streams'])) { 967 foreach ($thisfile_audio['streams'] as $streamnumber => $streamdata) { 968 if ($streamdata['dataformat'] == $thisfile_audio_dataformat) { 969 $thisfile_audio['streams'][$streamnumber]['sample_rate'] = $thisfile_audio['sample_rate']; 970 $thisfile_audio['streams'][$streamnumber]['channels'] = $thisfile_audio['channels']; 971 $thisfile_audio['streams'][$streamnumber]['bitrate'] = $thisfile_audio['bitrate']; 972 $thisfile_audio['streams'][$streamnumber]['bitrate_mode'] = $thisfile_audio['bitrate_mode']; 973 $thisfile_audio['streams'][$streamnumber]['codec'] = $thisfile_audio['codec']; 974 } 975 } 976 } 977 $thisfile_audio['encoder_options'] = getid3_mp3::GuessEncoderOptions($ThisFileInfo); 978 } 979 980 981 if (!empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) { 982 switch ($thisfile_audio_dataformat) { 983 case 'ac3': 984 // ignore bits_per_sample 985 break; 986 987 default: 988 $thisfile_audio['bits_per_sample'] = $thisfile_riff_raw['fmt ']['wBitsPerSample']; 989 break; 990 } 991 } 992 993 994 if (empty($thisfile_riff_raw)) { 995 unset($thisfile_riff['raw']); 996 } 997 if (empty($thisfile_riff_audio)) { 998 unset($thisfile_riff['audio']); 999 } 1000 if (empty($thisfile_riff_video)) { 1001 unset($thisfile_riff['video']); 1002 } 1003 1004 return true; 1005 } 1006 1007 1008 function RIFFcommentsParse(&$RIFFinfoArray, &$CommentsTargetArray) { 1009 $RIFFinfoKeyLookup = array( 1010 'IARL'=>'archivallocation', 1011 'IART'=>'artist', 1012 'ICDS'=>'costumedesigner', 1013 'ICMS'=>'commissionedby', 1014 'ICMT'=>'comment', 1015 'ICNT'=>'country', 1016 'ICOP'=>'copyright', 1017 'ICRD'=>'creationdate', 1018 'IDIM'=>'dimensions', 1019 'IDIT'=>'digitizationdate', 1020 'IDPI'=>'resolution', 1021 'IDST'=>'distributor', 1022 'IEDT'=>'editor', 1023 'IENG'=>'engineers', 1024 'IFRM'=>'accountofparts', 1025 'IGNR'=>'genre', 1026 'IKEY'=>'keywords', 1027 'ILGT'=>'lightness', 1028 'ILNG'=>'language', 1029 'IMED'=>'orignalmedium', 1030 'IMUS'=>'composer', 1031 'INAM'=>'title', 1032 'IPDS'=>'productiondesigner', 1033 'IPLT'=>'palette', 1034 'IPRD'=>'product', 1035 'IPRO'=>'producer', 1036 'IPRT'=>'part', 1037 'IRTD'=>'rating', 1038 'ISBJ'=>'subject', 1039 'ISFT'=>'software', 1040 'ISGN'=>'secondarygenre', 1041 'ISHP'=>'sharpness', 1042 'ISRC'=>'sourcesupplier', 1043 'ISRF'=>'digitizationsource', 1044 'ISTD'=>'productionstudio', 1045 'ISTR'=>'starring', 1046 'ITCH'=>'encoded_by', 1047 'IWEB'=>'url', 1048 'IWRI'=>'writer' 1049 ); 1050 foreach ($RIFFinfoKeyLookup as $key => $value) { 1051 if (isset($RIFFinfoArray[$key])) { 1052 foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) { 1053 if (trim($commentdata['data']) != '') { 1054 @$CommentsTargetArray[$value][] = trim($commentdata['data']); 1055 } 1056 } 1057 } 1058 } 1059 return true; 1060 } 1061 1062 function ParseRIFF(&$fd, $startoffset, $maxoffset, &$ThisFileInfo) { 1063 1064 $maxoffset = min($maxoffset, $ThisFileInfo['avdataend']); 1065 1066 $RIFFchunk = false; 1067 1068 fseek($fd, $startoffset, SEEK_SET); 1069 1070 while (ftell($fd) < $maxoffset) { 1071 $chunkname = fread($fd, 4); 1072 if (strlen($chunkname) < 4) { 1073 $ThisFileInfo['error'][] = 'Expecting chunk name at offset '.(ftell($fd) - 4).' but found nothing. Aborting RIFF parsing.'; 1074 break; 1075 } 1076 1077 $chunksize = getid3_riff::EitherEndian2Int($ThisFileInfo, fread($fd, 4)); 1078 if ($chunksize == 0) { 1079 $ThisFileInfo['error'][] = 'Chunk size at offset '.(ftell($fd) - 4).' is zero. Aborting RIFF parsing.'; 1080 break; 1081 } 1082 if (($chunksize % 2) != 0) { 1083 // all structures are packed on word boundaries 1084 $chunksize++; 1085 } 1086 1087 switch ($chunkname) { 1088 case 'LIST': 1089 $listname = fread($fd, 4); 1090 switch ($listname) { 1091 case 'movi': 1092 case 'rec ': 1093 $RIFFchunk[$listname]['offset'] = ftell($fd) - 4; 1094 $RIFFchunk[$listname]['size'] = $chunksize; 1095 1096 static $ParsedAudioStream = false; 1097 if ($ParsedAudioStream) { 1098 1099 // skip over 1100 1101 } else { 1102 1103 $WhereWeWere = ftell($fd); 1104 $AudioChunkHeader = fread($fd, 12); 1105 $AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2); 1106 $AudioChunkStreamType = substr($AudioChunkHeader, 2, 2); 1107 $AudioChunkSize = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4)); 1108 1109 if ($AudioChunkStreamType == 'wb') { 1110 $FirstFourBytes = substr($AudioChunkHeader, 8, 4); 1111 if (preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', $FirstFourBytes)) { 1112 1113 // MP3 1114 if (getid3_mp3::MPEGaudioHeaderBytesValid($FirstFourBytes)) { 1115 $dummy = $ThisFileInfo; 1116 $dummy['avdataoffset'] = ftell($fd) - 4; 1117 $dummy['avdataend'] = ftell($fd) + $AudioChunkSize; 1118 getid3_mp3::getOnlyMPEGaudioInfo($fd, $dummy, $dummy['avdataoffset'], false); 1119 if (isset($dummy['mpeg']['audio'])) { 1120 $ThisFileInfo = $dummy; 1121 $ThisFileInfo['audio']['dataformat'] = 'mp'.$ThisFileInfo['mpeg']['audio']['layer']; 1122 $ThisFileInfo['audio']['sample_rate'] = $ThisFileInfo['mpeg']['audio']['sample_rate']; 1123 $ThisFileInfo['audio']['channels'] = $ThisFileInfo['mpeg']['audio']['channels']; 1124 $ThisFileInfo['audio']['bitrate'] = $ThisFileInfo['mpeg']['audio']['bitrate']; 1125 $ThisFileInfo['bitrate'] = $ThisFileInfo['audio']['bitrate']; 1126 $ThisFileInfo['audio']['bitrate_mode'] = strtolower($ThisFileInfo['mpeg']['audio']['bitrate_mode']); 1127 } 1128 } 1129 1130 } elseif (preg_match('/^\x0B\x77/s', $FirstFourBytes)) { 1131 1132 // AC3 1133 $GETID3_ERRORARRAY = &$ThisFileInfo['warning']; 1134 if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, false)) { 1135 1136 $dummy = $ThisFileInfo; 1137 $dummy['avdataoffset'] = ftell($fd) - 4; 1138 $dummy['avdataend'] = ftell($fd) + $AudioChunkSize; 1139 $dummy['error'] = array(); 1140 $ac3_tag = new getid3_ac3($fd, $dummy); 1141 if (empty($dummy['error'])) { 1142 $ThisFileInfo['audio'] = $dummy['audio']; 1143 $ThisFileInfo['ac3'] = $dummy['ac3']; 1144 $ThisFileInfo['warning'] = $dummy['warning']; 1145 } 1146 1147 } 1148 1149 } 1150 1151 } 1152 1153 $ParsedAudioStream = true; 1154 fseek($fd, $WhereWeWere, SEEK_SET); 1155 1156 } 1157 fseek($fd, $chunksize - 4, SEEK_CUR); 1158 break; 1159 1160 default: 1161 if (!isset($RIFFchunk[$listname])) { 1162 $RIFFchunk[$listname] = array(); 1163 } 1164 $LISTchunkParent = $listname; 1165 $LISTchunkMaxOffset = ftell($fd) - 4 + $chunksize; 1166 if ($parsedChunk = getid3_riff::ParseRIFF($fd, ftell($fd), ftell($fd) + $chunksize - 4, $ThisFileInfo)) { 1167 $RIFFchunk[$listname] = array_merge_recursive($RIFFchunk[$listname], $parsedChunk); 1168 } 1169 break; 1170 } 1171 break; 1172 1173 default: 1174 $thisindex = 0; 1175 if (isset($RIFFchunk[$chunkname]) && is_array($RIFFchunk[$chunkname])) { 1176 $thisindex = count($RIFFchunk[$chunkname]); 1177 } 1178 $RIFFchunk[$chunkname][$thisindex]['offset'] = ftell($fd) - 8; 1179 $RIFFchunk[$chunkname][$thisindex]['size'] = $chunksize; 1180 switch ($chunkname) { 1181 case 'data': 1182 $ThisFileInfo['avdataoffset'] = ftell($fd); 1183 $ThisFileInfo['avdataend'] = $ThisFileInfo['avdataoffset'] + $chunksize; 1184 1185 $RIFFdataChunkContentsTest = fread($fd, 36); 1186 1187 if ((strlen($RIFFdataChunkContentsTest) > 0) && preg_match('/^\xFF[\xE2-\xE7\xF2-\xF7\xFA-\xFF][\x00-\xEB]/s', substr($RIFFdataChunkContentsTest, 0, 4))) { 1188 1189 // Probably is MP3 data 1190 if (getid3_mp3::MPEGaudioHeaderBytesValid(substr($RIFFdataChunkContentsTest, 0, 4))) { 1191 getid3_mp3::getOnlyMPEGaudioInfo($fd, $ThisFileInfo, $RIFFchunk[$chunkname][$thisindex]['offset'], false); 1192 } 1193 1194 } elseif ((strlen($RIFFdataChunkContentsTest) > 0) && (substr($RIFFdataChunkContentsTest, 0, 2) == "\x0B\x77")) { 1195 1196 // This is probably AC-3 data 1197 $GETID3_ERRORARRAY = &$ThisFileInfo['warning']; 1198 if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, false)) { 1199 1200 $dummy = $ThisFileInfo; 1201 $dummy['avdataoffset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; 1202 $dummy['avdataend'] = $dummy['avdataoffset'] + $RIFFchunk[$chunkname][$thisindex]['size']; 1203 $dummy['error'] = array(); 1204 1205 $ac3_tag = new getid3_ac3($fd, $dummy); 1206 if (empty($dummy['error'])) { 1207 $ThisFileInfo['audio'] = $dummy['audio']; 1208 $ThisFileInfo['ac3'] = $dummy['ac3']; 1209 $ThisFileInfo['warning'] = $dummy['warning']; 1210 } 1211 1212 } 1213 1214 } elseif ((strlen($RIFFdataChunkContentsTest) > 0) && (substr($RIFFdataChunkContentsTest, 8, 2) == "\x77\x0B")) { 1215 1216 // Dolby Digital WAV 1217 // AC-3 content, but not encoded in same format as normal AC-3 file 1218 // For one thing, byte order is swapped 1219 1220 $GETID3_ERRORARRAY = &$ThisFileInfo['warning']; 1221 if (getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ac3.php', __FILE__, false)) { 1222 1223 // ok to use tmpfile here - only 56 bytes 1224 if ($fd_temp = tmpfile()) { 1225 1226 for ($i = 0; $i < 28; $i += 2) { 1227 // swap byte order 1228 fwrite($fd_temp, substr($RIFFdataChunkContentsTest, 8 + $i + 1, 1)); 1229 fwrite($fd_temp, substr($RIFFdataChunkContentsTest, 8 + $i + 0, 1)); 1230 } 1231 1232 $dummy = $ThisFileInfo; 1233 $dummy['avdataoffset'] = 0; 1234 $dummy['avdataend'] = 20; 1235 $dummy['error'] = array(); 1236 $ac3_tag = new getid3_ac3($fd_temp, $dummy); 1237 fclose($fd_temp); 1238 if (empty($dummy['error'])) { 1239 $ThisFileInfo['audio'] = $dummy['audio']; 1240 $ThisFileInfo['ac3'] = $dummy['ac3']; 1241 $ThisFileInfo['warning'] = $dummy['warning']; 1242 } else { 1243 $ThisFileInfo['error'][] = 'Errors parsing DolbyDigital WAV: '.explode(';', $dummy['error']); 1244 } 1245 1246 } else { 1247 1248 $ThisFileInfo['error'][] = 'Could not create temporary file to analyze DolbyDigital WAV'; 1249 1250 } 1251 1252 } 1253 1254 } elseif ((strlen($RIFFdataChunkContentsTest) > 0) && (substr($RIFFdataChunkContentsTest, 0, 4) == 'wvpk')) { 1255 1256 // This is WavPack data 1257 $ThisFileInfo['wavpack']['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; 1258 $ThisFileInfo['wavpack']['size'] = getid3_lib::LittleEndian2Int(substr($RIFFdataChunkContentsTest, 4, 4)); 1259 getid3_riff::RIFFparseWavPackHeader(substr($RIFFdataChunkContentsTest, 8, 28), $ThisFileInfo); 1260 1261 } else { 1262 1263 // This is some other kind of data (quite possibly just PCM) 1264 // do nothing special, just skip it 1265 1266 } 1267 fseek($fd, $RIFFchunk[$chunkname][$thisindex]['offset'] + 8 + $chunksize, SEEK_SET); 1268 break; 1269 1270 case 'bext': 1271 case 'cart': 1272 case 'fmt ': 1273 case 'MEXT': 1274 case 'DISP': 1275 // always read data in 1276 $RIFFchunk[$chunkname][$thisindex]['data'] = fread($fd, $chunksize); 1277 break; 1278 1279 default: 1280 if (!empty($LISTchunkParent) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) { 1281 $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; 1282 $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['size'] = $RIFFchunk[$chunkname][$thisindex]['size']; 1283 unset($RIFFchunk[$chunkname][$thisindex]['offset']); 1284 unset($RIFFchunk[$chunkname][$thisindex]['size']); 1285 if (isset($RIFFchunk[$chunkname][$thisindex]) && empty($RIFFchunk[$chunkname][$thisindex])) { 1286 unset($RIFFchunk[$chunkname][$thisindex]); 1287 } 1288 if (isset($RIFFchunk[$chunkname]) && empty($RIFFchunk[$chunkname])) { 1289 unset($RIFFchunk[$chunkname]); 1290 } 1291 $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['data'] = fread($fd, $chunksize); 1292 } elseif ($chunksize < 2048) { 1293 // only read data in if smaller than 2kB 1294 $RIFFchunk[$chunkname][$thisindex]['data'] = fread($fd, $chunksize); 1295 } else { 1296 fseek($fd, $chunksize, SEEK_CUR); 1297 } 1298 break; 1299 } 1300 break; 1301 1302 } 1303 1304 } 1305 1306 return $RIFFchunk; 1307 } 1308 1309 1310 function ParseRIFFdata(&$RIFFdata, &$ThisFileInfo) { 1311 if ($RIFFdata) { 1312 1313 $tempfile = tempnam('*', 'getID3'); 1314 $fp_temp = fopen($tempfile, "wb"); 1315 $RIFFdataLength = strlen($RIFFdata); 1316 $NewLengthString = getid3_lib::LittleEndian2String($RIFFdataLength, 4); 1317 for ($i = 0; $i < 4; $i++) { 1318 $RIFFdata{$i + 4} = $NewLengthString{$i}; 1319 } 1320 fwrite($fp_temp, $RIFFdata); 1321 fclose($fp_temp); 1322 1323 $fp_temp = fopen($tempfile, "rb"); 1324 $dummy = array('filesize'=>$RIFFdataLength, 'filenamepath'=>$ThisFileInfo['filenamepath'], 'tags'=>$ThisFileInfo['tags'], 'avdataoffset'=>0, 'avdataend'=>$RIFFdataLength, 'warning'=>$ThisFileInfo['warning'], 'error'=>$ThisFileInfo['error'], 'comments'=>$ThisFileInfo['comments'], 'audio'=>(isset($ThisFileInfo['audio']) ? $ThisFileInfo['audio'] : array()), 'video'=>(isset($ThisFileInfo['video']) ? $ThisFileInfo['video'] : array())); 1325 $riff = new getid3_riff($fp_temp, $dummy); 1326 $ThisFileInfo['riff'] = $dummy['riff']; 1327 $ThisFileInfo['warning'] = $dummy['warning']; 1328 $ThisFileInfo['error'] = $dummy['error']; 1329 $ThisFileInfo['tags'] = $dummy['tags']; 1330 $ThisFileInfo['comments'] = $dummy['comments']; 1331 fclose($fp_temp); 1332 unlink($tempfile); 1333 return true; 1334 } 1335 return false; 1336 } 1337 1338 1339 function RIFFparseWAVEFORMATex($WaveFormatExData) { 1340 // shortcut 1341 $WaveFormatEx['raw'] = array(); 1342 $WaveFormatEx_raw = &$WaveFormatEx['raw']; 1343 1344 $WaveFormatEx_raw['wFormatTag'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 0, 2)); 1345 $WaveFormatEx_raw['nChannels'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 2, 2)); 1346 $WaveFormatEx_raw['nSamplesPerSec'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 4, 4)); 1347 $WaveFormatEx_raw['nAvgBytesPerSec'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 8, 4)); 1348 $WaveFormatEx_raw['nBlockAlign'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 12, 2)); 1349 $WaveFormatEx_raw['wBitsPerSample'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 14, 2)); 1350 if (strlen($WaveFormatExData) > 16) { 1351 $WaveFormatEx_raw['cbSize'] = getid3_lib::LittleEndian2Int(substr($WaveFormatExData, 16, 2)); 1352 } 1353 1354 $WaveFormatEx['codec'] = getid3_riff::RIFFwFormatTagLookup($WaveFormatEx_raw['wFormatTag']); 1355 $WaveFormatEx['channels'] = $WaveFormatEx_raw['nChannels']; 1356 $WaveFormatEx['sample_rate'] = $WaveFormatEx_raw['nSamplesPerSec']; 1357 $WaveFormatEx['bitrate'] = $WaveFormatEx_raw['nAvgBytesPerSec'] * 8; 1358 $WaveFormatEx['bits_per_sample'] = $WaveFormatEx_raw['wBitsPerSample']; 1359 1360 return $WaveFormatEx; 1361 } 1362 1363 1364 function RIFFparseWavPackHeader($WavPackChunkData, &$ThisFileInfo) { 1365 // typedef struct { 1366 // char ckID [4]; 1367 // long ckSize; 1368 // short version; 1369 // short bits; // added for version 2.00 1370 // short flags, shift; // added for version 3.00 1371 // long total_samples, crc, crc2; 1372 // char extension [4], extra_bc, extras [3]; 1373 // } WavpackHeader; 1374 1375 // shortcut 1376 $ThisFileInfo['wavpack'] = array(); 1377 $thisfile_wavpack = &$ThisFileInfo['wavpack']; 1378 1379 $thisfile_wavpack['version'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 0, 2)); 1380 if ($thisfile_wavpack['version'] >= 2) { 1381 $thisfile_wavpack['bits'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 2, 2)); 1382 } 1383 if ($thisfile_wavpack['version'] >= 3) { 1384 $thisfile_wavpack['flags_raw'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 4, 2)); 1385 $thisfile_wavpack['shift'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 6, 2)); 1386 $thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 8, 4)); 1387 $thisfile_wavpack['crc1'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 12, 4)); 1388 $thisfile_wavpack['crc2'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 16, 4)); 1389 $thisfile_wavpack['extension'] = substr($WavPackChunkData, 20, 4); 1390 $thisfile_wavpack['extra_bc'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 24, 1)); 1391 for ($i = 0; $i <= 2; $i++) { 1392 $thisfile_wavpack['extras'][] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1)); 1393 } 1394 1395 // shortcut 1396 $thisfile_wavpack['flags'] = array(); 1397 $thisfile_wavpack_flags = &$thisfile_wavpack['flags']; 1398 1399 $thisfile_wavpack_flags['mono'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000001); 1400 $thisfile_wavpack_flags['fast_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000002); 1401 $thisfile_wavpack_flags['raw_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000004); 1402 $thisfile_wavpack_flags['calc_noise'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000008); 1403 $thisfile_wavpack_flags['high_quality'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000010); 1404 $thisfile_wavpack_flags['3_byte_samples'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000020); 1405 $thisfile_wavpack_flags['over_20_bits'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000040); 1406 $thisfile_wavpack_flags['use_wvc'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000080); 1407 $thisfile_wavpack_flags['noiseshaping'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000100); 1408 $thisfile_wavpack_flags['very_fast_mode'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000200); 1409 $thisfile_wavpack_flags['new_high_quality'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000400); 1410 $thisfile_wavpack_flags['cancel_extreme'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x000800); 1411 $thisfile_wavpack_flags['cross_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x001000); 1412 $thisfile_wavpack_flags['new_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x002000); 1413 $thisfile_wavpack_flags['joint_stereo'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x004000); 1414 $thisfile_wavpack_flags['extra_decorrelation'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x008000); 1415 $thisfile_wavpack_flags['override_noiseshape'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x010000); 1416 $thisfile_wavpack_flags['override_jointstereo'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x020000); 1417 $thisfile_wavpack_flags['copy_source_filetime'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x040000); 1418 $thisfile_wavpack_flags['create_exe'] = (bool) ($thisfile_wavpack['flags_raw'] & 0x080000); 1419 } 1420 1421 return true; 1422 } 1423 1424 function RIFFwFormatTagLookup($wFormatTag) { 1425 1426 $begin = __LINE__; 1427 1428 /** This is not a comment! 1429 1430 0x0000 Microsoft Unknown Wave Format 1431 0x0001 Pulse Code Modulation (PCM) 1432 0x0002 Microsoft ADPCM 1433 0x0003 IEEE Float 1434 0x0004 Compaq Computer VSELP 1435 0x0005 IBM CVSD 1436 0x0006 Microsoft A-Law 1437 0x0007 Microsoft mu-Law 1438 0x0008 Microsoft DTS 1439 0x0010 OKI ADPCM 1440 0x0011 Intel DVI/IMA ADPCM 1441 0x0012 Videologic MediaSpace ADPCM 1442 0x0013 Sierra Semiconductor ADPCM 1443 0x0014 Antex Electronics G.723 ADPCM 1444 0x0015 DSP Solutions DigiSTD 1445 0x0016 DSP Solutions DigiFIX 1446 0x0017 Dialogic OKI ADPCM 1447 0x0018 MediaVision ADPCM 1448 0x0019 Hewlett-Packard CU 1449 0x0020 Yamaha ADPCM 1450 0x0021 Speech Compression Sonarc 1451 0x0022 DSP Group TrueSpeech 1452 0x0023 Echo Speech EchoSC1 1453 0x0024 Audiofile AF36 1454 0x0025 Audio Processing Technology APTX 1455 0x0026 AudioFile AF10 1456 0x0027 Prosody 1612 1457 0x0028 LRC 1458 0x0030 Dolby AC2 1459 0x0031 Microsoft GSM 6.10 1460 0x0032 MSNAudio 1461 0x0033 Antex Electronics ADPCME 1462 0x0034 Control Resources VQLPC 1463 0x0035 DSP Solutions DigiREAL 1464 0x0036 DSP Solutions DigiADPCM 1465 0x0037 Control Resources CR10 1466 0x0038 Natural MicroSystems VBXADPCM 1467 0x0039 Crystal Semiconductor IMA ADPCM 1468 0x003A EchoSC3 1469 0x003B Rockwell ADPCM 1470 0x003C Rockwell Digit LK 1471 0x003D Xebec 1472 0x0040 Antex Electronics G.721 ADPCM 1473 0x0041 G.728 CELP 1474 0x0042 MSG723 1475 0x0050 MPEG Layer-2 or Layer-1 1476 0x0052 RT24 1477 0x0053 PAC 1478 0x0055 MPEG Layer-3 1479 0x0059 Lucent G.723 1480 0x0060 Cirrus 1481 0x0061 ESPCM 1482 0x0062 Voxware 1483 0x0063 Canopus Atrac 1484 0x0064 G.726 ADPCM 1485 0x0065 G.722 ADPCM 1486 0x0066 DSAT 1487 0x0067 DSAT Display 1488 0x0069 Voxware Byte Aligned 1489 0x0070 Voxware AC8 1490 0x0071 Voxware AC10 1491 0x0072 Voxware AC16 1492 0x0073 Voxware AC20 1493 0x0074 Voxware MetaVoice 1494 0x0075 Voxware MetaSound 1495 0x0076 Voxware RT29HW 1496 0x0077 Voxware VR12 1497 0x0078 Voxware VR18 1498 0x0079 Voxware TQ40 1499 0x0080 Softsound 1500 0x0081 Voxware TQ60 1501 0x0082 MSRT24 1502 0x0083 G.729A 1503 0x0084 MVI MV12 1504 0x0085 DF G.726 1505 0x0086 DF GSM610 1506 0x0088 ISIAudio 1507 0x0089 Onlive 1508 0x0091 SBC24 1509 0x0092 Dolby AC3 SPDIF 1510 0x0093 MediaSonic G.723 1511 0x0094 Aculab PLC Prosody 8kbps 1512 0x0097 ZyXEL ADPCM 1513 0x0098 Philips LPCBB 1514 0x0099 Packed 1515 0x00FF AAC 1516 0x0100 Rhetorex ADPCM 1517 0x0101 IBM mu-law 1518 0x0102 IBM A-law 1519 0x0103 IBM AVC Adaptive Differential Pulse Code Modulation (ADPCM) 1520 0x0111 Vivo G.723 1521 0x0112 Vivo Siren 1522 0x0123 Digital G.723 1523 0x0125 Sanyo LD ADPCM 1524 0x0130 Sipro Lab Telecom ACELP NET 1525 0x0131 Sipro Lab Telecom ACELP 4800 1526 0x0132 Sipro Lab Telecom ACELP 8V3 1527 0x0133 Sipro Lab Telecom G.729 1528 0x0134 Sipro Lab Telecom G.729A 1529 0x0135 Sipro Lab Telecom Kelvin 1530 0x0140 Windows Media Video V8 1531 0x0150 Qualcomm PureVoice 1532 0x0151 Qualcomm HalfRate 1533 0x0155 Ring Zero Systems TUB GSM 1534 0x0160 Microsoft Audio 1 1535 0x0161 Windows Media Audio V7 / V8 / V9 1536 0x0162 Windows Media Audio Professional V9 1537 0x0163 Windows Media Audio Lossless V9 1538 0x0200 Creative Labs ADPCM 1539 0x0202 Creative Labs Fastspeech8 1540 0x0203 Creative Labs Fastspeech10 1541 0x0210 UHER Informatic GmbH ADPCM 1542 0x0220 Quarterdeck 1543 0x0230 I-link Worldwide VC 1544 0x0240 Aureal RAW Sport 1545 0x0250 Interactive Products HSX 1546 0x0251 Interactive Products RPELP 1547 0x0260 Consistent Software CS2 1548 0x0270 Sony SCX 1549 0x0300 Fujitsu FM Towns Snd 1550 0x0400 BTV Digital 1551 0x0401 Intel Music Coder 1552 0x0450 QDesign Music 1553 0x0680 VME VMPCM 1554 0x0681 AT&T Labs TPC 1555 0x08AE ClearJump LiteWave 1556 0x1000 Olivetti GSM 1557 0x1001 Olivetti ADPCM 1558 0x1002 Olivetti CELP 1559 0x1003 Olivetti SBC 1560 0x1004 Olivetti OPR 1561 0x1100 Lernout & Hauspie Codec (0x1100) 1562 0x1101 Lernout & Hauspie CELP Codec (0x1101) 1563 0x1102 Lernout & Hauspie SBC Codec (0x1102) 1564 0x1103 Lernout & Hauspie SBC Codec (0x1103) 1565 0x1104 Lernout & Hauspie SBC Codec (0x1104) 1566 0x1400 Norris 1567 0x1401 AT&T ISIAudio 1568 0x1500 Soundspace Music Compression 1569 0x181C VoxWare RT24 Speech 1570 0x1FC4 NCT Soft ALF2CD (www.nctsoft.com) 1571 0x2000 Dolby AC3 1572 0x2001 Dolby DTS 1573 0x2002 WAVE_FORMAT_14_4 1574 0x2003 WAVE_FORMAT_28_8 1575 0x2004 WAVE_FORMAT_COOK 1576 0x2005 WAVE_FORMAT_DNET 1577 0x674F Ogg Vorbis 1 1578 0x6750 Ogg Vorbis 2 1579 0x6751 Ogg Vorbis 3 1580 0x676F Ogg Vorbis 1+ 1581 0x6770 Ogg Vorbis 2+ 1582 0x6771 Ogg Vorbis 3+ 1583 0x7A21 GSM-AMR (CBR, no SID) 1584 0x7A22 GSM-AMR (VBR, including SID) 1585 0xFFFE WAVE_FORMAT_EXTENSIBLE 1586 0xFFFF WAVE_FORMAT_DEVELOPMENT 1587 1588 */ 1589 1590 return getid3_lib::EmbeddedLookup('0x'.str_pad(strtoupper(dechex($wFormatTag)), 4, '0', STR_PAD_LEFT), $begin, __LINE__, __FILE__, 'riff-wFormatTag'); 1591 1592 } 1593 1594 1595 function RIFFfourccLookup($fourcc) { 1596 1597 $begin = __LINE__; 1598 1599 /** This is not a comment! 1600 1601 swot http://developer.apple.com/qa/snd/snd07.html 1602 ____ No Codec (____) 1603 _BIT BI_BITFIELDS (Raw RGB) 1604 _JPG JPEG compressed 1605 _PNG PNG compressed W3C/ISO/IEC (RFC-2083) 1606 _RAW Full Frames (Uncompressed) 1607 _RGB Raw RGB Bitmap 1608 _RL4 RLE 4bpp RGB 1609 _RL8 RLE 8bpp RGB 1610 3IV1 3ivx MPEG-4 v1 1611 3IV2 3ivx MPEG-4 v2 1612 3IVX 3ivx MPEG-4 1613 AASC Autodesk Animator 1614 ABYR Kensington ?ABYR? 1615 AEMI Array Microsystems VideoONE MPEG1-I Capture 1616 AFLC Autodesk Animator FLC 1617 AFLI Autodesk Animator FLI 1618 AMPG Array Microsystems VideoONE MPEG 1619 ANIM Intel RDX (ANIM) 1620 AP41 AngelPotion Definitive 1621 ASV1 Asus Video v1 1622 ASV2 Asus Video v2 1623 ASVX Asus Video 2.0 (audio) 1624 AUR2 AuraVision Aura 2 Codec - YUV 4:2:2 1625 AURA AuraVision Aura 1 Codec - YUV 4:1:1 1626 AVDJ Independent JPEG Group\'s codec (AVDJ) 1627 AVRN Independent JPEG Group\'s codec (AVRN) 1628 AYUV 4:4:4 YUV (AYUV) 1629 AZPR Quicktime Apple Video (AZPR) 1630 BGR Raw RGB32 1631 BLZ0 Blizzard DivX MPEG-4 1632 BTVC Conexant Composite Video 1633 BINK RAD Game Tools Bink Video 1634 BT20 Conexant Prosumer Video 1635 BTCV Conexant Composite Video Codec 1636 BW10 Data Translation Broadway MPEG Capture 1637 CC12 Intel YUV12 1638 CDVC Canopus DV 1639 CFCC Digital Processing Systems DPS Perception 1640 CGDI Microsoft Office 97 Camcorder Video 1641 CHAM Winnov Caviara Champagne 1642 CJPG Creative WebCam JPEG 1643 CLJR Cirrus Logic YUV 4:1:1 1644 CMYK Common Data Format in Printing (Colorgraph) 1645 CPLA Weitek 4:2:0 YUV Planar 1646 CRAM Microsoft Video 1 (CRAM) 1647 cvid Radius Cinepak 1648 CVID Radius Cinepak 1649 CWLT Microsoft Color WLT DIB 1650 CYUV Creative Labs YUV 1651 CYUY ATI YUV 1652 D261 H.261 1653 D263 H.263 1654 DIB Device Independent Bitmap 1655 DIV1 FFmpeg OpenDivX 1656 DIV2 Microsoft MPEG-4 v1/v2 1657 DIV3 DivX ;-) MPEG-4 v3.x Low-Motion 1658 DIV4 DivX ;-) MPEG-4 v3.x Fast-Motion 1659 DIV5 DivX MPEG-4 v5.x 1660 DIV6 DivX ;-) (MS MPEG-4 v3.x) 1661 DIVX DivX MPEG-4 v4 (OpenDivX / Project Mayo) 1662 divx DivX MPEG-4 1663 DMB1 Matrox Rainbow Runner hardware MJPEG 1664 DMB2 Paradigm MJPEG 1665 DSVD ?DSVD? 1666 DUCK Duck TrueMotion 1.0 1667 DPS0 DPS/Leitch Reality Motion JPEG 1668 DPSC DPS/Leitch PAR Motion JPEG 1669 DV25 Matrox DVCPRO codec 1670 DV50 Matrox DVCPRO50 codec 1671 DVC IEC 61834 and SMPTE 314M (DVC/DV Video) 1672 DVCP IEC 61834 and SMPTE 314M (DVC/DV Video) 1673 DVHD IEC Standard DV 1125 lines @ 30fps / 1250 lines @ 25fps 1674 DVMA Darim Vision DVMPEG (dummy for MPEG compressor) (www.darvision.com) 1675 DVSL IEC Standard DV compressed in SD (SDL) 1676 DVAN ?DVAN? 1677 DVE2 InSoft DVE-2 Videoconferencing 1678 dvsd IEC 61834 and SMPTE 314M DVC/DV Video 1679 DVSD IEC 61834 and SMPTE 314M DVC/DV Video 1680 DVX1 Lucent DVX1000SP Video Decoder 1681 DVX2 Lucent DVX2000S Video Decoder 1682 DVX3 Lucent DVX3000S Video Decoder 1683 DX50 DivX v5 1684 DXT1 Microsoft DirectX Compressed Texture (DXT1) 1685 DXT2 Microsoft DirectX Compressed Texture (DXT2) 1686 DXT3 Microsoft DirectX Compressed Texture (DXT3) 1687 DXT4 Microsoft DirectX Compressed Texture (DXT4) 1688 DXT5 Microsoft DirectX Compressed Texture (DXT5) 1689 DXTC Microsoft DirectX Compressed Texture (DXTC) 1690 DXTn Microsoft DirectX Compressed Texture (DXTn) 1691 EM2V Etymonix MPEG-2 I-frame (www.etymonix.com) 1692 EKQ0 Elsa ?EKQ0? 1693 ELK0 Elsa ?ELK0? 1694 ESCP Eidos Escape 1695 ETV1 eTreppid Video ETV1 1696 ETV2 eTreppid Video ETV2 1697 ETVC eTreppid Video ETVC 1698 FLIC Autodesk FLI/FLC Animation 1699 FRWT Darim Vision Forward Motion JPEG (www.darvision.com) 1700 FRWU Darim Vision Forward Uncompressed (www.darvision.com) 1701 FLJP D-Vision Field Encoded Motion JPEG 1702 FRWA SoftLab-Nsk Forward Motion JPEG w/ alpha channel 1703 FRWD SoftLab-Nsk Forward Motion JPEG 1704 FVF1 Iterated Systems Fractal Video Frame 1705 GLZW Motion LZW (gabest@freemail.hu) 1706 GPEG Motion JPEG (gabest@freemail.hu) 1707 GWLT Microsoft Greyscale WLT DIB 1708 H260 Intel ITU H.260 Videoconferencing 1709 H261 Intel ITU H.261 Videoconferencing 1710 H262 Intel ITU H.262 Videoconferencing 1711 H263 Intel ITU H.263 Videoconferencing 1712 H264 Intel ITU H.264 Videoconferencing 1713 H265 Intel ITU H.265 Videoconferencing 1714 H266 Intel ITU H.266 Videoconferencing 1715 H267 Intel ITU H.267 Videoconferencing 1716 H268 Intel ITU H.268 Videoconferencing 1717 H269 Intel ITU H.269 Videoconferencing 1718 HFYU Huffman Lossless Codec 1719 HMCR Rendition Motion Compensation Format (HMCR) 1720 HMRR Rendition Motion Compensation Format (HMRR) 1721 I263 FFmpeg I263 decoder 1722 IF09 Indeo YVU9 ("YVU9 with additional delta-frame info after the U plane") 1723 IUYV Interlaced version of UYVY (www.leadtools.com) 1724 IY41 Interlaced version of Y41P (www.leadtools.com) 1725 IYU1 12 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec IEEE standard 1726 IYU2 24 bit format used in mode 2 of the IEEE 1394 Digital Camera 1.04 spec IEEE standard 1727 IYUV Planar YUV format (8-bpp Y plane, followed by 8-bpp 2×2 U and V planes) 1728 i263 Intel ITU H.263 Videoconferencing (i263) 1729 I420 Intel Indeo 4 1730 IAN Intel Indeo 4 (RDX) 1731 ICLB InSoft CellB Videoconferencing 1732 IGOR Power DVD 1733 IJPG Intergraph JPEG 1734 ILVC Intel Layered Video 1735 ILVR ITU-T H.263+ 1736 IPDV I-O Data Device Giga AVI DV Codec 1737 IR21 Intel Indeo 2.1 1738 IRAW Intel YUV Uncompressed 1739 IV30 Intel Indeo 3.0 1740 IV31 Intel Indeo 3.1 1741 IV32 Ligos Indeo 3.2 1742 IV33 Ligos Indeo 3.3 1743 IV34 Ligos Indeo 3.4 1744 IV35 Ligos Indeo 3.5 1745 IV36 Ligos Indeo 3.6 1746 IV37 Ligos Indeo 3.7 1747 IV38 Ligos Indeo 3.8 1748 IV39 Ligos Indeo 3.9 1749 IV40 Ligos Indeo Interactive 4.0 1750 IV41 Ligos Indeo Interactive 4.1 1751 IV42 Ligos Indeo Interactive 4.2 1752 IV43 Ligos Indeo Interactive 4.3 1753 IV44 Ligos Indeo Interactive 4.4 1754 IV45 Ligos Indeo Interactive 4.5 1755 IV46 Ligos Indeo Interactive 4.6 1756 IV47 Ligos Indeo Interactive 4.7 1757 IV48 Ligos Indeo Interactive 4.8 1758 IV49 Ligos Indeo Interactive 4.9 1759 IV50 Ligos Indeo Interactive 5.0 1760 JBYR Kensington ?JBYR? 1761 JPEG Still Image JPEG DIB 1762 JPGL Pegasus Lossless Motion JPEG 1763 KMVC Team17 Software Karl Morton\'s Video Codec 1764 LSVM Vianet Lighting Strike Vmail (Streaming) (www.vianet.com) 1765 LEAD LEAD Video Codec 1766 Ljpg LEAD MJPEG Codec 1767 MDVD Alex MicroDVD Video (hacked MS MPEG-4) (www.tiasoft.de) 1768 MJPA Morgan Motion JPEG (MJPA) (www.morgan-multimedia.com) 1769 MJPB Morgan Motion JPEG (MJPB) (www.morgan-multimedia.com) 1770 MMES Matrox MPEG-2 I-frame 1771 MP2v Microsoft S-Mpeg 4 version 1 (MP2v) 1772 MP42 Microsoft S-Mpeg 4 version 2 (MP42) 1773 MP43 Microsoft S-Mpeg 4 version 3 (MP43) 1774 MP4S Microsoft S-Mpeg 4 version 3 (MP4S) 1775 MP4V FFmpeg MPEG-4 1776 MPG1 FFmpeg MPEG 1/2 1777 MPG2 FFmpeg MPEG 1/2 1778 MPG3 FFmpeg DivX ;-) (MS MPEG-4 v3) 1779 MPG4 Microsoft MPEG-4 1780 MPGI Sigma Designs MPEG 1781 MPNG PNG images decoder 1782 MSS1 Microsoft Windows Screen Video 1783 MSZH LCL (Lossless Codec Library) (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm) 1784 M261 Microsoft H.261 1785 M263 Microsoft H.263 1786 M4S2 Microsoft Fully Compliant MPEG-4 v2 simple profile (M4S2) 1787 m4s2 Microsoft Fully Compliant MPEG-4 v2 simple profile (m4s2) 1788 MC12 ATI Motion Compensation Format (MC12) 1789 MCAM ATI Motion Compensation Format (MCAM) 1790 MJ2C Morgan Multimedia Motion JPEG2000 1791 mJPG IBM Motion JPEG w/ Huffman Tables 1792 MJPG Microsoft Motion JPEG DIB 1793 MP42 Microsoft MPEG-4 (low-motion) 1794 MP43 Microsoft MPEG-4 (fast-motion) 1795 MP4S Microsoft MPEG-4 (MP4S) 1796 mp4s Microsoft MPEG-4 (mp4s) 1797 MPEG Chromatic Research MPEG-1 Video I-Frame 1798 MPG4 Microsoft MPEG-4 Video High Speed Compressor 1799 MPGI Sigma Designs MPEG 1800 MRCA FAST Multimedia Martin Regen Codec 1801 MRLE Microsoft Run Length Encoding 1802 MSVC Microsoft Video 1 1803 MTX1 Matrox ?MTX1? 1804 MTX2 Matrox ?MTX2? 1805 MTX3 Matrox ?MTX3? 1806 MTX4 Matrox ?MTX4? 1807 MTX5 Matrox ?MTX5? 1808 MTX6 Matrox ?MTX6? 1809 MTX7 Matrox ?MTX7? 1810 MTX8 Matrox ?MTX8? 1811 MTX9 Matrox ?MTX9? 1812 MV12 Motion Pixels Codec (old) 1813 MWV1 Aware Motion Wavelets 1814 nAVI SMR Codec (hack of Microsoft MPEG-4) (IRC #shadowrealm) 1815 NT00 NewTek LightWave HDTV YUV w/ Alpha (www.newtek.com) 1816 NUV1 NuppelVideo 1817 NTN1 Nogatech Video Compression 1 1818 NVS0 nVidia GeForce Texture (NVS0) 1819 NVS1 nVidia GeForce Texture (NVS1) 1820 NVS2 nVidia GeForce Texture (NVS2) 1821 NVS3 nVidia GeForce Texture (NVS3) 1822 NVS4 nVidia GeForce Texture (NVS4) 1823 NVS5 nVidia GeForce Texture (NVS5) 1824 NVT0 nVidia GeForce Texture (NVT0) 1825 NVT1 nVidia GeForce Texture (NVT1) 1826 NVT2 nVidia GeForce Texture (NVT2) 1827 NVT3 nVidia GeForce Texture (NVT3) 1828 NVT4 nVidia GeForce Texture (NVT4) 1829 NVT5 nVidia GeForce Texture (NVT5) 1830 PIXL MiroXL, Pinnacle PCTV 1831 PDVC I-O Data Device Digital Video Capture DV codec 1832 PGVV Radius Video Vision 1833 PHMO IBM Photomotion 1834 PIM1 MPEG Realtime (Pinnacle Cards) 1835 PIM2 Pegasus Imaging ?PIM2? 1836 PIMJ Pegasus Imaging Lossless JPEG 1837 PVEZ Horizons Technology PowerEZ 1838 PVMM PacketVideo Corporation MPEG-4 1839 PVW2 Pegasus Imaging Wavelet Compression 1840 Q1.0 Q-Team\'s QPEG 1.0 (www.q-team.de) 1841 Q1.1 Q-Team\'s QPEG 1.1 (www.q-team.de) 1842 QPEG Q-Team QPEG 1.0 1843 qpeq Q-Team QPEG 1.1 1844 RGB Raw BGR32 1845 RGBA Raw RGB w/ Alpha 1846 RMP4 REALmagic MPEG-4 (unauthorized XVID copy) (www.sigmadesigns.com) 1847 ROQV Id RoQ File Video Decoder 1848 RPZA Quicktime Apple Video (RPZA) 1849 RUD0 Rududu video codec (http://rududu.ifrance.com/rududu/) 1850 RV10 RealVideo 1.0 (aka RealVideo 5.0) 1851 RV13 RealVideo 1.0 (RV13) 1852 RV20 RealVideo G2 1853 RV30 RealVideo 8 1854 RV40 RealVideo 9 1855 RGBT Raw RGB w/ Transparency 1856 RLE Microsoft Run Length Encoder 1857 RLE4 Run Length Encoded (4bpp, 16-color) 1858 RLE8 Run Length Encoded (8bpp, 256-color) 1859 RT21 Intel Indeo RealTime Video 2.1 1860 rv20 RealVideo G2 1861 rv30 RealVideo 8 1862 RVX Intel RDX (RVX ) 1863 SMC Apple Graphics (SMC ) 1864 SP54 Logitech Sunplus Sp54 Codec for Mustek GSmart Mini 2 1865 SPIG Radius Spigot 1866 SVQ3 Sorenson Video 3 (Apple Quicktime 5) 1867 s422 Tekram VideoCap C210 YUV 4:2:2 1868 SDCC Sun Communication Digital Camera Codec 1869 SFMC CrystalNet Surface Fitting Method 1870 SMSC Radius SMSC 1871 SMSD Radius SMSD 1872 smsv WorldConnect Wavelet Video 1873 SPIG Radius Spigot 1874 SPLC Splash Studios ACM Audio Codec (www.splashstudios.net) 1875 SQZ2 Microsoft VXTreme Video Codec V2 1876 STVA ST Microelectronics CMOS Imager Data (Bayer) 1877 STVB ST Microelectronics CMOS Imager Data (Nudged Bayer) 1878 STVC ST Microelectronics CMOS Imager Data (Bunched) 1879 STVX ST Microelectronics CMOS Imager Data (Extended CODEC Data Format) 1880 STVY ST Microelectronics CMOS Imager Data (Extended CODEC Data Format with Correction Data) 1881 SV10 Sorenson Video R1 1882 SVQ1 Sorenson Video 1883 T420 Toshiba YUV 4:2:0 1884 TM2A Duck TrueMotion Archiver 2.0 (www.duck.com) 1885 TVJP Pinnacle/Truevision Targa 2000 board (TVJP) 1886 TVMJ Pinnacle/Truevision Targa 2000 board (TVMJ) 1887 TY0N Tecomac Low-Bit Rate Codec (www.tecomac.com) 1888 TY2C Trident Decompression Driver 1889 TLMS TeraLogic Motion Intraframe Codec (TLMS) 1890 TLST TeraLogic Motion Intraframe Codec (TLST) 1891 TM20 Duck TrueMotion 2.0 1892 TM2X Duck TrueMotion 2X 1893 TMIC TeraLogic Motion Intraframe Codec (TMIC) 1894 TMOT Horizons Technology TrueMotion S 1895 tmot Horizons TrueMotion Video Compression 1896 TR20 Duck TrueMotion RealTime 2.0 1897 TSCC TechSmith Screen Capture Codec 1898 TV10 Tecomac Low-Bit Rate Codec 1899 TY2N Trident ?TY2N? 1900 U263 UB Video H.263/H.263+/H.263++ Decoder 1901 UMP4 UB Video MPEG 4 (www.ubvideo.com) 1902 UYNV Nvidia UYVY packed 4:2:2 1903 UYVP Evans & Sutherland YCbCr 4:2:2 extended precision 1904 UCOD eMajix.com ClearVideo 1905 ULTI IBM Ultimotion 1906 UYVY UYVY packed 4:2:2 1907 V261 Lucent VX2000S 1908 VIFP VFAPI Reader Codec (www.yks.ne.jp/~hori/) 1909 VIV1 FFmpeg H263+ decoder 1910 VIV2 Vivo H.263 1911 VQC2 Vector-quantised codec 2 (research) http://eprints.ecs.soton.ac.uk/archive/00001310/01/VTC97-js.pdf) 1912 VTLP Alaris VideoGramPiX 1913 VYU9 ATI YUV (VYU9) 1914 VYUY ATI YUV (VYUY) 1915 V261 Lucent VX2000S 1916 V422 Vitec Multimedia 24-bit YUV 4:2:2 Format 1917 V655 Vitec Multimedia 16-bit YUV 4:2:2 Format 1918 VCR1 ATI Video Codec 1 1919 VCR2 ATI Video Codec 2 1920 VCR3 ATI VCR 3.0 1921 VCR4 ATI VCR 4.0 1922 VCR5 ATI VCR 5.0 1923 VCR6 ATI VCR 6.0 1924 VCR7 ATI VCR 7.0 1925 VCR8 ATI VCR 8.0 1926 VCR9 ATI VCR 9.0 1927 VDCT Vitec Multimedia Video Maker Pro DIB 1928 VDOM VDOnet VDOWave 1929 VDOW VDOnet VDOLive (H.263) 1930 VDTZ Darim Vison VideoTizer YUV 1931 VGPX Alaris VideoGramPiX 1932 VIDS Vitec Multimedia YUV 4:2:2 CCIR 601 for V422 1933 VIVO Vivo H.263 v2.00 1934 vivo Vivo H.263 1935 VIXL Miro/Pinnacle Video XL 1936 VLV1 VideoLogic/PURE Digital Videologic Capture 1937 VP30 On2 VP3.0 1938 VP31 On2 VP3.1 1939 VX1K Lucent VX1000S Video Codec 1940 VX2K Lucent VX2000S Video Codec 1941 VXSP Lucent VX1000SP Video Codec 1942 WBVC Winbond W9960 1943 WHAM Microsoft Video 1 (WHAM) 1944 WINX Winnov Software Compression 1945 WJPG AverMedia Winbond JPEG 1946 WMV1 Windows Media Video V7 1947 WMV2 Windows Media Video V8 1948 WMV3 Windows Media Video V9 1949 WNV1 Winnov Hardware Compression 1950 XYZP Extended PAL format XYZ palette (www.riff.org) 1951 x263 Xirlink H.263 1952 XLV0 NetXL Video Decoder 1953 XMPG Xing MPEG (I-Frame only) 1954 XVID XviD MPEG-4 (www.xvid.org) 1955 XXAN ?XXAN? 1956 YU92 Intel YUV (YU92) 1957 YUNV Nvidia Uncompressed YUV 4:2:2 1958 YUVP Extended PAL format YUV palette (www.riff.org) 1959 Y211 YUV 2:1:1 Packed 1960 Y411 YUV 4:1:1 Packed 1961 Y41B Weitek YUV 4:1:1 Planar 1962 Y41P Brooktree PC1 YUV 4:1:1 Packed 1963 Y41T Brooktree PC1 YUV 4:1:1 with transparency 1964 Y42B Weitek YUV 4:2:2 Planar 1965 Y42T Brooktree UYUV 4:2:2 with transparency 1966 Y422 ADS Technologies Copy of UYVY used in Pyro WebCam firewire camera 1967 Y800 Simple, single Y plane for monochrome images 1968 Y8 Grayscale video 1969 YC12 Intel YUV 12 codec 1970 YUV8 Winnov Caviar YUV8 1971 YUV9 Intel YUV9 1972 YUY2 Uncompressed YUV 4:2:2 1973 YUYV Canopus YUV 1974 YV12 YVU12 Planar 1975 YVU9 Intel YVU9 Planar (8-bpp Y plane, followed by 8-bpp 4x4 U and V planes) 1976 YVYU YVYU 4:2:2 Packed 1977 ZLIB Lossless Codec Library zlib compression (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm) 1978 ZPEG Metheus Video Zipper 1979 1980 */ 1981 1982 return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); 1983 } 1984 1985 1986 function EitherEndian2Int(&$ThisFileInfo, $byteword, $signed=false) { 1987 if ($ThisFileInfo['fileformat'] == 'riff') { 1988 return getid3_lib::LittleEndian2Int($byteword, $signed); 1989 } 1990 return getid3_lib::BigEndian2Int($byteword, false, $signed); 1991 } 1992 1993 } 1994 1995 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
|