source: branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Assets/Connector/Assets/getid3/module.audio.aa.php @ 1300

Last change on this file since 1300 was 1300, checked in by gogo, 9 years ago

Update the MootoolsFileManager? to the latest cpojer with some modifications.
Add a demo for the MFM examples/mootools-file-manager.php
Change the default config for ImageManager? and ExtendedFileManager? for added security.

File size: 2.2 KB
Line 
1<?php
2/////////////////////////////////////////////////////////////////
3/// getID3() by James Heinrich <info@getid3.org>               //
4//  available at http://getid3.sourceforge.net                 //
5//            or http://www.getid3.org                         //
6/////////////////////////////////////////////////////////////////
7// See readme.txt for more details                             //
8/////////////////////////////////////////////////////////////////
9//                                                             //
10// module.audio.aa.php                                         //
11// module for analyzing Audible Audiobook files                //
12// dependencies: NONE                                          //
13//                                                            ///
14/////////////////////////////////////////////////////////////////
15
16
17class getid3_aa
18{
19
20        function getid3_aa(&$fd, &$ThisFileInfo) {
21
22                fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET);
23                $AAheader  = fread($fd, 8);
24
25                $magic = "\x57\x90\x75\x36";
26                if (substr($AAheader, 4, 4) != $magic) {
27                        $ThisFileInfo['error'][] = 'Expecting "'.PrintHexBytes($magic).'" at offset '.$ThisFileInfo['avdataoffset'].', found "'.PrintHexBytes(substr($AAheader, 4, 4)).'"';
28                        return false;
29                }
30
31                // shortcut
32                $ThisFileInfo['aa'] = array();
33                $thisfile_au        = &$ThisFileInfo['aa'];
34
35                $ThisFileInfo['fileformat']            = 'aa';
36                $ThisFileInfo['audio']['dataformat']   = 'aa';
37                $ThisFileInfo['audio']['bitrate_mode'] = 'cbr'; // is it?
38                $thisfile_au['encoding']               = 'ISO-8859-1';
39
40                $thisfile_au['filesize'] = getid3_lib::BigEndian2Int(substr($AUheader,  0, 4));
41                if ($thisfile_au['filesize'] > ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset'])) {
42                        $ThisFileInfo['warning'][] = 'Possible truncated file - expecting "'.$thisfile_au['filesize'].'" bytes of data, only found '.($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']).' bytes"';
43                }
44
45                $ThisFileInfo['audio']['bits_per_sample'] = 16; // is it?
46                $ThisFileInfo['audio']['sample_rate']  = $thisfile_au['sample_rate'];
47                $ThisFileInfo['audio']['channels']     = $thisfile_au['channels'];
48
49                //$ThisFileInfo['playtime_seconds'] = 0;
50                //$ThisFileInfo['audio']['bitrate'] = 0;
51
52                return true;
53        }
54
55}
56
57
58?>
Note: See TracBrowser for help on using the repository browser.