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
/////////////////////////////////////////////////////////////////
10
// module.audio.mod.php //
11
// module for analyzing MOD Audio files //
12
// dependencies: NONE //
14
/////////////////////////////////////////////////////////////////
17
class getid3_mod extends getid3_handler
21
$info = &$this->getid3->info;
22
fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
23
$fileheader = fread($this->getid3->fp, 1088);
24
if (preg_match('#^IMPM#', $fileheader)) {
25
return $this->getITheaderFilepointer();
26
} elseif (preg_match('#^Extended Module#', $fileheader)) {
27
return $this->getXMheaderFilepointer();
28
} elseif (preg_match('#^.{44}SCRM#', $fileheader)) {
29
return $this->getS3MheaderFilepointer();
30
} elseif (preg_match('#^.{1080}(M\\.K\\.|M!K!|FLT4|FLT8|[5-9]CHN|[1-3][0-9]CH)#', $fileheader)) {
31
return $this->getMODheaderFilepointer();
33
$info['error'][] = 'This is not a known type of MOD file';
38
function getMODheaderFilepointer() {
39
$info = &$this->getid3->info;
40
fseek($this->getid3->fp, $info['avdataoffset'] + 1080);
41
$FormatID = fread($this->getid3->fp, 4);
42
if (!preg_match('#^(M.K.|[5-9]CHN|[1-3][0-9]CH)$#', $FormatID)) {
43
$info['error'][] = 'This is not a known type of MOD file';
47
$info['fileformat'] = 'mod';
49
$info['error'][] = 'MOD parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
53
function getXMheaderFilepointer() {
54
$info = &$this->getid3->info;
55
fseek($this->getid3->fp, $info['avdataoffset']);
56
$FormatID = fread($this->getid3->fp, 15);
57
if (!preg_match('#^Extended Module$#', $FormatID)) {
58
$info['error'][] = 'This is not a known type of XM-MOD file';
62
$info['fileformat'] = 'xm';
64
$info['error'][] = 'XM-MOD parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
68
function getS3MheaderFilepointer() {
69
$info = &$this->getid3->info;
70
fseek($this->getid3->fp, $info['avdataoffset'] + 44);
71
$FormatID = fread($this->getid3->fp, 4);
72
if (!preg_match('#^SCRM$#', $FormatID)) {
73
$info['error'][] = 'This is not a ScreamTracker MOD file';
77
$info['fileformat'] = 's3m';
79
$info['error'][] = 'ScreamTracker parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
83
function getITheaderFilepointer() {
84
$info = &$this->getid3->info;
85
fseek($this->getid3->fp, $info['avdataoffset']);
86
$FormatID = fread($this->getid3->fp, 4);
87
if (!preg_match('#^IMPM$#', $FormatID)) {
88
$info['error'][] = 'This is not an ImpulseTracker MOD file';
92
$info['fileformat'] = 'it';
94
$info['error'][] = 'ImpulseTracker parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
b'\\ No newline at end of file'