ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
Aa.php
Go to the documentation of this file.
1 <?php
2 
4 
7 
10 // available at http://getid3.sourceforge.net //
11 // or http://www.getid3.org //
13 // See readme.txt for more details //
15 // //
16 // module.audio.aa.php //
17 // module for analyzing Audible Audiobook files //
18 // dependencies: NONE //
19 // ///
21 
29 class Aa extends BaseHandler
30 {
31 
36  public function analyze()
37  {
38  $info = &$this->getid3->info;
39 
40  fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
41  $AAheader = fread($this->getid3->fp, 8);
42 
43  $magic = "\x57\x90\x75\x36";
44  if (substr($AAheader, 4, 4) != $magic) {
45  $info['error'][] = 'Expecting "'.Helper::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.Helper::PrintHexBytes(substr($AAheader, 4, 4)).'"';
46 
47  return false;
48  }
49 
50  // shortcut
51  $info['aa'] = array();
52  $thisfile_au = &$info['aa'];
53 
54  $info['fileformat'] = 'aa';
55  $info['audio']['dataformat'] = 'aa';
56 $info['error'][] = 'Audible Audiobook (.aa) parsing not enabled in this version of GetId3Core() ['.$this->getid3->version().']';
57 return false;
58  $info['audio']['bitrate_mode'] = 'cbr'; // is it?
59  $thisfile_au['encoding'] = 'ISO-8859-1';
60 
61  $thisfile_au['filesize'] = Helper::BigEndian2Int(substr($AUheader, 0, 4));
62  if ($thisfile_au['filesize'] > ($info['avdataend'] - $info['avdataoffset'])) {
63  $info['warning'][] = 'Possible truncated file - expecting "'.$thisfile_au['filesize'].'" bytes of data, only found '.($info['avdataend'] - $info['avdataoffset']).' bytes"';
64  }
65 
66  $info['audio']['bits_per_sample'] = 16; // is it?
67  $info['audio']['sample_rate'] = $thisfile_au['sample_rate'];
68  $info['audio']['channels'] = $thisfile_au['channels'];
69 
70  //$info['playtime_seconds'] = 0;
71  //$info['audio']['bitrate'] = 0;
72  return true;
73  }
74 }
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
Definition: Helper.php:36
GetId3() by James Heinrich info@getid3.org //.
Definition: BaseHandler.php:25
fseek($bytes, $whence=SEEK_SET)
$info
Definition: example_052.php:80
GetId3() by James Heinrich info@getid3.org //.
Definition: Aa.php:29
Create styles array
The data for the language used.
static BigEndian2Int($byteword, $synchsafe=false, $signed=false)
Definition: Helper.php:374