25 {
26 $info = &$this->getid3->info;
27
29 $info[
'ac3'][
'raw'][
'bsi'] = array();
30 $thisfile_ac3 = &
$info[
'ac3'];
31 $thisfile_ac3_raw = &$thisfile_ac3['raw'];
32 $thisfile_ac3_raw_bsi = &$thisfile_ac3_raw['bsi'];
33
34
35
36
37 $info[
'fileformat'] =
'ac3';
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
58 $tempAC3header = $this->
fread(100);
62 unset($tempAC3header);
63
64 if ($this->AC3header['syncinfo'] !== self::syncword) {
67 return $this->
error(
'Expecting "'.dechex(self::syncword).
'" at offset '.
$info[
'avdataoffset'].
', found "'.dechex($this->AC3header[
'syncinfo']).
'"');
68 }
69 }
70
71 $info[
'audio'][
'dataformat'] =
'ac3';
72 $info[
'audio'][
'bitrate_mode'] =
'cbr';
73 $info[
'audio'][
'lossless'] =
false;
74
75 if ($thisfile_ac3_raw_bsi['bsid'] <= 8) {
76
79 $thisfile_ac3_raw_bsi[
'frmsizecod'] = $this->
readHeaderBSI(6);
80 if ($thisfile_ac3_raw_bsi['frmsizecod'] > 37) {
81 $this->
warning(
'Unexpected ac3.bsi.frmsizecod value: '.$thisfile_ac3_raw_bsi[
'frmsizecod'].
', bitrate not set correctly');
82 }
83
87
88 if ($thisfile_ac3_raw_bsi['acmod'] & 0x01) {
89
92 }
93
94 if ($thisfile_ac3_raw_bsi['acmod'] & 0x04) {
95
98 }
99
100 if ($thisfile_ac3_raw_bsi['acmod'] == 0x02) {
101
104 }
105
106 $thisfile_ac3_raw_bsi[
'flags'][
'lfeon'] = (bool) $this->
readHeaderBSI(1);
107
108
109
111
112 $thisfile_ac3_raw_bsi[
'flags'][
'compr'] = (bool) $this->
readHeaderBSI(1);
113 if ($thisfile_ac3_raw_bsi['flags']['compr']) {
116 }
117
118 $thisfile_ac3_raw_bsi[
'flags'][
'langcod'] = (bool) $this->
readHeaderBSI(1);
119 if ($thisfile_ac3_raw_bsi['flags']['langcod']) {
121 }
122
123 $thisfile_ac3_raw_bsi[
'flags'][
'audprodinfo'] = (bool) $this->
readHeaderBSI(1);
124 if ($thisfile_ac3_raw_bsi['flags']['audprodinfo']) {
127
128 $thisfile_ac3['mixing_level'] = (80 + $thisfile_ac3_raw_bsi['mixlevel']).'dB';
130 }
131
132
133 $thisfile_ac3_raw_bsi[
'dialnorm2'] = $this->
readHeaderBSI(5);
134 $thisfile_ac3['dialogue_normalization2'] = '-'.$thisfile_ac3_raw_bsi['dialnorm2'].'dB';
135
136 $thisfile_ac3_raw_bsi[
'flags'][
'compr2'] = (bool) $this->
readHeaderBSI(1);
137 if ($thisfile_ac3_raw_bsi['flags']['compr2']) {
140 }
141
142 $thisfile_ac3_raw_bsi[
'flags'][
'langcod2'] = (bool) $this->
readHeaderBSI(1);
143 if ($thisfile_ac3_raw_bsi['flags']['langcod2']) {
145 }
146
147 $thisfile_ac3_raw_bsi[
'flags'][
'audprodinfo2'] = (bool) $this->
readHeaderBSI(1);
148 if ($thisfile_ac3_raw_bsi['flags']['audprodinfo2']) {
149 $thisfile_ac3_raw_bsi[
'mixlevel2'] = $this->
readHeaderBSI(5);
151
152 $thisfile_ac3['mixing_level2'] = (80 + $thisfile_ac3_raw_bsi['mixlevel2']).'dB';
154 }
155
156 $thisfile_ac3_raw_bsi[
'copyright'] = (bool) $this->
readHeaderBSI(1);
157
158 $thisfile_ac3_raw_bsi[
'original'] = (bool) $this->
readHeaderBSI(1);
159
160 $thisfile_ac3_raw_bsi[
'flags'][
'timecod1'] = $this->
readHeaderBSI(2);
161 if ($thisfile_ac3_raw_bsi['flags']['timecod1'] & 0x01) {
162 $thisfile_ac3_raw_bsi[
'timecod1'] = $this->
readHeaderBSI(14);
163 $thisfile_ac3['timecode1'] = 0;
164 $thisfile_ac3['timecode1'] += (($thisfile_ac3_raw_bsi['timecod1'] & 0x3E00) >> 9) * 3600;
165 $thisfile_ac3['timecode1'] += (($thisfile_ac3_raw_bsi['timecod1'] & 0x01F8) >> 3) * 60;
166 $thisfile_ac3['timecode1'] += (($thisfile_ac3_raw_bsi['timecod1'] & 0x0003) >> 0) * 8;
167 }
168 if ($thisfile_ac3_raw_bsi['flags']['timecod1'] & 0x02) {
169 $thisfile_ac3_raw_bsi[
'timecod2'] = $this->
readHeaderBSI(14);
170 $thisfile_ac3['timecode2'] = 0;
171 $thisfile_ac3['timecode2'] += (($thisfile_ac3_raw_bsi['timecod2'] & 0x3800) >> 11) * 1;
172 $thisfile_ac3['timecode2'] += (($thisfile_ac3_raw_bsi['timecod2'] & 0x07C0) >> 6) * (1 / 30);
173 $thisfile_ac3['timecode2'] += (($thisfile_ac3_raw_bsi['timecod2'] & 0x003F) >> 0) * ((1 / 30) / 60);
174 }
175
176 $thisfile_ac3_raw_bsi[
'flags'][
'addbsi'] = (bool) $this->
readHeaderBSI(1);
177 if ($thisfile_ac3_raw_bsi['flags']['addbsi']) {
178 $thisfile_ac3_raw_bsi[
'addbsi_length'] = $this->
readHeaderBSI(6) + 1;
179
181
182 $thisfile_ac3_raw_bsi['addbsi_data'] = substr($this->AC3header['bsi'], $this->BSIoffset, $thisfile_ac3_raw_bsi['addbsi_length'] * 8);
183 $this->BSIoffset += $thisfile_ac3_raw_bsi['addbsi_length'] * 8;
184 }
185
186
187 } elseif ($thisfile_ac3_raw_bsi['bsid'] <= 16) {
188
189
190$this->
error(
'E-AC3 parsing is incomplete and experimental in this version of getID3 ('.$this->getid3->version().
'). Notably the bitrate calculations are wrong -- value might (or not) be correct, but it is not calculated correctly. Email info@getid3.org if you know how to calculate EAC3 bitrate correctly.');
191 $info[
'audio'][
'dataformat'] =
'eac3';
192
194 $thisfile_ac3_raw_bsi[
'substreamid'] = $this->
readHeaderBSI(3);
197 if ($thisfile_ac3_raw_bsi['fscod'] == 3) {
199 $thisfile_ac3_raw_bsi['numblkscod'] = 3;
200 } else {
201 $thisfile_ac3_raw_bsi[
'numblkscod'] = $this->
readHeaderBSI(2);
202 }
205 $thisfile_ac3_raw_bsi[
'flags'][
'lfeon'] = (bool) $this->
readHeaderBSI(1);
208 $thisfile_ac3_raw_bsi[
'flags'][
'compr'] = (bool) $this->
readHeaderBSI(1);
209 if ($thisfile_ac3_raw_bsi['flags']['compr']) {
211 }
212 if ($thisfile_ac3_raw_bsi['acmod'] == 0) {
213 $thisfile_ac3_raw_bsi[
'dialnorm2'] = $this->
readHeaderBSI(5);
214 $thisfile_ac3_raw_bsi[
'flags'][
'compr2'] = (bool) $this->
readHeaderBSI(1);
215 if ($thisfile_ac3_raw_bsi['flags']['compr2']) {
217 }
218 }
219 if ($thisfile_ac3_raw_bsi['strmtyp'] == 1) {
220 $thisfile_ac3_raw_bsi[
'flags'][
'chanmap'] = (bool) $this->
readHeaderBSI(1);
221 if ($thisfile_ac3_raw_bsi['flags']['chanmap']) {
223 }
224 }
225 $thisfile_ac3_raw_bsi[
'flags'][
'mixmdat'] = (bool) $this->
readHeaderBSI(1);
226 if ($thisfile_ac3_raw_bsi['flags']['mixmdat']) {
227 if ($thisfile_ac3_raw_bsi['acmod'] > 2) {
229 }
230 if (($thisfile_ac3_raw_bsi['acmod'] & 0x01) && ($thisfile_ac3_raw_bsi['acmod'] > 2)) {
231 $thisfile_ac3_raw_bsi[
'ltrtcmixlev'] = $this->
readHeaderBSI(3);
232 $thisfile_ac3_raw_bsi[
'lorocmixlev'] = $this->
readHeaderBSI(3);
233 }
234 if ($thisfile_ac3_raw_bsi['acmod'] & 0x04) {
235 $thisfile_ac3_raw_bsi[
'ltrtsurmixlev'] = $this->
readHeaderBSI(3);
236 $thisfile_ac3_raw_bsi[
'lorosurmixlev'] = $this->
readHeaderBSI(3);
237 }
238 if ($thisfile_ac3_raw_bsi['flags']['lfeon']) {
239 $thisfile_ac3_raw_bsi[
'flags'][
'lfemixlevcod'] = (bool) $this->
readHeaderBSI(1);
240 if ($thisfile_ac3_raw_bsi['flags']['lfemixlevcod']) {
241 $thisfile_ac3_raw_bsi[
'lfemixlevcod'] = $this->
readHeaderBSI(5);
242 }
243 }
244 if ($thisfile_ac3_raw_bsi['strmtyp'] == 0) {
245 $thisfile_ac3_raw_bsi[
'flags'][
'pgmscl'] = (bool) $this->
readHeaderBSI(1);
246 if ($thisfile_ac3_raw_bsi['flags']['pgmscl']) {
248 }
249 if ($thisfile_ac3_raw_bsi['acmod'] == 0) {
250 $thisfile_ac3_raw_bsi[
'flags'][
'pgmscl2'] = (bool) $this->
readHeaderBSI(1);
251 if ($thisfile_ac3_raw_bsi['flags']['pgmscl2']) {
253 }
254 }
255 $thisfile_ac3_raw_bsi[
'flags'][
'extpgmscl'] = (bool) $this->
readHeaderBSI(1);
256 if ($thisfile_ac3_raw_bsi['flags']['extpgmscl']) {
257 $thisfile_ac3_raw_bsi[
'extpgmscl'] = $this->
readHeaderBSI(6);
258 }
260 if ($thisfile_ac3_raw_bsi['mixdef'] == 1) {
261 $thisfile_ac3_raw_bsi[
'premixcmpsel'] = (bool) $this->
readHeaderBSI(1);
262 $thisfile_ac3_raw_bsi[
'drcsrc'] = (bool) $this->
readHeaderBSI(1);
263 $thisfile_ac3_raw_bsi[
'premixcmpscl'] = $this->
readHeaderBSI(3);
264 } elseif ($thisfile_ac3_raw_bsi['mixdef'] == 2) {
266 } elseif ($thisfile_ac3_raw_bsi['mixdef'] == 3) {
267 $mixdefbitsread = 0;
268 $thisfile_ac3_raw_bsi[
'mixdeflen'] = $this->
readHeaderBSI(5); $mixdefbitsread += 5;
269 $thisfile_ac3_raw_bsi[
'flags'][
'mixdata2'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
270 if ($thisfile_ac3_raw_bsi['flags']['mixdata2']) {
271 $thisfile_ac3_raw_bsi[
'premixcmpsel'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
272 $thisfile_ac3_raw_bsi[
'drcsrc'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
273 $thisfile_ac3_raw_bsi[
'premixcmpscl'] = $this->
readHeaderBSI(3); $mixdefbitsread += 3;
274 $thisfile_ac3_raw_bsi[
'flags'][
'extpgmlscl'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
275 if ($thisfile_ac3_raw_bsi['flags']['extpgmlscl']) {
276 $thisfile_ac3_raw_bsi[
'extpgmlscl'] = $this->
readHeaderBSI(4); $mixdefbitsread += 4;
277 }
278 $thisfile_ac3_raw_bsi[
'flags'][
'extpgmcscl'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
279 if ($thisfile_ac3_raw_bsi['flags']['extpgmcscl']) {
280 $thisfile_ac3_raw_bsi[
'extpgmcscl'] = $this->
readHeaderBSI(4); $mixdefbitsread += 4;
281 }
282 $thisfile_ac3_raw_bsi[
'flags'][
'extpgmrscl'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
283 if ($thisfile_ac3_raw_bsi['flags']['extpgmrscl']) {
284 $thisfile_ac3_raw_bsi[
'extpgmrscl'] = $this->
readHeaderBSI(4);
285 }
286 $thisfile_ac3_raw_bsi[
'flags'][
'extpgmlsscl'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
287 if ($thisfile_ac3_raw_bsi['flags']['extpgmlsscl']) {
288 $thisfile_ac3_raw_bsi[
'extpgmlsscl'] = $this->
readHeaderBSI(4); $mixdefbitsread += 4;
289 }
290 $thisfile_ac3_raw_bsi[
'flags'][
'extpgmrsscl'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
291 if ($thisfile_ac3_raw_bsi['flags']['extpgmrsscl']) {
292 $thisfile_ac3_raw_bsi[
'extpgmrsscl'] = $this->
readHeaderBSI(4); $mixdefbitsread += 4;
293 }
294 $thisfile_ac3_raw_bsi[
'flags'][
'extpgmlfescl'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
295 if ($thisfile_ac3_raw_bsi['flags']['extpgmlfescl']) {
296 $thisfile_ac3_raw_bsi[
'extpgmlfescl'] = $this->
readHeaderBSI(4); $mixdefbitsread += 4;
297 }
298 $thisfile_ac3_raw_bsi[
'flags'][
'dmixscl'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
299 if ($thisfile_ac3_raw_bsi['flags']['dmixscl']) {
300 $thisfile_ac3_raw_bsi[
'dmixscl'] = $this->
readHeaderBSI(4); $mixdefbitsread += 4;
301 }
302 $thisfile_ac3_raw_bsi[
'flags'][
'addch'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
303 if ($thisfile_ac3_raw_bsi['flags']['addch']) {
304 $thisfile_ac3_raw_bsi[
'flags'][
'extpgmaux1scl'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
305 if ($thisfile_ac3_raw_bsi['flags']['extpgmaux1scl']) {
306 $thisfile_ac3_raw_bsi[
'extpgmaux1scl'] = $this->
readHeaderBSI(4); $mixdefbitsread += 4;
307 }
308 $thisfile_ac3_raw_bsi[
'flags'][
'extpgmaux2scl'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
309 if ($thisfile_ac3_raw_bsi['flags']['extpgmaux2scl']) {
310 $thisfile_ac3_raw_bsi[
'extpgmaux2scl'] = $this->
readHeaderBSI(4); $mixdefbitsread += 4;
311 }
312 }
313 }
314 $thisfile_ac3_raw_bsi[
'flags'][
'mixdata3'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
315 if ($thisfile_ac3_raw_bsi['flags']['mixdata3']) {
316 $thisfile_ac3_raw_bsi[
'spchdat'] = $this->
readHeaderBSI(5); $mixdefbitsread += 5;
317 $thisfile_ac3_raw_bsi[
'flags'][
'addspchdat'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
318 if ($thisfile_ac3_raw_bsi['flags']['addspchdat']) {
319 $thisfile_ac3_raw_bsi[
'spchdat1'] = $this->
readHeaderBSI(5); $mixdefbitsread += 5;
320 $thisfile_ac3_raw_bsi[
'spchan1att'] = $this->
readHeaderBSI(2); $mixdefbitsread += 2;
321 $thisfile_ac3_raw_bsi[
'flags'][
'addspchdat1'] = (bool) $this->
readHeaderBSI(1); $mixdefbitsread += 1;
322 if ($thisfile_ac3_raw_bsi['flags']['addspchdat1']) {
323 $thisfile_ac3_raw_bsi[
'spchdat2'] = $this->
readHeaderBSI(5); $mixdefbitsread += 5;
324 $thisfile_ac3_raw_bsi[
'spchan2att'] = $this->
readHeaderBSI(3); $mixdefbitsread += 3;
325 }
326 }
327 }
328 $mixdata_bits = (8 * ($thisfile_ac3_raw_bsi['mixdeflen'] + 2)) - $mixdefbitsread;
329 $mixdata_fill = (($mixdata_bits % 8) ? 8 - ($mixdata_bits % 8) : 0);
330 $thisfile_ac3_raw_bsi[
'mixdata'] = $this->
readHeaderBSI($mixdata_bits);
331 $thisfile_ac3_raw_bsi[
'mixdatafill'] = $this->
readHeaderBSI($mixdata_fill);
332 unset($mixdefbitsread, $mixdata_bits, $mixdata_fill);
333 }
334 if ($thisfile_ac3_raw_bsi['acmod'] < 2) {
335 $thisfile_ac3_raw_bsi[
'flags'][
'paninfo'] = (bool) $this->
readHeaderBSI(1);
336 if ($thisfile_ac3_raw_bsi['flags']['paninfo']) {
339 }
340 if ($thisfile_ac3_raw_bsi['acmod'] == 0) {
341 $thisfile_ac3_raw_bsi[
'flags'][
'paninfo2'] = (bool) $this->
readHeaderBSI(1);
342 if ($thisfile_ac3_raw_bsi['flags']['paninfo2']) {
345 }
346 }
347 }
348 $thisfile_ac3_raw_bsi[
'flags'][
'frmmixcfginfo'] = (bool) $this->
readHeaderBSI(1);
349 if ($thisfile_ac3_raw_bsi['flags']['frmmixcfginfo']) {
350 if ($thisfile_ac3_raw_bsi['numblkscod'] == 0) {
351 $thisfile_ac3_raw_bsi[
'blkmixcfginfo'][0] = $this->
readHeaderBSI(5);
352 } else {
353 for ($blk = 0; $blk < $thisfile_ac3_raw_bsi['numblkscod']; $blk++) {
354 $thisfile_ac3_raw_bsi[
'flags'][
'blkmixcfginfo'.$blk] = (bool) $this->
readHeaderBSI(1);
355 if ($thisfile_ac3_raw_bsi['flags']['blkmixcfginfo'.$blk]) {
356 $thisfile_ac3_raw_bsi[
'blkmixcfginfo'][$blk] = $this->
readHeaderBSI(5);
357 }
358 }
359 }
360 }
361 }
362 }
363 $thisfile_ac3_raw_bsi[
'flags'][
'infomdat'] = (bool) $this->
readHeaderBSI(1);
364 if ($thisfile_ac3_raw_bsi['flags']['infomdat']) {
366 $thisfile_ac3_raw_bsi[
'flags'][
'copyrightb'] = (bool) $this->
readHeaderBSI(1);
367 $thisfile_ac3_raw_bsi[
'flags'][
'origbs'] = (bool) $this->
readHeaderBSI(1);
368 if ($thisfile_ac3_raw_bsi['acmod'] == 2) {
370 $thisfile_ac3_raw_bsi[
'dheadphonmod'] = $this->
readHeaderBSI(2);
371 }
372 if ($thisfile_ac3_raw_bsi['acmod'] >= 6) {
373 $thisfile_ac3_raw_bsi[
'dsurexmod'] = $this->
readHeaderBSI(2);
374 }
375 $thisfile_ac3_raw_bsi[
'flags'][
'audprodi'] = (bool) $this->
readHeaderBSI(1);
376 if ($thisfile_ac3_raw_bsi['flags']['audprodi']) {
379 $thisfile_ac3_raw_bsi[
'flags'][
'adconvtyp'] = (bool) $this->
readHeaderBSI(1);
380 }
381 if ($thisfile_ac3_raw_bsi['acmod'] == 0) {
382 $thisfile_ac3_raw_bsi[
'flags'][
'audprodi2'] = (bool) $this->
readHeaderBSI(1);
383 if ($thisfile_ac3_raw_bsi['flags']['audprodi2']) {
384 $thisfile_ac3_raw_bsi[
'mixlevel2'] = $this->
readHeaderBSI(5);
386 $thisfile_ac3_raw_bsi[
'flags'][
'adconvtyp2'] = (bool) $this->
readHeaderBSI(1);
387 }
388 }
389 if ($thisfile_ac3_raw_bsi['fscod'] < 3) {
390 $thisfile_ac3_raw_bsi[
'flags'][
'sourcefscod'] = (bool) $this->
readHeaderBSI(1);
391 }
392 }
393 if (($thisfile_ac3_raw_bsi['strmtyp'] == 0) && ($thisfile_ac3_raw_bsi['numblkscod'] != 3)) {
394 $thisfile_ac3_raw_bsi[
'flags'][
'convsync'] = (bool) $this->
readHeaderBSI(1);
395 }
396 if ($thisfile_ac3_raw_bsi['strmtyp'] == 2) {
397 if ($thisfile_ac3_raw_bsi['numblkscod'] != 3) {
398 $thisfile_ac3_raw_bsi['flags']['blkid'] = 1;
399 } else {
400 $thisfile_ac3_raw_bsi[
'flags'][
'blkid'] = (bool) $this->
readHeaderBSI(1);
401 }
402 if ($thisfile_ac3_raw_bsi['flags']['blkid']) {
403 $thisfile_ac3_raw_bsi[
'frmsizecod'] = $this->
readHeaderBSI(6);
404 }
405 }
406 $thisfile_ac3_raw_bsi[
'flags'][
'addbsi'] = (bool) $this->
readHeaderBSI(1);
407 if ($thisfile_ac3_raw_bsi['flags']['addbsi']) {
409 $thisfile_ac3_raw_bsi[
'addbsi'] = $this->
readHeaderBSI(($thisfile_ac3_raw_bsi[
'addbsil'] + 1) * 8);
410 }
411
412 } else {
413
414 $this->
error(
'Bit stream identification is version '.$thisfile_ac3_raw_bsi[
'bsid'].
', but getID3() only understands up to version 16. Please submit a support ticket with a sample file.');
416 return false;
417
418 }
419
420 if (isset($thisfile_ac3_raw_bsi['fscod2'])) {
422 } else {
424 }
425 if ($thisfile_ac3_raw_bsi['fscod'] <= 3) {
426 $info[
'audio'][
'sample_rate'] = $thisfile_ac3[
'sample_rate'];
427 } else {
428 $this->
warning(
'Unexpected ac3.bsi.fscod value: '.$thisfile_ac3_raw_bsi[
'fscod']);
429 }
430 if (isset($thisfile_ac3_raw_bsi['frmsizecod'])) {
431 $thisfile_ac3[
'frame_length'] =
self::frameSizeLookup($thisfile_ac3_raw_bsi[
'frmsizecod'], $thisfile_ac3_raw_bsi[
'fscod']);
433 } elseif (!empty($thisfile_ac3_raw_bsi['frmsiz'])) {
434
435
436 $thisfile_ac3['bitrate'] = ($thisfile_ac3_raw_bsi['frmsiz'] + 1) * 16 * 30;
437
438$thisfile_ac3['bitrate'] = round(($thisfile_ac3['bitrate'] * 1.05) / 16000) * 16000;
439 }
440 $info[
'audio'][
'bitrate'] = $thisfile_ac3[
'bitrate'];
441
442 $thisfile_ac3[
'service_type'] =
self::serviceTypeLookup($thisfile_ac3_raw_bsi[
'bsmod'], $thisfile_ac3_raw_bsi[
'acmod']);
444 foreach($ac3_coding_mode as
$key => $value) {
445 $thisfile_ac3[
$key] = $value;
446 }
447 switch ($thisfile_ac3_raw_bsi['acmod']) {
448 case 0:
449 case 1:
450 $info[
'audio'][
'channelmode'] =
'mono';
451 break;
452 case 3:
453 case 4:
454 $info[
'audio'][
'channelmode'] =
'stereo';
455 break;
456 default:
457 $info[
'audio'][
'channelmode'] =
'surround';
458 break;
459 }
460 $info[
'audio'][
'channels'] = $thisfile_ac3[
'num_channels'];
461
462 $thisfile_ac3['lfe_enabled'] = $thisfile_ac3_raw_bsi['flags']['lfeon'];
463 if ($thisfile_ac3_raw_bsi['flags']['lfeon']) {
464 $info[
'audio'][
'channels'] .=
'.1';
465 }
466
467 $thisfile_ac3[
'channels_enabled'] =
self::channelsEnabledLookup($thisfile_ac3_raw_bsi[
'acmod'], $thisfile_ac3_raw_bsi[
'flags'][
'lfeon']);
468 $thisfile_ac3['dialogue_normalization'] = '-'.$thisfile_ac3_raw_bsi['dialnorm'].'dB';
469
470 return true;
471 }
static channelsEnabledLookup($acmod, $lfeon)
static heavyCompression($compre)
static sampleRateCodeLookup2($fscod2)
static blocksPerSyncFrame($numblkscod)
static surroundMixLevelLookup($surmixlev)
static sampleRateCodeLookup($fscod)
static audioCodingModeLookup($acmod)
static dolbySurroundModeLookup($dsurmod)
static serviceTypeLookup($bsmod, $acmod)
static roomTypeLookup($roomtyp)
static bitrateLookup($frmsizecod)
static frameSizeLookup($frmsizecod, $fscod)
static centerMixLevelLookup($cmixlev)
fseek($bytes, $whence=SEEK_SET)
static LittleEndian2Int($byteword, $signed=false)
static BigEndian2Bin($byteword)
static Bin2Dec($binstring, $signed=false)
static BigEndian2Int($byteword, $synchsafe=false, $signed=false)