ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
module.audio.mod.php
Go to the documentation of this file.
1 <?php
4 // available at http://getid3.sourceforge.net //
5 // or http://www.getid3.org //
7 // See readme.txt for more details //
9 // //
10 // module.audio.mod.php //
11 // module for analyzing MOD Audio files //
12 // dependencies: NONE //
13 // ///
15 
16 
18 {
19 
20  // new combined constructor
21  function getid3_mod(&$fd, &$ThisFileInfo, $option) {
22 
23  if ($option === 'mod') {
24  $this->getMODheaderFilepointer($fd, $ThisFileInfo);
25  }
26  elseif ($option === 'xm') {
27  $this->getXMheaderFilepointer($fd, $ThisFileInfo);
28  }
29  elseif ($option === 'it') {
30  $this->getITheaderFilepointer($fd, $ThisFileInfo);
31  }
32  elseif ($option === 's3m') {
33  $this->getS3MheaderFilepointer($fd, $ThisFileInfo);
34  }
35  }
36 
37 
38  function getMODheaderFilepointer(&$fd, &$ThisFileInfo) {
39 
40  fseek($fd, $ThisFileInfo['avdataoffset'] + 1080);
41  $FormatID = fread($fd, 4);
42  if (!ereg('^(M.K.|[5-9]CHN|[1-3][0-9]CH)$', $FormatID)) {
43  $ThisFileInfo['error'][] = 'This is not a known type of MOD file';
44  return false;
45  }
46 
47  $ThisFileInfo['fileformat'] = 'mod';
48 
49  $ThisFileInfo['error'][] = 'MOD parsing not enabled in this version of getID3()';
50  return false;
51  }
52 
53  function getXMheaderFilepointer(&$fd, &$ThisFileInfo) {
54 
55  fseek($fd, $ThisFileInfo['avdataoffset']);
56  $FormatID = fread($fd, 15);
57  if (!ereg('^Extended Module$', $FormatID)) {
58  $ThisFileInfo['error'][] = 'This is not a known type of XM-MOD file';
59  return false;
60  }
61 
62  $ThisFileInfo['fileformat'] = 'xm';
63 
64  $ThisFileInfo['error'][] = 'XM-MOD parsing not enabled in this version of getID3()';
65  return false;
66  }
67 
68  function getS3MheaderFilepointer(&$fd, &$ThisFileInfo) {
69 
70  fseek($fd, $ThisFileInfo['avdataoffset'] + 44);
71  $FormatID = fread($fd, 4);
72  if (!ereg('^SCRM$', $FormatID)) {
73  $ThisFileInfo['error'][] = 'This is not a ScreamTracker MOD file';
74  return false;
75  }
76 
77  $ThisFileInfo['fileformat'] = 's3m';
78 
79  $ThisFileInfo['error'][] = 'ScreamTracker parsing not enabled in this version of getID3()';
80  return false;
81  }
82 
83  function getITheaderFilepointer(&$fd, &$ThisFileInfo) {
84 
85  fseek($fd, $ThisFileInfo['avdataoffset']);
86  $FormatID = fread($fd, 4);
87  if (!ereg('^IMPM$', $FormatID)) {
88  $ThisFileInfo['error'][] = 'This is not an ImpulseTracker MOD file';
89  return false;
90  }
91 
92  $ThisFileInfo['fileformat'] = 'it';
93 
94  $ThisFileInfo['error'][] = 'ImpulseTracker parsing not enabled in this version of getID3()';
95  return false;
96  }
97 
98 }
99 
100 
101 ?>