getid3_flac::parseMETAdata() –
You appear to be a bot. Output may be restricted
Description
Usage
$bool = getid3_flac::parseMETAdata();
Parameters
Returns
bool
Source
File name: wordpress/wp-includes/ID3/module.audio.flac.php
Lines:
1 to 100 of 157
public function parseMETAdata() { $info = &$this->getid3->info; do { $BlockOffset = $this->ftell(); $BlockHeader = $this->fread(4); $LBFBT = getid3_lib::BigEndian2Int(substr($BlockHeader, 0, 1)); // LBFBT = LastBlockFlag + BlockType $LastBlockFlag = (bool) ($LBFBT & 0x80); $BlockType = ($LBFBT & 0x7F); $BlockLength = getid3_lib::BigEndian2Int(substr($BlockHeader, 1, 3)); $BlockTypeText = self::metaBlockTypeLookup($BlockType); if (($BlockOffset + 4 + $BlockLength) > $info['avdataend']) { $this->warning('METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$BlockTypeText.') at offset '.$BlockOffset.' extends beyond end of file'); break; } if ($BlockLength < 1) { if ($BlockTypeText != 'reserved') { // probably supposed to be zero-length $this->warning('METADATA_BLOCK_HEADER.BLOCK_LENGTH ('.$BlockTypeText.') at offset '.$BlockOffset.' is zero bytes'); continue; } $this->error('METADATA_BLOCK_HEADER.BLOCK_LENGTH ('.$BlockLength.') at offset '.$BlockOffset.' is invalid'); break; } $info['flac'][$BlockTypeText]['raw'] = array(); $BlockTypeText_raw = &$info['flac'][$BlockTypeText]['raw']; $BlockTypeText_raw['offset'] = $BlockOffset; $BlockTypeText_raw['last_meta_block'] = $LastBlockFlag; $BlockTypeText_raw['block_type'] = $BlockType; $BlockTypeText_raw['block_type_text'] = $BlockTypeText; $BlockTypeText_raw['block_length'] = $BlockLength; if ($BlockTypeText_raw['block_type'] != 0x06) { // do not read attachment data automatically $BlockTypeText_raw['block_data'] = $this->fread($BlockLength); } switch ($BlockTypeText) { case 'STREAMINFO': // 0x00 if (!$this->getid3_flac::parseSTREAMINFO($BlockTypeText_raw['block_data'])) { return false; } break; case 'PADDING': // 0x01 unset($info['flac']['PADDING']); // ignore break; case 'APPLICATION': // 0x02 if (!$this->getid3_flac::parseAPPLICATION($BlockTypeText_raw['block_data'])) { return false; } break; case 'SEEKTABLE': // 0x03 if (!$this->getid3_flac::parseSEEKTABLE($BlockTypeText_raw['block_data'])) { return false; } break; case 'VORBIS_COMMENT': // 0x04 if (!$this->getid3_flac::parseVORBIS_COMMENT($BlockTypeText_raw['block_data'])) { return false; } break; case 'CUESHEET': // 0x05 if (!$this->getid3_flac::parseCUESHEET($BlockTypeText_raw['block_data'])) { return false; } break; case 'PICTURE': // 0x06 if (!$this->getid3_flac::parsePICTURE()) { return false; } break; default: $this->warning('Unhandled METADATA_BLOCK_HEADER.BLOCK_TYPE ('.$BlockType.') at offset '.$BlockOffset); } unset($info['flac'][$BlockTypeText]['raw']); $info['avdataoffset'] = $this->ftell(); } while ($LastBlockFlag === false); // handle tags if (!empty($info['flac']['VORBIS_COMMENT']['comments'])) { $info['flac']['comments'] = $info['flac']['VORBIS_COMMENT']['comments']; } if (!empty($info['flac']['VORBIS_COMMENT']['vendor'])) { $info['audio']['encoder'] = str_replace('reference ', '', $info['flac']['VORBIS_COMMENT']['vendor']); } // copy attachments to 'comments' array if nesesary if (isset($info['flac']['PICTURE']) && ($this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE)) { foreach ($info['flac']['PICTURE'] as $entry) { if (!empty($entry['data'])) { if (!isset($info['flac']['comments']['picture'])) {