37 $info = &$this->getid3->info;
43 $info[
'fileformat'] =
'dts';
46 $DTSheader = $this->
fread(16);
48 $magic =
"\x7F\xFE\x80\x01";
50 if (strpos($DTSheader, $magic) === 0) {
51 $info[
'dts'][
'raw'][
'magic'] = $magic;
55 unset(
$info[
'fileformat']);
65 $info[
'dts'][
'raw'][
'deficit_samples'] = $this->
readBinData($fhBS, $bsOffset, 5);
66 $info[
'dts'][
'flags'][
'crc_present'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
67 $info[
'dts'][
'raw'][
'pcm_sample_blocks'] = $this->
readBinData($fhBS, $bsOffset, 7);
68 $info[
'dts'][
'raw'][
'frame_byte_size'] = $this->
readBinData($fhBS, $bsOffset, 14);
69 $info[
'dts'][
'raw'][
'channel_arrangement'] = $this->
readBinData($fhBS, $bsOffset, 6);
70 $info[
'dts'][
'raw'][
'sample_frequency'] = $this->
readBinData($fhBS, $bsOffset, 4);
72 $info[
'dts'][
'flags'][
'embedded_downmix'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
73 $info[
'dts'][
'flags'][
'dynamicrange'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
74 $info[
'dts'][
'flags'][
'timestamp'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
75 $info[
'dts'][
'flags'][
'auxdata'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
76 $info[
'dts'][
'flags'][
'hdcd'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
77 $info[
'dts'][
'raw'][
'extension_audio'] = $this->
readBinData($fhBS, $bsOffset, 3);
78 $info[
'dts'][
'flags'][
'extended_coding'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
79 $info[
'dts'][
'flags'][
'audio_sync_insertion'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
80 $info[
'dts'][
'raw'][
'lfe_effects'] = $this->
readBinData($fhBS, $bsOffset, 2);
81 $info[
'dts'][
'flags'][
'predictor_history'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
82 if (
$info[
'dts'][
'flags'][
'crc_present']) {
85 $info[
'dts'][
'flags'][
'mri_perfect_reconst'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
86 $info[
'dts'][
'raw'][
'encoder_soft_version'] = $this->
readBinData($fhBS, $bsOffset, 4);
87 $info[
'dts'][
'raw'][
'copy_history'] = $this->
readBinData($fhBS, $bsOffset, 2);
88 $info[
'dts'][
'raw'][
'bits_per_sample'] = $this->
readBinData($fhBS, $bsOffset, 2);
89 $info[
'dts'][
'flags'][
'surround_es'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
90 $info[
'dts'][
'flags'][
'front_sum_diff'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
91 $info[
'dts'][
'flags'][
'surround_sum_diff'] = (bool) $this->
readBinData($fhBS, $bsOffset, 1);
92 $info[
'dts'][
'raw'][
'dialog_normalization'] = $this->
readBinData($fhBS, $bsOffset, 4);
94 $info[
'dts'][
'bitrate'] = self::bitrateLookup(
$info[
'dts'][
'raw'][
'bitrate']);
95 $info[
'dts'][
'bits_per_sample'] = self::bitPerSampleLookup(
$info[
'dts'][
'raw'][
'bits_per_sample']);
96 $info[
'dts'][
'sample_rate'] = self::sampleRateLookup(
$info[
'dts'][
'raw'][
'sample_frequency']);
97 $info[
'dts'][
'dialog_normalization'] = self::dialogNormalization(
$info[
'dts'][
'raw'][
'dialog_normalization'],
$info[
'dts'][
'raw'][
'encoder_soft_version']);
98 $info[
'dts'][
'flags'][
'lossless'] = ((
$info[
'dts'][
'raw'][
'bitrate'] == 31) ?
true :
false);
99 $info[
'dts'][
'bitrate_mode'] = ((
$info[
'dts'][
'raw'][
'bitrate'] == 30) ?
'vbr' :
'cbr');
100 $info[
'dts'][
'channels'] = self::numChannelsLookup(
$info[
'dts'][
'raw'][
'channel_arrangement']);
101 $info[
'dts'][
'channel_arrangement'] = self::channelArrangementLookup(
$info[
'dts'][
'raw'][
'channel_arrangement']);
103 $info[
'audio'][
'dataformat'] =
'dts';
104 $info[
'audio'][
'lossless'] =
$info[
'dts'][
'flags'][
'lossless'];
105 $info[
'audio'][
'bitrate_mode'] =
$info[
'dts'][
'bitrate_mode'];
106 $info[
'audio'][
'bits_per_sample'] =
$info[
'dts'][
'bits_per_sample'];
107 $info[
'audio'][
'sample_rate'] =
$info[
'dts'][
'sample_rate'];
108 $info[
'audio'][
'channels'] =
$info[
'dts'][
'channels'];
109 $info[
'audio'][
'bitrate'] =
$info[
'dts'][
'bitrate'];
110 if (isset(
$info[
'avdataend'])) {
111 $info[
'playtime_seconds'] = (
$info[
'avdataend'] -
$info[
'avdataoffset']) / (
$info[
'dts'][
'bitrate'] / 8);
126 $data = substr($bin, $offset, $length);
129 return bindec(
$data);
139 $DTSbitrateLookup =
array(
174 return (isset($DTSbitrateLookup[$index]) ? $DTSbitrateLookup[$index] :
false);
184 $DTSsampleRateLookup =
array(
203 return (isset($DTSsampleRateLookup[$index]) ? $DTSsampleRateLookup[$index] :
false);
213 $DTSbitPerSampleLookup =
array(
220 return (isset($DTSbitPerSampleLookup[$index]) ? $DTSbitPerSampleLookup[$index] :
false);
275 $DTSchannelArrangementLookup =
array(
277 1 =>
'A + B (dual mono)',
278 2 =>
'L + R (stereo)',
279 3 =>
'(L+R) + (L-R) (sum-difference)',
280 4 =>
'LT + RT (left and right total)',
283 7 =>
'C + L + R + S',
284 8 =>
'L + R + SL + SR',
285 9 =>
'C + L + R + SL + SR',
286 10 =>
'CL + CR + L + R + SL + SR',
287 11 =>
'C + L + R+ LR + RR + OV',
288 12 =>
'CF + CR + LF + RF + LR + RR',
289 13 =>
'CL + C + CR + L + R + SL + SR',
290 14 =>
'CL + CR + L + R + SL1 + SL2 + SR1 + SR2',
291 15 =>
'CL + C+ CR + L + R + SL + S + SR',
294 return (isset($DTSchannelArrangementLookup[$index]) ? $DTSchannelArrangementLookup[$index] :
'user-defined');
310 return 0 - 16 - $index;
static bitrateLookup($index)
static BigEndian2Bin($byteword)
static numChannelsLookup($index)
static dialogNormalization($index, $version)
readBinData($bin, &$offset, $length)
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
GetId3() by James Heinrich info@getid3.org //.
static sampleRateLookup($index)
fseek($bytes, $whence=SEEK_SET)
static channelArrangementLookup($index)
Create styles array
The data for the language used.
GetId3() by James Heinrich info@getid3.org //.
static bitPerSampleLookup($index)