aboutsummaryrefslogtreecommitdiff
path: root/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/docs/php-reader/Magic.html
blob: 594c1c3936f8edc8bd8ee3efd3a6d22aba56c41a (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>Docs For Class Magic</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
			<div class="page-body">			

<h2 class="class-name">Class Magic</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
															<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
						
					</div>
	<div class="info-box-body">
        		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">This class is used to classify the given file using some magic bytes  characteristic to a particular file type. The classification information can  be a MIME type or just text describing the file.</p>
<p class="description"><p>This method is slower than determining the type by file suffix but on the  other hand reduces the risk of fail positives during the test.</p><p>The magic file consists of ASCII characters defining the magic numbers for  different file types. Each row has 4 to 5 columns, empty and commented lines  (those starting with a hash character) are ignored. Columns are described  below.</p><p><ul><li><strong>1</strong> -- byte number to begin checking from. &quot;&gt;&quot; indicates a dependency
    upon the previous non-&quot;&gt;&quot; line</li><li><strong>2</strong> -- type of data to match. Can be one of following
    - <em>byte</em> (single character)
    - <em>short</em> (machine-order 16-bit integer)
    - <em>long</em> (machine-order 32-bit integer)
    - <em>string</em> (arbitrary-length string)
    - <em>date</em> (long integer date (seconds since Unix epoch/1970))
    - <em>beshort</em> (big-endian 16-bit integer)
    - <em>belong</em> (big-endian 32-bit integer)
    - <em>bedate</em> (big-endian 32-bit integer date)
    - <em>leshort</em> (little-endian 16-bit integer)
    - <em>lelong</em> (little-endian 32-bit integer)
    - <em>ledate</em> (little-endian 32-bit integer date)</li><li><strong>3</strong> -- contents of data to match</li><li><strong>4</strong> -- file description/MIME type if matched</li><li><strong>5</strong> -- optional MIME encoding if matched and if above was a MIME type</li></ul></p></p>
	<ul class="tags">
				<li><span class="field">author:</span> Sven Vollbehr &lt;<a href="mailto:svollbehr@gmail.com">svollbehr@gmail.com</a>&gt;</li>
				<li><span class="field">version:</span> $Rev: 73 $</li>
				<li><span class="field">copyright:</span> Copyright (c) 2006-2008 PHP Reader Project Workgroup</li>
				<li><span class="field">license:</span> <a href="http://code.google.com/p/php-reader/wiki/License">New BSD License</a></li>
			</ul>
		<p class="notes">
			Located in <a class="field" href="_Magic.php.html">/Magic.php</a> (line <span class="field">79</span>)
		</p>
		
				
		<pre></pre>
	
			</div>
</div>




	<a name="sec-method-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Method Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
												<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
		</div>
		<div class="info-box-body">			
			<div class="method-summary">
																				
												<div class="method-definition">
											<span class="method-result">Magic</span>
										<a href="#__construct" title="details" class="method-name">__construct</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$filename</span>)
									</div>
																<div class="method-definition">
											<span class="method-result">string|false</span>
										<a href="#getType" title="details" class="method-name">getType</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$filename</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$default</span> = <span class="var-default">false</span>])
									</div>
								</div>
		</div>
	</div>		

	
	<a name="sec-methods"></a>
	<div class="info-box">
		<div class="info-box-title">Methods</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
																<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
						
		</div>
		<div class="info-box-body">
			<A NAME='method_detail'></A>

<a name="method__construct" id="__construct"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">Constructor __construct</span> (line <span class="line-number">89</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Reads the magic information from given magic file.</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">Magic</span>
		<span class="method-name">
			__construct
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$filename</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$filename</span><span class="var-description">: The path to the magic file.</span>			</li>
				</ul>
		
			
	</div>
<a name="methodgetType" id="getType"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">getType</span> (line <span class="line-number">107</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Returns the recognized MIME type/description of the given file. The type  is determined by the content using magic bytes characteristic for the  particular file type.</p>
<p class="description"><p>If the type could not be found, the function returns the default value, or  <var>false</var>.</p></p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string|false</span>
		<span class="method-name">
			getType
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$filename</span>, [<span class="var-type">string</span>&nbsp;<span class="var-name">$default</span> = <span class="var-default">false</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$filename</span><span class="var-description">: The file path whose type to determine.</span>			</li>
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$default</span><span class="var-description">: The default value.</span>			</li>
				</ul>
		
			
	</div>
						
		</div>
	</div>


	<p class="notes" id="credit">
		Documentation generated on Fri, 05 Sep 2008 20:18:59 +0300 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.1</a>
	</p>
	</div></body>
</html>