private function ParseOptimFROGheader45()
 {
     $getid3 = $this->getid3;
     // for fileformat of v4.50a and higher
     $riff_data = '';
     fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
     while (!feof($getid3->fp) && ftell($getid3->fp) < $getid3->info['avdataend']) {
         $block_offset = ftell($getid3->fp);
         $block_data = fread($getid3->fp, 8);
         $offset = 8;
         $block_name = substr($block_data, 0, 4);
         $block_size = getid3_lib::LittleEndian2Int(substr($block_data, 4, 4));
         if ($block_name == 'OFRX') {
             $block_name = 'OFR ';
         }
         if (!isset($getid3->info['ofr'][$block_name])) {
             $getid3->info['ofr'][$block_name] = array();
         }
         $info_ofr_this_block =& $getid3->info['ofr'][$block_name];
         switch ($block_name) {
             case 'OFR ':
                 // shortcut
                 $info_ofr_this_block['offset'] = $block_offset;
                 $info_ofr_this_block['size'] = $block_size;
                 $getid3->info['audio']['encoder'] = 'OptimFROG 4.50 alpha';
                 switch ($block_size) {
                     case 12:
                     case 15:
                         // good
                         break;
                     default:
                         $getid3->warning('"' . $block_name . '" contains more data than expected (expected 12 or 15 bytes, found ' . $block_size . ' bytes)');
                         break;
                 }
                 $block_data .= fread($getid3->fp, $block_size);
                 $info_ofr_this_block['total_samples'] = getid3_lib::LittleEndian2Int(substr($block_data, $offset, 6));
                 $offset += 6;
                 $info_ofr_this_block['raw']['sample_type'] = getid3_lib::LittleEndian2Int($block_data[$offset++]);
                 $info_ofr_this_block['sample_type'] = $this->OptimFROGsampleTypeLookup($info_ofr_this_block['raw']['sample_type']);
                 $info_ofr_this_block['channel_config'] = getid3_lib::LittleEndian2Int($block_data[$offset++]);
                 $info_ofr_this_block['channels'] = $info_ofr_this_block['channel_config'];
                 $info_ofr_this_block['sample_rate'] = getid3_lib::LittleEndian2Int(substr($block_data, $offset, 4));
                 $offset += 4;
                 if ($block_size > 12) {
                     // OFR 4.504b or higher
                     $info_ofr_this_block['channels'] = $this->OptimFROGchannelConfigNumChannelsLookup($info_ofr_this_block['channel_config']);
                     $info_ofr_this_block['raw']['encoder_id'] = getid3_lib::LittleEndian2Int(substr($block_data, $offset, 2));
                     $info_ofr_this_block['encoder'] = $this->OptimFROGencoderNameLookup($info_ofr_this_block['raw']['encoder_id']);
                     $offset += 2;
                     $info_ofr_this_block['raw']['compression'] = getid3_lib::LittleEndian2Int($block_data[$offset++]);
                     $info_ofr_this_block['compression'] = $this->OptimFROGcompressionLookup($info_ofr_this_block['raw']['compression']);
                     $info_ofr_this_block['speedup'] = $this->OptimFROGspeedupLookup($info_ofr_this_block['raw']['compression']);
                     $getid3->info['audio']['encoder'] = 'OptimFROG ' . $info_ofr_this_block['encoder'];
                     $getid3->info['audio']['encoder_options'] = '--mode ' . $info_ofr_this_block['compression'];
                     if (($info_ofr_this_block['raw']['encoder_id'] & 0xf0) >> 4 == 7) {
                         // v4.507
                         if (preg_match('/\\.ofs$/i', $getid3->filename)) {
                             // OptimFROG DualStream format is lossy, but as of v4.507 there is no way to tell the difference
                             // between lossless and lossy other than the file extension.
                             $getid3->info['audio']['dataformat'] = 'ofs';
                             $getid3->info['audio']['lossless'] = true;
                         }
                     }
                 }
                 $getid3->info['audio']['channels'] = $info_ofr_this_block['channels'];
                 $getid3->info['audio']['sample_rate'] = $info_ofr_this_block['sample_rate'];
                 $getid3->info['audio']['bits_per_sample'] = $this->OptimFROGbitsPerSampleTypeLookup($info_ofr_this_block['raw']['sample_type']);
                 break;
             case 'COMP':
                 // unlike other block types, there CAN be multiple COMP blocks
                 $comp_data['offset'] = $block_offset;
                 $comp_data['size'] = $block_size;
                 if ($getid3->info['avdataoffset'] == 0) {
                     $getid3->info['avdataoffset'] = $block_offset;
                 }
                 // Only interested in first 14 bytes (only first 12 needed for v4.50 alpha), not actual audio data
                 $block_data .= fread($getid3->fp, 14);
                 fseek($getid3->fp, $block_size - 14, SEEK_CUR);
                 $comp_data['crc_32'] = getid3_lib::LittleEndian2Int(substr($block_data, $offset, 4));
                 $offset += 4;
                 $comp_data['sample_count'] = getid3_lib::LittleEndian2Int(substr($block_data, $offset, 4));
                 $offset += 4;
                 $comp_data['raw']['sample_type'] = getid3_lib::LittleEndian2Int($block_data[$offset++]);
                 $comp_data['sample_type'] = $this->OptimFROGsampleTypeLookup($comp_data['raw']['sample_type']);
                 $comp_data['raw']['channel_configuration'] = getid3_lib::LittleEndian2Int($block_data[$offset++]);
                 $comp_data['channel_configuration'] = $this->OptimFROGchannelConfigurationLookup($comp_data['raw']['channel_configuration']);
                 $comp_data['raw']['algorithm_id'] = getid3_lib::LittleEndian2Int(substr($block_data, $offset, 2));
                 $offset += 2;
                 if ($getid3->info['ofr']['OFR ']['size'] > 12) {
                     // OFR 4.504b or higher
                     $comp_data['raw']['encoder_id'] = getid3_lib::LittleEndian2Int(substr($block_data, $offset, 2));
                     $comp_data['encoder'] = $this->OptimFROGencoderNameLookup($comp_data['raw']['encoder_id']);
                     $offset += 2;
                 }
                 if ($comp_data['crc_32'] == 0x454e4f4e) {
                     // ASCII value of 'NONE' - placeholder value in v4.50a
                     $comp_data['crc_32'] = false;
                 }
                 $info_ofr_this_block[] = $comp_data;
                 break;
             case 'HEAD':
                 $info_ofr_this_block['offset'] = $block_offset;
                 $info_ofr_this_block['size'] = $block_size;
                 $riff_data .= fread($getid3->fp, $block_size);
                 break;
             case 'TAIL':
                 $info_ofr_this_block['offset'] = $block_offset;
                 $info_ofr_this_block['size'] = $block_size;
                 if ($block_size > 0) {
                     $riff_data .= fread($getid3->fp, $block_size);
                 }
                 break;
             case 'RECV':
                 // block contains no useful meta data - simply note and skip
                 $info_ofr_this_block['offset'] = $block_offset;
                 $info_ofr_this_block['size'] = $block_size;
                 fseek($getid3->fp, $block_size, SEEK_CUR);
                 break;
             case 'APET':
                 // APEtag v2
                 $info_ofr_this_block['offset'] = $block_offset;
                 $info_ofr_this_block['size'] = $block_size;
                 $getid3->warning('APEtag processing inside OptimFROG not supported in this version (' . GETID3_VERSION . ') of getID3()');
                 fseek($getid3->fp, $block_size, SEEK_CUR);
                 break;
             case 'MD5 ':
                 // APEtag v2
                 $info_ofr_this_block['offset'] = $block_offset;
                 $info_ofr_this_block['size'] = $block_size;
                 if ($block_size == 16) {
                     $info_ofr_this_block['md5_binary'] = fread($getid3->fp, $block_size);
                     $info_ofr_this_block['md5_string'] = getid3_lib::PrintHexBytes($info_ofr_this_block['md5_binary'], true, false, false);
                     $getid3->info['md5_data_source'] = $info_ofr_this_block['md5_string'];
                 } else {
                     $getid3->warning('Expecting block size of 16 in "MD5 " chunk, found ' . $block_size . ' instead');
                     fseek($getid3->fp, $block_size, SEEK_CUR);
                 }
                 break;
             default:
                 $info_ofr_this_block['offset'] = $block_offset;
                 $info_ofr_this_block['size'] = $block_size;
                 $getid3->warning('Unhandled OptimFROG block type "' . $block_name . '" at offset ' . $info_ofr_this_block['offset']);
                 fseek($getid3->fp, $block_size, SEEK_CUR);
                 break;
         }
     }
     if (isset($getid3->info['ofr']['TAIL']['offset'])) {
         $getid3->info['avdataend'] = $getid3->info['ofr']['TAIL']['offset'];
     }
     $getid3->info['playtime_seconds'] = (double) $getid3->info['ofr']['OFR ']['total_samples'] / ($getid3->info['audio']['channels'] * $getid3->info['audio']['sample_rate']);
     $getid3->info['audio']['bitrate'] = ($getid3->info['avdataend'] - $getid3->info['avdataoffset']) * 8 / $getid3->info['playtime_seconds'];
     // 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 = $getid3->info['audio'];
     // Instantiate riff module and analyze string
     $riff = new getid3_riff($getid3);
     $riff->AnalyzeString($riff_data);
     // Restore info key
     $getid3->info['audio'] = $saved_info_audio;
     $getid3->info['fileformat'] = 'ofr';
     return true;
 }
 public function Analyze()
 {
     $getid3 = $this->getid3;
     $getid3->include_module('audio-video.riff');
     fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
     $raw_data = fread($getid3->fp, getid3::FREAD_BUFFER_SIZE);
     $getid3->info['fileformat'] = 'la';
     $getid3->info['audio']['dataformat'] = 'la';
     $getid3->info['audio']['lossless'] = true;
     $getid3->info['la']['version_major'] = (int) $raw_data[2];
     $getid3->info['la']['version_minor'] = (int) $raw_data[3];
     $getid3->info['la']['version'] = (double) $getid3->info['la']['version_major'] + $getid3->info['la']['version_minor'] / 10;
     $getid3->info['la']['uncompressed_size'] = getid3_lib::LittleEndian2Int(substr($raw_data, 4, 4));
     $wave_chunk = substr($raw_data, 8, 4);
     if ($wave_chunk !== 'WAVE') {
         throw new getid3_exception('Expected "WAVE" (' . getid3_lib::PrintHexBytes('WAVE') . ') at offset 8, found "' . $wave_chunk . '" (' . getid3_lib::PrintHexBytes($wave_chunk) . ') instead.');
     }
     $offset = 12;
     $getid3->info['la']['fmt_size'] = 24;
     if ($getid3->info['la']['version'] >= 0.3) {
         $getid3->info['la']['fmt_size'] = getid3_lib::LittleEndian2Int(substr($raw_data, $offset, 4));
         $getid3->info['la']['header_size'] = 49 + $getid3->info['la']['fmt_size'] - 24;
         $offset += 4;
     } else {
         // version 0.2 didn't support additional data blocks
         $getid3->info['la']['header_size'] = 41;
     }
     $fmt_chunk = substr($raw_data, $offset, 4);
     if ($fmt_chunk !== 'fmt ') {
         throw new getid3_exception('Expected "fmt " (' . getid3_lib::PrintHexBytes('fmt ') . ') at offset ' . $offset . ', found "' . $fmt_chunk . '" (' . getid3_lib::PrintHexBytes($fmt_chunk) . ') instead.');
     }
     $offset += 4;
     $fmt_size = getid3_lib::LittleEndian2Int(substr($raw_data, $offset, 4));
     $offset += 4;
     $getid3->info['la']['raw']['format'] = getid3_lib::LittleEndian2Int(substr($raw_data, $offset, 2));
     $offset += 2;
     getid3_lib::ReadSequence('LittleEndian2Int', $getid3->info['la'], $raw_data, $offset, array('channels' => 2, 'sample_rate' => 4, 'bytes_per_second' => 4, 'bytes_per_sample' => 2, 'bits_per_sample' => 2, 'samples' => 4));
     $offset += 18;
     $getid3->info['la']['raw']['flags'] = getid3_lib::LittleEndian2Int($raw_data[$offset++]);
     $getid3->info['la']['flags']['seekable'] = (bool) ($getid3->info['la']['raw']['flags'] & 0x1);
     if ($getid3->info['la']['version'] >= 0.4) {
         $getid3->info['la']['flags']['high_compression'] = (bool) ($getid3->info['la']['raw']['flags'] & 0x2);
     }
     $getid3->info['la']['original_crc'] = getid3_lib::LittleEndian2Int(substr($raw_data, $offset, 4));
     $offset += 4;
     // mikeØbevin*de
     // Basically, the blocksize/seekevery are 61440/19 in La0.4 and 73728/16
     // in earlier versions. A seekpoint is added every blocksize * seekevery
     // samples, so 4 * int(totalSamples / (blockSize * seekEvery)) should
     // give the number of bytes used for the seekpoints. Of course, if seeking
     // is disabled, there are no seekpoints stored.
     if ($getid3->info['la']['version'] >= 0.4) {
         $getid3->info['la']['blocksize'] = 61440;
         $getid3->info['la']['seekevery'] = 19;
     } else {
         $getid3->info['la']['blocksize'] = 73728;
         $getid3->info['la']['seekevery'] = 16;
     }
     $getid3->info['la']['seekpoint_count'] = 0;
     if ($getid3->info['la']['flags']['seekable']) {
         $getid3->info['la']['seekpoint_count'] = floor($getid3->info['la']['samples'] / ($getid3->info['la']['blocksize'] * $getid3->info['la']['seekevery']));
         for ($i = 0; $i < $getid3->info['la']['seekpoint_count']; $i++) {
             $getid3->info['la']['seekpoints'][] = getid3_lib::LittleEndian2Int(substr($raw_data, $offset, 4));
             $offset += 4;
         }
     }
     if ($getid3->info['la']['version'] >= 0.3) {
         // Following the main header information, the program outputs all of the
         // seekpoints. Following these is what I called the 'footer start',
         // i.e. the position immediately after the La audio data is finished.
         $getid3->info['la']['footerstart'] = getid3_lib::LittleEndian2Int(substr($raw_data, $offset, 4));
         $offset += 4;
         if ($getid3->info['la']['footerstart'] > $getid3->info['filesize']) {
             $getid3->warning('FooterStart value points to offset ' . $getid3->info['la']['footerstart'] . ' which is beyond end-of-file (' . $getid3->info['filesize'] . ')');
             $getid3->info['la']['footerstart'] = $getid3->info['filesize'];
         }
     } else {
         // La v0.2 didn't have FooterStart value
         $getid3->info['la']['footerstart'] = $getid3->info['avdataend'];
     }
     if ($getid3->info['la']['footerstart'] < $getid3->info['avdataend']) {
         // Create riff header
         $riff_data = 'WAVE';
         if ($getid3->info['la']['version'] == 0.2) {
             $riff_data .= substr($raw_data, 12, 24);
         } else {
             $riff_data .= substr($raw_data, 16, 24);
         }
         if ($getid3->info['la']['footerstart'] < $getid3->info['avdataend']) {
             fseek($getid3->fp, $getid3->info['la']['footerstart'], SEEK_SET);
             $riff_data .= fread($getid3->fp, $getid3->info['avdataend'] - $getid3->info['la']['footerstart']);
         }
         $riff_data = 'RIFF' . getid3_lib::LittleEndian2String(strlen($riff_data), 4, false) . $riff_data;
         // Clone getid3 - messing with offsets - better safe than sorry
         $clone = clone $getid3;
         // Analyze clone by string
         $riff = new getid3_riff($clone);
         $riff->AnalyzeString($riff_data);
         // Import from clone and destroy
         $getid3->info['riff'] = $clone->info['riff'];
         $getid3->warnings($clone->warnings());
         unset($clone);
     }
     // $getid3->info['avdataoffset'] should be zero to begin with, but just in case it's not, include the addition anyway
     $getid3->info['avdataend'] = $getid3->info['avdataoffset'] + $getid3->info['la']['footerstart'];
     $getid3->info['avdataoffset'] = $getid3->info['avdataoffset'] + $offset;
     $getid3->info['la']['compression_ratio'] = (double) (($getid3->info['avdataend'] - $getid3->info['avdataoffset']) / $getid3->info['la']['uncompressed_size']);
     $getid3->info['playtime_seconds'] = (double) ($getid3->info['la']['samples'] / $getid3->info['la']['sample_rate']) / $getid3->info['la']['channels'];
     $getid3->info['audio']['bitrate'] = ($getid3->info['avdataend'] - $getid3->info['avdataoffset']) * 8 / $getid3->info['playtime_seconds'];
     $getid3->info['audio']['bits_per_sample'] = $getid3->info['la']['bits_per_sample'];
     $getid3->info['audio']['channels'] = $getid3->info['la']['channels'];
     $getid3->info['audio']['sample_rate'] = (int) $getid3->info['la']['sample_rate'];
     $getid3->info['audio']['encoder'] = 'LA v' . $getid3->info['la']['version'];
     return true;
 }
 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;
 }