3 /////////////////////////////////////////////////////////////////
4 /// getID3() by James Heinrich <info@getid3.org> //
5 // available at https://github.com/JamesHeinrich/getID3 //
6 // or https://www.getid3.org //
7 // or http://getid3.sourceforge.net //
8 // see readme.txt for more details //
9 /////////////////////////////////////////////////////////////////
11 // module.audio.mpc.php //
12 // module for analyzing Musepack/MPEG+ Audio files //
13 // dependencies: NONE //
15 /////////////////////////////////////////////////////////////////
18 class getid3_mpc
extends getid3_handler
23 public function Analyze() {
24 $info = &$this->getid3
->info
;
26 $info['mpc']['header'] = array();
27 $thisfile_mpc_header = &$info['mpc']['header'];
29 $info['fileformat'] = 'mpc';
30 $info['audio']['dataformat'] = 'mpc';
31 $info['audio']['bitrate_mode'] = 'vbr';
32 $info['audio']['channels'] = 2; // up to SV7 the format appears to have been hardcoded for stereo only
33 $info['audio']['lossless'] = false;
35 $this->fseek($info['avdataoffset']);
36 $MPCheaderData = $this->fread(4);
37 $info['mpc']['header']['preamble'] = substr($MPCheaderData, 0, 4); // should be 'MPCK' (SV8) or 'MP+' (SV7), otherwise possible stream data (SV4-SV6)
38 if (preg_match('#^MPCK#', $info['mpc']['header']['preamble'])) {
41 return $this->ParseMPCsv8();
43 } elseif (preg_match('#^MP\+#', $info['mpc']['header']['preamble'])) {
46 return $this->ParseMPCsv7();
48 } elseif (preg_match('/^[\x00\x01\x10\x11\x40\x41\x50\x51\x80\x81\x90\x91\xC0\xC1\xD0\xD1][\x20-37][\x00\x20\x40\x60\x80\xA0\xC0\xE0]/s', $MPCheaderData)) {
50 // this is SV4 - SV6, handle seperately
51 return $this->ParseMPCsv6();
55 $this->error('Expecting "MP+" or "MPCK" at offset '.$info['avdataoffset'].', found "'.getid3_lib
::PrintHexBytes(substr($MPCheaderData, 0, 4)).'"');
56 unset($info['fileformat']);
66 public function ParseMPCsv8() {
68 // http://trac.musepack.net/trac/wiki/SV8Specification
70 $info = &$this->getid3
->info
;
71 $thisfile_mpc_header = &$info['mpc']['header'];
74 $maxHandledPacketLength = 9; // specs say: "n*8; 0 < n < 10"
76 $offset = $this->ftell();
77 while ($offset < $info['avdataend']) {
78 $thisPacket = array();
79 $thisPacket['offset'] = $offset;
82 // Size is a variable-size field, could be 1-4 bytes (possibly more?)
83 // read enough data in and figure out the exact size later
84 $MPCheaderData = $this->fread($keyNameSize +
$maxHandledPacketLength);
85 $packet_offset +
= $keyNameSize;
86 $thisPacket['key'] = substr($MPCheaderData, 0, $keyNameSize);
87 $thisPacket['key_name'] = $this->MPCsv8PacketName($thisPacket['key']);
88 if ($thisPacket['key'] == $thisPacket['key_name']) {
89 $this->error('Found unexpected key value "'.$thisPacket['key'].'" at offset '.$thisPacket['offset']);
93 $thisPacket['packet_size'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $keyNameSize), $packetLength); // includes keyname and packet_size field
94 if ($thisPacket['packet_size'] === false) {
95 $this->error('Did not find expected packet length within '.$maxHandledPacketLength.' bytes at offset '.($thisPacket['offset'] +
$keyNameSize));
98 $packet_offset +
= $packetLength;
99 $offset +
= $thisPacket['packet_size'];
101 switch ($thisPacket['key']) {
102 case 'SH': // Stream Header
103 $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength;
104 if ($moreBytesToRead > 0) {
105 $MPCheaderData .= $this->fread($moreBytesToRead);
107 $thisPacket['crc'] = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 4));
109 $thisPacket['stream_version'] = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
113 $thisPacket['sample_count'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength);
114 $packet_offset +
= $packetLength;
117 $thisPacket['beginning_silence'] = $this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength);
118 $packet_offset +
= $packetLength;
120 $otherUsefulData = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2));
122 $thisPacket['sample_frequency_raw'] = (($otherUsefulData & 0xE000) >> 13);
123 $thisPacket['max_bands_used'] = (($otherUsefulData & 0x1F00) >> 8);
124 $thisPacket['channels'] = (($otherUsefulData & 0x00F0) >> 4) +
1;
125 $thisPacket['ms_used'] = (bool) (($otherUsefulData & 0x0008) >> 3);
126 $thisPacket['audio_block_frames'] = (($otherUsefulData & 0x0007) >> 0);
127 $thisPacket['sample_frequency'] = $this->MPCfrequencyLookup($thisPacket['sample_frequency_raw']);
129 $thisfile_mpc_header['mid_side_stereo'] = $thisPacket['ms_used'];
130 $thisfile_mpc_header['sample_rate'] = $thisPacket['sample_frequency'];
131 $thisfile_mpc_header['samples'] = $thisPacket['sample_count'];
132 $thisfile_mpc_header['stream_version_major'] = $thisPacket['stream_version'];
134 $info['audio']['channels'] = $thisPacket['channels'];
135 $info['audio']['sample_rate'] = $thisPacket['sample_frequency'];
136 $info['playtime_seconds'] = $thisPacket['sample_count'] / $thisPacket['sample_frequency'];
137 $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
140 case 'RG': // Replay Gain
141 $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength;
142 if ($moreBytesToRead > 0) {
143 $MPCheaderData .= $this->fread($moreBytesToRead);
145 $thisPacket['replaygain_version'] = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
147 $thisPacket['replaygain_title_gain'] = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2));
149 $thisPacket['replaygain_title_peak'] = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2));
151 $thisPacket['replaygain_album_gain'] = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2));
153 $thisPacket['replaygain_album_peak'] = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 2));
156 if ($thisPacket['replaygain_title_gain']) { $info['replay_gain']['title']['gain'] = $thisPacket['replaygain_title_gain']; }
157 if ($thisPacket['replaygain_title_peak']) { $info['replay_gain']['title']['peak'] = $thisPacket['replaygain_title_peak']; }
158 if ($thisPacket['replaygain_album_gain']) { $info['replay_gain']['album']['gain'] = $thisPacket['replaygain_album_gain']; }
159 if ($thisPacket['replaygain_album_peak']) { $info['replay_gain']['album']['peak'] = $thisPacket['replaygain_album_peak']; }
162 case 'EI': // Encoder Info
163 $moreBytesToRead = $thisPacket['packet_size'] - $keyNameSize - $maxHandledPacketLength;
164 if ($moreBytesToRead > 0) {
165 $MPCheaderData .= $this->fread($moreBytesToRead);
167 $profile_pns = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
169 $quality_int = (($profile_pns & 0xF0) >> 4);
170 $quality_dec = (($profile_pns & 0x0E) >> 3);
171 $thisPacket['quality'] = (float) $quality_int +
($quality_dec / 8);
172 $thisPacket['pns_tool'] = (bool) (($profile_pns & 0x01) >> 0);
173 $thisPacket['version_major'] = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
175 $thisPacket['version_minor'] = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
177 $thisPacket['version_build'] = getid3_lib
::BigEndian2Int(substr($MPCheaderData, $packet_offset, 1));
179 $thisPacket['version'] = $thisPacket['version_major'].'.'.$thisPacket['version_minor'].'.'.$thisPacket['version_build'];
181 $info['audio']['encoder'] = 'MPC v'.$thisPacket['version'].' ('.(($thisPacket['version_minor'] %
2) ?
'unstable' : 'stable').')';
182 $thisfile_mpc_header['encoder_version'] = $info['audio']['encoder'];
183 //$thisfile_mpc_header['quality'] = (float) ($thisPacket['quality'] / 1.5875); // values can range from 0.000 to 15.875, mapped to qualities of 0.0 to 10.0
184 $thisfile_mpc_header['quality'] = (float) ($thisPacket['quality'] - 5); // values can range from 0.000 to 15.875, of which 0..4 are "reserved/experimental", and 5..15 are mapped to qualities of 0.0 to 10.0
187 case 'SO': // Seek Table Offset
189 $thisPacket['seek_table_offset'] = $thisPacket['offset'] +
$this->SV8variableLengthInteger(substr($MPCheaderData, $packet_offset, $maxHandledPacketLength), $packetLength);
190 $packet_offset +
= $packetLength;
193 case 'ST': // Seek Table
194 case 'SE': // Stream End
195 case 'AP': // Audio Data
196 // nothing useful here, just skip this packet
197 $thisPacket = array();
201 $this->error('Found unhandled key type "'.$thisPacket['key'].'" at offset '.$thisPacket['offset']);
205 if (!empty($thisPacket)) {
206 $info['mpc']['packets'][] = $thisPacket;
208 $this->fseek($offset);
210 $thisfile_mpc_header['size'] = $offset;
217 public function ParseMPCsv7() {
219 // http://www.uni-jena.de/~pfk/mpp/sv8/header.html
221 $info = &$this->getid3
->info
;
222 $thisfile_mpc_header = &$info['mpc']['header'];
225 $thisfile_mpc_header['size'] = 28;
226 $MPCheaderData = $info['mpc']['header']['preamble'];
227 $MPCheaderData .= $this->fread($thisfile_mpc_header['size'] - strlen($info['mpc']['header']['preamble']));
228 $offset = strlen('MP+');
230 $StreamVersionByte = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, $offset, 1));
232 $thisfile_mpc_header['stream_version_major'] = ($StreamVersionByte & 0x0F) >> 0;
233 $thisfile_mpc_header['stream_version_minor'] = ($StreamVersionByte & 0xF0) >> 4; // should always be 0, subversions no longer exist in SV8
234 $thisfile_mpc_header['frame_count'] = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, $offset, 4));
237 if ($thisfile_mpc_header['stream_version_major'] != 7) {
238 $this->error('Only Musepack SV7 supported (this file claims to be v'.$thisfile_mpc_header['stream_version_major'].')');
242 $FlagsDWORD1 = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, $offset, 4));
244 $thisfile_mpc_header['intensity_stereo'] = (bool) (($FlagsDWORD1 & 0x80000000) >> 31);
245 $thisfile_mpc_header['mid_side_stereo'] = (bool) (($FlagsDWORD1 & 0x40000000) >> 30);
246 $thisfile_mpc_header['max_subband'] = ($FlagsDWORD1 & 0x3F000000) >> 24;
247 $thisfile_mpc_header['raw']['profile'] = ($FlagsDWORD1 & 0x00F00000) >> 20;
248 $thisfile_mpc_header['begin_loud'] = (bool) (($FlagsDWORD1 & 0x00080000) >> 19);
249 $thisfile_mpc_header['end_loud'] = (bool) (($FlagsDWORD1 & 0x00040000) >> 18);
250 $thisfile_mpc_header['raw']['sample_rate'] = ($FlagsDWORD1 & 0x00030000) >> 16;
251 $thisfile_mpc_header['max_level'] = ($FlagsDWORD1 & 0x0000FFFF);
253 $thisfile_mpc_header['raw']['title_peak'] = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, $offset, 2));
255 $thisfile_mpc_header['raw']['title_gain'] = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, $offset, 2), true);
258 $thisfile_mpc_header['raw']['album_peak'] = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, $offset, 2));
260 $thisfile_mpc_header['raw']['album_gain'] = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, $offset, 2), true);
263 $FlagsDWORD2 = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, $offset, 4));
265 $thisfile_mpc_header['true_gapless'] = (bool) (($FlagsDWORD2 & 0x80000000) >> 31);
266 $thisfile_mpc_header['last_frame_length'] = ($FlagsDWORD2 & 0x7FF00000) >> 20;
269 $thisfile_mpc_header['raw']['not_sure_what'] = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, $offset, 3));
271 $thisfile_mpc_header['raw']['encoder_version'] = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, $offset, 1));
274 $thisfile_mpc_header['profile'] = $this->MPCprofileNameLookup($thisfile_mpc_header['raw']['profile']);
275 $thisfile_mpc_header['sample_rate'] = $this->MPCfrequencyLookup($thisfile_mpc_header['raw']['sample_rate']);
276 if ($thisfile_mpc_header['sample_rate'] == 0) {
277 $this->error('Corrupt MPC file: frequency == zero');
280 $info['audio']['sample_rate'] = $thisfile_mpc_header['sample_rate'];
281 $thisfile_mpc_header['samples'] = ((($thisfile_mpc_header['frame_count'] - 1) * 1152) +
$thisfile_mpc_header['last_frame_length']) * $info['audio']['channels'];
283 $info['playtime_seconds'] = ($thisfile_mpc_header['samples'] / $info['audio']['channels']) / $info['audio']['sample_rate'];
284 if ($info['playtime_seconds'] == 0) {
285 $this->error('Corrupt MPC file: playtime_seconds == zero');
289 // add size of file header to avdataoffset - calc bitrate correctly + MD5 data
290 $info['avdataoffset'] +
= $thisfile_mpc_header['size'];
292 $info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
294 $thisfile_mpc_header['title_peak'] = $thisfile_mpc_header['raw']['title_peak'];
295 $thisfile_mpc_header['title_peak_db'] = $this->MPCpeakDBLookup($thisfile_mpc_header['title_peak']);
296 if ($thisfile_mpc_header['raw']['title_gain'] < 0) {
297 $thisfile_mpc_header['title_gain_db'] = (float) (32768 +
$thisfile_mpc_header['raw']['title_gain']) / -100;
299 $thisfile_mpc_header['title_gain_db'] = (float) $thisfile_mpc_header['raw']['title_gain'] / 100;
302 $thisfile_mpc_header['album_peak'] = $thisfile_mpc_header['raw']['album_peak'];
303 $thisfile_mpc_header['album_peak_db'] = $this->MPCpeakDBLookup($thisfile_mpc_header['album_peak']);
304 if ($thisfile_mpc_header['raw']['album_gain'] < 0) {
305 $thisfile_mpc_header['album_gain_db'] = (float) (32768 +
$thisfile_mpc_header['raw']['album_gain']) / -100;
307 $thisfile_mpc_header['album_gain_db'] = (float) $thisfile_mpc_header['raw']['album_gain'] / 100;;
309 $thisfile_mpc_header['encoder_version'] = $this->MPCencoderVersionLookup($thisfile_mpc_header['raw']['encoder_version']);
311 $info['replay_gain']['track']['adjustment'] = $thisfile_mpc_header['title_gain_db'];
312 $info['replay_gain']['album']['adjustment'] = $thisfile_mpc_header['album_gain_db'];
314 if ($thisfile_mpc_header['title_peak'] > 0) {
315 $info['replay_gain']['track']['peak'] = $thisfile_mpc_header['title_peak'];
316 } elseif (round($thisfile_mpc_header['max_level'] * 1.18) > 0) {
317 $info['replay_gain']['track']['peak'] = getid3_lib
::CastAsInt(round($thisfile_mpc_header['max_level'] * 1.18)); // why? I don't know - see mppdec.c
319 if ($thisfile_mpc_header['album_peak'] > 0) {
320 $info['replay_gain']['album']['peak'] = $thisfile_mpc_header['album_peak'];
323 //$info['audio']['encoder'] = 'SV'.$thisfile_mpc_header['stream_version_major'].'.'.$thisfile_mpc_header['stream_version_minor'].', '.$thisfile_mpc_header['encoder_version'];
324 $info['audio']['encoder'] = $thisfile_mpc_header['encoder_version'];
325 $info['audio']['encoder_options'] = $thisfile_mpc_header['profile'];
326 $thisfile_mpc_header['quality'] = (float) ($thisfile_mpc_header['raw']['profile'] - 5); // values can range from 0 to 15, of which 0..4 are "reserved/experimental", and 5..15 are mapped to qualities of 0.0 to 10.0
334 public function ParseMPCsv6() {
337 $info = &$this->getid3
->info
;
338 $thisfile_mpc_header = &$info['mpc']['header'];
341 $thisfile_mpc_header['size'] = 8;
342 $this->fseek($info['avdataoffset']);
343 $MPCheaderData = $this->fread($thisfile_mpc_header['size']);
345 // add size of file header to avdataoffset - calc bitrate correctly + MD5 data
346 $info['avdataoffset'] +
= $thisfile_mpc_header['size'];
348 // Most of this code adapted from Jurgen Faul's MPEGplus source code - thanks Jurgen! :)
349 $HeaderDWORD[0] = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, 0, 4));
350 $HeaderDWORD[1] = getid3_lib
::LittleEndian2Int(substr($MPCheaderData, 4, 4));
353 // DDDD DDDD CCCC CCCC BBBB BBBB AAAA AAAA
354 // aaaa aaaa abcd dddd dddd deee eeff ffff
356 // a = bitrate = anything
359 // d = streamversion = 0000000004 or 0000000005 or 0000000006
360 // e = maxband = anything
361 // f = blocksize = 000001 for SV5+, anything(?) for SV4
363 $thisfile_mpc_header['target_bitrate'] = (($HeaderDWORD[0] & 0xFF800000) >> 23);
364 $thisfile_mpc_header['intensity_stereo'] = (bool) (($HeaderDWORD[0] & 0x00400000) >> 22);
365 $thisfile_mpc_header['mid_side_stereo'] = (bool) (($HeaderDWORD[0] & 0x00200000) >> 21);
366 $thisfile_mpc_header['stream_version_major'] = ($HeaderDWORD[0] & 0x001FF800) >> 11;
367 $thisfile_mpc_header['stream_version_minor'] = 0; // no sub-version numbers before SV7
368 $thisfile_mpc_header['max_band'] = ($HeaderDWORD[0] & 0x000007C0) >> 6; // related to lowpass frequency, not sure how it translates exactly
369 $thisfile_mpc_header['block_size'] = ($HeaderDWORD[0] & 0x0000003F);
371 switch ($thisfile_mpc_header['stream_version_major']) {
373 $thisfile_mpc_header['frame_count'] = ($HeaderDWORD[1] >> 16);
378 $thisfile_mpc_header['frame_count'] = $HeaderDWORD[1];
382 $info['error'] = 'Expecting 4, 5 or 6 in version field, found '.$thisfile_mpc_header['stream_version_major'].' instead';
388 if (($thisfile_mpc_header['stream_version_major'] > 4) && ($thisfile_mpc_header['block_size'] != 1)) {
389 $this->warning('Block size expected to be 1, actual value found: '.$thisfile_mpc_header['block_size']);
392 $thisfile_mpc_header['sample_rate'] = 44100; // AB: used by all files up to SV7
393 $info['audio']['sample_rate'] = $thisfile_mpc_header['sample_rate'];
394 $thisfile_mpc_header['samples'] = $thisfile_mpc_header['frame_count'] * 1152 * $info['audio']['channels'];
396 if ($thisfile_mpc_header['target_bitrate'] == 0) {
397 $info['audio']['bitrate_mode'] = 'vbr';
399 $info['audio']['bitrate_mode'] = 'cbr';
402 $info['mpc']['bitrate'] = ($info['avdataend'] - $info['avdataoffset']) * 8 * 44100 / $thisfile_mpc_header['frame_count'] / 1152;
403 $info['audio']['bitrate'] = $info['mpc']['bitrate'];
404 $info['audio']['encoder'] = 'SV'.$thisfile_mpc_header['stream_version_major'];
410 * @param int $profileid
414 public function MPCprofileNameLookup($profileid) {
415 static $MPCprofileNameLookup = array(
421 5 => 'below Telephone (q = 0.0)',
422 6 => 'below Telephone (q = 1.0)',
423 7 => 'Telephone (q = 2.0)',
424 8 => 'Thumb (q = 3.0)',
425 9 => 'Radio (q = 4.0)',
426 10 => 'Standard (q = 5.0)',
427 11 => 'Extreme (q = 6.0)',
428 12 => 'Insane (q = 7.0)',
429 13 => 'BrainDead (q = 8.0)',
430 14 => 'above BrainDead (q = 9.0)',
431 15 => 'above BrainDead (q = 10.0)'
433 return (isset($MPCprofileNameLookup[$profileid]) ?
$MPCprofileNameLookup[$profileid] : 'invalid');
437 * @param int $frequencyid
441 public function MPCfrequencyLookup($frequencyid) {
442 static $MPCfrequencyLookup = array(
448 return (isset($MPCfrequencyLookup[$frequencyid]) ?
$MPCfrequencyLookup[$frequencyid] : 'invalid');
452 * @param int $intvalue
454 * @return float|false
456 public function MPCpeakDBLookup($intvalue) {
458 return ((log10($intvalue) / log10(2)) - 15) * 6;
464 * @param int $encoderversion
468 public function MPCencoderVersionLookup($encoderversion) {
469 //Encoder version * 100 (106 = 1.06)
470 //EncoderVersion % 10 == 0 Release (1.0)
471 //EncoderVersion % 2 == 0 Beta (1.06)
472 //EncoderVersion % 2 == 1 Alpha (1.05a...z)
474 if ($encoderversion == 0) {
475 // very old version, not known exactly which
476 return 'Buschmann v1.7.0-v1.7.9 or Klemm v0.90-v1.05';
479 if (($encoderversion %
10) == 0) {
482 return number_format($encoderversion / 100, 2);
484 } elseif (($encoderversion %
2) == 0) {
487 return number_format($encoderversion / 100, 2).' beta';
492 return number_format($encoderversion / 100, 2).' alpha';
496 * @param string $data
497 * @param int $packetLength
498 * @param int $maxHandledPacketLength
502 public function SV8variableLengthInteger($data, &$packetLength, $maxHandledPacketLength=9) {
504 for ($packetLength = 1; $packetLength <= $maxHandledPacketLength; $packetLength++
) {
505 // variable-length size field:
507 // 0xxx xxxx - value 0 to 2^7-1
508 // 1xxx xxxx 0xxx xxxx - value 0 to 2^14-1
509 // 1xxx xxxx 1xxx xxxx 0xxx xxxx - value 0 to 2^21-1
510 // 1xxx xxxx 1xxx xxxx 1xxx xxxx 0xxx xxxx - value 0 to 2^28-1
512 $thisbyte = ord(substr($data, ($packetLength - 1), 1));
513 // look through bytes until find a byte with MSB==0
514 $packet_size = ($packet_size << 7);
515 $packet_size = ($packet_size |
($thisbyte & 0x7F));
516 if (($thisbyte & 0x80) === 0) {
519 if ($packetLength >= $maxHandledPacketLength) {
527 * @param string $packetKey
531 public function MPCsv8PacketName($packetKey) {
532 static $MPCsv8PacketName = array();
533 if (empty($MPCsv8PacketName)) {
534 $MPCsv8PacketName = array(
535 'AP' => 'Audio Packet',
536 'CT' => 'Chapter Tag',
537 'EI' => 'Encoder Info',
538 'RG' => 'Replay Gain',
539 'SE' => 'Stream End',
540 'SH' => 'Stream Header',
541 'SO' => 'Seek Table Offset',
542 'ST' => 'Seek Table',
545 return (isset($MPCsv8PacketName[$packetKey]) ?
$MPCsv8PacketName[$packetKey] : $packetKey);