49 $info = &$this->getid3->info;
53 $thisfile_ac3 = &
$info[
'ac3'];
54 $thisfile_ac3_raw = &$thisfile_ac3[
'raw'];
55 $thisfile_ac3_raw_bsi = &$thisfile_ac3_raw[
'bsi'];
59 $info[
'fileformat'] =
'ac3';
80 $this->AC3header[
'syncinfo'] = $this->
fread(5);
84 if (strpos($this->AC3header[
'syncinfo'], $magic) === 0) {
85 $thisfile_ac3_raw[
'synchinfo'][
'synchword'] = $magic;
94 $this->
fseek(-2, SEEK_CUR);
97 $info[
'audio'][
'dataformat'] =
'ac3';
98 $info[
'audio'][
'bitrate_mode'] =
'cbr';
99 $info[
'audio'][
'lossless'] =
false;
101 $thisfile_ac3_raw[
'synchinfo'][
'crc1'] =
Helper::LittleEndian2Int(substr($this->AC3header[
'syncinfo'], $offset, 2));
103 $thisfile_ac3_raw[
'synchinfo'][
'fscod'] = ($ac3_synchinfo_fscod_frmsizecod & 0xC0) >> 6;
104 $thisfile_ac3_raw[
'synchinfo'][
'frmsizecod'] = ($ac3_synchinfo_fscod_frmsizecod & 0x3F);
106 $thisfile_ac3[
'sample_rate'] = self::sampleRateCodeLookup($thisfile_ac3_raw[
'synchinfo'][
'fscod']);
107 if ($thisfile_ac3_raw[
'synchinfo'][
'fscod'] <= 3) {
108 $info[
'audio'][
'sample_rate'] = $thisfile_ac3[
'sample_rate'];
111 $thisfile_ac3[
'frame_length'] = self::frameSizeLookup($thisfile_ac3_raw[
'synchinfo'][
'frmsizecod'], $thisfile_ac3_raw[
'synchinfo'][
'fscod']);
112 $thisfile_ac3[
'bitrate'] = self::bitrateLookup($thisfile_ac3_raw[
'synchinfo'][
'frmsizecod']);
113 $info[
'audio'][
'bitrate'] = $thisfile_ac3[
'bitrate'];
119 if ($thisfile_ac3_raw_bsi[
'bsid'] > 8) {
123 $this->
error(
'Bit stream identification is version '.$thisfile_ac3_raw_bsi[
'bsid'].
', but GetId3Core() only understands up to version 8');
132 $thisfile_ac3[
'service_type'] = self::serviceTypeLookup($thisfile_ac3_raw_bsi[
'bsmod'], $thisfile_ac3_raw_bsi[
'acmod']);
133 $ac3_coding_mode = self::audioCodingModeLookup($thisfile_ac3_raw_bsi[
'acmod']);
134 foreach ($ac3_coding_mode as $key => $value) {
135 $thisfile_ac3[$key] = $value;
137 switch ($thisfile_ac3_raw_bsi[
'acmod']) {
140 $info[
'audio'][
'channelmode'] =
'mono';
144 $info[
'audio'][
'channelmode'] =
'stereo';
147 $info[
'audio'][
'channelmode'] =
'surround';
150 $info[
'audio'][
'channels'] = $thisfile_ac3[
'num_channels'];
152 if ($thisfile_ac3_raw_bsi[
'acmod'] & 0x01) {
155 $thisfile_ac3[
'center_mix_level'] = self::centerMixLevelLookup($thisfile_ac3_raw_bsi[
'cmixlev']);
158 if ($thisfile_ac3_raw_bsi[
'acmod'] & 0x04) {
160 $thisfile_ac3_raw_bsi[
'surmixlev'] = $this->
readHeaderBSI(2);
161 $thisfile_ac3[
'surround_mix_level'] = self::surroundMixLevelLookup($thisfile_ac3_raw_bsi[
'surmixlev']);
164 if ($thisfile_ac3_raw_bsi[
'acmod'] == 0x02) {
167 $thisfile_ac3[
'dolby_surround_mode'] = self::dolbySurroundModeLookup($thisfile_ac3_raw_bsi[
'dsurmod']);
170 $thisfile_ac3_raw_bsi[
'lfeon'] = (bool) $this->
readHeaderBSI(1);
171 $thisfile_ac3[
'lfe_enabled'] = $thisfile_ac3_raw_bsi[
'lfeon'];
172 if ($thisfile_ac3_raw_bsi[
'lfeon']) {
174 $info[
'audio'][
'channels'] .=
'.1';
177 $thisfile_ac3[
'channels_enabled'] = self::channelsEnabledLookup($thisfile_ac3_raw_bsi[
'acmod'], $thisfile_ac3_raw_bsi[
'lfeon']);
182 $thisfile_ac3[
'dialogue_normalization'] =
'-'.$thisfile_ac3_raw_bsi[
'dialnorm'].
'dB';
184 $thisfile_ac3_raw_bsi[
'compre_flag'] = (bool) $this->
readHeaderBSI(1);
185 if ($thisfile_ac3_raw_bsi[
'compre_flag']) {
187 $thisfile_ac3[
'heavy_compression'] = self::heavyCompression($thisfile_ac3_raw_bsi[
'compr']);
190 $thisfile_ac3_raw_bsi[
'langcode_flag'] = (bool) $this->
readHeaderBSI(1);
191 if ($thisfile_ac3_raw_bsi[
'langcode_flag']) {
195 $thisfile_ac3_raw_bsi[
'audprodie'] = (bool) $this->
readHeaderBSI(1);
196 if ($thisfile_ac3_raw_bsi[
'audprodie']) {
200 $thisfile_ac3[
'mixing_level'] = (80 + $thisfile_ac3_raw_bsi[
'mixlevel']).
'dB';
201 $thisfile_ac3[
'room_type'] = self::roomTypeLookup($thisfile_ac3_raw_bsi[
'roomtyp']);
204 if ($thisfile_ac3_raw_bsi[
'acmod'] == 0x00) {
211 $thisfile_ac3_raw_bsi[
'dialnorm2'] = $this->
readHeaderBSI(5);
212 $thisfile_ac3[
'dialogue_normalization2'] =
'-'.$thisfile_ac3_raw_bsi[
'dialnorm2'].
'dB';
214 $thisfile_ac3_raw_bsi[
'compre_flag2'] = (bool) $this->
readHeaderBSI(1);
215 if ($thisfile_ac3_raw_bsi[
'compre_flag2']) {
217 $thisfile_ac3[
'heavy_compression2'] = self::heavyCompression($thisfile_ac3_raw_bsi[
'compr2']);
220 $thisfile_ac3_raw_bsi[
'langcode_flag2'] = (bool) $this->
readHeaderBSI(1);
221 if ($thisfile_ac3_raw_bsi[
'langcode_flag2']) {
225 $thisfile_ac3_raw_bsi[
'audprodie2'] = (bool) $this->
readHeaderBSI(1);
226 if ($thisfile_ac3_raw_bsi[
'audprodie2']) {
227 $thisfile_ac3_raw_bsi[
'mixlevel2'] = $this->
readHeaderBSI(5);
230 $thisfile_ac3[
'mixing_level2'] = (80 + $thisfile_ac3_raw_bsi[
'mixlevel2']).
'dB';
231 $thisfile_ac3[
'room_type2'] = self::roomTypeLookup($thisfile_ac3_raw_bsi[
'roomtyp2']);
236 $thisfile_ac3_raw_bsi[
'copyright'] = (bool) $this->
readHeaderBSI(1);
238 $thisfile_ac3_raw_bsi[
'original'] = (bool) $this->
readHeaderBSI(1);
240 $thisfile_ac3_raw_bsi[
'timecode1_flag'] = (bool) $this->
readHeaderBSI(1);
241 if ($thisfile_ac3_raw_bsi[
'timecode1_flag']) {
242 $thisfile_ac3_raw_bsi[
'timecode1'] = $this->
readHeaderBSI(14);
245 $thisfile_ac3_raw_bsi[
'timecode2_flag'] = (bool) $this->
readHeaderBSI(1);
246 if ($thisfile_ac3_raw_bsi[
'timecode2_flag']) {
247 $thisfile_ac3_raw_bsi[
'timecode2'] = $this->
readHeaderBSI(14);
250 $thisfile_ac3_raw_bsi[
'addbsi_flag'] = (bool) $this->
readHeaderBSI(1);
251 if ($thisfile_ac3_raw_bsi[
'addbsi_flag']) {
252 $thisfile_ac3_raw_bsi[
'addbsi_length'] = $this->
readHeaderBSI(6);
256 $thisfile_ac3_raw_bsi[
'addbsi_data'] = substr($this->AC3header[
'bsi'], $this->BSIoffset, $thisfile_ac3_raw_bsi[
'addbsi_length'] * 8);
257 $this->BSIoffset += $thisfile_ac3_raw_bsi[
'addbsi_length'] * 8;
static BigEndian2Bin($byteword)
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
fseek($bytes, $whence=SEEK_SET)
Create styles array
The data for the language used.
static LittleEndian2Int($byteword, $signed=false)