Mercurial > judyates
diff e2gallerypro/e2upload/Backend/Assets/getid3/module.audio.mpc_old.php @ 3:3f6b44aa6b35 judyates
[svn r4] added ability to buy stuff, from a Prints page, but it doesn't work well with the css, and it also has not been fitted into the perl make system.
author | rlm |
---|---|
date | Mon, 22 Feb 2010 08:02:39 -0500 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/e2gallerypro/e2upload/Backend/Assets/getid3/module.audio.mpc_old.php Mon Feb 22 08:02:39 2010 -0500 1.3 @@ -0,0 +1,107 @@ 1.4 +<?php 1.5 +// +----------------------------------------------------------------------+ 1.6 +// | PHP version 5 | 1.7 +// +----------------------------------------------------------------------+ 1.8 +// | Copyright (c) 2002-2006 James Heinrich, Allan Hansen | 1.9 +// +----------------------------------------------------------------------+ 1.10 +// | This source file is subject to version 2 of the GPL license, | 1.11 +// | that is bundled with this package in the file license.txt and is | 1.12 +// | available through the world-wide-web at the following url: | 1.13 +// | http://www.gnu.org/copyleft/gpl.html | 1.14 +// +----------------------------------------------------------------------+ 1.15 +// | getID3() - http://getid3.sourceforge.net or http://www.getid3.org | 1.16 +// +----------------------------------------------------------------------+ 1.17 +// | Authors: James Heinrich <infoØgetid3*org> | 1.18 +// | Allan Hansen <ahØartemis*dk> | 1.19 +// +----------------------------------------------------------------------+ 1.20 +// | module.audio.mpc_old.php | 1.21 +// | Module for analyzing Musepack/MPEG+ Audio files - SV4-SV6 | 1.22 +// | dependencies: NONE | 1.23 +// +----------------------------------------------------------------------+ 1.24 +// 1.25 +// $Id: module.audio.mpc_old.php,v 1.2 2006/11/02 10:48:01 ah Exp $ 1.26 + 1.27 + 1.28 + 1.29 +class getid3_mpc_old extends getid3_handler 1.30 +{ 1.31 + 1.32 + public function Analyze() { 1.33 + 1.34 + $getid3 = $this->getid3; 1.35 + 1.36 + // http://www.uni-jena.de/~pfk/mpp/sv8/header.html 1.37 + 1.38 + $getid3->info['mpc']['header'] = array (); 1.39 + $info_mpc_header = &$getid3->info['mpc']['header']; 1.40 + 1.41 + $getid3->info['fileformat'] = 'mpc'; 1.42 + $getid3->info['audio']['dataformat'] = 'mpc'; 1.43 + $getid3->info['audio']['bitrate_mode'] = 'vbr'; 1.44 + $getid3->info['audio']['channels'] = 2; // the format appears to be hardcoded for stereo only 1.45 + $getid3->info['audio']['lossless'] = false; 1.46 + 1.47 + fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET); 1.48 + 1.49 + $info_mpc_header['size'] = 8; 1.50 + $getid3->info['avdataoffset'] += $info_mpc_header['size']; 1.51 + 1.52 + $mpc_header_data = fread($getid3->fp, $info_mpc_header['size']); 1.53 + 1.54 + 1.55 + // Most of this code adapted from Jurgen Faul's MPEGplus source code - thanks Jurgen! :) 1.56 + $header_dword[0] = getid3_lib::LittleEndian2Int(substr($mpc_header_data, 0, 4)); 1.57 + $header_dword[1] = getid3_lib::LittleEndian2Int(substr($mpc_header_data, 4, 4)); 1.58 + 1.59 + 1.60 + // DDDD DDDD CCCC CCCC BBBB BBBB AAAA AAAA 1.61 + // aaaa aaaa abcd dddd dddd deee eeff ffff 1.62 + // 1.63 + // a = bitrate = anything 1.64 + // b = IS = anything 1.65 + // c = MS = anything 1.66 + // d = streamversion = 0000000004 or 0000000005 or 0000000006 1.67 + // e = maxband = anything 1.68 + // f = blocksize = 000001 for SV5+, anything(?) for SV4 1.69 + 1.70 + $info_mpc_header['target_bitrate'] = (($header_dword[0] & 0xFF800000) >> 23); 1.71 + $info_mpc_header['intensity_stereo'] = (bool)(($header_dword[0] & 0x00400000) >> 22); 1.72 + $info_mpc_header['mid-side_stereo'] = (bool)(($header_dword[0] & 0x00200000) >> 21); 1.73 + $info_mpc_header['stream_major_version'] = ($header_dword[0] & 0x001FF800) >> 11; 1.74 + $info_mpc_header['stream_minor_version'] = 0; 1.75 + $info_mpc_header['max_band'] = ($header_dword[0] & 0x000007C0) >> 6; // related to lowpass frequency, not sure how it translates exactly 1.76 + $info_mpc_header['block_size'] = ($header_dword[0] & 0x0000003F); 1.77 + 1.78 + switch ($info_mpc_header['stream_major_version']) { 1.79 + case 4: 1.80 + $info_mpc_header['frame_count'] = ($header_dword[1] >> 16); 1.81 + break; 1.82 + case 5: 1.83 + case 6: 1.84 + $info_mpc_header['frame_count'] = $header_dword[1]; 1.85 + break; 1.86 + 1.87 + default: 1.88 + throw new getid3_exception('Expecting 4, 5 or 6 in version field, found '.$info_mpc_header['stream_major_version'].' instead'); 1.89 + } 1.90 + 1.91 + if (($info_mpc_header['stream_major_version'] > 4) && ($info_mpc_header['block_size'] != 1)) { 1.92 + $getid3->warning('Block size expected to be 1, actual value found: '.$info_mpc_header['block_size']); 1.93 + } 1.94 + 1.95 + $info_mpc_header['sample_rate'] = $getid3->info['audio']['sample_rate'] = 44100; // AB: used by all files up to SV7 1.96 + $info_mpc_header['samples'] = $info_mpc_header['frame_count'] * 1152 * $getid3->info['audio']['channels']; 1.97 + 1.98 + $getid3->info['audio']['bitrate_mode'] = $info_mpc_header['target_bitrate'] == 0 ? 'vbr' : 'cbr'; 1.99 + 1.100 + $getid3->info['mpc']['bitrate'] = ($getid3->info['avdataend'] - $getid3->info['avdataoffset']) * 8 * 44100 / $info_mpc_header['frame_count'] / 1152; 1.101 + $getid3->info['audio']['bitrate'] = $getid3->info['mpc']['bitrate']; 1.102 + $getid3->info['audio']['encoder'] = 'SV'.$info_mpc_header['stream_major_version']; 1.103 + 1.104 + return true; 1.105 + } 1.106 + 1.107 +} 1.108 + 1.109 + 1.110 +?> 1.111 \ No newline at end of file