Minor improvements

git-svn-id: http://php-reader.googlecode.com/svn/trunk@138 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
svollbehr
2009-02-15 11:14:37 +00:00
parent ae15e87ccc
commit 1b8eed275f
13 changed files with 530 additions and 526 deletions

View File

@@ -2,7 +2,8 @@
/**
* PHP Reader Library
*
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -30,7 +31,7 @@
*
* @package php-reader
* @subpackage ID3
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id$
*/
@@ -47,7 +48,7 @@ require_once("ID3/Object.php");
* @package php-reader
* @subpackage ID3
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev$
*/
@@ -193,14 +194,14 @@ class ID3_Frame extends ID3_Object
*
* @return string
*/
public function getIdentifier() { return $this->_identifier; }
public final function getIdentifier() { return $this->_identifier; }
/**
* Sets the frame identifier.
*
* @param string $identifier The identifier.
*/
public function setIdentifier($identifier)
public final function setIdentifier($identifier)
{
$this->_identifier = $identifier;
}
@@ -211,7 +212,7 @@ class ID3_Frame extends ID3_Object
*
* @return integer
*/
public function getSize() { return $this->_size; }
public final function getSize() { return $this->_size; }
/**
* Checks whether or not the flag is set. Returns <var>true</var> if the flag
@@ -220,21 +221,21 @@ class ID3_Frame extends ID3_Object
* @param integer $flag The flag to query.
* @return boolean
*/
public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; }
public final function hasFlag($flag) { return ($this->_flags & $flag) == $flag; }
/**
* Returns the frame flags byte.
*
* @return integer
*/
public function getFlags($flags) { return $this->_flags; }
public final function getFlags($flags) { return $this->_flags; }
/**
* Sets the frame flags byte.
*
* @param string $flags The flags byte.
*/
public function setFlags($flags) { $this->_flags = $flags; }
public final function setFlags($flags) { $this->_flags = $flags; }
/**
* Sets the frame raw data.

View File

@@ -2,7 +2,7 @@
/**
* PHP Reader Library
*
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -30,7 +30,7 @@
*
* @package php-reader
* @subpackage ID3
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id$
*/
@@ -42,7 +42,7 @@
* @subpackage ID3
* @author Sven Vollbehr <svollbehr@gmail.com>
* @author Ryan Butterfield <buttza@gmail.com>
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev$
*/
@@ -79,7 +79,7 @@ abstract class ID3_Object
*
* @return Array
*/
public function getOptions() { return $this->_options; }
public final function getOptions() { return $this->_options; }
/**
* Returns the given option value, or the default value if the option is not
@@ -88,7 +88,7 @@ abstract class ID3_Object
* @param string $option The name of the option.
* @param mixed $defaultValue The default value to be returned.
*/
public function getOption($option, $defaultValue = false)
public final function getOption($option, $defaultValue = false)
{
if (isset($this->_options[$option]))
return $this->_options[$option];
@@ -100,7 +100,7 @@ abstract class ID3_Object
*
* @param Array $options The options array.
*/
public function setOptions(&$options) { $this->_options = &$options; }
public final function setOptions(&$options) { $this->_options = &$options; }
/**
* Sets the given option the given value.
@@ -108,7 +108,7 @@ abstract class ID3_Object
* @param string $option The name of the option.
* @param mixed $value The value to set for the option.
*/
public function setOption($option, $value)
public final function setOption($option, $value)
{
$this->_options[$option] = $value;
}
@@ -149,7 +149,7 @@ abstract class ID3_Object
* @param integer $val The integer to encode.
* @return integer
*/
protected function encodeSynchsafe32($val)
protected final function encodeSynchsafe32($val)
{
return ($val & 0x7f) | ($val & 0x3f80) << 1 |
($val & 0x1fc000) << 2 | ($val & 0xfe00000) << 3;
@@ -161,7 +161,7 @@ abstract class ID3_Object
* @param integer $val The integer to decode
* @return integer
*/
protected function decodeSynchsafe32($val)
protected final function decodeSynchsafe32($val)
{
return ($val & 0x7f) | ($val & 0x7f00) >> 1 |
($val & 0x7f0000) >> 2 | ($val & 0x7f000000) >> 3;
@@ -180,7 +180,7 @@ abstract class ID3_Object
* @param string $data The input data.
* @return string
*/
protected function encodeUnsynchronisation(&$data)
protected final function encodeUnsynchronisation(&$data)
{
$result = "";
for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++)
@@ -199,7 +199,7 @@ abstract class ID3_Object
* @param string $data The input data.
* @return string
*/
protected function decodeUnsynchronisation(&$data)
protected final function decodeUnsynchronisation(&$data)
{
$result = "";
for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++)
@@ -217,7 +217,7 @@ abstract class ID3_Object
* @param string $value The input string.
* @return Array
*/
protected function explodeString16($value, $limit = null)
protected final function explodeString16($value, $limit = null)
{
$i = 0;
$array = array();
@@ -244,7 +244,7 @@ abstract class ID3_Object
* @param string $value The input string.
* @return Array
*/
protected function explodeString8($value, $limit = null)
protected final function explodeString8($value, $limit = null)
{
return preg_split("/\\x00/", $value, $limit);
}
@@ -256,7 +256,7 @@ abstract class ID3_Object
* @param string|Array $string
* @param string $encoding
*/
protected function convertString($string, $encoding)
protected final function convertString($string, $encoding)
{
$target = $this->getOption("encoding", ID3_Encoding::UTF8);
switch ($target) {

View File

@@ -245,7 +245,7 @@ require_once("ISO14496/Box.php");
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev$
*/
class ISO14496 extends ISO14496_Box
final class ISO14496 extends ISO14496_Box
{
/** @var string */
private $_filename;

View File

@@ -2,7 +2,8 @@
/**
* PHP Reader Library
*
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -30,7 +31,7 @@
*
* @package php-reader
* @subpackage ISO 14496
* @copyright Copyright (c) 2008 PHP Reader Project Workgroup
* @copyright Copyright (c) 2008-2009 PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id$
*/
@@ -45,7 +46,7 @@ require_once("ISO14496/Exception.php");
* @package php-reader
* @subpackage ISO 14496
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008 PHP Reader Project Workgroup
* @copyright Copyright (c) 2008-2009 PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev$
*/
@@ -107,7 +108,7 @@ class ISO14496_Box
if ($this->_type == "uuid")
$this->_type = $this->_reader->readGUID();
}
$this->_options = $options;
$this->_options = &$options;
}
/**
@@ -115,7 +116,7 @@ class ISO14496_Box
*
* @return Array
*/
public function getOptions() { return $this->_options; }
public final function getOptions() { return $this->_options; }
/**
* Returns the given option value, or the default value if the option is not
@@ -124,7 +125,7 @@ class ISO14496_Box
* @param string $option The name of the option.
* @param mixed $defaultValue The default value to be returned.
*/
public function getOption($option, $defaultValue = false)
public final function getOption($option, $defaultValue = false)
{
if (isset($this->_options[$option]))
return $this->_options[$option];
@@ -136,7 +137,7 @@ class ISO14496_Box
*
* @param Array $options The options array.
*/
public function setOptions(&$options) { $this->_options = $options; }
public final function setOptions(&$options) { $this->_options = &$options; }
/**
* Sets the given option the given value.
@@ -144,7 +145,7 @@ class ISO14496_Box
* @param string $option The name of the option.
* @param mixed $value The value to set for the option.
*/
public function setOption($option, $value)
public final function setOption($option, $value)
{
$this->_options[$option] = $value;
}
@@ -154,14 +155,14 @@ class ISO14496_Box
*
* @return integer
*/
public function getOffset() { return $this->_offset; }
public final function getOffset() { return $this->_offset; }
/**
* Sets the file offset where the box starts.
*
* @param integer $offset The file offset to box start.
*/
public function setOffset($offset) { $this->_offset = $offset; }
public final function setOffset($offset) { $this->_offset = $offset; }
/**
* Returns the box size in bytes, including the size and type header,
@@ -169,7 +170,7 @@ class ISO14496_Box
*
* @return integer
*/
public function getSize() { return $this->_size; }
public final function getSize() { return $this->_size; }
/**
* Sets the box size. The size must include the size and type header,
@@ -179,7 +180,7 @@ class ISO14496_Box
*
* @param integer $size The box size.
*/
public function setSize($size)
public final function setSize($size)
{
if ($this->_parent !== null)
$this->_parent->setSize
@@ -193,21 +194,21 @@ class ISO14496_Box
*
* @return string
*/
public function getType() { return $this->_type; }
public final function getType() { return $this->_type; }
/**
* Sets the box type.
*
* @param string $type The box type.
*/
public function setType($type) { $this->_type = $type; }
public final function setType($type) { $this->_type = $type; }
/**
* Returns the parent box containing this box.
*
* @return ISO14496_Box
*/
public function getParent() { return $this->_parent; }
public final function getParent() { return $this->_parent; }
/**
* Sets the parent containing box.
@@ -221,21 +222,21 @@ class ISO14496_Box
*
* @return boolean
*/
public function isContainer() { return $this->_container; }
public final function isContainer() { return $this->_container; }
/**
* Returns a boolean value corresponding to whether the box is a container.
*
* @return boolean
*/
public function getContainer() { return $this->_container; }
public final function getContainer() { return $this->_container; }
/**
* Sets whether the box is a container.
*
* @param boolean $container Whether the box is a container.
*/
protected function setContainer($container)
protected final function setContainer($container)
{
$this->_container = $container;
}
@@ -245,7 +246,7 @@ class ISO14496_Box
*
* @todo Does not parse iTunes internal ---- boxes.
*/
protected function constructBoxes($defaultclassname = "ISO14496_Box")
protected final function constructBoxes($defaultclassname = "ISO14496_Box")
{
$base = $this->getOption("base", "");
if ($this->getType() != "file")
@@ -295,7 +296,7 @@ class ISO14496_Box
* @return boolean
* @throws ISO14496_Exception if called on a non-container box
*/
public function hasBox($identifier)
public final function hasBox($identifier)
{
if (!$this->isContainer())
throw new ISO14496_Exception("Box not a container");
@@ -309,7 +310,7 @@ class ISO14496_Box
* @return Array
* @throws ISO14496_Exception if called on a non-container box
*/
public function getBoxes()
public final function getBoxes()
{
if (!$this->isContainer())
throw new ISO14496_Exception("Box not a container");
@@ -331,7 +332,7 @@ class ISO14496_Box
* @return Array
* @throws ISO14496_Exception if called on a non-container box
*/
public function getBoxesByIdentifier($identifier)
public final function getBoxesByIdentifier($identifier)
{
if (!$this->isContainer())
throw new ISO14496_Exception("Box not a container");
@@ -351,7 +352,7 @@ class ISO14496_Box
* @param ISO14496_Box The box to add
* @return ISO14496_Box
*/
public function addBox($box)
public final function addBox($box)
{
$box->setParent($this);
$box->setOptions($this->_options);

View File

@@ -32,7 +32,7 @@
* @subpackage MPEG
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id: MPEG.php 1 2008-07-06 10:43:41Z rbutterfield $
* @version $Id$
*/
/**#@+ @ignore */
@@ -58,7 +58,7 @@ require_once("MPEG/ABS/Frame.php");
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev: 1 $
* @version $Rev$
* @todo Implement validation routines
*/
final class MPEG_ABS extends MPEG_ABS_Object

View File

@@ -2,7 +2,8 @@
/**
* PHP Reader Library
*
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -30,9 +31,9 @@
*
* @package php-reader
* @subpackage MPEG
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id: Frame.php 1 2008-07-06 10:43:41Z rbutterfield $
* @version $Id$
*/
/**#@+ @ignore */
@@ -53,11 +54,11 @@ require_once("MPEG/ABS/Object.php");
* @subpackage MPEG
* @author Ryan Butterfield <buttza@gmail.com>
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev: 1 $
* @version $Rev$
*/
class MPEG_ABS_Frame extends MPEG_ABS_Object
final class MPEG_ABS_Frame extends MPEG_ABS_Object
{
/**
* The bitrate lookup table. The table has the following format.

View File

@@ -58,7 +58,7 @@ require_once("MPEG/ABS/Object.php");
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev: 1 $
* @version $Rev$
*/
class MPEG_ABS_LAMEHeader extends MPEG_ABS_Object
{

View File

@@ -32,7 +32,7 @@
* @subpackage MPEG
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id: Object.php 107 2008-08-03 19:09:16Z svollbehr $
* @version $Id$
*/
/**#@+ @ignore */
@@ -48,7 +48,7 @@ require_once("MPEG/Object.php");
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev: 107 $
* @version $Rev$
*/
abstract class MPEG_ABS_Object extends MPEG_Object
{

View File

@@ -32,7 +32,7 @@
* @subpackage MPEG
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id: VBRIHeader.php 1 2008-07-19 10:43:41Z rbutterfield $
* @version $Id$
*/
/**#@+ @ignore */
@@ -51,7 +51,7 @@ require_once("MPEG/ABS/Object.php");
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev: 1 $
* @version $Rev$
*/
class MPEG_ABS_VBRIHeader extends MPEG_ABS_Object
{

View File

@@ -32,7 +32,7 @@
* @subpackage MPEG
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id: XINGHeader.php 1 2008-07-06 10:43:41Z rbutterfield $
* @version $Id$
*/
/**#@+ @ignore */
@@ -51,7 +51,7 @@ require_once("MPEG/ABS/Object.php");
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev: 1 $
* @version $Rev$
*/
class MPEG_ABS_XINGHeader extends MPEG_ABS_Object
{

View File

@@ -32,7 +32,7 @@
* @subpackage MPEG
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id: Exception.php 85 2008-04-23 20:21:36Z svollbehr $
* @version $Id$
*/
/**
@@ -44,7 +44,7 @@
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev: 85 $
* @version $Rev$
*/
class MPEG_Exception extends Exception
{

View File

@@ -2,7 +2,8 @@
/**
* PHP Reader Library
*
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
* Copyright (c) 2008-2009 The PHP Reader Project Workgroup. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -30,9 +31,9 @@
*
* @package php-reader
* @subpackage MPEG
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id: Object.php 107 2008-08-03 19:09:16Z svollbehr $
* @version $Id$
*/
/**#@+ @ignore */
@@ -46,9 +47,9 @@ require_once("MPEG/Exception.php");
* @package php-reader
* @subpackage MPEG
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev: 107 $
* @version $Rev$
*/
abstract class MPEG_Object
{
@@ -83,7 +84,7 @@ abstract class MPEG_Object
*
* @return Array
*/
public function getOptions() { return $this->_options; }
public final function getOptions() { return $this->_options; }
/**
* Returns the given option value, or the default value if the option is not
@@ -92,7 +93,7 @@ abstract class MPEG_Object
* @param string $option The name of the option.
* @param mixed $defaultValue The default value to be returned.
*/
public function getOption($option, $defaultValue = false)
public final function getOption($option, $defaultValue = false)
{
if (isset($this->_options[$option]))
return $this->_options[$option];
@@ -104,7 +105,7 @@ abstract class MPEG_Object
*
* @param Array $options The options array.
*/
public function setOptions(&$options) { $this->_options = &$options; }
public final function setOptions(&$options) { $this->_options = &$options; }
/**
* Sets the given option the given value.
@@ -112,7 +113,7 @@ abstract class MPEG_Object
* @param string $option The name of the option.
* @param mixed $value The value to set for the option.
*/
public function setOption($option, $value)
public final function setOption($option, $value)
{
$this->_options[$option] = $value;
}
@@ -126,7 +127,7 @@ abstract class MPEG_Object
*
* @return integer
*/
protected function nextStartCode()
protected final function nextStartCode()
{
$buffer = " ";
for ($i = 0; $i < 4; $i++) {
@@ -162,7 +163,7 @@ abstract class MPEG_Object
*
* @return integer
*/
protected function prevStartCode()
protected final function prevStartCode()
{
$buffer = " ";
$start;
@@ -202,7 +203,7 @@ abstract class MPEG_Object
* @param integer $seconds The time to format, in seconds
* @return string
*/
protected function formatTime($seconds)
protected final function formatTime($seconds)
{
$milliseconds = round(($seconds - floor($seconds)) * 1000);
$seconds = floor($seconds);

View File

@@ -32,7 +32,7 @@
* @subpackage MPEG
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id: MPEG.php 1 2008-07-06 10:43:41Z rbutterfield $
* @version $Id$
*/
/**#@+ @ignore */
@@ -57,7 +57,7 @@ require_once("MPEG/Object.php");
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev: 1 $
* @version $Rev$
* @todo Full implementation
*/
final class MPEG_PS extends MPEG_Object