38 $info = &$this->getid3->info;
40 $info[
'fileformat'] =
'tta';
41 $info[
'audio'][
'dataformat'] =
'tta';
42 $info[
'audio'][
'lossless'] =
true;
43 $info[
'audio'][
'bitrate_mode'] =
'vbr';
45 fseek($this->getid3->fp,
$info[
'avdataoffset'], SEEK_SET);
46 $ttaheader =
fread($this->getid3->fp, 26);
48 $info[
'tta'][
'magic'] = substr($ttaheader, 0, 3);
50 if (
$info[
'tta'][
'magic'] != $magic) {
52 unset(
$info[
'fileformat']);
53 unset(
$info[
'audio']);
59 switch ($ttaheader{3}) {
64 $info[
'tta'][
'major_version'] = 1;
65 $info[
'avdataoffset'] += 16;
67 $info[
'tta'][
'compression_level'] = ord($ttaheader{3});
73 $info[
'audio'][
'encoder_options'] =
'-e'.$info[
'tta'][
'compression_level'];
74 $info[
'playtime_seconds'] = $info[
'tta'][
'samples_per_channel'] / $info[
'tta'][
'sample_rate'];
79 $info[
'tta'][
'major_version'] = 2;
80 $info[
'avdataoffset'] += 20;
89 $info[
'audio'][
'encoder_options'] =
'-e'.$info[
'tta'][
'compression_level'];
90 $info[
'playtime_seconds'] = $info[
'tta'][
'data_length'] / $info[
'tta'][
'sample_rate'];
95 $info[
'tta'][
'major_version'] = 3;
96 $info[
'avdataoffset'] += 26;
103 $info[
'tta'][
'crc32_footer'] = substr($ttaheader, 18, 4);
106 $info[
'playtime_seconds'] = $info[
'tta'][
'data_length'] / $info[
'tta'][
'sample_rate'];
110 $info[
'error'][] =
'This version of GetId3Core() ['.$this->getid3->version().
'] only knows how to handle TTA v1 and v2 - it may not work correctly with this file which appears to be TTA v'.$ttaheader{3};
116 $info[
'audio'][
'encoder'] =
'TTA v'.$info[
'tta'][
'major_version'];
117 $info[
'audio'][
'bits_per_sample'] =
$info[
'tta'][
'bits_per_sample'];
118 $info[
'audio'][
'sample_rate'] =
$info[
'tta'][
'sample_rate'];
119 $info[
'audio'][
'channels'] =
$info[
'tta'][
'channels'];
120 $info[
'audio'][
'bitrate'] = ((
$info[
'avdataend'] -
$info[
'avdataoffset']) * 8) /
$info[
'playtime_seconds'];
GetId3() by James Heinrich info@getid3.org //.
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
GetId3() by James Heinrich info@getid3.org //.
fseek($bytes, $whence=SEEK_SET)
static LittleEndian2Int($byteword, $signed=false)