ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
module.audio.aa.php
Go to the documentation of this file.
1<?php
4// available at http://getid3.sourceforge.net //
5// or http://www.getid3.org //
6// also https://github.com/JamesHeinrich/getID3 //
8// See readme.txt for more details //
10// //
11// module.audio.aa.php //
12// module for analyzing Audible Audiobook files //
13// dependencies: NONE //
14// ///
16
17
19{
20
21 public function Analyze() {
22 $info = &$this->getid3->info;
23
24 $this->fseek($info['avdataoffset']);
25 $AAheader = $this->fread(8);
26
27 $magic = "\x57\x90\x75\x36";
28 if (substr($AAheader, 4, 4) != $magic) {
29 $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.getid3_lib::PrintHexBytes(substr($AAheader, 4, 4)).'"';
30 return false;
31 }
32
33 // shortcut
34 $info['aa'] = array();
35 $thisfile_aa = &$info['aa'];
36
37 $info['fileformat'] = 'aa';
38 $info['audio']['dataformat'] = 'aa';
39$info['error'][] = 'Audible Audiobook (.aa) parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
40return false;
41 $info['audio']['bitrate_mode'] = 'cbr'; // is it?
42 $thisfile_aa['encoding'] = 'ISO-8859-1';
43
44 $thisfile_aa['filesize'] = getid3_lib::BigEndian2Int(substr($AUheader, 0, 4));
45 if ($thisfile_aa['filesize'] > ($info['avdataend'] - $info['avdataoffset'])) {
46 $info['warning'][] = 'Possible truncated file - expecting "'.$thisfile_aa['filesize'].'" bytes of data, only found '.($info['avdataend'] - $info['avdataoffset']).' bytes"';
47 }
48
49 $info['audio']['bits_per_sample'] = 16; // is it?
50 $info['audio']['sample_rate'] = $thisfile_aa['sample_rate'];
51 $info['audio']['channels'] = $thisfile_aa['channels'];
52
53 //$info['playtime_seconds'] = 0;
54 //$info['audio']['bitrate'] = 0;
55
56 return true;
57 }
58
59}
getID3() by James Heinrich info@getid3.org //
fseek($bytes, $whence=SEEK_SET)
Definition: getid3.php:1697
fread($bytes)
Definition: getid3.php:1685
BigEndian2Int($byteword, $synchsafe=false, $signed=false)
Definition: getid3.lib.php:234
PrintHexBytes($string, $hex=true, $spaces=true, $htmlsafe=true)
Definition: getid3.lib.php:17
$info
Definition: example_052.php:80