@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @access public |
271 | 271 | * @since 2.1.0 |
272 | 272 | * |
273 | - * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings). |
|
273 | + * @param string $handles Item handle and argument (string) or item handles and arguments (array of strings). |
|
274 | 274 | * @return void |
275 | 275 | */ |
276 | 276 | public function remove( $handles ) { |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @access public |
290 | 290 | * @since 2.1.0 |
291 | 291 | * |
292 | - * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings). |
|
292 | + * @param string $handles Item handle and argument (string) or item handles and arguments (array of strings). |
|
293 | 293 | */ |
294 | 294 | public function enqueue( $handles ) { |
295 | 295 | foreach ( (array) $handles as $handle ) { |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | * @access public |
312 | 312 | * @since 2.1.0 |
313 | 313 | * |
314 | - * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings). |
|
314 | + * @param string $handles Item handle and argument (string) or item handles and arguments (array of strings). |
|
315 | 315 | */ |
316 | 316 | public function dequeue( $handles ) { |
317 | 317 | foreach ( (array) $handles as $handle ) { |
@@ -95,26 +95,26 @@ discard block |
||
95 | 95 | * @param mixed $group Group level: level (int), no groups (false). |
96 | 96 | * @return array Handles of items that have been processed. |
97 | 97 | */ |
98 | - public function do_items( $handles = false, $group = false ) { |
|
98 | + public function do_items($handles = false, $group = false) { |
|
99 | 99 | /* |
100 | 100 | * If nothing is passed, print the queue. If a string is passed, |
101 | 101 | * print that item. If an array is passed, print those items. |
102 | 102 | */ |
103 | 103 | $handles = false === $handles ? $this->queue : (array) $handles; |
104 | - $this->all_deps( $handles ); |
|
104 | + $this->all_deps($handles); |
|
105 | 105 | |
106 | - foreach ( $this->to_do as $key => $handle ) { |
|
107 | - if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) { |
|
106 | + foreach ($this->to_do as $key => $handle) { |
|
107 | + if ( ! in_array($handle, $this->done, true) && isset($this->registered[$handle])) { |
|
108 | 108 | /* |
109 | 109 | * Attempt to process the item. If successful, |
110 | 110 | * add the handle to the done array. |
111 | 111 | * |
112 | 112 | * Unset the item from the to_do array. |
113 | 113 | */ |
114 | - if ( $this->do_item( $handle, $group ) ) |
|
114 | + if ($this->do_item($handle, $group)) |
|
115 | 115 | $this->done[] = $handle; |
116 | 116 | |
117 | - unset( $this->to_do[$key] ); |
|
117 | + unset($this->to_do[$key]); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @param string $handle Name of the item. Should be unique. |
131 | 131 | * @return bool True on success, false if not set. |
132 | 132 | */ |
133 | - public function do_item( $handle ) { |
|
133 | + public function do_item($handle) { |
|
134 | 134 | return isset($this->registered[$handle]); |
135 | 135 | } |
136 | 136 | |
@@ -150,43 +150,43 @@ discard block |
||
150 | 150 | * @param int|false $group Group level: (int) level, (false) no groups. |
151 | 151 | * @return bool True on success, false on failure. |
152 | 152 | */ |
153 | - public function all_deps( $handles, $recursion = false, $group = false ) { |
|
154 | - if ( !$handles = (array) $handles ) |
|
153 | + public function all_deps($handles, $recursion = false, $group = false) { |
|
154 | + if ( ! $handles = (array) $handles) |
|
155 | 155 | return false; |
156 | 156 | |
157 | - foreach ( $handles as $handle ) { |
|
157 | + foreach ($handles as $handle) { |
|
158 | 158 | $handle_parts = explode('?', $handle); |
159 | 159 | $handle = $handle_parts[0]; |
160 | 160 | $queued = in_array($handle, $this->to_do, true); |
161 | 161 | |
162 | - if ( in_array($handle, $this->done, true) ) // Already done |
|
162 | + if (in_array($handle, $this->done, true)) // Already done |
|
163 | 163 | continue; |
164 | 164 | |
165 | - $moved = $this->set_group( $handle, $recursion, $group ); |
|
166 | - $new_group = $this->groups[ $handle ]; |
|
165 | + $moved = $this->set_group($handle, $recursion, $group); |
|
166 | + $new_group = $this->groups[$handle]; |
|
167 | 167 | |
168 | - if ( $queued && !$moved ) // already queued and in the right group |
|
168 | + if ($queued && ! $moved) // already queued and in the right group |
|
169 | 169 | continue; |
170 | 170 | |
171 | 171 | $keep_going = true; |
172 | - if ( !isset($this->registered[$handle]) ) |
|
172 | + if ( ! isset($this->registered[$handle])) |
|
173 | 173 | $keep_going = false; // Item doesn't exist. |
174 | - elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) ) |
|
174 | + elseif ($this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered))) |
|
175 | 175 | $keep_going = false; // Item requires dependencies that don't exist. |
176 | - elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $new_group ) ) |
|
176 | + elseif ($this->registered[$handle]->deps && ! $this->all_deps($this->registered[$handle]->deps, true, $new_group)) |
|
177 | 177 | $keep_going = false; // Item requires dependencies that don't exist. |
178 | 178 | |
179 | - if ( ! $keep_going ) { // Either item or its dependencies don't exist. |
|
180 | - if ( $recursion ) |
|
179 | + if ( ! $keep_going) { // Either item or its dependencies don't exist. |
|
180 | + if ($recursion) |
|
181 | 181 | return false; // Abort this branch. |
182 | 182 | else |
183 | 183 | continue; // We're at the top level. Move on to the next one. |
184 | 184 | } |
185 | 185 | |
186 | - if ( $queued ) // Already grabbed it and its dependencies. |
|
186 | + if ($queued) // Already grabbed it and its dependencies. |
|
187 | 187 | continue; |
188 | 188 | |
189 | - if ( isset($handle_parts[1]) ) |
|
189 | + if (isset($handle_parts[1])) |
|
190 | 190 | $this->args[$handle] = $handle_parts[1]; |
191 | 191 | |
192 | 192 | $this->to_do[] = $handle; |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | * @param mixed $args Optional. Custom property of the item. NOT the class property $args. Examples: $media, $in_footer. |
215 | 215 | * @return bool Whether the item has been registered. True on success, false on failure. |
216 | 216 | */ |
217 | - public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { |
|
218 | - if ( isset($this->registered[$handle]) ) |
|
217 | + public function add($handle, $src, $deps = array(), $ver = false, $args = null) { |
|
218 | + if (isset($this->registered[$handle])) |
|
219 | 219 | return false; |
220 | - $this->registered[$handle] = new _WP_Dependency( $handle, $src, $deps, $ver, $args ); |
|
220 | + $this->registered[$handle] = new _WP_Dependency($handle, $src, $deps, $ver, $args); |
|
221 | 221 | return true; |
222 | 222 | } |
223 | 223 | |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | * @param mixed $value The data value. |
235 | 235 | * @return bool True on success, false on failure. |
236 | 236 | */ |
237 | - public function add_data( $handle, $key, $value ) { |
|
238 | - if ( !isset( $this->registered[$handle] ) ) |
|
237 | + public function add_data($handle, $key, $value) { |
|
238 | + if ( ! isset($this->registered[$handle])) |
|
239 | 239 | return false; |
240 | 240 | |
241 | - return $this->registered[$handle]->add_data( $key, $value ); |
|
241 | + return $this->registered[$handle]->add_data($key, $value); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -253,11 +253,11 @@ discard block |
||
253 | 253 | * @param string $key The data key. |
254 | 254 | * @return mixed Extra item data (string), false otherwise. |
255 | 255 | */ |
256 | - public function get_data( $handle, $key ) { |
|
257 | - if ( !isset( $this->registered[$handle] ) ) |
|
256 | + public function get_data($handle, $key) { |
|
257 | + if ( ! isset($this->registered[$handle])) |
|
258 | 258 | return false; |
259 | 259 | |
260 | - if ( !isset( $this->registered[$handle]->extra[$key] ) ) |
|
260 | + if ( ! isset($this->registered[$handle]->extra[$key])) |
|
261 | 261 | return false; |
262 | 262 | |
263 | 263 | return $this->registered[$handle]->extra[$key]; |
@@ -273,8 +273,8 @@ discard block |
||
273 | 273 | * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings). |
274 | 274 | * @return void |
275 | 275 | */ |
276 | - public function remove( $handles ) { |
|
277 | - foreach ( (array) $handles as $handle ) |
|
276 | + public function remove($handles) { |
|
277 | + foreach ((array) $handles as $handle) |
|
278 | 278 | unset($this->registered[$handle]); |
279 | 279 | } |
280 | 280 | |
@@ -292,12 +292,12 @@ discard block |
||
292 | 292 | * |
293 | 293 | * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings). |
294 | 294 | */ |
295 | - public function enqueue( $handles ) { |
|
296 | - foreach ( (array) $handles as $handle ) { |
|
295 | + public function enqueue($handles) { |
|
296 | + foreach ((array) $handles as $handle) { |
|
297 | 297 | $handle = explode('?', $handle); |
298 | - if ( !in_array($handle[0], $this->queue) && isset($this->registered[$handle[0]]) ) { |
|
298 | + if ( ! in_array($handle[0], $this->queue) && isset($this->registered[$handle[0]])) { |
|
299 | 299 | $this->queue[] = $handle[0]; |
300 | - if ( isset($handle[1]) ) |
|
300 | + if (isset($handle[1])) |
|
301 | 301 | $this->args[$handle[0]] = $handle[1]; |
302 | 302 | } |
303 | 303 | } |
@@ -315,11 +315,11 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings). |
317 | 317 | */ |
318 | - public function dequeue( $handles ) { |
|
319 | - foreach ( (array) $handles as $handle ) { |
|
318 | + public function dequeue($handles) { |
|
319 | + foreach ((array) $handles as $handle) { |
|
320 | 320 | $handle = explode('?', $handle); |
321 | 321 | $key = array_search($handle[0], $this->queue); |
322 | - if ( false !== $key ) { |
|
322 | + if (false !== $key) { |
|
323 | 323 | unset($this->queue[$key]); |
324 | 324 | unset($this->args[$handle[0]]); |
325 | 325 | } |
@@ -335,15 +335,15 @@ discard block |
||
335 | 335 | * @param string $handle Name of the item. Should be unique. |
336 | 336 | * @return bool Whether the handle is found after recursively searching the dependency tree. |
337 | 337 | */ |
338 | - protected function recurse_deps( $queue, $handle ) { |
|
339 | - foreach ( $queue as $queued ) { |
|
340 | - if ( ! isset( $this->registered[ $queued ] ) ) { |
|
338 | + protected function recurse_deps($queue, $handle) { |
|
339 | + foreach ($queue as $queued) { |
|
340 | + if ( ! isset($this->registered[$queued])) { |
|
341 | 341 | continue; |
342 | 342 | } |
343 | 343 | |
344 | - if ( in_array( $handle, $this->registered[ $queued ]->deps ) ) { |
|
344 | + if (in_array($handle, $this->registered[$queued]->deps)) { |
|
345 | 345 | return true; |
346 | - } elseif ( $this->recurse_deps( $this->registered[ $queued ]->deps, $handle ) ) { |
|
346 | + } elseif ($this->recurse_deps($this->registered[$queued]->deps, $handle)) { |
|
347 | 347 | return true; |
348 | 348 | } |
349 | 349 | } |
@@ -362,28 +362,28 @@ discard block |
||
362 | 362 | * @param string $list Property name of list array. |
363 | 363 | * @return bool|_WP_Dependency Found, or object Item data. |
364 | 364 | */ |
365 | - public function query( $handle, $list = 'registered' ) { |
|
366 | - switch ( $list ) { |
|
365 | + public function query($handle, $list = 'registered') { |
|
366 | + switch ($list) { |
|
367 | 367 | case 'registered' : |
368 | 368 | case 'scripts': // back compat |
369 | - if ( isset( $this->registered[ $handle ] ) ) |
|
370 | - return $this->registered[ $handle ]; |
|
369 | + if (isset($this->registered[$handle])) |
|
370 | + return $this->registered[$handle]; |
|
371 | 371 | return false; |
372 | 372 | |
373 | 373 | case 'enqueued' : |
374 | 374 | case 'queue' : |
375 | - if ( in_array( $handle, $this->queue ) ) { |
|
375 | + if (in_array($handle, $this->queue)) { |
|
376 | 376 | return true; |
377 | 377 | } |
378 | - return $this->recurse_deps( $this->queue, $handle ); |
|
378 | + return $this->recurse_deps($this->queue, $handle); |
|
379 | 379 | |
380 | 380 | case 'to_do' : |
381 | 381 | case 'to_print': // back compat |
382 | - return in_array( $handle, $this->to_do ); |
|
382 | + return in_array($handle, $this->to_do); |
|
383 | 383 | |
384 | 384 | case 'done' : |
385 | 385 | case 'printed': // back compat |
386 | - return in_array( $handle, $this->done ); |
|
386 | + return in_array($handle, $this->done); |
|
387 | 387 | } |
388 | 388 | return false; |
389 | 389 | } |
@@ -399,14 +399,14 @@ discard block |
||
399 | 399 | * @param mixed $group Group level. |
400 | 400 | * @return bool Not already in the group or a lower group |
401 | 401 | */ |
402 | - public function set_group( $handle, $recursion, $group ) { |
|
402 | + public function set_group($handle, $recursion, $group) { |
|
403 | 403 | $group = (int) $group; |
404 | 404 | |
405 | - if ( isset( $this->groups[ $handle ] ) && $this->groups[ $handle ] <= $group ) { |
|
405 | + if (isset($this->groups[$handle]) && $this->groups[$handle] <= $group) { |
|
406 | 406 | return false; |
407 | 407 | } |
408 | 408 | |
409 | - $this->groups[ $handle ] = $group; |
|
409 | + $this->groups[$handle] = $group; |
|
410 | 410 | |
411 | 411 | return true; |
412 | 412 | } |
@@ -111,8 +111,9 @@ discard block |
||
111 | 111 | * |
112 | 112 | * Unset the item from the to_do array. |
113 | 113 | */ |
114 | - if ( $this->do_item( $handle, $group ) ) |
|
115 | - $this->done[] = $handle; |
|
114 | + if ( $this->do_item( $handle, $group ) ) { |
|
115 | + $this->done[] = $handle; |
|
116 | + } |
|
116 | 117 | |
117 | 118 | unset( $this->to_do[$key] ); |
118 | 119 | } |
@@ -151,43 +152,61 @@ discard block |
||
151 | 152 | * @return bool True on success, false on failure. |
152 | 153 | */ |
153 | 154 | public function all_deps( $handles, $recursion = false, $group = false ) { |
154 | - if ( !$handles = (array) $handles ) |
|
155 | - return false; |
|
155 | + if ( !$handles = (array) $handles ) { |
|
156 | + return false; |
|
157 | + } |
|
156 | 158 | |
157 | 159 | foreach ( $handles as $handle ) { |
158 | 160 | $handle_parts = explode('?', $handle); |
159 | 161 | $handle = $handle_parts[0]; |
160 | 162 | $queued = in_array($handle, $this->to_do, true); |
161 | 163 | |
162 | - if ( in_array($handle, $this->done, true) ) // Already done |
|
164 | + if ( in_array($handle, $this->done, true) ) { |
|
165 | + // Already done |
|
163 | 166 | continue; |
167 | + } |
|
164 | 168 | |
165 | 169 | $moved = $this->set_group( $handle, $recursion, $group ); |
166 | 170 | $new_group = $this->groups[ $handle ]; |
167 | 171 | |
168 | - if ( $queued && !$moved ) // already queued and in the right group |
|
172 | + if ( $queued && !$moved ) { |
|
173 | + // already queued and in the right group |
|
169 | 174 | continue; |
175 | + } |
|
170 | 176 | |
171 | 177 | $keep_going = true; |
172 | - if ( !isset($this->registered[$handle]) ) |
|
173 | - $keep_going = false; // Item doesn't exist. |
|
174 | - elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) ) |
|
175 | - $keep_going = false; // Item requires dependencies that don't exist. |
|
176 | - elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $new_group ) ) |
|
177 | - $keep_going = false; // Item requires dependencies that don't exist. |
|
178 | + if ( !isset($this->registered[$handle]) ) { |
|
179 | + $keep_going = false; |
|
180 | + } |
|
181 | + // Item doesn't exist. |
|
182 | + elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) ) { |
|
183 | + $keep_going = false; |
|
184 | + } |
|
185 | + // Item requires dependencies that don't exist. |
|
186 | + elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $new_group ) ) { |
|
187 | + $keep_going = false; |
|
188 | + } |
|
189 | + // Item requires dependencies that don't exist. |
|
178 | 190 | |
179 | 191 | if ( ! $keep_going ) { // Either item or its dependencies don't exist. |
180 | - if ( $recursion ) |
|
181 | - return false; // Abort this branch. |
|
182 | - else |
|
183 | - continue; // We're at the top level. Move on to the next one. |
|
192 | + if ( $recursion ) { |
|
193 | + return false; |
|
194 | + } |
|
195 | + // Abort this branch. |
|
196 | + else { |
|
197 | + continue; |
|
198 | + } |
|
199 | + // We're at the top level. Move on to the next one. |
|
184 | 200 | } |
185 | 201 | |
186 | - if ( $queued ) // Already grabbed it and its dependencies. |
|
202 | + if ( $queued ) { |
|
203 | + // Already grabbed it and its dependencies. |
|
187 | 204 | continue; |
205 | + } |
|
188 | 206 | |
189 | - if ( isset($handle_parts[1]) ) |
|
190 | - $this->args[$handle] = $handle_parts[1]; |
|
207 | + if ( isset($handle_parts[1]) ) { |
|
208 | + $this->args[$handle] = $handle_parts[1]; |
|
209 | + } |
|
191 | 210 | |
192 | 211 | $this->to_do[] = $handle; |
193 | 212 | } |
@@ -215,8 +234,9 @@ discard block |
||
215 | 234 | * @return bool Whether the item has been registered. True on success, false on failure. |
216 | 235 | */ |
217 | 236 | public function add( $handle, $src, $deps = array(), $ver = false, $args = null ) { |
218 | - if ( isset($this->registered[$handle]) ) |
|
219 | - return false; |
|
237 | + if ( isset($this->registered[$handle]) ) { |
|
238 | + return false; |
|
239 | + } |
|
220 | 240 | $this->registered[$handle] = new _WP_Dependency( $handle, $src, $deps, $ver, $args ); |
221 | 241 | return true; |
222 | 242 | } |
@@ -235,8 +255,9 @@ discard block |
||
235 | 255 | * @return bool True on success, false on failure. |
236 | 256 | */ |
237 | 257 | public function add_data( $handle, $key, $value ) { |
238 | - if ( !isset( $this->registered[$handle] ) ) |
|
239 | - return false; |
|
258 | + if ( !isset( $this->registered[$handle] ) ) { |
|
259 | + return false; |
|
260 | + } |
|
240 | 261 | |
241 | 262 | return $this->registered[$handle]->add_data( $key, $value ); |
242 | 263 | } |
@@ -254,11 +275,13 @@ discard block |
||
254 | 275 | * @return mixed Extra item data (string), false otherwise. |
255 | 276 | */ |
256 | 277 | public function get_data( $handle, $key ) { |
257 | - if ( !isset( $this->registered[$handle] ) ) |
|
258 | - return false; |
|
278 | + if ( !isset( $this->registered[$handle] ) ) { |
|
279 | + return false; |
|
280 | + } |
|
259 | 281 | |
260 | - if ( !isset( $this->registered[$handle]->extra[$key] ) ) |
|
261 | - return false; |
|
282 | + if ( !isset( $this->registered[$handle]->extra[$key] ) ) { |
|
283 | + return false; |
|
284 | + } |
|
262 | 285 | |
263 | 286 | return $this->registered[$handle]->extra[$key]; |
264 | 287 | } |
@@ -274,8 +297,9 @@ discard block |
||
274 | 297 | * @return void |
275 | 298 | */ |
276 | 299 | public function remove( $handles ) { |
277 | - foreach ( (array) $handles as $handle ) |
|
278 | - unset($this->registered[$handle]); |
|
300 | + foreach ( (array) $handles as $handle ) { |
|
301 | + unset($this->registered[$handle]); |
|
302 | + } |
|
279 | 303 | } |
280 | 304 | |
281 | 305 | /** |
@@ -297,8 +321,9 @@ discard block |
||
297 | 321 | $handle = explode('?', $handle); |
298 | 322 | if ( !in_array($handle[0], $this->queue) && isset($this->registered[$handle[0]]) ) { |
299 | 323 | $this->queue[] = $handle[0]; |
300 | - if ( isset($handle[1]) ) |
|
301 | - $this->args[$handle[0]] = $handle[1]; |
|
324 | + if ( isset($handle[1]) ) { |
|
325 | + $this->args[$handle[0]] = $handle[1]; |
|
326 | + } |
|
302 | 327 | } |
303 | 328 | } |
304 | 329 | } |
@@ -366,8 +391,9 @@ discard block |
||
366 | 391 | switch ( $list ) { |
367 | 392 | case 'registered' : |
368 | 393 | case 'scripts': // back compat |
369 | - if ( isset( $this->registered[ $handle ] ) ) |
|
370 | - return $this->registered[ $handle ]; |
|
394 | + if ( isset( $this->registered[ $handle ] ) ) { |
|
395 | + return $this->registered[ $handle ]; |
|
396 | + } |
|
371 | 397 | return false; |
372 | 398 | |
373 | 399 | case 'enqueued' : |
@@ -524,7 +524,7 @@ |
||
524 | 524 | * @since 2.5.0 |
525 | 525 | * |
526 | 526 | * @param string $data Input string |
527 | - * @return array array(type, value) |
|
527 | + * @return string[] array(type, value) |
|
528 | 528 | */ |
529 | 529 | function prep_atom_text_construct($data) { |
530 | 530 | if (strpos($data, '<') === false && strpos($data, '&') === false) { |
@@ -179,8 +179,9 @@ discard block |
||
179 | 179 | * @return string The filtered content. |
180 | 180 | */ |
181 | 181 | function get_the_content_feed($feed_type = null) { |
182 | - if ( !$feed_type ) |
|
183 | - $feed_type = get_default_feed(); |
|
182 | + if ( !$feed_type ) { |
|
183 | + $feed_type = get_default_feed(); |
|
184 | + } |
|
184 | 185 | |
185 | 186 | /** This filter is documented in wp-includes/post-template.php */ |
186 | 187 | $content = apply_filters( 'the_content', get_the_content() ); |
@@ -281,8 +282,9 @@ discard block |
||
281 | 282 | function get_comment_guid($comment_id = null) { |
282 | 283 | $comment = get_comment($comment_id); |
283 | 284 | |
284 | - if ( !is_object($comment) ) |
|
285 | - return false; |
|
285 | + if ( !is_object($comment) ) { |
|
286 | + return false; |
|
287 | + } |
|
286 | 288 | |
287 | 289 | return get_the_guid($comment->comment_post_ID) . '#comment-' . $comment->comment_ID; |
288 | 290 | } |
@@ -365,34 +367,41 @@ discard block |
||
365 | 367 | * @return string All of the post categories for displaying in the feed. |
366 | 368 | */ |
367 | 369 | function get_the_category_rss($type = null) { |
368 | - if ( empty($type) ) |
|
369 | - $type = get_default_feed(); |
|
370 | + if ( empty($type) ) { |
|
371 | + $type = get_default_feed(); |
|
372 | + } |
|
370 | 373 | $categories = get_the_category(); |
371 | 374 | $tags = get_the_tags(); |
372 | 375 | $the_list = ''; |
373 | 376 | $cat_names = array(); |
374 | 377 | |
375 | 378 | $filter = 'rss'; |
376 | - if ( 'atom' == $type ) |
|
377 | - $filter = 'raw'; |
|
379 | + if ( 'atom' == $type ) { |
|
380 | + $filter = 'raw'; |
|
381 | + } |
|
378 | 382 | |
379 | - if ( !empty($categories) ) foreach ( (array) $categories as $category ) { |
|
383 | + if ( !empty($categories) ) { |
|
384 | + foreach ( (array) $categories as $category ) { |
|
380 | 385 | $cat_names[] = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter); |
381 | 386 | } |
387 | + } |
|
382 | 388 | |
383 | - if ( !empty($tags) ) foreach ( (array) $tags as $tag ) { |
|
389 | + if ( !empty($tags) ) { |
|
390 | + foreach ( (array) $tags as $tag ) { |
|
384 | 391 | $cat_names[] = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter); |
385 | 392 | } |
393 | + } |
|
386 | 394 | |
387 | 395 | $cat_names = array_unique($cat_names); |
388 | 396 | |
389 | 397 | foreach ( $cat_names as $cat_name ) { |
390 | - if ( 'rdf' == $type ) |
|
391 | - $the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n"; |
|
392 | - elseif ( 'atom' == $type ) |
|
393 | - $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) ); |
|
394 | - else |
|
395 | - $the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option('blog_charset') ) . "]]></category>\n"; |
|
398 | + if ( 'rdf' == $type ) { |
|
399 | + $the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n"; |
|
400 | + } elseif ( 'atom' == $type ) { |
|
401 | + $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) ); |
|
402 | + } else { |
|
403 | + $the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option('blog_charset') ) . "]]></category>\n"; |
|
404 | + } |
|
396 | 405 | } |
397 | 406 | |
398 | 407 | /** |
@@ -428,10 +437,11 @@ discard block |
||
428 | 437 | */ |
429 | 438 | function html_type_rss() { |
430 | 439 | $type = get_bloginfo('html_type'); |
431 | - if (strpos($type, 'xhtml') !== false) |
|
432 | - $type = 'xhtml'; |
|
433 | - else |
|
434 | - $type = 'html'; |
|
440 | + if (strpos($type, 'xhtml') !== false) { |
|
441 | + $type = 'xhtml'; |
|
442 | + } else { |
|
443 | + $type = 'html'; |
|
444 | + } |
|
435 | 445 | echo $type; |
436 | 446 | } |
437 | 447 | |
@@ -450,8 +460,9 @@ discard block |
||
450 | 460 | * @since 1.5.0 |
451 | 461 | */ |
452 | 462 | function rss_enclosure() { |
453 | - if ( post_password_required() ) |
|
454 | - return; |
|
463 | + if ( post_password_required() ) { |
|
464 | + return; |
|
465 | + } |
|
455 | 466 | |
456 | 467 | foreach ( (array) get_post_custom() as $key => $val) { |
457 | 468 | if ($key == 'enclosure') { |
@@ -489,8 +500,9 @@ discard block |
||
489 | 500 | * @since 2.2.0 |
490 | 501 | */ |
491 | 502 | function atom_enclosure() { |
492 | - if ( post_password_required() ) |
|
493 | - return; |
|
503 | + if ( post_password_required() ) { |
|
504 | + return; |
|
505 | + } |
|
494 | 506 | |
495 | 507 | foreach ( (array) get_post_custom() as $key => $val ) { |
496 | 508 | if ($key == 'enclosure') { |
@@ -618,8 +630,9 @@ discard block |
||
618 | 630 | * @since 2.8.0 |
619 | 631 | */ |
620 | 632 | function feed_content_type( $type = '' ) { |
621 | - if ( empty($type) ) |
|
622 | - $type = get_default_feed(); |
|
633 | + if ( empty($type) ) { |
|
634 | + $type = get_default_feed(); |
|
635 | + } |
|
623 | 636 | |
624 | 637 | $types = array( |
625 | 638 | 'rss' => 'application/rss+xml', |
@@ -683,8 +696,9 @@ discard block |
||
683 | 696 | $feed->set_output_encoding( get_option( 'blog_charset' ) ); |
684 | 697 | $feed->handle_content_type(); |
685 | 698 | |
686 | - if ( $feed->error() ) |
|
687 | - return new WP_Error( 'simplepie-error', $feed->error() ); |
|
699 | + if ( $feed->error() ) { |
|
700 | + return new WP_Error( 'simplepie-error', $feed->error() ); |
|
701 | + } |
|
688 | 702 | |
689 | 703 | return $feed; |
690 | 704 | } |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param string $info Converted string value of the blog information. |
37 | 37 | * @param string $show The type of blog information to retrieve. |
38 | 38 | */ |
39 | - return apply_filters( 'get_bloginfo_rss', convert_chars( $info ), $show ); |
|
39 | + return apply_filters('get_bloginfo_rss', convert_chars($info), $show); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param string $rss_container RSS container for the blog information. |
63 | 63 | * @param string $show The type of blog information to retrieve. |
64 | 64 | */ |
65 | - echo apply_filters( 'bloginfo_rss', get_bloginfo_rss( $show ), $show ); |
|
65 | + echo apply_filters('bloginfo_rss', get_bloginfo_rss($show), $show); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param string $feed_type Type of default feed. Possible values include 'rss2', 'atom'. |
85 | 85 | * Default 'rss2'. |
86 | 86 | */ |
87 | - $default_feed = apply_filters( 'default_feed', 'rss2' ); |
|
87 | + $default_feed = apply_filters('default_feed', 'rss2'); |
|
88 | 88 | return 'rss' == $default_feed ? 'rss2' : $default_feed; |
89 | 89 | } |
90 | 90 | |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | * @param string $deprecated Unused.. |
98 | 98 | * @return string The document title. |
99 | 99 | */ |
100 | -function get_wp_title_rss( $deprecated = '–' ) { |
|
101 | - if ( '–' !== $deprecated ) { |
|
100 | +function get_wp_title_rss($deprecated = '–') { |
|
101 | + if ('–' !== $deprecated) { |
|
102 | 102 | /* translators: %s: 'document_title_separator' filter name */ |
103 | - _deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), '<code>document_title_separator</code>' ) ); |
|
103 | + _deprecated_argument(__FUNCTION__, '4.4.0', sprintf(__('Use the %s filter instead.'), '<code>document_title_separator</code>')); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * @param string $title The current blog title. |
113 | 113 | * @param string $deprecated Unused. |
114 | 114 | */ |
115 | - return apply_filters( 'get_wp_title_rss', wp_get_document_title(), $deprecated ); |
|
115 | + return apply_filters('get_wp_title_rss', wp_get_document_title(), $deprecated); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -123,10 +123,10 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @param string $deprecated Unused. |
125 | 125 | */ |
126 | -function wp_title_rss( $deprecated = '–' ) { |
|
127 | - if ( '–' !== $deprecated ) { |
|
126 | +function wp_title_rss($deprecated = '–') { |
|
127 | + if ('–' !== $deprecated) { |
|
128 | 128 | /* translators: %s: 'document_title_separator' filter name */ |
129 | - _deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), '<code>document_title_separator</code>' ) ); |
|
129 | + _deprecated_argument(__FUNCTION__, '4.4.0', sprintf(__('Use the %s filter instead.'), '<code>document_title_separator</code>')); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param string $wp_title_rss The current blog title. |
141 | 141 | * @param string $deprecated Unused. |
142 | 142 | */ |
143 | - echo apply_filters( 'wp_title_rss', get_wp_title_rss(), $deprecated ); |
|
143 | + echo apply_filters('wp_title_rss', get_wp_title_rss(), $deprecated); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @param string $title The current post title. |
162 | 162 | */ |
163 | - $title = apply_filters( 'the_title_rss', $title ); |
|
163 | + $title = apply_filters('the_title_rss', $title); |
|
164 | 164 | return $title; |
165 | 165 | } |
166 | 166 | |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | * @return string The filtered content. |
184 | 184 | */ |
185 | 185 | function get_the_content_feed($feed_type = null) { |
186 | - if ( !$feed_type ) |
|
186 | + if ( ! $feed_type) |
|
187 | 187 | $feed_type = get_default_feed(); |
188 | 188 | |
189 | 189 | /** This filter is documented in wp-includes/post-template.php */ |
190 | - $content = apply_filters( 'the_content', get_the_content() ); |
|
190 | + $content = apply_filters('the_content', get_the_content()); |
|
191 | 191 | $content = str_replace(']]>', ']]>', $content); |
192 | 192 | /** |
193 | 193 | * Filters the post content for use in feeds. |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @param string $feed_type Type of feed. Possible values include 'rss2', 'atom'. |
199 | 199 | * Default 'rss2'. |
200 | 200 | */ |
201 | - return apply_filters( 'the_content_feed', $content, $feed_type ); |
|
201 | + return apply_filters('the_content_feed', $content, $feed_type); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * |
227 | 227 | * @param string $output The current post excerpt. |
228 | 228 | */ |
229 | - echo apply_filters( 'the_excerpt_rss', $output ); |
|
229 | + echo apply_filters('the_excerpt_rss', $output); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @param string $post_permalink The current post permalink. |
244 | 244 | */ |
245 | - echo esc_url( apply_filters( 'the_permalink_rss', get_permalink() ) ); |
|
245 | + echo esc_url(apply_filters('the_permalink_rss', get_permalink())); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | * @param string $comment_permalink The current comment permalink with |
261 | 261 | * '#comments' appended. |
262 | 262 | */ |
263 | - echo esc_url( apply_filters( 'comments_link_feed', get_comments_link() ) ); |
|
263 | + echo esc_url(apply_filters('comments_link_feed', get_comments_link())); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @param int|WP_Comment $comment_id Optional comment object or id. Defaults to global comment object. |
272 | 272 | */ |
273 | 273 | function comment_guid($comment_id = null) { |
274 | - echo esc_url( get_comment_guid($comment_id) ); |
|
274 | + echo esc_url(get_comment_guid($comment_id)); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | function get_comment_guid($comment_id = null) { |
286 | 286 | $comment = get_comment($comment_id); |
287 | 287 | |
288 | - if ( !is_object($comment) ) |
|
288 | + if ( ! is_object($comment)) |
|
289 | 289 | return false; |
290 | 290 | |
291 | - return get_the_guid($comment->comment_post_ID) . '#comment-' . $comment->comment_ID; |
|
291 | + return get_the_guid($comment->comment_post_ID).'#comment-'.$comment->comment_ID; |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @param int|WP_Comment $comment Optional. Comment object or id. Defaults to global comment object. |
301 | 301 | */ |
302 | -function comment_link( $comment = null ) { |
|
302 | +function comment_link($comment = null) { |
|
303 | 303 | /** |
304 | 304 | * Filters the current comment's permalink. |
305 | 305 | * |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * |
310 | 310 | * @param string $comment_permalink The current comment permalink. |
311 | 311 | */ |
312 | - echo esc_url( apply_filters( 'comment_link', get_comment_link( $comment ) ) ); |
|
312 | + echo esc_url(apply_filters('comment_link', get_comment_link($comment))); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @param string $comment_author The current comment author. |
331 | 331 | */ |
332 | - return apply_filters( 'comment_author_rss', get_comment_author() ); |
|
332 | + return apply_filters('comment_author_rss', get_comment_author()); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @param string $comment_text The content of the current comment. |
357 | 357 | */ |
358 | - $comment_text = apply_filters( 'comment_text_rss', $comment_text ); |
|
358 | + $comment_text = apply_filters('comment_text_rss', $comment_text); |
|
359 | 359 | echo $comment_text; |
360 | 360 | } |
361 | 361 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | * @return string All of the post categories for displaying in the feed. |
373 | 373 | */ |
374 | 374 | function get_the_category_rss($type = null) { |
375 | - if ( empty($type) ) |
|
375 | + if (empty($type)) |
|
376 | 376 | $type = get_default_feed(); |
377 | 377 | $categories = get_the_category(); |
378 | 378 | $tags = get_the_tags(); |
@@ -380,26 +380,26 @@ discard block |
||
380 | 380 | $cat_names = array(); |
381 | 381 | |
382 | 382 | $filter = 'rss'; |
383 | - if ( 'atom' == $type ) |
|
383 | + if ('atom' == $type) |
|
384 | 384 | $filter = 'raw'; |
385 | 385 | |
386 | - if ( !empty($categories) ) foreach ( (array) $categories as $category ) { |
|
386 | + if ( ! empty($categories)) foreach ((array) $categories as $category) { |
|
387 | 387 | $cat_names[] = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter); |
388 | 388 | } |
389 | 389 | |
390 | - if ( !empty($tags) ) foreach ( (array) $tags as $tag ) { |
|
390 | + if ( ! empty($tags)) foreach ((array) $tags as $tag) { |
|
391 | 391 | $cat_names[] = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter); |
392 | 392 | } |
393 | 393 | |
394 | 394 | $cat_names = array_unique($cat_names); |
395 | 395 | |
396 | - foreach ( $cat_names as $cat_name ) { |
|
397 | - if ( 'rdf' == $type ) |
|
396 | + foreach ($cat_names as $cat_name) { |
|
397 | + if ('rdf' == $type) |
|
398 | 398 | $the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n"; |
399 | - elseif ( 'atom' == $type ) |
|
400 | - $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) ); |
|
399 | + elseif ('atom' == $type) |
|
400 | + $the_list .= sprintf('<category scheme="%1$s" term="%2$s" />', esc_attr(get_bloginfo_rss('url')), esc_attr($cat_name)); |
|
401 | 401 | else |
402 | - $the_list .= "\t\t<category><![CDATA[" . @html_entity_decode( $cat_name, ENT_COMPAT, get_option('blog_charset') ) . "]]></category>\n"; |
|
402 | + $the_list .= "\t\t<category><![CDATA[".@html_entity_decode($cat_name, ENT_COMPAT, get_option('blog_charset'))."]]></category>\n"; |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | /** |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param string $type Type of feed. Possible values include 'rss2', 'atom'. |
412 | 412 | * Default 'rss2'. |
413 | 413 | */ |
414 | - return apply_filters( 'the_category_rss', $the_list, $type ); |
|
414 | + return apply_filters('the_category_rss', $the_list, $type); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -457,16 +457,16 @@ discard block |
||
457 | 457 | * @since 1.5.0 |
458 | 458 | */ |
459 | 459 | function rss_enclosure() { |
460 | - if ( post_password_required() ) |
|
460 | + if (post_password_required()) |
|
461 | 461 | return; |
462 | 462 | |
463 | - foreach ( (array) get_post_custom() as $key => $val) { |
|
463 | + foreach ((array) get_post_custom() as $key => $val) { |
|
464 | 464 | if ($key == 'enclosure') { |
465 | - foreach ( (array) $val as $enc ) { |
|
465 | + foreach ((array) $val as $enc) { |
|
466 | 466 | $enclosure = explode("\n", $enc); |
467 | 467 | |
468 | 468 | // only get the first element, e.g. audio/mpeg from 'audio/mpeg mpga mp2 mp3' |
469 | - $t = preg_split('/[ \t]/', trim($enclosure[2]) ); |
|
469 | + $t = preg_split('/[ \t]/', trim($enclosure[2])); |
|
470 | 470 | $type = $t[0]; |
471 | 471 | |
472 | 472 | /** |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * |
477 | 477 | * @param string $html_link_tag The HTML link tag with a URI and other attributes. |
478 | 478 | */ |
479 | - echo apply_filters( 'rss_enclosure', '<enclosure url="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" length="' . trim( $enclosure[1] ) . '" type="' . $type . '" />' . "\n" ); |
|
479 | + echo apply_filters('rss_enclosure', '<enclosure url="'.trim(htmlspecialchars($enclosure[0])).'" length="'.trim($enclosure[1]).'" type="'.$type.'" />'."\n"); |
|
480 | 480 | } |
481 | 481 | } |
482 | 482 | } |
@@ -496,12 +496,12 @@ discard block |
||
496 | 496 | * @since 2.2.0 |
497 | 497 | */ |
498 | 498 | function atom_enclosure() { |
499 | - if ( post_password_required() ) |
|
499 | + if (post_password_required()) |
|
500 | 500 | return; |
501 | 501 | |
502 | - foreach ( (array) get_post_custom() as $key => $val ) { |
|
502 | + foreach ((array) get_post_custom() as $key => $val) { |
|
503 | 503 | if ($key == 'enclosure') { |
504 | - foreach ( (array) $val as $enc ) { |
|
504 | + foreach ((array) $val as $enc) { |
|
505 | 505 | $enclosure = explode("\n", $enc); |
506 | 506 | /** |
507 | 507 | * Filters the atom enclosure HTML link tag for the current post. |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | * |
511 | 511 | * @param string $html_link_tag The HTML link tag with a URI and other attributes. |
512 | 512 | */ |
513 | - echo apply_filters( 'atom_enclosure', '<link href="' . trim( htmlspecialchars( $enclosure[0] ) ) . '" rel="enclosure" length="' . trim( $enclosure[1] ) . '" type="' . trim( $enclosure[2] ) . '" />' . "\n" ); |
|
513 | + echo apply_filters('atom_enclosure', '<link href="'.trim(htmlspecialchars($enclosure[0])).'" rel="enclosure" length="'.trim($enclosure[1]).'" type="'.trim($enclosure[2]).'" />'."\n"); |
|
514 | 514 | } |
515 | 515 | } |
516 | 516 | } |
@@ -538,18 +538,18 @@ discard block |
||
538 | 538 | return array('text', $data); |
539 | 539 | } |
540 | 540 | |
541 | - if ( ! function_exists( 'xml_parser_create' ) ) { |
|
542 | - trigger_error( __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) ); |
|
541 | + if ( ! function_exists('xml_parser_create')) { |
|
542 | + trigger_error(__("PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension.")); |
|
543 | 543 | |
544 | - return array( 'html', "<![CDATA[$data]]>" ); |
|
544 | + return array('html', "<![CDATA[$data]]>"); |
|
545 | 545 | } |
546 | 546 | |
547 | 547 | $parser = xml_parser_create(); |
548 | - xml_parse($parser, '<div>' . $data . '</div>', true); |
|
548 | + xml_parse($parser, '<div>'.$data.'</div>', true); |
|
549 | 549 | $code = xml_get_error_code($parser); |
550 | 550 | xml_parser_free($parser); |
551 | 551 | |
552 | - if (!$code) { |
|
552 | + if ( ! $code) { |
|
553 | 553 | if (strpos($data, '<') === false) { |
554 | 554 | return array('text', $data); |
555 | 555 | } else { |
@@ -573,8 +573,8 @@ discard block |
||
573 | 573 | * @see get_site_icon_url() |
574 | 574 | */ |
575 | 575 | function atom_site_icon() { |
576 | - $url = get_site_icon_url( 32 ); |
|
577 | - if ( $url ) { |
|
576 | + $url = get_site_icon_url(32); |
|
577 | + if ($url) { |
|
578 | 578 | echo "<icon>$url</icon>\n"; |
579 | 579 | } |
580 | 580 | } |
@@ -586,17 +586,17 @@ discard block |
||
586 | 586 | */ |
587 | 587 | function rss2_site_icon() { |
588 | 588 | $rss_title = get_wp_title_rss(); |
589 | - if ( empty( $rss_title ) ) { |
|
590 | - $rss_title = get_bloginfo_rss( 'name' ); |
|
589 | + if (empty($rss_title)) { |
|
590 | + $rss_title = get_bloginfo_rss('name'); |
|
591 | 591 | } |
592 | 592 | |
593 | - $url = get_site_icon_url( 32 ); |
|
594 | - if ( $url ) { |
|
593 | + $url = get_site_icon_url(32); |
|
594 | + if ($url) { |
|
595 | 595 | echo ' |
596 | 596 | <image> |
597 | - <url>' . convert_chars( $url ) . '</url> |
|
598 | - <title>' . $rss_title . '</title> |
|
599 | - <link>' . get_bloginfo_rss( 'url' ) . '</link> |
|
597 | + <url>' . convert_chars($url).'</url> |
|
598 | + <title>' . $rss_title.'</title> |
|
599 | + <link>' . get_bloginfo_rss('url').'</link> |
|
600 | 600 | <width>32</width> |
601 | 601 | <height>32</height> |
602 | 602 | </image> ' . "\n"; |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * |
623 | 623 | * @param string $feed_link The link for the feed with set URL scheme. |
624 | 624 | */ |
625 | - echo esc_url( apply_filters( 'self_link', set_url_scheme( 'http://' . $host['host'] . wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) ); |
|
625 | + echo esc_url(apply_filters('self_link', set_url_scheme('http://'.$host['host'].wp_unslash($_SERVER['REQUEST_URI'])))); |
|
626 | 626 | } |
627 | 627 | |
628 | 628 | /** |
@@ -632,8 +632,8 @@ discard block |
||
632 | 632 | * |
633 | 633 | * @param string $type Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'. |
634 | 634 | */ |
635 | -function feed_content_type( $type = '' ) { |
|
636 | - if ( empty($type) ) |
|
635 | +function feed_content_type($type = '') { |
|
636 | + if (empty($type)) |
|
637 | 637 | $type = get_default_feed(); |
638 | 638 | |
639 | 639 | $types = array( |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | 'rdf' => 'application/rdf+xml' |
645 | 645 | ); |
646 | 646 | |
647 | - $content_type = ( !empty($types[$type]) ) ? $types[$type] : 'application/octet-stream'; |
|
647 | + $content_type = ( ! empty($types[$type])) ? $types[$type] : 'application/octet-stream'; |
|
648 | 648 | |
649 | 649 | /** |
650 | 650 | * Filters the content type for a specific feed type. |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | * @param string $content_type Content type indicating the type of data that a feed contains. |
655 | 655 | * @param string $type Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'. |
656 | 656 | */ |
657 | - return apply_filters( 'feed_content_type', $content_type, $type ); |
|
657 | + return apply_filters('feed_content_type', $content_type, $type); |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | /** |
@@ -668,29 +668,29 @@ discard block |
||
668 | 668 | * |
669 | 669 | * @return WP_Error|SimplePie WP_Error object on failure or SimplePie object on success |
670 | 670 | */ |
671 | -function fetch_feed( $url ) { |
|
672 | - if ( ! class_exists( 'SimplePie', false ) ) { |
|
673 | - require_once( ABSPATH . WPINC . '/class-simplepie.php' ); |
|
671 | +function fetch_feed($url) { |
|
672 | + if ( ! class_exists('SimplePie', false)) { |
|
673 | + require_once(ABSPATH.WPINC.'/class-simplepie.php'); |
|
674 | 674 | } |
675 | 675 | |
676 | - require_once( ABSPATH . WPINC . '/class-wp-feed-cache.php' ); |
|
677 | - require_once( ABSPATH . WPINC . '/class-wp-feed-cache-transient.php' ); |
|
678 | - require_once( ABSPATH . WPINC . '/class-wp-simplepie-file.php' ); |
|
679 | - require_once( ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php' ); |
|
676 | + require_once(ABSPATH.WPINC.'/class-wp-feed-cache.php'); |
|
677 | + require_once(ABSPATH.WPINC.'/class-wp-feed-cache-transient.php'); |
|
678 | + require_once(ABSPATH.WPINC.'/class-wp-simplepie-file.php'); |
|
679 | + require_once(ABSPATH.WPINC.'/class-wp-simplepie-sanitize-kses.php'); |
|
680 | 680 | |
681 | 681 | $feed = new SimplePie(); |
682 | 682 | |
683 | - $feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' ); |
|
683 | + $feed->set_sanitize_class('WP_SimplePie_Sanitize_KSES'); |
|
684 | 684 | // We must manually overwrite $feed->sanitize because SimplePie's |
685 | 685 | // constructor sets it before we have a chance to set the sanitization class |
686 | 686 | $feed->sanitize = new WP_SimplePie_Sanitize_KSES(); |
687 | 687 | |
688 | - $feed->set_cache_class( 'WP_Feed_Cache' ); |
|
689 | - $feed->set_file_class( 'WP_SimplePie_File' ); |
|
688 | + $feed->set_cache_class('WP_Feed_Cache'); |
|
689 | + $feed->set_file_class('WP_SimplePie_File'); |
|
690 | 690 | |
691 | - $feed->set_feed_url( $url ); |
|
691 | + $feed->set_feed_url($url); |
|
692 | 692 | /** This filter is documented in wp-includes/class-wp-feed-cache-transient.php */ |
693 | - $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) ); |
|
693 | + $feed->set_cache_duration(apply_filters('wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url)); |
|
694 | 694 | /** |
695 | 695 | * Fires just before processing the SimplePie feed object. |
696 | 696 | * |
@@ -699,12 +699,12 @@ discard block |
||
699 | 699 | * @param object &$feed SimplePie feed object, passed by reference. |
700 | 700 | * @param mixed $url URL of feed to retrieve. If an array of URLs, the feeds are merged. |
701 | 701 | */ |
702 | - do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) ); |
|
702 | + do_action_ref_array('wp_feed_options', array(&$feed, $url)); |
|
703 | 703 | $feed->init(); |
704 | - $feed->set_output_encoding( get_option( 'blog_charset' ) ); |
|
704 | + $feed->set_output_encoding(get_option('blog_charset')); |
|
705 | 705 | |
706 | - if ( $feed->error() ) |
|
707 | - return new WP_Error( 'simplepie-error', $feed->error() ); |
|
706 | + if ($feed->error()) |
|
707 | + return new WP_Error('simplepie-error', $feed->error()); |
|
708 | 708 | |
709 | 709 | return $feed; |
710 | 710 | } |
@@ -99,6 +99,9 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | |
102 | + /** |
|
103 | + * @param string $binarynumerator |
|
104 | + */ |
|
102 | 105 | public static function DecimalBinary2Float($binarynumerator) { |
103 | 106 | $numerator = self::Bin2Dec($binarynumerator); |
104 | 107 | $denominator = self::Bin2Dec('1'.str_repeat('0', strlen($binarynumerator))); |
@@ -106,6 +109,9 @@ discard block |
||
106 | 109 | } |
107 | 110 | |
108 | 111 | |
112 | + /** |
|
113 | + * @param string $binarypointnumber |
|
114 | + */ |
|
109 | 115 | public static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) { |
110 | 116 | // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html |
111 | 117 | if (strpos($binarypointnumber, '.') === false) { |
@@ -177,6 +183,9 @@ discard block |
||
177 | 183 | } |
178 | 184 | |
179 | 185 | |
186 | + /** |
|
187 | + * @param string $byteword |
|
188 | + */ |
|
180 | 189 | public static function LittleEndian2Float($byteword) { |
181 | 190 | return self::BigEndian2Float(strrev($byteword)); |
182 | 191 | } |
@@ -366,6 +375,9 @@ discard block |
||
366 | 375 | } |
367 | 376 | |
368 | 377 | |
378 | + /** |
|
379 | + * @param integer $number |
|
380 | + */ |
|
369 | 381 | public static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) { |
370 | 382 | $intstring = ''; |
371 | 383 | while ($number > 0) { |
@@ -458,16 +470,25 @@ discard block |
||
458 | 470 | } |
459 | 471 | |
460 | 472 | |
473 | + /** |
|
474 | + * @param string $rawdata |
|
475 | + */ |
|
461 | 476 | public static function FixedPoint8_8($rawdata) { |
462 | 477 | return self::BigEndian2Int(substr($rawdata, 0, 1)) + (float) (self::BigEndian2Int(substr($rawdata, 1, 1)) / pow(2, 8)); |
463 | 478 | } |
464 | 479 | |
465 | 480 | |
481 | + /** |
|
482 | + * @param string $rawdata |
|
483 | + */ |
|
466 | 484 | public static function FixedPoint16_16($rawdata) { |
467 | 485 | return self::BigEndian2Int(substr($rawdata, 0, 2)) + (float) (self::BigEndian2Int(substr($rawdata, 2, 2)) / pow(2, 16)); |
468 | 486 | } |
469 | 487 | |
470 | 488 | |
489 | + /** |
|
490 | + * @param string $rawdata |
|
491 | + */ |
|
471 | 492 | public static function FixedPoint2_30($rawdata) { |
472 | 493 | $binarystring = self::BigEndian2Bin($rawdata); |
473 | 494 | return self::Bin2Dec(substr($binarystring, 0, 2)) + (float) (self::Bin2Dec(substr($binarystring, 2, 30)) / pow(2, 30)); |
@@ -531,6 +552,9 @@ discard block |
||
531 | 552 | return false; |
532 | 553 | } |
533 | 554 | |
555 | + /** |
|
556 | + * @param SimpleXMLElement $XMLobject |
|
557 | + */ |
|
534 | 558 | public static function SimpleXMLelement2array($XMLobject) { |
535 | 559 | if (!is_object($XMLobject) && !is_array($XMLobject)) { |
536 | 560 | return $XMLobject; |
@@ -631,6 +655,9 @@ discard block |
||
631 | 655 | return $result; |
632 | 656 | } |
633 | 657 | |
658 | + /** |
|
659 | + * @param string $filename_dest |
|
660 | + */ |
|
634 | 661 | public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) { |
635 | 662 | if (!self::intValueSupported($offset + $length)) { |
636 | 663 | throw new Exception('cannot copy file portion, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit'); |
@@ -863,6 +890,10 @@ discard block |
||
863 | 890 | } |
864 | 891 | |
865 | 892 | // UTF-16BE => UTF-8 |
893 | + |
|
894 | + /** |
|
895 | + * @param string $string |
|
896 | + */ |
|
866 | 897 | public static function iconv_fallback_utf16be_utf8($string) { |
867 | 898 | if (substr($string, 0, 2) == "\xFE\xFF") { |
868 | 899 | // strip BOM |
@@ -877,6 +908,10 @@ discard block |
||
877 | 908 | } |
878 | 909 | |
879 | 910 | // UTF-16LE => UTF-8 |
911 | + |
|
912 | + /** |
|
913 | + * @param string $string |
|
914 | + */ |
|
880 | 915 | public static function iconv_fallback_utf16le_utf8($string) { |
881 | 916 | if (substr($string, 0, 2) == "\xFF\xFE") { |
882 | 917 | // strip BOM |
@@ -891,6 +926,10 @@ discard block |
||
891 | 926 | } |
892 | 927 | |
893 | 928 | // UTF-16BE => ISO-8859-1 |
929 | + |
|
930 | + /** |
|
931 | + * @param string $string |
|
932 | + */ |
|
894 | 933 | public static function iconv_fallback_utf16be_iso88591($string) { |
895 | 934 | if (substr($string, 0, 2) == "\xFE\xFF") { |
896 | 935 | // strip BOM |
@@ -905,6 +944,10 @@ discard block |
||
905 | 944 | } |
906 | 945 | |
907 | 946 | // UTF-16LE => ISO-8859-1 |
947 | + |
|
948 | + /** |
|
949 | + * @param string $string |
|
950 | + */ |
|
908 | 951 | public static function iconv_fallback_utf16le_iso88591($string) { |
909 | 952 | if (substr($string, 0, 2) == "\xFF\xFE") { |
910 | 953 | // strip BOM |
@@ -940,6 +983,9 @@ discard block |
||
940 | 983 | return $string; |
941 | 984 | } |
942 | 985 | |
986 | + /** |
|
987 | + * @return string |
|
988 | + */ |
|
943 | 989 | public static function iconv_fallback($in_charset, $out_charset, $string) { |
944 | 990 | |
945 | 991 | if ($in_charset == $out_charset) { |
@@ -1271,6 +1317,12 @@ discard block |
||
1271 | 1317 | } |
1272 | 1318 | |
1273 | 1319 | |
1320 | + /** |
|
1321 | + * @param integer $begin |
|
1322 | + * @param integer $end |
|
1323 | + * @param string $file |
|
1324 | + * @param string $name |
|
1325 | + */ |
|
1274 | 1326 | public static function EmbeddedLookup($key, $begin, $end, $file, $name) { |
1275 | 1327 | |
1276 | 1328 | // Cached |
@@ -1317,6 +1369,10 @@ discard block |
||
1317 | 1369 | return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : ''); |
1318 | 1370 | } |
1319 | 1371 | |
1372 | + /** |
|
1373 | + * @param string $filename |
|
1374 | + * @param string $sourcefile |
|
1375 | + */ |
|
1320 | 1376 | public static function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) { |
1321 | 1377 | global $GETID3_ERRORARRAY; |
1322 | 1378 | |
@@ -1341,6 +1397,9 @@ discard block |
||
1341 | 1397 | return trim($string, "\x00"); |
1342 | 1398 | } |
1343 | 1399 | |
1400 | + /** |
|
1401 | + * @param string $path |
|
1402 | + */ |
|
1344 | 1403 | public static function getFileSizeSyscall($path) { |
1345 | 1404 | $filesize = false; |
1346 | 1405 |
@@ -1367,11 +1367,11 @@ |
||
1367 | 1367 | |
1368 | 1368 | |
1369 | 1369 | /** |
1370 | - * Workaround for Bug #37268 (https://bugs.php.net/bug.php?id=37268) |
|
1371 | - * @param string $path A path. |
|
1372 | - * @param string $suffix If the name component ends in suffix this will also be cut off. |
|
1373 | - * @return string |
|
1374 | - */ |
|
1370 | + * Workaround for Bug #37268 (https://bugs.php.net/bug.php?id=37268) |
|
1371 | + * @param string $path A path. |
|
1372 | + * @param string $suffix If the name component ends in suffix this will also be cut off. |
|
1373 | + * @return string |
|
1374 | + */ |
|
1375 | 1375 | public static function mb_basename($path, $suffix = null) { |
1376 | 1376 | $splited = preg_split('#/#', rtrim($path, '/ ')); |
1377 | 1377 | return substr(basename('X'.$splited[count($splited) - 1], $suffix), 1); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | class getid3_lib |
16 | 16 | { |
17 | 17 | |
18 | - public static function PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8') { |
|
18 | + public static function PrintHexBytes($string, $hex = true, $spaces = true, $htmlencoding = 'UTF-8') { |
|
19 | 19 | $returnstring = ''; |
20 | 20 | for ($i = 0; $i < strlen($string); $i++) { |
21 | 21 | if ($hex) { |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $returnstring .= ' '; |
28 | 28 | } |
29 | 29 | } |
30 | - if (!empty($htmlencoding)) { |
|
30 | + if ( ! empty($htmlencoding)) { |
|
31 | 31 | if ($htmlencoding === true) { |
32 | 32 | $htmlencoding = 'UTF-8'; // prior to getID3 v1.9.0 the function's 4th parameter was boolean |
33 | 33 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | |
56 | - public static function safe_inc(&$variable, $increment=1) { |
|
56 | + public static function safe_inc(&$variable, $increment = 1) { |
|
57 | 57 | if (isset($variable)) { |
58 | 58 | $variable += $increment; |
59 | 59 | } else { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | static $hasINT64 = null; |
83 | 83 | if ($hasINT64 === null) { // 10x faster than is_null() |
84 | 84 | $hasINT64 = is_int(pow(2, 31)); // 32-bit int are limited to (2^31)-1 |
85 | - if (!$hasINT64 && !defined('PHP_INT_MIN')) { |
|
85 | + if ( ! $hasINT64 && ! defined('PHP_INT_MIN')) { |
|
86 | 86 | define('PHP_INT_MIN', ~PHP_INT_MAX); |
87 | 87 | } |
88 | 88 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | - public static function NormalizeBinaryPoint($binarypointnumber, $maxbits=52) { |
|
109 | + public static function NormalizeBinaryPoint($binarypointnumber, $maxbits = 52) { |
|
110 | 110 | // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/binary.html |
111 | 111 | if (strpos($binarypointnumber, '.') === false) { |
112 | 112 | $binarypointnumber = '0.'.$binarypointnumber; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | // http://www.scri.fsu.edu/~jac/MAD3401/Backgrnd/ieee.html |
189 | 189 | |
190 | 190 | $bitword = self::BigEndian2Bin($byteword); |
191 | - if (!$bitword) { |
|
191 | + if ( ! $bitword) { |
|
192 | 192 | return 0; |
193 | 193 | } |
194 | 194 | $signbit = $bitword{0}; |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | } |
261 | 261 | |
262 | 262 | |
263 | - public static function BigEndian2Int($byteword, $synchsafe=false, $signed=false) { |
|
263 | + public static function BigEndian2Int($byteword, $synchsafe = false, $signed = false) { |
|
264 | 264 | $intvalue = 0; |
265 | 265 | $bytewordlen = strlen($byteword); |
266 | 266 | if ($bytewordlen == 0) { |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i)); |
275 | 275 | } |
276 | 276 | } |
277 | - if ($signed && !$synchsafe) { |
|
277 | + if ($signed && ! $synchsafe) { |
|
278 | 278 | // synchsafe ints are not allowed to be signed |
279 | 279 | if ($bytewordlen <= PHP_INT_SIZE) { |
280 | 280 | $signMaskBit = 0x80 << (8 * ($bytewordlen - 1)); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | } |
290 | 290 | |
291 | 291 | |
292 | - public static function LittleEndian2Int($byteword, $signed=false) { |
|
292 | + public static function LittleEndian2Int($byteword, $signed = false) { |
|
293 | 293 | return self::BigEndian2Int(strrev($byteword), false, $signed); |
294 | 294 | } |
295 | 295 | |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | |
307 | - public static function BigEndian2String($number, $minbytes=1, $synchsafe=false, $signed=false) { |
|
307 | + public static function BigEndian2String($number, $minbytes = 1, $synchsafe = false, $signed = false) { |
|
308 | 308 | if ($number < 0) { |
309 | 309 | throw new Exception('ERROR: self::BigEndian2String() does not support negative numbers'); |
310 | 310 | } |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | |
342 | - public static function Bin2Dec($binstring, $signed=false) { |
|
342 | + public static function Bin2Dec($binstring, $signed = false) { |
|
343 | 343 | $signmult = 1; |
344 | 344 | if ($signed) { |
345 | 345 | if ($binstring{0} == '1') { |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | } |
367 | 367 | |
368 | 368 | |
369 | - public static function LittleEndian2String($number, $minbytes=1, $synchsafe=false) { |
|
369 | + public static function LittleEndian2String($number, $minbytes = 1, $synchsafe = false) { |
|
370 | 370 | $intstring = ''; |
371 | 371 | while ($number > 0) { |
372 | 372 | if ($synchsafe) { |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | public static function array_merge_clobber($array1, $array2) { |
385 | 385 | // written by kcØhireability*com |
386 | 386 | // taken from http://www.php.net/manual/en/function.array-merge-recursive.php |
387 | - if (!is_array($array1) || !is_array($array2)) { |
|
387 | + if ( ! is_array($array1) || ! is_array($array2)) { |
|
388 | 388 | return false; |
389 | 389 | } |
390 | 390 | $newarray = $array1; |
@@ -400,14 +400,14 @@ discard block |
||
400 | 400 | |
401 | 401 | |
402 | 402 | public static function array_merge_noclobber($array1, $array2) { |
403 | - if (!is_array($array1) || !is_array($array2)) { |
|
403 | + if ( ! is_array($array1) || ! is_array($array2)) { |
|
404 | 404 | return false; |
405 | 405 | } |
406 | 406 | $newarray = $array1; |
407 | 407 | foreach ($array2 as $key => $val) { |
408 | 408 | if (is_array($val) && isset($newarray[$key]) && is_array($newarray[$key])) { |
409 | 409 | $newarray[$key] = self::array_merge_noclobber($newarray[$key], $val); |
410 | - } elseif (!isset($newarray[$key])) { |
|
410 | + } elseif ( ! isset($newarray[$key])) { |
|
411 | 411 | $newarray[$key] = $val; |
412 | 412 | } |
413 | 413 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | return true; |
426 | 426 | } |
427 | 427 | |
428 | - public static function fileextension($filename, $numextensions=1) { |
|
428 | + public static function fileextension($filename, $numextensions = 1) { |
|
429 | 429 | if (strstr($filename, '.')) { |
430 | 430 | $reversedfilename = strrev($filename); |
431 | 431 | $offset = 0; |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | public static function PlaytimeString($seconds) { |
445 | 445 | $sign = (($seconds < 0) ? '-' : ''); |
446 | 446 | $seconds = round(abs($seconds)); |
447 | - $H = (int) floor( $seconds / 3600); |
|
448 | - $M = (int) floor(($seconds - (3600 * $H) ) / 60); |
|
449 | - $S = (int) round( $seconds - (3600 * $H) - (60 * $M) ); |
|
447 | + $H = (int) floor($seconds / 3600); |
|
448 | + $M = (int) floor(($seconds - (3600 * $H)) / 60); |
|
449 | + $S = (int) round($seconds - (3600 * $H) - (60 * $M)); |
|
450 | 450 | return $sign.($H ? $H.':' : '').($H ? str_pad($M, 2, '0', STR_PAD_LEFT) : intval($M)).':'.str_pad($S, 2, 0, STR_PAD_LEFT); |
451 | 451 | } |
452 | 452 | |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | return $ReturnedArray; |
491 | 491 | } |
492 | 492 | |
493 | - public static function array_max($arraydata, $returnkey=false) { |
|
493 | + public static function array_max($arraydata, $returnkey = false) { |
|
494 | 494 | $maxvalue = false; |
495 | 495 | $maxkey = false; |
496 | 496 | foreach ($arraydata as $key => $value) { |
497 | - if (!is_array($value)) { |
|
497 | + if ( ! is_array($value)) { |
|
498 | 498 | if ($value > $maxvalue) { |
499 | 499 | $maxvalue = $value; |
500 | 500 | $maxkey = $key; |
@@ -504,11 +504,11 @@ discard block |
||
504 | 504 | return ($returnkey ? $maxkey : $maxvalue); |
505 | 505 | } |
506 | 506 | |
507 | - public static function array_min($arraydata, $returnkey=false) { |
|
507 | + public static function array_min($arraydata, $returnkey = false) { |
|
508 | 508 | $minvalue = false; |
509 | 509 | $minkey = false; |
510 | 510 | foreach ($arraydata as $key => $value) { |
511 | - if (!is_array($value)) { |
|
511 | + if ( ! is_array($value)) { |
|
512 | 512 | if ($value > $minvalue) { |
513 | 513 | $minvalue = $value; |
514 | 514 | $minkey = $key; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | } |
533 | 533 | |
534 | 534 | public static function SimpleXMLelement2array($XMLobject) { |
535 | - if (!is_object($XMLobject) && !is_array($XMLobject)) { |
|
535 | + if ( ! is_object($XMLobject) && ! is_array($XMLobject)) { |
|
536 | 536 | return $XMLobject; |
537 | 537 | } |
538 | 538 | $XMLarray = (is_object($XMLobject) ? get_object_vars($XMLobject) : $XMLobject); |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | // self::md5_data() - returns md5sum for a file from startuing position to absolute end position |
548 | 548 | public static function hash_data($file, $offset, $end, $algorithm) { |
549 | 549 | static $tempdir = ''; |
550 | - if (!self::intValueSupported($end)) { |
|
550 | + if ( ! self::intValueSupported($end)) { |
|
551 | 551 | return false; |
552 | 552 | } |
553 | 553 | switch ($algorithm) { |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | |
582 | 582 | $RequiredFiles = array('cygwin1.dll', 'head.exe', 'tail.exe', $windows_call); |
583 | 583 | foreach ($RequiredFiles as $required_file) { |
584 | - if (!is_readable(GETID3_HELPERAPPSDIR.$required_file)) { |
|
584 | + if ( ! is_readable(GETID3_HELPERAPPSDIR.$required_file)) { |
|
585 | 585 | // helper apps not available - fall back to old method |
586 | 586 | break 2; |
587 | 587 | } |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | } |
633 | 633 | |
634 | 634 | public static function CopyFileParts($filename_source, $filename_dest, $offset, $length) { |
635 | - if (!self::intValueSupported($offset + $length)) { |
|
635 | + if ( ! self::intValueSupported($offset + $length)) { |
|
636 | 636 | throw new Exception('cannot copy file portion, it extends beyond the '.round(PHP_INT_MAX / 1073741824).'GB limit'); |
637 | 637 | } |
638 | 638 | if (is_readable($filename_source) && is_file($filename_source) && ($fp_src = fopen($filename_source, 'rb'))) { |
@@ -664,25 +664,25 @@ discard block |
||
664 | 664 | $newcharstring = chr($charval); |
665 | 665 | } elseif ($charval < 2048) { |
666 | 666 | // 110bbbbb 10bbbbbb |
667 | - $newcharstring = chr(($charval >> 6) | 0xC0); |
|
667 | + $newcharstring = chr(($charval >> 6) | 0xC0); |
|
668 | 668 | $newcharstring .= chr(($charval & 0x3F) | 0x80); |
669 | 669 | } elseif ($charval < 65536) { |
670 | 670 | // 1110bbbb 10bbbbbb 10bbbbbb |
671 | - $newcharstring = chr(($charval >> 12) | 0xE0); |
|
672 | - $newcharstring .= chr(($charval >> 6) | 0xC0); |
|
671 | + $newcharstring = chr(($charval >> 12) | 0xE0); |
|
672 | + $newcharstring .= chr(($charval >> 6) | 0xC0); |
|
673 | 673 | $newcharstring .= chr(($charval & 0x3F) | 0x80); |
674 | 674 | } else { |
675 | 675 | // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
676 | - $newcharstring = chr(($charval >> 18) | 0xF0); |
|
677 | - $newcharstring .= chr(($charval >> 12) | 0xC0); |
|
678 | - $newcharstring .= chr(($charval >> 6) | 0xC0); |
|
676 | + $newcharstring = chr(($charval >> 18) | 0xF0); |
|
677 | + $newcharstring .= chr(($charval >> 12) | 0xC0); |
|
678 | + $newcharstring .= chr(($charval >> 6) | 0xC0); |
|
679 | 679 | $newcharstring .= chr(($charval & 0x3F) | 0x80); |
680 | 680 | } |
681 | 681 | return $newcharstring; |
682 | 682 | } |
683 | 683 | |
684 | 684 | // ISO-8859-1 => UTF-8 |
685 | - public static function iconv_fallback_iso88591_utf8($string, $bom=false) { |
|
685 | + public static function iconv_fallback_iso88591_utf8($string, $bom = false) { |
|
686 | 686 | if (function_exists('utf8_encode')) { |
687 | 687 | return utf8_encode($string); |
688 | 688 | } |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | } |
700 | 700 | |
701 | 701 | // ISO-8859-1 => UTF-16BE |
702 | - public static function iconv_fallback_iso88591_utf16be($string, $bom=false) { |
|
702 | + public static function iconv_fallback_iso88591_utf16be($string, $bom = false) { |
|
703 | 703 | $newcharstring = ''; |
704 | 704 | if ($bom) { |
705 | 705 | $newcharstring .= "\xFE\xFF"; |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | } |
712 | 712 | |
713 | 713 | // ISO-8859-1 => UTF-16LE |
714 | - public static function iconv_fallback_iso88591_utf16le($string, $bom=false) { |
|
714 | + public static function iconv_fallback_iso88591_utf16le($string, $bom = false) { |
|
715 | 715 | $newcharstring = ''; |
716 | 716 | if ($bom) { |
717 | 717 | $newcharstring .= "\xFF\xFE"; |
@@ -741,18 +741,18 @@ discard block |
||
741 | 741 | // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
742 | 742 | $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & |
743 | 743 | ((ord($string{($offset + 1)}) & 0x3F) << 12) & |
744 | - ((ord($string{($offset + 2)}) & 0x3F) << 6) & |
|
744 | + ((ord($string{($offset + 2)}) & 0x3F) << 6) & |
|
745 | 745 | (ord($string{($offset + 3)}) & 0x3F); |
746 | 746 | $offset += 4; |
747 | 747 | } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { |
748 | 748 | // 1110bbbb 10bbbbbb 10bbbbbb |
749 | 749 | $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & |
750 | - ((ord($string{($offset + 1)}) & 0x3F) << 6) & |
|
750 | + ((ord($string{($offset + 1)}) & 0x3F) << 6) & |
|
751 | 751 | (ord($string{($offset + 2)}) & 0x3F); |
752 | 752 | $offset += 3; |
753 | 753 | } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { |
754 | 754 | // 110bbbbb 10bbbbbb |
755 | - $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & |
|
755 | + $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & |
|
756 | 756 | (ord($string{($offset + 1)}) & 0x3F); |
757 | 757 | $offset += 2; |
758 | 758 | } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | } |
773 | 773 | |
774 | 774 | // UTF-8 => UTF-16BE |
775 | - public static function iconv_fallback_utf8_utf16be($string, $bom=false) { |
|
775 | + public static function iconv_fallback_utf8_utf16be($string, $bom = false) { |
|
776 | 776 | $newcharstring = ''; |
777 | 777 | if ($bom) { |
778 | 778 | $newcharstring .= "\xFE\xFF"; |
@@ -784,18 +784,18 @@ discard block |
||
784 | 784 | // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
785 | 785 | $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & |
786 | 786 | ((ord($string{($offset + 1)}) & 0x3F) << 12) & |
787 | - ((ord($string{($offset + 2)}) & 0x3F) << 6) & |
|
787 | + ((ord($string{($offset + 2)}) & 0x3F) << 6) & |
|
788 | 788 | (ord($string{($offset + 3)}) & 0x3F); |
789 | 789 | $offset += 4; |
790 | 790 | } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { |
791 | 791 | // 1110bbbb 10bbbbbb 10bbbbbb |
792 | 792 | $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & |
793 | - ((ord($string{($offset + 1)}) & 0x3F) << 6) & |
|
793 | + ((ord($string{($offset + 1)}) & 0x3F) << 6) & |
|
794 | 794 | (ord($string{($offset + 2)}) & 0x3F); |
795 | 795 | $offset += 3; |
796 | 796 | } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { |
797 | 797 | // 110bbbbb 10bbbbbb |
798 | - $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & |
|
798 | + $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & |
|
799 | 799 | (ord($string{($offset + 1)}) & 0x3F); |
800 | 800 | $offset += 2; |
801 | 801 | } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | } |
816 | 816 | |
817 | 817 | // UTF-8 => UTF-16LE |
818 | - public static function iconv_fallback_utf8_utf16le($string, $bom=false) { |
|
818 | + public static function iconv_fallback_utf8_utf16le($string, $bom = false) { |
|
819 | 819 | $newcharstring = ''; |
820 | 820 | if ($bom) { |
821 | 821 | $newcharstring .= "\xFF\xFE"; |
@@ -827,18 +827,18 @@ discard block |
||
827 | 827 | // 11110bbb 10bbbbbb 10bbbbbb 10bbbbbb |
828 | 828 | $charval = ((ord($string{($offset + 0)}) & 0x07) << 18) & |
829 | 829 | ((ord($string{($offset + 1)}) & 0x3F) << 12) & |
830 | - ((ord($string{($offset + 2)}) & 0x3F) << 6) & |
|
830 | + ((ord($string{($offset + 2)}) & 0x3F) << 6) & |
|
831 | 831 | (ord($string{($offset + 3)}) & 0x3F); |
832 | 832 | $offset += 4; |
833 | 833 | } elseif ((ord($string{$offset}) | 0x0F) == 0xEF) { |
834 | 834 | // 1110bbbb 10bbbbbb 10bbbbbb |
835 | 835 | $charval = ((ord($string{($offset + 0)}) & 0x0F) << 12) & |
836 | - ((ord($string{($offset + 1)}) & 0x3F) << 6) & |
|
836 | + ((ord($string{($offset + 1)}) & 0x3F) << 6) & |
|
837 | 837 | (ord($string{($offset + 2)}) & 0x3F); |
838 | 838 | $offset += 3; |
839 | 839 | } elseif ((ord($string{$offset}) | 0x1F) == 0xDF) { |
840 | 840 | // 110bbbbb 10bbbbbb |
841 | - $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & |
|
841 | + $charval = ((ord($string{($offset + 0)}) & 0x1F) << 6) & |
|
842 | 842 | (ord($string{($offset + 1)}) & 0x3F); |
843 | 843 | $offset += 2; |
844 | 844 | } elseif ((ord($string{$offset}) | 0x7F) == 0x7F) { |
@@ -988,7 +988,7 @@ discard block |
||
988 | 988 | throw new Exception('PHP does not have iconv() support - cannot convert from '.$in_charset.' to '.$out_charset); |
989 | 989 | } |
990 | 990 | |
991 | - public static function recursiveMultiByteCharString2HTML($data, $charset='ISO-8859-1') { |
|
991 | + public static function recursiveMultiByteCharString2HTML($data, $charset = 'ISO-8859-1') { |
|
992 | 992 | if (is_string($data)) { |
993 | 993 | return self::MultiByteCharString2HTML($data, $charset); |
994 | 994 | } elseif (is_array($data)) { |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | return $data; |
1003 | 1003 | } |
1004 | 1004 | |
1005 | - public static function MultiByteCharString2HTML($string, $charset='ISO-8859-1') { |
|
1005 | + public static function MultiByteCharString2HTML($string, $charset = 'ISO-8859-1') { |
|
1006 | 1006 | $string = (string) $string; // in case trying to pass a numeric (float, int) string, would otherwise return an empty string |
1007 | 1007 | $HTMLstring = ''; |
1008 | 1008 | |
@@ -1044,16 +1044,16 @@ discard block |
||
1044 | 1044 | $charval = 0; |
1045 | 1045 | if ($char_ord_val < 0x80) { |
1046 | 1046 | $charval = $char_ord_val; |
1047 | - } elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F && $i+3 < $strlen) { |
|
1047 | + } elseif ((($char_ord_val & 0xF0) >> 4) == 0x0F && $i + 3 < $strlen) { |
|
1048 | 1048 | $charval = (($char_ord_val & 0x07) << 18); |
1049 | 1049 | $charval += ((ord($string{++$i}) & 0x3F) << 12); |
1050 | 1050 | $charval += ((ord($string{++$i}) & 0x3F) << 6); |
1051 | - $charval += (ord($string{++$i}) & 0x3F); |
|
1052 | - } elseif ((($char_ord_val & 0xE0) >> 5) == 0x07 && $i+2 < $strlen) { |
|
1051 | + $charval += (ord($string{++$i}) & 0x3F); |
|
1052 | + } elseif ((($char_ord_val & 0xE0) >> 5) == 0x07 && $i + 2 < $strlen) { |
|
1053 | 1053 | $charval = (($char_ord_val & 0x0F) << 12); |
1054 | 1054 | $charval += ((ord($string{++$i}) & 0x3F) << 6); |
1055 | - $charval += (ord($string{++$i}) & 0x3F); |
|
1056 | - } elseif ((($char_ord_val & 0xC0) >> 6) == 0x03 && $i+1 < $strlen) { |
|
1055 | + $charval += (ord($string{++$i}) & 0x3F); |
|
1056 | + } elseif ((($char_ord_val & 0xC0) >> 6) == 0x03 && $i + 1 < $strlen) { |
|
1057 | 1057 | $charval = (($char_ord_val & 0x1F) << 6); |
1058 | 1058 | $charval += (ord($string{++$i}) & 0x3F); |
1059 | 1059 | } |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | |
1153 | - public static function GetDataImageSize($imgData, &$imageinfo=array()) { |
|
1153 | + public static function GetDataImageSize($imgData, &$imageinfo = array()) { |
|
1154 | 1154 | static $tempdir = ''; |
1155 | 1155 | if (empty($tempdir)) { |
1156 | 1156 | // yes this is ugly, feel free to suggest a better way |
@@ -1202,11 +1202,11 @@ discard block |
||
1202 | 1202 | public static function CopyTagsToComments(&$ThisFileInfo) { |
1203 | 1203 | |
1204 | 1204 | // Copy all entries from ['tags'] into common ['comments'] |
1205 | - if (!empty($ThisFileInfo['tags'])) { |
|
1205 | + if ( ! empty($ThisFileInfo['tags'])) { |
|
1206 | 1206 | foreach ($ThisFileInfo['tags'] as $tagtype => $tagarray) { |
1207 | 1207 | foreach ($tagarray as $tagname => $tagdata) { |
1208 | 1208 | foreach ($tagdata as $key => $value) { |
1209 | - if (!empty($value)) { |
|
1209 | + if ( ! empty($value)) { |
|
1210 | 1210 | if (empty($ThisFileInfo['comments'][$tagname])) { |
1211 | 1211 | |
1212 | 1212 | // fall through and append value |
@@ -1222,7 +1222,7 @@ discard block |
||
1222 | 1222 | } |
1223 | 1223 | } |
1224 | 1224 | |
1225 | - } elseif (!is_array($value)) { |
|
1225 | + } elseif ( ! is_array($value)) { |
|
1226 | 1226 | |
1227 | 1227 | $newvaluelength = strlen(trim($value)); |
1228 | 1228 | foreach ($ThisFileInfo['comments'][$tagname] as $existingkey => $existingvalue) { |
@@ -1235,9 +1235,9 @@ discard block |
||
1235 | 1235 | } |
1236 | 1236 | |
1237 | 1237 | } |
1238 | - if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || !in_array(trim($value), $ThisFileInfo['comments'][$tagname])) { |
|
1238 | + if (is_array($value) || empty($ThisFileInfo['comments'][$tagname]) || ! in_array(trim($value), $ThisFileInfo['comments'][$tagname])) { |
|
1239 | 1239 | $value = (is_string($value) ? trim($value) : $value); |
1240 | - if (!is_numeric($key)) { |
|
1240 | + if ( ! is_numeric($key)) { |
|
1241 | 1241 | $ThisFileInfo['comments'][$tagname][$key] = $value; |
1242 | 1242 | } else { |
1243 | 1243 | $ThisFileInfo['comments'][$tagname][] = $value; |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | } |
1250 | 1250 | |
1251 | 1251 | // Copy to ['comments_html'] |
1252 | - if (!empty($ThisFileInfo['comments'])) { |
|
1252 | + if ( ! empty($ThisFileInfo['comments'])) { |
|
1253 | 1253 | foreach ($ThisFileInfo['comments'] as $field => $values) { |
1254 | 1254 | if ($field == 'picture') { |
1255 | 1255 | // pictures can take up a lot of space, and we don't need multiple copies of them |
@@ -1317,7 +1317,7 @@ discard block |
||
1317 | 1317 | return (isset($cache[$file][$name][$key]) ? $cache[$file][$name][$key] : ''); |
1318 | 1318 | } |
1319 | 1319 | |
1320 | - public static function IncludeDependency($filename, $sourcefile, $DieOnFailure=false) { |
|
1320 | + public static function IncludeDependency($filename, $sourcefile, $DieOnFailure = false) { |
|
1321 | 1321 | global $GETID3_ERRORARRAY; |
1322 | 1322 | |
1323 | 1323 | if (file_exists($filename)) { |
@@ -335,6 +335,10 @@ discard block |
||
335 | 335 | } |
336 | 336 | |
337 | 337 | // public: analyze file |
338 | + |
|
339 | + /** |
|
340 | + * @param string $filename |
|
341 | + */ |
|
338 | 342 | public function analyze($filename) { |
339 | 343 | try { |
340 | 344 | if (!$this->openfile($filename)) { |
@@ -486,6 +490,10 @@ discard block |
||
486 | 490 | |
487 | 491 | |
488 | 492 | // private: error handling |
493 | + |
|
494 | + /** |
|
495 | + * @param string $message |
|
496 | + */ |
|
489 | 497 | public function error($message) { |
490 | 498 | $this->CleanUp(); |
491 | 499 | if (!isset($this->info['error'])) { |
@@ -1097,6 +1105,9 @@ discard block |
||
1097 | 1105 | |
1098 | 1106 | |
1099 | 1107 | |
1108 | + /** |
|
1109 | + * @param string $filedata |
|
1110 | + */ |
|
1100 | 1111 | public function GetFileFormat(&$filedata, $filename='') { |
1101 | 1112 | // this function will determine the format of a file based on usually |
1102 | 1113 | // the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG, |
@@ -1136,6 +1147,10 @@ discard block |
||
1136 | 1147 | |
1137 | 1148 | |
1138 | 1149 | // converts array to $encoding charset from $this->encoding |
1150 | + |
|
1151 | + /** |
|
1152 | + * @param string $encoding |
|
1153 | + */ |
|
1139 | 1154 | public function CharConvert(&$array, $encoding) { |
1140 | 1155 | |
1141 | 1156 | // identical encoding - end here |
@@ -1280,6 +1295,9 @@ discard block |
||
1280 | 1295 | return true; |
1281 | 1296 | } |
1282 | 1297 | |
1298 | + /** |
|
1299 | + * @param string $algorithm |
|
1300 | + */ |
|
1283 | 1301 | public function getHashdata($algorithm) { |
1284 | 1302 | switch ($algorithm) { |
1285 | 1303 | case 'md5': |
@@ -1573,6 +1591,9 @@ discard block |
||
1573 | 1591 | return tempnam($this->tempdir, 'gI3'); |
1574 | 1592 | } |
1575 | 1593 | |
1594 | + /** |
|
1595 | + * @param string $name |
|
1596 | + */ |
|
1576 | 1597 | public function include_module($name) { |
1577 | 1598 | //if (!file_exists($this->include_path.'module.'.$name.'.php')) { |
1578 | 1599 | if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) { |
@@ -1600,6 +1621,9 @@ discard block |
||
1600 | 1621 | private $dependency_to = null; |
1601 | 1622 | |
1602 | 1623 | |
1624 | + /** |
|
1625 | + * @param string $call_module |
|
1626 | + */ |
|
1603 | 1627 | public function __construct(getID3 $getid3, $call_module=null) { |
1604 | 1628 | $this->getid3 = $getid3; |
1605 | 1629 | |
@@ -1664,6 +1688,9 @@ discard block |
||
1664 | 1688 | return fread($this->getid3->fp, $bytes); |
1665 | 1689 | } |
1666 | 1690 | |
1691 | + /** |
|
1692 | + * @param integer $whence |
|
1693 | + */ |
|
1667 | 1694 | protected function fseek($bytes, $whence=SEEK_SET) { |
1668 | 1695 | if ($this->data_string_flag) { |
1669 | 1696 | switch ($whence) { |
@@ -1701,20 +1728,32 @@ discard block |
||
1701 | 1728 | return feof($this->getid3->fp); |
1702 | 1729 | } |
1703 | 1730 | |
1731 | + /** |
|
1732 | + * @param string $module |
|
1733 | + */ |
|
1704 | 1734 | final protected function isDependencyFor($module) { |
1705 | 1735 | return $this->dependency_to == $module; |
1706 | 1736 | } |
1707 | 1737 | |
1738 | + /** |
|
1739 | + * @param string $text |
|
1740 | + */ |
|
1708 | 1741 | protected function error($text) { |
1709 | 1742 | $this->getid3->info['error'][] = $text; |
1710 | 1743 | |
1711 | 1744 | return false; |
1712 | 1745 | } |
1713 | 1746 | |
1747 | + /** |
|
1748 | + * @param string $text |
|
1749 | + */ |
|
1714 | 1750 | protected function warning($text) { |
1715 | 1751 | return $this->getid3->warning($text); |
1716 | 1752 | } |
1717 | 1753 | |
1754 | + /** |
|
1755 | + * @param string $text |
|
1756 | + */ |
|
1718 | 1757 | protected function notice($text) { |
1719 | 1758 | // does nothing for now |
1720 | 1759 | } |
@@ -1588,8 +1588,8 @@ |
||
1588 | 1588 | abstract class getid3_handler { |
1589 | 1589 | |
1590 | 1590 | /** |
1591 | - * @var getID3 |
|
1592 | - */ |
|
1591 | + * @var getID3 |
|
1592 | + */ |
|
1593 | 1593 | protected $getid3; // pointer |
1594 | 1594 | |
1595 | 1595 | protected $data_string_flag = false; // analyzing filepointer or string |
@@ -11,24 +11,24 @@ discard block |
||
11 | 11 | ///////////////////////////////////////////////////////////////// |
12 | 12 | |
13 | 13 | // define a constant rather than looking up every time it is needed |
14 | -if (!defined('GETID3_OS_ISWINDOWS')) { |
|
14 | +if ( ! defined('GETID3_OS_ISWINDOWS')) { |
|
15 | 15 | define('GETID3_OS_ISWINDOWS', (stripos(PHP_OS, 'WIN') === 0)); |
16 | 16 | } |
17 | 17 | // Get base path of getID3() - ONCE |
18 | -if (!defined('GETID3_INCLUDEPATH')) { |
|
18 | +if ( ! defined('GETID3_INCLUDEPATH')) { |
|
19 | 19 | define('GETID3_INCLUDEPATH', dirname(__FILE__).DIRECTORY_SEPARATOR); |
20 | 20 | } |
21 | 21 | // Workaround Bug #39923 (https://bugs.php.net/bug.php?id=39923) |
22 | -if (!defined('IMG_JPG') && defined('IMAGETYPE_JPEG')) { |
|
22 | +if ( ! defined('IMG_JPG') && defined('IMAGETYPE_JPEG')) { |
|
23 | 23 | define('IMG_JPG', IMAGETYPE_JPEG); |
24 | 24 | } |
25 | 25 | |
26 | 26 | // attempt to define temp dir as something flexible but reliable |
27 | 27 | $temp_dir = ini_get('upload_tmp_dir'); |
28 | -if ($temp_dir && (!is_dir($temp_dir) || !is_readable($temp_dir))) { |
|
28 | +if ($temp_dir && ( ! is_dir($temp_dir) || ! is_readable($temp_dir))) { |
|
29 | 29 | $temp_dir = ''; |
30 | 30 | } |
31 | -if (!$temp_dir && function_exists('sys_get_temp_dir')) { // sys_get_temp_dir added in PHP v5.2.1 |
|
31 | +if ( ! $temp_dir && function_exists('sys_get_temp_dir')) { // sys_get_temp_dir added in PHP v5.2.1 |
|
32 | 32 | // sys_get_temp_dir() may give inaccessible temp dir, e.g. with open_basedir on virtual hosts |
33 | 33 | $temp_dir = sys_get_temp_dir(); |
34 | 34 | } |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | break; |
53 | 53 | } |
54 | 54 | } |
55 | - if (!$found_valid_tempdir) { |
|
55 | + if ( ! $found_valid_tempdir) { |
|
56 | 56 | $temp_dir = ''; |
57 | 57 | } |
58 | 58 | unset($open_basedirs, $found_valid_tempdir, $basedir); |
59 | 59 | } |
60 | -if (!$temp_dir) { |
|
60 | +if ( ! $temp_dir) { |
|
61 | 61 | $temp_dir = '*'; // invalid directory name should force tempnam() to use system default temp dir |
62 | 62 | } |
63 | 63 | // $temp_dir = '/something/else/'; // feel free to override temp dir here if it works better for your system |
64 | -if (!defined('GETID3_TEMP_DIR')) { |
|
64 | +if ( ! defined('GETID3_TEMP_DIR')) { |
|
65 | 65 | define('GETID3_TEMP_DIR', $temp_dir); |
66 | 66 | } |
67 | 67 | unset($open_basedir, $temp_dir); |
@@ -72,19 +72,19 @@ discard block |
||
72 | 72 | class getID3 |
73 | 73 | { |
74 | 74 | // public: Settings |
75 | - public $encoding = 'UTF-8'; // CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE |
|
76 | - public $encoding_id3v1 = 'ISO-8859-1'; // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252' |
|
75 | + public $encoding = 'UTF-8'; // CASE SENSITIVE! - i.e. (must be supported by iconv()). Examples: ISO-8859-1 UTF-8 UTF-16 UTF-16BE |
|
76 | + public $encoding_id3v1 = 'ISO-8859-1'; // Should always be 'ISO-8859-1', but some tags may be written in other encodings such as 'EUC-CN' or 'CP1252' |
|
77 | 77 | |
78 | 78 | // public: Optional tag checks - disable for speed. |
79 | - public $option_tag_id3v1 = true; // Read and process ID3v1 tags |
|
80 | - public $option_tag_id3v2 = true; // Read and process ID3v2 tags |
|
81 | - public $option_tag_lyrics3 = true; // Read and process Lyrics3 tags |
|
82 | - public $option_tag_apetag = true; // Read and process APE tags |
|
83 | - public $option_tags_process = true; // Copy tags to root key 'tags' and encode to $this->encoding |
|
84 | - public $option_tags_html = true; // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities |
|
79 | + public $option_tag_id3v1 = true; // Read and process ID3v1 tags |
|
80 | + public $option_tag_id3v2 = true; // Read and process ID3v2 tags |
|
81 | + public $option_tag_lyrics3 = true; // Read and process Lyrics3 tags |
|
82 | + public $option_tag_apetag = true; // Read and process APE tags |
|
83 | + public $option_tags_process = true; // Copy tags to root key 'tags' and encode to $this->encoding |
|
84 | + public $option_tags_html = true; // Copy tags to root key 'tags_html' properly translated from various encodings to HTML entities |
|
85 | 85 | |
86 | 86 | // public: Optional tag/comment calucations |
87 | - public $option_extra_info = true; // Calculate additional info such as bitrate, channelmode etc |
|
87 | + public $option_extra_info = true; // Calculate additional info such as bitrate, channelmode etc |
|
88 | 88 | |
89 | 89 | // public: Optional handling of embedded attachments (e.g. images) |
90 | 90 | public $option_save_attachments = true; // defaults to true (ATTACHMENTS_INLINE) for backward compatibility |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | public $option_md5_data = false; // Get MD5 sum of data part - slow |
94 | 94 | public $option_md5_data_source = false; // Use MD5 of source file if availble - only FLAC and OptimFROG |
95 | 95 | public $option_sha1_data = false; // Get SHA1 sum of data part - slow |
96 | - public $option_max_2gb_check = null; // Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on PHP_INT_MAX) |
|
96 | + public $option_max_2gb_check = null; // Check whether file is larger than 2GB and thus not supported by 32-bit PHP (null: auto-detect based on PHP_INT_MAX) |
|
97 | 97 | |
98 | 98 | // public: Read buffer size in bytes |
99 | 99 | public $option_fread_buffer_size = 32768; |
100 | 100 | |
101 | 101 | // Public variables |
102 | - public $filename; // Filename of file being analysed. |
|
103 | - public $fp; // Filepointer to file being analysed. |
|
104 | - public $info; // Result array. |
|
102 | + public $filename; // Filename of file being analysed. |
|
103 | + public $fp; // Filepointer to file being analysed. |
|
104 | + public $info; // Result array. |
|
105 | 105 | public $tempdir = GETID3_TEMP_DIR; |
106 | 106 | public $memory_limit = 0; |
107 | 107 | |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | |
161 | 161 | // Load support library |
162 | - if (!include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { |
|
162 | + if ( ! include_once(GETID3_INCLUDEPATH.'getid3.lib.php')) { |
|
163 | 163 | $this->startup_error .= 'getid3.lib.php is missing or corrupt'; |
164 | 164 | } |
165 | 165 | |
@@ -174,18 +174,18 @@ discard block |
||
174 | 174 | // This path cannot contain spaces, but the below code will attempt to get the |
175 | 175 | // 8.3-equivalent path automatically |
176 | 176 | // IMPORTANT: This path must include the trailing slash |
177 | - if (GETID3_OS_ISWINDOWS && !defined('GETID3_HELPERAPPSDIR')) { |
|
177 | + if (GETID3_OS_ISWINDOWS && ! defined('GETID3_HELPERAPPSDIR')) { |
|
178 | 178 | |
179 | 179 | $helperappsdir = GETID3_INCLUDEPATH.'..'.DIRECTORY_SEPARATOR.'helperapps'; // must not have any space in this path |
180 | 180 | |
181 | - if (!is_dir($helperappsdir)) { |
|
181 | + if ( ! is_dir($helperappsdir)) { |
|
182 | 182 | $this->startup_warning .= '"'.$helperappsdir.'" cannot be defined as GETID3_HELPERAPPSDIR because it does not exist'; |
183 | 183 | } elseif (strpos(realpath($helperappsdir), ' ') !== false) { |
184 | 184 | $DirPieces = explode(DIRECTORY_SEPARATOR, realpath($helperappsdir)); |
185 | 185 | $path_so_far = array(); |
186 | 186 | foreach ($DirPieces as $key => $value) { |
187 | 187 | if (strpos($value, ' ') !== false) { |
188 | - if (!empty($path_so_far)) { |
|
188 | + if ( ! empty($path_so_far)) { |
|
189 | 189 | $commandline = 'dir /x '.escapeshellarg(implode(DIRECTORY_SEPARATOR, $path_so_far)); |
190 | 190 | $dir_listing = `$commandline`; |
191 | 191 | $lines = explode("\n", $dir_listing); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | // public: setOption |
225 | 225 | public function setOption($optArray) { |
226 | - if (!is_array($optArray) || empty($optArray)) { |
|
226 | + if ( ! is_array($optArray) || empty($optArray)) { |
|
227 | 227 | return false; |
228 | 228 | } |
229 | 229 | foreach ($optArray as $opt => $val) { |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | |
239 | 239 | public function openfile($filename) { |
240 | 240 | try { |
241 | - if (!empty($this->startup_error)) { |
|
241 | + if ( ! empty($this->startup_error)) { |
|
242 | 242 | throw new getid3_exception($this->startup_error); |
243 | 243 | } |
244 | - if (!empty($this->startup_warning)) { |
|
244 | + if ( ! empty($this->startup_warning)) { |
|
245 | 245 | $this->warning($this->startup_warning); |
246 | 246 | } |
247 | 247 | |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | // great |
266 | 266 | } else { |
267 | 267 | $errormessagelist = array(); |
268 | - if (!is_readable($filename)) { |
|
268 | + if ( ! is_readable($filename)) { |
|
269 | 269 | $errormessagelist[] = '!is_readable'; |
270 | 270 | } |
271 | - if (!is_file($filename)) { |
|
271 | + if ( ! is_file($filename)) { |
|
272 | 272 | $errormessagelist[] = '!is_file'; |
273 | 273 | } |
274 | - if (!file_exists($filename)) { |
|
274 | + if ( ! file_exists($filename)) { |
|
275 | 275 | $errormessagelist[] = '!file_exists'; |
276 | 276 | } |
277 | 277 | if (empty($errormessagelist)) { |
@@ -317,14 +317,14 @@ discard block |
||
317 | 317 | // set more parameters |
318 | 318 | $this->info['avdataoffset'] = 0; |
319 | 319 | $this->info['avdataend'] = $this->info['filesize']; |
320 | - $this->info['fileformat'] = ''; // filled in later |
|
321 | - $this->info['audio']['dataformat'] = ''; // filled in later, unset if not used |
|
322 | - $this->info['video']['dataformat'] = ''; // filled in later, unset if not used |
|
323 | - $this->info['tags'] = array(); // filled in later, unset if not used |
|
324 | - $this->info['error'] = array(); // filled in later, unset if not used |
|
325 | - $this->info['warning'] = array(); // filled in later, unset if not used |
|
326 | - $this->info['comments'] = array(); // filled in later, unset if not used |
|
327 | - $this->info['encoding'] = $this->encoding; // required by id3v2 and iso modules - can be unset at the end if desired |
|
320 | + $this->info['fileformat'] = ''; // filled in later |
|
321 | + $this->info['audio']['dataformat'] = ''; // filled in later, unset if not used |
|
322 | + $this->info['video']['dataformat'] = ''; // filled in later, unset if not used |
|
323 | + $this->info['tags'] = array(); // filled in later, unset if not used |
|
324 | + $this->info['error'] = array(); // filled in later, unset if not used |
|
325 | + $this->info['warning'] = array(); // filled in later, unset if not used |
|
326 | + $this->info['comments'] = array(); // filled in later, unset if not used |
|
327 | + $this->info['encoding'] = $this->encoding; // required by id3v2 and iso modules - can be unset at the end if desired |
|
328 | 328 | |
329 | 329 | return true; |
330 | 330 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | // public: analyze file |
338 | 338 | public function analyze($filename) { |
339 | 339 | try { |
340 | - if (!$this->openfile($filename)) { |
|
340 | + if ( ! $this->openfile($filename)) { |
|
341 | 341 | return $this->info; |
342 | 342 | } |
343 | 343 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | } |
367 | 367 | |
368 | 368 | // ID3v2 detection (NOT parsing), even if ($this->option_tag_id3v2 == false) done to make fileformat easier |
369 | - if (!$this->option_tag_id3v2) { |
|
369 | + if ( ! $this->option_tag_id3v2) { |
|
370 | 370 | fseek($this->fp, 0); |
371 | 371 | $header = fread($this->fp, 10); |
372 | 372 | if ((substr($header, 0, 3) == 'ID3') && (strlen($header) == 10)) { |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | $determined_format = $this->GetFileFormat($formattest, $filename); |
386 | 386 | |
387 | 387 | // unable to determine file format |
388 | - if (!$determined_format) { |
|
388 | + if ( ! $determined_format) { |
|
389 | 389 | fclose($this->fp); |
390 | 390 | return $this->error('unable to determine file format'); |
391 | 391 | } |
@@ -414,14 +414,14 @@ discard block |
||
414 | 414 | $this->info['mime_type'] = $determined_format['mime_type']; |
415 | 415 | |
416 | 416 | // supported format signature pattern detected, but module deleted |
417 | - if (!file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) { |
|
417 | + if ( ! file_exists(GETID3_INCLUDEPATH.$determined_format['include'])) { |
|
418 | 418 | fclose($this->fp); |
419 | 419 | return $this->error('Format not supported, module "'.$determined_format['include'].'" was removed.'); |
420 | 420 | } |
421 | 421 | |
422 | 422 | // module requires iconv support |
423 | 423 | // Check encoding/iconv support |
424 | - if (!empty($determined_format['iconv_req']) && !function_exists('iconv') && !in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) { |
|
424 | + if ( ! empty($determined_format['iconv_req']) && ! function_exists('iconv') && ! in_array($this->encoding, array('ISO-8859-1', 'UTF-8', 'UTF-16LE', 'UTF-16BE', 'UTF-16'))) { |
|
425 | 425 | $errormessage = 'iconv() support is required for this module ('.$determined_format['include'].') for encodings other than ISO-8859-1, UTF-8, UTF-16LE, UTF16-BE, UTF-16. '; |
426 | 426 | if (GETID3_OS_ISWINDOWS) { |
427 | 427 | $errormessage .= 'PHP does not have iconv() support. Please enable php_iconv.dll in php.ini, and copy iconv.dll from c:/php/dlls to c:/windows/system32'; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | |
437 | 437 | // instantiate module class |
438 | 438 | $class_name = 'getid3_'.$determined_format['module']; |
439 | - if (!class_exists($class_name)) { |
|
439 | + if ( ! class_exists($class_name)) { |
|
440 | 440 | return $this->error('Format not supported, module "'.$determined_format['include'].'" is corrupt.'); |
441 | 441 | } |
442 | 442 | $class = new $class_name($this); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | // get the MD5 sum of the audio/video portion of the file - without ID3/APE/Lyrics3/etc header/footer tags |
464 | 464 | if ($this->option_md5_data) { |
465 | 465 | // do not calc md5_data if md5_data_source is present - set by flac only - future MPC/SV8 too |
466 | - if (!$this->option_md5_data_source || empty($this->info['md5_data_source'])) { |
|
466 | + if ( ! $this->option_md5_data_source || empty($this->info['md5_data_source'])) { |
|
467 | 467 | $this->getHashdata('md5'); |
468 | 468 | } |
469 | 469 | } |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | // private: error handling |
489 | 489 | public function error($message) { |
490 | 490 | $this->CleanUp(); |
491 | - if (!isset($this->info['error'])) { |
|
491 | + if ( ! isset($this->info['error'])) { |
|
492 | 492 | $this->info['error'] = array(); |
493 | 493 | } |
494 | 494 | $this->info['error'][] = $message; |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | } |
519 | 519 | |
520 | 520 | // remove empty root keys |
521 | - if (!empty($this->info)) { |
|
521 | + if ( ! empty($this->info)) { |
|
522 | 522 | foreach ($this->info as $key => $value) { |
523 | 523 | if (empty($this->info[$key]) && ($this->info[$key] !== 0) && ($this->info[$key] !== '0')) { |
524 | 524 | unset($this->info[$key]); |
@@ -537,10 +537,10 @@ discard block |
||
537 | 537 | } |
538 | 538 | |
539 | 539 | // remove possible duplicated identical entries |
540 | - if (!empty($this->info['error'])) { |
|
540 | + if ( ! empty($this->info['error'])) { |
|
541 | 541 | $this->info['error'] = array_values(array_unique($this->info['error'])); |
542 | 542 | } |
543 | - if (!empty($this->info['warning'])) { |
|
543 | + if ( ! empty($this->info['warning'])) { |
|
544 | 544 | $this->info['warning'] = array_values(array_unique($this->info['warning'])); |
545 | 545 | } |
546 | 546 | |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | |
765 | 765 | // TTA - audio - TTA Lossless Audio Compressor (http://tta.corecodec.org) |
766 | 766 | 'tta' => array( |
767 | - 'pattern' => '^TTA', // could also be '^TTA(\x01|\x02|\x03|2|1)' |
|
767 | + 'pattern' => '^TTA', // could also be '^TTA(\x01|\x02|\x03|2|1)' |
|
768 | 768 | 'group' => 'audio', |
769 | 769 | 'module' => 'tta', |
770 | 770 | 'mime_type' => 'application/octet-stream', |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | // Misc other formats |
1053 | 1053 | |
1054 | 1054 | // PAR2 - data - Parity Volume Set Specification 2.0 |
1055 | - 'par2' => array ( |
|
1055 | + 'par2' => array( |
|
1056 | 1056 | 'pattern' => '^PAR2\x00PKT', |
1057 | 1057 | 'group' => 'misc', |
1058 | 1058 | 'module' => 'par2', |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | |
1098 | 1098 | |
1099 | 1099 | |
1100 | - public function GetFileFormat(&$filedata, $filename='') { |
|
1100 | + public function GetFileFormat(&$filedata, $filename = '') { |
|
1101 | 1101 | // this function will determine the format of a file based on usually |
1102 | 1102 | // the first 2-4 bytes of the file (8 bytes for PNG, 16 bytes for JPG, |
1103 | 1103 | // and in the case of ISO CD image, 6 bytes offset 32kb from the start |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | foreach ($this->GetFileFormatArray() as $format_name => $info) { |
1108 | 1108 | // The /s switch on preg_match() forces preg_match() NOT to treat |
1109 | 1109 | // newline (0x0A) characters as special chars but do a binary match |
1110 | - if (!empty($info['pattern']) && preg_match('#'.$info['pattern'].'#s', $filedata)) { |
|
1110 | + if ( ! empty($info['pattern']) && preg_match('#'.$info['pattern'].'#s', $filedata)) { |
|
1111 | 1111 | $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; |
1112 | 1112 | return $info; |
1113 | 1113 | } |
@@ -1127,7 +1127,7 @@ discard block |
||
1127 | 1127 | // and verify there's at least one instance of "TRACK xx AUDIO" in the file |
1128 | 1128 | $GetFileFormatArray = $this->GetFileFormatArray(); |
1129 | 1129 | $info = $GetFileFormatArray['cue']; |
1130 | - $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; |
|
1130 | + $info['include'] = 'module.'.$info['group'].'.'.$info['module'].'.php'; |
|
1131 | 1131 | return $info; |
1132 | 1132 | } |
1133 | 1133 | |
@@ -1165,26 +1165,26 @@ discard block |
||
1165 | 1165 | static $tags; |
1166 | 1166 | if (empty($tags)) { |
1167 | 1167 | $tags = array( |
1168 | - 'asf' => array('asf' , 'UTF-16LE'), |
|
1169 | - 'midi' => array('midi' , 'ISO-8859-1'), |
|
1170 | - 'nsv' => array('nsv' , 'ISO-8859-1'), |
|
1171 | - 'ogg' => array('vorbiscomment' , 'UTF-8'), |
|
1172 | - 'png' => array('png' , 'UTF-8'), |
|
1173 | - 'tiff' => array('tiff' , 'ISO-8859-1'), |
|
1174 | - 'quicktime' => array('quicktime' , 'UTF-8'), |
|
1175 | - 'real' => array('real' , 'ISO-8859-1'), |
|
1176 | - 'vqf' => array('vqf' , 'ISO-8859-1'), |
|
1177 | - 'zip' => array('zip' , 'ISO-8859-1'), |
|
1178 | - 'riff' => array('riff' , 'ISO-8859-1'), |
|
1179 | - 'lyrics3' => array('lyrics3' , 'ISO-8859-1'), |
|
1180 | - 'id3v1' => array('id3v1' , $this->encoding_id3v1), |
|
1181 | - 'id3v2' => array('id3v2' , 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8 |
|
1182 | - 'ape' => array('ape' , 'UTF-8'), |
|
1183 | - 'cue' => array('cue' , 'ISO-8859-1'), |
|
1184 | - 'matroska' => array('matroska' , 'UTF-8'), |
|
1185 | - 'flac' => array('vorbiscomment' , 'UTF-8'), |
|
1186 | - 'divxtag' => array('divx' , 'ISO-8859-1'), |
|
1187 | - 'iptc' => array('iptc' , 'ISO-8859-1'), |
|
1168 | + 'asf' => array('asf', 'UTF-16LE'), |
|
1169 | + 'midi' => array('midi', 'ISO-8859-1'), |
|
1170 | + 'nsv' => array('nsv', 'ISO-8859-1'), |
|
1171 | + 'ogg' => array('vorbiscomment', 'UTF-8'), |
|
1172 | + 'png' => array('png', 'UTF-8'), |
|
1173 | + 'tiff' => array('tiff', 'ISO-8859-1'), |
|
1174 | + 'quicktime' => array('quicktime', 'UTF-8'), |
|
1175 | + 'real' => array('real', 'ISO-8859-1'), |
|
1176 | + 'vqf' => array('vqf', 'ISO-8859-1'), |
|
1177 | + 'zip' => array('zip', 'ISO-8859-1'), |
|
1178 | + 'riff' => array('riff', 'ISO-8859-1'), |
|
1179 | + 'lyrics3' => array('lyrics3', 'ISO-8859-1'), |
|
1180 | + 'id3v1' => array('id3v1', $this->encoding_id3v1), |
|
1181 | + 'id3v2' => array('id3v2', 'UTF-8'), // not according to the specs (every frame can have a different encoding), but getID3() force-converts all encodings to UTF-8 |
|
1182 | + 'ape' => array('ape', 'UTF-8'), |
|
1183 | + 'cue' => array('cue', 'ISO-8859-1'), |
|
1184 | + 'matroska' => array('matroska', 'UTF-8'), |
|
1185 | + 'flac' => array('vorbiscomment', 'UTF-8'), |
|
1186 | + 'divxtag' => array('divx', 'ISO-8859-1'), |
|
1187 | + 'iptc' => array('iptc', 'ISO-8859-1'), |
|
1188 | 1188 | ); |
1189 | 1189 | } |
1190 | 1190 | |
@@ -1193,19 +1193,19 @@ discard block |
||
1193 | 1193 | list($tag_name, $encoding) = $tagname_encoding_array; |
1194 | 1194 | |
1195 | 1195 | // fill in default encoding type if not already present |
1196 | - if (isset($this->info[$comment_name]) && !isset($this->info[$comment_name]['encoding'])) { |
|
1196 | + if (isset($this->info[$comment_name]) && ! isset($this->info[$comment_name]['encoding'])) { |
|
1197 | 1197 | $this->info[$comment_name]['encoding'] = $encoding; |
1198 | 1198 | } |
1199 | 1199 | |
1200 | 1200 | // copy comments if key name set |
1201 | - if (!empty($this->info[$comment_name]['comments'])) { |
|
1201 | + if ( ! empty($this->info[$comment_name]['comments'])) { |
|
1202 | 1202 | foreach ($this->info[$comment_name]['comments'] as $tag_key => $valuearray) { |
1203 | 1203 | foreach ($valuearray as $key => $value) { |
1204 | 1204 | if (is_string($value)) { |
1205 | 1205 | $value = trim($value, " \r\n\t"); // do not trim nulls from $value!! Unicode characters will get mangled if trailing nulls are removed! |
1206 | 1206 | } |
1207 | 1207 | if ($value) { |
1208 | - if (!is_numeric($key)) { |
|
1208 | + if ( ! is_numeric($key)) { |
|
1209 | 1209 | $this->info['tags'][trim($tag_name)][trim($tag_key)][$key] = $value; |
1210 | 1210 | } else { |
1211 | 1211 | $this->info['tags'][trim($tag_name)][trim($tag_key)][] = $value; |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | } |
1219 | 1219 | |
1220 | - if (!isset($this->info['tags'][$tag_name])) { |
|
1220 | + if ( ! isset($this->info['tags'][$tag_name])) { |
|
1221 | 1221 | // comments are set but contain nothing but empty strings, so skip |
1222 | 1222 | continue; |
1223 | 1223 | } |
@@ -1228,14 +1228,14 @@ discard block |
||
1228 | 1228 | } |
1229 | 1229 | } |
1230 | 1230 | |
1231 | - $this->CharConvert($this->info['tags'][$tag_name], $encoding); // only copy gets converted! |
|
1231 | + $this->CharConvert($this->info['tags'][$tag_name], $encoding); // only copy gets converted! |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | } |
1235 | 1235 | |
1236 | 1236 | // pictures can take up a lot of space, and we don't need multiple copies of them |
1237 | 1237 | // let there be a single copy in [comments][picture], and not elsewhere |
1238 | - if (!empty($this->info['tags'])) { |
|
1238 | + if ( ! empty($this->info['tags'])) { |
|
1239 | 1239 | $unset_keys = array('tags', 'tags_html'); |
1240 | 1240 | foreach ($this->info['tags'] as $tagtype => $tagarray) { |
1241 | 1241 | foreach ($tagarray as $tagname => $tagdata) { |
@@ -1291,7 +1291,7 @@ discard block |
||
1291 | 1291 | break; |
1292 | 1292 | } |
1293 | 1293 | |
1294 | - if (!empty($this->info['fileformat']) && !empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) { |
|
1294 | + if ( ! empty($this->info['fileformat']) && ! empty($this->info['dataformat']) && ($this->info['fileformat'] == 'ogg') && ($this->info['audio']['dataformat'] == 'vorbis')) { |
|
1295 | 1295 | |
1296 | 1296 | // We cannot get an identical md5_data value for Ogg files where the comments |
1297 | 1297 | // span more than 1 Ogg page (compared to the same audio data with smaller |
@@ -1350,7 +1350,7 @@ discard block |
||
1350 | 1350 | |
1351 | 1351 | } |
1352 | 1352 | |
1353 | - if (!empty($VorbisCommentError)) { |
|
1353 | + if ( ! empty($VorbisCommentError)) { |
|
1354 | 1354 | |
1355 | 1355 | $this->info['warning'][] = 'Failed making system call to vorbiscomment(.exe) - '.$algorithm.'_data will be incorrect. If vorbiscomment is unavailable, please download from http://www.vorbis.com/download.psp and put in the getID3() directory. Error returned: '.$VorbisCommentError; |
1356 | 1356 | $this->info[$algorithm.'_data'] = false; |
@@ -1380,7 +1380,7 @@ discard block |
||
1380 | 1380 | |
1381 | 1381 | } else { |
1382 | 1382 | |
1383 | - if (!empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) { |
|
1383 | + if ( ! empty($this->info['avdataoffset']) || (isset($this->info['avdataend']) && ($this->info['avdataend'] < $this->info['filesize']))) { |
|
1384 | 1384 | |
1385 | 1385 | // get hash from part of file |
1386 | 1386 | $this->info[$algorithm.'_data'] = getid3_lib::hash_data($this->info['filenamepath'], $this->info['avdataoffset'], $this->info['avdataend'], $algorithm); |
@@ -1407,7 +1407,7 @@ discard block |
||
1407 | 1407 | public function ChannelsBitratePlaytimeCalculations() { |
1408 | 1408 | |
1409 | 1409 | // set channelmode on audio |
1410 | - if (!empty($this->info['audio']['channelmode']) || !isset($this->info['audio']['channels'])) { |
|
1410 | + if ( ! empty($this->info['audio']['channelmode']) || ! isset($this->info['audio']['channels'])) { |
|
1411 | 1411 | // ignore |
1412 | 1412 | } elseif ($this->info['audio']['channels'] == 1) { |
1413 | 1413 | $this->info['audio']['channelmode'] = 'mono'; |
@@ -1429,7 +1429,7 @@ discard block |
||
1429 | 1429 | //} |
1430 | 1430 | |
1431 | 1431 | // video bitrate undetermined, but calculable |
1432 | - if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && (!isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) { |
|
1432 | + if (isset($this->info['video']['dataformat']) && $this->info['video']['dataformat'] && ( ! isset($this->info['video']['bitrate']) || ($this->info['video']['bitrate'] == 0))) { |
|
1433 | 1433 | // if video bitrate not set |
1434 | 1434 | if (isset($this->info['audio']['bitrate']) && ($this->info['audio']['bitrate'] > 0) && ($this->info['audio']['bitrate'] == $this->info['bitrate'])) { |
1435 | 1435 | // AND if audio bitrate is set to same as overall bitrate |
@@ -1445,11 +1445,11 @@ discard block |
||
1445 | 1445 | } |
1446 | 1446 | } |
1447 | 1447 | |
1448 | - if ((!isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && !empty($this->info['bitrate'])) { |
|
1448 | + if (( ! isset($this->info['playtime_seconds']) || ($this->info['playtime_seconds'] <= 0)) && ! empty($this->info['bitrate'])) { |
|
1449 | 1449 | $this->info['playtime_seconds'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['bitrate']; |
1450 | 1450 | } |
1451 | 1451 | |
1452 | - if (!isset($this->info['bitrate']) && !empty($this->info['playtime_seconds'])) { |
|
1452 | + if ( ! isset($this->info['bitrate']) && ! empty($this->info['playtime_seconds'])) { |
|
1453 | 1453 | $this->info['bitrate'] = (($this->info['avdataend'] - $this->info['avdataoffset']) * 8) / $this->info['playtime_seconds']; |
1454 | 1454 | } |
1455 | 1455 | if (isset($this->info['bitrate']) && empty($this->info['audio']['bitrate']) && empty($this->info['video']['bitrate'])) { |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | } |
1464 | 1464 | |
1465 | 1465 | // Set playtime string |
1466 | - if (!empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) { |
|
1466 | + if ( ! empty($this->info['playtime_seconds']) && empty($this->info['playtime_string'])) { |
|
1467 | 1467 | $this->info['playtime_string'] = getid3_lib::PlaytimeString($this->info['playtime_seconds']); |
1468 | 1468 | } |
1469 | 1469 | } |
@@ -1493,17 +1493,17 @@ discard block |
||
1493 | 1493 | break; |
1494 | 1494 | |
1495 | 1495 | default: |
1496 | - if (!empty($this->info['video']['frame_rate'])) { |
|
1496 | + if ( ! empty($this->info['video']['frame_rate'])) { |
|
1497 | 1497 | $FrameRate = $this->info['video']['frame_rate']; |
1498 | 1498 | } else { |
1499 | 1499 | return false; |
1500 | 1500 | } |
1501 | - if (!empty($this->info['playtime_seconds'])) { |
|
1501 | + if ( ! empty($this->info['playtime_seconds'])) { |
|
1502 | 1502 | $PlaytimeSeconds = $this->info['playtime_seconds']; |
1503 | 1503 | } else { |
1504 | 1504 | return false; |
1505 | 1505 | } |
1506 | - if (!empty($this->info['video']['bitrate'])) { |
|
1506 | + if ( ! empty($this->info['video']['bitrate'])) { |
|
1507 | 1507 | $BitrateCompressed = $this->info['video']['bitrate']; |
1508 | 1508 | } else { |
1509 | 1509 | return false; |
@@ -1518,15 +1518,15 @@ discard block |
||
1518 | 1518 | |
1519 | 1519 | |
1520 | 1520 | public function CalculateCompressionRatioAudio() { |
1521 | - if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || !is_numeric($this->info['audio']['sample_rate'])) { |
|
1521 | + if (empty($this->info['audio']['bitrate']) || empty($this->info['audio']['channels']) || empty($this->info['audio']['sample_rate']) || ! is_numeric($this->info['audio']['sample_rate'])) { |
|
1522 | 1522 | return false; |
1523 | 1523 | } |
1524 | - $this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * (!empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16)); |
|
1524 | + $this->info['audio']['compression_ratio'] = $this->info['audio']['bitrate'] / ($this->info['audio']['channels'] * $this->info['audio']['sample_rate'] * ( ! empty($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : 16)); |
|
1525 | 1525 | |
1526 | - if (!empty($this->info['audio']['streams'])) { |
|
1526 | + if ( ! empty($this->info['audio']['streams'])) { |
|
1527 | 1527 | foreach ($this->info['audio']['streams'] as $streamnumber => $streamdata) { |
1528 | - if (!empty($streamdata['bitrate']) && !empty($streamdata['channels']) && !empty($streamdata['sample_rate'])) { |
|
1529 | - $this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * (!empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16)); |
|
1528 | + if ( ! empty($streamdata['bitrate']) && ! empty($streamdata['channels']) && ! empty($streamdata['sample_rate'])) { |
|
1529 | + $this->info['audio']['streams'][$streamnumber]['compression_ratio'] = $streamdata['bitrate'] / ($streamdata['channels'] * $streamdata['sample_rate'] * ( ! empty($streamdata['bits_per_sample']) ? $streamdata['bits_per_sample'] : 16)); |
|
1530 | 1530 | } |
1531 | 1531 | } |
1532 | 1532 | } |
@@ -1536,7 +1536,7 @@ discard block |
||
1536 | 1536 | |
1537 | 1537 | public function CalculateReplayGain() { |
1538 | 1538 | if (isset($this->info['replay_gain'])) { |
1539 | - if (!isset($this->info['replay_gain']['reference_volume'])) { |
|
1539 | + if ( ! isset($this->info['replay_gain']['reference_volume'])) { |
|
1540 | 1540 | $this->info['replay_gain']['reference_volume'] = (double) 89.0; |
1541 | 1541 | } |
1542 | 1542 | if (isset($this->info['replay_gain']['track']['adjustment'])) { |
@@ -1557,8 +1557,8 @@ discard block |
||
1557 | 1557 | } |
1558 | 1558 | |
1559 | 1559 | public function ProcessAudioStreams() { |
1560 | - if (!empty($this->info['audio']['bitrate']) || !empty($this->info['audio']['channels']) || !empty($this->info['audio']['sample_rate'])) { |
|
1561 | - if (!isset($this->info['audio']['streams'])) { |
|
1560 | + if ( ! empty($this->info['audio']['bitrate']) || ! empty($this->info['audio']['channels']) || ! empty($this->info['audio']['sample_rate'])) { |
|
1561 | + if ( ! isset($this->info['audio']['streams'])) { |
|
1562 | 1562 | foreach ($this->info['audio'] as $key => $value) { |
1563 | 1563 | if ($key != 'streams') { |
1564 | 1564 | $this->info['audio']['streams'][0][$key] = $value; |
@@ -1575,7 +1575,7 @@ discard block |
||
1575 | 1575 | |
1576 | 1576 | public function include_module($name) { |
1577 | 1577 | //if (!file_exists($this->include_path.'module.'.$name.'.php')) { |
1578 | - if (!file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) { |
|
1578 | + if ( ! file_exists(GETID3_INCLUDEPATH.'module.'.$name.'.php')) { |
|
1579 | 1579 | throw new getid3_exception('Required module.'.$name.'.php is missing.'); |
1580 | 1580 | } |
1581 | 1581 | include_once(GETID3_INCLUDEPATH.'module.'.$name.'.php'); |
@@ -1590,17 +1590,17 @@ discard block |
||
1590 | 1590 | /** |
1591 | 1591 | * @var getID3 |
1592 | 1592 | */ |
1593 | - protected $getid3; // pointer |
|
1593 | + protected $getid3; // pointer |
|
1594 | 1594 | |
1595 | 1595 | protected $data_string_flag = false; // analyzing filepointer or string |
1596 | - protected $data_string = ''; // string to analyze |
|
1597 | - protected $data_string_position = 0; // seek position in string |
|
1598 | - protected $data_string_length = 0; // string length |
|
1596 | + protected $data_string = ''; // string to analyze |
|
1597 | + protected $data_string_position = 0; // seek position in string |
|
1598 | + protected $data_string_length = 0; // string length |
|
1599 | 1599 | |
1600 | 1600 | private $dependency_to = null; |
1601 | 1601 | |
1602 | 1602 | |
1603 | - public function __construct(getID3 $getid3, $call_module=null) { |
|
1603 | + public function __construct(getID3 $getid3, $call_module = null) { |
|
1604 | 1604 | $this->getid3 = $getid3; |
1605 | 1605 | |
1606 | 1606 | if ($call_module) { |
@@ -1658,13 +1658,13 @@ discard block |
||
1658 | 1658 | return substr($this->data_string, $this->data_string_position - $bytes, $bytes); |
1659 | 1659 | } |
1660 | 1660 | $pos = $this->ftell() + $bytes; |
1661 | - if (!getid3_lib::intValueSupported($pos)) { |
|
1661 | + if ( ! getid3_lib::intValueSupported($pos)) { |
|
1662 | 1662 | throw new getid3_exception('cannot fread('.$bytes.' from '.$this->ftell().') because beyond PHP filesystem limit', 10); |
1663 | 1663 | } |
1664 | 1664 | return fread($this->getid3->fp, $bytes); |
1665 | 1665 | } |
1666 | 1666 | |
1667 | - protected function fseek($bytes, $whence=SEEK_SET) { |
|
1667 | + protected function fseek($bytes, $whence = SEEK_SET) { |
|
1668 | 1668 | if ($this->data_string_flag) { |
1669 | 1669 | switch ($whence) { |
1670 | 1670 | case SEEK_SET: |
@@ -1687,7 +1687,7 @@ discard block |
||
1687 | 1687 | } elseif ($whence == SEEK_END) { |
1688 | 1688 | $pos = $this->getid3->info['filesize'] + $bytes; |
1689 | 1689 | } |
1690 | - if (!getid3_lib::intValueSupported($pos)) { |
|
1690 | + if ( ! getid3_lib::intValueSupported($pos)) { |
|
1691 | 1691 | throw new getid3_exception('cannot fseek('.$pos.') because beyond PHP filesystem limit', 10); |
1692 | 1692 | } |
1693 | 1693 | } |
@@ -1719,7 +1719,7 @@ discard block |
||
1719 | 1719 | // does nothing for now |
1720 | 1720 | } |
1721 | 1721 | |
1722 | - public function saveAttachment($name, $offset, $length, $image_mime=null) { |
|
1722 | + public function saveAttachment($name, $offset, $length, $image_mime = null) { |
|
1723 | 1723 | try { |
1724 | 1724 | |
1725 | 1725 | // do not extract at all |
@@ -1741,7 +1741,7 @@ discard block |
||
1741 | 1741 | |
1742 | 1742 | // set up destination path |
1743 | 1743 | $dir = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->getid3->option_save_attachments), DIRECTORY_SEPARATOR); |
1744 | - if (!is_dir($dir) || !is_writable($dir)) { // check supplied directory |
|
1744 | + if ( ! is_dir($dir) || ! is_writable($dir)) { // check supplied directory |
|
1745 | 1745 | throw new Exception('supplied path ('.$dir.') does not exist, or is not writable'); |
1746 | 1746 | } |
1747 | 1747 | $dest = $dir.DIRECTORY_SEPARATOR.$name.($image_mime ? '.'.getid3_lib::ImageExtFromMime($image_mime) : ''); |
@@ -350,8 +350,7 @@ |
||
350 | 350 | $tag_class = 'getid3_'.$tag_name; |
351 | 351 | $tag = new $tag_class($this); |
352 | 352 | $tag->Analyze(); |
353 | - } |
|
354 | - catch (getid3_exception $e) { |
|
353 | + } catch (getid3_exception $e) { |
|
355 | 354 | throw $e; |
356 | 355 | } |
357 | 356 | } |
@@ -1684,6 +1684,10 @@ |
||
1684 | 1684 | return (isset($lookup[$WMpictureType]) ? $lookup[$WMpictureType] : ''); |
1685 | 1685 | } |
1686 | 1686 | |
1687 | + /** |
|
1688 | + * @param string $asf_header_extension_object_data |
|
1689 | + * @param integer $unhandled_sections |
|
1690 | + */ |
|
1687 | 1691 | public function HeaderExtensionObjectDataParse(&$asf_header_extension_object_data, &$unhandled_sections) { |
1688 | 1692 | // http://msdn.microsoft.com/en-us/library/bb643323.aspx |
1689 | 1693 |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | class getid3_asf extends getid3_handler { |
20 | 20 | |
21 | 21 | public function __construct(getID3 $getid3) { |
22 | - parent::__construct($getid3); // extends getid3_handler::__construct() |
|
22 | + parent::__construct($getid3); // extends getid3_handler::__construct() |
|
23 | 23 | |
24 | 24 | // initialize all GUID constants |
25 | 25 | $GUIDarray = $this->KnownGUIDs(); |
26 | 26 | foreach ($GUIDarray as $GUIDname => $hexstringvalue) { |
27 | - if (!defined($GUIDname)) { |
|
27 | + if ( ! defined($GUIDname)) { |
|
28 | 28 | define($GUIDname, $this->GUIDtoBytestring($hexstringvalue)); |
29 | 29 | } |
30 | 30 | } |
@@ -220,8 +220,8 @@ discard block |
||
220 | 220 | switch ($StreamPropertiesObjectData['stream_type']) { |
221 | 221 | |
222 | 222 | case GETID3_ASF_Audio_Media: |
223 | - $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); |
|
224 | - $thisfile_audio['bitrate_mode'] = (!empty($thisfile_audio['bitrate_mode']) ? $thisfile_audio['bitrate_mode'] : 'cbr'); |
|
223 | + $thisfile_audio['dataformat'] = ( ! empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); |
|
224 | + $thisfile_audio['bitrate_mode'] = ( ! empty($thisfile_audio['bitrate_mode']) ? $thisfile_audio['bitrate_mode'] : 'cbr'); |
|
225 | 225 | |
226 | 226 | $audiodata = getid3_riff::parseWAVEFORMATex(substr($StreamPropertiesObjectData['type_specific_data'], 0, 16)); |
227 | 227 | unset($audiodata['raw']); |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | break; |
230 | 230 | |
231 | 231 | case GETID3_ASF_Video_Media: |
232 | - $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); |
|
233 | - $thisfile_video['bitrate_mode'] = (!empty($thisfile_video['bitrate_mode']) ? $thisfile_video['bitrate_mode'] : 'cbr'); |
|
232 | + $thisfile_video['dataformat'] = ( ! empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); |
|
233 | + $thisfile_video['bitrate_mode'] = ( ! empty($thisfile_video['bitrate_mode']) ? $thisfile_video['bitrate_mode'] : 'cbr'); |
|
234 | 234 | break; |
235 | 235 | |
236 | 236 | case GETID3_ASF_Command_Media: |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | //return false; |
271 | 271 | break; |
272 | 272 | } |
273 | - $thisfile_asf_headerextensionobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); |
|
273 | + $thisfile_asf_headerextensionobject['reserved_2'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 2)); |
|
274 | 274 | $offset += 2; |
275 | 275 | if ($thisfile_asf_headerextensionobject['reserved_2'] != 6) { |
276 | 276 | $info['warning'][] = 'header_extension_object.reserved_2 ('.getid3_lib::PrintHexBytes($thisfile_asf_headerextensionobject['reserved_2']).') does not match expected value of "6"'; |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | $thisfile_asf_headerextensionobject['extension_data_size'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 4)); |
281 | 281 | $offset += 4; |
282 | - $thisfile_asf_headerextensionobject['extension_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']); |
|
282 | + $thisfile_asf_headerextensionobject['extension_data'] = substr($ASFHeaderData, $offset, $thisfile_asf_headerextensionobject['extension_data_size']); |
|
283 | 283 | $unhandled_sections = 0; |
284 | 284 | $thisfile_asf_headerextensionobject['extension_data_parsed'] = $this->HeaderExtensionObjectDataParse($thisfile_asf_headerextensionobject['extension_data'], $unhandled_sections); |
285 | 285 | if ($unhandled_sections === 0) { |
@@ -355,11 +355,11 @@ discard block |
||
355 | 355 | list($AudioCodecBitrate, $AudioCodecFrequency, $AudioCodecChannels) = explode(',', $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['description'])); |
356 | 356 | $thisfile_audio['codec'] = $this->TrimConvert($thisfile_asf_codeclistobject_codecentries_current['name']); |
357 | 357 | |
358 | - if (!isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) { |
|
358 | + if ( ! isset($thisfile_audio['bitrate']) && strstr($AudioCodecBitrate, 'kbps')) { |
|
359 | 359 | $thisfile_audio['bitrate'] = (int) (trim(str_replace('kbps', '', $AudioCodecBitrate)) * 1000); |
360 | 360 | } |
361 | 361 | //if (!isset($thisfile_video['bitrate']) && isset($thisfile_audio['bitrate']) && isset($thisfile_asf['file_properties_object']['max_bitrate']) && ($thisfile_asf_codeclistobject['codec_entries_count'] > 1)) { |
362 | - if (empty($thisfile_video['bitrate']) && !empty($thisfile_audio['bitrate']) && !empty($info['bitrate'])) { |
|
362 | + if (empty($thisfile_video['bitrate']) && ! empty($thisfile_audio['bitrate']) && ! empty($info['bitrate'])) { |
|
363 | 363 | //$thisfile_video['bitrate'] = $thisfile_asf['file_properties_object']['max_bitrate'] - $thisfile_audio['bitrate']; |
364 | 364 | $thisfile_video['bitrate'] = $info['bitrate'] - $thisfile_audio['bitrate']; |
365 | 365 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | break; |
417 | 417 | } |
418 | 418 | |
419 | - if (!isset($thisfile_audio['channels'])) { |
|
419 | + if ( ! isset($thisfile_audio['channels'])) { |
|
420 | 420 | if (strstr($AudioCodecChannels, 'stereo')) { |
421 | 421 | $thisfile_audio['channels'] = 2; |
422 | 422 | } elseif (strstr($AudioCodecChannels, 'mono')) { |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | $thisfile_asf_markerobject['name'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['name_length']); |
534 | 534 | $offset += $thisfile_asf_markerobject['name_length']; |
535 | 535 | for ($MarkersCounter = 0; $MarkersCounter < $thisfile_asf_markerobject['markers_count']; $MarkersCounter++) { |
536 | - $thisfile_asf_markerobject['markers'][$MarkersCounter]['offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); |
|
536 | + $thisfile_asf_markerobject['markers'][$MarkersCounter]['offset'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); |
|
537 | 537 | $offset += 8; |
538 | 538 | $thisfile_asf_markerobject['markers'][$MarkersCounter]['presentation_time'] = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8)); |
539 | 539 | $offset += 8; |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | $offset += 4; |
548 | 548 | $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description'] = substr($ASFHeaderData, $offset, $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']); |
549 | 549 | $offset += $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; |
550 | - $PaddingLength = $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] - 4 - 4 - 4 - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; |
|
550 | + $PaddingLength = $thisfile_asf_markerobject['markers'][$MarkersCounter]['entry_length'] - 4 - 4 - 4 - $thisfile_asf_markerobject['markers'][$MarkersCounter]['marker_description_length']; |
|
551 | 551 | if ($PaddingLength > 0) { |
552 | - $thisfile_asf_markerobject['markers'][$MarkersCounter]['padding'] = substr($ASFHeaderData, $offset, $PaddingLength); |
|
552 | + $thisfile_asf_markerobject['markers'][$MarkersCounter]['padding'] = substr($ASFHeaderData, $offset, $PaddingLength); |
|
553 | 553 | $offset += $PaddingLength; |
554 | 554 | } |
555 | 555 | } |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | |
692 | 692 | $ASFcommentKeysToCopy = array('title'=>'title', 'author'=>'artist', 'copyright'=>'copyright', 'description'=>'comment', 'rating'=>'rating'); |
693 | 693 | foreach ($ASFcommentKeysToCopy as $keytocopyfrom => $keytocopyto) { |
694 | - if (!empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) { |
|
694 | + if ( ! empty($thisfile_asf_contentdescriptionobject[$keytocopyfrom])) { |
|
695 | 695 | $thisfile_asf_comments[$keytocopyto][] = $this->TrimTerm($thisfile_asf_contentdescriptionobject[$keytocopyfrom]); |
696 | 696 | } |
697 | 697 | } |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | |
776 | 776 | case 'wm/albumtitle': |
777 | 777 | case 'album': |
778 | - $thisfile_asf_comments['album'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); |
|
778 | + $thisfile_asf_comments['album'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); |
|
779 | 779 | break; |
780 | 780 | |
781 | 781 | case 'wm/genre': |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | case 'wm/year': |
808 | 808 | case 'year': |
809 | 809 | case 'date': |
810 | - $thisfile_asf_comments['year'] = array( $this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); |
|
810 | + $thisfile_asf_comments['year'] = array($this->TrimTerm($thisfile_asf_extendedcontentdescriptionobject_contentdescriptor_current['value'])); |
|
811 | 811 | break; |
812 | 812 | |
813 | 813 | case 'wm/lyrics': |
@@ -1033,7 +1033,7 @@ discard block |
||
1033 | 1033 | break; |
1034 | 1034 | } |
1035 | 1035 | |
1036 | - if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { |
|
1036 | + if ( ! empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { |
|
1037 | 1037 | foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { |
1038 | 1038 | if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) { |
1039 | 1039 | $thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate']; |
@@ -1042,9 +1042,9 @@ discard block |
||
1042 | 1042 | } |
1043 | 1043 | } |
1044 | 1044 | } else { |
1045 | - if (!empty($thisfile_asf_audiomedia_currentstream['bytes_sec'])) { |
|
1045 | + if ( ! empty($thisfile_asf_audiomedia_currentstream['bytes_sec'])) { |
|
1046 | 1046 | $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bytes_sec'] * 8; |
1047 | - } elseif (!empty($thisfile_asf_audiomedia_currentstream['bitrate'])) { |
|
1047 | + } elseif ( ! empty($thisfile_asf_audiomedia_currentstream['bitrate'])) { |
|
1048 | 1048 | $thisfile_audio['bitrate'] += $thisfile_asf_audiomedia_currentstream['bitrate']; |
1049 | 1049 | } |
1050 | 1050 | } |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | $videomediaoffset += 4; |
1120 | 1120 | $thisfile_asf_videomedia_currentstream['format_data']['codec_data'] = substr($streamdata['type_specific_data'], $videomediaoffset); |
1121 | 1121 | |
1122 | - if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { |
|
1122 | + if ( ! empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { |
|
1123 | 1123 | foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) { |
1124 | 1124 | if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) { |
1125 | 1125 | $thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate']; |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | $thisfile_asf_simpleindexobject['objectid_guid'] = $NextObjectGUIDtext; |
1226 | 1226 | $thisfile_asf_simpleindexobject['objectsize'] = $NextObjectSize; |
1227 | 1227 | |
1228 | - $thisfile_asf_simpleindexobject['fileid'] = substr($SimpleIndexObjectData, $offset, 16); |
|
1228 | + $thisfile_asf_simpleindexobject['fileid'] = substr($SimpleIndexObjectData, $offset, 16); |
|
1229 | 1229 | $offset += 16; |
1230 | 1230 | $thisfile_asf_simpleindexobject['fileid_guid'] = $this->BytestringToGUID($thisfile_asf_simpleindexobject['fileid']); |
1231 | 1231 | $thisfile_asf_simpleindexobject['index_entry_time_interval'] = getid3_lib::LittleEndian2Int(substr($SimpleIndexObjectData, $offset, 8)); |
@@ -1379,8 +1379,7 @@ discard block |
||
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | switch (isset($thisfile_audio['codec']) ? $thisfile_audio['codec'] : '') { |
1382 | - case 'MPEG Layer-3': |
|
1383 | - $thisfile_audio['dataformat'] = 'mp3'; |
|
1382 | + case 'MPEG Layer-3' : $thisfile_audio['dataformat'] = 'mp3'; |
|
1384 | 1383 | break; |
1385 | 1384 | |
1386 | 1385 | default: |
@@ -1401,7 +1400,7 @@ discard block |
||
1401 | 1400 | // AH 2003-10-01 |
1402 | 1401 | $thisfile_audio['encoder_options'] = $this->TrimConvert($thisfile_asf_codeclistobject['codec_entries'][0]['description']); |
1403 | 1402 | |
1404 | - $thisfile_audio['codec'] = $thisfile_audio['encoder']; |
|
1403 | + $thisfile_audio['codec'] = $thisfile_audio['encoder']; |
|
1405 | 1404 | break; |
1406 | 1405 | |
1407 | 1406 | default: |
@@ -1413,15 +1412,15 @@ discard block |
||
1413 | 1412 | } |
1414 | 1413 | |
1415 | 1414 | if (isset($info['audio'])) { |
1416 | - $thisfile_audio['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); |
|
1417 | - $thisfile_audio['dataformat'] = (!empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); |
|
1415 | + $thisfile_audio['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); |
|
1416 | + $thisfile_audio['dataformat'] = ( ! empty($thisfile_audio['dataformat']) ? $thisfile_audio['dataformat'] : 'asf'); |
|
1418 | 1417 | } |
1419 | - if (!empty($thisfile_video['dataformat'])) { |
|
1420 | - $thisfile_video['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); |
|
1418 | + if ( ! empty($thisfile_video['dataformat'])) { |
|
1419 | + $thisfile_video['lossless'] = (isset($thisfile_audio['lossless']) ? $thisfile_audio['lossless'] : false); |
|
1421 | 1420 | $thisfile_video['pixel_aspect_ratio'] = (isset($thisfile_audio['pixel_aspect_ratio']) ? $thisfile_audio['pixel_aspect_ratio'] : (float) 1); |
1422 | - $thisfile_video['dataformat'] = (!empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); |
|
1421 | + $thisfile_video['dataformat'] = ( ! empty($thisfile_video['dataformat']) ? $thisfile_video['dataformat'] : 'asf'); |
|
1423 | 1422 | } |
1424 | - if (!empty($thisfile_video['streams'])) { |
|
1423 | + if ( ! empty($thisfile_video['streams'])) { |
|
1425 | 1424 | $thisfile_video['resolution_x'] = 0; |
1426 | 1425 | $thisfile_video['resolution_y'] = 0; |
1427 | 1426 | foreach ($thisfile_video['streams'] as $key => $valuearray) { |
@@ -1433,7 +1432,7 @@ discard block |
||
1433 | 1432 | } |
1434 | 1433 | $info['bitrate'] = (isset($thisfile_audio['bitrate']) ? $thisfile_audio['bitrate'] : 0) + (isset($thisfile_video['bitrate']) ? $thisfile_video['bitrate'] : 0); |
1435 | 1434 | |
1436 | - if ((!isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) { |
|
1435 | + if (( ! isset($info['playtime_seconds']) || ($info['playtime_seconds'] <= 0)) && ($info['bitrate'] > 0)) { |
|
1437 | 1436 | $info['playtime_seconds'] = ($info['filesize'] - $info['avdataoffset']) / ($info['bitrate'] / 8); |
1438 | 1437 | } |
1439 | 1438 | |
@@ -1593,13 +1592,13 @@ discard block |
||
1593 | 1592 | // AaBbCcDd-EeFf-GgHh-IiJj-KkLlMmNnOoPp is stored as this 16-byte string: |
1594 | 1593 | // $Dd $Cc $Bb $Aa $Ff $Ee $Hh $Gg $Ii $Jj $Kk $Ll $Mm $Nn $Oo $Pp |
1595 | 1594 | |
1596 | - $hexbytecharstring = chr(hexdec(substr($GUIDstring, 6, 2))); |
|
1597 | - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 4, 2))); |
|
1598 | - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 2, 2))); |
|
1599 | - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 0, 2))); |
|
1595 | + $hexbytecharstring = chr(hexdec(substr($GUIDstring, 6, 2))); |
|
1596 | + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 4, 2))); |
|
1597 | + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 2, 2))); |
|
1598 | + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 0, 2))); |
|
1600 | 1599 | |
1601 | 1600 | $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 11, 2))); |
1602 | - $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 9, 2))); |
|
1601 | + $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 9, 2))); |
|
1603 | 1602 | |
1604 | 1603 | $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 16, 2))); |
1605 | 1604 | $hexbytecharstring .= chr(hexdec(substr($GUIDstring, 14, 2))); |
@@ -1618,19 +1617,19 @@ discard block |
||
1618 | 1617 | } |
1619 | 1618 | |
1620 | 1619 | public static function BytestringToGUID($Bytestring) { |
1621 | - $GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT); |
|
1622 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT); |
|
1623 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT); |
|
1624 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT); |
|
1620 | + $GUIDstring = str_pad(dechex(ord($Bytestring{3})), 2, '0', STR_PAD_LEFT); |
|
1621 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{2})), 2, '0', STR_PAD_LEFT); |
|
1622 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{1})), 2, '0', STR_PAD_LEFT); |
|
1623 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{0})), 2, '0', STR_PAD_LEFT); |
|
1625 | 1624 | $GUIDstring .= '-'; |
1626 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT); |
|
1627 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT); |
|
1625 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{5})), 2, '0', STR_PAD_LEFT); |
|
1626 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{4})), 2, '0', STR_PAD_LEFT); |
|
1628 | 1627 | $GUIDstring .= '-'; |
1629 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT); |
|
1630 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT); |
|
1628 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{7})), 2, '0', STR_PAD_LEFT); |
|
1629 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{6})), 2, '0', STR_PAD_LEFT); |
|
1631 | 1630 | $GUIDstring .= '-'; |
1632 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT); |
|
1633 | - $GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT); |
|
1631 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{8})), 2, '0', STR_PAD_LEFT); |
|
1632 | + $GUIDstring .= str_pad(dechex(ord($Bytestring{9})), 2, '0', STR_PAD_LEFT); |
|
1634 | 1633 | $GUIDstring .= '-'; |
1635 | 1634 | $GUIDstring .= str_pad(dechex(ord($Bytestring{10})), 2, '0', STR_PAD_LEFT); |
1636 | 1635 | $GUIDstring .= str_pad(dechex(ord($Bytestring{11})), 2, '0', STR_PAD_LEFT); |
@@ -1642,7 +1641,7 @@ discard block |
||
1642 | 1641 | return strtoupper($GUIDstring); |
1643 | 1642 | } |
1644 | 1643 | |
1645 | - public static function FILETIMEtoUNIXtime($FILETIME, $round=true) { |
|
1644 | + public static function FILETIMEtoUNIXtime($FILETIME, $round = true) { |
|
1646 | 1645 | // FILETIME is a 64-bit unsigned integer representing |
1647 | 1646 | // the number of 100-nanosecond intervals since January 1, 1601 |
1648 | 1647 | // UNIX timestamp is number of seconds since January 1, 1970 |
@@ -1694,12 +1693,12 @@ discard block |
||
1694 | 1693 | $offset = $objectOffset; |
1695 | 1694 | $thisObject = array(); |
1696 | 1695 | |
1697 | - $thisObject['guid'] = substr($asf_header_extension_object_data, $offset, 16); |
|
1696 | + $thisObject['guid'] = substr($asf_header_extension_object_data, $offset, 16); |
|
1698 | 1697 | $offset += 16; |
1699 | 1698 | $thisObject['guid_text'] = $this->BytestringToGUID($thisObject['guid']); |
1700 | 1699 | $thisObject['guid_name'] = $this->GUIDname($thisObject['guid_text']); |
1701 | 1700 | |
1702 | - $thisObject['size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1701 | + $thisObject['size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1703 | 1702 | $offset += 8; |
1704 | 1703 | if ($thisObject['size'] <= 0) { |
1705 | 1704 | break; |
@@ -1707,67 +1706,67 @@ discard block |
||
1707 | 1706 | |
1708 | 1707 | switch ($thisObject['guid']) { |
1709 | 1708 | case GETID3_ASF_Extended_Stream_Properties_Object: |
1710 | - $thisObject['start_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1709 | + $thisObject['start_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1711 | 1710 | $offset += 8; |
1712 | 1711 | $thisObject['start_time_unix'] = $this->FILETIMEtoUNIXtime($thisObject['start_time']); |
1713 | 1712 | |
1714 | - $thisObject['end_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1713 | + $thisObject['end_time'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 8)); |
|
1715 | 1714 | $offset += 8; |
1716 | 1715 | $thisObject['end_time_unix'] = $this->FILETIMEtoUNIXtime($thisObject['end_time']); |
1717 | 1716 | |
1718 | - $thisObject['data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1717 | + $thisObject['data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1719 | 1718 | $offset += 4; |
1720 | 1719 | |
1721 | - $thisObject['buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1720 | + $thisObject['buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1722 | 1721 | $offset += 4; |
1723 | 1722 | |
1724 | - $thisObject['initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1723 | + $thisObject['initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1725 | 1724 | $offset += 4; |
1726 | 1725 | |
1727 | - $thisObject['alternate_data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1726 | + $thisObject['alternate_data_bitrate'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1728 | 1727 | $offset += 4; |
1729 | 1728 | |
1730 | - $thisObject['alternate_buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1729 | + $thisObject['alternate_buffer_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1731 | 1730 | $offset += 4; |
1732 | 1731 | |
1733 | - $thisObject['alternate_initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1732 | + $thisObject['alternate_initial_buffer_fullness'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1734 | 1733 | $offset += 4; |
1735 | 1734 | |
1736 | - $thisObject['maximum_object_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1735 | + $thisObject['maximum_object_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1737 | 1736 | $offset += 4; |
1738 | 1737 | |
1739 | - $thisObject['flags_raw'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1738 | + $thisObject['flags_raw'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1740 | 1739 | $offset += 4; |
1741 | 1740 | $thisObject['flags']['reliable'] = (bool) $thisObject['flags_raw'] & 0x00000001; |
1742 | 1741 | $thisObject['flags']['seekable'] = (bool) $thisObject['flags_raw'] & 0x00000002; |
1743 | 1742 | $thisObject['flags']['no_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000004; |
1744 | 1743 | $thisObject['flags']['resend_live_cleanpoints'] = (bool) $thisObject['flags_raw'] & 0x00000008; |
1745 | 1744 | |
1746 | - $thisObject['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1745 | + $thisObject['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1747 | 1746 | $offset += 2; |
1748 | 1747 | |
1749 | - $thisObject['stream_language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1748 | + $thisObject['stream_language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1750 | 1749 | $offset += 2; |
1751 | 1750 | |
1752 | - $thisObject['average_time_per_frame'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1751 | + $thisObject['average_time_per_frame'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1753 | 1752 | $offset += 4; |
1754 | 1753 | |
1755 | - $thisObject['stream_name_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1754 | + $thisObject['stream_name_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1756 | 1755 | $offset += 2; |
1757 | 1756 | |
1758 | - $thisObject['payload_extension_system_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1757 | + $thisObject['payload_extension_system_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1759 | 1758 | $offset += 2; |
1760 | 1759 | |
1761 | 1760 | for ($i = 0; $i < $thisObject['stream_name_count']; $i++) { |
1762 | 1761 | $streamName = array(); |
1763 | 1762 | |
1764 | - $streamName['language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1763 | + $streamName['language_id_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1765 | 1764 | $offset += 2; |
1766 | 1765 | |
1767 | - $streamName['stream_name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1766 | + $streamName['stream_name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1768 | 1767 | $offset += 2; |
1769 | 1768 | |
1770 | - $streamName['stream_name'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $streamName['stream_name_length'])); |
|
1769 | + $streamName['stream_name'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $streamName['stream_name_length'])); |
|
1771 | 1770 | $offset += $streamName['stream_name_length']; |
1772 | 1771 | |
1773 | 1772 | $thisObject['stream_names'][$i] = $streamName; |
@@ -1776,20 +1775,20 @@ discard block |
||
1776 | 1775 | for ($i = 0; $i < $thisObject['payload_extension_system_count']; $i++) { |
1777 | 1776 | $payloadExtensionSystem = array(); |
1778 | 1777 | |
1779 | - $payloadExtensionSystem['extension_system_id'] = substr($asf_header_extension_object_data, $offset, 16); |
|
1778 | + $payloadExtensionSystem['extension_system_id'] = substr($asf_header_extension_object_data, $offset, 16); |
|
1780 | 1779 | $offset += 16; |
1781 | 1780 | $payloadExtensionSystem['extension_system_id_text'] = $this->BytestringToGUID($payloadExtensionSystem['extension_system_id']); |
1782 | 1781 | |
1783 | - $payloadExtensionSystem['extension_system_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1782 | + $payloadExtensionSystem['extension_system_size'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1784 | 1783 | $offset += 2; |
1785 | 1784 | if ($payloadExtensionSystem['extension_system_size'] <= 0) { |
1786 | 1785 | break 2; |
1787 | 1786 | } |
1788 | 1787 | |
1789 | - $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1788 | + $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1790 | 1789 | $offset += 4; |
1791 | 1790 | |
1792 | - $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $payloadExtensionSystem['extension_system_info_length'])); |
|
1791 | + $payloadExtensionSystem['extension_system_info_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, $payloadExtensionSystem['extension_system_info_length'])); |
|
1793 | 1792 | $offset += $payloadExtensionSystem['extension_system_info_length']; |
1794 | 1793 | |
1795 | 1794 | $thisObject['payload_extension_systems'][$i] = $payloadExtensionSystem; |
@@ -1802,32 +1801,32 @@ discard block |
||
1802 | 1801 | break; |
1803 | 1802 | |
1804 | 1803 | case GETID3_ASF_Metadata_Object: |
1805 | - $thisObject['description_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1804 | + $thisObject['description_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1806 | 1805 | $offset += 2; |
1807 | 1806 | |
1808 | 1807 | for ($i = 0; $i < $thisObject['description_record_counts']; $i++) { |
1809 | 1808 | $descriptionRecord = array(); |
1810 | 1809 | |
1811 | - $descriptionRecord['reserved_1'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); // must be zero |
|
1810 | + $descriptionRecord['reserved_1'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); // must be zero |
|
1812 | 1811 | $offset += 2; |
1813 | 1812 | |
1814 | - $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1813 | + $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1815 | 1814 | $offset += 2; |
1816 | 1815 | |
1817 | - $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1816 | + $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1818 | 1817 | $offset += 2; |
1819 | 1818 | |
1820 | - $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1819 | + $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1821 | 1820 | $offset += 2; |
1822 | 1821 | $descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']); |
1823 | 1822 | |
1824 | - $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1823 | + $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1825 | 1824 | $offset += 4; |
1826 | 1825 | |
1827 | - $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); |
|
1826 | + $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); |
|
1828 | 1827 | $offset += $descriptionRecord['name_length']; |
1829 | 1828 | |
1830 | - $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); |
|
1829 | + $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); |
|
1831 | 1830 | $offset += $descriptionRecord['data_length']; |
1832 | 1831 | switch ($descriptionRecord['data_type']) { |
1833 | 1832 | case 0x0000: // Unicode string |
@@ -1857,16 +1856,16 @@ discard block |
||
1857 | 1856 | break; |
1858 | 1857 | |
1859 | 1858 | case GETID3_ASF_Language_List_Object: |
1860 | - $thisObject['language_id_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1859 | + $thisObject['language_id_record_counts'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1861 | 1860 | $offset += 2; |
1862 | 1861 | |
1863 | 1862 | for ($i = 0; $i < $thisObject['language_id_record_counts']; $i++) { |
1864 | 1863 | $languageIDrecord = array(); |
1865 | 1864 | |
1866 | - $languageIDrecord['language_id_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1)); |
|
1865 | + $languageIDrecord['language_id_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 1)); |
|
1867 | 1866 | $offset += 1; |
1868 | 1867 | |
1869 | - $languageIDrecord['language_id'] = substr($asf_header_extension_object_data, $offset, $languageIDrecord['language_id_length']); |
|
1868 | + $languageIDrecord['language_id'] = substr($asf_header_extension_object_data, $offset, $languageIDrecord['language_id_length']); |
|
1870 | 1869 | $offset += $languageIDrecord['language_id_length']; |
1871 | 1870 | |
1872 | 1871 | $thisObject['language_id_record'][$i] = $languageIDrecord; |
@@ -1874,32 +1873,32 @@ discard block |
||
1874 | 1873 | break; |
1875 | 1874 | |
1876 | 1875 | case GETID3_ASF_Metadata_Library_Object: |
1877 | - $thisObject['description_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1876 | + $thisObject['description_records_count'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1878 | 1877 | $offset += 2; |
1879 | 1878 | |
1880 | 1879 | for ($i = 0; $i < $thisObject['description_records_count']; $i++) { |
1881 | 1880 | $descriptionRecord = array(); |
1882 | 1881 | |
1883 | - $descriptionRecord['language_list_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1882 | + $descriptionRecord['language_list_index'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1884 | 1883 | $offset += 2; |
1885 | 1884 | |
1886 | - $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1885 | + $descriptionRecord['stream_number'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1887 | 1886 | $offset += 2; |
1888 | 1887 | |
1889 | - $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1888 | + $descriptionRecord['name_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1890 | 1889 | $offset += 2; |
1891 | 1890 | |
1892 | - $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1891 | + $descriptionRecord['data_type'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 2)); |
|
1893 | 1892 | $offset += 2; |
1894 | 1893 | $descriptionRecord['data_type_text'] = self::metadataLibraryObjectDataTypeLookup($descriptionRecord['data_type']); |
1895 | 1894 | |
1896 | - $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1895 | + $descriptionRecord['data_length'] = getid3_lib::LittleEndian2Int(substr($asf_header_extension_object_data, $offset, 4)); |
|
1897 | 1896 | $offset += 4; |
1898 | 1897 | |
1899 | - $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); |
|
1898 | + $descriptionRecord['name'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['name_length']); |
|
1900 | 1899 | $offset += $descriptionRecord['name_length']; |
1901 | 1900 | |
1902 | - $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); |
|
1901 | + $descriptionRecord['data'] = substr($asf_header_extension_object_data, $offset, $descriptionRecord['data_length']); |
|
1903 | 1902 | $offset += $descriptionRecord['data_length']; |
1904 | 1903 | |
1905 | 1904 | if (preg_match('#^WM/Picture$#', str_replace("\x00", '', trim($descriptionRecord['name'])))) { |
@@ -1934,12 +1933,12 @@ discard block |
||
1934 | 1933 | public static function metadataLibraryObjectDataTypeLookup($id) { |
1935 | 1934 | static $lookup = array( |
1936 | 1935 | 0x0000 => 'Unicode string', // The data consists of a sequence of Unicode characters |
1937 | - 0x0001 => 'BYTE array', // The type of the data is implementation-specific |
|
1938 | - 0x0002 => 'BOOL', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values |
|
1939 | - 0x0003 => 'DWORD', // The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer |
|
1940 | - 0x0004 => 'QWORD', // The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer |
|
1941 | - 0x0005 => 'WORD', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer |
|
1942 | - 0x0006 => 'GUID', // The data is 16 bytes long and should be interpreted as a 128-bit GUID |
|
1936 | + 0x0001 => 'BYTE array', // The type of the data is implementation-specific |
|
1937 | + 0x0002 => 'BOOL', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer. Only 0x0000 or 0x0001 are permitted values |
|
1938 | + 0x0003 => 'DWORD', // The data is 4 bytes long and should be interpreted as a 32-bit unsigned integer |
|
1939 | + 0x0004 => 'QWORD', // The data is 8 bytes long and should be interpreted as a 64-bit unsigned integer |
|
1940 | + 0x0005 => 'WORD', // The data is 2 bytes long and should be interpreted as a 16-bit unsigned integer |
|
1941 | + 0x0006 => 'GUID', // The data is 16 bytes long and should be interpreted as a 128-bit GUID |
|
1943 | 1942 | ); |
1944 | 1943 | return (isset($lookup[$id]) ? $lookup[$id] : 'invalid'); |
1945 | 1944 | } |
@@ -1983,10 +1982,10 @@ discard block |
||
1983 | 1982 | $WMpicture['image_mime'] = ''; |
1984 | 1983 | $imagechunkcheck = getid3_lib::GetDataImageSize($WMpicture['data'], $imageinfo); |
1985 | 1984 | unset($imageinfo); |
1986 | - if (!empty($imagechunkcheck)) { |
|
1985 | + if ( ! empty($imagechunkcheck)) { |
|
1987 | 1986 | $WMpicture['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]); |
1988 | 1987 | } |
1989 | - if (!isset($this->getid3->info['asf']['comments']['picture'])) { |
|
1988 | + if ( ! isset($this->getid3->info['asf']['comments']['picture'])) { |
|
1990 | 1989 | $this->getid3->info['asf']['comments']['picture'] = array(); |
1991 | 1990 | } |
1992 | 1991 | $this->getid3->info['asf']['comments']['picture'][] = array('data'=>$WMpicture['data'], 'image_mime'=>$WMpicture['image_mime']); |
@@ -390,6 +390,9 @@ discard block |
||
390 | 390 | public $bytes; |
391 | 391 | public $pos; |
392 | 392 | |
393 | + /** |
|
394 | + * @param string $bytes |
|
395 | + */ |
|
393 | 396 | public function __construct(&$bytes) { |
394 | 397 | $this->bytes =& $bytes; |
395 | 398 | $this->pos = 0; |
@@ -473,6 +476,9 @@ discard block |
||
473 | 476 | class AMFReader { |
474 | 477 | public $stream; |
475 | 478 | |
479 | + /** |
|
480 | + * @param AMFStream $stream |
|
481 | + */ |
|
476 | 482 | public function __construct(&$stream) { |
477 | 483 | $this->stream =& $stream; |
478 | 484 | } |
@@ -635,6 +641,9 @@ discard block |
||
635 | 641 | public $width; |
636 | 642 | public $height; |
637 | 643 | |
644 | + /** |
|
645 | + * @param string $sps |
|
646 | + */ |
|
638 | 647 | public function __construct($sps) { |
639 | 648 | $this->sps = $sps; |
640 | 649 | } |
@@ -691,6 +700,9 @@ discard block |
||
691 | 700 | } |
692 | 701 | } |
693 | 702 | |
703 | + /** |
|
704 | + * @param integer $bits |
|
705 | + */ |
|
694 | 706 | public function skipBits($bits) { |
695 | 707 | $newBits = $this->currentBits + $bits; |
696 | 708 | $this->currentBytes += (int)floor($newBits / 8); |
@@ -703,6 +715,9 @@ discard block |
||
703 | 715 | return $result; |
704 | 716 | } |
705 | 717 | |
718 | + /** |
|
719 | + * @param integer $bits |
|
720 | + */ |
|
706 | 721 | public function getBits($bits) { |
707 | 722 | $result = 0; |
708 | 723 | for ($i = 0; $i < $bits; $i++) { |
@@ -52,25 +52,25 @@ discard block |
||
52 | 52 | // /// |
53 | 53 | ///////////////////////////////////////////////////////////////// |
54 | 54 | |
55 | -define('GETID3_FLV_TAG_AUDIO', 8); |
|
56 | -define('GETID3_FLV_TAG_VIDEO', 9); |
|
57 | -define('GETID3_FLV_TAG_META', 18); |
|
55 | +define('GETID3_FLV_TAG_AUDIO', 8); |
|
56 | +define('GETID3_FLV_TAG_VIDEO', 9); |
|
57 | +define('GETID3_FLV_TAG_META', 18); |
|
58 | 58 | |
59 | -define('GETID3_FLV_VIDEO_H263', 2); |
|
60 | -define('GETID3_FLV_VIDEO_SCREEN', 3); |
|
61 | -define('GETID3_FLV_VIDEO_VP6FLV', 4); |
|
59 | +define('GETID3_FLV_VIDEO_H263', 2); |
|
60 | +define('GETID3_FLV_VIDEO_SCREEN', 3); |
|
61 | +define('GETID3_FLV_VIDEO_VP6FLV', 4); |
|
62 | 62 | define('GETID3_FLV_VIDEO_VP6FLV_ALPHA', 5); |
63 | -define('GETID3_FLV_VIDEO_SCREENV2', 6); |
|
64 | -define('GETID3_FLV_VIDEO_H264', 7); |
|
65 | - |
|
66 | -define('H264_AVC_SEQUENCE_HEADER', 0); |
|
67 | -define('H264_PROFILE_BASELINE', 66); |
|
68 | -define('H264_PROFILE_MAIN', 77); |
|
69 | -define('H264_PROFILE_EXTENDED', 88); |
|
70 | -define('H264_PROFILE_HIGH', 100); |
|
71 | -define('H264_PROFILE_HIGH10', 110); |
|
72 | -define('H264_PROFILE_HIGH422', 122); |
|
73 | -define('H264_PROFILE_HIGH444', 144); |
|
63 | +define('GETID3_FLV_VIDEO_SCREENV2', 6); |
|
64 | +define('GETID3_FLV_VIDEO_H264', 7); |
|
65 | + |
|
66 | +define('H264_AVC_SEQUENCE_HEADER', 0); |
|
67 | +define('H264_PROFILE_BASELINE', 66); |
|
68 | +define('H264_PROFILE_MAIN', 77); |
|
69 | +define('H264_PROFILE_EXTENDED', 88); |
|
70 | +define('H264_PROFILE_HIGH', 100); |
|
71 | +define('H264_PROFILE_HIGH10', 110); |
|
72 | +define('H264_PROFILE_HIGH422', 122); |
|
73 | +define('H264_PROFILE_HIGH444', 144); |
|
74 | 74 | define('H264_PROFILE_HIGH444_PREDICTIVE', 244); |
75 | 75 | |
76 | 76 | class getid3_flv extends getid3_handler { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $FLVheader = $this->fread(5); |
89 | 89 | |
90 | 90 | $info['fileformat'] = 'flv'; |
91 | - $info['flv']['header']['signature'] = substr($FLVheader, 0, 3); |
|
91 | + $info['flv']['header']['signature'] = substr($FLVheader, 0, 3); |
|
92 | 92 | $info['flv']['header']['version'] = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1)); |
93 | 93 | $TypeFlags = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1)); |
94 | 94 | |
@@ -114,13 +114,13 @@ discard block |
||
114 | 114 | $tagParseCount = 0; |
115 | 115 | $info['flv']['framecount'] = array('total'=>0, 'audio'=>0, 'video'=>0); |
116 | 116 | $flv_framecount = &$info['flv']['framecount']; |
117 | - while ((($this->ftell() + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || !$found_valid_meta_playtime)) { |
|
117 | + while ((($this->ftell() + 16) < $info['avdataend']) && (($tagParseCount++ <= $this->max_frames) || ! $found_valid_meta_playtime)) { |
|
118 | 118 | $ThisTagHeader = $this->fread(16); |
119 | 119 | |
120 | - $PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 0, 4)); |
|
121 | - $TagType = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 4, 1)); |
|
122 | - $DataLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 5, 3)); |
|
123 | - $Timestamp = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 8, 3)); |
|
120 | + $PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 0, 4)); |
|
121 | + $TagType = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 4, 1)); |
|
122 | + $DataLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 5, 3)); |
|
123 | + $Timestamp = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 8, 3)); |
|
124 | 124 | $LastHeaderByte = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1)); |
125 | 125 | $NextOffset = $this->ftell() - 1 + $DataLength; |
126 | 126 | if ($Timestamp > $Duration) { |
@@ -131,18 +131,18 @@ discard block |
||
131 | 131 | switch ($TagType) { |
132 | 132 | case GETID3_FLV_TAG_AUDIO: |
133 | 133 | $flv_framecount['audio']++; |
134 | - if (!$found_audio) { |
|
134 | + if ( ! $found_audio) { |
|
135 | 135 | $found_audio = true; |
136 | 136 | $info['flv']['audio']['audioFormat'] = ($LastHeaderByte >> 4) & 0x0F; |
137 | 137 | $info['flv']['audio']['audioRate'] = ($LastHeaderByte >> 2) & 0x03; |
138 | 138 | $info['flv']['audio']['audioSampleSize'] = ($LastHeaderByte >> 1) & 0x01; |
139 | - $info['flv']['audio']['audioType'] = $LastHeaderByte & 0x01; |
|
139 | + $info['flv']['audio']['audioType'] = $LastHeaderByte & 0x01; |
|
140 | 140 | } |
141 | 141 | break; |
142 | 142 | |
143 | 143 | case GETID3_FLV_TAG_VIDEO: |
144 | 144 | $flv_framecount['video']++; |
145 | - if (!$found_video) { |
|
145 | + if ( ! $found_video) { |
|
146 | 146 | $found_video = true; |
147 | 147 | $info['flv']['video']['videoCodec'] = $LastHeaderByte & 0x07; |
148 | 148 | |
@@ -154,11 +154,11 @@ discard block |
||
154 | 154 | $AVCPacketType = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 0, 1)); |
155 | 155 | if ($AVCPacketType == H264_AVC_SEQUENCE_HEADER) { |
156 | 156 | // read AVCDecoderConfigurationRecord |
157 | - $configurationVersion = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 1)); |
|
158 | - $AVCProfileIndication = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 1)); |
|
159 | - $profile_compatibility = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 1)); |
|
160 | - $lengthSizeMinusOne = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 1)); |
|
161 | - $numOfSequenceParameterSets = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 8, 1)); |
|
157 | + $configurationVersion = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 4, 1)); |
|
158 | + $AVCProfileIndication = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 1)); |
|
159 | + $profile_compatibility = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 1)); |
|
160 | + $lengthSizeMinusOne = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 1)); |
|
161 | + $numOfSequenceParameterSets = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 8, 1)); |
|
162 | 162 | |
163 | 163 | if (($numOfSequenceParameterSets & 0x1F) != 0) { |
164 | 164 | // there is at least one SequenceParameterSet |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | |
237 | 237 | } |
238 | 238 | |
239 | - } elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_VP6FLV_ALPHA) { |
|
239 | + } elseif ($info['flv']['video']['videoCodec'] == GETID3_FLV_VIDEO_VP6FLV_ALPHA) { |
|
240 | 240 | |
241 | 241 | /* contributed by schouwerwouØgmail*com */ |
242 | - if (!isset($info['video']['resolution_x'])) { // only when meta data isn't set |
|
242 | + if ( ! isset($info['video']['resolution_x'])) { // only when meta data isn't set |
|
243 | 243 | $PictureSizeEnc['x'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2)); |
244 | 244 | $PictureSizeEnc['y'] = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 2)); |
245 | 245 | $info['video']['resolution_x'] = ($PictureSizeEnc['x'] & 0xFF) << 3; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | /* end schouwerwouØgmail*com */ |
249 | 249 | |
250 | 250 | } |
251 | - if (!empty($info['video']['resolution_x']) && !empty($info['video']['resolution_y'])) { |
|
251 | + if ( ! empty($info['video']['resolution_x']) && ! empty($info['video']['resolution_y'])) { |
|
252 | 252 | $info['video']['pixel_aspect_ratio'] = $info['video']['resolution_x'] / $info['video']['resolution_y']; |
253 | 253 | } |
254 | 254 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | // Meta tag |
258 | 258 | case GETID3_FLV_TAG_META: |
259 | - if (!$found_meta) { |
|
259 | + if ( ! $found_meta) { |
|
260 | 260 | $found_meta = true; |
261 | 261 | $this->fseek(-1, SEEK_CUR); |
262 | 262 | $datachunk = $this->fread($DataLength); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | } |
286 | 286 | } |
287 | 287 | } |
288 | - if (!empty($info['flv']['meta']['onMetaData']['duration'])) { |
|
288 | + if ( ! empty($info['flv']['meta']['onMetaData']['duration'])) { |
|
289 | 289 | $found_valid_meta_playtime = true; |
290 | 290 | } |
291 | 291 | } |
@@ -304,22 +304,22 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | if ($info['flv']['header']['hasAudio']) { |
307 | - $info['audio']['codec'] = self::audioFormatLookup($info['flv']['audio']['audioFormat']); |
|
308 | - $info['audio']['sample_rate'] = self::audioRateLookup($info['flv']['audio']['audioRate']); |
|
307 | + $info['audio']['codec'] = self::audioFormatLookup($info['flv']['audio']['audioFormat']); |
|
308 | + $info['audio']['sample_rate'] = self::audioRateLookup($info['flv']['audio']['audioRate']); |
|
309 | 309 | $info['audio']['bits_per_sample'] = self::audioBitDepthLookup($info['flv']['audio']['audioSampleSize']); |
310 | 310 | |
311 | - $info['audio']['channels'] = $info['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo |
|
311 | + $info['audio']['channels'] = $info['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo |
|
312 | 312 | $info['audio']['lossless'] = ($info['flv']['audio']['audioFormat'] ? false : true); // 0=uncompressed |
313 | 313 | $info['audio']['dataformat'] = 'flv'; |
314 | 314 | } |
315 | - if (!empty($info['flv']['header']['hasVideo'])) { |
|
315 | + if ( ! empty($info['flv']['header']['hasVideo'])) { |
|
316 | 316 | $info['video']['codec'] = self::videoCodecLookup($info['flv']['video']['videoCodec']); |
317 | 317 | $info['video']['dataformat'] = 'flv'; |
318 | 318 | $info['video']['lossless'] = false; |
319 | 319 | } |
320 | 320 | |
321 | 321 | // Set information from meta |
322 | - if (!empty($info['flv']['meta']['onMetaData']['duration'])) { |
|
322 | + if ( ! empty($info['flv']['meta']['onMetaData']['duration'])) { |
|
323 | 323 | $info['playtime_seconds'] = $info['flv']['meta']['onMetaData']['duration']; |
324 | 324 | $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; |
325 | 325 | } |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | public $pos; |
392 | 392 | |
393 | 393 | public function __construct(&$bytes) { |
394 | - $this->bytes =& $bytes; |
|
394 | + $this->bytes = & $bytes; |
|
395 | 395 | $this->pos = 0; |
396 | 396 | } |
397 | 397 | |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | public $stream; |
475 | 475 | |
476 | 476 | public function __construct(&$stream) { |
477 | - $this->stream =& $stream; |
|
477 | + $this->stream = & $stream; |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | public function readData() { |
@@ -642,35 +642,35 @@ discard block |
||
642 | 642 | public function readData() { |
643 | 643 | $this->skipBits(8); |
644 | 644 | $this->skipBits(8); |
645 | - $profile = $this->getBits(8); // read profile |
|
645 | + $profile = $this->getBits(8); // read profile |
|
646 | 646 | if ($profile > 0) { |
647 | 647 | $this->skipBits(8); |
648 | - $level_idc = $this->getBits(8); // level_idc |
|
649 | - $this->expGolombUe(); // seq_parameter_set_id // sps |
|
650 | - $this->expGolombUe(); // log2_max_frame_num_minus4 |
|
651 | - $picOrderType = $this->expGolombUe(); // pic_order_cnt_type |
|
648 | + $level_idc = $this->getBits(8); // level_idc |
|
649 | + $this->expGolombUe(); // seq_parameter_set_id // sps |
|
650 | + $this->expGolombUe(); // log2_max_frame_num_minus4 |
|
651 | + $picOrderType = $this->expGolombUe(); // pic_order_cnt_type |
|
652 | 652 | if ($picOrderType == 0) { |
653 | - $this->expGolombUe(); // log2_max_pic_order_cnt_lsb_minus4 |
|
653 | + $this->expGolombUe(); // log2_max_pic_order_cnt_lsb_minus4 |
|
654 | 654 | } elseif ($picOrderType == 1) { |
655 | - $this->skipBits(1); // delta_pic_order_always_zero_flag |
|
656 | - $this->expGolombSe(); // offset_for_non_ref_pic |
|
657 | - $this->expGolombSe(); // offset_for_top_to_bottom_field |
|
655 | + $this->skipBits(1); // delta_pic_order_always_zero_flag |
|
656 | + $this->expGolombSe(); // offset_for_non_ref_pic |
|
657 | + $this->expGolombSe(); // offset_for_top_to_bottom_field |
|
658 | 658 | $num_ref_frames_in_pic_order_cnt_cycle = $this->expGolombUe(); // num_ref_frames_in_pic_order_cnt_cycle |
659 | 659 | for ($i = 0; $i < $num_ref_frames_in_pic_order_cnt_cycle; $i++) { |
660 | - $this->expGolombSe(); // offset_for_ref_frame[ i ] |
|
660 | + $this->expGolombSe(); // offset_for_ref_frame[ i ] |
|
661 | 661 | } |
662 | 662 | } |
663 | - $this->expGolombUe(); // num_ref_frames |
|
664 | - $this->skipBits(1); // gaps_in_frame_num_value_allowed_flag |
|
665 | - $pic_width_in_mbs_minus1 = $this->expGolombUe(); // pic_width_in_mbs_minus1 |
|
663 | + $this->expGolombUe(); // num_ref_frames |
|
664 | + $this->skipBits(1); // gaps_in_frame_num_value_allowed_flag |
|
665 | + $pic_width_in_mbs_minus1 = $this->expGolombUe(); // pic_width_in_mbs_minus1 |
|
666 | 666 | $pic_height_in_map_units_minus1 = $this->expGolombUe(); // pic_height_in_map_units_minus1 |
667 | 667 | |
668 | - $frame_mbs_only_flag = $this->getBits(1); // frame_mbs_only_flag |
|
668 | + $frame_mbs_only_flag = $this->getBits(1); // frame_mbs_only_flag |
|
669 | 669 | if ($frame_mbs_only_flag == 0) { |
670 | - $this->skipBits(1); // mb_adaptive_frame_field_flag |
|
670 | + $this->skipBits(1); // mb_adaptive_frame_field_flag |
|
671 | 671 | } |
672 | - $this->skipBits(1); // direct_8x8_inference_flag |
|
673 | - $frame_cropping_flag = $this->getBits(1); // frame_cropping_flag |
|
672 | + $this->skipBits(1); // direct_8x8_inference_flag |
|
673 | + $frame_cropping_flag = $this->getBits(1); // frame_cropping_flag |
|
674 | 674 | |
675 | 675 | $frame_crop_left_offset = 0; |
676 | 676 | $frame_crop_right_offset = 0; |
@@ -678,12 +678,12 @@ discard block |
||
678 | 678 | $frame_crop_bottom_offset = 0; |
679 | 679 | |
680 | 680 | if ($frame_cropping_flag) { |
681 | - $frame_crop_left_offset = $this->expGolombUe(); // frame_crop_left_offset |
|
682 | - $frame_crop_right_offset = $this->expGolombUe(); // frame_crop_right_offset |
|
683 | - $frame_crop_top_offset = $this->expGolombUe(); // frame_crop_top_offset |
|
684 | - $frame_crop_bottom_offset = $this->expGolombUe(); // frame_crop_bottom_offset |
|
681 | + $frame_crop_left_offset = $this->expGolombUe(); // frame_crop_left_offset |
|
682 | + $frame_crop_right_offset = $this->expGolombUe(); // frame_crop_right_offset |
|
683 | + $frame_crop_top_offset = $this->expGolombUe(); // frame_crop_top_offset |
|
684 | + $frame_crop_bottom_offset = $this->expGolombUe(); // frame_crop_bottom_offset |
|
685 | 685 | } |
686 | - $this->skipBits(1); // vui_parameters_present_flag |
|
686 | + $this->skipBits(1); // vui_parameters_present_flag |
|
687 | 687 | // etc |
688 | 688 | |
689 | 689 | $this->width = (($pic_width_in_mbs_minus1 + 1) * 16) - ($frame_crop_left_offset * 2) - ($frame_crop_right_offset * 2); |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | |
694 | 694 | public function skipBits($bits) { |
695 | 695 | $newBits = $this->currentBits + $bits; |
696 | - $this->currentBytes += (int)floor($newBits / 8); |
|
696 | + $this->currentBytes += (int) floor($newBits / 8); |
|
697 | 697 | $this->currentBits = $newBits % 8; |
698 | 698 | } |
699 | 699 |
@@ -1289,6 +1289,10 @@ discard block |
||
1289 | 1289 | return true; |
1290 | 1290 | } |
1291 | 1291 | |
1292 | + /** |
|
1293 | + * @param string $type |
|
1294 | + * @param integer $line |
|
1295 | + */ |
|
1292 | 1296 | private function unhandledElement($type, $line, $element) { |
1293 | 1297 | // warn only about unknown and missed elements, not about unuseful |
1294 | 1298 | if (!in_array($element['id'], $this->unuseful_elements)) { |
@@ -1345,6 +1349,9 @@ discard block |
||
1345 | 1349 | return $simpletag_entry; |
1346 | 1350 | } |
1347 | 1351 | |
1352 | + /** |
|
1353 | + * @param integer $block_type |
|
1354 | + */ |
|
1348 | 1355 | private function HandleEMBLClusterBlock($element, $block_type, &$info) { |
1349 | 1356 | // http://www.matroska.org/technical/specs/index.html#block_structure |
1350 | 1357 | // http://www.matroska.org/technical/specs/index.html#simpleblock_structure |
@@ -15,196 +15,196 @@ discard block |
||
15 | 15 | ///////////////////////////////////////////////////////////////// |
16 | 16 | |
17 | 17 | |
18 | -define('EBML_ID_CHAPTERS', 0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation. |
|
19 | -define('EBML_ID_SEEKHEAD', 0x014D9B74); // [11][4D][9B][74] -- Contains the position of other level 1 elements. |
|
20 | -define('EBML_ID_TAGS', 0x0254C367); // [12][54][C3][67] -- Element containing elements specific to Tracks/Chapters. A list of valid tags can be found <http://www.matroska.org/technical/specs/tagging/index.html>. |
|
21 | -define('EBML_ID_INFO', 0x0549A966); // [15][49][A9][66] -- Contains miscellaneous general information and statistics on the file. |
|
22 | -define('EBML_ID_TRACKS', 0x0654AE6B); // [16][54][AE][6B] -- A top-level block of information with many tracks described. |
|
23 | -define('EBML_ID_SEGMENT', 0x08538067); // [18][53][80][67] -- This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment. |
|
24 | -define('EBML_ID_ATTACHMENTS', 0x0941A469); // [19][41][A4][69] -- Contain attached files. |
|
25 | -define('EBML_ID_EBML', 0x0A45DFA3); // [1A][45][DF][A3] -- Set the EBML characteristics of the data to follow. Each EBML document has to start with this. |
|
26 | -define('EBML_ID_CUES', 0x0C53BB6B); // [1C][53][BB][6B] -- A top-level element to speed seeking access. All entries are local to the segment. |
|
27 | -define('EBML_ID_CLUSTER', 0x0F43B675); // [1F][43][B6][75] -- The lower level element containing the (monolithic) Block structure. |
|
28 | -define('EBML_ID_LANGUAGE', 0x02B59C); // [22][B5][9C] -- Specifies the language of the track in the Matroska languages form. |
|
29 | -define('EBML_ID_TRACKTIMECODESCALE', 0x03314F); // [23][31][4F] -- The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs). |
|
30 | -define('EBML_ID_DEFAULTDURATION', 0x03E383); // [23][E3][83] -- Number of nanoseconds (i.e. not scaled) per frame. |
|
31 | -define('EBML_ID_CODECNAME', 0x058688); // [25][86][88] -- A human-readable string specifying the codec. |
|
32 | -define('EBML_ID_CODECDOWNLOADURL', 0x06B240); // [26][B2][40] -- A URL to download about the codec used. |
|
33 | -define('EBML_ID_TIMECODESCALE', 0x0AD7B1); // [2A][D7][B1] -- Timecode scale in nanoseconds (1.000.000 means all timecodes in the segment are expressed in milliseconds). |
|
34 | -define('EBML_ID_COLOURSPACE', 0x0EB524); // [2E][B5][24] -- Same value as in AVI (32 bits). |
|
35 | -define('EBML_ID_GAMMAVALUE', 0x0FB523); // [2F][B5][23] -- Gamma Value. |
|
36 | -define('EBML_ID_CODECSETTINGS', 0x1A9697); // [3A][96][97] -- A string describing the encoding setting used. |
|
37 | -define('EBML_ID_CODECINFOURL', 0x1B4040); // [3B][40][40] -- A URL to find information about the codec used. |
|
38 | -define('EBML_ID_PREVFILENAME', 0x1C83AB); // [3C][83][AB] -- An escaped filename corresponding to the previous segment. |
|
39 | -define('EBML_ID_PREVUID', 0x1CB923); // [3C][B9][23] -- A unique ID to identify the previous chained segment (128 bits). |
|
40 | -define('EBML_ID_NEXTFILENAME', 0x1E83BB); // [3E][83][BB] -- An escaped filename corresponding to the next segment. |
|
41 | -define('EBML_ID_NEXTUID', 0x1EB923); // [3E][B9][23] -- A unique ID to identify the next chained segment (128 bits). |
|
42 | -define('EBML_ID_CONTENTCOMPALGO', 0x0254); // [42][54] -- The compression algorithm used. Algorithms that have been specified so far are: |
|
43 | -define('EBML_ID_CONTENTCOMPSETTINGS', 0x0255); // [42][55] -- Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track. |
|
44 | -define('EBML_ID_DOCTYPE', 0x0282); // [42][82] -- A string that describes the type of document that follows this EBML header ('matroska' in our case). |
|
45 | -define('EBML_ID_DOCTYPEREADVERSION', 0x0285); // [42][85] -- The minimum DocType version an interpreter has to support to read this file. |
|
46 | -define('EBML_ID_EBMLVERSION', 0x0286); // [42][86] -- The version of EBML parser used to create the file. |
|
47 | -define('EBML_ID_DOCTYPEVERSION', 0x0287); // [42][87] -- The version of DocType interpreter used to create the file. |
|
48 | -define('EBML_ID_EBMLMAXIDLENGTH', 0x02F2); // [42][F2] -- The maximum length of the IDs you'll find in this file (4 or less in Matroska). |
|
49 | -define('EBML_ID_EBMLMAXSIZELENGTH', 0x02F3); // [42][F3] -- The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid. |
|
50 | -define('EBML_ID_EBMLREADVERSION', 0x02F7); // [42][F7] -- The minimum EBML version a parser has to support to read this file. |
|
51 | -define('EBML_ID_CHAPLANGUAGE', 0x037C); // [43][7C] -- The languages corresponding to the string, in the bibliographic ISO-639-2 form. |
|
52 | -define('EBML_ID_CHAPCOUNTRY', 0x037E); // [43][7E] -- The countries corresponding to the string, same 2 octets as in Internet domains. |
|
53 | -define('EBML_ID_SEGMENTFAMILY', 0x0444); // [44][44] -- A randomly generated unique ID that all segments related to each other must use (128 bits). |
|
54 | -define('EBML_ID_DATEUTC', 0x0461); // [44][61] -- Date of the origin of timecode (value 0), i.e. production date. |
|
55 | -define('EBML_ID_TAGLANGUAGE', 0x047A); // [44][7A] -- Specifies the language of the tag specified, in the Matroska languages form. |
|
56 | -define('EBML_ID_TAGDEFAULT', 0x0484); // [44][84] -- Indication to know if this is the default/original language to use for the given tag. |
|
57 | -define('EBML_ID_TAGBINARY', 0x0485); // [44][85] -- The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString. |
|
58 | -define('EBML_ID_TAGSTRING', 0x0487); // [44][87] -- The value of the Tag. |
|
59 | -define('EBML_ID_DURATION', 0x0489); // [44][89] -- Duration of the segment (based on TimecodeScale). |
|
60 | -define('EBML_ID_CHAPPROCESSPRIVATE', 0x050D); // [45][0D] -- Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent. |
|
61 | -define('EBML_ID_CHAPTERFLAGENABLED', 0x0598); // [45][98] -- Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter. |
|
62 | -define('EBML_ID_TAGNAME', 0x05A3); // [45][A3] -- The name of the Tag that is going to be stored. |
|
63 | -define('EBML_ID_EDITIONENTRY', 0x05B9); // [45][B9] -- Contains all information about a segment edition. |
|
64 | -define('EBML_ID_EDITIONUID', 0x05BC); // [45][BC] -- A unique ID to identify the edition. It's useful for tagging an edition. |
|
65 | -define('EBML_ID_EDITIONFLAGHIDDEN', 0x05BD); // [45][BD] -- If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
66 | -define('EBML_ID_EDITIONFLAGDEFAULT', 0x05DB); // [45][DB] -- If a flag is set (1) the edition should be used as the default one. |
|
67 | -define('EBML_ID_EDITIONFLAGORDERED', 0x05DD); // [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced. |
|
68 | -define('EBML_ID_FILEDATA', 0x065C); // [46][5C] -- The data of the file. |
|
69 | -define('EBML_ID_FILEMIMETYPE', 0x0660); // [46][60] -- MIME type of the file. |
|
70 | -define('EBML_ID_FILENAME', 0x066E); // [46][6E] -- Filename of the attached file. |
|
71 | -define('EBML_ID_FILEREFERRAL', 0x0675); // [46][75] -- A binary value that a track/codec can refer to when the attachment is needed. |
|
72 | -define('EBML_ID_FILEDESCRIPTION', 0x067E); // [46][7E] -- A human-friendly name for the attached file. |
|
73 | -define('EBML_ID_FILEUID', 0x06AE); // [46][AE] -- Unique ID representing the file, as random as possible. |
|
74 | -define('EBML_ID_CONTENTENCALGO', 0x07E1); // [47][E1] -- The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: |
|
75 | -define('EBML_ID_CONTENTENCKEYID', 0x07E2); // [47][E2] -- For public key algorithms this is the ID of the public key the the data was encrypted with. |
|
76 | -define('EBML_ID_CONTENTSIGNATURE', 0x07E3); // [47][E3] -- A cryptographic signature of the contents. |
|
77 | -define('EBML_ID_CONTENTSIGKEYID', 0x07E4); // [47][E4] -- This is the ID of the private key the data was signed with. |
|
78 | -define('EBML_ID_CONTENTSIGALGO', 0x07E5); // [47][E5] -- The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
79 | -define('EBML_ID_CONTENTSIGHASHALGO', 0x07E6); // [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
80 | -define('EBML_ID_MUXINGAPP', 0x0D80); // [4D][80] -- Muxing application or library ("libmatroska-0.4.3"). |
|
81 | -define('EBML_ID_SEEK', 0x0DBB); // [4D][BB] -- Contains a single seek entry to an EBML element. |
|
82 | -define('EBML_ID_CONTENTENCODINGORDER', 0x1031); // [50][31] -- Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment. |
|
83 | -define('EBML_ID_CONTENTENCODINGSCOPE', 0x1032); // [50][32] -- A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: |
|
84 | -define('EBML_ID_CONTENTENCODINGTYPE', 0x1033); // [50][33] -- A value describing what kind of transformation has been done. Possible values: |
|
85 | -define('EBML_ID_CONTENTCOMPRESSION', 0x1034); // [50][34] -- Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking. |
|
86 | -define('EBML_ID_CONTENTENCRYPTION', 0x1035); // [50][35] -- Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise. |
|
87 | -define('EBML_ID_CUEREFNUMBER', 0x135F); // [53][5F] -- Number of the referenced Block of Track X in the specified Cluster. |
|
88 | -define('EBML_ID_NAME', 0x136E); // [53][6E] -- A human-readable track name. |
|
89 | -define('EBML_ID_CUEBLOCKNUMBER', 0x1378); // [53][78] -- Number of the Block in the specified Cluster. |
|
90 | -define('EBML_ID_TRACKOFFSET', 0x137F); // [53][7F] -- A value to add to the Block's Timecode. This can be used to adjust the playback offset of a track. |
|
91 | -define('EBML_ID_SEEKID', 0x13AB); // [53][AB] -- The binary ID corresponding to the element name. |
|
92 | -define('EBML_ID_SEEKPOSITION', 0x13AC); // [53][AC] -- The position of the element in the segment in octets (0 = first level 1 element). |
|
93 | -define('EBML_ID_STEREOMODE', 0x13B8); // [53][B8] -- Stereo-3D video mode. |
|
94 | -define('EBML_ID_OLDSTEREOMODE', 0x13B9); // [53][B9] -- Bogus StereoMode value used in old versions of libmatroska. DO NOT USE. (0: mono, 1: right eye, 2: left eye, 3: both eyes). |
|
95 | -define('EBML_ID_PIXELCROPBOTTOM', 0x14AA); // [54][AA] -- The number of video pixels to remove at the bottom of the image (for HDTV content). |
|
96 | -define('EBML_ID_DISPLAYWIDTH', 0x14B0); // [54][B0] -- Width of the video frames to display. |
|
97 | -define('EBML_ID_DISPLAYUNIT', 0x14B2); // [54][B2] -- Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches). |
|
98 | -define('EBML_ID_ASPECTRATIOTYPE', 0x14B3); // [54][B3] -- Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed). |
|
99 | -define('EBML_ID_DISPLAYHEIGHT', 0x14BA); // [54][BA] -- Height of the video frames to display. |
|
100 | -define('EBML_ID_PIXELCROPTOP', 0x14BB); // [54][BB] -- The number of video pixels to remove at the top of the image. |
|
101 | -define('EBML_ID_PIXELCROPLEFT', 0x14CC); // [54][CC] -- The number of video pixels to remove on the left of the image. |
|
102 | -define('EBML_ID_PIXELCROPRIGHT', 0x14DD); // [54][DD] -- The number of video pixels to remove on the right of the image. |
|
103 | -define('EBML_ID_FLAGFORCED', 0x15AA); // [55][AA] -- Set if that track MUST be used during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. |
|
104 | -define('EBML_ID_MAXBLOCKADDITIONID', 0x15EE); // [55][EE] -- The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track. |
|
105 | -define('EBML_ID_WRITINGAPP', 0x1741); // [57][41] -- Writing application ("mkvmerge-0.3.3"). |
|
106 | -define('EBML_ID_CLUSTERSILENTTRACKS', 0x1854); // [58][54] -- The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use. |
|
107 | -define('EBML_ID_CLUSTERSILENTTRACKNUMBER', 0x18D7); // [58][D7] -- One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster. |
|
108 | -define('EBML_ID_ATTACHEDFILE', 0x21A7); // [61][A7] -- An attached file. |
|
109 | -define('EBML_ID_CONTENTENCODING', 0x2240); // [62][40] -- Settings for one content encoding like compression or encryption. |
|
110 | -define('EBML_ID_BITDEPTH', 0x2264); // [62][64] -- Bits per sample, mostly used for PCM. |
|
111 | -define('EBML_ID_CODECPRIVATE', 0x23A2); // [63][A2] -- Private data only known to the codec. |
|
112 | -define('EBML_ID_TARGETS', 0x23C0); // [63][C0] -- Contain all UIDs where the specified meta data apply. It is void to describe everything in the segment. |
|
113 | -define('EBML_ID_CHAPTERPHYSICALEQUIV', 0x23C3); // [63][C3] -- Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values. |
|
114 | -define('EBML_ID_TAGCHAPTERUID', 0x23C4); // [63][C4] -- A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment. |
|
115 | -define('EBML_ID_TAGTRACKUID', 0x23C5); // [63][C5] -- A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment. |
|
116 | -define('EBML_ID_TAGATTACHMENTUID', 0x23C6); // [63][C6] -- A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment. |
|
117 | -define('EBML_ID_TAGEDITIONUID', 0x23C9); // [63][C9] -- A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment. |
|
118 | -define('EBML_ID_TARGETTYPE', 0x23CA); // [63][CA] -- An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType). |
|
119 | -define('EBML_ID_TRACKTRANSLATE', 0x2624); // [66][24] -- The track identification for the given Chapter Codec. |
|
120 | -define('EBML_ID_TRACKTRANSLATETRACKID', 0x26A5); // [66][A5] -- The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
121 | -define('EBML_ID_TRACKTRANSLATECODEC', 0x26BF); // [66][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
122 | -define('EBML_ID_TRACKTRANSLATEEDITIONUID', 0x26FC); // [66][FC] -- Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment. |
|
123 | -define('EBML_ID_SIMPLETAG', 0x27C8); // [67][C8] -- Contains general information about the target. |
|
124 | -define('EBML_ID_TARGETTYPEVALUE', 0x28CA); // [68][CA] -- A number to indicate the logical level of the target (see TargetType). |
|
125 | -define('EBML_ID_CHAPPROCESSCOMMAND', 0x2911); // [69][11] -- Contains all the commands associated to the Atom. |
|
126 | -define('EBML_ID_CHAPPROCESSTIME', 0x2922); // [69][22] -- Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter). |
|
127 | -define('EBML_ID_CHAPTERTRANSLATE', 0x2924); // [69][24] -- A tuple of corresponding ID used by chapter codecs to represent this segment. |
|
128 | -define('EBML_ID_CHAPPROCESSDATA', 0x2933); // [69][33] -- Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands. |
|
129 | -define('EBML_ID_CHAPPROCESS', 0x2944); // [69][44] -- Contains all the commands associated to the Atom. |
|
130 | -define('EBML_ID_CHAPPROCESSCODECID', 0x2955); // [69][55] -- Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later. |
|
131 | -define('EBML_ID_CHAPTERTRANSLATEID', 0x29A5); // [69][A5] -- The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
132 | -define('EBML_ID_CHAPTERTRANSLATECODEC', 0x29BF); // [69][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
133 | -define('EBML_ID_CHAPTERTRANSLATEEDITIONUID', 0x29FC); // [69][FC] -- Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment. |
|
134 | -define('EBML_ID_CONTENTENCODINGS', 0x2D80); // [6D][80] -- Settings for several content encoding mechanisms like compression or encryption. |
|
135 | -define('EBML_ID_MINCACHE', 0x2DE7); // [6D][E7] -- The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used. |
|
136 | -define('EBML_ID_MAXCACHE', 0x2DF8); // [6D][F8] -- The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed. |
|
137 | -define('EBML_ID_CHAPTERSEGMENTUID', 0x2E67); // [6E][67] -- A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used. |
|
138 | -define('EBML_ID_CHAPTERSEGMENTEDITIONUID', 0x2EBC); // [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID. |
|
139 | -define('EBML_ID_TRACKOVERLAY', 0x2FAB); // [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc. |
|
140 | -define('EBML_ID_TAG', 0x3373); // [73][73] -- Element containing elements specific to Tracks/Chapters. |
|
141 | -define('EBML_ID_SEGMENTFILENAME', 0x3384); // [73][84] -- A filename corresponding to this segment. |
|
142 | -define('EBML_ID_SEGMENTUID', 0x33A4); // [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits). |
|
143 | -define('EBML_ID_CHAPTERUID', 0x33C4); // [73][C4] -- A unique ID to identify the Chapter. |
|
144 | -define('EBML_ID_TRACKUID', 0x33C5); // [73][C5] -- A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file. |
|
145 | -define('EBML_ID_ATTACHMENTLINK', 0x3446); // [74][46] -- The UID of an attachment that is used by this codec. |
|
146 | -define('EBML_ID_CLUSTERBLOCKADDITIONS', 0x35A1); // [75][A1] -- Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data. |
|
147 | -define('EBML_ID_CHANNELPOSITIONS', 0x347B); // [7D][7B] -- Table of horizontal angles for each successive channel, see appendix. |
|
148 | -define('EBML_ID_OUTPUTSAMPLINGFREQUENCY', 0x38B5); // [78][B5] -- Real output sampling frequency in Hz (used for SBR techniques). |
|
149 | -define('EBML_ID_TITLE', 0x3BA9); // [7B][A9] -- General name of the segment. |
|
150 | -define('EBML_ID_CHAPTERDISPLAY', 0x00); // [80] -- Contains all possible strings to use for the chapter display. |
|
151 | -define('EBML_ID_TRACKTYPE', 0x03); // [83] -- A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control). |
|
152 | -define('EBML_ID_CHAPSTRING', 0x05); // [85] -- Contains the string to use as the chapter atom. |
|
153 | -define('EBML_ID_CODECID', 0x06); // [86] -- An ID corresponding to the codec, see the codec page for more info. |
|
154 | -define('EBML_ID_FLAGDEFAULT', 0x08); // [88] -- Set if that track (audio, video or subs) SHOULD be used if no language found matches the user preference. |
|
155 | -define('EBML_ID_CHAPTERTRACKNUMBER', 0x09); // [89] -- UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks. |
|
156 | -define('EBML_ID_CLUSTERSLICES', 0x0E); // [8E] -- Contains slices description. |
|
157 | -define('EBML_ID_CHAPTERTRACK', 0x0F); // [8F] -- List of tracks on which the chapter applies. If this element is not present, all tracks apply |
|
158 | -define('EBML_ID_CHAPTERTIMESTART', 0x11); // [91] -- Timecode of the start of Chapter (not scaled). |
|
159 | -define('EBML_ID_CHAPTERTIMEEND', 0x12); // [92] -- Timecode of the end of Chapter (timecode excluded, not scaled). |
|
160 | -define('EBML_ID_CUEREFTIME', 0x16); // [96] -- Timecode of the referenced Block. |
|
161 | -define('EBML_ID_CUEREFCLUSTER', 0x17); // [97] -- Position of the Cluster containing the referenced Block. |
|
162 | -define('EBML_ID_CHAPTERFLAGHIDDEN', 0x18); // [98] -- If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
163 | -define('EBML_ID_FLAGINTERLACED', 0x1A); // [9A] -- Set if the video is interlaced. |
|
164 | -define('EBML_ID_CLUSTERBLOCKDURATION', 0x1B); // [9B] -- The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track. When not written and with no DefaultDuration, the value is assumed to be the difference between the timecode of this Block and the timecode of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. |
|
165 | -define('EBML_ID_FLAGLACING', 0x1C); // [9C] -- Set if the track may contain blocks using lacing. |
|
166 | -define('EBML_ID_CHANNELS', 0x1F); // [9F] -- Numbers of channels in the track. |
|
167 | -define('EBML_ID_CLUSTERBLOCKGROUP', 0x20); // [A0] -- Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock. |
|
168 | -define('EBML_ID_CLUSTERBLOCK', 0x21); // [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode. |
|
169 | -define('EBML_ID_CLUSTERBLOCKVIRTUAL', 0x22); // [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order. |
|
170 | -define('EBML_ID_CLUSTERSIMPLEBLOCK', 0x23); // [A3] -- Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed. |
|
171 | -define('EBML_ID_CLUSTERCODECSTATE', 0x24); // [A4] -- The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry. |
|
172 | -define('EBML_ID_CLUSTERBLOCKADDITIONAL', 0x25); // [A5] -- Interpreted by the codec as it wishes (using the BlockAddID). |
|
173 | -define('EBML_ID_CLUSTERBLOCKMORE', 0x26); // [A6] -- Contain the BlockAdditional and some parameters. |
|
174 | -define('EBML_ID_CLUSTERPOSITION', 0x27); // [A7] -- Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams. |
|
175 | -define('EBML_ID_CODECDECODEALL', 0x2A); // [AA] -- The codec can decode potentially damaged data. |
|
176 | -define('EBML_ID_CLUSTERPREVSIZE', 0x2B); // [AB] -- Size of the previous Cluster, in octets. Can be useful for backward playing. |
|
177 | -define('EBML_ID_TRACKENTRY', 0x2E); // [AE] -- Describes a track with all elements. |
|
178 | -define('EBML_ID_CLUSTERENCRYPTEDBLOCK', 0x2F); // [AF] -- Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed). |
|
179 | -define('EBML_ID_PIXELWIDTH', 0x30); // [B0] -- Width of the encoded video frames in pixels. |
|
180 | -define('EBML_ID_CUETIME', 0x33); // [B3] -- Absolute timecode according to the segment time base. |
|
181 | -define('EBML_ID_SAMPLINGFREQUENCY', 0x35); // [B5] -- Sampling frequency in Hz. |
|
182 | -define('EBML_ID_CHAPTERATOM', 0x36); // [B6] -- Contains the atom information to use as the chapter atom (apply to all tracks). |
|
183 | -define('EBML_ID_CUETRACKPOSITIONS', 0x37); // [B7] -- Contain positions for different tracks corresponding to the timecode. |
|
184 | -define('EBML_ID_FLAGENABLED', 0x39); // [B9] -- Set if the track is used. |
|
185 | -define('EBML_ID_PIXELHEIGHT', 0x3A); // [BA] -- Height of the encoded video frames in pixels. |
|
186 | -define('EBML_ID_CUEPOINT', 0x3B); // [BB] -- Contains all information relative to a seek point in the segment. |
|
187 | -define('EBML_ID_CRC32', 0x3F); // [BF] -- The CRC is computed on all the data of the Master element it's in, regardless of its position. It's recommended to put the CRC value at the beggining of the Master element for easier reading. All level 1 elements should include a CRC-32. |
|
188 | -define('EBML_ID_CLUSTERBLOCKADDITIONID', 0x4B); // [CB] -- The ID of the BlockAdditional element (0 is the main Block). |
|
189 | -define('EBML_ID_CLUSTERLACENUMBER', 0x4C); // [CC] -- The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
190 | -define('EBML_ID_CLUSTERFRAMENUMBER', 0x4D); // [CD] -- The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame). |
|
191 | -define('EBML_ID_CLUSTERDELAY', 0x4E); // [CE] -- The (scaled) delay to apply to the element. |
|
192 | -define('EBML_ID_CLUSTERDURATION', 0x4F); // [CF] -- The (scaled) duration to apply to the element. |
|
193 | -define('EBML_ID_TRACKNUMBER', 0x57); // [D7] -- The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number). |
|
194 | -define('EBML_ID_CUEREFERENCE', 0x5B); // [DB] -- The Clusters containing the required referenced Blocks. |
|
195 | -define('EBML_ID_VIDEO', 0x60); // [E0] -- Video settings. |
|
196 | -define('EBML_ID_AUDIO', 0x61); // [E1] -- Audio settings. |
|
197 | -define('EBML_ID_CLUSTERTIMESLICE', 0x68); // [E8] -- Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
198 | -define('EBML_ID_CUECODECSTATE', 0x6A); // [EA] -- The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry. |
|
199 | -define('EBML_ID_CUEREFCODECSTATE', 0x6B); // [EB] -- The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry. |
|
200 | -define('EBML_ID_VOID', 0x6C); // [EC] -- Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use. |
|
201 | -define('EBML_ID_CLUSTERTIMECODE', 0x67); // [E7] -- Absolute timecode of the cluster (based on TimecodeScale). |
|
202 | -define('EBML_ID_CLUSTERBLOCKADDID', 0x6E); // [EE] -- An ID to identify the BlockAdditional level. |
|
203 | -define('EBML_ID_CUECLUSTERPOSITION', 0x71); // [F1] -- The position of the Cluster containing the required Block. |
|
204 | -define('EBML_ID_CUETRACK', 0x77); // [F7] -- The track for which a position is given. |
|
205 | -define('EBML_ID_CLUSTERREFERENCEPRIORITY', 0x7A); // [FA] -- This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced. |
|
206 | -define('EBML_ID_CLUSTERREFERENCEBLOCK', 0x7B); // [FB] -- Timecode of another frame used as a reference (ie: B or P frame). The timecode is relative to the block it's attached to. |
|
207 | -define('EBML_ID_CLUSTERREFERENCEVIRTUAL', 0x7D); // [FD] -- Relative position of the data that should be in position of the virtual block. |
|
18 | +define('EBML_ID_CHAPTERS', 0x0043A770); // [10][43][A7][70] -- A system to define basic menus and partition data. For more detailed information, look at the Chapters Explanation. |
|
19 | +define('EBML_ID_SEEKHEAD', 0x014D9B74); // [11][4D][9B][74] -- Contains the position of other level 1 elements. |
|
20 | +define('EBML_ID_TAGS', 0x0254C367); // [12][54][C3][67] -- Element containing elements specific to Tracks/Chapters. A list of valid tags can be found <http://www.matroska.org/technical/specs/tagging/index.html>. |
|
21 | +define('EBML_ID_INFO', 0x0549A966); // [15][49][A9][66] -- Contains miscellaneous general information and statistics on the file. |
|
22 | +define('EBML_ID_TRACKS', 0x0654AE6B); // [16][54][AE][6B] -- A top-level block of information with many tracks described. |
|
23 | +define('EBML_ID_SEGMENT', 0x08538067); // [18][53][80][67] -- This element contains all other top-level (level 1) elements. Typically a Matroska file is composed of 1 segment. |
|
24 | +define('EBML_ID_ATTACHMENTS', 0x0941A469); // [19][41][A4][69] -- Contain attached files. |
|
25 | +define('EBML_ID_EBML', 0x0A45DFA3); // [1A][45][DF][A3] -- Set the EBML characteristics of the data to follow. Each EBML document has to start with this. |
|
26 | +define('EBML_ID_CUES', 0x0C53BB6B); // [1C][53][BB][6B] -- A top-level element to speed seeking access. All entries are local to the segment. |
|
27 | +define('EBML_ID_CLUSTER', 0x0F43B675); // [1F][43][B6][75] -- The lower level element containing the (monolithic) Block structure. |
|
28 | +define('EBML_ID_LANGUAGE', 0x02B59C); // [22][B5][9C] -- Specifies the language of the track in the Matroska languages form. |
|
29 | +define('EBML_ID_TRACKTIMECODESCALE', 0x03314F); // [23][31][4F] -- The scale to apply on this track to work at normal speed in relation with other tracks (mostly used to adjust video speed when the audio length differs). |
|
30 | +define('EBML_ID_DEFAULTDURATION', 0x03E383); // [23][E3][83] -- Number of nanoseconds (i.e. not scaled) per frame. |
|
31 | +define('EBML_ID_CODECNAME', 0x058688); // [25][86][88] -- A human-readable string specifying the codec. |
|
32 | +define('EBML_ID_CODECDOWNLOADURL', 0x06B240); // [26][B2][40] -- A URL to download about the codec used. |
|
33 | +define('EBML_ID_TIMECODESCALE', 0x0AD7B1); // [2A][D7][B1] -- Timecode scale in nanoseconds (1.000.000 means all timecodes in the segment are expressed in milliseconds). |
|
34 | +define('EBML_ID_COLOURSPACE', 0x0EB524); // [2E][B5][24] -- Same value as in AVI (32 bits). |
|
35 | +define('EBML_ID_GAMMAVALUE', 0x0FB523); // [2F][B5][23] -- Gamma Value. |
|
36 | +define('EBML_ID_CODECSETTINGS', 0x1A9697); // [3A][96][97] -- A string describing the encoding setting used. |
|
37 | +define('EBML_ID_CODECINFOURL', 0x1B4040); // [3B][40][40] -- A URL to find information about the codec used. |
|
38 | +define('EBML_ID_PREVFILENAME', 0x1C83AB); // [3C][83][AB] -- An escaped filename corresponding to the previous segment. |
|
39 | +define('EBML_ID_PREVUID', 0x1CB923); // [3C][B9][23] -- A unique ID to identify the previous chained segment (128 bits). |
|
40 | +define('EBML_ID_NEXTFILENAME', 0x1E83BB); // [3E][83][BB] -- An escaped filename corresponding to the next segment. |
|
41 | +define('EBML_ID_NEXTUID', 0x1EB923); // [3E][B9][23] -- A unique ID to identify the next chained segment (128 bits). |
|
42 | +define('EBML_ID_CONTENTCOMPALGO', 0x0254); // [42][54] -- The compression algorithm used. Algorithms that have been specified so far are: |
|
43 | +define('EBML_ID_CONTENTCOMPSETTINGS', 0x0255); // [42][55] -- Settings that might be needed by the decompressor. For Header Stripping (ContentCompAlgo=3), the bytes that were removed from the beggining of each frames of the track. |
|
44 | +define('EBML_ID_DOCTYPE', 0x0282); // [42][82] -- A string that describes the type of document that follows this EBML header ('matroska' in our case). |
|
45 | +define('EBML_ID_DOCTYPEREADVERSION', 0x0285); // [42][85] -- The minimum DocType version an interpreter has to support to read this file. |
|
46 | +define('EBML_ID_EBMLVERSION', 0x0286); // [42][86] -- The version of EBML parser used to create the file. |
|
47 | +define('EBML_ID_DOCTYPEVERSION', 0x0287); // [42][87] -- The version of DocType interpreter used to create the file. |
|
48 | +define('EBML_ID_EBMLMAXIDLENGTH', 0x02F2); // [42][F2] -- The maximum length of the IDs you'll find in this file (4 or less in Matroska). |
|
49 | +define('EBML_ID_EBMLMAXSIZELENGTH', 0x02F3); // [42][F3] -- The maximum length of the sizes you'll find in this file (8 or less in Matroska). This does not override the element size indicated at the beginning of an element. Elements that have an indicated size which is larger than what is allowed by EBMLMaxSizeLength shall be considered invalid. |
|
50 | +define('EBML_ID_EBMLREADVERSION', 0x02F7); // [42][F7] -- The minimum EBML version a parser has to support to read this file. |
|
51 | +define('EBML_ID_CHAPLANGUAGE', 0x037C); // [43][7C] -- The languages corresponding to the string, in the bibliographic ISO-639-2 form. |
|
52 | +define('EBML_ID_CHAPCOUNTRY', 0x037E); // [43][7E] -- The countries corresponding to the string, same 2 octets as in Internet domains. |
|
53 | +define('EBML_ID_SEGMENTFAMILY', 0x0444); // [44][44] -- A randomly generated unique ID that all segments related to each other must use (128 bits). |
|
54 | +define('EBML_ID_DATEUTC', 0x0461); // [44][61] -- Date of the origin of timecode (value 0), i.e. production date. |
|
55 | +define('EBML_ID_TAGLANGUAGE', 0x047A); // [44][7A] -- Specifies the language of the tag specified, in the Matroska languages form. |
|
56 | +define('EBML_ID_TAGDEFAULT', 0x0484); // [44][84] -- Indication to know if this is the default/original language to use for the given tag. |
|
57 | +define('EBML_ID_TAGBINARY', 0x0485); // [44][85] -- The values of the Tag if it is binary. Note that this cannot be used in the same SimpleTag as TagString. |
|
58 | +define('EBML_ID_TAGSTRING', 0x0487); // [44][87] -- The value of the Tag. |
|
59 | +define('EBML_ID_DURATION', 0x0489); // [44][89] -- Duration of the segment (based on TimecodeScale). |
|
60 | +define('EBML_ID_CHAPPROCESSPRIVATE', 0x050D); // [45][0D] -- Some optional data attached to the ChapProcessCodecID information. For ChapProcessCodecID = 1, it is the "DVD level" equivalent. |
|
61 | +define('EBML_ID_CHAPTERFLAGENABLED', 0x0598); // [45][98] -- Specify wether the chapter is enabled. It can be enabled/disabled by a Control Track. When disabled, the movie should skip all the content between the TimeStart and TimeEnd of this chapter. |
|
62 | +define('EBML_ID_TAGNAME', 0x05A3); // [45][A3] -- The name of the Tag that is going to be stored. |
|
63 | +define('EBML_ID_EDITIONENTRY', 0x05B9); // [45][B9] -- Contains all information about a segment edition. |
|
64 | +define('EBML_ID_EDITIONUID', 0x05BC); // [45][BC] -- A unique ID to identify the edition. It's useful for tagging an edition. |
|
65 | +define('EBML_ID_EDITIONFLAGHIDDEN', 0x05BD); // [45][BD] -- If an edition is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
66 | +define('EBML_ID_EDITIONFLAGDEFAULT', 0x05DB); // [45][DB] -- If a flag is set (1) the edition should be used as the default one. |
|
67 | +define('EBML_ID_EDITIONFLAGORDERED', 0x05DD); // [45][DD] -- Specify if the chapters can be defined multiple times and the order to play them is enforced. |
|
68 | +define('EBML_ID_FILEDATA', 0x065C); // [46][5C] -- The data of the file. |
|
69 | +define('EBML_ID_FILEMIMETYPE', 0x0660); // [46][60] -- MIME type of the file. |
|
70 | +define('EBML_ID_FILENAME', 0x066E); // [46][6E] -- Filename of the attached file. |
|
71 | +define('EBML_ID_FILEREFERRAL', 0x0675); // [46][75] -- A binary value that a track/codec can refer to when the attachment is needed. |
|
72 | +define('EBML_ID_FILEDESCRIPTION', 0x067E); // [46][7E] -- A human-friendly name for the attached file. |
|
73 | +define('EBML_ID_FILEUID', 0x06AE); // [46][AE] -- Unique ID representing the file, as random as possible. |
|
74 | +define('EBML_ID_CONTENTENCALGO', 0x07E1); // [47][E1] -- The encryption algorithm used. The value '0' means that the contents have not been encrypted but only signed. Predefined values: |
|
75 | +define('EBML_ID_CONTENTENCKEYID', 0x07E2); // [47][E2] -- For public key algorithms this is the ID of the public key the the data was encrypted with. |
|
76 | +define('EBML_ID_CONTENTSIGNATURE', 0x07E3); // [47][E3] -- A cryptographic signature of the contents. |
|
77 | +define('EBML_ID_CONTENTSIGKEYID', 0x07E4); // [47][E4] -- This is the ID of the private key the data was signed with. |
|
78 | +define('EBML_ID_CONTENTSIGALGO', 0x07E5); // [47][E5] -- The algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
79 | +define('EBML_ID_CONTENTSIGHASHALGO', 0x07E6); // [47][E6] -- The hash algorithm used for the signature. A value of '0' means that the contents have not been signed but only encrypted. Predefined values: |
|
80 | +define('EBML_ID_MUXINGAPP', 0x0D80); // [4D][80] -- Muxing application or library ("libmatroska-0.4.3"). |
|
81 | +define('EBML_ID_SEEK', 0x0DBB); // [4D][BB] -- Contains a single seek entry to an EBML element. |
|
82 | +define('EBML_ID_CONTENTENCODINGORDER', 0x1031); // [50][31] -- Tells when this modification was used during encoding/muxing starting with 0 and counting upwards. The decoder/demuxer has to start with the highest order number it finds and work its way down. This value has to be unique over all ContentEncodingOrder elements in the segment. |
|
83 | +define('EBML_ID_CONTENTENCODINGSCOPE', 0x1032); // [50][32] -- A bit field that describes which elements have been modified in this way. Values (big endian) can be OR'ed. Possible values: |
|
84 | +define('EBML_ID_CONTENTENCODINGTYPE', 0x1033); // [50][33] -- A value describing what kind of transformation has been done. Possible values: |
|
85 | +define('EBML_ID_CONTENTCOMPRESSION', 0x1034); // [50][34] -- Settings describing the compression used. Must be present if the value of ContentEncodingType is 0 and absent otherwise. Each block must be decompressable even if no previous block is available in order not to prevent seeking. |
|
86 | +define('EBML_ID_CONTENTENCRYPTION', 0x1035); // [50][35] -- Settings describing the encryption used. Must be present if the value of ContentEncodingType is 1 and absent otherwise. |
|
87 | +define('EBML_ID_CUEREFNUMBER', 0x135F); // [53][5F] -- Number of the referenced Block of Track X in the specified Cluster. |
|
88 | +define('EBML_ID_NAME', 0x136E); // [53][6E] -- A human-readable track name. |
|
89 | +define('EBML_ID_CUEBLOCKNUMBER', 0x1378); // [53][78] -- Number of the Block in the specified Cluster. |
|
90 | +define('EBML_ID_TRACKOFFSET', 0x137F); // [53][7F] -- A value to add to the Block's Timecode. This can be used to adjust the playback offset of a track. |
|
91 | +define('EBML_ID_SEEKID', 0x13AB); // [53][AB] -- The binary ID corresponding to the element name. |
|
92 | +define('EBML_ID_SEEKPOSITION', 0x13AC); // [53][AC] -- The position of the element in the segment in octets (0 = first level 1 element). |
|
93 | +define('EBML_ID_STEREOMODE', 0x13B8); // [53][B8] -- Stereo-3D video mode. |
|
94 | +define('EBML_ID_OLDSTEREOMODE', 0x13B9); // [53][B9] -- Bogus StereoMode value used in old versions of libmatroska. DO NOT USE. (0: mono, 1: right eye, 2: left eye, 3: both eyes). |
|
95 | +define('EBML_ID_PIXELCROPBOTTOM', 0x14AA); // [54][AA] -- The number of video pixels to remove at the bottom of the image (for HDTV content). |
|
96 | +define('EBML_ID_DISPLAYWIDTH', 0x14B0); // [54][B0] -- Width of the video frames to display. |
|
97 | +define('EBML_ID_DISPLAYUNIT', 0x14B2); // [54][B2] -- Type of the unit for DisplayWidth/Height (0: pixels, 1: centimeters, 2: inches). |
|
98 | +define('EBML_ID_ASPECTRATIOTYPE', 0x14B3); // [54][B3] -- Specify the possible modifications to the aspect ratio (0: free resizing, 1: keep aspect ratio, 2: fixed). |
|
99 | +define('EBML_ID_DISPLAYHEIGHT', 0x14BA); // [54][BA] -- Height of the video frames to display. |
|
100 | +define('EBML_ID_PIXELCROPTOP', 0x14BB); // [54][BB] -- The number of video pixels to remove at the top of the image. |
|
101 | +define('EBML_ID_PIXELCROPLEFT', 0x14CC); // [54][CC] -- The number of video pixels to remove on the left of the image. |
|
102 | +define('EBML_ID_PIXELCROPRIGHT', 0x14DD); // [54][DD] -- The number of video pixels to remove on the right of the image. |
|
103 | +define('EBML_ID_FLAGFORCED', 0x15AA); // [55][AA] -- Set if that track MUST be used during playback. There can be many forced track for a kind (audio, video or subs), the player should select the one which language matches the user preference or the default + forced track. Overlay MAY happen between a forced and non-forced track of the same kind. |
|
104 | +define('EBML_ID_MAXBLOCKADDITIONID', 0x15EE); // [55][EE] -- The maximum value of BlockAddID. A value 0 means there is no BlockAdditions for this track. |
|
105 | +define('EBML_ID_WRITINGAPP', 0x1741); // [57][41] -- Writing application ("mkvmerge-0.3.3"). |
|
106 | +define('EBML_ID_CLUSTERSILENTTRACKS', 0x1854); // [58][54] -- The list of tracks that are not used in that part of the stream. It is useful when using overlay tracks on seeking. Then you should decide what track to use. |
|
107 | +define('EBML_ID_CLUSTERSILENTTRACKNUMBER', 0x18D7); // [58][D7] -- One of the track number that are not used from now on in the stream. It could change later if not specified as silent in a further Cluster. |
|
108 | +define('EBML_ID_ATTACHEDFILE', 0x21A7); // [61][A7] -- An attached file. |
|
109 | +define('EBML_ID_CONTENTENCODING', 0x2240); // [62][40] -- Settings for one content encoding like compression or encryption. |
|
110 | +define('EBML_ID_BITDEPTH', 0x2264); // [62][64] -- Bits per sample, mostly used for PCM. |
|
111 | +define('EBML_ID_CODECPRIVATE', 0x23A2); // [63][A2] -- Private data only known to the codec. |
|
112 | +define('EBML_ID_TARGETS', 0x23C0); // [63][C0] -- Contain all UIDs where the specified meta data apply. It is void to describe everything in the segment. |
|
113 | +define('EBML_ID_CHAPTERPHYSICALEQUIV', 0x23C3); // [63][C3] -- Specify the physical equivalent of this ChapterAtom like "DVD" (60) or "SIDE" (50), see complete list of values. |
|
114 | +define('EBML_ID_TAGCHAPTERUID', 0x23C4); // [63][C4] -- A unique ID to identify the Chapter(s) the tags belong to. If the value is 0 at this level, the tags apply to all chapters in the Segment. |
|
115 | +define('EBML_ID_TAGTRACKUID', 0x23C5); // [63][C5] -- A unique ID to identify the Track(s) the tags belong to. If the value is 0 at this level, the tags apply to all tracks in the Segment. |
|
116 | +define('EBML_ID_TAGATTACHMENTUID', 0x23C6); // [63][C6] -- A unique ID to identify the Attachment(s) the tags belong to. If the value is 0 at this level, the tags apply to all the attachments in the Segment. |
|
117 | +define('EBML_ID_TAGEDITIONUID', 0x23C9); // [63][C9] -- A unique ID to identify the EditionEntry(s) the tags belong to. If the value is 0 at this level, the tags apply to all editions in the Segment. |
|
118 | +define('EBML_ID_TARGETTYPE', 0x23CA); // [63][CA] -- An informational string that can be used to display the logical level of the target like "ALBUM", "TRACK", "MOVIE", "CHAPTER", etc (see TargetType). |
|
119 | +define('EBML_ID_TRACKTRANSLATE', 0x2624); // [66][24] -- The track identification for the given Chapter Codec. |
|
120 | +define('EBML_ID_TRACKTRANSLATETRACKID', 0x26A5); // [66][A5] -- The binary value used to represent this track in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
121 | +define('EBML_ID_TRACKTRANSLATECODEC', 0x26BF); // [66][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
122 | +define('EBML_ID_TRACKTRANSLATEEDITIONUID', 0x26FC); // [66][FC] -- Specify an edition UID on which this translation applies. When not specified, it means for all editions found in the segment. |
|
123 | +define('EBML_ID_SIMPLETAG', 0x27C8); // [67][C8] -- Contains general information about the target. |
|
124 | +define('EBML_ID_TARGETTYPEVALUE', 0x28CA); // [68][CA] -- A number to indicate the logical level of the target (see TargetType). |
|
125 | +define('EBML_ID_CHAPPROCESSCOMMAND', 0x2911); // [69][11] -- Contains all the commands associated to the Atom. |
|
126 | +define('EBML_ID_CHAPPROCESSTIME', 0x2922); // [69][22] -- Defines when the process command should be handled (0: during the whole chapter, 1: before starting playback, 2: after playback of the chapter). |
|
127 | +define('EBML_ID_CHAPTERTRANSLATE', 0x2924); // [69][24] -- A tuple of corresponding ID used by chapter codecs to represent this segment. |
|
128 | +define('EBML_ID_CHAPPROCESSDATA', 0x2933); // [69][33] -- Contains the command information. The data should be interpreted depending on the ChapProcessCodecID value. For ChapProcessCodecID = 1, the data correspond to the binary DVD cell pre/post commands. |
|
129 | +define('EBML_ID_CHAPPROCESS', 0x2944); // [69][44] -- Contains all the commands associated to the Atom. |
|
130 | +define('EBML_ID_CHAPPROCESSCODECID', 0x2955); // [69][55] -- Contains the type of the codec used for the processing. A value of 0 means native Matroska processing (to be defined), a value of 1 means the DVD command set is used. More codec IDs can be added later. |
|
131 | +define('EBML_ID_CHAPTERTRANSLATEID', 0x29A5); // [69][A5] -- The binary value used to represent this segment in the chapter codec data. The format depends on the ChapProcessCodecID used. |
|
132 | +define('EBML_ID_CHAPTERTRANSLATECODEC', 0x29BF); // [69][BF] -- The chapter codec using this ID (0: Matroska Script, 1: DVD-menu). |
|
133 | +define('EBML_ID_CHAPTERTRANSLATEEDITIONUID', 0x29FC); // [69][FC] -- Specify an edition UID on which this correspondance applies. When not specified, it means for all editions found in the segment. |
|
134 | +define('EBML_ID_CONTENTENCODINGS', 0x2D80); // [6D][80] -- Settings for several content encoding mechanisms like compression or encryption. |
|
135 | +define('EBML_ID_MINCACHE', 0x2DE7); // [6D][E7] -- The minimum number of frames a player should be able to cache during playback. If set to 0, the reference pseudo-cache system is not used. |
|
136 | +define('EBML_ID_MAXCACHE', 0x2DF8); // [6D][F8] -- The maximum cache size required to store referenced frames in and the current frame. 0 means no cache is needed. |
|
137 | +define('EBML_ID_CHAPTERSEGMENTUID', 0x2E67); // [6E][67] -- A segment to play in place of this chapter. Edition ChapterSegmentEditionUID should be used for this segment, otherwise no edition is used. |
|
138 | +define('EBML_ID_CHAPTERSEGMENTEDITIONUID', 0x2EBC); // [6E][BC] -- The edition to play from the segment linked in ChapterSegmentUID. |
|
139 | +define('EBML_ID_TRACKOVERLAY', 0x2FAB); // [6F][AB] -- Specify that this track is an overlay track for the Track specified (in the u-integer). That means when this track has a gap (see SilentTracks) the overlay track should be used instead. The order of multiple TrackOverlay matters, the first one is the one that should be used. If not found it should be the second, etc. |
|
140 | +define('EBML_ID_TAG', 0x3373); // [73][73] -- Element containing elements specific to Tracks/Chapters. |
|
141 | +define('EBML_ID_SEGMENTFILENAME', 0x3384); // [73][84] -- A filename corresponding to this segment. |
|
142 | +define('EBML_ID_SEGMENTUID', 0x33A4); // [73][A4] -- A randomly generated unique ID to identify the current segment between many others (128 bits). |
|
143 | +define('EBML_ID_CHAPTERUID', 0x33C4); // [73][C4] -- A unique ID to identify the Chapter. |
|
144 | +define('EBML_ID_TRACKUID', 0x33C5); // [73][C5] -- A unique ID to identify the Track. This should be kept the same when making a direct stream copy of the Track to another file. |
|
145 | +define('EBML_ID_ATTACHMENTLINK', 0x3446); // [74][46] -- The UID of an attachment that is used by this codec. |
|
146 | +define('EBML_ID_CLUSTERBLOCKADDITIONS', 0x35A1); // [75][A1] -- Contain additional blocks to complete the main one. An EBML parser that has no knowledge of the Block structure could still see and use/skip these data. |
|
147 | +define('EBML_ID_CHANNELPOSITIONS', 0x347B); // [7D][7B] -- Table of horizontal angles for each successive channel, see appendix. |
|
148 | +define('EBML_ID_OUTPUTSAMPLINGFREQUENCY', 0x38B5); // [78][B5] -- Real output sampling frequency in Hz (used for SBR techniques). |
|
149 | +define('EBML_ID_TITLE', 0x3BA9); // [7B][A9] -- General name of the segment. |
|
150 | +define('EBML_ID_CHAPTERDISPLAY', 0x00); // [80] -- Contains all possible strings to use for the chapter display. |
|
151 | +define('EBML_ID_TRACKTYPE', 0x03); // [83] -- A set of track types coded on 8 bits (1: video, 2: audio, 3: complex, 0x10: logo, 0x11: subtitle, 0x12: buttons, 0x20: control). |
|
152 | +define('EBML_ID_CHAPSTRING', 0x05); // [85] -- Contains the string to use as the chapter atom. |
|
153 | +define('EBML_ID_CODECID', 0x06); // [86] -- An ID corresponding to the codec, see the codec page for more info. |
|
154 | +define('EBML_ID_FLAGDEFAULT', 0x08); // [88] -- Set if that track (audio, video or subs) SHOULD be used if no language found matches the user preference. |
|
155 | +define('EBML_ID_CHAPTERTRACKNUMBER', 0x09); // [89] -- UID of the Track to apply this chapter too. In the absense of a control track, choosing this chapter will select the listed Tracks and deselect unlisted tracks. Absense of this element indicates that the Chapter should be applied to any currently used Tracks. |
|
156 | +define('EBML_ID_CLUSTERSLICES', 0x0E); // [8E] -- Contains slices description. |
|
157 | +define('EBML_ID_CHAPTERTRACK', 0x0F); // [8F] -- List of tracks on which the chapter applies. If this element is not present, all tracks apply |
|
158 | +define('EBML_ID_CHAPTERTIMESTART', 0x11); // [91] -- Timecode of the start of Chapter (not scaled). |
|
159 | +define('EBML_ID_CHAPTERTIMEEND', 0x12); // [92] -- Timecode of the end of Chapter (timecode excluded, not scaled). |
|
160 | +define('EBML_ID_CUEREFTIME', 0x16); // [96] -- Timecode of the referenced Block. |
|
161 | +define('EBML_ID_CUEREFCLUSTER', 0x17); // [97] -- Position of the Cluster containing the referenced Block. |
|
162 | +define('EBML_ID_CHAPTERFLAGHIDDEN', 0x18); // [98] -- If a chapter is hidden (1), it should not be available to the user interface (but still to Control Tracks). |
|
163 | +define('EBML_ID_FLAGINTERLACED', 0x1A); // [9A] -- Set if the video is interlaced. |
|
164 | +define('EBML_ID_CLUSTERBLOCKDURATION', 0x1B); // [9B] -- The duration of the Block (based on TimecodeScale). This element is mandatory when DefaultDuration is set for the track. When not written and with no DefaultDuration, the value is assumed to be the difference between the timecode of this Block and the timecode of the next Block in "display" order (not coding order). This element can be useful at the end of a Track (as there is not other Block available), or when there is a break in a track like for subtitle tracks. |
|
165 | +define('EBML_ID_FLAGLACING', 0x1C); // [9C] -- Set if the track may contain blocks using lacing. |
|
166 | +define('EBML_ID_CHANNELS', 0x1F); // [9F] -- Numbers of channels in the track. |
|
167 | +define('EBML_ID_CLUSTERBLOCKGROUP', 0x20); // [A0] -- Basic container of information containing a single Block or BlockVirtual, and information specific to that Block/VirtualBlock. |
|
168 | +define('EBML_ID_CLUSTERBLOCK', 0x21); // [A1] -- Block containing the actual data to be rendered and a timecode relative to the Cluster Timecode. |
|
169 | +define('EBML_ID_CLUSTERBLOCKVIRTUAL', 0x22); // [A2] -- A Block with no data. It must be stored in the stream at the place the real Block should be in display order. |
|
170 | +define('EBML_ID_CLUSTERSIMPLEBLOCK', 0x23); // [A3] -- Similar to Block but without all the extra information, mostly used to reduced overhead when no extra feature is needed. |
|
171 | +define('EBML_ID_CLUSTERCODECSTATE', 0x24); // [A4] -- The new codec state to use. Data interpretation is private to the codec. This information should always be referenced by a seek entry. |
|
172 | +define('EBML_ID_CLUSTERBLOCKADDITIONAL', 0x25); // [A5] -- Interpreted by the codec as it wishes (using the BlockAddID). |
|
173 | +define('EBML_ID_CLUSTERBLOCKMORE', 0x26); // [A6] -- Contain the BlockAdditional and some parameters. |
|
174 | +define('EBML_ID_CLUSTERPOSITION', 0x27); // [A7] -- Position of the Cluster in the segment (0 in live broadcast streams). It might help to resynchronise offset on damaged streams. |
|
175 | +define('EBML_ID_CODECDECODEALL', 0x2A); // [AA] -- The codec can decode potentially damaged data. |
|
176 | +define('EBML_ID_CLUSTERPREVSIZE', 0x2B); // [AB] -- Size of the previous Cluster, in octets. Can be useful for backward playing. |
|
177 | +define('EBML_ID_TRACKENTRY', 0x2E); // [AE] -- Describes a track with all elements. |
|
178 | +define('EBML_ID_CLUSTERENCRYPTEDBLOCK', 0x2F); // [AF] -- Similar to SimpleBlock but the data inside the Block are Transformed (encrypt and/or signed). |
|
179 | +define('EBML_ID_PIXELWIDTH', 0x30); // [B0] -- Width of the encoded video frames in pixels. |
|
180 | +define('EBML_ID_CUETIME', 0x33); // [B3] -- Absolute timecode according to the segment time base. |
|
181 | +define('EBML_ID_SAMPLINGFREQUENCY', 0x35); // [B5] -- Sampling frequency in Hz. |
|
182 | +define('EBML_ID_CHAPTERATOM', 0x36); // [B6] -- Contains the atom information to use as the chapter atom (apply to all tracks). |
|
183 | +define('EBML_ID_CUETRACKPOSITIONS', 0x37); // [B7] -- Contain positions for different tracks corresponding to the timecode. |
|
184 | +define('EBML_ID_FLAGENABLED', 0x39); // [B9] -- Set if the track is used. |
|
185 | +define('EBML_ID_PIXELHEIGHT', 0x3A); // [BA] -- Height of the encoded video frames in pixels. |
|
186 | +define('EBML_ID_CUEPOINT', 0x3B); // [BB] -- Contains all information relative to a seek point in the segment. |
|
187 | +define('EBML_ID_CRC32', 0x3F); // [BF] -- The CRC is computed on all the data of the Master element it's in, regardless of its position. It's recommended to put the CRC value at the beggining of the Master element for easier reading. All level 1 elements should include a CRC-32. |
|
188 | +define('EBML_ID_CLUSTERBLOCKADDITIONID', 0x4B); // [CB] -- The ID of the BlockAdditional element (0 is the main Block). |
|
189 | +define('EBML_ID_CLUSTERLACENUMBER', 0x4C); // [CC] -- The reverse number of the frame in the lace (0 is the last frame, 1 is the next to last, etc). While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
190 | +define('EBML_ID_CLUSTERFRAMENUMBER', 0x4D); // [CD] -- The number of the frame to generate from this lace with this delay (allow you to generate many frames from the same Block/Frame). |
|
191 | +define('EBML_ID_CLUSTERDELAY', 0x4E); // [CE] -- The (scaled) delay to apply to the element. |
|
192 | +define('EBML_ID_CLUSTERDURATION', 0x4F); // [CF] -- The (scaled) duration to apply to the element. |
|
193 | +define('EBML_ID_TRACKNUMBER', 0x57); // [D7] -- The track number as used in the Block Header (using more than 127 tracks is not encouraged, though the design allows an unlimited number). |
|
194 | +define('EBML_ID_CUEREFERENCE', 0x5B); // [DB] -- The Clusters containing the required referenced Blocks. |
|
195 | +define('EBML_ID_VIDEO', 0x60); // [E0] -- Video settings. |
|
196 | +define('EBML_ID_AUDIO', 0x61); // [E1] -- Audio settings. |
|
197 | +define('EBML_ID_CLUSTERTIMESLICE', 0x68); // [E8] -- Contains extra time information about the data contained in the Block. While there are a few files in the wild with this element, it is no longer in use and has been deprecated. Being able to interpret this element is not required for playback. |
|
198 | +define('EBML_ID_CUECODECSTATE', 0x6A); // [EA] -- The position of the Codec State corresponding to this Cue element. 0 means that the data is taken from the initial Track Entry. |
|
199 | +define('EBML_ID_CUEREFCODECSTATE', 0x6B); // [EB] -- The position of the Codec State corresponding to this referenced element. 0 means that the data is taken from the initial Track Entry. |
|
200 | +define('EBML_ID_VOID', 0x6C); // [EC] -- Used to void damaged data, to avoid unexpected behaviors when using damaged data. The content is discarded. Also used to reserve space in a sub-element for later use. |
|
201 | +define('EBML_ID_CLUSTERTIMECODE', 0x67); // [E7] -- Absolute timecode of the cluster (based on TimecodeScale). |
|
202 | +define('EBML_ID_CLUSTERBLOCKADDID', 0x6E); // [EE] -- An ID to identify the BlockAdditional level. |
|
203 | +define('EBML_ID_CUECLUSTERPOSITION', 0x71); // [F1] -- The position of the Cluster containing the required Block. |
|
204 | +define('EBML_ID_CUETRACK', 0x77); // [F7] -- The track for which a position is given. |
|
205 | +define('EBML_ID_CLUSTERREFERENCEPRIORITY', 0x7A); // [FA] -- This frame is referenced and has the specified cache priority. In cache only a frame of the same or higher priority can replace this frame. A value of 0 means the frame is not referenced. |
|
206 | +define('EBML_ID_CLUSTERREFERENCEBLOCK', 0x7B); // [FB] -- Timecode of another frame used as a reference (ie: B or P frame). The timecode is relative to the block it's attached to. |
|
207 | +define('EBML_ID_CLUSTERREFERENCEVIRTUAL', 0x7D); // [FD] -- Relative position of the data that should be in position of the virtual block. |
|
208 | 208 | |
209 | 209 | |
210 | 210 | /** |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | class getid3_matroska extends getid3_handler |
217 | 217 | { |
218 | 218 | // public options |
219 | - public static $hide_clusters = true; // if true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful [default: TRUE] |
|
219 | + public static $hide_clusters = true; // if true, do not return information about CLUSTER chunks, since there's a lot of them and they're not usually useful [default: TRUE] |
|
220 | 220 | public static $parse_whole_file = false; // true to parse the whole file, not only header [default: FALSE] |
221 | 221 | |
222 | 222 | // private parser settings/placeholders |
@@ -274,11 +274,11 @@ discard block |
||
274 | 274 | $track_info['display_y'] = (isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight']); |
275 | 275 | |
276 | 276 | if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; } |
277 | - if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; } |
|
278 | - if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; } |
|
279 | - if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; } |
|
277 | + if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; } |
|
278 | + if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; } |
|
279 | + if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; } |
|
280 | 280 | if (isset($trackarray['DefaultDuration'])) { $track_info['frame_rate'] = round(1000000000 / $trackarray['DefaultDuration'], 3); } |
281 | - if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } |
|
281 | + if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } |
|
282 | 282 | |
283 | 283 | switch ($trackarray['CodecID']) { |
284 | 284 | case 'V_MS/VFW/FOURCC': |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | $track_info['sample_rate'] = (isset($trackarray['SamplingFrequency']) ? $trackarray['SamplingFrequency'] : 8000.0); |
321 | 321 | $track_info['channels'] = (isset($trackarray['Channels']) ? $trackarray['Channels'] : 1); |
322 | 322 | $track_info['language'] = (isset($trackarray['Language']) ? $trackarray['Language'] : 'eng'); |
323 | - if (isset($trackarray['BitDepth'])) { $track_info['bits_per_sample'] = $trackarray['BitDepth']; } |
|
323 | + if (isset($trackarray['BitDepth'])) { $track_info['bits_per_sample'] = $trackarray['BitDepth']; } |
|
324 | 324 | if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; } |
325 | 325 | |
326 | 326 | switch ($trackarray['CodecID']) { |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | case 'A_FLAC': |
337 | 337 | getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio.'.($track_info['dataformat'] == 'mp2' ? 'mp3' : $track_info['dataformat']).'.php', __FILE__, true); |
338 | 338 | |
339 | - if (!isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) { |
|
339 | + if ( ! isset($info['matroska']['track_data_offsets'][$trackarray['TrackNumber']])) { |
|
340 | 340 | $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because $info[matroska][track_data_offsets]['.$trackarray['TrackNumber'].'] not set'); |
341 | 341 | break; |
342 | 342 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | else { |
362 | 362 | $getid3_audio->Analyze(); |
363 | 363 | } |
364 | - if (!empty($getid3_temp->info[$header_data_key])) { |
|
364 | + if ( ! empty($getid3_temp->info[$header_data_key])) { |
|
365 | 365 | $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info[$header_data_key]; |
366 | 366 | if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) { |
367 | 367 | foreach ($getid3_temp->info['audio'] as $key => $value) { |
@@ -374,12 +374,12 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | // copy errors and warnings |
377 | - if (!empty($getid3_temp->info['error'])) { |
|
377 | + if ( ! empty($getid3_temp->info['error'])) { |
|
378 | 378 | foreach ($getid3_temp->info['error'] as $newerror) { |
379 | 379 | $this->warning($class.'() says: ['.$newerror.']'); |
380 | 380 | } |
381 | 381 | } |
382 | - if (!empty($getid3_temp->info['warning'])) { |
|
382 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
383 | 383 | foreach ($getid3_temp->info['warning'] as $newerror) { |
384 | 384 | $this->warning($class.'() says: ['.$newerror.']'); |
385 | 385 | } |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | break; |
397 | 397 | |
398 | 398 | case 'A_VORBIS': |
399 | - if (!isset($trackarray['CodecPrivate'])) { |
|
399 | + if ( ! isset($trackarray['CodecPrivate'])) { |
|
400 | 400 | $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because CodecPrivate data not set'); |
401 | 401 | break; |
402 | 402 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $getid3_ogg = new getid3_ogg($getid3_temp); |
417 | 417 | $oggpageinfo['page_seqno'] = 0; |
418 | 418 | $getid3_ogg->ParseVorbisPageHeader($trackarray['CodecPrivate'], $vorbis_offset, $oggpageinfo); |
419 | - if (!empty($getid3_temp->info['ogg'])) { |
|
419 | + if ( ! empty($getid3_temp->info['ogg'])) { |
|
420 | 420 | $info['matroska']['track_codec_parsed'][$trackarray['TrackNumber']] = $getid3_temp->info['ogg']; |
421 | 421 | if (isset($getid3_temp->info['audio']) && is_array($getid3_temp->info['audio'])) { |
422 | 422 | foreach ($getid3_temp->info['audio'] as $key => $value) { |
@@ -426,18 +426,18 @@ discard block |
||
426 | 426 | } |
427 | 427 | |
428 | 428 | // copy errors and warnings |
429 | - if (!empty($getid3_temp->info['error'])) { |
|
429 | + if ( ! empty($getid3_temp->info['error'])) { |
|
430 | 430 | foreach ($getid3_temp->info['error'] as $newerror) { |
431 | 431 | $this->warning('getid3_ogg() says: ['.$newerror.']'); |
432 | 432 | } |
433 | 433 | } |
434 | - if (!empty($getid3_temp->info['warning'])) { |
|
434 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
435 | 435 | foreach ($getid3_temp->info['warning'] as $newerror) { |
436 | 436 | $this->warning('getid3_ogg() says: ['.$newerror.']'); |
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | - if (!empty($getid3_temp->info['ogg']['bitrate_nominal'])) { |
|
440 | + if ( ! empty($getid3_temp->info['ogg']['bitrate_nominal'])) { |
|
441 | 441 | $track_info['bitrate'] = $getid3_temp->info['ogg']['bitrate_nominal']; |
442 | 442 | } |
443 | 443 | unset($getid3_temp, $getid3_ogg, $oggpageinfo, $vorbis_offset); |
@@ -464,10 +464,10 @@ discard block |
||
464 | 464 | } |
465 | 465 | } |
466 | 466 | |
467 | - if (!empty($info['video']['streams'])) { |
|
467 | + if ( ! empty($info['video']['streams'])) { |
|
468 | 468 | $info['video'] = self::getDefaultStreamInfo($info['video']['streams']); |
469 | 469 | } |
470 | - if (!empty($info['audio']['streams'])) { |
|
470 | + if ( ! empty($info['audio']['streams'])) { |
|
471 | 471 | $info['audio'] = self::getDefaultStreamInfo($info['audio']['streams']); |
472 | 472 | } |
473 | 473 | } |
@@ -475,16 +475,16 @@ discard block |
||
475 | 475 | // process attachments |
476 | 476 | if (isset($info['matroska']['attachments']) && $this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE) { |
477 | 477 | foreach ($info['matroska']['attachments'] as $i => $entry) { |
478 | - if (strpos($entry['FileMimeType'], 'image/') === 0 && !empty($entry['FileData'])) { |
|
478 | + if (strpos($entry['FileMimeType'], 'image/') === 0 && ! empty($entry['FileData'])) { |
|
479 | 479 | $info['matroska']['comments']['picture'][] = array('data' => $entry['FileData'], 'image_mime' => $entry['FileMimeType'], 'filename' => $entry['FileName']); |
480 | 480 | } |
481 | 481 | } |
482 | 482 | } |
483 | 483 | |
484 | 484 | // determine mime type |
485 | - if (!empty($info['video']['streams'])) { |
|
485 | + if ( ! empty($info['video']['streams'])) { |
|
486 | 486 | $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'video/webm' : 'video/x-matroska'); |
487 | - } elseif (!empty($info['audio']['streams'])) { |
|
487 | + } elseif ( ! empty($info['audio']['streams'])) { |
|
488 | 488 | $info['mime_type'] = ($info['matroska']['doctype'] == 'webm' ? 'audio/webm' : 'audio/x-matroska'); |
489 | 489 | } elseif (isset($info['mime_type'])) { |
490 | 490 | unset($info['mime_type']); |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $info['matroska']['segment'][0]['length'] = $top_element['length']; |
537 | 537 | |
538 | 538 | while ($this->getEBMLelement($element_data, $top_element['end'])) { |
539 | - if ($element_data['id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required |
|
539 | + if ($element_data['id'] != EBML_ID_CLUSTER || ! self::$hide_clusters) { // collect clusters only if required |
|
540 | 540 | $info['matroska']['segments'][] = $element_data; |
541 | 541 | } |
542 | 542 | switch ($element_data['id']) { |
@@ -561,10 +561,10 @@ discard block |
||
561 | 561 | break; |
562 | 562 | |
563 | 563 | default: |
564 | - $this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry); } |
|
564 | + $this->unhandledElement('seekhead.seek', __LINE__, $sub_seek_entry); } |
|
565 | 565 | } |
566 | 566 | |
567 | - if ($seek_entry['target_id'] != EBML_ID_CLUSTER || !self::$hide_clusters) { // collect clusters only if required |
|
567 | + if ($seek_entry['target_id'] != EBML_ID_CLUSTER || ! self::$hide_clusters) { // collect clusters only if required |
|
568 | 568 | $info['matroska']['seek'][] = $seek_entry; |
569 | 569 | } |
570 | 570 | break; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | break; |
641 | 641 | |
642 | 642 | case EBML_ID_FLAGINTERLACED: |
643 | - $track_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
643 | + $track_entry[$sub_subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
644 | 644 | break; |
645 | 645 | |
646 | 646 | case EBML_ID_GAMMAVALUE: |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | case EBML_ID_EDITIONFLAGHIDDEN: |
1015 | 1015 | case EBML_ID_EDITIONFLAGDEFAULT: |
1016 | 1016 | case EBML_ID_EDITIONFLAGORDERED: |
1017 | - $editionentry_entry[$sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
1017 | + $editionentry_entry[$sub_subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($sub_subelement['data']); |
|
1018 | 1018 | break; |
1019 | 1019 | |
1020 | 1020 | case EBML_ID_CHAPTERATOM: |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | |
1031 | 1031 | case EBML_ID_CHAPTERFLAGENABLED: |
1032 | 1032 | case EBML_ID_CHAPTERFLAGHIDDEN: |
1033 | - $chapteratom_entry[$sub_sub_subelement['id_name']] = (bool)getid3_lib::BigEndian2Int($sub_sub_subelement['data']); |
|
1033 | + $chapteratom_entry[$sub_sub_subelement['id_name']] = (bool) getid3_lib::BigEndian2Int($sub_sub_subelement['data']); |
|
1034 | 1034 | break; |
1035 | 1035 | |
1036 | 1036 | case EBML_ID_CHAPTERUID: |
@@ -1163,12 +1163,12 @@ discard block |
||
1163 | 1163 | } |
1164 | 1164 | $this->current_offset = $subelement['end']; |
1165 | 1165 | } |
1166 | - if (!self::$hide_clusters) { |
|
1166 | + if ( ! self::$hide_clusters) { |
|
1167 | 1167 | $info['matroska']['cluster'][] = $cluster_entry; |
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | // check to see if all the data we need exists already, if so, break out of the loop |
1171 | - if (!self::$parse_whole_file) { |
|
1171 | + if ( ! self::$parse_whole_file) { |
|
1172 | 1172 | if (isset($info['matroska']['info']) && is_array($info['matroska']['info'])) { |
1173 | 1173 | if (isset($info['matroska']['tracks']['tracks']) && is_array($info['matroska']['tracks']['tracks'])) { |
1174 | 1174 | if (count($info['matroska']['track_data_offsets']) == count($info['matroska']['tracks']['tracks'])) { |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | } |
1192 | 1192 | } |
1193 | 1193 | |
1194 | - private function EnsureBufferHasEnoughData($min_data=1024) { |
|
1194 | + private function EnsureBufferHasEnoughData($min_data = 1024) { |
|
1195 | 1195 | if (($this->current_offset - $this->EBMLbuffer_offset) >= ($this->EBMLbuffer_length - $min_data)) { |
1196 | 1196 | $read_bytes = max($min_data, $this->getid3->fread_buffer_size()); |
1197 | 1197 | |
@@ -1217,7 +1217,7 @@ discard block |
||
1217 | 1217 | |
1218 | 1218 | // get length of integer |
1219 | 1219 | $first_byte_int = ord($this->EBMLbuffer[$actual_offset]); |
1220 | - if (0x80 & $first_byte_int) { |
|
1220 | + if (0x80 & $first_byte_int) { |
|
1221 | 1221 | $length = 1; |
1222 | 1222 | } elseif (0x40 & $first_byte_int) { |
1223 | 1223 | $length = 2; |
@@ -1244,8 +1244,8 @@ discard block |
||
1244 | 1244 | return $int_value; |
1245 | 1245 | } |
1246 | 1246 | |
1247 | - private function readEBMLelementData($length, $check_buffer=false) { |
|
1248 | - if ($check_buffer && !$this->EnsureBufferHasEnoughData($length)) { |
|
1247 | + private function readEBMLelementData($length, $check_buffer = false) { |
|
1248 | + if ($check_buffer && ! $this->EnsureBufferHasEnoughData($length)) { |
|
1249 | 1249 | return false; |
1250 | 1250 | } |
1251 | 1251 | $data = substr($this->EBMLbuffer, $this->current_offset - $this->EBMLbuffer_offset, $length); |
@@ -1253,12 +1253,12 @@ discard block |
||
1253 | 1253 | return $data; |
1254 | 1254 | } |
1255 | 1255 | |
1256 | - private function getEBMLelement(&$element, $parent_end, $get_data=false) { |
|
1256 | + private function getEBMLelement(&$element, $parent_end, $get_data = false) { |
|
1257 | 1257 | if ($this->current_offset >= $parent_end) { |
1258 | 1258 | return false; |
1259 | 1259 | } |
1260 | 1260 | |
1261 | - if (!$this->EnsureBufferHasEnoughData()) { |
|
1261 | + if ( ! $this->EnsureBufferHasEnoughData()) { |
|
1262 | 1262 | $this->current_offset = PHP_INT_MAX; // do not exit parser right now, allow to finish current loop to gather maximum information |
1263 | 1263 | return false; |
1264 | 1264 | } |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | |
1283 | 1283 | // get raw data |
1284 | 1284 | $dont_parse = (in_array($element['id'], $this->unuseful_elements) || $element['id_name'] == dechex($element['id'])); |
1285 | - if (($get_data === true || (is_array($get_data) && !in_array($element['id'], $get_data))) && !$dont_parse) { |
|
1285 | + if (($get_data === true || (is_array($get_data) && ! in_array($element['id'], $get_data))) && ! $dont_parse) { |
|
1286 | 1286 | $element['data'] = $this->readEBMLelementData($element['length'], $element); |
1287 | 1287 | } |
1288 | 1288 | |
@@ -1291,23 +1291,23 @@ discard block |
||
1291 | 1291 | |
1292 | 1292 | private function unhandledElement($type, $line, $element) { |
1293 | 1293 | // warn only about unknown and missed elements, not about unuseful |
1294 | - if (!in_array($element['id'], $this->unuseful_elements)) { |
|
1294 | + if ( ! in_array($element['id'], $this->unuseful_elements)) { |
|
1295 | 1295 | $this->warning('Unhandled '.$type.' element ['.basename(__FILE__).':'.$line.'] ('.$element['id'].'::'.$element['id_name'].' ['.$element['length'].' bytes]) at '.$element['offset']); |
1296 | 1296 | } |
1297 | 1297 | |
1298 | 1298 | // increase offset for unparsed elements |
1299 | - if (!isset($element['data'])) { |
|
1299 | + if ( ! isset($element['data'])) { |
|
1300 | 1300 | $this->current_offset = $element['end']; |
1301 | 1301 | } |
1302 | 1302 | } |
1303 | 1303 | |
1304 | 1304 | private function ExtractCommentsSimpleTag($SimpleTagArray) { |
1305 | - if (!empty($SimpleTagArray['SimpleTag'])) { |
|
1305 | + if ( ! empty($SimpleTagArray['SimpleTag'])) { |
|
1306 | 1306 | foreach ($SimpleTagArray['SimpleTag'] as $SimpleTagKey => $SimpleTagData) { |
1307 | - if (!empty($SimpleTagData['TagName']) && !empty($SimpleTagData['TagString'])) { |
|
1307 | + if ( ! empty($SimpleTagData['TagName']) && ! empty($SimpleTagData['TagString'])) { |
|
1308 | 1308 | $this->getid3->info['matroska']['comments'][strtolower($SimpleTagData['TagName'])][] = $SimpleTagData['TagString']; |
1309 | 1309 | } |
1310 | - if (!empty($SimpleTagData['SimpleTag'])) { |
|
1310 | + if ( ! empty($SimpleTagData['SimpleTag'])) { |
|
1311 | 1311 | $this->ExtractCommentsSimpleTag($SimpleTagData); |
1312 | 1312 | } |
1313 | 1313 | } |
@@ -1334,7 +1334,7 @@ discard block |
||
1334 | 1334 | break; |
1335 | 1335 | |
1336 | 1336 | case EBML_ID_TAGDEFAULT: |
1337 | - $simpletag_entry[$element['id_name']] = (bool)getid3_lib::BigEndian2Int($element['data']); |
|
1337 | + $simpletag_entry[$element['id_name']] = (bool) getid3_lib::BigEndian2Int($element['data']); |
|
1338 | 1338 | break; |
1339 | 1339 | |
1340 | 1340 | default: |
@@ -1355,14 +1355,14 @@ discard block |
||
1355 | 1355 | $block_data['flags_raw'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)); |
1356 | 1356 | |
1357 | 1357 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1358 | - $block_data['flags']['keyframe'] = (($block_data['flags_raw'] & 0x80) >> 7); |
|
1358 | + $block_data['flags']['keyframe'] = (($block_data['flags_raw'] & 0x80) >> 7); |
|
1359 | 1359 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0x70) >> 4); |
1360 | 1360 | } |
1361 | 1361 | else { |
1362 | 1362 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0xF0) >> 4); |
1363 | 1363 | } |
1364 | - $block_data['flags']['invisible'] = (bool)(($block_data['flags_raw'] & 0x08) >> 3); |
|
1365 | - $block_data['flags']['lacing'] = (($block_data['flags_raw'] & 0x06) >> 1); // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing |
|
1364 | + $block_data['flags']['invisible'] = (bool) (($block_data['flags_raw'] & 0x08) >> 3); |
|
1365 | + $block_data['flags']['lacing'] = (($block_data['flags_raw'] & 0x06) >> 1); // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing |
|
1366 | 1366 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1367 | 1367 | $block_data['flags']['discardable'] = (($block_data['flags_raw'] & 0x01)); |
1368 | 1368 | } |
@@ -1375,7 +1375,7 @@ discard block |
||
1375 | 1375 | if ($block_data['flags']['lacing'] > 0) { |
1376 | 1376 | $block_data['lace_frames'] = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)) + 1; // Number of frames in the lace-1 (uint8) |
1377 | 1377 | if ($block_data['flags']['lacing'] != 0x02) { |
1378 | - for ($i = 1; $i < $block_data['lace_frames']; $i ++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace). |
|
1378 | + for ($i = 1; $i < $block_data['lace_frames']; $i++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace). |
|
1379 | 1379 | if ($block_data['flags']['lacing'] == 0x03) { // EBML lacing |
1380 | 1380 | $block_data['lace_frames_size'][$i] = $this->readEBMLint(); // TODO: read size correctly, calc size for the last frame. For now offsets are deteminded OK with readEBMLint() and that's the most important thing. |
1381 | 1381 | } |
@@ -1394,7 +1394,7 @@ discard block |
||
1394 | 1394 | } |
1395 | 1395 | } |
1396 | 1396 | |
1397 | - if (!isset($info['matroska']['track_data_offsets'][$block_data['tracknumber']])) { |
|
1397 | + if ( ! isset($info['matroska']['track_data_offsets'][$block_data['tracknumber']])) { |
|
1398 | 1398 | $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['offset'] = $this->current_offset; |
1399 | 1399 | $info['matroska']['track_data_offsets'][$block_data['tracknumber']]['length'] = $element['end'] - $this->current_offset; |
1400 | 1400 | //$info['matroska']['track_data_offsets'][$block_data['tracknumber']]['total_length'] = 0; |
@@ -1460,13 +1460,13 @@ discard block |
||
1460 | 1460 | // http://www.matroska.org/technical/specs/tagging/index.html |
1461 | 1461 | static $TargetTypeValue = array(); |
1462 | 1462 | if (empty($TargetTypeValue)) { |
1463 | - $TargetTypeValue[10] = 'A: ~ V:shot'; // the lowest hierarchy found in music or movies |
|
1464 | - $TargetTypeValue[20] = 'A:subtrack/part/movement ~ V:scene'; // corresponds to parts of a track for audio (like a movement) |
|
1465 | - $TargetTypeValue[30] = 'A:track/song ~ V:chapter'; // the common parts of an album or a movie |
|
1466 | - $TargetTypeValue[40] = 'A:part/session ~ V:part/session'; // when an album or episode has different logical parts |
|
1467 | - $TargetTypeValue[50] = 'A:album/opera/concert ~ V:movie/episode/concert'; // the most common grouping level of music and video (equals to an episode for TV series) |
|
1468 | - $TargetTypeValue[60] = 'A:edition/issue/volume/opus ~ V:season/sequel/volume'; // a list of lower levels grouped together |
|
1469 | - $TargetTypeValue[70] = 'A:collection ~ V:collection'; // the high hierarchy consisting of many different lower items |
|
1463 | + $TargetTypeValue[10] = 'A: ~ V:shot'; // the lowest hierarchy found in music or movies |
|
1464 | + $TargetTypeValue[20] = 'A:subtrack/part/movement ~ V:scene'; // corresponds to parts of a track for audio (like a movement) |
|
1465 | + $TargetTypeValue[30] = 'A:track/song ~ V:chapter'; // the common parts of an album or a movie |
|
1466 | + $TargetTypeValue[40] = 'A:part/session ~ V:part/session'; // when an album or episode has different logical parts |
|
1467 | + $TargetTypeValue[50] = 'A:album/opera/concert ~ V:movie/episode/concert'; // the most common grouping level of music and video (equals to an episode for TV series) |
|
1468 | + $TargetTypeValue[60] = 'A:edition/issue/volume/opus ~ V:season/sequel/volume'; // a list of lower levels grouped together |
|
1469 | + $TargetTypeValue[70] = 'A:collection ~ V:collection'; // the high hierarchy consisting of many different lower items |
|
1470 | 1470 | } |
1471 | 1471 | return (isset($TargetTypeValue[$target_type]) ? $TargetTypeValue[$target_type] : $target_type); |
1472 | 1472 | } |
@@ -1495,8 +1495,8 @@ discard block |
||
1495 | 1495 | $CodecIDlist['A_MPEG/L1'] = 'mp1'; |
1496 | 1496 | $CodecIDlist['A_MPEG/L2'] = 'mp2'; |
1497 | 1497 | $CodecIDlist['A_MPEG/L3'] = 'mp3'; |
1498 | - $CodecIDlist['A_PCM/INT/LIT'] = 'pcm'; // PCM Integer Little Endian |
|
1499 | - $CodecIDlist['A_PCM/INT/BIG'] = 'pcm'; // PCM Integer Big Endian |
|
1498 | + $CodecIDlist['A_PCM/INT/LIT'] = 'pcm'; // PCM Integer Little Endian |
|
1499 | + $CodecIDlist['A_PCM/INT/BIG'] = 'pcm'; // PCM Integer Big Endian |
|
1500 | 1500 | $CodecIDlist['A_QUICKTIME/QDMC'] = 'quicktime'; // Quicktime: QDesign Music |
1501 | 1501 | $CodecIDlist['A_QUICKTIME/QDM2'] = 'quicktime'; // Quicktime: QDesign Music v2 |
1502 | 1502 | $CodecIDlist['A_VORBIS'] = 'vorbis'; |
@@ -357,8 +357,7 @@ discard block |
||
357 | 357 | $getid3_audio = new $class($getid3_temp, __CLASS__); |
358 | 358 | if ($track_info['dataformat'] == 'flac') { |
359 | 359 | $getid3_audio->AnalyzeString($trackarray['CodecPrivate']); |
360 | - } |
|
361 | - else { |
|
360 | + } else { |
|
362 | 361 | $getid3_audio->Analyze(); |
363 | 362 | } |
364 | 363 | if (!empty($getid3_temp->info[$header_data_key])) { |
@@ -368,8 +367,7 @@ discard block |
||
368 | 367 | $track_info[$key] = $value; |
369 | 368 | } |
370 | 369 | } |
371 | - } |
|
372 | - else { |
|
370 | + } else { |
|
373 | 371 | $this->warning('Unable to parse audio data ['.basename(__FILE__).':'.__LINE__.'] because '.$class.'::Analyze() failed at offset '.$getid3_temp->info['avdataoffset']); |
374 | 372 | } |
375 | 373 | |
@@ -1357,16 +1355,14 @@ discard block |
||
1357 | 1355 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1358 | 1356 | $block_data['flags']['keyframe'] = (($block_data['flags_raw'] & 0x80) >> 7); |
1359 | 1357 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0x70) >> 4); |
1360 | - } |
|
1361 | - else { |
|
1358 | + } else { |
|
1362 | 1359 | //$block_data['flags']['reserved1'] = (($block_data['flags_raw'] & 0xF0) >> 4); |
1363 | 1360 | } |
1364 | 1361 | $block_data['flags']['invisible'] = (bool)(($block_data['flags_raw'] & 0x08) >> 3); |
1365 | 1362 | $block_data['flags']['lacing'] = (($block_data['flags_raw'] & 0x06) >> 1); // 00=no lacing; 01=Xiph lacing; 11=EBML lacing; 10=fixed-size lacing |
1366 | 1363 | if ($block_type == EBML_ID_CLUSTERSIMPLEBLOCK) { |
1367 | 1364 | $block_data['flags']['discardable'] = (($block_data['flags_raw'] & 0x01)); |
1368 | - } |
|
1369 | - else { |
|
1365 | + } else { |
|
1370 | 1366 | //$block_data['flags']['reserved2'] = (($block_data['flags_raw'] & 0x01) >> 0); |
1371 | 1367 | } |
1372 | 1368 | $block_data['flags']['lacing_type'] = self::BlockLacingType($block_data['flags']['lacing']); |
@@ -1378,8 +1374,7 @@ discard block |
||
1378 | 1374 | for ($i = 1; $i < $block_data['lace_frames']; $i ++) { // Lace-coded size of each frame of the lace, except for the last one (multiple uint8). *This is not used with Fixed-size lacing as it is calculated automatically from (total size of lace) / (number of frames in lace). |
1379 | 1375 | if ($block_data['flags']['lacing'] == 0x03) { // EBML lacing |
1380 | 1376 | $block_data['lace_frames_size'][$i] = $this->readEBMLint(); // TODO: read size correctly, calc size for the last frame. For now offsets are deteminded OK with readEBMLint() and that's the most important thing. |
1381 | - } |
|
1382 | - else { // Xiph lacing |
|
1377 | + } else { // Xiph lacing |
|
1383 | 1378 | $block_data['lace_frames_size'][$i] = 0; |
1384 | 1379 | do { |
1385 | 1380 | $size = getid3_lib::BigEndian2Int($this->readEBMLelementData(1)); |
@@ -118,6 +118,10 @@ discard block |
||
118 | 118 | return true; |
119 | 119 | } |
120 | 120 | |
121 | + /** |
|
122 | + * @param string $atomname |
|
123 | + * @param string $atom_data |
|
124 | + */ |
|
121 | 125 | public function QuicktimeParseAtom($atomname, $atomsize, $atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { |
122 | 126 | // http://developer.apple.com/techpubs/quicktime/qtdevdocs/APIREF/INDEX/atomalphaindex.htm |
123 | 127 | |
@@ -1424,6 +1428,9 @@ discard block |
||
1424 | 1428 | return $atom_structure; |
1425 | 1429 | } |
1426 | 1430 | |
1431 | + /** |
|
1432 | + * @param integer $baseoffset |
|
1433 | + */ |
|
1427 | 1434 | public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { |
1428 | 1435 | //echo 'QuicktimeParseContainerAtom('.substr($atom_data, 4, 4).') @ '.$baseoffset.'<br><br>'; |
1429 | 1436 | $atom_structure = false; |
@@ -1452,6 +1459,9 @@ discard block |
||
1452 | 1459 | } |
1453 | 1460 | |
1454 | 1461 | |
1462 | + /** |
|
1463 | + * @param integer $offset |
|
1464 | + */ |
|
1455 | 1465 | public function quicktime_read_mp4_descr_length($data, &$offset) { |
1456 | 1466 | // http://libquicktime.sourcearchive.com/documentation/2:1.0.2plus-pdebian-2build1/esds_8c-source.html |
1457 | 1467 | $num_bytes = 0; |
@@ -2230,6 +2240,9 @@ discard block |
||
2230 | 2240 | return true; |
2231 | 2241 | } |
2232 | 2242 | |
2243 | + /** |
|
2244 | + * @param string $nullterminatedstring |
|
2245 | + */ |
|
2233 | 2246 | public function NoNullString($nullterminatedstring) { |
2234 | 2247 | // remove the single null terminator on null terminated strings |
2235 | 2248 | if (substr($nullterminatedstring, strlen($nullterminatedstring) - 1, 1) === "\x00") { |
@@ -2238,6 +2251,9 @@ discard block |
||
2238 | 2251 | return $nullterminatedstring; |
2239 | 2252 | } |
2240 | 2253 | |
2254 | + /** |
|
2255 | + * @param string $pascalstring |
|
2256 | + */ |
|
2241 | 2257 | public function Pascal2String($pascalstring) { |
2242 | 2258 | // Pascal strings have 1 unsigned byte at the beginning saying how many chars (1-255) are in the string |
2243 | 2259 | return substr($pascalstring, 1); |
@@ -1402,9 +1402,9 @@ discard block |
||
1402 | 1402 | // mdta keys \005 mdtacom.apple.quicktime.make (mdtacom.apple.quicktime.creationdate ,mdtacom.apple.quicktime.location.ISO6709 $mdtacom.apple.quicktime.software !mdtacom.apple.quicktime.model ilst \01D \001 \015data \001DE\010Apple 0 \002 (data \001DE\0102011-05-11T17:54:04+0200 2 \003 *data \001DE\010+52.4936+013.3897+040.247/ \01D \004 \015data \001DE\0104.3.1 \005 \018data \001DE\010iPhone 4 |
1403 | 1403 | // http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt |
1404 | 1404 | |
1405 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1406 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1407 | - $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
|
1405 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1406 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1407 | + $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
|
1408 | 1408 | //$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
1409 | 1409 | break; |
1410 | 1410 | |
@@ -1753,56 +1753,56 @@ discard block |
||
1753 | 1753 | static $QuicktimeIODSaudioProfileNameLookup = array(); |
1754 | 1754 | if (empty($QuicktimeIODSaudioProfileNameLookup)) { |
1755 | 1755 | $QuicktimeIODSaudioProfileNameLookup = array( |
1756 | - 0x00 => 'ISO Reserved (0x00)', |
|
1757 | - 0x01 => 'Main Audio Profile @ Level 1', |
|
1758 | - 0x02 => 'Main Audio Profile @ Level 2', |
|
1759 | - 0x03 => 'Main Audio Profile @ Level 3', |
|
1760 | - 0x04 => 'Main Audio Profile @ Level 4', |
|
1761 | - 0x05 => 'Scalable Audio Profile @ Level 1', |
|
1762 | - 0x06 => 'Scalable Audio Profile @ Level 2', |
|
1763 | - 0x07 => 'Scalable Audio Profile @ Level 3', |
|
1764 | - 0x08 => 'Scalable Audio Profile @ Level 4', |
|
1765 | - 0x09 => 'Speech Audio Profile @ Level 1', |
|
1766 | - 0x0A => 'Speech Audio Profile @ Level 2', |
|
1767 | - 0x0B => 'Synthetic Audio Profile @ Level 1', |
|
1768 | - 0x0C => 'Synthetic Audio Profile @ Level 2', |
|
1769 | - 0x0D => 'Synthetic Audio Profile @ Level 3', |
|
1770 | - 0x0E => 'High Quality Audio Profile @ Level 1', |
|
1771 | - 0x0F => 'High Quality Audio Profile @ Level 2', |
|
1772 | - 0x10 => 'High Quality Audio Profile @ Level 3', |
|
1773 | - 0x11 => 'High Quality Audio Profile @ Level 4', |
|
1774 | - 0x12 => 'High Quality Audio Profile @ Level 5', |
|
1775 | - 0x13 => 'High Quality Audio Profile @ Level 6', |
|
1776 | - 0x14 => 'High Quality Audio Profile @ Level 7', |
|
1777 | - 0x15 => 'High Quality Audio Profile @ Level 8', |
|
1778 | - 0x16 => 'Low Delay Audio Profile @ Level 1', |
|
1779 | - 0x17 => 'Low Delay Audio Profile @ Level 2', |
|
1780 | - 0x18 => 'Low Delay Audio Profile @ Level 3', |
|
1781 | - 0x19 => 'Low Delay Audio Profile @ Level 4', |
|
1782 | - 0x1A => 'Low Delay Audio Profile @ Level 5', |
|
1783 | - 0x1B => 'Low Delay Audio Profile @ Level 6', |
|
1784 | - 0x1C => 'Low Delay Audio Profile @ Level 7', |
|
1785 | - 0x1D => 'Low Delay Audio Profile @ Level 8', |
|
1786 | - 0x1E => 'Natural Audio Profile @ Level 1', |
|
1787 | - 0x1F => 'Natural Audio Profile @ Level 2', |
|
1788 | - 0x20 => 'Natural Audio Profile @ Level 3', |
|
1789 | - 0x21 => 'Natural Audio Profile @ Level 4', |
|
1790 | - 0x22 => 'Mobile Audio Internetworking Profile @ Level 1', |
|
1791 | - 0x23 => 'Mobile Audio Internetworking Profile @ Level 2', |
|
1792 | - 0x24 => 'Mobile Audio Internetworking Profile @ Level 3', |
|
1793 | - 0x25 => 'Mobile Audio Internetworking Profile @ Level 4', |
|
1794 | - 0x26 => 'Mobile Audio Internetworking Profile @ Level 5', |
|
1795 | - 0x27 => 'Mobile Audio Internetworking Profile @ Level 6', |
|
1796 | - 0x28 => 'AAC Profile @ Level 1', |
|
1797 | - 0x29 => 'AAC Profile @ Level 2', |
|
1798 | - 0x2A => 'AAC Profile @ Level 4', |
|
1799 | - 0x2B => 'AAC Profile @ Level 5', |
|
1800 | - 0x2C => 'High Efficiency AAC Profile @ Level 2', |
|
1801 | - 0x2D => 'High Efficiency AAC Profile @ Level 3', |
|
1802 | - 0x2E => 'High Efficiency AAC Profile @ Level 4', |
|
1803 | - 0x2F => 'High Efficiency AAC Profile @ Level 5', |
|
1804 | - 0xFE => 'Not part of MPEG-4 audio profiles', |
|
1805 | - 0xFF => 'No audio capability required', |
|
1756 | + 0x00 => 'ISO Reserved (0x00)', |
|
1757 | + 0x01 => 'Main Audio Profile @ Level 1', |
|
1758 | + 0x02 => 'Main Audio Profile @ Level 2', |
|
1759 | + 0x03 => 'Main Audio Profile @ Level 3', |
|
1760 | + 0x04 => 'Main Audio Profile @ Level 4', |
|
1761 | + 0x05 => 'Scalable Audio Profile @ Level 1', |
|
1762 | + 0x06 => 'Scalable Audio Profile @ Level 2', |
|
1763 | + 0x07 => 'Scalable Audio Profile @ Level 3', |
|
1764 | + 0x08 => 'Scalable Audio Profile @ Level 4', |
|
1765 | + 0x09 => 'Speech Audio Profile @ Level 1', |
|
1766 | + 0x0A => 'Speech Audio Profile @ Level 2', |
|
1767 | + 0x0B => 'Synthetic Audio Profile @ Level 1', |
|
1768 | + 0x0C => 'Synthetic Audio Profile @ Level 2', |
|
1769 | + 0x0D => 'Synthetic Audio Profile @ Level 3', |
|
1770 | + 0x0E => 'High Quality Audio Profile @ Level 1', |
|
1771 | + 0x0F => 'High Quality Audio Profile @ Level 2', |
|
1772 | + 0x10 => 'High Quality Audio Profile @ Level 3', |
|
1773 | + 0x11 => 'High Quality Audio Profile @ Level 4', |
|
1774 | + 0x12 => 'High Quality Audio Profile @ Level 5', |
|
1775 | + 0x13 => 'High Quality Audio Profile @ Level 6', |
|
1776 | + 0x14 => 'High Quality Audio Profile @ Level 7', |
|
1777 | + 0x15 => 'High Quality Audio Profile @ Level 8', |
|
1778 | + 0x16 => 'Low Delay Audio Profile @ Level 1', |
|
1779 | + 0x17 => 'Low Delay Audio Profile @ Level 2', |
|
1780 | + 0x18 => 'Low Delay Audio Profile @ Level 3', |
|
1781 | + 0x19 => 'Low Delay Audio Profile @ Level 4', |
|
1782 | + 0x1A => 'Low Delay Audio Profile @ Level 5', |
|
1783 | + 0x1B => 'Low Delay Audio Profile @ Level 6', |
|
1784 | + 0x1C => 'Low Delay Audio Profile @ Level 7', |
|
1785 | + 0x1D => 'Low Delay Audio Profile @ Level 8', |
|
1786 | + 0x1E => 'Natural Audio Profile @ Level 1', |
|
1787 | + 0x1F => 'Natural Audio Profile @ Level 2', |
|
1788 | + 0x20 => 'Natural Audio Profile @ Level 3', |
|
1789 | + 0x21 => 'Natural Audio Profile @ Level 4', |
|
1790 | + 0x22 => 'Mobile Audio Internetworking Profile @ Level 1', |
|
1791 | + 0x23 => 'Mobile Audio Internetworking Profile @ Level 2', |
|
1792 | + 0x24 => 'Mobile Audio Internetworking Profile @ Level 3', |
|
1793 | + 0x25 => 'Mobile Audio Internetworking Profile @ Level 4', |
|
1794 | + 0x26 => 'Mobile Audio Internetworking Profile @ Level 5', |
|
1795 | + 0x27 => 'Mobile Audio Internetworking Profile @ Level 6', |
|
1796 | + 0x28 => 'AAC Profile @ Level 1', |
|
1797 | + 0x29 => 'AAC Profile @ Level 2', |
|
1798 | + 0x2A => 'AAC Profile @ Level 4', |
|
1799 | + 0x2B => 'AAC Profile @ Level 5', |
|
1800 | + 0x2C => 'High Efficiency AAC Profile @ Level 2', |
|
1801 | + 0x2D => 'High Efficiency AAC Profile @ Level 3', |
|
1802 | + 0x2E => 'High Efficiency AAC Profile @ Level 4', |
|
1803 | + 0x2F => 'High Efficiency AAC Profile @ Level 5', |
|
1804 | + 0xFE => 'Not part of MPEG-4 audio profiles', |
|
1805 | + 0xFF => 'No audio capability required', |
|
1806 | 1806 | ); |
1807 | 1807 | } |
1808 | 1808 | return (isset($QuicktimeIODSaudioProfileNameLookup[$audio_profile_id]) ? $QuicktimeIODSaudioProfileNameLookup[$audio_profile_id] : 'ISO Reserved / User Private'); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $atomcounter = 0; |
38 | 38 | $atom_data_read_buffer_size = ($info['php_memory_limit'] ? round($info['php_memory_limit'] / 2) : $this->getid3->option_fread_buffer_size * 1024); // allow [default: 32MB] if PHP configured with no memory_limit |
39 | 39 | while ($offset < $info['avdataend']) { |
40 | - if (!getid3_lib::intValueSupported($offset)) { |
|
40 | + if ( ! getid3_lib::intValueSupported($offset)) { |
|
41 | 41 | $info['error'][] = 'Unable to parse atom at offset '.$offset.' because beyond '.round(PHP_INT_MAX / 1073741824).'GB limit of PHP filesystem functions'; |
42 | 42 | break; |
43 | 43 | } |
@@ -74,20 +74,20 @@ discard block |
||
74 | 74 | $atomcounter++; |
75 | 75 | } |
76 | 76 | |
77 | - if (!empty($info['avdataend_tmp'])) { |
|
77 | + if ( ! empty($info['avdataend_tmp'])) { |
|
78 | 78 | // this value is assigned to a temp value and then erased because |
79 | 79 | // otherwise any atoms beyond the 'mdat' atom would not get parsed |
80 | 80 | $info['avdataend'] = $info['avdataend_tmp']; |
81 | 81 | unset($info['avdataend_tmp']); |
82 | 82 | } |
83 | 83 | |
84 | - if (!isset($info['bitrate']) && isset($info['playtime_seconds'])) { |
|
84 | + if ( ! isset($info['bitrate']) && isset($info['playtime_seconds'])) { |
|
85 | 85 | $info['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; |
86 | 86 | } |
87 | - if (isset($info['bitrate']) && !isset($info['audio']['bitrate']) && !isset($info['quicktime']['video'])) { |
|
87 | + if (isset($info['bitrate']) && ! isset($info['audio']['bitrate']) && ! isset($info['quicktime']['video'])) { |
|
88 | 88 | $info['audio']['bitrate'] = $info['bitrate']; |
89 | 89 | } |
90 | - if (!empty($info['playtime_seconds']) && !isset($info['video']['frame_rate']) && !empty($info['quicktime']['stts_framecount'])) { |
|
90 | + if ( ! empty($info['playtime_seconds']) && ! isset($info['video']['frame_rate']) && ! empty($info['quicktime']['stts_framecount'])) { |
|
91 | 91 | foreach ($info['quicktime']['stts_framecount'] as $key => $samples_count) { |
92 | 92 | $samples_per_second = $samples_count / $info['playtime_seconds']; |
93 | 93 | if ($samples_per_second > 240) { |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | unset($info['video']['dataformat']); |
105 | 105 | } |
106 | 106 | |
107 | - if (!$this->ReturnAtomData) { |
|
107 | + if ( ! $this->ReturnAtomData) { |
|
108 | 108 | unset($info['quicktime']['moov']); |
109 | 109 | } |
110 | 110 | |
111 | - if (empty($info['audio']['dataformat']) && !empty($info['quicktime']['audio'])) { |
|
111 | + if (empty($info['audio']['dataformat']) && ! empty($info['quicktime']['audio'])) { |
|
112 | 112 | $info['audio']['dataformat'] = 'quicktime'; |
113 | 113 | } |
114 | - if (empty($info['video']['dataformat']) && !empty($info['quicktime']['video'])) { |
|
114 | + if (empty($info['video']['dataformat']) && ! empty($info['quicktime']['video'])) { |
|
115 | 115 | $info['video']['dataformat'] = 'quicktime'; |
116 | 116 | } |
117 | 117 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // some "ilst" atoms contain data atoms that have a numeric name, and the data is far more accessible if the returned array is compacted |
153 | 153 | $allnumericnames = true; |
154 | 154 | foreach ($atom_structure['subatoms'] as $subatomarray) { |
155 | - if (!is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) { |
|
155 | + if ( ! is_integer($subatomarray['name']) || (count($subatomarray['subatoms']) != 1)) { |
|
156 | 156 | $allnumericnames = false; |
157 | 157 | break; |
158 | 158 | } |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | // User data atom handler |
302 | 302 | $atom_structure['data_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); |
303 | 303 | $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); |
304 | - $atom_structure['data'] = substr($atom_data, 4); |
|
304 | + $atom_structure['data'] = substr($atom_data, 4); |
|
305 | 305 | |
306 | 306 | $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); |
307 | - if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { |
|
307 | + if (empty($info['comments']['language']) || ( ! in_array($atom_structure['language'], $info['comments']['language']))) { |
|
308 | 308 | $info['comments']['language'][] = $atom_structure['language']; |
309 | 309 | } |
310 | 310 | } else { |
@@ -314,9 +314,9 @@ discard block |
||
314 | 314 | // not sure what it means, but observed on iPhone4 data. |
315 | 315 | // Each $atom_data has 2 bytes of datasize, plus 0x10B5, then data |
316 | 316 | while ($atomoffset < strlen($atom_data)) { |
317 | - $boxsmallsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 2)); |
|
318 | - $boxsmalltype = substr($atom_data, $atomoffset + 2, 2); |
|
319 | - $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize); |
|
317 | + $boxsmallsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 2)); |
|
318 | + $boxsmalltype = substr($atom_data, $atomoffset + 2, 2); |
|
319 | + $boxsmalldata = substr($atom_data, $atomoffset + 4, $boxsmallsize); |
|
320 | 320 | if ($boxsmallsize <= 1) { |
321 | 321 | $info['warning'][] = 'Invalid QuickTime atom smallbox size "'.$boxsmallsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset); |
322 | 322 | $atom_structure['data'] = null; |
@@ -337,8 +337,8 @@ discard block |
||
337 | 337 | } else { |
338 | 338 | while ($atomoffset < strlen($atom_data)) { |
339 | 339 | $boxsize = getid3_lib::BigEndian2Int(substr($atom_data, $atomoffset, 4)); |
340 | - $boxtype = substr($atom_data, $atomoffset + 4, 4); |
|
341 | - $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8); |
|
340 | + $boxtype = substr($atom_data, $atomoffset + 4, 4); |
|
341 | + $boxdata = substr($atom_data, $atomoffset + 8, $boxsize - 8); |
|
342 | 342 | if ($boxsize <= 1) { |
343 | 343 | $info['warning'][] = 'Invalid QuickTime atom box size "'.$boxsize.'" in atom "'.preg_replace('#[^a-zA-Z0-9 _\\-]#', '?', $atomname).'" at offset: '.($atom_structure['offset'] + $atomoffset); |
344 | 344 | $atom_structure['data'] = null; |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | break; |
355 | 355 | |
356 | 356 | case 'data': |
357 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1)); |
|
358 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3)); |
|
357 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($boxdata, 0, 1)); |
|
358 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($boxdata, 1, 3)); |
|
359 | 359 | switch ($atom_structure['flags_raw']) { |
360 | 360 | case 0: // data flag |
361 | 361 | case 21: // tmpo/cpil flag |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | |
381 | 381 | case 'gnre': |
382 | 382 | $GenreID = getid3_lib::BigEndian2Int(substr($boxdata, 8, 4)); |
383 | - $atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1); |
|
383 | + $atom_structure['data'] = getid3_id3v1::LookupGenreName($GenreID - 1); |
|
384 | 384 | break; |
385 | 385 | |
386 | 386 | case 'rtng': |
@@ -440,15 +440,15 @@ discard block |
||
440 | 440 | |
441 | 441 | |
442 | 442 | case 'play': // auto-PLAY atom |
443 | - $atom_structure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
443 | + $atom_structure['autoplay'] = (bool) getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
444 | 444 | |
445 | 445 | $info['quicktime']['autoplay'] = $atom_structure['autoplay']; |
446 | 446 | break; |
447 | 447 | |
448 | 448 | |
449 | 449 | case 'WLOC': // Window LOCation atom |
450 | - $atom_structure['location_x'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); |
|
451 | - $atom_structure['location_y'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); |
|
450 | + $atom_structure['location_x'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); |
|
451 | + $atom_structure['location_y'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 2)); |
|
452 | 452 | break; |
453 | 453 | |
454 | 454 | |
@@ -488,27 +488,27 @@ discard block |
||
488 | 488 | |
489 | 489 | |
490 | 490 | case 'rdrf': // Reference movie Data ReFerence atom |
491 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
492 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
491 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
492 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
493 | 493 | $atom_structure['flags']['internal_data'] = (bool) ($atom_structure['flags_raw'] & 0x000001); |
494 | 494 | |
495 | - $atom_structure['reference_type_name'] = substr($atom_data, 4, 4); |
|
496 | - $atom_structure['reference_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
495 | + $atom_structure['reference_type_name'] = substr($atom_data, 4, 4); |
|
496 | + $atom_structure['reference_length'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
497 | 497 | switch ($atom_structure['reference_type_name']) { |
498 | 498 | case 'url ': |
499 | - $atom_structure['url'] = $this->NoNullString(substr($atom_data, 12)); |
|
499 | + $atom_structure['url'] = $this->NoNullString(substr($atom_data, 12)); |
|
500 | 500 | break; |
501 | 501 | |
502 | 502 | case 'alis': |
503 | - $atom_structure['file_alias'] = substr($atom_data, 12); |
|
503 | + $atom_structure['file_alias'] = substr($atom_data, 12); |
|
504 | 504 | break; |
505 | 505 | |
506 | 506 | case 'rsrc': |
507 | - $atom_structure['resource_alias'] = substr($atom_data, 12); |
|
507 | + $atom_structure['resource_alias'] = substr($atom_data, 12); |
|
508 | 508 | break; |
509 | 509 | |
510 | 510 | default: |
511 | - $atom_structure['data'] = substr($atom_data, 12); |
|
511 | + $atom_structure['data'] = substr($atom_data, 12); |
|
512 | 512 | break; |
513 | 513 | } |
514 | 514 | break; |
@@ -520,28 +520,28 @@ discard block |
||
520 | 520 | |
521 | 521 | |
522 | 522 | case 'rmcs': // Reference Movie Cpu Speed atom |
523 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
524 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
525 | - $atom_structure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
523 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
524 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
525 | + $atom_structure['cpu_speed_rating'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
526 | 526 | break; |
527 | 527 | |
528 | 528 | |
529 | 529 | case 'rmvc': // Reference Movie Version Check atom |
530 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
531 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
532 | - $atom_structure['gestalt_selector'] = substr($atom_data, 4, 4); |
|
533 | - $atom_structure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
530 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
531 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
532 | + $atom_structure['gestalt_selector'] = substr($atom_data, 4, 4); |
|
533 | + $atom_structure['gestalt_value_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
534 | 534 | $atom_structure['gestalt_value'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
535 | 535 | $atom_structure['gestalt_check_type'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2)); |
536 | 536 | break; |
537 | 537 | |
538 | 538 | |
539 | 539 | case 'rmcd': // Reference Movie Component check atom |
540 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
541 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
542 | - $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
543 | - $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
544 | - $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
540 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
541 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
542 | + $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
543 | + $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
544 | + $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
545 | 545 | $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
546 | 546 | $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
547 | 547 | $atom_structure['component_min_version'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 4)); |
@@ -549,30 +549,30 @@ discard block |
||
549 | 549 | |
550 | 550 | |
551 | 551 | case 'rmdr': // Reference Movie Data Rate atom |
552 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
553 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
554 | - $atom_structure['data_rate'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
552 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
553 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
554 | + $atom_structure['data_rate'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
555 | 555 | |
556 | 556 | $atom_structure['data_rate_bps'] = $atom_structure['data_rate'] * 10; |
557 | 557 | break; |
558 | 558 | |
559 | 559 | |
560 | 560 | case 'rmla': // Reference Movie Language Atom |
561 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
562 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
563 | - $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
561 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
562 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
563 | + $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
564 | 564 | |
565 | 565 | $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); |
566 | - if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { |
|
566 | + if (empty($info['comments']['language']) || ( ! in_array($atom_structure['language'], $info['comments']['language']))) { |
|
567 | 567 | $info['comments']['language'][] = $atom_structure['language']; |
568 | 568 | } |
569 | 569 | break; |
570 | 570 | |
571 | 571 | |
572 | 572 | case 'rmla': // Reference Movie Language Atom |
573 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
574 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
575 | - $atom_structure['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
573 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
574 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
575 | + $atom_structure['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
576 | 576 | break; |
577 | 577 | |
578 | 578 | |
@@ -601,49 +601,49 @@ discard block |
||
601 | 601 | |
602 | 602 | |
603 | 603 | case 'stsd': // Sample Table Sample Description atom |
604 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
605 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
606 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
604 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
605 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
606 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
607 | 607 | $stsdEntriesDataOffset = 8; |
608 | 608 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
609 | 609 | $atom_structure['sample_description_table'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 4)); |
610 | 610 | $stsdEntriesDataOffset += 4; |
611 | - $atom_structure['sample_description_table'][$i]['data_format'] = substr($atom_data, $stsdEntriesDataOffset, 4); |
|
611 | + $atom_structure['sample_description_table'][$i]['data_format'] = substr($atom_data, $stsdEntriesDataOffset, 4); |
|
612 | 612 | $stsdEntriesDataOffset += 4; |
613 | 613 | $atom_structure['sample_description_table'][$i]['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 6)); |
614 | 614 | $stsdEntriesDataOffset += 6; |
615 | 615 | $atom_structure['sample_description_table'][$i]['reference_index'] = getid3_lib::BigEndian2Int(substr($atom_data, $stsdEntriesDataOffset, 2)); |
616 | 616 | $stsdEntriesDataOffset += 2; |
617 | - $atom_structure['sample_description_table'][$i]['data'] = substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2)); |
|
617 | + $atom_structure['sample_description_table'][$i]['data'] = substr($atom_data, $stsdEntriesDataOffset, ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2)); |
|
618 | 618 | $stsdEntriesDataOffset += ($atom_structure['sample_description_table'][$i]['size'] - 4 - 4 - 6 - 2); |
619 | 619 | |
620 | - $atom_structure['sample_description_table'][$i]['encoder_version'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 0, 2)); |
|
621 | - $atom_structure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 2, 2)); |
|
622 | - $atom_structure['sample_description_table'][$i]['encoder_vendor'] = substr($atom_structure['sample_description_table'][$i]['data'], 4, 4); |
|
620 | + $atom_structure['sample_description_table'][$i]['encoder_version'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 0, 2)); |
|
621 | + $atom_structure['sample_description_table'][$i]['encoder_revision'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 2, 2)); |
|
622 | + $atom_structure['sample_description_table'][$i]['encoder_vendor'] = substr($atom_structure['sample_description_table'][$i]['data'], 4, 4); |
|
623 | 623 | |
624 | 624 | switch ($atom_structure['sample_description_table'][$i]['encoder_vendor']) { |
625 | 625 | |
626 | 626 | case "\x00\x00\x00\x00": |
627 | 627 | // audio tracks |
628 | - $atom_structure['sample_description_table'][$i]['audio_channels'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 2)); |
|
629 | - $atom_structure['sample_description_table'][$i]['audio_bit_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 10, 2)); |
|
630 | - $atom_structure['sample_description_table'][$i]['audio_compression_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 2)); |
|
631 | - $atom_structure['sample_description_table'][$i]['audio_packet_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 14, 2)); |
|
632 | - $atom_structure['sample_description_table'][$i]['audio_sample_rate'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 16, 4)); |
|
628 | + $atom_structure['sample_description_table'][$i]['audio_channels'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 2)); |
|
629 | + $atom_structure['sample_description_table'][$i]['audio_bit_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 10, 2)); |
|
630 | + $atom_structure['sample_description_table'][$i]['audio_compression_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 2)); |
|
631 | + $atom_structure['sample_description_table'][$i]['audio_packet_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 14, 2)); |
|
632 | + $atom_structure['sample_description_table'][$i]['audio_sample_rate'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 16, 4)); |
|
633 | 633 | |
634 | 634 | // video tracks |
635 | 635 | // http://developer.apple.com/library/mac/#documentation/QuickTime/QTFF/QTFFChap3/qtff3.html |
636 | - $atom_structure['sample_description_table'][$i]['temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
637 | - $atom_structure['sample_description_table'][$i]['spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
638 | - $atom_structure['sample_description_table'][$i]['width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
639 | - $atom_structure['sample_description_table'][$i]['height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
640 | - $atom_structure['sample_description_table'][$i]['resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
641 | - $atom_structure['sample_description_table'][$i]['resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
642 | - $atom_structure['sample_description_table'][$i]['data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 4)); |
|
643 | - $atom_structure['sample_description_table'][$i]['frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 36, 2)); |
|
644 | - $atom_structure['sample_description_table'][$i]['compressor_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 38, 4); |
|
645 | - $atom_structure['sample_description_table'][$i]['pixel_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 42, 2)); |
|
646 | - $atom_structure['sample_description_table'][$i]['color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 44, 2)); |
|
636 | + $atom_structure['sample_description_table'][$i]['temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
637 | + $atom_structure['sample_description_table'][$i]['spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
638 | + $atom_structure['sample_description_table'][$i]['width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
639 | + $atom_structure['sample_description_table'][$i]['height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
640 | + $atom_structure['sample_description_table'][$i]['resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
641 | + $atom_structure['sample_description_table'][$i]['resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
642 | + $atom_structure['sample_description_table'][$i]['data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 4)); |
|
643 | + $atom_structure['sample_description_table'][$i]['frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 36, 2)); |
|
644 | + $atom_structure['sample_description_table'][$i]['compressor_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 38, 4); |
|
645 | + $atom_structure['sample_description_table'][$i]['pixel_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 42, 2)); |
|
646 | + $atom_structure['sample_description_table'][$i]['color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 44, 2)); |
|
647 | 647 | |
648 | 648 | switch ($atom_structure['sample_description_table'][$i]['data_format']) { |
649 | 649 | case '2vuY': |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | $info['video']['fourcc'] = $atom_structure['sample_description_table'][$i]['data_format']; |
677 | 677 | // http://www.getid3.org/phpBB3/viewtopic.php?t=1550 |
678 | 678 | //if ((!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($atom_structure['sample_description_table'][$i]['width'])) && (empty($info['video']['resolution_x']) || empty($info['video']['resolution_y']) || (number_format($info['video']['resolution_x'], 6) != number_format(round($info['video']['resolution_x']), 6)) || (number_format($info['video']['resolution_y'], 6) != number_format(round($info['video']['resolution_y']), 6)))) { // ugly check for floating point numbers |
679 | -if (!empty($atom_structure['sample_description_table'][$i]['width']) && !empty($atom_structure['sample_description_table'][$i]['height'])) { |
|
679 | +if ( ! empty($atom_structure['sample_description_table'][$i]['width']) && ! empty($atom_structure['sample_description_table'][$i]['height'])) { |
|
680 | 680 | // assume that values stored here are more important than values stored in [tkhd] atom |
681 | 681 | $info['video']['resolution_x'] = $atom_structure['sample_description_table'][$i]['width']; |
682 | 682 | $info['video']['resolution_y'] = $atom_structure['sample_description_table'][$i]['height']; |
@@ -720,18 +720,18 @@ discard block |
||
720 | 720 | |
721 | 721 | default: |
722 | 722 | // video atom |
723 | - $atom_structure['sample_description_table'][$i]['video_temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
724 | - $atom_structure['sample_description_table'][$i]['video_spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
725 | - $atom_structure['sample_description_table'][$i]['video_frame_width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
726 | - $atom_structure['sample_description_table'][$i]['video_frame_height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
727 | - $atom_structure['sample_description_table'][$i]['video_resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 20, 4)); |
|
728 | - $atom_structure['sample_description_table'][$i]['video_resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
729 | - $atom_structure['sample_description_table'][$i]['video_data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
730 | - $atom_structure['sample_description_table'][$i]['video_frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 2)); |
|
731 | - $atom_structure['sample_description_table'][$i]['video_encoder_name_len'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 34, 1)); |
|
732 | - $atom_structure['sample_description_table'][$i]['video_encoder_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 35, $atom_structure['sample_description_table'][$i]['video_encoder_name_len']); |
|
733 | - $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 66, 2)); |
|
734 | - $atom_structure['sample_description_table'][$i]['video_color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 68, 2)); |
|
723 | + $atom_structure['sample_description_table'][$i]['video_temporal_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 8, 4)); |
|
724 | + $atom_structure['sample_description_table'][$i]['video_spatial_quality'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 12, 4)); |
|
725 | + $atom_structure['sample_description_table'][$i]['video_frame_width'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 16, 2)); |
|
726 | + $atom_structure['sample_description_table'][$i]['video_frame_height'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 18, 2)); |
|
727 | + $atom_structure['sample_description_table'][$i]['video_resolution_x'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 20, 4)); |
|
728 | + $atom_structure['sample_description_table'][$i]['video_resolution_y'] = getid3_lib::FixedPoint16_16(substr($atom_structure['sample_description_table'][$i]['data'], 24, 4)); |
|
729 | + $atom_structure['sample_description_table'][$i]['video_data_size'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 28, 4)); |
|
730 | + $atom_structure['sample_description_table'][$i]['video_frame_count'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 32, 2)); |
|
731 | + $atom_structure['sample_description_table'][$i]['video_encoder_name_len'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 34, 1)); |
|
732 | + $atom_structure['sample_description_table'][$i]['video_encoder_name'] = substr($atom_structure['sample_description_table'][$i]['data'], 35, $atom_structure['sample_description_table'][$i]['video_encoder_name_len']); |
|
733 | + $atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 66, 2)); |
|
734 | + $atom_structure['sample_description_table'][$i]['video_color_table_id'] = getid3_lib::BigEndian2Int(substr($atom_structure['sample_description_table'][$i]['data'], 68, 2)); |
|
735 | 735 | |
736 | 736 | $atom_structure['sample_description_table'][$i]['video_pixel_color_type'] = (($atom_structure['sample_description_table'][$i]['video_pixel_color_depth'] > 32) ? 'grayscale' : 'color'); |
737 | 737 | $atom_structure['sample_description_table'][$i]['video_pixel_color_name'] = $this->QuicktimeColorNameLookup($atom_structure['sample_description_table'][$i]['video_pixel_color_depth']); |
@@ -792,9 +792,9 @@ discard block |
||
792 | 792 | |
793 | 793 | |
794 | 794 | case 'stts': // Sample Table Time-to-Sample atom |
795 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
796 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
797 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
795 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
796 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
797 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
798 | 798 | $sttsEntriesDataOffset = 8; |
799 | 799 | //$FrameRateCalculatorArray = array(); |
800 | 800 | $frames_count = 0; |
@@ -845,9 +845,9 @@ discard block |
||
845 | 845 | |
846 | 846 | case 'stss': // Sample Table Sync Sample (key frames) atom |
847 | 847 | if ($ParseAllPossibleAtoms) { |
848 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
849 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
850 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
848 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
849 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
850 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
851 | 851 | $stssEntriesDataOffset = 8; |
852 | 852 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
853 | 853 | $atom_structure['time_to_sample_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stssEntriesDataOffset, 4)); |
@@ -859,9 +859,9 @@ discard block |
||
859 | 859 | |
860 | 860 | case 'stsc': // Sample Table Sample-to-Chunk atom |
861 | 861 | if ($ParseAllPossibleAtoms) { |
862 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
863 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
864 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
862 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
863 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
864 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
865 | 865 | $stscEntriesDataOffset = 8; |
866 | 866 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
867 | 867 | $atom_structure['sample_to_chunk_table'][$i]['first_chunk'] = getid3_lib::BigEndian2Int(substr($atom_data, $stscEntriesDataOffset, 4)); |
@@ -877,10 +877,10 @@ discard block |
||
877 | 877 | |
878 | 878 | case 'stsz': // Sample Table SiZe atom |
879 | 879 | if ($ParseAllPossibleAtoms) { |
880 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
881 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
882 | - $atom_structure['sample_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
883 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
880 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
881 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
882 | + $atom_structure['sample_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
883 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
884 | 884 | $stszEntriesDataOffset = 12; |
885 | 885 | if ($atom_structure['sample_size'] == 0) { |
886 | 886 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
@@ -894,9 +894,9 @@ discard block |
||
894 | 894 | |
895 | 895 | case 'stco': // Sample Table Chunk Offset atom |
896 | 896 | if ($ParseAllPossibleAtoms) { |
897 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
898 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
899 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
897 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
898 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
899 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
900 | 900 | $stcoEntriesDataOffset = 8; |
901 | 901 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
902 | 902 | $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 4)); |
@@ -908,9 +908,9 @@ discard block |
||
908 | 908 | |
909 | 909 | case 'co64': // Chunk Offset 64-bit (version of "stco" that supports > 2GB files) |
910 | 910 | if ($ParseAllPossibleAtoms) { |
911 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
912 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
913 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
911 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
912 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
913 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
914 | 914 | $stcoEntriesDataOffset = 8; |
915 | 915 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
916 | 916 | $atom_structure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atom_data, $stcoEntriesDataOffset, 8)); |
@@ -921,20 +921,20 @@ discard block |
||
921 | 921 | |
922 | 922 | |
923 | 923 | case 'dref': // Data REFerence atom |
924 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
925 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
926 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
924 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
925 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
926 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
927 | 927 | $drefDataOffset = 8; |
928 | 928 | for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
929 | 929 | $atom_structure['data_references'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 4)); |
930 | 930 | $drefDataOffset += 4; |
931 | - $atom_structure['data_references'][$i]['type'] = substr($atom_data, $drefDataOffset, 4); |
|
931 | + $atom_structure['data_references'][$i]['type'] = substr($atom_data, $drefDataOffset, 4); |
|
932 | 932 | $drefDataOffset += 4; |
933 | - $atom_structure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 1)); |
|
933 | + $atom_structure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 1)); |
|
934 | 934 | $drefDataOffset += 1; |
935 | - $atom_structure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 3)); // hardcoded: 0x0000 |
|
935 | + $atom_structure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $drefDataOffset, 3)); // hardcoded: 0x0000 |
|
936 | 936 | $drefDataOffset += 3; |
937 | - $atom_structure['data_references'][$i]['data'] = substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); |
|
937 | + $atom_structure['data_references'][$i]['data'] = substr($atom_data, $drefDataOffset, ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); |
|
938 | 938 | $drefDataOffset += ($atom_structure['data_references'][$i]['size'] - 4 - 4 - 1 - 3); |
939 | 939 | |
940 | 940 | $atom_structure['data_references'][$i]['flags']['self_reference'] = (bool) ($atom_structure['data_references'][$i]['flags_raw'] & 0x001); |
@@ -943,11 +943,11 @@ discard block |
||
943 | 943 | |
944 | 944 | |
945 | 945 | case 'gmin': // base Media INformation atom |
946 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
947 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
948 | - $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
949 | - $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
950 | - $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
946 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
947 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
948 | + $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
949 | + $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
950 | + $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
951 | 951 | $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); |
952 | 952 | $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 2)); |
953 | 953 | $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 14, 2)); |
@@ -955,19 +955,19 @@ discard block |
||
955 | 955 | |
956 | 956 | |
957 | 957 | case 'smhd': // Sound Media information HeaDer atom |
958 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
959 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
960 | - $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
961 | - $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
958 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
959 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
960 | + $atom_structure['balance'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
961 | + $atom_structure['reserved'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
962 | 962 | break; |
963 | 963 | |
964 | 964 | |
965 | 965 | case 'vmhd': // Video Media information HeaDer atom |
966 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
967 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
968 | - $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
969 | - $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
970 | - $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
966 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
967 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
968 | + $atom_structure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); |
|
969 | + $atom_structure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)); |
|
970 | + $atom_structure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 2)); |
|
971 | 971 | $atom_structure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); |
972 | 972 | |
973 | 973 | $atom_structure['flags']['no_lean_ahead'] = (bool) ($atom_structure['flags_raw'] & 0x001); |
@@ -975,14 +975,14 @@ discard block |
||
975 | 975 | |
976 | 976 | |
977 | 977 | case 'hdlr': // HanDLeR reference atom |
978 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
979 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
980 | - $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
981 | - $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
982 | - $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
978 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
979 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
980 | + $atom_structure['component_type'] = substr($atom_data, 4, 4); |
|
981 | + $atom_structure['component_subtype'] = substr($atom_data, 8, 4); |
|
982 | + $atom_structure['component_manufacturer'] = substr($atom_data, 12, 4); |
|
983 | 983 | $atom_structure['component_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
984 | 984 | $atom_structure['component_flags_mask'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
985 | - $atom_structure['component_name'] = $this->Pascal2String(substr($atom_data, 24)); |
|
985 | + $atom_structure['component_name'] = $this->Pascal2String(substr($atom_data, 24)); |
|
986 | 986 | |
987 | 987 | if (($atom_structure['component_subtype'] == 'STpn') && ($atom_structure['component_manufacturer'] == 'zzzz')) { |
988 | 988 | $info['video']['dataformat'] = 'quicktimevr'; |
@@ -991,10 +991,10 @@ discard block |
||
991 | 991 | |
992 | 992 | |
993 | 993 | case 'mdhd': // MeDia HeaDer atom |
994 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
995 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
996 | - $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
997 | - $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
994 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
995 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
996 | + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
997 | + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
998 | 998 | $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
999 | 999 | $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
1000 | 1000 | $atom_structure['language_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 2)); |
@@ -1010,16 +1010,16 @@ discard block |
||
1010 | 1010 | $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); |
1011 | 1011 | $atom_structure['playtime_seconds'] = $atom_structure['duration'] / $atom_structure['time_scale']; |
1012 | 1012 | $atom_structure['language'] = $this->QuicktimeLanguageLookup($atom_structure['language_id']); |
1013 | - if (empty($info['comments']['language']) || (!in_array($atom_structure['language'], $info['comments']['language']))) { |
|
1013 | + if (empty($info['comments']['language']) || ( ! in_array($atom_structure['language'], $info['comments']['language']))) { |
|
1014 | 1014 | $info['comments']['language'][] = $atom_structure['language']; |
1015 | 1015 | } |
1016 | 1016 | break; |
1017 | 1017 | |
1018 | 1018 | |
1019 | 1019 | case 'pnot': // Preview atom |
1020 | - $atom_structure['modification_date'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // "standard Macintosh format" |
|
1021 | - $atom_structure['version_number'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x00 |
|
1022 | - $atom_structure['atom_type'] = substr($atom_data, 6, 4); // usually: 'PICT' |
|
1020 | + $atom_structure['modification_date'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // "standard Macintosh format" |
|
1021 | + $atom_structure['version_number'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x00 |
|
1022 | + $atom_structure['atom_type'] = substr($atom_data, 6, 4); // usually: 'PICT' |
|
1023 | 1023 | $atom_structure['atom_index'] = getid3_lib::BigEndian2Int(substr($atom_data, 10, 2)); // usually: 0x01 |
1024 | 1024 | |
1025 | 1025 | $atom_structure['modification_date_unix'] = getid3_lib::DateMac2Unix($atom_structure['modification_date']); |
@@ -1027,16 +1027,16 @@ discard block |
||
1027 | 1027 | |
1028 | 1028 | |
1029 | 1029 | case 'crgn': // Clipping ReGioN atom |
1030 | - $atom_structure['region_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); // The Region size, Region boundary box, |
|
1031 | - $atom_structure['boundary_box'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 8)); // and Clipping region data fields |
|
1032 | - $atom_structure['clipping_data'] = substr($atom_data, 10); // constitute a QuickDraw region. |
|
1030 | + $atom_structure['region_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 2)); // The Region size, Region boundary box, |
|
1031 | + $atom_structure['boundary_box'] = getid3_lib::BigEndian2Int(substr($atom_data, 2, 8)); // and Clipping region data fields |
|
1032 | + $atom_structure['clipping_data'] = substr($atom_data, 10); // constitute a QuickDraw region. |
|
1033 | 1033 | break; |
1034 | 1034 | |
1035 | 1035 | |
1036 | 1036 | case 'load': // track LOAD settings atom |
1037 | - $atom_structure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1038 | - $atom_structure['preload_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1039 | - $atom_structure['preload_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1037 | + $atom_structure['preload_start_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1038 | + $atom_structure['preload_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1039 | + $atom_structure['preload_flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1040 | 1040 | $atom_structure['default_hints_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
1041 | 1041 | |
1042 | 1042 | $atom_structure['default_hints']['double_buffer'] = (bool) ($atom_structure['default_hints_raw'] & 0x0020); |
@@ -1056,28 +1056,28 @@ discard block |
||
1056 | 1056 | |
1057 | 1057 | |
1058 | 1058 | case 'elst': // Edit LiST atom |
1059 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1060 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
1061 | - $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1062 | - for ($i = 0; $i < $atom_structure['number_entries']; $i++ ) { |
|
1063 | - $atom_structure['edit_list'][$i]['track_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4)); |
|
1064 | - $atom_structure['edit_list'][$i]['media_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4)); |
|
1059 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1060 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
1061 | + $atom_structure['number_entries'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1062 | + for ($i = 0; $i < $atom_structure['number_entries']; $i++) { |
|
1063 | + $atom_structure['edit_list'][$i]['track_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 0, 4)); |
|
1064 | + $atom_structure['edit_list'][$i]['media_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($i * 12) + 4, 4)); |
|
1065 | 1065 | $atom_structure['edit_list'][$i]['media_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 8 + ($i * 12) + 8, 4)); |
1066 | 1066 | } |
1067 | 1067 | break; |
1068 | 1068 | |
1069 | 1069 | |
1070 | 1070 | case 'kmat': // compressed MATte atom |
1071 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1072 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
1073 | - $atom_structure['matte_data_raw'] = substr($atom_data, 4); |
|
1071 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1072 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); // hardcoded: 0x0000 |
|
1073 | + $atom_structure['matte_data_raw'] = substr($atom_data, 4); |
|
1074 | 1074 | break; |
1075 | 1075 | |
1076 | 1076 | |
1077 | 1077 | case 'ctab': // Color TABle atom |
1078 | - $atom_structure['color_table_seed'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // hardcoded: 0x00000000 |
|
1079 | - $atom_structure['color_table_flags'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x8000 |
|
1080 | - $atom_structure['color_table_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)) + 1; |
|
1078 | + $atom_structure['color_table_seed'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); // hardcoded: 0x00000000 |
|
1079 | + $atom_structure['color_table_flags'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 2)); // hardcoded: 0x8000 |
|
1080 | + $atom_structure['color_table_size'] = getid3_lib::BigEndian2Int(substr($atom_data, 6, 2)) + 1; |
|
1081 | 1081 | for ($colortableentry = 0; $colortableentry < $atom_structure['color_table_size']; $colortableentry++) { |
1082 | 1082 | $atom_structure['color_table'][$colortableentry]['alpha'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 0, 2)); |
1083 | 1083 | $atom_structure['color_table'][$colortableentry]['red'] = getid3_lib::BigEndian2Int(substr($atom_data, 8 + ($colortableentry * 8) + 2, 2)); |
@@ -1088,31 +1088,31 @@ discard block |
||
1088 | 1088 | |
1089 | 1089 | |
1090 | 1090 | case 'mvhd': // MoVie HeaDer atom |
1091 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1092 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1093 | - $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1094 | - $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1095 | - $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
1096 | - $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
1091 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1092 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1093 | + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1094 | + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1095 | + $atom_structure['time_scale'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
1096 | + $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
1097 | 1097 | $atom_structure['preferred_rate'] = getid3_lib::FixedPoint16_16(substr($atom_data, 20, 4)); |
1098 | - $atom_structure['preferred_volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 24, 2)); |
|
1099 | - $atom_structure['reserved'] = substr($atom_data, 26, 10); |
|
1098 | + $atom_structure['preferred_volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 24, 2)); |
|
1099 | + $atom_structure['reserved'] = substr($atom_data, 26, 10); |
|
1100 | 1100 | $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 36, 4)); |
1101 | 1101 | $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4)); |
1102 | - $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 44, 4)); |
|
1102 | + $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 44, 4)); |
|
1103 | 1103 | $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 48, 4)); |
1104 | 1104 | $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4)); |
1105 | - $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 56, 4)); |
|
1105 | + $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 56, 4)); |
|
1106 | 1106 | $atom_structure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atom_data, 60, 4)); |
1107 | 1107 | $atom_structure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4)); |
1108 | - $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4)); |
|
1109 | - $atom_structure['preview_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 72, 4)); |
|
1110 | - $atom_structure['preview_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 76, 4)); |
|
1111 | - $atom_structure['poster_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 80, 4)); |
|
1112 | - $atom_structure['selection_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 84, 4)); |
|
1113 | - $atom_structure['selection_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 88, 4)); |
|
1114 | - $atom_structure['current_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 92, 4)); |
|
1115 | - $atom_structure['next_track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 96, 4)); |
|
1108 | + $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 68, 4)); |
|
1109 | + $atom_structure['preview_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 72, 4)); |
|
1110 | + $atom_structure['preview_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 76, 4)); |
|
1111 | + $atom_structure['poster_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 80, 4)); |
|
1112 | + $atom_structure['selection_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 84, 4)); |
|
1113 | + $atom_structure['selection_duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 88, 4)); |
|
1114 | + $atom_structure['current_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 92, 4)); |
|
1115 | + $atom_structure['next_track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, 96, 4)); |
|
1116 | 1116 | |
1117 | 1117 | if ($atom_structure['time_scale'] == 0) { |
1118 | 1118 | $info['error'][] = 'Corrupt Quicktime file: mvhd.time_scale == zero'; |
@@ -1127,29 +1127,29 @@ discard block |
||
1127 | 1127 | |
1128 | 1128 | |
1129 | 1129 | case 'tkhd': // TracK HeaDer atom |
1130 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1131 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1132 | - $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1133 | - $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1134 | - $atom_structure['trackid'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
1135 | - $atom_structure['reserved1'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
1136 | - $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
|
1137 | - $atom_structure['reserved2'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 8)); |
|
1138 | - $atom_structure['layer'] = getid3_lib::BigEndian2Int(substr($atom_data, 32, 2)); |
|
1139 | - $atom_structure['alternate_group'] = getid3_lib::BigEndian2Int(substr($atom_data, 34, 2)); |
|
1140 | - $atom_structure['volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 36, 2)); |
|
1141 | - $atom_structure['reserved3'] = getid3_lib::BigEndian2Int(substr($atom_data, 38, 2)); |
|
1130 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1131 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1132 | + $atom_structure['creation_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1133 | + $atom_structure['modify_time'] = getid3_lib::BigEndian2Int(substr($atom_data, 8, 4)); |
|
1134 | + $atom_structure['trackid'] = getid3_lib::BigEndian2Int(substr($atom_data, 12, 4)); |
|
1135 | + $atom_structure['reserved1'] = getid3_lib::BigEndian2Int(substr($atom_data, 16, 4)); |
|
1136 | + $atom_structure['duration'] = getid3_lib::BigEndian2Int(substr($atom_data, 20, 4)); |
|
1137 | + $atom_structure['reserved2'] = getid3_lib::BigEndian2Int(substr($atom_data, 24, 8)); |
|
1138 | + $atom_structure['layer'] = getid3_lib::BigEndian2Int(substr($atom_data, 32, 2)); |
|
1139 | + $atom_structure['alternate_group'] = getid3_lib::BigEndian2Int(substr($atom_data, 34, 2)); |
|
1140 | + $atom_structure['volume'] = getid3_lib::FixedPoint8_8(substr($atom_data, 36, 2)); |
|
1141 | + $atom_structure['reserved3'] = getid3_lib::BigEndian2Int(substr($atom_data, 38, 2)); |
|
1142 | 1142 | // http://developer.apple.com/library/mac/#documentation/QuickTime/RM/MovieBasics/MTEditing/K-Chapter/11MatrixFunctions.html |
1143 | 1143 | // http://developer.apple.com/library/mac/#documentation/QuickTime/qtff/QTFFChap4/qtff4.html#//apple_ref/doc/uid/TP40000939-CH206-18737 |
1144 | 1144 | $atom_structure['matrix_a'] = getid3_lib::FixedPoint16_16(substr($atom_data, 40, 4)); |
1145 | 1145 | $atom_structure['matrix_b'] = getid3_lib::FixedPoint16_16(substr($atom_data, 44, 4)); |
1146 | - $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 48, 4)); |
|
1146 | + $atom_structure['matrix_u'] = getid3_lib::FixedPoint2_30(substr($atom_data, 48, 4)); |
|
1147 | 1147 | $atom_structure['matrix_c'] = getid3_lib::FixedPoint16_16(substr($atom_data, 52, 4)); |
1148 | 1148 | $atom_structure['matrix_d'] = getid3_lib::FixedPoint16_16(substr($atom_data, 56, 4)); |
1149 | - $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 60, 4)); |
|
1149 | + $atom_structure['matrix_v'] = getid3_lib::FixedPoint2_30(substr($atom_data, 60, 4)); |
|
1150 | 1150 | $atom_structure['matrix_x'] = getid3_lib::FixedPoint16_16(substr($atom_data, 64, 4)); |
1151 | 1151 | $atom_structure['matrix_y'] = getid3_lib::FixedPoint16_16(substr($atom_data, 68, 4)); |
1152 | - $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 72, 4)); |
|
1152 | + $atom_structure['matrix_w'] = getid3_lib::FixedPoint2_30(substr($atom_data, 72, 4)); |
|
1153 | 1153 | $atom_structure['width'] = getid3_lib::FixedPoint16_16(substr($atom_data, 76, 4)); |
1154 | 1154 | $atom_structure['height'] = getid3_lib::FixedPoint16_16(substr($atom_data, 80, 4)); |
1155 | 1155 | $atom_structure['flags']['enabled'] = (bool) ($atom_structure['flags_raw'] & 0x0001); |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | $atom_structure['modify_time_unix'] = getid3_lib::DateMac2Unix($atom_structure['modify_time']); |
1161 | 1161 | |
1162 | 1162 | if ($atom_structure['flags']['enabled'] == 1) { |
1163 | - if (!isset($info['video']['resolution_x']) || !isset($info['video']['resolution_y'])) { |
|
1163 | + if ( ! isset($info['video']['resolution_x']) || ! isset($info['video']['resolution_y'])) { |
|
1164 | 1164 | $info['video']['resolution_x'] = $atom_structure['width']; |
1165 | 1165 | $info['video']['resolution_y'] = $atom_structure['height']; |
1166 | 1166 | } |
@@ -1181,34 +1181,34 @@ discard block |
||
1181 | 1181 | // http://www.koders.com/c/fid1FAB3E762903DC482D8A246D4A4BF9F28E049594.aspx?s=windows.h |
1182 | 1182 | // http://libquicktime.sourcearchive.com/documentation/1.0.2plus-pdebian/iods_8c-source.html |
1183 | 1183 | $offset = 0; |
1184 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1184 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1185 | 1185 | $offset += 1; |
1186 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 3)); |
|
1186 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 3)); |
|
1187 | 1187 | $offset += 3; |
1188 | - $atom_structure['mp4_iod_tag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1188 | + $atom_structure['mp4_iod_tag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1189 | 1189 | $offset += 1; |
1190 | 1190 | $atom_structure['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset); |
1191 | 1191 | //$offset already adjusted by quicktime_read_mp4_descr_length() |
1192 | - $atom_structure['object_descriptor_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); |
|
1192 | + $atom_structure['object_descriptor_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); |
|
1193 | 1193 | $offset += 2; |
1194 | - $atom_structure['od_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1194 | + $atom_structure['od_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1195 | 1195 | $offset += 1; |
1196 | - $atom_structure['scene_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1196 | + $atom_structure['scene_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1197 | 1197 | $offset += 1; |
1198 | - $atom_structure['audio_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1198 | + $atom_structure['audio_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1199 | 1199 | $offset += 1; |
1200 | - $atom_structure['video_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1200 | + $atom_structure['video_profile_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1201 | 1201 | $offset += 1; |
1202 | - $atom_structure['graphics_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1202 | + $atom_structure['graphics_profile_level'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1203 | 1203 | $offset += 1; |
1204 | 1204 | |
1205 | 1205 | $atom_structure['num_iods_tracks'] = ($atom_structure['length'] - 7) / 6; // 6 bytes would only be right if all tracks use 1-byte length fields |
1206 | 1206 | for ($i = 0; $i < $atom_structure['num_iods_tracks']; $i++) { |
1207 | - $atom_structure['track'][$i]['ES_ID_IncTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1207 | + $atom_structure['track'][$i]['ES_ID_IncTag'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 1)); |
|
1208 | 1208 | $offset += 1; |
1209 | 1209 | $atom_structure['track'][$i]['length'] = $this->quicktime_read_mp4_descr_length($atom_data, $offset); |
1210 | 1210 | //$offset already adjusted by quicktime_read_mp4_descr_length() |
1211 | - $atom_structure['track'][$i]['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); |
|
1211 | + $atom_structure['track'][$i]['track_id'] = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); |
|
1212 | 1212 | $offset += 4; |
1213 | 1213 | } |
1214 | 1214 | |
@@ -1217,9 +1217,9 @@ discard block |
||
1217 | 1217 | break; |
1218 | 1218 | |
1219 | 1219 | case 'ftyp': // FileTYPe (?) atom (for MP4 it seems) |
1220 | - $atom_structure['signature'] = substr($atom_data, 0, 4); |
|
1221 | - $atom_structure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1222 | - $atom_structure['fourcc'] = substr($atom_data, 8, 4); |
|
1220 | + $atom_structure['signature'] = substr($atom_data, 0, 4); |
|
1221 | + $atom_structure['unknown_1'] = getid3_lib::BigEndian2Int(substr($atom_data, 4, 4)); |
|
1222 | + $atom_structure['fourcc'] = substr($atom_data, 8, 4); |
|
1223 | 1223 | break; |
1224 | 1224 | |
1225 | 1225 | case 'mdat': // Media DATa atom |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | // check to see if it looks like chapter titles, in the form of unterminated strings with a leading 16-bit size field |
1243 | - while (($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2))) |
|
1243 | + while (($chapter_string_length = getid3_lib::BigEndian2Int(substr($atom_data, $mdat_offset, 2))) |
|
1244 | 1244 | && ($chapter_string_length < 1000) |
1245 | 1245 | && ($chapter_string_length <= (strlen($atom_data) - $mdat_offset - 2)) |
1246 | 1246 | && preg_match('#^[\x20-\xFF]+$#', substr($atom_data, $mdat_offset + 2, $chapter_string_length), $chapter_matches)) { |
@@ -1250,9 +1250,9 @@ discard block |
||
1250 | 1250 | |
1251 | 1251 | |
1252 | 1252 | |
1253 | - if (($atomsize > 8) && (!isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) { |
|
1253 | + if (($atomsize > 8) && ( ! isset($info['avdataend_tmp']) || ($info['quicktime'][$atomname]['size'] > ($info['avdataend_tmp'] - $info['avdataoffset'])))) { |
|
1254 | 1254 | |
1255 | - $info['avdataoffset'] = $atom_structure['offset'] + 8; // $info['quicktime'][$atomname]['offset'] + 8; |
|
1255 | + $info['avdataoffset'] = $atom_structure['offset'] + 8; // $info['quicktime'][$atomname]['offset'] + 8; |
|
1256 | 1256 | $OldAVDataEnd = $info['avdataend']; |
1257 | 1257 | $info['avdataend'] = $atom_structure['offset'] + $atom_structure['size']; // $info['quicktime'][$atomname]['offset'] + $info['quicktime'][$atomname]['size']; |
1258 | 1258 | |
@@ -1263,16 +1263,16 @@ discard block |
||
1263 | 1263 | $getid3_mp3 = new getid3_mp3($getid3_temp); |
1264 | 1264 | if ($getid3_mp3->MPEGaudioHeaderValid($getid3_mp3->MPEGaudioHeaderDecode($this->fread(4)))) { |
1265 | 1265 | $getid3_mp3->getOnlyMPEGaudioInfo($getid3_temp->info['avdataoffset'], false); |
1266 | - if (!empty($getid3_temp->info['warning'])) { |
|
1266 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
1267 | 1267 | foreach ($getid3_temp->info['warning'] as $value) { |
1268 | 1268 | $info['warning'][] = $value; |
1269 | 1269 | } |
1270 | 1270 | } |
1271 | - if (!empty($getid3_temp->info['mpeg'])) { |
|
1271 | + if ( ! empty($getid3_temp->info['mpeg'])) { |
|
1272 | 1272 | $info['mpeg'] = $getid3_temp->info['mpeg']; |
1273 | 1273 | if (isset($info['mpeg']['audio'])) { |
1274 | 1274 | $info['audio']['dataformat'] = 'mp3'; |
1275 | - $info['audio']['codec'] = (!empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : (!empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : (!empty($info['mpeg']['audio']['LAME']) ? 'LAME' :'mp3'))); |
|
1275 | + $info['audio']['codec'] = ( ! empty($info['mpeg']['audio']['encoder']) ? $info['mpeg']['audio']['encoder'] : ( ! empty($info['mpeg']['audio']['codec']) ? $info['mpeg']['audio']['codec'] : ( ! empty($info['mpeg']['audio']['LAME']) ? 'LAME' : 'mp3'))); |
|
1276 | 1276 | $info['audio']['sample_rate'] = $info['mpeg']['audio']['sample_rate']; |
1277 | 1277 | $info['audio']['channels'] = $info['mpeg']['audio']['channels']; |
1278 | 1278 | $info['audio']['bitrate'] = $info['mpeg']['audio']['bitrate']; |
@@ -1307,7 +1307,7 @@ discard block |
||
1307 | 1307 | |
1308 | 1308 | case 'nsav': // NoSAVe atom |
1309 | 1309 | // http://developer.apple.com/technotes/tn/tn2038.html |
1310 | - $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1310 | + $atom_structure['data'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1311 | 1311 | break; |
1312 | 1312 | |
1313 | 1313 | case 'ctyp': // Controller TYPe atom (seen on QTVR) |
@@ -1325,7 +1325,7 @@ discard block |
||
1325 | 1325 | break; |
1326 | 1326 | |
1327 | 1327 | case 'pano': // PANOrama track (seen on QTVR) |
1328 | - $atom_structure['pano'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1328 | + $atom_structure['pano'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 4)); |
|
1329 | 1329 | break; |
1330 | 1330 | |
1331 | 1331 | case 'hint': // HINT track |
@@ -1364,7 +1364,7 @@ discard block |
||
1364 | 1364 | @list($all, $latitude, $longitude, $altitude) = $matches; |
1365 | 1365 | $info['quicktime']['comments']['gps_latitude'][] = floatval($latitude); |
1366 | 1366 | $info['quicktime']['comments']['gps_longitude'][] = floatval($longitude); |
1367 | - if (!empty($altitude)) { |
|
1367 | + if ( ! empty($altitude)) { |
|
1368 | 1368 | $info['quicktime']['comments']['gps_altitude'][] = floatval($altitude); |
1369 | 1369 | } |
1370 | 1370 | } else { |
@@ -1402,17 +1402,17 @@ discard block |
||
1402 | 1402 | // mdta keys \005 mdtacom.apple.quicktime.make (mdtacom.apple.quicktime.creationdate ,mdtacom.apple.quicktime.location.ISO6709 $mdtacom.apple.quicktime.software !mdtacom.apple.quicktime.model ilst \01D \001 \015data \001DE\010Apple 0 \002 (data \001DE\0102011-05-11T17:54:04+0200 2 \003 *data \001DE\010+52.4936+013.3897+040.247/ \01D \004 \015data \001DE\0104.3.1 \005 \018data \001DE\010iPhone 4 |
1403 | 1403 | // http://www.geocities.com/xhelmboyx/quicktime/formats/qti-layout.txt |
1404 | 1404 | |
1405 | - $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1406 | - $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1405 | + $atom_structure['version'] = getid3_lib::BigEndian2Int(substr($atom_data, 0, 1)); |
|
1406 | + $atom_structure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atom_data, 1, 3)); |
|
1407 | 1407 | $atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom(substr($atom_data, 4), $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
1408 | 1408 | //$atom_structure['subatoms'] = $this->QuicktimeParseContainerAtom($atom_data, $baseoffset + 8, $atomHierarchy, $ParseAllPossibleAtoms); |
1409 | 1409 | break; |
1410 | 1410 | |
1411 | 1411 | case 'data': // metaDATA atom |
1412 | 1412 | // seems to be 2 bytes language code (ASCII), 2 bytes unknown (set to 0x10B5 in sample I have), remainder is useful data |
1413 | - $atom_structure['language'] = substr($atom_data, 4 + 0, 2); |
|
1413 | + $atom_structure['language'] = substr($atom_data, 4 + 0, 2); |
|
1414 | 1414 | $atom_structure['unknown'] = getid3_lib::BigEndian2Int(substr($atom_data, 4 + 2, 2)); |
1415 | - $atom_structure['data'] = substr($atom_data, 4 + 4); |
|
1415 | + $atom_structure['data'] = substr($atom_data, 4 + 4); |
|
1416 | 1416 | break; |
1417 | 1417 | |
1418 | 1418 | default: |
@@ -1426,7 +1426,7 @@ discard block |
||
1426 | 1426 | |
1427 | 1427 | public function QuicktimeParseContainerAtom($atom_data, $baseoffset, &$atomHierarchy, $ParseAllPossibleAtoms) { |
1428 | 1428 | //echo 'QuicktimeParseContainerAtom('.substr($atom_data, 4, 4).') @ '.$baseoffset.'<br><br>'; |
1429 | - $atom_structure = false; |
|
1429 | + $atom_structure = false; |
|
1430 | 1430 | $subatomoffset = 0; |
1431 | 1431 | $subatomcounter = 0; |
1432 | 1432 | if ((strlen($atom_data) == 4) && (getid3_lib::BigEndian2Int($atom_data) == 0x00000000)) { |
@@ -1434,8 +1434,8 @@ discard block |
||
1434 | 1434 | } |
1435 | 1435 | while ($subatomoffset < strlen($atom_data)) { |
1436 | 1436 | $subatomsize = getid3_lib::BigEndian2Int(substr($atom_data, $subatomoffset + 0, 4)); |
1437 | - $subatomname = substr($atom_data, $subatomoffset + 4, 4); |
|
1438 | - $subatomdata = substr($atom_data, $subatomoffset + 8, $subatomsize - 8); |
|
1437 | + $subatomname = substr($atom_data, $subatomoffset + 4, 4); |
|
1438 | + $subatomdata = substr($atom_data, $subatomoffset + 8, $subatomsize - 8); |
|
1439 | 1439 | if ($subatomsize == 0) { |
1440 | 1440 | // Furthermore, for historical reasons the list of atoms is optionally |
1441 | 1441 | // terminated by a 32-bit integer set to 0. If you are writing a program |
@@ -1594,8 +1594,8 @@ discard block |
||
1594 | 1594 | */ |
1595 | 1595 | $iso_language_id = ''; |
1596 | 1596 | $iso_language_id .= chr((($languageid & 0x7C00) >> 10) + 0x60); |
1597 | - $iso_language_id .= chr((($languageid & 0x03E0) >> 5) + 0x60); |
|
1598 | - $iso_language_id .= chr((($languageid & 0x001F) >> 0) + 0x60); |
|
1597 | + $iso_language_id .= chr((($languageid & 0x03E0) >> 5) + 0x60); |
|
1598 | + $iso_language_id .= chr((($languageid & 0x001F) >> 0) + 0x60); |
|
1599 | 1599 | $QuicktimeLanguageLookup[$languageid] = getid3_id3v2::LanguageLookup($iso_language_id); |
1600 | 1600 | } |
1601 | 1601 | return (isset($QuicktimeLanguageLookup[$languageid]) ? $QuicktimeLanguageLookup[$languageid] : 'invalid'); |
@@ -1975,9 +1975,9 @@ discard block |
||
1975 | 1975 | $parsed = array(); |
1976 | 1976 | while ($offset < $datalength) { |
1977 | 1977 | //echo getid3_lib::PrintHexBytes(substr($atom_data, $offset, 4)).'<br>'; |
1978 | - $record_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); $offset += 4; |
|
1979 | - $data_size_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
1980 | - $data_size = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
1978 | + $record_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 4)); $offset += 4; |
|
1979 | + $data_size_type = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
1980 | + $data_size = getid3_lib::BigEndian2Int(substr($atom_data, $offset, 2)); $offset += 2; |
|
1981 | 1981 | switch ($data_size_type) { |
1982 | 1982 | case 0x0001: // 0x0001 = flag (size field *= 1-byte) |
1983 | 1983 | $data = getid3_lib::BigEndian2Int(substr($atom_data, $offset, $data_size * 1)); |
@@ -2050,23 +2050,23 @@ discard block |
||
2050 | 2050 | break; |
2051 | 2051 | case 0x02000023: // PictureControlData |
2052 | 2052 | $PictureControlAdjust = array(0=>'default', 1=>'quick', 2=>'full'); |
2053 | - $FilterEffect = array(0x80=>'off', 0x81=>'yellow', 0x82=>'orange', 0x83=>'red', 0x84=>'green', 0xff=>'n/a'); |
|
2054 | - $ToningEffect = array(0x80=>'b&w', 0x81=>'sepia', 0x82=>'cyanotype', 0x83=>'red', 0x84=>'yellow', 0x85=>'green', 0x86=>'blue-green', 0x87=>'blue', 0x88=>'purple-blue', 0x89=>'red-purple', 0xff=>'n/a'); |
|
2053 | + $FilterEffect = array(0x80=>'off', 0x81=>'yellow', 0x82=>'orange', 0x83=>'red', 0x84=>'green', 0xff=>'n/a'); |
|
2054 | + $ToningEffect = array(0x80=>'b&w', 0x81=>'sepia', 0x82=>'cyanotype', 0x83=>'red', 0x84=>'yellow', 0x85=>'green', 0x86=>'blue-green', 0x87=>'blue', 0x88=>'purple-blue', 0x89=>'red-purple', 0xff=>'n/a'); |
|
2055 | 2055 | $data = array( |
2056 | - 'PictureControlVersion' => substr($data, 0, 4), |
|
2057 | - 'PictureControlName' => rtrim(substr($data, 4, 20), "\x00"), |
|
2056 | + 'PictureControlVersion' => substr($data, 0, 4), |
|
2057 | + 'PictureControlName' => rtrim(substr($data, 4, 20), "\x00"), |
|
2058 | 2058 | 'PictureControlBase' => rtrim(substr($data, 24, 20), "\x00"), |
2059 | 2059 | //'?' => substr($data, 44, 4), |
2060 | - 'PictureControlAdjust' => $PictureControlAdjust[ord(substr($data, 48, 1))], |
|
2061 | - 'PictureControlQuickAdjust' => ord(substr($data, 49, 1)), |
|
2062 | - 'Sharpness' => ord(substr($data, 50, 1)), |
|
2063 | - 'Contrast' => ord(substr($data, 51, 1)), |
|
2064 | - 'Brightness' => ord(substr($data, 52, 1)), |
|
2065 | - 'Saturation' => ord(substr($data, 53, 1)), |
|
2066 | - 'HueAdjustment' => ord(substr($data, 54, 1)), |
|
2067 | - 'FilterEffect' => $FilterEffect[ord(substr($data, 55, 1))], |
|
2068 | - 'ToningEffect' => $ToningEffect[ord(substr($data, 56, 1))], |
|
2069 | - 'ToningSaturation' => ord(substr($data, 57, 1)), |
|
2060 | + 'PictureControlAdjust' => $PictureControlAdjust[ord(substr($data, 48, 1))], |
|
2061 | + 'PictureControlQuickAdjust' => ord(substr($data, 49, 1)), |
|
2062 | + 'Sharpness' => ord(substr($data, 50, 1)), |
|
2063 | + 'Contrast' => ord(substr($data, 51, 1)), |
|
2064 | + 'Brightness' => ord(substr($data, 52, 1)), |
|
2065 | + 'Saturation' => ord(substr($data, 53, 1)), |
|
2066 | + 'HueAdjustment' => ord(substr($data, 54, 1)), |
|
2067 | + 'FilterEffect' => $FilterEffect[ord(substr($data, 55, 1))], |
|
2068 | + 'ToningEffect' => $ToningEffect[ord(substr($data, 56, 1))], |
|
2069 | + 'ToningSaturation' => ord(substr($data, 57, 1)), |
|
2070 | 2070 | ); |
2071 | 2071 | break; |
2072 | 2072 | case 0x02000024: // WorldTime |
@@ -2108,11 +2108,11 @@ discard block |
||
2108 | 2108 | } |
2109 | 2109 | |
2110 | 2110 | |
2111 | - public function CopyToAppropriateCommentsSection($keyname, $data, $boxname='') { |
|
2111 | + public function CopyToAppropriateCommentsSection($keyname, $data, $boxname = '') { |
|
2112 | 2112 | static $handyatomtranslatorarray = array(); |
2113 | 2113 | if (empty($handyatomtranslatorarray)) { |
2114 | 2114 | $handyatomtranslatorarray["\xA9".'cpy'] = 'copyright'; |
2115 | - $handyatomtranslatorarray["\xA9".'day'] = 'creation_date'; // iTunes 4.0 |
|
2115 | + $handyatomtranslatorarray["\xA9".'day'] = 'creation_date'; // iTunes 4.0 |
|
2116 | 2116 | $handyatomtranslatorarray["\xA9".'dir'] = 'director'; |
2117 | 2117 | $handyatomtranslatorarray["\xA9".'ed1'] = 'edit1'; |
2118 | 2118 | $handyatomtranslatorarray["\xA9".'ed2'] = 'edit2'; |
@@ -2132,8 +2132,8 @@ discard block |
||
2132 | 2132 | $handyatomtranslatorarray["\xA9".'wrt'] = 'writer'; |
2133 | 2133 | |
2134 | 2134 | // http://www.geocities.com/xhelmboyx/quicktime/formats/qtm-layout.txt |
2135 | - $handyatomtranslatorarray["\xA9".'nam'] = 'title'; // iTunes 4.0 |
|
2136 | - $handyatomtranslatorarray["\xA9".'cmt'] = 'comment'; // iTunes 4.0 |
|
2135 | + $handyatomtranslatorarray["\xA9".'nam'] = 'title'; // iTunes 4.0 |
|
2136 | + $handyatomtranslatorarray["\xA9".'cmt'] = 'comment'; // iTunes 4.0 |
|
2137 | 2137 | $handyatomtranslatorarray["\xA9".'wrn'] = 'warning'; |
2138 | 2138 | $handyatomtranslatorarray["\xA9".'hst'] = 'host_computer'; |
2139 | 2139 | $handyatomtranslatorarray["\xA9".'mak'] = 'make'; |
@@ -2143,39 +2143,39 @@ discard block |
||
2143 | 2143 | $handyatomtranslatorarray["\xA9".'aut'] = 'author'; |
2144 | 2144 | $handyatomtranslatorarray["\xA9".'ART'] = 'artist'; |
2145 | 2145 | $handyatomtranslatorarray["\xA9".'trk'] = 'track'; |
2146 | - $handyatomtranslatorarray["\xA9".'alb'] = 'album'; // iTunes 4.0 |
|
2146 | + $handyatomtranslatorarray["\xA9".'alb'] = 'album'; // iTunes 4.0 |
|
2147 | 2147 | $handyatomtranslatorarray["\xA9".'com'] = 'comment'; |
2148 | - $handyatomtranslatorarray["\xA9".'gen'] = 'genre'; // iTunes 4.0 |
|
2148 | + $handyatomtranslatorarray["\xA9".'gen'] = 'genre'; // iTunes 4.0 |
|
2149 | 2149 | $handyatomtranslatorarray["\xA9".'ope'] = 'composer'; |
2150 | 2150 | $handyatomtranslatorarray["\xA9".'url'] = 'url'; |
2151 | 2151 | $handyatomtranslatorarray["\xA9".'enc'] = 'encoder'; |
2152 | 2152 | |
2153 | 2153 | // http://atomicparsley.sourceforge.net/mpeg-4files.html |
2154 | - $handyatomtranslatorarray["\xA9".'art'] = 'artist'; // iTunes 4.0 |
|
2154 | + $handyatomtranslatorarray["\xA9".'art'] = 'artist'; // iTunes 4.0 |
|
2155 | 2155 | $handyatomtranslatorarray['aART'] = 'album_artist'; |
2156 | - $handyatomtranslatorarray['trkn'] = 'track_number'; // iTunes 4.0 |
|
2157 | - $handyatomtranslatorarray['disk'] = 'disc_number'; // iTunes 4.0 |
|
2158 | - $handyatomtranslatorarray['gnre'] = 'genre'; // iTunes 4.0 |
|
2159 | - $handyatomtranslatorarray["\xA9".'too'] = 'encoder'; // iTunes 4.0 |
|
2160 | - $handyatomtranslatorarray['tmpo'] = 'bpm'; // iTunes 4.0 |
|
2161 | - $handyatomtranslatorarray['cprt'] = 'copyright'; // iTunes 4.0? |
|
2162 | - $handyatomtranslatorarray['cpil'] = 'compilation'; // iTunes 4.0 |
|
2163 | - $handyatomtranslatorarray['covr'] = 'picture'; // iTunes 4.0 |
|
2164 | - $handyatomtranslatorarray['rtng'] = 'rating'; // iTunes 4.0 |
|
2165 | - $handyatomtranslatorarray["\xA9".'grp'] = 'grouping'; // iTunes 4.2 |
|
2166 | - $handyatomtranslatorarray['stik'] = 'stik'; // iTunes 4.9 |
|
2167 | - $handyatomtranslatorarray['pcst'] = 'podcast'; // iTunes 4.9 |
|
2168 | - $handyatomtranslatorarray['catg'] = 'category'; // iTunes 4.9 |
|
2169 | - $handyatomtranslatorarray['keyw'] = 'keyword'; // iTunes 4.9 |
|
2170 | - $handyatomtranslatorarray['purl'] = 'podcast_url'; // iTunes 4.9 |
|
2171 | - $handyatomtranslatorarray['egid'] = 'episode_guid'; // iTunes 4.9 |
|
2172 | - $handyatomtranslatorarray['desc'] = 'description'; // iTunes 5.0 |
|
2173 | - $handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics'; // iTunes 5.0 |
|
2174 | - $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; // iTunes 6.0 |
|
2175 | - $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; // iTunes 6.0 |
|
2176 | - $handyatomtranslatorarray['tvsn'] = 'tv_season'; // iTunes 6.0 |
|
2177 | - $handyatomtranslatorarray['tves'] = 'tv_episode'; // iTunes 6.0 |
|
2178 | - $handyatomtranslatorarray['purd'] = 'purchase_date'; // iTunes 6.0.2 |
|
2156 | + $handyatomtranslatorarray['trkn'] = 'track_number'; // iTunes 4.0 |
|
2157 | + $handyatomtranslatorarray['disk'] = 'disc_number'; // iTunes 4.0 |
|
2158 | + $handyatomtranslatorarray['gnre'] = 'genre'; // iTunes 4.0 |
|
2159 | + $handyatomtranslatorarray["\xA9".'too'] = 'encoder'; // iTunes 4.0 |
|
2160 | + $handyatomtranslatorarray['tmpo'] = 'bpm'; // iTunes 4.0 |
|
2161 | + $handyatomtranslatorarray['cprt'] = 'copyright'; // iTunes 4.0? |
|
2162 | + $handyatomtranslatorarray['cpil'] = 'compilation'; // iTunes 4.0 |
|
2163 | + $handyatomtranslatorarray['covr'] = 'picture'; // iTunes 4.0 |
|
2164 | + $handyatomtranslatorarray['rtng'] = 'rating'; // iTunes 4.0 |
|
2165 | + $handyatomtranslatorarray["\xA9".'grp'] = 'grouping'; // iTunes 4.2 |
|
2166 | + $handyatomtranslatorarray['stik'] = 'stik'; // iTunes 4.9 |
|
2167 | + $handyatomtranslatorarray['pcst'] = 'podcast'; // iTunes 4.9 |
|
2168 | + $handyatomtranslatorarray['catg'] = 'category'; // iTunes 4.9 |
|
2169 | + $handyatomtranslatorarray['keyw'] = 'keyword'; // iTunes 4.9 |
|
2170 | + $handyatomtranslatorarray['purl'] = 'podcast_url'; // iTunes 4.9 |
|
2171 | + $handyatomtranslatorarray['egid'] = 'episode_guid'; // iTunes 4.9 |
|
2172 | + $handyatomtranslatorarray['desc'] = 'description'; // iTunes 5.0 |
|
2173 | + $handyatomtranslatorarray["\xA9".'lyr'] = 'lyrics'; // iTunes 5.0 |
|
2174 | + $handyatomtranslatorarray['tvnn'] = 'tv_network_name'; // iTunes 6.0 |
|
2175 | + $handyatomtranslatorarray['tvsh'] = 'tv_show_name'; // iTunes 6.0 |
|
2176 | + $handyatomtranslatorarray['tvsn'] = 'tv_season'; // iTunes 6.0 |
|
2177 | + $handyatomtranslatorarray['tves'] = 'tv_episode'; // iTunes 6.0 |
|
2178 | + $handyatomtranslatorarray['purd'] = 'purchase_date'; // iTunes 6.0.2 |
|
2179 | 2179 | $handyatomtranslatorarray['pgap'] = 'gapless_playback'; // iTunes 7.0 |
2180 | 2180 | |
2181 | 2181 | // http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt |
@@ -2211,7 +2211,7 @@ discard block |
||
2211 | 2211 | } |
2212 | 2212 | if ($comment_key) { |
2213 | 2213 | if ($comment_key == 'picture') { |
2214 | - if (!is_array($data)) { |
|
2214 | + if ( ! is_array($data)) { |
|
2215 | 2215 | $image_mime = ''; |
2216 | 2216 | if (preg_match('#^\x89\x50\x4E\x47\x0D\x0A\x1A\x0A#', $data)) { |
2217 | 2217 | $image_mime = 'image/png'; |
@@ -1320,6 +1320,9 @@ discard block |
||
1320 | 1320 | return true; |
1321 | 1321 | } |
1322 | 1322 | |
1323 | + /** |
|
1324 | + * @param double $startoffset |
|
1325 | + */ |
|
1323 | 1326 | public function ParseRIFFAMV($startoffset, $maxoffset) { |
1324 | 1327 | // AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size |
1325 | 1328 | |
@@ -1715,6 +1718,9 @@ discard block |
||
1715 | 1718 | return $RIFFchunk; |
1716 | 1719 | } |
1717 | 1720 | |
1721 | + /** |
|
1722 | + * @param string $RIFFdata |
|
1723 | + */ |
|
1718 | 1724 | public function ParseRIFFdata(&$RIFFdata) { |
1719 | 1725 | $info = &$this->getid3->info; |
1720 | 1726 | if ($RIFFdata) { |
@@ -1836,6 +1842,9 @@ discard block |
||
1836 | 1842 | return $WaveFormatEx; |
1837 | 1843 | } |
1838 | 1844 | |
1845 | + /** |
|
1846 | + * @param string $WavPackChunkData |
|
1847 | + */ |
|
1839 | 1848 | public function parseWavPackHeader($WavPackChunkData) { |
1840 | 1849 | // typedef struct { |
1841 | 1850 | // char ckID [4]; |
@@ -1916,6 +1925,9 @@ discard block |
||
1916 | 1925 | return $parsed; |
1917 | 1926 | } |
1918 | 1927 | |
1928 | + /** |
|
1929 | + * @param string $DIVXTAG |
|
1930 | + */ |
|
1919 | 1931 | public static function ParseDIVXTAG($DIVXTAG, $raw=false) { |
1920 | 1932 | // structure from "IDivX" source, Form1.frm, by "Greg Frazier of Daemonic Software Group", email: [email protected], web: http://dsg.cjb.net/ |
1921 | 1933 | // source available at http://files.divx-digest.com/download/c663efe7ef8ad2e90bf4af4d3ea6188a/on0SWN2r/edit/IDivX.zip |
@@ -1990,6 +2002,9 @@ discard block |
||
1990 | 2002 | return $parsed; |
1991 | 2003 | } |
1992 | 2004 | |
2005 | + /** |
|
2006 | + * @param string $tagshortname |
|
2007 | + */ |
|
1993 | 2008 | public static function waveSNDMtagLookup($tagshortname) { |
1994 | 2009 | $begin = __LINE__; |
1995 | 2010 | |
@@ -2576,6 +2591,9 @@ discard block |
||
2576 | 2591 | return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); |
2577 | 2592 | } |
2578 | 2593 | |
2594 | + /** |
|
2595 | + * @param string $byteword |
|
2596 | + */ |
|
2579 | 2597 | private function EitherEndian2Int($byteword, $signed=false) { |
2580 | 2598 | if ($this->container == 'riff') { |
2581 | 2599 | return getid3_lib::LittleEndian2Int($byteword, $signed); |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | 'capturedfile' => 0x00010000, |
694 | 694 | 'copyrighted' => 0x00020010, |
695 | 695 | ); |
696 | - foreach ($flags as $flag => $value) { |
|
696 | + foreach ($flags as $flag => $value) { |
|
697 | 697 | $thisfile_riff_raw_avih['flags'][$flag] = (bool) ($thisfile_riff_raw_avih['dwFlags'] & $value); |
698 | 698 | } |
699 | 699 | |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | // http://en.wikipedia.org/wiki/CD-DA |
913 | 913 | case 'CDDA': |
914 | 914 | $info['fileformat'] = 'cda'; |
915 | - unset($info['mime_type']); |
|
915 | + unset($info['mime_type']); |
|
916 | 916 | |
917 | 917 | $thisfile_audio_dataformat = 'cda'; |
918 | 918 | |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | } |
946 | 946 | break; |
947 | 947 | |
948 | - // http://en.wikipedia.org/wiki/AIFF |
|
948 | + // http://en.wikipedia.org/wiki/AIFF |
|
949 | 949 | case 'AIFF': |
950 | 950 | case 'AIFC': |
951 | 951 | $info['fileformat'] = 'aiff'; |
@@ -2007,8 +2007,7 @@ discard block |
||
2007 | 2007 | ©cdt cdtitle |
2008 | 2008 | ©alb library |
2009 | 2009 | ©com composer |
2010 | - |
|
2011 | - */ |
|
2010 | + */ |
|
2012 | 2011 | |
2013 | 2012 | return getid3_lib::EmbeddedLookup($tagshortname, $begin, __LINE__, __FILE__, 'riff-sndm'); |
2014 | 2013 | } |
@@ -2176,8 +2175,7 @@ discard block |
||
2176 | 2175 | 0x7A22 GSM-AMR (VBR, including SID) |
2177 | 2176 | 0xFFFE WAVE_FORMAT_EXTENSIBLE |
2178 | 2177 | 0xFFFF WAVE_FORMAT_DEVELOPMENT |
2179 | - |
|
2180 | - */ |
|
2178 | + */ |
|
2181 | 2179 | |
2182 | 2180 | return getid3_lib::EmbeddedLookup('0x'.str_pad(strtoupper(dechex($wFormatTag)), 4, '0', STR_PAD_LEFT), $begin, __LINE__, __FILE__, 'riff-wFormatTag'); |
2183 | 2181 | } |
@@ -2570,8 +2568,7 @@ discard block |
||
2570 | 2568 | YVYU YVYU 4:2:2 Packed |
2571 | 2569 | ZLIB Lossless Codec Library zlib compression (www.geocities.co.jp/Playtown-Denei/2837/LRC.htm) |
2572 | 2570 | ZPEG Metheus Video Zipper |
2573 | - |
|
2574 | - */ |
|
2571 | + */ |
|
2575 | 2572 | |
2576 | 2573 | return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); |
2577 | 2574 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | if ($RIFFsubtype != 'AMV ') { |
80 | 80 | // AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size |
81 | 81 | // Handled separately in ParseRIFFAMV() |
82 | - $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); |
|
82 | + $thisfile_riff[$RIFFsubtype] = $this->ParseRIFF($offset, ($offset + $thisfile_riff['header_size'] - 4)); |
|
83 | 83 | } |
84 | 84 | if (($info['avdataend'] - $info['filesize']) == 1) { |
85 | 85 | // LiteWave appears to incorrectly *not* pad actual output file |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | break; |
110 | 110 | } |
111 | 111 | } |
112 | - $nextRIFFheaderID = substr($nextRIFFheader, 0, 4); |
|
112 | + $nextRIFFheaderID = substr($nextRIFFheader, 0, 4); |
|
113 | 113 | $nextRIFFsize = $this->EitherEndian2Int(substr($nextRIFFheader, 4, 4)); |
114 | - $nextRIFFtype = substr($nextRIFFheader, 8, 4); |
|
114 | + $nextRIFFtype = substr($nextRIFFheader, 8, 4); |
|
115 | 115 | $chunkdata = array(); |
116 | 116 | $chunkdata['offset'] = $nextRIFFoffset + 8; |
117 | 117 | $chunkdata['size'] = $nextRIFFsize; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | switch ($nextRIFFheaderID) { |
121 | 121 | case 'RIFF': |
122 | 122 | $chunkdata['chunks'] = $this->ParseRIFF($chunkdata['offset'] + 4, $nextRIFFoffset); |
123 | - if (!isset($thisfile_riff[$nextRIFFtype])) { |
|
123 | + if ( ! isset($thisfile_riff[$nextRIFFtype])) { |
|
124 | 124 | $thisfile_riff[$nextRIFFtype] = array(); |
125 | 125 | } |
126 | 126 | $thisfile_riff[$nextRIFFtype][] = $chunkdata; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | $thisfile_riff_audio[$streamindex] = self::parseWAVEFORMATex($thisfile_riff_WAVE['fmt '][0]['data']); |
191 | 191 | $thisfile_audio['wformattag'] = $thisfile_riff_audio[$streamindex]['raw']['wFormatTag']; |
192 | - if (!isset($thisfile_riff_audio[$streamindex]['bitrate']) || ($thisfile_riff_audio[$streamindex]['bitrate'] == 0)) { |
|
192 | + if ( ! isset($thisfile_riff_audio[$streamindex]['bitrate']) || ($thisfile_riff_audio[$streamindex]['bitrate'] == 0)) { |
|
193 | 193 | $info['error'][] = 'Corrupt RIFF file: bitrate_audio == zero'; |
194 | 194 | return false; |
195 | 195 | } |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | $thisfile_riff_raw_rgad_album = &$thisfile_riff_raw_rgad['album']; |
242 | 242 | |
243 | 243 | $thisfile_riff_raw_rgad['fPeakAmplitude'] = getid3_lib::LittleEndian2Float(substr($rgadData, 0, 4)); |
244 | - $thisfile_riff_raw_rgad['nRadioRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 4, 2)); |
|
245 | - $thisfile_riff_raw_rgad['nAudiophileRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 6, 2)); |
|
244 | + $thisfile_riff_raw_rgad['nRadioRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 4, 2)); |
|
245 | + $thisfile_riff_raw_rgad['nAudiophileRgAdjust'] = $this->EitherEndian2Int(substr($rgadData, 6, 2)); |
|
246 | 246 | |
247 | 247 | $nRadioRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nRadioRgAdjust']), 16, '0', STR_PAD_LEFT); |
248 | 248 | $nAudiophileRgAdjustBitstring = str_pad(getid3_lib::Dec2Bin($thisfile_riff_raw_rgad['nAudiophileRgAdjust']), 16, '0', STR_PAD_LEFT); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | // $info['playtime_seconds'] = (float) $thisfile_riff_raw['fact']['NumberOfSamples'] / $thisfile_riff_raw['fmt ']['nSamplesPerSec']; |
280 | 280 | // } |
281 | 281 | } |
282 | - if (!empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) { |
|
282 | + if ( ! empty($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'])) { |
|
283 | 283 | $thisfile_audio['bitrate'] = getid3_lib::CastAsInt($thisfile_riff_raw['fmt ']['nAvgBytesPerSec'] * 8); |
284 | 284 | } |
285 | 285 | |
@@ -287,18 +287,18 @@ discard block |
||
287 | 287 | // shortcut |
288 | 288 | $thisfile_riff_WAVE_bext_0 = &$thisfile_riff_WAVE['bext'][0]; |
289 | 289 | |
290 | - $thisfile_riff_WAVE_bext_0['title'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 0, 256)); |
|
291 | - $thisfile_riff_WAVE_bext_0['author'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 256, 32)); |
|
292 | - $thisfile_riff_WAVE_bext_0['reference'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 288, 32)); |
|
293 | - $thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10); |
|
294 | - $thisfile_riff_WAVE_bext_0['origin_time'] = substr($thisfile_riff_WAVE_bext_0['data'], 330, 8); |
|
295 | - $thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338, 8)); |
|
296 | - $thisfile_riff_WAVE_bext_0['bwf_version'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346, 1)); |
|
297 | - $thisfile_riff_WAVE_bext_0['reserved'] = substr($thisfile_riff_WAVE_bext_0['data'], 347, 254); |
|
298 | - $thisfile_riff_WAVE_bext_0['coding_history'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601))); |
|
290 | + $thisfile_riff_WAVE_bext_0['title'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 0, 256)); |
|
291 | + $thisfile_riff_WAVE_bext_0['author'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 256, 32)); |
|
292 | + $thisfile_riff_WAVE_bext_0['reference'] = trim(substr($thisfile_riff_WAVE_bext_0['data'], 288, 32)); |
|
293 | + $thisfile_riff_WAVE_bext_0['origin_date'] = substr($thisfile_riff_WAVE_bext_0['data'], 320, 10); |
|
294 | + $thisfile_riff_WAVE_bext_0['origin_time'] = substr($thisfile_riff_WAVE_bext_0['data'], 330, 8); |
|
295 | + $thisfile_riff_WAVE_bext_0['time_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 338, 8)); |
|
296 | + $thisfile_riff_WAVE_bext_0['bwf_version'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_bext_0['data'], 346, 1)); |
|
297 | + $thisfile_riff_WAVE_bext_0['reserved'] = substr($thisfile_riff_WAVE_bext_0['data'], 347, 254); |
|
298 | + $thisfile_riff_WAVE_bext_0['coding_history'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_bext_0['data'], 601))); |
|
299 | 299 | if (preg_match('#^([0-9]{4}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_date'], $matches_bext_date)) { |
300 | 300 | if (preg_match('#^([0-9]{2}).([0-9]{2}).([0-9]{2})$#', $thisfile_riff_WAVE_bext_0['origin_time'], $matches_bext_time)) { |
301 | - list($dummy, $bext_timestamp['year'], $bext_timestamp['month'], $bext_timestamp['day']) = $matches_bext_date; |
|
301 | + list($dummy, $bext_timestamp['year'], $bext_timestamp['month'], $bext_timestamp['day']) = $matches_bext_date; |
|
302 | 302 | list($dummy, $bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second']) = $matches_bext_time; |
303 | 303 | $thisfile_riff_WAVE_bext_0['origin_date_unix'] = gmmktime($bext_timestamp['hour'], $bext_timestamp['minute'], $bext_timestamp['second'], $bext_timestamp['month'], $bext_timestamp['day'], $bext_timestamp['year']); |
304 | 304 | } else { |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | $thisfile_riff_WAVE_MEXT_0['flags']['homogenous'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0001); |
320 | 320 | if ($thisfile_riff_WAVE_MEXT_0['flags']['homogenous']) { |
321 | 321 | $thisfile_riff_WAVE_MEXT_0['flags']['padding'] = ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0002) ? false : true; |
322 | - $thisfile_riff_WAVE_MEXT_0['flags']['22_or_44'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004); |
|
323 | - $thisfile_riff_WAVE_MEXT_0['flags']['free_format'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008); |
|
322 | + $thisfile_riff_WAVE_MEXT_0['flags']['22_or_44'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0004); |
|
323 | + $thisfile_riff_WAVE_MEXT_0['flags']['free_format'] = (bool) ($thisfile_riff_WAVE_MEXT_0['raw']['sound_information'] & 0x0008); |
|
324 | 324 | |
325 | 325 | $thisfile_riff_WAVE_MEXT_0['nominal_frame_size'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_MEXT_0['data'], 2, 2)); |
326 | 326 | } |
@@ -335,27 +335,27 @@ discard block |
||
335 | 335 | // shortcut |
336 | 336 | $thisfile_riff_WAVE_cart_0 = &$thisfile_riff_WAVE['cart'][0]; |
337 | 337 | |
338 | - $thisfile_riff_WAVE_cart_0['version'] = substr($thisfile_riff_WAVE_cart_0['data'], 0, 4); |
|
339 | - $thisfile_riff_WAVE_cart_0['title'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 4, 64)); |
|
340 | - $thisfile_riff_WAVE_cart_0['artist'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 68, 64)); |
|
341 | - $thisfile_riff_WAVE_cart_0['cut_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64)); |
|
342 | - $thisfile_riff_WAVE_cart_0['client_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64)); |
|
343 | - $thisfile_riff_WAVE_cart_0['category'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64)); |
|
344 | - $thisfile_riff_WAVE_cart_0['classification'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64)); |
|
345 | - $thisfile_riff_WAVE_cart_0['out_cue'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64)); |
|
346 | - $thisfile_riff_WAVE_cart_0['start_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10)); |
|
347 | - $thisfile_riff_WAVE_cart_0['start_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 462, 8)); |
|
348 | - $thisfile_riff_WAVE_cart_0['end_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10)); |
|
349 | - $thisfile_riff_WAVE_cart_0['end_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 480, 8)); |
|
350 | - $thisfile_riff_WAVE_cart_0['producer_app_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64)); |
|
351 | - $thisfile_riff_WAVE_cart_0['producer_app_version'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64)); |
|
352 | - $thisfile_riff_WAVE_cart_0['user_defined_text'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64)); |
|
353 | - $thisfile_riff_WAVE_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680, 4), true); |
|
338 | + $thisfile_riff_WAVE_cart_0['version'] = substr($thisfile_riff_WAVE_cart_0['data'], 0, 4); |
|
339 | + $thisfile_riff_WAVE_cart_0['title'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 4, 64)); |
|
340 | + $thisfile_riff_WAVE_cart_0['artist'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 68, 64)); |
|
341 | + $thisfile_riff_WAVE_cart_0['cut_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 132, 64)); |
|
342 | + $thisfile_riff_WAVE_cart_0['client_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 196, 64)); |
|
343 | + $thisfile_riff_WAVE_cart_0['category'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 260, 64)); |
|
344 | + $thisfile_riff_WAVE_cart_0['classification'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 324, 64)); |
|
345 | + $thisfile_riff_WAVE_cart_0['out_cue'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 388, 64)); |
|
346 | + $thisfile_riff_WAVE_cart_0['start_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 452, 10)); |
|
347 | + $thisfile_riff_WAVE_cart_0['start_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 462, 8)); |
|
348 | + $thisfile_riff_WAVE_cart_0['end_date'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 470, 10)); |
|
349 | + $thisfile_riff_WAVE_cart_0['end_time'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 480, 8)); |
|
350 | + $thisfile_riff_WAVE_cart_0['producer_app_id'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 488, 64)); |
|
351 | + $thisfile_riff_WAVE_cart_0['producer_app_version'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 552, 64)); |
|
352 | + $thisfile_riff_WAVE_cart_0['user_defined_text'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 616, 64)); |
|
353 | + $thisfile_riff_WAVE_cart_0['zero_db_reference'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 680, 4), true); |
|
354 | 354 | for ($i = 0; $i < 8; $i++) { |
355 | - $thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] = substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4); |
|
355 | + $thisfile_riff_WAVE_cart_0['post_time'][$i]['usage_fourcc'] = substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8), 4); |
|
356 | 356 | $thisfile_riff_WAVE_cart_0['post_time'][$i]['timer_value'] = getid3_lib::LittleEndian2Int(substr($thisfile_riff_WAVE_cart_0['data'], 684 + ($i * 8) + 4, 4)); |
357 | 357 | } |
358 | - $thisfile_riff_WAVE_cart_0['url'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 748, 1024)); |
|
358 | + $thisfile_riff_WAVE_cart_0['url'] = trim(substr($thisfile_riff_WAVE_cart_0['data'], 748, 1024)); |
|
359 | 359 | $thisfile_riff_WAVE_cart_0['tag_text'] = explode("\r\n", trim(substr($thisfile_riff_WAVE_cart_0['data'], 1772))); |
360 | 360 | |
361 | 361 | $thisfile_riff['comments']['artist'][] = $thisfile_riff_WAVE_cart_0['artist']; |
@@ -375,13 +375,13 @@ discard block |
||
375 | 375 | $SNDM_thisTagOffset = 0; |
376 | 376 | $SNDM_thisTagSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4)); |
377 | 377 | $SNDM_thisTagOffset += 4; |
378 | - $SNDM_thisTagKey = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4); |
|
378 | + $SNDM_thisTagKey = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 4); |
|
379 | 379 | $SNDM_thisTagOffset += 4; |
380 | 380 | $SNDM_thisTagDataSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2)); |
381 | 381 | $SNDM_thisTagOffset += 2; |
382 | 382 | $SNDM_thisTagDataFlags = getid3_lib::BigEndian2Int(substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, 2)); |
383 | 383 | $SNDM_thisTagOffset += 2; |
384 | - $SNDM_thisTagDataText = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, $SNDM_thisTagDataSize); |
|
384 | + $SNDM_thisTagDataText = substr($thisfile_riff_WAVE_SNDM_0_data, $SNDM_startoffset + $SNDM_thisTagOffset, $SNDM_thisTagDataSize); |
|
385 | 385 | $SNDM_thisTagOffset += $SNDM_thisTagDataSize; |
386 | 386 | |
387 | 387 | if ($SNDM_thisTagSize != (4 + 4 + 2 + 2 + $SNDM_thisTagDataSize)) { |
@@ -426,15 +426,15 @@ discard block |
||
426 | 426 | @list($numerator, $denominator) = explode('/', $parsedXML['SPEED']['TIMECODE_RATE']); |
427 | 427 | $thisfile_riff_WAVE['iXML'][0]['timecode_rate'] = $numerator / ($denominator ? $denominator : 1000); |
428 | 428 | } |
429 | - if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && !empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && !empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) { |
|
429 | + if (isset($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO']) && ! empty($parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']) && ! empty($thisfile_riff_WAVE['iXML'][0]['timecode_rate'])) { |
|
430 | 430 | $samples_since_midnight = floatval(ltrim($parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_HI'].$parsedXML['SPEED']['TIMESTAMP_SAMPLES_SINCE_MIDNIGHT_LO'], '0')); |
431 | 431 | $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] = $samples_since_midnight / $parsedXML['SPEED']['TIMESTAMP_SAMPLE_RATE']; |
432 | - $h = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] / 3600); |
|
433 | - $m = floor(($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600)) / 60); |
|
434 | - $s = floor( $thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60)); |
|
435 | - $f = ($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60) - $s) * $thisfile_riff_WAVE['iXML'][0]['timecode_rate']; |
|
436 | - $thisfile_riff_WAVE['iXML'][0]['timecode_string'] = sprintf('%02d:%02d:%02d:%05.2f', $h, $m, $s, $f); |
|
437 | - $thisfile_riff_WAVE['iXML'][0]['timecode_string_round'] = sprintf('%02d:%02d:%02d:%02d', $h, $m, $s, round($f)); |
|
432 | + $h = floor($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] / 3600); |
|
433 | + $m = floor(($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600)) / 60); |
|
434 | + $s = floor($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60)); |
|
435 | + $f = ($thisfile_riff_WAVE['iXML'][0]['timecode_seconds'] - ($h * 3600) - ($m * 60) - $s) * $thisfile_riff_WAVE['iXML'][0]['timecode_rate']; |
|
436 | + $thisfile_riff_WAVE['iXML'][0]['timecode_string'] = sprintf('%02d:%02d:%02d:%05.2f', $h, $m, $s, $f); |
|
437 | + $thisfile_riff_WAVE['iXML'][0]['timecode_string_round'] = sprintf('%02d:%02d:%02d:%02d', $h, $m, $s, round($f)); |
|
438 | 438 | } |
439 | 439 | unset($parsedXML); |
440 | 440 | } |
@@ -442,23 +442,23 @@ discard block |
||
442 | 442 | |
443 | 443 | |
444 | 444 | |
445 | - if (!isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) { |
|
445 | + if ( ! isset($thisfile_audio['bitrate']) && isset($thisfile_riff_audio[$streamindex]['bitrate'])) { |
|
446 | 446 | $thisfile_audio['bitrate'] = $thisfile_riff_audio[$streamindex]['bitrate']; |
447 | 447 | $info['playtime_seconds'] = (float) ((($info['avdataend'] - $info['avdataoffset']) * 8) / $thisfile_audio['bitrate']); |
448 | 448 | } |
449 | 449 | |
450 | - if (!empty($info['wavpack'])) { |
|
450 | + if ( ! empty($info['wavpack'])) { |
|
451 | 451 | $thisfile_audio_dataformat = 'wavpack'; |
452 | 452 | $thisfile_audio['bitrate_mode'] = 'vbr'; |
453 | 453 | $thisfile_audio['encoder'] = 'WavPack v'.$info['wavpack']['version']; |
454 | 454 | |
455 | 455 | // Reset to the way it was - RIFF parsing will have messed this up |
456 | - $info['avdataend'] = $Original['avdataend']; |
|
456 | + $info['avdataend'] = $Original['avdataend']; |
|
457 | 457 | $thisfile_audio['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds']; |
458 | 458 | |
459 | 459 | $this->fseek($info['avdataoffset'] - 44); |
460 | 460 | $RIFFdata = $this->fread(44); |
461 | - $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; |
|
461 | + $OrignalRIFFheaderSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 4, 4)) + 8; |
|
462 | 462 | $OrignalRIFFdataSize = getid3_lib::LittleEndian2Int(substr($RIFFdata, 40, 4)) + 44; |
463 | 463 | |
464 | 464 | if ($OrignalRIFFheaderSize > $OrignalRIFFdataSize) { |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | if (isset($thisfile_riff_raw['fmt ']['wFormatTag'])) { |
480 | 480 | switch ($thisfile_riff_raw['fmt ']['wFormatTag']) { |
481 | 481 | case 0x0001: // PCM |
482 | - if (!empty($info['ac3'])) { |
|
482 | + if ( ! empty($info['ac3'])) { |
|
483 | 483 | // Dolby Digital WAV files masquerade as PCM-WAV, but they're not |
484 | 484 | $thisfile_audio['wformattag'] = 0x2000; |
485 | 485 | $thisfile_audio['codec'] = self::wFormatTagLookup($thisfile_audio['wformattag']); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | $thisfile_audio['bitrate'] = $info['ac3']['bitrate']; |
488 | 488 | $thisfile_audio['sample_rate'] = $info['ac3']['sample_rate']; |
489 | 489 | } |
490 | - if (!empty($info['dts'])) { |
|
490 | + if ( ! empty($info['dts'])) { |
|
491 | 491 | // Dolby DTS files masquerade as PCM-WAV, but they're not |
492 | 492 | $thisfile_audio['wformattag'] = 0x2001; |
493 | 493 | $thisfile_audio['codec'] = self::wFormatTagLookup($thisfile_audio['wformattag']); |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | break; |
499 | 499 | case 0x08AE: // ClearJump LiteWave |
500 | 500 | $thisfile_audio['bitrate_mode'] = 'vbr'; |
501 | - $thisfile_audio_dataformat = 'litewave'; |
|
501 | + $thisfile_audio_dataformat = 'litewave'; |
|
502 | 502 | |
503 | 503 | //typedef struct tagSLwFormat { |
504 | 504 | // WORD m_wCompFormat; // low byte defines compression method, high byte is compression flags |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | |
545 | 545 | $riff_litewave['flags']['raw_source'] = ($riff_litewave_raw['compression_flags'] & 0x01) ? false : true; |
546 | 546 | $riff_litewave['flags']['vbr_blocksize'] = ($riff_litewave_raw['compression_flags'] & 0x02) ? false : true; |
547 | - $riff_litewave['flags']['seekpoints'] = (bool) ($riff_litewave_raw['compression_flags'] & 0x04); |
|
547 | + $riff_litewave['flags']['seekpoints'] = (bool) ($riff_litewave_raw['compression_flags'] & 0x04); |
|
548 | 548 | |
549 | 549 | $thisfile_audio['lossless'] = (($riff_litewave_raw['m_wQuality'] == 100) ? true : false); |
550 | 550 | $thisfile_audio['encoder_options'] = '-q'.$riff_litewave['quality_factor']; |
@@ -555,11 +555,11 @@ discard block |
||
555 | 555 | } |
556 | 556 | } |
557 | 557 | if ($info['avdataend'] > $info['filesize']) { |
558 | - switch (!empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') { |
|
559 | - case 'wavpack': // WavPack |
|
560 | - case 'lpac': // LPAC |
|
561 | - case 'ofr': // OptimFROG |
|
562 | - case 'ofs': // OptimFROG DualStream |
|
558 | + switch ( ! empty($thisfile_audio_dataformat) ? $thisfile_audio_dataformat : '') { |
|
559 | + case 'wavpack' : // WavPack |
|
560 | + case 'lpac' : // LPAC |
|
561 | + case 'ofr' : // OptimFROG |
|
562 | + case 'ofs' : // OptimFROG DualStream |
|
563 | 563 | // lossless compressed audio formats that keep original RIFF headers - skip warning |
564 | 564 | break; |
565 | 565 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | break; |
590 | 590 | } |
591 | 591 | } |
592 | - if (!empty($info['mpeg']['audio']['LAME']['audio_bytes'])) { |
|
592 | + if ( ! empty($info['mpeg']['audio']['LAME']['audio_bytes'])) { |
|
593 | 593 | if ((($info['avdataend'] - $info['avdataoffset']) - $info['mpeg']['audio']['LAME']['audio_bytes']) == 1) { |
594 | 594 | $info['avdataend']--; |
595 | 595 | $info['warning'][] = 'Extra null byte at end of MP3 data assumed to be RIFF padding and therefore ignored'; |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | if (isset($thisfile_audio_dataformat) && ($thisfile_audio_dataformat == 'ac3')) { |
599 | 599 | unset($thisfile_audio['bits_per_sample']); |
600 | - if (!empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) { |
|
600 | + if ( ! empty($info['ac3']['bitrate']) && ($info['ac3']['bitrate'] != $thisfile_audio['bitrate'])) { |
|
601 | 601 | $thisfile_audio['bitrate'] = $info['ac3']['bitrate']; |
602 | 602 | } |
603 | 603 | } |
@@ -638,11 +638,11 @@ discard block |
||
638 | 638 | foreach ($thisfile_riff['AVI ']['hdrl']['strl']['indx'] as $streamnumber => $steamdataarray) { |
639 | 639 | $ahsisd = &$thisfile_riff['AVI ']['hdrl']['strl']['indx'][$streamnumber]['data']; |
640 | 640 | |
641 | - $thisfile_riff_raw['indx'][$streamnumber]['wLongsPerEntry'] = $this->EitherEndian2Int(substr($ahsisd, 0, 2)); |
|
642 | - $thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType'] = $this->EitherEndian2Int(substr($ahsisd, 2, 1)); |
|
643 | - $thisfile_riff_raw['indx'][$streamnumber]['bIndexType'] = $this->EitherEndian2Int(substr($ahsisd, 3, 1)); |
|
644 | - $thisfile_riff_raw['indx'][$streamnumber]['nEntriesInUse'] = $this->EitherEndian2Int(substr($ahsisd, 4, 4)); |
|
645 | - $thisfile_riff_raw['indx'][$streamnumber]['dwChunkId'] = substr($ahsisd, 8, 4); |
|
641 | + $thisfile_riff_raw['indx'][$streamnumber]['wLongsPerEntry'] = $this->EitherEndian2Int(substr($ahsisd, 0, 2)); |
|
642 | + $thisfile_riff_raw['indx'][$streamnumber]['bIndexSubType'] = $this->EitherEndian2Int(substr($ahsisd, 2, 1)); |
|
643 | + $thisfile_riff_raw['indx'][$streamnumber]['bIndexType'] = $this->EitherEndian2Int(substr($ahsisd, 3, 1)); |
|
644 | + $thisfile_riff_raw['indx'][$streamnumber]['nEntriesInUse'] = $this->EitherEndian2Int(substr($ahsisd, 4, 4)); |
|
645 | + $thisfile_riff_raw['indx'][$streamnumber]['dwChunkId'] = substr($ahsisd, 8, 4); |
|
646 | 646 | $thisfile_riff_raw['indx'][$streamnumber]['dwReserved'] = $this->EitherEndian2Int(substr($ahsisd, 12, 4)); |
647 | 647 | |
648 | 648 | //$thisfile_riff_raw['indx'][$streamnumber]['bIndexType_name'] = $bIndexType[$thisfile_riff_raw['indx'][$streamnumber]['bIndexType']]; |
@@ -658,26 +658,26 @@ discard block |
||
658 | 658 | $thisfile_riff_raw['avih'] = array(); |
659 | 659 | $thisfile_riff_raw_avih = &$thisfile_riff_raw['avih']; |
660 | 660 | |
661 | - $thisfile_riff_raw_avih['dwMicroSecPerFrame'] = $this->EitherEndian2Int(substr($avihData, 0, 4)); // frame display rate (or 0L) |
|
661 | + $thisfile_riff_raw_avih['dwMicroSecPerFrame'] = $this->EitherEndian2Int(substr($avihData, 0, 4)); // frame display rate (or 0L) |
|
662 | 662 | if ($thisfile_riff_raw_avih['dwMicroSecPerFrame'] == 0) { |
663 | 663 | $info['error'][] = 'Corrupt RIFF file: avih.dwMicroSecPerFrame == zero'; |
664 | 664 | return false; |
665 | 665 | } |
666 | 666 | |
667 | 667 | $flags = array( |
668 | - 'dwMaxBytesPerSec', // max. transfer rate |
|
669 | - 'dwPaddingGranularity', // pad to multiples of this size; normally 2K. |
|
670 | - 'dwFlags', // the ever-present flags |
|
671 | - 'dwTotalFrames', // # frames in file |
|
672 | - 'dwInitialFrames', // |
|
673 | - 'dwStreams', // |
|
674 | - 'dwSuggestedBufferSize', // |
|
675 | - 'dwWidth', // |
|
676 | - 'dwHeight', // |
|
677 | - 'dwScale', // |
|
678 | - 'dwRate', // |
|
679 | - 'dwStart', // |
|
680 | - 'dwLength', // |
|
668 | + 'dwMaxBytesPerSec', // max. transfer rate |
|
669 | + 'dwPaddingGranularity', // pad to multiples of this size; normally 2K. |
|
670 | + 'dwFlags', // the ever-present flags |
|
671 | + 'dwTotalFrames', // # frames in file |
|
672 | + 'dwInitialFrames', // |
|
673 | + 'dwStreams', // |
|
674 | + 'dwSuggestedBufferSize', // |
|
675 | + 'dwWidth', // |
|
676 | + 'dwHeight', // |
|
677 | + 'dwScale', // |
|
678 | + 'dwRate', // |
|
679 | + 'dwStart', // |
|
680 | + 'dwLength', // |
|
681 | 681 | ); |
682 | 682 | $avih_offset = 4; |
683 | 683 | foreach ($flags as $flag) { |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | for ($i = 0; $i < count($thisfile_riff['AVI ']['hdrl']['strl']['strh']); $i++) { |
723 | 723 | if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data'])) { |
724 | 724 | $strhData = $thisfile_riff['AVI ']['hdrl']['strl']['strh'][$i]['data']; |
725 | - $strhfccType = substr($strhData, 0, 4); |
|
725 | + $strhfccType = substr($strhData, 0, 4); |
|
726 | 726 | |
727 | 727 | if (isset($thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data'])) { |
728 | 728 | $strfData = $thisfile_riff['AVI ']['hdrl']['strl']['strf'][$i]['data']; |
@@ -806,9 +806,9 @@ discard block |
||
806 | 806 | $thisfile_riff_raw['strh'][$i] = array(); |
807 | 807 | $thisfile_riff_raw_strh_current = &$thisfile_riff_raw['strh'][$i]; |
808 | 808 | |
809 | - $thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); // same as $strhfccType; |
|
810 | - $thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4); |
|
811 | - $thisfile_riff_raw_strh_current['dwFlags'] = $this->EitherEndian2Int(substr($strhData, 8, 4)); // Contains AVITF_* flags |
|
809 | + $thisfile_riff_raw_strh_current['fccType'] = substr($strhData, 0, 4); // same as $strhfccType; |
|
810 | + $thisfile_riff_raw_strh_current['fccHandler'] = substr($strhData, 4, 4); |
|
811 | + $thisfile_riff_raw_strh_current['dwFlags'] = $this->EitherEndian2Int(substr($strhData, 8, 4)); // Contains AVITF_* flags |
|
812 | 812 | $thisfile_riff_raw_strh_current['wPriority'] = $this->EitherEndian2Int(substr($strhData, 12, 2)); |
813 | 813 | $thisfile_riff_raw_strh_current['wLanguage'] = $this->EitherEndian2Int(substr($strhData, 14, 2)); |
814 | 814 | $thisfile_riff_raw_strh_current['dwInitialFrames'] = $this->EitherEndian2Int(substr($strhData, 16, 4)); |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | |
824 | 824 | $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strh_current['fccHandler']); |
825 | 825 | $thisfile_video['fourcc'] = $thisfile_riff_raw_strh_current['fccHandler']; |
826 | - if (!$thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { |
|
826 | + if ( ! $thisfile_riff_video_current['codec'] && isset($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']) && self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc'])) { |
|
827 | 827 | $thisfile_riff_video_current['codec'] = self::fourccLookup($thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']); |
828 | 828 | $thisfile_video['fourcc'] = $thisfile_riff_raw_strf_strhfccType_streamindex['fourcc']; |
829 | 829 | } |
@@ -877,12 +877,12 @@ discard block |
||
877 | 877 | case 'HFYU': // Huffman Lossless Codec |
878 | 878 | case 'IRAW': // Intel YUV Uncompressed |
879 | 879 | case 'YUY2': // Uncompressed YUV 4:2:2 |
880 | - $thisfile_video['lossless'] = true; |
|
880 | + $thisfile_video['lossless'] = true; |
|
881 | 881 | //$thisfile_video['bits_per_sample'] = 24; |
882 | 882 | break; |
883 | 883 | |
884 | 884 | default: |
885 | - $thisfile_video['lossless'] = false; |
|
885 | + $thisfile_video['lossless'] = false; |
|
886 | 886 | //$thisfile_video['bits_per_sample'] = 24; |
887 | 887 | break; |
888 | 888 | } |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | $info['fileformat'] = 'cda'; |
915 | 915 | unset($info['mime_type']); |
916 | 916 | |
917 | - $thisfile_audio_dataformat = 'cda'; |
|
917 | + $thisfile_audio_dataformat = 'cda'; |
|
918 | 918 | |
919 | 919 | $info['avdataoffset'] = 44; |
920 | 920 | |
@@ -922,10 +922,10 @@ discard block |
||
922 | 922 | // shortcut |
923 | 923 | $thisfile_riff_CDDA_fmt_0 = &$thisfile_riff['CDDA']['fmt '][0]; |
924 | 924 | |
925 | - $thisfile_riff_CDDA_fmt_0['unknown1'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2)); |
|
926 | - $thisfile_riff_CDDA_fmt_0['track_num'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2)); |
|
927 | - $thisfile_riff_CDDA_fmt_0['disc_id'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4)); |
|
928 | - $thisfile_riff_CDDA_fmt_0['start_offset_frame'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4)); |
|
925 | + $thisfile_riff_CDDA_fmt_0['unknown1'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2)); |
|
926 | + $thisfile_riff_CDDA_fmt_0['track_num'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2)); |
|
927 | + $thisfile_riff_CDDA_fmt_0['disc_id'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4)); |
|
928 | + $thisfile_riff_CDDA_fmt_0['start_offset_frame'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4)); |
|
929 | 929 | $thisfile_riff_CDDA_fmt_0['playtime_frames'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 12, 4)); |
930 | 930 | $thisfile_riff_CDDA_fmt_0['unknown6'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 16, 4)); |
931 | 931 | $thisfile_riff_CDDA_fmt_0['unknown7'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 20, 4)); |
@@ -974,15 +974,15 @@ discard block |
||
974 | 974 | // shortcut |
975 | 975 | $thisfile_riff_RIFFsubtype_COMM_0_data = &$thisfile_riff[$RIFFsubtype]['COMM'][0]['data']; |
976 | 976 | |
977 | - $thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true); |
|
978 | - $thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false); |
|
979 | - $thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true); |
|
980 | - $thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10)); |
|
977 | + $thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true); |
|
978 | + $thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false); |
|
979 | + $thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true); |
|
980 | + $thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10)); |
|
981 | 981 | |
982 | 982 | if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) { |
983 | - $thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4); |
|
984 | - $CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false); |
|
985 | - $thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize); |
|
983 | + $thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4); |
|
984 | + $CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false); |
|
985 | + $thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize); |
|
986 | 986 | switch ($thisfile_riff_audio['codec_name']) { |
987 | 987 | case 'NONE': |
988 | 988 | $thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)'; |
@@ -1014,11 +1014,11 @@ discard block |
||
1014 | 1014 | } |
1015 | 1015 | } |
1016 | 1016 | |
1017 | - $thisfile_audio['channels'] = $thisfile_riff_audio['channels']; |
|
1017 | + $thisfile_audio['channels'] = $thisfile_riff_audio['channels']; |
|
1018 | 1018 | if ($thisfile_riff_audio['bits_per_sample'] > 0) { |
1019 | 1019 | $thisfile_audio['bits_per_sample'] = $thisfile_riff_audio['bits_per_sample']; |
1020 | 1020 | } |
1021 | - $thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate']; |
|
1021 | + $thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate']; |
|
1022 | 1022 | if ($thisfile_audio['sample_rate'] == 0) { |
1023 | 1023 | $info['error'][] = 'Corrupted AIFF file: sample_rate == zero'; |
1024 | 1024 | return false; |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | |
1029 | 1029 | if (isset($thisfile_riff[$RIFFsubtype]['COMT'])) { |
1030 | 1030 | $offset = 0; |
1031 | - $CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); |
|
1031 | + $CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); |
|
1032 | 1032 | $offset += 2; |
1033 | 1033 | for ($i = 0; $i < $CommentCount; $i++) { |
1034 | 1034 | $info['comments_raw'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 4), false); |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | $offset += 2; |
1038 | 1038 | $CommentLength = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false); |
1039 | 1039 | $offset += 2; |
1040 | - $info['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength); |
|
1040 | + $info['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength); |
|
1041 | 1041 | $offset += $CommentLength; |
1042 | 1042 | |
1043 | 1043 | $info['comments_raw'][$i]['timestamp_unix'] = getid3_lib::DateMac2Unix($info['comments_raw'][$i]['timestamp']); |
@@ -1088,12 +1088,12 @@ discard block |
||
1088 | 1088 | // shortcut |
1089 | 1089 | $thisfile_riff_RIFFsubtype_VHDR_0 = &$thisfile_riff[$RIFFsubtype]['VHDR'][0]; |
1090 | 1090 | |
1091 | - $thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4)); |
|
1092 | - $thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4)); |
|
1093 | - $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4)); |
|
1094 | - $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2)); |
|
1095 | - $thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1)); |
|
1096 | - $thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1)); |
|
1091 | + $thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4)); |
|
1092 | + $thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4)); |
|
1093 | + $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4)); |
|
1094 | + $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2)); |
|
1095 | + $thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1)); |
|
1096 | + $thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1)); |
|
1097 | 1097 | $thisfile_riff_RIFFsubtype_VHDR_0['Volume'] = getid3_lib::FixedPoint16_16(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 16, 4)); |
1098 | 1098 | |
1099 | 1099 | $thisfile_audio['sample_rate'] = $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec']; |
@@ -1144,7 +1144,7 @@ discard block |
||
1144 | 1144 | } |
1145 | 1145 | |
1146 | 1146 | $thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $ActualBitsPerSample * $thisfile_audio['channels']; |
1147 | - if (!empty($thisfile_audio['bitrate'])) { |
|
1147 | + if ( ! empty($thisfile_audio['bitrate'])) { |
|
1148 | 1148 | $info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($thisfile_audio['bitrate'] / 8); |
1149 | 1149 | } |
1150 | 1150 | break; |
@@ -1153,7 +1153,7 @@ discard block |
||
1153 | 1153 | $info['fileformat'] = 'vcd'; // Asume Video CD |
1154 | 1154 | $info['mime_type'] = 'video/mpeg'; |
1155 | 1155 | |
1156 | - if (!empty($thisfile_riff['CDXA']['data'][0]['size'])) { |
|
1156 | + if ( ! empty($thisfile_riff['CDXA']['data'][0]['size'])) { |
|
1157 | 1157 | getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, true); |
1158 | 1158 | |
1159 | 1159 | $getid3_temp = new getID3(); |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | $ID3v2_key_good = 'id3 '; |
1184 | 1184 | $ID3v2_keys_bad = array('ID3 ', 'tag '); |
1185 | 1185 | foreach ($ID3v2_keys_bad as $ID3v2_key_bad) { |
1186 | - if (isset($thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]) && !array_key_exists($ID3v2_key_good, $thisfile_riff[$RIFFsubtype])) { |
|
1186 | + if (isset($thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]) && ! array_key_exists($ID3v2_key_good, $thisfile_riff[$RIFFsubtype])) { |
|
1187 | 1187 | $thisfile_riff[$RIFFsubtype][$ID3v2_key_good] = $thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]; |
1188 | 1188 | $info['warning'][] = 'mapping "'.$ID3v2_key_bad.'" chunk to "'.$ID3v2_key_good.'"'; |
1189 | 1189 | } |
@@ -1214,11 +1214,11 @@ discard block |
||
1214 | 1214 | self::parseComments($thisfile_riff['AVI ']['INFO'], $thisfile_riff['comments']); |
1215 | 1215 | } |
1216 | 1216 | |
1217 | - if (empty($thisfile_audio['encoder']) && !empty($info['mpeg']['audio']['LAME']['short_version'])) { |
|
1217 | + if (empty($thisfile_audio['encoder']) && ! empty($info['mpeg']['audio']['LAME']['short_version'])) { |
|
1218 | 1218 | $thisfile_audio['encoder'] = $info['mpeg']['audio']['LAME']['short_version']; |
1219 | 1219 | } |
1220 | 1220 | |
1221 | - if (!isset($info['playtime_seconds'])) { |
|
1221 | + if ( ! isset($info['playtime_seconds'])) { |
|
1222 | 1222 | $info['playtime_seconds'] = 0; |
1223 | 1223 | } |
1224 | 1224 | if (isset($thisfile_riff_raw['strh'][0]['dwLength']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { |
@@ -1231,19 +1231,19 @@ discard block |
||
1231 | 1231 | if ($info['playtime_seconds'] > 0) { |
1232 | 1232 | if (isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { |
1233 | 1233 | |
1234 | - if (!isset($info['bitrate'])) { |
|
1234 | + if ( ! isset($info['bitrate'])) { |
|
1235 | 1235 | $info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); |
1236 | 1236 | } |
1237 | 1237 | |
1238 | - } elseif (isset($thisfile_riff_audio) && !isset($thisfile_riff_video)) { |
|
1238 | + } elseif (isset($thisfile_riff_audio) && ! isset($thisfile_riff_video)) { |
|
1239 | 1239 | |
1240 | - if (!isset($thisfile_audio['bitrate'])) { |
|
1240 | + if ( ! isset($thisfile_audio['bitrate'])) { |
|
1241 | 1241 | $thisfile_audio['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); |
1242 | 1242 | } |
1243 | 1243 | |
1244 | - } elseif (!isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { |
|
1244 | + } elseif ( ! isset($thisfile_riff_audio) && isset($thisfile_riff_video)) { |
|
1245 | 1245 | |
1246 | - if (!isset($thisfile_video['bitrate'])) { |
|
1246 | + if ( ! isset($thisfile_video['bitrate'])) { |
|
1247 | 1247 | $thisfile_video['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8); |
1248 | 1248 | } |
1249 | 1249 | |
@@ -1274,10 +1274,10 @@ discard block |
||
1274 | 1274 | $thisfile_audio['channels'] = $info['mpeg']['audio']['channels']; |
1275 | 1275 | $thisfile_audio['bitrate'] = $info['mpeg']['audio']['bitrate']; |
1276 | 1276 | $thisfile_audio['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']); |
1277 | - if (!empty($info['mpeg']['audio']['codec'])) { |
|
1277 | + if ( ! empty($info['mpeg']['audio']['codec'])) { |
|
1278 | 1278 | $thisfile_audio['codec'] = $info['mpeg']['audio']['codec'].' '.$thisfile_audio['codec']; |
1279 | 1279 | } |
1280 | - if (!empty($thisfile_audio['streams'])) { |
|
1280 | + if ( ! empty($thisfile_audio['streams'])) { |
|
1281 | 1281 | foreach ($thisfile_audio['streams'] as $streamnumber => $streamdata) { |
1282 | 1282 | if ($streamdata['dataformat'] == $thisfile_audio_dataformat) { |
1283 | 1283 | $thisfile_audio['streams'][$streamnumber]['sample_rate'] = $thisfile_audio['sample_rate']; |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | } |
1295 | 1295 | |
1296 | 1296 | |
1297 | - if (!empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) { |
|
1297 | + if ( ! empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) { |
|
1298 | 1298 | switch ($thisfile_audio_dataformat) { |
1299 | 1299 | case 'ac3': |
1300 | 1300 | // ignore bits_per_sample |
@@ -1347,23 +1347,23 @@ discard block |
||
1347 | 1347 | $this->fseek($startoffset); |
1348 | 1348 | $maxoffset = min($maxoffset, $info['avdataend']); |
1349 | 1349 | $AMVheader = $this->fread(284); |
1350 | - if (substr($AMVheader, 0, 8) != 'hdrlamvh') { |
|
1351 | - throw new Exception('expecting "hdrlamv" at offset '.($startoffset + 0).', found "'.substr($AMVheader, 0, 8).'"'); |
|
1350 | + if (substr($AMVheader, 0, 8) != 'hdrlamvh') { |
|
1351 | + throw new Exception('expecting "hdrlamv" at offset '.($startoffset + 0).', found "'.substr($AMVheader, 0, 8).'"'); |
|
1352 | 1352 | } |
1353 | - if (substr($AMVheader, 8, 4) != "\x38\x00\x00\x00") { // "amvh" chunk size, hardcoded to 0x38 = 56 bytes |
|
1354 | - throw new Exception('expecting "0x38000000" at offset '.($startoffset + 8).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 8, 4)).'"'); |
|
1353 | + if (substr($AMVheader, 8, 4) != "\x38\x00\x00\x00") { // "amvh" chunk size, hardcoded to 0x38 = 56 bytes |
|
1354 | + throw new Exception('expecting "0x38000000" at offset '.($startoffset + 8).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 8, 4)).'"'); |
|
1355 | 1355 | } |
1356 | 1356 | $RIFFchunk = array(); |
1357 | - $RIFFchunk['amvh']['us_per_frame'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 12, 4)); |
|
1358 | - $RIFFchunk['amvh']['reserved28'] = substr($AMVheader, 16, 28); // null? reserved? |
|
1359 | - $RIFFchunk['amvh']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 44, 4)); |
|
1360 | - $RIFFchunk['amvh']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 48, 4)); |
|
1361 | - $RIFFchunk['amvh']['frame_rate_int'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 52, 4)); |
|
1362 | - $RIFFchunk['amvh']['reserved0'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 56, 4)); // 1? reserved? |
|
1363 | - $RIFFchunk['amvh']['reserved1'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 60, 4)); // 0? reserved? |
|
1364 | - $RIFFchunk['amvh']['runtime_sec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 64, 1)); |
|
1365 | - $RIFFchunk['amvh']['runtime_min'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 65, 1)); |
|
1366 | - $RIFFchunk['amvh']['runtime_hrs'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 66, 2)); |
|
1357 | + $RIFFchunk['amvh']['us_per_frame'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 12, 4)); |
|
1358 | + $RIFFchunk['amvh']['reserved28'] = substr($AMVheader, 16, 28); // null? reserved? |
|
1359 | + $RIFFchunk['amvh']['resolution_x'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 44, 4)); |
|
1360 | + $RIFFchunk['amvh']['resolution_y'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 48, 4)); |
|
1361 | + $RIFFchunk['amvh']['frame_rate_int'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 52, 4)); |
|
1362 | + $RIFFchunk['amvh']['reserved0'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 56, 4)); // 1? reserved? |
|
1363 | + $RIFFchunk['amvh']['reserved1'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 60, 4)); // 0? reserved? |
|
1364 | + $RIFFchunk['amvh']['runtime_sec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 64, 1)); |
|
1365 | + $RIFFchunk['amvh']['runtime_min'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 65, 1)); |
|
1366 | + $RIFFchunk['amvh']['runtime_hrs'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 66, 2)); |
|
1367 | 1367 | |
1368 | 1368 | $info['video']['frame_rate'] = 1000000 / $RIFFchunk['amvh']['us_per_frame']; |
1369 | 1369 | $info['video']['resolution_x'] = $RIFFchunk['amvh']['resolution_x']; |
@@ -1372,12 +1372,12 @@ discard block |
||
1372 | 1372 | |
1373 | 1373 | // the rest is all hardcoded(?) and does not appear to be useful until you get to audio info at offset 256, even then everything is probably hardcoded |
1374 | 1374 | |
1375 | - if (substr($AMVheader, 68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") { |
|
1376 | - throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset + 68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 68, 20)).'"'); |
|
1375 | + if (substr($AMVheader, 68, 20) != 'LIST'."\x00\x00\x00\x00".'strlstrh'."\x38\x00\x00\x00") { |
|
1376 | + throw new Exception('expecting "LIST<0x00000000>strlstrh<0x38000000>" at offset '.($startoffset + 68).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 68, 20)).'"'); |
|
1377 | 1377 | } |
1378 | 1378 | // followed by 56 bytes of null: substr($AMVheader, 88, 56) -> 144 |
1379 | - if (substr($AMVheader, 144, 8) != 'strf'."\x24\x00\x00\x00") { |
|
1380 | - throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144, 8)).'"'); |
|
1379 | + if (substr($AMVheader, 144, 8) != 'strf'."\x24\x00\x00\x00") { |
|
1380 | + throw new Exception('expecting "strf<0x24000000>" at offset '.($startoffset + 144).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 144, 8)).'"'); |
|
1381 | 1381 | } |
1382 | 1382 | // followed by 36 bytes of null: substr($AMVheader, 144, 36) -> 180 |
1383 | 1383 | |
@@ -1385,8 +1385,8 @@ discard block |
||
1385 | 1385 | throw new Exception('expecting "LIST<0x00000000>strlstrh<0x30000000>" at offset '.($startoffset + 188).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 188, 20)).'"'); |
1386 | 1386 | } |
1387 | 1387 | // followed by 48 bytes of null: substr($AMVheader, 208, 48) -> 256 |
1388 | - if (substr($AMVheader, 256, 8) != 'strf'."\x14\x00\x00\x00") { |
|
1389 | - throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256, 8)).'"'); |
|
1388 | + if (substr($AMVheader, 256, 8) != 'strf'."\x14\x00\x00\x00") { |
|
1389 | + throw new Exception('expecting "strf<0x14000000>" at offset '.($startoffset + 256).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 256, 8)).'"'); |
|
1390 | 1390 | } |
1391 | 1391 | // followed by 20 bytes of a modified WAVEFORMATEX: |
1392 | 1392 | // typedef struct { |
@@ -1399,14 +1399,14 @@ discard block |
||
1399 | 1399 | // WORD cbSize; //(Fixme: this seems to be 0 in AMV files) |
1400 | 1400 | // WORD reserved; |
1401 | 1401 | // } WAVEFORMATEX; |
1402 | - $RIFFchunk['strf']['wformattag'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 264, 2)); |
|
1403 | - $RIFFchunk['strf']['nchannels'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 266, 2)); |
|
1404 | - $RIFFchunk['strf']['nsamplespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 268, 4)); |
|
1405 | - $RIFFchunk['strf']['navgbytespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 272, 4)); |
|
1406 | - $RIFFchunk['strf']['nblockalign'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 276, 2)); |
|
1407 | - $RIFFchunk['strf']['wbitspersample'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 278, 2)); |
|
1408 | - $RIFFchunk['strf']['cbsize'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 280, 2)); |
|
1409 | - $RIFFchunk['strf']['reserved'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 282, 2)); |
|
1402 | + $RIFFchunk['strf']['wformattag'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 264, 2)); |
|
1403 | + $RIFFchunk['strf']['nchannels'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 266, 2)); |
|
1404 | + $RIFFchunk['strf']['nsamplespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 268, 4)); |
|
1405 | + $RIFFchunk['strf']['navgbytespersec'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 272, 4)); |
|
1406 | + $RIFFchunk['strf']['nblockalign'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 276, 2)); |
|
1407 | + $RIFFchunk['strf']['wbitspersample'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 278, 2)); |
|
1408 | + $RIFFchunk['strf']['cbsize'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 280, 2)); |
|
1409 | + $RIFFchunk['strf']['reserved'] = getid3_lib::LittleEndian2Int(substr($AMVheader, 282, 2)); |
|
1410 | 1410 | |
1411 | 1411 | |
1412 | 1412 | $info['audio']['lossless'] = false; |
@@ -1441,8 +1441,8 @@ discard block |
||
1441 | 1441 | while ($this->ftell() < $maxoffset) { |
1442 | 1442 | $chunknamesize = $this->fread(8); |
1443 | 1443 | //$chunkname = substr($chunknamesize, 0, 4); |
1444 | - $chunkname = str_replace("\x00", '_', substr($chunknamesize, 0, 4)); // note: chunk names of 4 null bytes do appear to be legal (has been observed inside INFO and PRMI chunks, for example), but makes traversing array keys more difficult |
|
1445 | - $chunksize = $this->EitherEndian2Int(substr($chunknamesize, 4, 4)); |
|
1444 | + $chunkname = str_replace("\x00", '_', substr($chunknamesize, 0, 4)); // note: chunk names of 4 null bytes do appear to be legal (has been observed inside INFO and PRMI chunks, for example), but makes traversing array keys more difficult |
|
1445 | + $chunksize = $this->EitherEndian2Int(substr($chunknamesize, 4, 4)); |
|
1446 | 1446 | //if (strlen(trim($chunkname, "\x00")) < 4) { |
1447 | 1447 | if (strlen($chunkname) < 4) { |
1448 | 1448 | $this->error('Expecting chunk name at offset '.($this->ftell() - 8).' but found nothing. Aborting RIFF parsing.'); |
@@ -1464,11 +1464,11 @@ discard block |
||
1464 | 1464 | $RIFFchunk[$listname]['offset'] = $this->ftell() - 4; |
1465 | 1465 | $RIFFchunk[$listname]['size'] = $chunksize; |
1466 | 1466 | |
1467 | - if (!$FoundAllChunksWeNeed) { |
|
1467 | + if ( ! $FoundAllChunksWeNeed) { |
|
1468 | 1468 | $WhereWeWere = $this->ftell(); |
1469 | 1469 | $AudioChunkHeader = $this->fread(12); |
1470 | - $AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2); |
|
1471 | - $AudioChunkStreamType = substr($AudioChunkHeader, 2, 2); |
|
1470 | + $AudioChunkStreamNum = substr($AudioChunkHeader, 0, 2); |
|
1471 | + $AudioChunkStreamType = substr($AudioChunkHeader, 2, 2); |
|
1472 | 1472 | $AudioChunkSize = getid3_lib::LittleEndian2Int(substr($AudioChunkHeader, 4, 4)); |
1473 | 1473 | |
1474 | 1474 | if ($AudioChunkStreamType == 'wb') { |
@@ -1507,7 +1507,7 @@ discard block |
||
1507 | 1507 | if (empty($getid3_temp->info['error'])) { |
1508 | 1508 | $info['audio'] = $getid3_temp->info['audio']; |
1509 | 1509 | $info['ac3'] = $getid3_temp->info['ac3']; |
1510 | - if (!empty($getid3_temp->info['warning'])) { |
|
1510 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
1511 | 1511 | foreach ($getid3_temp->info['warning'] as $key => $value) { |
1512 | 1512 | $info['warning'][] = $value; |
1513 | 1513 | } |
@@ -1523,7 +1523,7 @@ discard block |
||
1523 | 1523 | |
1524 | 1524 | } else { |
1525 | 1525 | |
1526 | - if (!isset($RIFFchunk[$listname])) { |
|
1526 | + if ( ! isset($RIFFchunk[$listname])) { |
|
1527 | 1527 | $RIFFchunk[$listname] = array(); |
1528 | 1528 | } |
1529 | 1529 | $LISTchunkParent = $listname; |
@@ -1599,7 +1599,7 @@ discard block |
||
1599 | 1599 | if (empty($getid3_temp->info['error'])) { |
1600 | 1600 | $info['audio'] = $getid3_temp->info['audio']; |
1601 | 1601 | $info['ac3'] = $getid3_temp->info['ac3']; |
1602 | - if (!empty($getid3_temp->info['warning'])) { |
|
1602 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
1603 | 1603 | foreach ($getid3_temp->info['warning'] as $newerror) { |
1604 | 1604 | $this->warning('getid3_ac3() says: ['.$newerror.']'); |
1605 | 1605 | } |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | $info['audio'] = $getid3_temp->info['audio']; |
1620 | 1620 | $info['dts'] = $getid3_temp->info['dts']; |
1621 | 1621 | $info['playtime_seconds'] = $getid3_temp->info['playtime_seconds']; // may not match RIFF calculations since DTS-WAV often used 14/16 bit-word packing |
1622 | - if (!empty($getid3_temp->info['warning'])) { |
|
1622 | + if ( ! empty($getid3_temp->info['warning'])) { |
|
1623 | 1623 | foreach ($getid3_temp->info['warning'] as $newerror) { |
1624 | 1624 | $this->warning('getid3_dts() says: ['.$newerror.']'); |
1625 | 1625 | } |
@@ -1680,7 +1680,7 @@ discard block |
||
1680 | 1680 | // break; |
1681 | 1681 | |
1682 | 1682 | default: |
1683 | - if (!empty($LISTchunkParent) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) { |
|
1683 | + if ( ! empty($LISTchunkParent) && (($RIFFchunk[$chunkname][$thisindex]['offset'] + $RIFFchunk[$chunkname][$thisindex]['size']) <= $LISTchunkMaxOffset)) { |
|
1684 | 1684 | $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['offset'] = $RIFFchunk[$chunkname][$thisindex]['offset']; |
1685 | 1685 | $RIFFchunk[$LISTchunkParent][$chunkname][$thisindex]['size'] = $RIFFchunk[$chunkname][$thisindex]['size']; |
1686 | 1686 | unset($RIFFchunk[$chunkname][$thisindex]['offset']); |
@@ -1800,7 +1800,7 @@ discard block |
||
1800 | 1800 | foreach ($RIFFinfoArray[$key] as $commentid => $commentdata) { |
1801 | 1801 | if (trim($commentdata['data']) != '') { |
1802 | 1802 | if (isset($CommentsTargetArray[$value])) { |
1803 | - $CommentsTargetArray[$value][] = trim($commentdata['data']); |
|
1803 | + $CommentsTargetArray[$value][] = trim($commentdata['data']); |
|
1804 | 1804 | } else { |
1805 | 1805 | $CommentsTargetArray[$value] = array(trim($commentdata['data'])); |
1806 | 1806 | } |
@@ -1816,14 +1816,14 @@ discard block |
||
1816 | 1816 | $WaveFormatEx['raw'] = array(); |
1817 | 1817 | $WaveFormatEx_raw = &$WaveFormatEx['raw']; |
1818 | 1818 | |
1819 | - $WaveFormatEx_raw['wFormatTag'] = substr($WaveFormatExData, 0, 2); |
|
1820 | - $WaveFormatEx_raw['nChannels'] = substr($WaveFormatExData, 2, 2); |
|
1821 | - $WaveFormatEx_raw['nSamplesPerSec'] = substr($WaveFormatExData, 4, 4); |
|
1822 | - $WaveFormatEx_raw['nAvgBytesPerSec'] = substr($WaveFormatExData, 8, 4); |
|
1819 | + $WaveFormatEx_raw['wFormatTag'] = substr($WaveFormatExData, 0, 2); |
|
1820 | + $WaveFormatEx_raw['nChannels'] = substr($WaveFormatExData, 2, 2); |
|
1821 | + $WaveFormatEx_raw['nSamplesPerSec'] = substr($WaveFormatExData, 4, 4); |
|
1822 | + $WaveFormatEx_raw['nAvgBytesPerSec'] = substr($WaveFormatExData, 8, 4); |
|
1823 | 1823 | $WaveFormatEx_raw['nBlockAlign'] = substr($WaveFormatExData, 12, 2); |
1824 | 1824 | $WaveFormatEx_raw['wBitsPerSample'] = substr($WaveFormatExData, 14, 2); |
1825 | 1825 | if (strlen($WaveFormatExData) > 16) { |
1826 | - $WaveFormatEx_raw['cbSize'] = substr($WaveFormatExData, 16, 2); |
|
1826 | + $WaveFormatEx_raw['cbSize'] = substr($WaveFormatExData, 16, 2); |
|
1827 | 1827 | } |
1828 | 1828 | $WaveFormatEx_raw = array_map('getid3_lib::LittleEndian2Int', $WaveFormatEx_raw); |
1829 | 1829 | |
@@ -1852,20 +1852,20 @@ discard block |
||
1852 | 1852 | $info['wavpack'] = array(); |
1853 | 1853 | $thisfile_wavpack = &$info['wavpack']; |
1854 | 1854 | |
1855 | - $thisfile_wavpack['version'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 0, 2)); |
|
1855 | + $thisfile_wavpack['version'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 0, 2)); |
|
1856 | 1856 | if ($thisfile_wavpack['version'] >= 2) { |
1857 | - $thisfile_wavpack['bits'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 2, 2)); |
|
1857 | + $thisfile_wavpack['bits'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 2, 2)); |
|
1858 | 1858 | } |
1859 | 1859 | if ($thisfile_wavpack['version'] >= 3) { |
1860 | - $thisfile_wavpack['flags_raw'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 4, 2)); |
|
1861 | - $thisfile_wavpack['shift'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 6, 2)); |
|
1862 | - $thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 8, 4)); |
|
1860 | + $thisfile_wavpack['flags_raw'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 4, 2)); |
|
1861 | + $thisfile_wavpack['shift'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 6, 2)); |
|
1862 | + $thisfile_wavpack['total_samples'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 8, 4)); |
|
1863 | 1863 | $thisfile_wavpack['crc1'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 12, 4)); |
1864 | 1864 | $thisfile_wavpack['crc2'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 16, 4)); |
1865 | - $thisfile_wavpack['extension'] = substr($WavPackChunkData, 20, 4); |
|
1865 | + $thisfile_wavpack['extension'] = substr($WavPackChunkData, 20, 4); |
|
1866 | 1866 | $thisfile_wavpack['extra_bc'] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 24, 1)); |
1867 | 1867 | for ($i = 0; $i <= 2; $i++) { |
1868 | - $thisfile_wavpack['extras'][] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1)); |
|
1868 | + $thisfile_wavpack['extras'][] = getid3_lib::LittleEndian2Int(substr($WavPackChunkData, 25 + $i, 1)); |
|
1869 | 1869 | } |
1870 | 1870 | |
1871 | 1871 | // shortcut |
@@ -1897,11 +1897,11 @@ discard block |
||
1897 | 1897 | return true; |
1898 | 1898 | } |
1899 | 1899 | |
1900 | - public static function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian=true) { |
|
1900 | + public static function ParseBITMAPINFOHEADER($BITMAPINFOHEADER, $littleEndian = true) { |
|
1901 | 1901 | |
1902 | - $parsed['biSize'] = substr($BITMAPINFOHEADER, 0, 4); // number of bytes required by the BITMAPINFOHEADER structure |
|
1903 | - $parsed['biWidth'] = substr($BITMAPINFOHEADER, 4, 4); // width of the bitmap in pixels |
|
1904 | - $parsed['biHeight'] = substr($BITMAPINFOHEADER, 8, 4); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner |
|
1902 | + $parsed['biSize'] = substr($BITMAPINFOHEADER, 0, 4); // number of bytes required by the BITMAPINFOHEADER structure |
|
1903 | + $parsed['biWidth'] = substr($BITMAPINFOHEADER, 4, 4); // width of the bitmap in pixels |
|
1904 | + $parsed['biHeight'] = substr($BITMAPINFOHEADER, 8, 4); // height of the bitmap in pixels. If biHeight is positive, the bitmap is a 'bottom-up' DIB and its origin is the lower left corner. If biHeight is negative, the bitmap is a 'top-down' DIB and its origin is the upper left corner |
|
1905 | 1905 | $parsed['biPlanes'] = substr($BITMAPINFOHEADER, 12, 2); // number of color planes on the target device. In most cases this value must be set to 1 |
1906 | 1906 | $parsed['biBitCount'] = substr($BITMAPINFOHEADER, 14, 2); // Specifies the number of bits per pixels |
1907 | 1907 | $parsed['biSizeImage'] = substr($BITMAPINFOHEADER, 20, 4); // size of the bitmap data section of the image (the actual pixel data, excluding BITMAPINFOHEADER and RGBQUAD structures) |
@@ -1911,12 +1911,12 @@ discard block |
||
1911 | 1911 | $parsed['biClrImportant'] = substr($BITMAPINFOHEADER, 36, 4); // number of color indices that are considered important for displaying the bitmap. If this value is zero, all colors are important |
1912 | 1912 | $parsed = array_map('getid3_lib::'.($littleEndian ? 'Little' : 'Big').'Endian2Int', $parsed); |
1913 | 1913 | |
1914 | - $parsed['fourcc'] = substr($BITMAPINFOHEADER, 16, 4); // compression identifier |
|
1914 | + $parsed['fourcc'] = substr($BITMAPINFOHEADER, 16, 4); // compression identifier |
|
1915 | 1915 | |
1916 | 1916 | return $parsed; |
1917 | 1917 | } |
1918 | 1918 | |
1919 | - public static function ParseDIVXTAG($DIVXTAG, $raw=false) { |
|
1919 | + public static function ParseDIVXTAG($DIVXTAG, $raw = false) { |
|
1920 | 1920 | // structure from "IDivX" source, Form1.frm, by "Greg Frazier of Daemonic Software Group", email: [email protected], web: http://dsg.cjb.net/ |
1921 | 1921 | // source available at http://files.divx-digest.com/download/c663efe7ef8ad2e90bf4af4d3ea6188a/on0SWN2r/edit/IDivX.zip |
1922 | 1922 | // 'Byte Layout: '1111111111111111 |
@@ -1929,7 +1929,7 @@ discard block |
||
1929 | 1929 | // '5 for Future Additions - 0 '333400000DIVXTAG |
1930 | 1930 | // '128 bytes total |
1931 | 1931 | |
1932 | - static $DIVXTAGgenre = array( |
|
1932 | + static $DIVXTAGgenre = array( |
|
1933 | 1933 | 0 => 'Action', |
1934 | 1934 | 1 => 'Action/Adventure', |
1935 | 1935 | 2 => 'Adventure', |
@@ -1962,22 +1962,22 @@ discard block |
||
1962 | 1962 | 5 => 'NC-17', |
1963 | 1963 | ); |
1964 | 1964 | |
1965 | - $parsed['title'] = trim(substr($DIVXTAG, 0, 32)); |
|
1966 | - $parsed['artist'] = trim(substr($DIVXTAG, 32, 28)); |
|
1967 | - $parsed['year'] = intval(trim(substr($DIVXTAG, 60, 4))); |
|
1968 | - $parsed['comment'] = trim(substr($DIVXTAG, 64, 48)); |
|
1969 | - $parsed['genre_id'] = intval(trim(substr($DIVXTAG, 112, 3))); |
|
1970 | - $parsed['rating_id'] = ord(substr($DIVXTAG, 115, 1)); |
|
1965 | + $parsed['title'] = trim(substr($DIVXTAG, 0, 32)); |
|
1966 | + $parsed['artist'] = trim(substr($DIVXTAG, 32, 28)); |
|
1967 | + $parsed['year'] = intval(trim(substr($DIVXTAG, 60, 4))); |
|
1968 | + $parsed['comment'] = trim(substr($DIVXTAG, 64, 48)); |
|
1969 | + $parsed['genre_id'] = intval(trim(substr($DIVXTAG, 112, 3))); |
|
1970 | + $parsed['rating_id'] = ord(substr($DIVXTAG, 115, 1)); |
|
1971 | 1971 | //$parsed['padding'] = substr($DIVXTAG, 116, 5); // 5-byte null |
1972 | 1972 | //$parsed['magic'] = substr($DIVXTAG, 121, 7); // "DIVXTAG" |
1973 | 1973 | |
1974 | - $parsed['genre'] = (isset($DIVXTAGgenre[$parsed['genre_id']]) ? $DIVXTAGgenre[$parsed['genre_id']] : $parsed['genre_id']); |
|
1974 | + $parsed['genre'] = (isset($DIVXTAGgenre[$parsed['genre_id']]) ? $DIVXTAGgenre[$parsed['genre_id']] : $parsed['genre_id']); |
|
1975 | 1975 | $parsed['rating'] = (isset($DIVXTAGrating[$parsed['rating_id']]) ? $DIVXTAGrating[$parsed['rating_id']] : $parsed['rating_id']); |
1976 | 1976 | |
1977 | - if (!$raw) { |
|
1977 | + if ( ! $raw) { |
|
1978 | 1978 | unset($parsed['genre_id'], $parsed['rating_id']); |
1979 | 1979 | foreach ($parsed as $key => $value) { |
1980 | - if (!$value === '') { |
|
1980 | + if ( ! $value === '') { |
|
1981 | 1981 | unset($parsed['key']); |
1982 | 1982 | } |
1983 | 1983 | } |
@@ -2576,7 +2576,7 @@ discard block |
||
2576 | 2576 | return getid3_lib::EmbeddedLookup($fourcc, $begin, __LINE__, __FILE__, 'riff-fourcc'); |
2577 | 2577 | } |
2578 | 2578 | |
2579 | - private function EitherEndian2Int($byteword, $signed=false) { |
|
2579 | + private function EitherEndian2Int($byteword, $signed = false) { |
|
2580 | 2580 | if ($this->container == 'riff') { |
2581 | 2581 | return getid3_lib::LittleEndian2Int($byteword, $signed); |
2582 | 2582 | } |