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