public function Analyze()
 {
     $getid3 = $this->getid3;
     $getid3->include_module('audio-video.riff');
     $getid3->info['wavpack'] = array();
     $info_wavpack =& $getid3->info['wavpack'];
     fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
     while (true) {
         $wavpack_header = fread($getid3->fp, 32);
         if (ftell($getid3->fp) >= $getid3->info['avdataend']) {
             break;
         } elseif (feof($getid3->fp)) {
             break;
         } elseif (@$info_wavpack_blockheader['total_samples'] > 0 && @$info_wavpack_blockheader['block_samples'] > 0 && (!isset($info_wavpack['riff_trailer_size']) || $info_wavpack['riff_trailer_size'] <= 0) && (@$info_wavpack['config_flags']['md5_checksum'] === false || !empty($getid3->info['md5_data_source']))) {
             break;
         }
         $block_header_offset = ftell($getid3->fp) - 32;
         $block_header_magic = substr($wavpack_header, 0, 4);
         $block_header_size = getid3_lib::LittleEndian2Int(substr($wavpack_header, 4, 4));
         if ($block_header_magic != 'wvpk') {
             throw new getid3_exception('Expecting "wvpk" at offset ' . $block_header_offset . ', found "' . $block_header_magic . '"');
         }
         if (@$info_wavpack_blockheader['block_samples'] <= 0 || @$info_wavpack_blockheader['total_samples'] <= 0) {
             // Also, it is possible that the first block might not have
             // any samples (block_samples == 0) and in this case you should skip blocks
             // until you find one with samples because the other information (like
             // total_samples) are not guaranteed to be correct until (block_samples > 0)
             // Finally, I have defined a format for files in which the length is not known
             // (for example when raw files are created using pipes). In these cases
             // total_samples will be -1 and you must seek to the final block to determine
             // the total number of samples.
             $getid3->info['audio']['dataformat'] = 'wavpack';
             $getid3->info['fileformat'] = 'wavpack';
             $getid3->info['audio']['lossless'] = true;
             $getid3->info['audio']['bitrate_mode'] = 'vbr';
             $info_wavpack['blockheader']['offset'] = $block_header_offset;
             $info_wavpack['blockheader']['magic'] = $block_header_magic;
             $info_wavpack['blockheader']['size'] = $block_header_size;
             $info_wavpack_blockheader =& $info_wavpack['blockheader'];
             if ($info_wavpack_blockheader['size'] >= 0x100000) {
                 throw new getid3_exception('Expecting WavPack block size less than "0x100000", found "' . $info_wavpack_blockheader['size'] . '" at offset ' . $info_wavpack_blockheader['offset']);
             }
             $info_wavpack_blockheader['minor_version'] = ord($wavpack_header[8]);
             $info_wavpack_blockheader['major_version'] = ord($wavpack_header[9]);
             if ($info_wavpack_blockheader['major_version'] != 4 || $info_wavpack_blockheader['minor_version'] < 4 && $info_wavpack_blockheader['minor_version'] > 16) {
                 throw new getid3_exception('Expecting WavPack version between "4.2" and "4.16", found version "' . $info_wavpack_blockheader['major_version'] . '.' . $info_wavpack_blockheader['minor_version'] . '" at offset ' . $info_wavpack_blockheader['offset']);
             }
             $info_wavpack_blockheader['track_number'] = ord($wavpack_header[10]);
             // unused
             $info_wavpack_blockheader['index_number'] = ord($wavpack_header[11]);
             // unused
             getid3_lib::ReadSequence('LittleEndian2Int', $info_wavpack_blockheader, $wavpack_header, 12, array('total_samples' => 4, 'block_index' => 4, 'block_samples' => 4, 'flags_raw' => 4, 'crc' => 4));
             $info_wavpack_blockheader['flags']['bytes_per_sample'] = 1 + ($info_wavpack_blockheader['flags_raw'] & 0x3);
             $info_wavpack_blockheader['flags']['mono'] = (bool) ($info_wavpack_blockheader['flags_raw'] & 0x4);
             $info_wavpack_blockheader['flags']['hybrid'] = (bool) ($info_wavpack_blockheader['flags_raw'] & 0x8);
             $info_wavpack_blockheader['flags']['joint_stereo'] = (bool) ($info_wavpack_blockheader['flags_raw'] & 0x10);
             $info_wavpack_blockheader['flags']['cross_decorrelation'] = (bool) ($info_wavpack_blockheader['flags_raw'] & 0x20);
             $info_wavpack_blockheader['flags']['hybrid_noiseshape'] = (bool) ($info_wavpack_blockheader['flags_raw'] & 0x40);
             $info_wavpack_blockheader['flags']['ieee_32bit_float'] = (bool) ($info_wavpack_blockheader['flags_raw'] & 0x80);
             $info_wavpack_blockheader['flags']['int_32bit'] = (bool) ($info_wavpack_blockheader['flags_raw'] & 0x100);
             $info_wavpack_blockheader['flags']['hybrid_bitrate_noise'] = (bool) ($info_wavpack_blockheader['flags_raw'] & 0x200);
             $info_wavpack_blockheader['flags']['hybrid_balance_noise'] = (bool) ($info_wavpack_blockheader['flags_raw'] & 0x400);
             $info_wavpack_blockheader['flags']['multichannel_initial'] = (bool) ($info_wavpack_blockheader['flags_raw'] & 0x800);
             $info_wavpack_blockheader['flags']['multichannel_final'] = (bool) ($info_wavpack_blockheader['flags_raw'] & 0x1000);
             $getid3->info['audio']['lossless'] = !$info_wavpack_blockheader['flags']['hybrid'];
         }
         while (!feof($getid3->fp) && ftell($getid3->fp) < $block_header_offset + $block_header_size + 8) {
             $metablock = array('offset' => ftell($getid3->fp));
             $metablockheader = fread($getid3->fp, 2);
             if (feof($getid3->fp)) {
                 break;
             }
             $metablock['id'] = ord($metablockheader[0]);
             $metablock['function_id'] = $metablock['id'] & 0x3f;
             $metablock['function_name'] = $this->WavPackMetablockNameLookup($metablock['function_id']);
             // The 0x20 bit in the id of the meta subblocks (which is defined as
             // ID_OPTIONAL_DATA) is a permanent part of the id. The idea is that
             // if a decoder encounters an id that it does not know about, it uses
             // that "ID_OPTIONAL_DATA" flag to determine what to do. If it is set
             // then the decoder simply ignores the metadata, but if it is zero
             // then the decoder should quit because it means that an understanding
             // of the metadata is required to correctly decode the audio.
             $metablock['non_decoder'] = (bool) ($metablock['id'] & 0x20);
             $metablock['padded_data'] = (bool) ($metablock['id'] & 0x40);
             $metablock['large_block'] = (bool) ($metablock['id'] & 0x80);
             if ($metablock['large_block']) {
                 $metablockheader .= fread($getid3->fp, 2);
             }
             $metablock['size'] = getid3_lib::LittleEndian2Int(substr($metablockheader, 1)) * 2;
             // size is stored in words
             $metablock['data'] = null;
             if ($metablock['size'] > 0) {
                 switch ($metablock['function_id']) {
                     case 0x21:
                         // ID_RIFF_HEADER
                     // ID_RIFF_HEADER
                     case 0x22:
                         // ID_RIFF_TRAILER
                     // ID_RIFF_TRAILER
                     case 0x23:
                         // ID_REPLAY_GAIN
                     // ID_REPLAY_GAIN
                     case 0x24:
                         // ID_CUESHEET
                     // ID_CUESHEET
                     case 0x25:
                         // ID_CONFIG_BLOCK
                     // ID_CONFIG_BLOCK
                     case 0x26:
                         // ID_MD5_CHECKSUM
                         $metablock['data'] = fread($getid3->fp, $metablock['size']);
                         if ($metablock['padded_data']) {
                             // padded to the nearest even byte
                             $metablock['size']--;
                             $metablock['data'] = substr($metablock['data'], 0, -1);
                         }
                         break;
                     case 0x0:
                         // ID_DUMMY
                     // ID_DUMMY
                     case 0x1:
                         // ID_ENCODER_INFO
                     // ID_ENCODER_INFO
                     case 0x2:
                         // ID_DECORR_TERMS
                     // ID_DECORR_TERMS
                     case 0x3:
                         // ID_DECORR_WEIGHTS
                     // ID_DECORR_WEIGHTS
                     case 0x4:
                         // ID_DECORR_SAMPLES
                     // ID_DECORR_SAMPLES
                     case 0x5:
                         // ID_ENTROPY_VARS
                     // ID_ENTROPY_VARS
                     case 0x6:
                         // ID_HYBRID_PROFILE
                     // ID_HYBRID_PROFILE
                     case 0x7:
                         // ID_SHAPING_WEIGHTS
                     // ID_SHAPING_WEIGHTS
                     case 0x8:
                         // ID_FLOAT_INFO
                     // ID_FLOAT_INFO
                     case 0x9:
                         // ID_INT32_INFO
                     // ID_INT32_INFO
                     case 0xa:
                         // ID_WV_BITSTREAM
                     // ID_WV_BITSTREAM
                     case 0xb:
                         // ID_WVC_BITSTREAM
                     // ID_WVC_BITSTREAM
                     case 0xc:
                         // ID_WVX_BITSTREAM
                     // ID_WVX_BITSTREAM
                     case 0xd:
                         // ID_CHANNEL_INFO
                         fseek($getid3->fp, $metablock['offset'] + ($metablock['large_block'] ? 4 : 2) + $metablock['size'], SEEK_SET);
                         break;
                     default:
                         $getid3->warning('Unexpected metablock type "0x' . str_pad(dechex($metablock['function_id']), 2, '0', STR_PAD_LEFT) . '" at offset ' . $metablock['offset']);
                         fseek($getid3->fp, $metablock['offset'] + ($metablock['large_block'] ? 4 : 2) + $metablock['size'], SEEK_SET);
                         break;
                 }
                 switch ($metablock['function_id']) {
                     case 0x21:
                         // ID_RIFF_HEADER
                         $original_wav_filesize = getid3_lib::LittleEndian2Int(substr($metablock['data'], 4, 4));
                         // Clone getid3
                         $clone = clone $getid3;
                         // Analyze clone by string
                         $riff = new getid3_riff($clone);
                         $riff->AnalyzeString($metablock['data']);
                         // Import from clone and destroy
                         $metablock['riff'] = $clone->info['riff'];
                         $getid3->warnings($clone->warnings());
                         unset($clone);
                         // Save RIFF header - we may need it later for RIFF footer parsing
                         $this->riff_header = $metablock['data'];
                         $metablock['riff']['original_filesize'] = $original_wav_filesize;
                         $info_wavpack['riff_trailer_size'] = $original_wav_filesize - $metablock['riff']['WAVE']['data'][0]['size'] - $metablock['riff']['header_size'];
                         $getid3->info['audio']['sample_rate'] = $metablock['riff']['raw']['fmt ']['nSamplesPerSec'];
                         $getid3->info['playtime_seconds'] = $info_wavpack_blockheader['total_samples'] / $getid3->info['audio']['sample_rate'];
                         // Safe RIFF header in case there's a RIFF footer later
                         $metablock_riff_header = $metablock['data'];
                         break;
                     case 0x22:
                         // ID_RIFF_TRAILER
                         $metablock_riff_footer = $metablock_riff_header . $metablock['data'];
                         $start_offset = $metablock['offset'] + ($metablock['large_block'] ? 4 : 2);
                         $ftell_old = ftell($getid3->fp);
                         // Clone getid3
                         $clone = clone $getid3;
                         // Call public method that really should be private
                         $riff = new getid3_riff($clone);
                         $metablock['riff'] = $riff->ParseRIFF($start_offset, $start_offset + $metablock['size']);
                         unset($clone);
                         fseek($getid3->fp, $ftell_old, SEEK_SET);
                         if (!empty($metablock['riff']['INFO'])) {
                             getid3_riff::RIFFCommentsParse($metablock['riff']['INFO'], $metablock['comments']);
                             $getid3->info['tags']['riff'] = $metablock['comments'];
                         }
                         break;
                     case 0x23:
                         // ID_REPLAY_GAIN
                         $getid3->warning('WavPack "Replay Gain" contents not yet handled by getID3() in metablock at offset ' . $metablock['offset']);
                         break;
                     case 0x24:
                         // ID_CUESHEET
                         $getid3->warning('WavPack "Cuesheet" contents not yet handled by getID3() in metablock at offset ' . $metablock['offset']);
                         break;
                     case 0x25:
                         // ID_CONFIG_BLOCK
                         $metablock['flags_raw'] = getid3_lib::LittleEndian2Int(substr($metablock['data'], 0, 3));
                         $metablock['flags']['adobe_mode'] = (bool) ($metablock['flags_raw'] & 0x1);
                         // "adobe" mode for 32-bit floats
                         $metablock['flags']['fast_flag'] = (bool) ($metablock['flags_raw'] & 0x2);
                         // fast mode
                         $metablock['flags']['very_fast_flag'] = (bool) ($metablock['flags_raw'] & 0x4);
                         // double fast
                         $metablock['flags']['high_flag'] = (bool) ($metablock['flags_raw'] & 0x8);
                         // high quality mode
                         $metablock['flags']['very_high_flag'] = (bool) ($metablock['flags_raw'] & 0x10);
                         // double high (not used yet)
                         $metablock['flags']['bitrate_kbps'] = (bool) ($metablock['flags_raw'] & 0x20);
                         // bitrate is kbps, not bits / sample
                         $metablock['flags']['auto_shaping'] = (bool) ($metablock['flags_raw'] & 0x40);
                         // automatic noise shaping
                         $metablock['flags']['shape_override'] = (bool) ($metablock['flags_raw'] & 0x80);
                         // shaping mode specified
                         $metablock['flags']['joint_override'] = (bool) ($metablock['flags_raw'] & 0x100);
                         // joint-stereo mode specified
                         $metablock['flags']['copy_time'] = (bool) ($metablock['flags_raw'] & 0x200);
                         // copy file-time from source
                         $metablock['flags']['create_exe'] = (bool) ($metablock['flags_raw'] & 0x400);
                         // create executable
                         $metablock['flags']['create_wvc'] = (bool) ($metablock['flags_raw'] & 0x800);
                         // create correction file
                         $metablock['flags']['optimize_wvc'] = (bool) ($metablock['flags_raw'] & 0x1000);
                         // maximize bybrid compression
                         $metablock['flags']['quality_mode'] = (bool) ($metablock['flags_raw'] & 0x2000);
                         // psychoacoustic quality mode
                         $metablock['flags']['raw_flag'] = (bool) ($metablock['flags_raw'] & 0x4000);
                         // raw mode (not implemented yet)
                         $metablock['flags']['calc_noise'] = (bool) ($metablock['flags_raw'] & 0x8000);
                         // calc noise in hybrid mode
                         $metablock['flags']['lossy_mode'] = (bool) ($metablock['flags_raw'] & 0x10000);
                         // obsolete (for information)
                         $metablock['flags']['extra_mode'] = (bool) ($metablock['flags_raw'] & 0x20000);
                         // extra processing mode
                         $metablock['flags']['skip_wvx'] = (bool) ($metablock['flags_raw'] & 0x40000);
                         // no wvx stream w/ floats & big ints
                         $metablock['flags']['md5_checksum'] = (bool) ($metablock['flags_raw'] & 0x80000);
                         // compute & store MD5 signature
                         $metablock['flags']['quiet_mode'] = (bool) ($metablock['flags_raw'] & 0x100000);
                         // don't report progress %
                         $info_wavpack['config_flags'] = $metablock['flags'];
                         $getid3->info['audio']['encoder_options'] = trim(($info_wavpack_blockheader['flags']['hybrid'] ? ' -b???' : '') . ($metablock['flags']['adobe_mode'] ? ' -a' : '') . ($metablock['flags']['optimize_wvc'] ? ' -cc' : '') . ($metablock['flags']['create_exe'] ? ' -e' : '') . ($metablock['flags']['fast_flag'] ? ' -f' : '') . ($metablock['flags']['joint_override'] ? ' -j?' : '') . ($metablock['flags']['high_flag'] ? ' -h' : '') . ($metablock['flags']['md5_checksum'] ? ' -m' : '') . ($metablock['flags']['calc_noise'] ? ' -n' : '') . ($metablock['flags']['shape_override'] ? ' -s?' : '') . ($metablock['flags']['extra_mode'] ? ' -x?' : ''));
                         if (!$getid3->info['audio']['encoder_options']) {
                             unset($getid3->info['audio']['encoder_options']);
                         }
                         break;
                     case 0x26:
                         // ID_MD5_CHECKSUM
                         if (strlen($metablock['data']) == 16) {
                             $getid3->info['md5_data_source'] = strtolower(getid3_lib::PrintHexBytes($metablock['data'], true, false, false));
                         } else {
                             $getid3->warning('Expecting 16 bytes of WavPack "MD5 Checksum" in metablock at offset ' . $metablock['offset'] . ', but found ' . strlen($metablock['data']) . ' bytes');
                         }
                         break;
                     case 0x0:
                         // ID_DUMMY
                     // ID_DUMMY
                     case 0x1:
                         // ID_ENCODER_INFO
                     // ID_ENCODER_INFO
                     case 0x2:
                         // ID_DECORR_TERMS
                     // ID_DECORR_TERMS
                     case 0x3:
                         // ID_DECORR_WEIGHTS
                     // ID_DECORR_WEIGHTS
                     case 0x4:
                         // ID_DECORR_SAMPLES
                     // ID_DECORR_SAMPLES
                     case 0x5:
                         // ID_ENTROPY_VARS
                     // ID_ENTROPY_VARS
                     case 0x6:
                         // ID_HYBRID_PROFILE
                     // ID_HYBRID_PROFILE
                     case 0x7:
                         // ID_SHAPING_WEIGHTS
                     // ID_SHAPING_WEIGHTS
                     case 0x8:
                         // ID_FLOAT_INFO
                     // ID_FLOAT_INFO
                     case 0x9:
                         // ID_INT32_INFO
                     // ID_INT32_INFO
                     case 0xa:
                         // ID_WV_BITSTREAM
                     // ID_WV_BITSTREAM
                     case 0xb:
                         // ID_WVC_BITSTREAM
                     // ID_WVC_BITSTREAM
                     case 0xc:
                         // ID_WVX_BITSTREAM
                     // ID_WVX_BITSTREAM
                     case 0xd:
                         // ID_CHANNEL_INFO
                         unset($metablock);
                         break;
                 }
             }
             if (!empty($metablock)) {
                 $info_wavpack['metablocks'][] = $metablock;
             }
         }
     }
     $getid3->info['audio']['encoder'] = 'WavPack v' . $info_wavpack_blockheader['major_version'] . '.' . str_pad($info_wavpack_blockheader['minor_version'], 2, '0', STR_PAD_LEFT);
     $getid3->info['audio']['bits_per_sample'] = $info_wavpack_blockheader['flags']['bytes_per_sample'] * 8;
     $getid3->info['audio']['channels'] = $info_wavpack_blockheader['flags']['mono'] ? 1 : 2;
     if (@$getid3->info['playtime_seconds']) {
         $getid3->info['audio']['bitrate'] = ($getid3->info['avdataend'] - $getid3->info['avdataoffset']) * 8 / $getid3->info['playtime_seconds'];
     } else {
         $getid3->info['audio']['dataformat'] = 'wvc';
     }
     return true;
 }
 public function Analyze()
 {
     $getid3 = $this->getid3;
     $getid3->info['riff']['raw'] = array();
     $info_riff =& $getid3->info['riff'];
     $info_riff_raw =& $info_riff['raw'];
     $info_audio =& $getid3->info['audio'];
     $info_video =& $getid3->info['video'];
     $info_avdataoffset =& $getid3->info['avdataoffset'];
     $info_avdataend =& $getid3->info['avdataend'];
     $info_audio_dataformat =& $info_audio['dataformat'];
     $info_riff_audio =& $info_riff['audio'];
     $info_riff_video =& $info_riff['video'];
     $original['avdataend'] = $info_avdataend;
     $this->fseek($info_avdataoffset, SEEK_SET);
     $riff_header = $this->fread(12);
     $riff_sub_type = substr($riff_header, 8, 4);
     switch (substr($riff_header, 0, 4)) {
         case 'FORM':
             $getid3->info['fileformat'] = 'aiff';
             $this->endian_function = 'BigEndian2Int';
             $riff_header_size = getid3_lib::BigEndian2Int(substr($riff_header, 4, 4));
             $info_riff[$riff_sub_type] = $this->ParseRIFF($info_avdataoffset + 12, $info_avdataoffset + $riff_header_size);
             $info_riff['header_size'] = $riff_header_size;
             break;
         case 'RIFF':
         case 'SDSS':
             // SDSS is identical to RIFF, just renamed. Used by SmartSound QuickTracks (www.smartsound.com)
         // SDSS is identical to RIFF, just renamed. Used by SmartSound QuickTracks (www.smartsound.com)
         case 'RMP3':
             // RMP3 is identical to RIFF, just renamed. Used by [unknown program] when creating RIFF-MP3s
             if ($riff_sub_type == 'RMP3') {
                 $riff_sub_type = 'WAVE';
             }
             $getid3->info['fileformat'] = 'riff';
             $this->endian_function = 'LittleEndian2Int';
             $riff_header_size = getid3_lib::LittleEndian2Int(substr($riff_header, 4, 4));
             $info_riff[$riff_sub_type] = $this->ParseRIFF($info_avdataoffset + 12, $info_avdataoffset + $riff_header_size);
             $info_riff['header_size'] = $riff_header_size;
             if ($riff_sub_type == 'WAVE') {
                 $info_riff_wave =& $info_riff['WAVE'];
             }
             break;
         default:
             throw new getid3_exception('Cannot parse RIFF (this is maybe not a RIFF / WAV / AVI file?) - expecting "FORM|RIFF|SDSS|RMP3" found "' . $riff_sub_type . '" instead');
     }
     $endian_function = $this->endian_function;
     $stream_index = 0;
     switch ($riff_sub_type) {
         case 'WAVE':
             if (empty($info_audio['bitrate_mode'])) {
                 $info_audio['bitrate_mode'] = 'cbr';
             }
             if (empty($info_audio_dataformat)) {
                 $info_audio_dataformat = 'wav';
             }
             if (isset($info_riff_wave['data'][0]['offset'])) {
                 $info_avdataoffset = $info_riff_wave['data'][0]['offset'] + 8;
                 $info_avdataend = $info_avdataoffset + $info_riff_wave['data'][0]['size'];
             }
             if (isset($info_riff_wave['fmt '][0]['data'])) {
                 $info_riff_audio[$stream_index] = getid3_riff::RIFFparseWAVEFORMATex($info_riff_wave['fmt '][0]['data']);
                 $info_audio['wformattag'] = $info_riff_audio[$stream_index]['raw']['wFormatTag'];
                 $info_riff_raw['fmt '] = $info_riff_audio[$stream_index]['raw'];
                 unset($info_riff_audio[$stream_index]['raw']);
                 $info_audio['streams'][$stream_index] = $info_riff_audio[$stream_index];
                 $info_audio = getid3_riff::array_merge_noclobber($info_audio, $info_riff_audio[$stream_index]);
                 if (substr($info_audio['codec'], 0, strlen('unknown: 0x')) == 'unknown: 0x') {
                     $getid3->warning('Audio codec = ' . $info_audio['codec']);
                 }
                 $info_audio['bitrate'] = $info_riff_audio[$stream_index]['bitrate'];
                 $getid3->info['playtime_seconds'] = (double) (($info_avdataend - $info_avdataoffset) * 8 / $info_audio['bitrate']);
                 $info_audio['lossless'] = false;
                 if (isset($info_riff_wave['data'][0]['offset']) && isset($info_riff_raw['fmt ']['wFormatTag'])) {
                     switch ($info_riff_raw['fmt ']['wFormatTag']) {
                         case 0x1:
                             // PCM
                             $info_audio['lossless'] = true;
                             break;
                         case 0x2000:
                             // AC-3
                             $info_audio_dataformat = 'ac3';
                             break;
                         default:
                             // do nothing
                             break;
                     }
                 }
                 $info_audio['streams'][$stream_index]['wformattag'] = $info_audio['wformattag'];
                 $info_audio['streams'][$stream_index]['bitrate_mode'] = $info_audio['bitrate_mode'];
                 $info_audio['streams'][$stream_index]['lossless'] = $info_audio['lossless'];
                 $info_audio['streams'][$stream_index]['dataformat'] = $info_audio_dataformat;
             }
             if (isset($info_riff_wave['rgad'][0]['data'])) {
                 // shortcuts
                 $rgadData =& $info_riff_wave['rgad'][0]['data'];
                 $info_riff_raw['rgad'] = array('track' => array(), 'album' => array());
                 $info_riff_raw_rgad =& $info_riff_raw['rgad'];
                 $info_riff_raw_rgad_track =& $info_riff_raw_rgad['track'];
                 $info_riff_raw_rgad_album =& $info_riff_raw_rgad['album'];
                 $info_riff_raw_rgad['fPeakAmplitude'] = getid3_riff::BigEndian2Float(strrev(substr($rgadData, 0, 4)));
                 // LittleEndian2Float()
                 $info_riff_raw_rgad['nRadioRgAdjust'] = getid3_lib::$endian_function(substr($rgadData, 4, 2));
                 $info_riff_raw_rgad['nAudiophileRgAdjust'] = getid3_lib::$endian_function(substr($rgadData, 6, 2));
                 $n_track_rg_adjust_bit_string = str_pad(decbin($info_riff_raw_rgad['nRadioRgAdjust']), 16, '0', STR_PAD_LEFT);
                 $n_album_rg_adjust_bit_string = str_pad(decbin($info_riff_raw_rgad['nAudiophileRgAdjust']), 16, '0', STR_PAD_LEFT);
                 $info_riff_raw_rgad_track['name'] = bindec(substr($n_track_rg_adjust_bit_string, 0, 3));
                 $info_riff_raw_rgad_track['originator'] = bindec(substr($n_track_rg_adjust_bit_string, 3, 3));
                 $info_riff_raw_rgad_track['signbit'] = bindec($n_track_rg_adjust_bit_string[6]);
                 $info_riff_raw_rgad_track['adjustment'] = bindec(substr($n_track_rg_adjust_bit_string, 7, 9));
                 $info_riff_raw_rgad_album['name'] = bindec(substr($n_album_rg_adjust_bit_string, 0, 3));
                 $info_riff_raw_rgad_album['originator'] = bindec(substr($n_album_rg_adjust_bit_string, 3, 3));
                 $info_riff_raw_rgad_album['signbit'] = bindec($n_album_rg_adjust_bit_string[6]);
                 $info_riff_raw_rgad_album['adjustment'] = bindec(substr($n_album_rg_adjust_bit_string, 7, 9));
                 $info_riff['rgad']['peakamplitude'] = $info_riff_raw_rgad['fPeakAmplitude'];
                 if ($info_riff_raw_rgad_track['name'] != 0 && $info_riff_raw_rgad_track['originator'] != 0) {
                     $info_riff['rgad']['track']['name'] = getid3_lib_replaygain::NameLookup($info_riff_raw_rgad_track['name']);
                     $info_riff['rgad']['track']['originator'] = getid3_lib_replaygain::OriginatorLookup($info_riff_raw_rgad_track['originator']);
                     $info_riff['rgad']['track']['adjustment'] = getid3_lib_replaygain::AdjustmentLookup($info_riff_raw_rgad_track['adjustment'], $info_riff_raw_rgad_track['signbit']);
                 }
                 if ($info_riff_raw_rgad_album['name'] != 0 && $info_riff_raw_rgad_album['originator'] != 0) {
                     $info_riff['rgad']['album']['name'] = getid3_lib_replaygain::NameLookup($info_riff_raw_rgad_album['name']);
                     $info_riff['rgad']['album']['originator'] = getid3_lib_replaygain::OriginatorLookup($info_riff_raw_rgad_album['originator']);
                     $info_riff['rgad']['album']['adjustment'] = getid3_lib_replaygain::AdjustmentLookup($info_riff_raw_rgad_album['adjustment'], $info_riff_raw_rgad_album['signbit']);
                 }
             }
             if (isset($info_riff_wave['fact'][0]['data'])) {
                 $info_riff_raw['fact']['NumberOfSamples'] = getid3_lib::$endian_function(substr($info_riff_wave['fact'][0]['data'], 0, 4));
                 // This should be a good way of calculating exact playtime, but some sample files have had incorrect number of samples, so cannot use this method
                 // if (!empty($info_riff_raw['fmt ']['nSamplesPerSec'])) {
                 //     $getid3->info['playtime_seconds'] = (float)$info_riff_raw['fact']['NumberOfSamples'] / $info_riff_raw['fmt ']['nSamplesPerSec'];
                 // }
             }
             if (!empty($info_riff_raw['fmt ']['nAvgBytesPerSec'])) {
                 $info_audio['bitrate'] = (int) $info_riff_raw['fmt ']['nAvgBytesPerSec'] * 8;
             }
             if (isset($info_riff_wave['bext'][0]['data'])) {
                 $info_riff_wave_bext_0 =& $info_riff_wave['bext'][0];
                 getid3_lib::ReadSequence('LittleEndian2Int', $info_riff_wave_bext_0, $info_riff_wave_bext_0['data'], 0, array('title' => -256, 'author' => -32, 'reference' => -32, 'origin_date' => -10, 'origin_time' => -8, 'time_reference' => 8, 'bwf_version' => 1, 'reserved' => 254));
                 foreach (array('title', 'author', 'reference') as $key) {
                     $info_riff_wave_bext_0[$key] = trim($info_riff_wave_bext_0[$key]);
                 }
                 $info_riff_wave_bext_0['coding_history'] = explode("\r\n", trim(substr($info_riff_wave_bext_0['data'], 601)));
                 $info_riff_wave_bext_0['origin_date_unix'] = gmmktime(substr($info_riff_wave_bext_0['origin_time'], 0, 2), substr($info_riff_wave_bext_0['origin_time'], 3, 2), substr($info_riff_wave_bext_0['origin_time'], 6, 2), substr($info_riff_wave_bext_0['origin_date'], 5, 2), substr($info_riff_wave_bext_0['origin_date'], 8, 2), substr($info_riff_wave_bext_0['origin_date'], 0, 4));
                 $info_riff['comments']['author'][] = $info_riff_wave_bext_0['author'];
                 $info_riff['comments']['title'][] = $info_riff_wave_bext_0['title'];
             }
             if (isset($info_riff_wave['MEXT'][0]['data'])) {
                 $info_riff_wave_mext_0 =& $info_riff_wave['MEXT'][0];
                 $info_riff_wave_mext_0['raw']['sound_information'] = getid3_lib::LittleEndian2Int(substr($info_riff_wave_mext_0['data'], 0, 2));
                 $info_riff_wave_mext_0['flags']['homogenous'] = (bool) ($info_riff_wave_mext_0['raw']['sound_information'] & 0x1);
                 if ($info_riff_wave_mext_0['flags']['homogenous']) {
                     $info_riff_wave_mext_0['flags']['padding'] = $info_riff_wave_mext_0['raw']['sound_information'] & 0x2 ? false : true;
                     $info_riff_wave_mext_0['flags']['22_or_44'] = (bool) ($info_riff_wave_mext_0['raw']['sound_information'] & 0x4);
                     $info_riff_wave_mext_0['flags']['free_format'] = (bool) ($info_riff_wave_mext_0['raw']['sound_information'] & 0x8);
                     $info_riff_wave_mext_0['nominal_frame_size'] = getid3_lib::LittleEndian2Int(substr($info_riff_wave_mext_0['data'], 2, 2));
                 }
                 $info_riff_wave_mext_0['anciliary_data_length'] = getid3_lib::LittleEndian2Int(substr($info_riff_wave_mext_0['data'], 6, 2));
                 $info_riff_wave_mext_0['raw']['anciliary_data_def'] = getid3_lib::LittleEndian2Int(substr($info_riff_wave_mext_0['data'], 8, 2));
                 $info_riff_wave_mext_0['flags']['anciliary_data_left'] = (bool) ($info_riff_wave_mext_0['raw']['anciliary_data_def'] & 0x1);
                 $info_riff_wave_mext_0['flags']['anciliary_data_free'] = (bool) ($info_riff_wave_mext_0['raw']['anciliary_data_def'] & 0x2);
                 $info_riff_wave_mext_0['flags']['anciliary_data_right'] = (bool) ($info_riff_wave_mext_0['raw']['anciliary_data_def'] & 0x4);
             }
             if (isset($info_riff_wave['cart'][0]['data'])) {
                 $info_riff_wave_cart_0 =& $info_riff_wave['cart'][0];
                 getid3_lib::ReadSequence('LittleEndian2Int', $info_riff_wave_cart_0, $info_riff_wave_cart_0['data'], 0, array('version' => -4, 'title' => -64, 'artist' => -64, 'cut_id' => -64, 'client_id' => -64, 'category' => -64, 'classification' => -64, 'out_cue' => -64, 'start_date' => -10, 'start_time' => -8, 'end_date' => -10, 'end_time' => -8, 'producer_app_id' => -64, 'producer_app_version' => -64, 'user_defined_text' => -64));
                 foreach (array('artist', 'cut_id', 'client_id', 'category', 'classification', 'out_cue', 'start_date', 'start_time', 'end_date', 'end_time', 'producer_app_id', 'producer_app_version', 'user_defined_text') as $key) {
                     $info_riff_wave_cart_0[$key] = trim($info_riff_wave_cart_0[$key]);
                 }
                 $info_riff_wave_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($info_riff_wave_cart_0['data'], 680, 4), true);
                 for ($i = 0; $i < 8; $i++) {
                     $info_riff_wave_cart_0['post_time'][$i]['usage_fourcc'] = substr($info_riff_wave_cart_0['data'], 684 + $i * 8, 4);
                     $info_riff_wave_cart_0['post_time'][$i]['timer_value'] = getid3_lib::LittleEndian2Int(substr($info_riff_wave_cart_0['data'], 684 + $i * 8 + 4, 4));
                 }
                 $info_riff_wave_cart_0['url'] = trim(substr($info_riff_wave_cart_0['data'], 748, 1024));
                 $info_riff_wave_cart_0['tag_text'] = explode("\r\n", trim(substr($info_riff_wave_cart_0['data'], 1772)));
                 $info_riff['comments']['artist'][] = $info_riff_wave_cart_0['artist'];
                 $info_riff['comments']['title'][] = $info_riff_wave_cart_0['title'];
             }
             if (!isset($info_audio['bitrate']) && isset($info_riff_audio[$stream_index]['bitrate'])) {
                 $info_audio['bitrate'] = $info_riff_audio[$stream_index]['bitrate'];
                 $getid3->info['playtime_seconds'] = (double) (($info_avdataend - $info_avdataoffset) * 8 / $info_audio['bitrate']);
             }
             if (@$getid3->info['wavpack']) {
                 if (!$this->data_string_flag) {
                     $info_audio_dataformat = 'wavpack';
                     $info_audio['bitrate_mode'] = 'vbr';
                     $info_audio['encoder'] = 'WavPack v' . $getid3->info['wavpack']['version'];
                     // Reset to the way it was - RIFF parsing will have messed this up
                     $info_avdataend = $original['avdataend'];
                     $info_audio['bitrate'] = ($info_avdataend - $info_avdataoffset) * 8 / $getid3->info['playtime_seconds'];
                     $this->fseek($info_avdataoffset - 44, SEEK_SET);
                     $riff_data = $this->fread(44);
                     $orignal_riff_header_size = getid3_lib::LittleEndian2Int(substr($riff_data, 4, 4)) + 8;
                     $orignal_riff_data_size = getid3_lib::LittleEndian2Int(substr($riff_data, 40, 4)) + 44;
                     if ($orignal_riff_header_size > $orignal_riff_data_size) {
                         $info_avdataend -= $orignal_riff_header_size - $orignal_riff_data_size;
                         $this->fseek($info_avdataend, SEEK_SET);
                         $riff_data .= $this->fread($orignal_riff_header_size - $orignal_riff_data_size);
                     }
                     // move the data chunk after all other chunks (if any)
                     // so that the RIFF parser doesn't see EOF when trying
                     // to skip over the data chunk
                     $riff_data = substr($riff_data, 0, 36) . substr($riff_data, 44) . substr($riff_data, 36, 8);
                     // Save audio info key
                     $saved_info_audio = $info_audio;
                     // Analyze riff_data
                     $this->AnalyzeString($riff_data);
                     // Restore info key
                     $info_audio = $saved_info_audio;
                 }
             }
             if (isset($info_riff_raw['fmt ']['wFormatTag'])) {
                 switch ($info_riff_raw['fmt ']['wFormatTag']) {
                     case 0x8ae:
                         // ClearJump LiteWave
                         $info_audio['bitrate_mode'] = 'vbr';
                         $info_audio_dataformat = 'litewave';
                         //typedef struct tagSLwFormat {
                         //  WORD    m_wCompFormat;     // low byte defines compression method, high byte is compression flags
                         //  DWORD   m_dwScale;         // scale factor for lossy compression
                         //  DWORD   m_dwBlockSize;     // number of samples in encoded blocks
                         //  WORD    m_wQuality;        // alias for the scale factor
                         //  WORD    m_wMarkDistance;   // distance between marks in bytes
                         //  WORD    m_wReserved;
                         //
                         //  //following paramters are ignored if CF_FILESRC is not set
                         //  DWORD   m_dwOrgSize;       // original file size in bytes
                         //  WORD    m_bFactExists;     // indicates if 'fact' chunk exists in the original file
                         //  DWORD   m_dwRiffChunkSize; // riff chunk size in the original file
                         //
                         //  PCMWAVEFORMAT m_OrgWf;     // original wave format
                         // }SLwFormat, *PSLwFormat;
                         $info_riff['litewave']['raw'] = array();
                         $info_riff_litewave =& $info_riff['litewave'];
                         $info_riff_litewave_raw =& $info_riff_litewave['raw'];
                         getid3_lib::ReadSequence('LittleEndian2Int', $info_riff_litewave_raw, $info_riff_wave['fmt '][0]['data'], 18, array('compression_method' => 1, 'compression_flags' => 1, 'm_dwScale' => 4, 'm_dwBlockSize' => 4, 'm_wQuality' => 2, 'm_wMarkDistance' => 2, 'm_wReserved' => 2, 'm_dwOrgSize' => 4, 'm_bFactExists' => 2, 'm_dwRiffChunkSize' => 4));
                         //$info_riff_litewave['quality_factor'] = intval(round((2000 - $info_riff_litewave_raw['m_dwScale']) / 20));
                         $info_riff_litewave['quality_factor'] = $info_riff_litewave_raw['m_wQuality'];
                         $info_riff_litewave['flags']['raw_source'] = $info_riff_litewave_raw['compression_flags'] & 0x1 ? false : true;
                         $info_riff_litewave['flags']['vbr_blocksize'] = $info_riff_litewave_raw['compression_flags'] & 0x2 ? false : true;
                         $info_riff_litewave['flags']['seekpoints'] = (bool) ($info_riff_litewave_raw['compression_flags'] & 0x4);
                         $info_audio['lossless'] = $info_riff_litewave_raw['m_wQuality'] == 100 ? true : false;
                         $info_audio['encoder_options'] = '-q' . $info_riff_litewave['quality_factor'];
                         break;
                 }
             }
             if ($info_avdataend > $getid3->info['filesize']) {
                 switch (@$info_audio_dataformat) {
                     case 'wavpack':
                         // WavPack
                     // WavPack
                     case 'lpac':
                         // LPAC
                     // LPAC
                     case 'ofr':
                         // OptimFROG
                     // OptimFROG
                     case 'ofs':
                         // OptimFROG DualStream
                         // lossless compressed audio formats that keep original RIFF headers - skip warning
                         break;
                     case 'litewave':
                         if ($info_avdataend - $getid3->info['filesize'] == 1) {
                             // LiteWave appears to incorrectly *not* pad actual output file
                             // to nearest WORD boundary so may appear to be short by one
                             // byte, in which case - skip warning
                         } else {
                             // Short by more than one byte, throw warning
                             $getid3->warning('Probably truncated file - expecting ' . $info_riff[$riff_sub_type]['data'][0]['size'] . ' bytes of data, only found ' . ($getid3->info['filesize'] - $info_avdataoffset) . ' (short by ' . ($info_riff[$riff_sub_type]['data'][0]['size'] - ($getid3->info['filesize'] - $info_avdataoffset)) . ' bytes)');
                         }
                         break;
                     default:
                         if ($info_avdataend - $getid3->info['filesize'] == 1 && $info_riff[$riff_sub_type]['data'][0]['size'] % 2 == 0 && ($getid3->info['filesize'] - $info_avdataoffset) % 2 == 1) {
                             // output file appears to be incorrectly *not* padded to nearest WORD boundary
                             // Output less severe warning
                             $getid3->warning('File should probably be padded to nearest WORD boundary, but it is not (expecting ' . $info_riff[$riff_sub_type]['data'][0]['size'] . ' bytes of data, only found ' . ($getid3->info['filesize'] - $info_avdataoffset) . ' therefore short by ' . ($info_riff[$riff_sub_type]['data'][0]['size'] - ($getid3->info['filesize'] - $info_avdataoffset)) . ' bytes)');
                             $info_avdataend = $getid3->info['filesize'];
                             break;
                         }
                         // Short by more than one byte, throw warning
                         $getid3->warning('Probably truncated file - expecting ' . $info_riff[$riff_sub_type]['data'][0]['size'] . ' bytes of data, only found ' . ($getid3->info['filesize'] - $info_avdataoffset) . ' (short by ' . ($info_riff[$riff_sub_type]['data'][0]['size'] - ($getid3->info['filesize'] - $info_avdataoffset)) . ' bytes)');
                         $info_avdataend = $getid3->info['filesize'];
                         break;
                 }
             }
             if (!empty($getid3->info['mpeg']['audio']['LAME']['audio_bytes'])) {
                 if ($info_avdataend - $info_avdataoffset - $getid3->info['mpeg']['audio']['LAME']['audio_bytes'] == 1) {
                     $info_avdataend--;
                     $getid3->warning('Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored');
                 }
             }
             if (@$info_audio_dataformat == 'ac3') {
                 unset($info_audio['bits_per_sample']);
                 if (!empty($getid3->info['ac3']['bitrate']) && $getid3->info['ac3']['bitrate'] != $info_audio['bitrate']) {
                     $info_audio['bitrate'] = $getid3->info['ac3']['bitrate'];
                 }
             }
             break;
         case 'AVI ':
             $info_video['bitrate_mode'] = 'vbr';
             // maybe not, but probably
             $info_video['dataformat'] = 'avi';
             $getid3->info['mime_type'] = 'video/avi';
             if (isset($info_riff[$riff_sub_type]['movi']['offset'])) {
                 $info_avdataoffset = $info_riff[$riff_sub_type]['movi']['offset'] + 8;
                 $info_avdataend = $info_avdataoffset + $info_riff[$riff_sub_type]['movi']['size'];
                 if ($info_avdataend > $getid3->info['filesize']) {
                     $getid3->warning('Probably truncated file - expecting ' . $info_riff[$riff_sub_type]['movi']['size'] . ' bytes of data, only found ' . ($getid3->info['filesize'] - $info_avdataoffset) . ' (short by ' . ($info_riff[$riff_sub_type]['movi']['size'] - ($getid3->info['filesize'] - $info_avdataoffset)) . ' bytes)');
                     $info_avdataend = $getid3->info['filesize'];
                 }
             }
             if (isset($info_riff['AVI ']['hdrl']['avih'][$stream_index]['data'])) {
                 $avihData = $info_riff['AVI ']['hdrl']['avih'][$stream_index]['data'];
                 $info_riff_raw['avih'] = array();
                 $info_riff_raw_avih =& $info_riff_raw['avih'];
                 getid3_lib::ReadSequence($this->endian_function, $info_riff_raw_avih, $avihData, 0, array('dwMicroSecPerFrame' => 4, 'dwMaxBytesPerSec' => 4, 'dwPaddingGranularity' => 4, 'dwFlags' => 4, 'dwTotalFrames' => 4, 'dwInitialFrames' => 4, 'dwStreams' => 4, 'dwSuggestedBufferSize' => 4, 'dwWidth' => 4, 'dwHeight' => 4, 'dwScale' => 4, 'dwRate' => 4, 'dwStart' => 4, 'dwLength' => 4));
                 $info_riff_raw_avih['flags']['hasindex'] = (bool) ($info_riff_raw_avih['dwFlags'] & 0x10);
                 $info_riff_raw_avih['flags']['mustuseindex'] = (bool) ($info_riff_raw_avih['dwFlags'] & 0x20);
                 $info_riff_raw_avih['flags']['interleaved'] = (bool) ($info_riff_raw_avih['dwFlags'] & 0x100);
                 $info_riff_raw_avih['flags']['trustcktype'] = (bool) ($info_riff_raw_avih['dwFlags'] & 0x800);
                 $info_riff_raw_avih['flags']['capturedfile'] = (bool) ($info_riff_raw_avih['dwFlags'] & 0x10000);
                 $info_riff_raw_avih['flags']['copyrighted'] = (bool) ($info_riff_raw_avih['dwFlags'] & 0x20010);
                 $info_riff_video[$stream_index] = array();
                 $info_riff_video_current =& $info_riff_video[$stream_index];
                 if ($info_riff_raw_avih['dwWidth'] > 0) {
                     $info_riff_video_current['frame_width'] = $info_riff_raw_avih['dwWidth'];
                     $info_video['resolution_x'] = $info_riff_video_current['frame_width'];
                 }
                 if ($info_riff_raw_avih['dwHeight'] > 0) {
                     $info_riff_video_current['frame_height'] = $info_riff_raw_avih['dwHeight'];
                     $info_video['resolution_y'] = $info_riff_video_current['frame_height'];
                 }
                 if ($info_riff_raw_avih['dwTotalFrames'] > 0) {
                     $info_riff_video_current['total_frames'] = $info_riff_raw_avih['dwTotalFrames'];
                     $info_video['total_frames'] = $info_riff_video_current['total_frames'];
                 }
                 $info_riff_video_current['frame_rate'] = round(1000000 / $info_riff_raw_avih['dwMicroSecPerFrame'], 3);
                 $info_video['frame_rate'] = $info_riff_video_current['frame_rate'];
             }
             if (isset($info_riff['AVI ']['hdrl']['strl']['strh'][0]['data'])) {
                 if (is_array($info_riff['AVI ']['hdrl']['strl']['strh'])) {
                     for ($i = 0; $i < count($info_riff['AVI ']['hdrl']['strl']['strh']); $i++) {
                         if (isset($info_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) {
                             $strh_data = $info_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'];
                             $strh_fcc_type = substr($strh_data, 0, 4);
                             if (isset($info_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) {
                                 $strf_data = $info_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'];
                                 // shortcut
                                 $info_riff_raw_strf_strh_fcc_type_stream_index =& $info_riff_raw['strf'][$strh_fcc_type][$stream_index];
                                 switch ($strh_fcc_type) {
                                     case 'auds':
                                         $info_audio['bitrate_mode'] = 'cbr';
                                         $info_audio_dataformat = 'wav';
                                         if (isset($info_riff_audio) && is_array($info_riff_audio)) {
                                             $stream_index = count($info_riff_audio);
                                         }
                                         $info_riff_audio[$stream_index] = getid3_riff::RIFFparseWAVEFORMATex($strf_data);
                                         $info_audio['wformattag'] = $info_riff_audio[$stream_index]['raw']['wFormatTag'];
                                         // shortcut
                                         $info_audio['streams'][$stream_index] = $info_riff_audio[$stream_index];
                                         $info_audio_streams_currentstream =& $info_audio['streams'][$stream_index];
                                         if (@$info_audio_streams_currentstream['bits_per_sample'] === 0) {
                                             unset($info_audio_streams_currentstream['bits_per_sample']);
                                         }
                                         $info_audio_streams_currentstream['wformattag'] = $info_audio_streams_currentstream['raw']['wFormatTag'];
                                         unset($info_audio_streams_currentstream['raw']);
                                         // shortcut
                                         $info_riff_raw['strf'][$strh_fcc_type][$stream_index] = $info_riff_audio[$stream_index]['raw'];
                                         unset($info_riff_audio[$stream_index]['raw']);
                                         $info_audio = getid3_riff::array_merge_noclobber($info_audio, $info_riff_audio[$stream_index]);
                                         $info_audio['lossless'] = false;
                                         switch ($info_riff_raw_strf_strh_fcc_type_stream_index['wFormatTag']) {
                                             case 0x1:
                                                 // PCM
                                                 $info_audio_dataformat = 'wav';
                                                 $info_audio['lossless'] = true;
                                                 break;
                                             case 0x50:
                                                 // MPEG Layer 2 or Layer 1
                                                 $info_audio_dataformat = 'mp2';
                                                 // Assume Layer-2
                                                 break;
                                             case 0x55:
                                                 // MPEG Layer 3
                                                 $info_audio_dataformat = 'mp3';
                                                 break;
                                             case 0xff:
                                                 // AAC
                                                 $info_audio_dataformat = 'aac';
                                                 break;
                                             case 0x161:
                                                 // Windows Media v7 / v8 / v9
                                             // Windows Media v7 / v8 / v9
                                             case 0x162:
                                                 // Windows Media Professional v9
                                             // Windows Media Professional v9
                                             case 0x163:
                                                 // Windows Media Lossess v9
                                                 $info_audio_dataformat = 'wma';
                                                 break;
                                             case 0x2000:
                                                 // AC-3
                                                 $info_audio_dataformat = 'ac3';
                                                 break;
                                             case 0x2001:
                                                 // DTS
                                                 $info_audio_dataformat = 'dts';
                                                 break;
                                             default:
                                                 $info_audio_dataformat = 'wav';
                                                 break;
                                         }
                                         $info_audio_streams_currentstream['dataformat'] = $info_audio_dataformat;
                                         $info_audio_streams_currentstream['lossless'] = $info_audio['lossless'];
                                         $info_audio_streams_currentstream['bitrate_mode'] = $info_audio['bitrate_mode'];
                                         break;
                                     case 'iavs':
                                     case 'vids':
                                         // shortcut
                                         $info_riff_raw['strh'][$i] = array();
                                         $info_riff_raw_strh_current =& $info_riff_raw['strh'][$i];
                                         getid3_lib::ReadSequence($this->endian_function, $info_riff_raw_strh_current, $strh_data, 0, array('fccType' => -4, 'fccHandler' => -4, 'dwFlags' => 4, 'wPriority' => 2, 'wLanguage' => 2, 'dwInitialFrames' => 4, 'dwScale' => 4, 'dwRate' => 4, 'dwStart' => 4, 'dwLength' => 4, 'dwSuggestedBufferSize' => 4, 'dwQuality' => 4, 'dwSampleSize' => 4, 'rcFrame' => 4));
                                         $info_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($info_riff_raw_strh_current['fccHandler']);
                                         $info_video['fourcc'] = $info_riff_raw_strh_current['fccHandler'];
                                         if (!$info_riff_video_current['codec'] && isset($info_riff_raw_strf_strh_fcc_type_stream_index['fourcc']) && getid3_riff::RIFFfourccLookup($info_riff_raw_strf_strh_fcc_type_stream_index['fourcc'])) {
                                             $info_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($info_riff_raw_strf_strh_fcc_type_stream_index['fourcc']);
                                             $info_video['fourcc'] = $info_riff_raw_strf_strh_fcc_type_stream_index['fourcc'];
                                         }
                                         $info_video['codec'] = $info_riff_video_current['codec'];
                                         $info_video['pixel_aspect_ratio'] = (double) 1;
                                         switch ($info_riff_raw_strh_current['fccHandler']) {
                                             case 'HFYU':
                                                 // Huffman Lossless Codec
                                             // Huffman Lossless Codec
                                             case 'IRAW':
                                                 // Intel YUV Uncompressed
                                             // Intel YUV Uncompressed
                                             case 'YUY2':
                                                 // Uncompressed YUV 4:2:2
                                                 $info_video['lossless'] = true;
                                                 break;
                                             default:
                                                 $info_video['lossless'] = false;
                                                 break;
                                         }
                                         switch ($strh_fcc_type) {
                                             case 'vids':
                                                 getid3_lib::ReadSequence($this->endian_function, $info_riff_raw_strf_strh_fcc_type_stream_index, $strf_data, 0, array('biSize' => 4, 'biWidth' => 4, 'biHeight' => 4, 'biPlanes' => 2, 'biBitCount' => 2, 'fourcc' => -4, 'biSizeImage' => 4, 'biXPelsPerMeter' => 4, 'biYPelsPerMeter' => 4, 'biClrUsed' => 4, 'biClrImportant' => 4));
                                                 $info_video['bits_per_sample'] = $info_riff_raw_strf_strh_fcc_type_stream_index['biBitCount'];
                                                 if ($info_riff_video_current['codec'] == 'DV') {
                                                     $info_riff_video_current['dv_type'] = 2;
                                                 }
                                                 break;
                                             case 'iavs':
                                                 $info_riff_video_current['dv_type'] = 1;
                                                 break;
                                         }
                                         break;
                                     default:
                                         $getid3->warning('Unhandled fccType for stream (' . $i . '): "' . $strh_fcc_type . '"');
                                         break;
                                 }
                             }
                         }
                         if (isset($info_riff_raw_strf_strh_fcc_type_stream_index['fourcc']) && getid3_riff::RIFFfourccLookup($info_riff_raw_strf_strh_fcc_type_stream_index['fourcc'])) {
                             $info_riff_video_current['codec'] = getid3_riff::RIFFfourccLookup($info_riff_raw_strf_strh_fcc_type_stream_index['fourcc']);
                             $info_video['codec'] = $info_riff_video_current['codec'];
                             $info_video['fourcc'] = $info_riff_raw_strf_strh_fcc_type_stream_index['fourcc'];
                             switch ($info_riff_raw_strf_strh_fcc_type_stream_index['fourcc']) {
                                 case 'HFYU':
                                     // Huffman Lossless Codec
                                 // Huffman Lossless Codec
                                 case 'IRAW':
                                     // Intel YUV Uncompressed
                                 // Intel YUV Uncompressed
                                 case 'YUY2':
                                     // Uncompressed YUV 4:2:2
                                     $info_video['lossless'] = true;
                                     $info_video['bits_per_sample'] = 24;
                                     break;
                                 default:
                                     $info_video['lossless'] = false;
                                     $info_video['bits_per_sample'] = 24;
                                     break;
                             }
                         }
                     }
                 }
             }
             break;
         case 'CDDA':
             $info_audio['bitrate_mode'] = 'cbr';
             $info_audio_dataformat = 'cda';
             $info_audio['lossless'] = true;
             unset($getid3->info['mime_type']);
             $info_avdataoffset = 44;
             if (isset($info_riff['CDDA']['fmt '][0]['data'])) {
                 $info_riff_cdda_fmt_0 =& $info_riff['CDDA']['fmt '][0];
                 getid3_lib::ReadSequence($this->endian_function, $info_riff_cdda_fmt_0, $info_riff_cdda_fmt_0['data'], 0, array('unknown1' => 2, 'track_num' => 2, 'disc_id' => 4, 'start_offset_frame' => 4, 'playtime_frames' => 4, 'unknown6' => 4, 'unknown7' => 4));
                 $info_riff_cdda_fmt_0['start_offset_seconds'] = (double) $info_riff_cdda_fmt_0['start_offset_frame'] / 75;
                 $info_riff_cdda_fmt_0['playtime_seconds'] = (double) $info_riff_cdda_fmt_0['playtime_frames'] / 75;
                 $getid3->info['comments']['track'] = $info_riff_cdda_fmt_0['track_num'];
                 $getid3->info['playtime_seconds'] = $info_riff_cdda_fmt_0['playtime_seconds'];
                 // hardcoded data for CD-audio
                 $info_audio['sample_rate'] = 44100;
                 $info_audio['channels'] = 2;
                 $info_audio['bits_per_sample'] = 16;
                 $info_audio['bitrate'] = $info_audio['sample_rate'] * $info_audio['channels'] * $info_audio['bits_per_sample'];
                 $info_audio['bitrate_mode'] = 'cbr';
             }
             break;
         case 'AIFF':
         case 'AIFC':
             $info_audio['bitrate_mode'] = 'cbr';
             $info_audio_dataformat = 'aiff';
             $info_audio['lossless'] = true;
             $getid3->info['mime_type'] = 'audio/x-aiff';
             if (isset($info_riff[$riff_sub_type]['SSND'][0]['offset'])) {
                 $info_avdataoffset = $info_riff[$riff_sub_type]['SSND'][0]['offset'] + 8;
                 $info_avdataend = $info_avdataoffset + $info_riff[$riff_sub_type]['SSND'][0]['size'];
                 if ($info_avdataend > $getid3->info['filesize']) {
                     if ($info_avdataend == $getid3->info['filesize'] + 1 && $getid3->info['filesize'] % 2 == 1) {
                         // structures rounded to 2-byte boundary, but dumb encoders
                         // forget to pad end of file to make this actually work
                     } else {
                         $getid3->warning('Probable truncated AIFF file: expecting ' . $info_riff[$riff_sub_type]['SSND'][0]['size'] . ' bytes of audio data, only ' . ($getid3->info['filesize'] - $info_avdataoffset) . ' bytes found');
                     }
                     $info_avdataend = $getid3->info['filesize'];
                 }
             }
             if (isset($info_riff[$riff_sub_type]['COMM'][0]['data'])) {
                 // shortcut
                 $info_riff_RIFFsubtype_COMM_0_data =& $info_riff[$riff_sub_type]['COMM'][0]['data'];
                 $info_riff_audio['channels'] = getid3_lib::BigEndianSyncSafe2Int(substr($info_riff_RIFFsubtype_COMM_0_data, 0, 2));
                 $info_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($info_riff_RIFFsubtype_COMM_0_data, 2, 4));
                 $info_riff_audio['bits_per_sample'] = getid3_lib::BigEndianSyncSafe2Int(substr($info_riff_RIFFsubtype_COMM_0_data, 6, 2));
                 $info_riff_audio['sample_rate'] = (int) getid3_riff::BigEndian2Float(substr($info_riff_RIFFsubtype_COMM_0_data, 8, 10));
                 if ($info_riff[$riff_sub_type]['COMM'][0]['size'] > 18) {
                     $info_riff_audio['codec_fourcc'] = substr($info_riff_RIFFsubtype_COMM_0_data, 18, 4);
                     $codec_name_size = getid3_lib::BigEndian2Int(substr($info_riff_RIFFsubtype_COMM_0_data, 22, 1));
                     $info_riff_audio['codec_name'] = substr($info_riff_RIFFsubtype_COMM_0_data, 23, $codec_name_size);
                     switch ($info_riff_audio['codec_name']) {
                         case 'NONE':
                             $info_audio['codec'] = 'Pulse Code Modulation (PCM)';
                             $info_audio['lossless'] = true;
                             break;
                         case '':
                             switch ($info_riff_audio['codec_fourcc']) {
                                 // http://developer.apple.com/qa/snd/snd07.html
                                 case 'sowt':
                                     $info_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM';
                                     $info_audio['lossless'] = true;
                                     break;
                                 case 'twos':
                                     $info_riff_audio['codec_name'] = 'Two\'s Compliment Big-Endian PCM';
                                     $info_audio['lossless'] = true;
                                     break;
                                 default:
                                     break;
                             }
                             break;
                         default:
                             $info_audio['codec'] = $info_riff_audio['codec_name'];
                             $info_audio['lossless'] = false;
                             break;
                     }
                 }
                 $info_audio['channels'] = $info_riff_audio['channels'];
                 if ($info_riff_audio['bits_per_sample'] > 0) {
                     $info_audio['bits_per_sample'] = $info_riff_audio['bits_per_sample'];
                 }
                 $info_audio['sample_rate'] = $info_riff_audio['sample_rate'];
                 $getid3->info['playtime_seconds'] = $info_riff_audio['total_samples'] / $info_audio['sample_rate'];
             }
             if (isset($info_riff[$riff_sub_type]['COMT'])) {
                 $comment_count = getid3_lib::BigEndian2Int(substr($info_riff[$riff_sub_type]['COMT'][0]['data'], 0, 2));
                 $offset = 2;
                 for ($i = 0; $i < $comment_count; $i++) {
                     $getid3->info['comments_raw'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($info_riff[$riff_sub_type]['COMT'][0]['data'], $offset, 4));
                     $offset += 4;
                     $getid3->info['comments_raw'][$i]['marker_id'] = getid3_lib::BigEndianSyncSafe2Int(substr($info_riff[$riff_sub_type]['COMT'][0]['data'], $offset, 2));
                     $offset += 2;
                     $comment_length = getid3_lib::BigEndian2Int(substr($info_riff[$riff_sub_type]['COMT'][0]['data'], $offset, 2));
                     $offset += 2;
                     $getid3->info['comments_raw'][$i]['comment'] = substr($info_riff[$riff_sub_type]['COMT'][0]['data'], $offset, $comment_length);
                     $offset += $comment_length;
                     $getid3->info['comments_raw'][$i]['timestamp_unix'] = getid3_riff::DateMac2Unix($getid3->info['comments_raw'][$i]['timestamp']);
                     $info_riff['comments']['comment'][] = $getid3->info['comments_raw'][$i]['comment'];
                 }
             }
             foreach (array('NAME' => 'title', 'author' => 'artist', '(c) ' => 'copyright', 'ANNO' => 'comment') as $key => $value) {
                 if (isset($info_riff[$riff_sub_type][$key][0]['data'])) {
                     $info_riff['comments'][$value][] = $info_riff[$riff_sub_type][$key][0]['data'];
                 }
             }
             break;
         case '8SVX':
             $info_audio['bitrate_mode'] = 'cbr';
             $info_audio_dataformat = '8svx';
             $info_audio['bits_per_sample'] = 8;
             $info_audio['channels'] = 1;
             // overridden below, if need be
             $getid3->info['mime_type'] = 'audio/x-aiff';
             if (isset($info_riff[$riff_sub_type]['BODY'][0]['offset'])) {
                 $info_avdataoffset = $info_riff[$riff_sub_type]['BODY'][0]['offset'] + 8;
                 $info_avdataend = $info_avdataoffset + $info_riff[$riff_sub_type]['BODY'][0]['size'];
                 if ($info_avdataend > $getid3->info['filesize']) {
                     $getid3->warning('Probable truncated AIFF file: expecting ' . $info_riff[$riff_sub_type]['BODY'][0]['size'] . ' bytes of audio data, only ' . ($getid3->info['filesize'] - $info_avdataoffset) . ' bytes found');
                 }
             }
             if (isset($info_riff[$riff_sub_type]['VHDR'][0]['offset'])) {
                 // shortcut
                 $info_riff_riff_sub_type_vhdr_0 =& $info_riff[$riff_sub_type]['VHDR'][0];
                 getid3_lib::ReadSequence('BigEndian2Int', $info_riff_riff_sub_type_vhdr_0, $info_riff_riff_sub_type_vhdr_0['data'], 0, array('oneShotHiSamples' => 4, 'repeatHiSamples' => 4, 'samplesPerHiCycle' => 4, 'samplesPerSec' => 2, 'ctOctave' => 1, 'sCompression' => 1, 'Volume' => -4));
                 $info_riff_riff_sub_type_vhdr_0['Volume'] = getid3_riff::FixedPoint16_16($info_riff_riff_sub_type_vhdr_0['Volume']);
                 $info_audio['sample_rate'] = $info_riff_riff_sub_type_vhdr_0['samplesPerSec'];
                 switch ($info_riff_riff_sub_type_vhdr_0['sCompression']) {
                     case 0:
                         $info_audio['codec'] = 'Pulse Code Modulation (PCM)';
                         $info_audio['lossless'] = true;
                         $actual_bits_per_sample = 8;
                         break;
                     case 1:
                         $info_audio['codec'] = 'Fibonacci-delta encoding';
                         $info_audio['lossless'] = false;
                         $actual_bits_per_sample = 4;
                         break;
                     default:
                         $getid3->warning('Unexpected sCompression value in 8SVX.VHDR chunk - expecting 0 or 1, found "' . sCompression . '"');
                         break;
                 }
             }
             if (isset($info_riff[$riff_sub_type]['CHAN'][0]['data'])) {
                 $ChannelsIndex = getid3_lib::BigEndian2Int(substr($info_riff[$riff_sub_type]['CHAN'][0]['data'], 0, 4));
                 switch ($ChannelsIndex) {
                     case 6:
                         // Stereo
                         $info_audio['channels'] = 2;
                         break;
                     case 2:
                         // Left channel only
                     // Left channel only
                     case 4:
                         // Right channel only
                         $info_audio['channels'] = 1;
                         break;
                     default:
                         $getid3->warning('Unexpected value in 8SVX.CHAN chunk - expecting 2 or 4 or 6, found "' . $ChannelsIndex . '"');
                         break;
                 }
             }
             foreach (array('NAME' => 'title', 'author' => 'artist', '(c) ' => 'copyright', 'ANNO' => 'comment') as $key => $value) {
                 if (isset($info_riff[$riff_sub_type][$key][0]['data'])) {
                     $info_riff['comments'][$value][] = $info_riff[$riff_sub_type][$key][0]['data'];
                 }
             }
             $info_audio['bitrate'] = $info_audio['sample_rate'] * $actual_bits_per_sample * $info_audio['channels'];
             if (!empty($info_audio['bitrate'])) {
                 $getid3->info['playtime_seconds'] = ($info_avdataend - $info_avdataoffset) / ($info_audio['bitrate'] / 8);
             }
             break;
         case 'CDXA':
             $getid3->info['mime_type'] = 'video/mpeg';
             if (!empty($info_riff['CDXA']['data'][0]['size'])) {
                 $GETID3_ERRORARRAY =& $getid3->info['warning'];
                 if (!$getid3->include_module_optional('audio-video.mpeg')) {
                     $getid3->warning('MPEG skipped because mpeg module is missing.');
                 } else {
                     // Clone getid3 - messing with offsets - better safe than sorry
                     $clone = clone $getid3;
                     // Analyse
                     $mpeg = new getid3_mpeg($clone);
                     $mpeg->Analyze();
                     // Import from clone and destroy
                     $getid3->info['audio'] = $clone->info['audio'];
                     $getid3->info['video'] = $clone->info['video'];
                     $getid3->info['mpeg'] = $clone->info['mpeg'];
                     $getid3->info['warning'] = $clone->info['warning'];
                     unset($clone);
                 }
             }
             break;
         default:
             throw new getid3_exception('Unknown RIFF type: expecting one of (WAVE|RMP3|AVI |CDDA|AIFF|AIFC|8SVX|CDXA), found "' . $riff_sub_type . '" instead');
     }
     if (@$info_riff_raw['fmt ']['wFormatTag'] == 1) {
         // http://www.mega-nerd.com/erikd/Blog/Windiots/dts.html
         $this->fseek($getid3->info['avdataoffset'], SEEK_SET);
         $bytes4 = $this->fread(4);
         // DTSWAV
         if (preg_match('/^\\xFF\\x1F\\x00\\xE8/s', $bytes4)) {
             $info_audio_dataformat = 'dts';
         } elseif (preg_match('/^\\x7F\\xFF\\x80\\x01/s', $bytes4)) {
             $info_audio_dataformat = 'dts';
         }
     }
     if (@is_array($info_riff_wave['DISP'])) {
         $info_riff['comments']['title'][] = trim(substr($info_riff_wave['DISP'][count($info_riff_wave['DISP']) - 1]['data'], 4));
     }
     if (@is_array($info_riff_wave['INFO'])) {
         getid3_riff::RIFFCommentsParse($info_riff_wave['INFO'], $info_riff['comments']);
     }
     if (isset($info_riff_wave['INFO']) && is_array($info_riff_wave['INFO'])) {
         foreach (array('IARL' => 'archivallocation', 'IART' => 'artist', 'ICDS' => 'costumedesigner', 'ICMS' => 'commissionedby', 'ICMT' => 'comment', 'ICNT' => 'country', 'ICOP' => 'copyright', 'ICRD' => 'creationdate', 'IDIM' => 'dimensions', 'IDIT' => 'digitizationdate', 'IDPI' => 'resolution', 'IDST' => 'distributor', 'IEDT' => 'editor', 'IENG' => 'engineers', 'IFRM' => 'accountofparts', 'IGNR' => 'genre', 'IKEY' => 'keywords', 'ILGT' => 'lightness', 'ILNG' => 'language', 'IMED' => 'orignalmedium', 'IMUS' => 'composer', 'INAM' => 'title', 'IPDS' => 'productiondesigner', 'IPLT' => 'palette', 'IPRD' => 'product', 'IPRO' => 'producer', 'IPRT' => 'part', 'IRTD' => 'rating', 'ISBJ' => 'subject', 'ISFT' => 'software', 'ISGN' => 'secondarygenre', 'ISHP' => 'sharpness', 'ISRC' => 'sourcesupplier', 'ISRF' => 'digitizationsource', 'ISTD' => 'productionstudio', 'ISTR' => 'starring', 'ITCH' => 'encoded_by', 'IWEB' => 'url', 'IWRI' => 'writer') as $key => $value) {
             if (isset($info_riff_wave['INFO'][$key])) {
                 foreach ($info_riff_wave['INFO'][$key] as $comment_id => $comment_data) {
                     if (trim($comment_data['data']) != '') {
                         $info_riff['comments'][$value][] = trim($comment_data['data']);
                     }
                 }
             }
         }
     }
     if (empty($info_audio['encoder']) && !empty($getid3->info['mpeg']['audio']['LAME']['short_version'])) {
         $info_audio['encoder'] = $getid3->info['mpeg']['audio']['LAME']['short_version'];
     }
     if (!isset($getid3->info['playtime_seconds'])) {
         $getid3->info['playtime_seconds'] = 0;
     }
     if (isset($info_riff_raw['avih']['dwTotalFrames']) && isset($info_riff_raw['avih']['dwMicroSecPerFrame'])) {
         $getid3->info['playtime_seconds'] = $info_riff_raw['avih']['dwTotalFrames'] * ($info_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000);
     }
     if ($getid3->info['playtime_seconds'] > 0) {
         if (isset($info_riff_audio) && isset($info_riff_video)) {
             if (!isset($getid3->info['bitrate'])) {
                 $getid3->info['bitrate'] = ($info_avdataend - $info_avdataoffset) / $getid3->info['playtime_seconds'] * 8;
             }
         } elseif (isset($info_riff_audio) && !isset($info_riff_video)) {
             if (!isset($info_audio['bitrate'])) {
                 $info_audio['bitrate'] = ($info_avdataend - $info_avdataoffset) / $getid3->info['playtime_seconds'] * 8;
             }
         } elseif (!isset($info_riff_audio) && isset($info_riff_video)) {
             if (!isset($info_video['bitrate'])) {
                 $info_video['bitrate'] = ($info_avdataend - $info_avdataoffset) / $getid3->info['playtime_seconds'] * 8;
             }
         }
     }
     if (isset($info_riff_video) && isset($info_audio['bitrate']) && $info_audio['bitrate'] > 0 && $getid3->info['playtime_seconds'] > 0) {
         $getid3->info['bitrate'] = ($info_avdataend - $info_avdataoffset) / $getid3->info['playtime_seconds'] * 8;
         $info_audio['bitrate'] = 0;
         $info_video['bitrate'] = $getid3->info['bitrate'];
         foreach ($info_riff_audio as $channelnumber => $audioinfoarray) {
             $info_video['bitrate'] -= $audioinfoarray['bitrate'];
             $info_audio['bitrate'] += $audioinfoarray['bitrate'];
         }
         if ($info_video['bitrate'] <= 0) {
             unset($info_video['bitrate']);
         }
         if ($info_audio['bitrate'] <= 0) {
             unset($info_audio['bitrate']);
         }
     }
     if (isset($getid3->info['mpeg']['audio'])) {
         $info_audio_dataformat = 'mp' . $getid3->info['mpeg']['audio']['layer'];
         $info_audio['sample_rate'] = $getid3->info['mpeg']['audio']['sample_rate'];
         $info_audio['channels'] = $getid3->info['mpeg']['audio']['channels'];
         $info_audio['bitrate'] = $getid3->info['mpeg']['audio']['bitrate'];
         $info_audio['bitrate_mode'] = strtolower($getid3->info['mpeg']['audio']['bitrate_mode']);
         if (!empty($getid3->info['mpeg']['audio']['codec'])) {
             $info_audio['codec'] = $getid3->info['mpeg']['audio']['codec'] . ' ' . $info_audio['codec'];
         }
         if (!empty($info_audio['streams'])) {
             foreach ($info_audio['streams'] as $streamnumber => $streamdata) {
                 if ($streamdata['dataformat'] == $info_audio_dataformat) {
                     $info_audio['streams'][$streamnumber]['sample_rate'] = $info_audio['sample_rate'];
                     $info_audio['streams'][$streamnumber]['channels'] = $info_audio['channels'];
                     $info_audio['streams'][$streamnumber]['bitrate'] = $info_audio['bitrate'];
                     $info_audio['streams'][$streamnumber]['bitrate_mode'] = $info_audio['bitrate_mode'];
                     $info_audio['streams'][$streamnumber]['codec'] = $info_audio['codec'];
                 }
             }
         }
         $info_audio['encoder_options'] = getid3_mp3::GuessEncoderOptions($getid3->info);
     }
     if (!empty($info_riff_raw['fmt ']['wBitsPerSample']) && $info_riff_raw['fmt ']['wBitsPerSample'] > 0) {
         switch ($info_audio_dataformat) {
             case 'ac3':
                 // ignore bits_per_sample
                 break;
             default:
                 $info_audio['bits_per_sample'] = $info_riff_raw['fmt ']['wBitsPerSample'];
                 break;
         }
     }
     if (empty($info_riff_raw)) {
         unset($info_riff['raw']);
     }
     if (empty($info_riff_audio)) {
         unset($info_riff['audio']);
     }
     if (empty($info_riff_video)) {
         unset($info_riff['video']);
     }
     if (empty($info_audio_dataformat)) {
         unset($info_audio['dataformat']);
     }
     if (empty($getid3->info['audio'])) {
         unset($getid3->info['audio']);
     }
     if (empty($info_video)) {
         unset($getid3->info['video']);
     }
     return true;
 }