Minor improvements
git-svn-id: http://php-reader.googlecode.com/svn/trunk@138 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
/**
|
/**
|
||||||
* PHP Reader Library
|
* 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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @subpackage ID3
|
* @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
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@@ -47,7 +48,7 @@ require_once("ID3/Object.php");
|
|||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @subpackage ID3
|
* @subpackage ID3
|
||||||
* @author Sven Vollbehr <svollbehr@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
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
* @version $Rev$
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
@@ -193,14 +194,14 @@ class ID3_Frame extends ID3_Object
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getIdentifier() { return $this->_identifier; }
|
public final function getIdentifier() { return $this->_identifier; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the frame identifier.
|
* Sets the frame identifier.
|
||||||
*
|
*
|
||||||
* @param string $identifier The identifier.
|
* @param string $identifier The identifier.
|
||||||
*/
|
*/
|
||||||
public function setIdentifier($identifier)
|
public final function setIdentifier($identifier)
|
||||||
{
|
{
|
||||||
$this->_identifier = $identifier;
|
$this->_identifier = $identifier;
|
||||||
}
|
}
|
||||||
@@ -211,7 +212,7 @@ class ID3_Frame extends ID3_Object
|
|||||||
*
|
*
|
||||||
* @return integer
|
* @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
|
* 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.
|
* @param integer $flag The flag to query.
|
||||||
* @return boolean
|
* @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.
|
* Returns the frame flags byte.
|
||||||
*
|
*
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getFlags($flags) { return $this->_flags; }
|
public final function getFlags($flags) { return $this->_flags; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the frame flags byte.
|
* Sets the frame flags byte.
|
||||||
*
|
*
|
||||||
* @param string $flags The 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.
|
* Sets the frame raw data.
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHP Reader Library
|
* 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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @subpackage ID3
|
* @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
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
* @subpackage ID3
|
* @subpackage ID3
|
||||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||||
* @author Ryan Butterfield <buttza@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
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
* @version $Rev$
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
@@ -79,7 +79,7 @@ abstract class ID3_Object
|
|||||||
*
|
*
|
||||||
* @return Array
|
* @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
|
* 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 string $option The name of the option.
|
||||||
* @param mixed $defaultValue The default value to be returned.
|
* @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]))
|
if (isset($this->_options[$option]))
|
||||||
return $this->_options[$option];
|
return $this->_options[$option];
|
||||||
@@ -100,7 +100,7 @@ abstract class ID3_Object
|
|||||||
*
|
*
|
||||||
* @param Array $options The options array.
|
* @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.
|
* Sets the given option the given value.
|
||||||
@@ -108,7 +108,7 @@ abstract class ID3_Object
|
|||||||
* @param string $option The name of the option.
|
* @param string $option The name of the option.
|
||||||
* @param mixed $value The value to set for 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;
|
$this->_options[$option] = $value;
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ abstract class ID3_Object
|
|||||||
* @param integer $val The integer to encode.
|
* @param integer $val The integer to encode.
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
protected function encodeSynchsafe32($val)
|
protected final function encodeSynchsafe32($val)
|
||||||
{
|
{
|
||||||
return ($val & 0x7f) | ($val & 0x3f80) << 1 |
|
return ($val & 0x7f) | ($val & 0x3f80) << 1 |
|
||||||
($val & 0x1fc000) << 2 | ($val & 0xfe00000) << 3;
|
($val & 0x1fc000) << 2 | ($val & 0xfe00000) << 3;
|
||||||
@@ -161,7 +161,7 @@ abstract class ID3_Object
|
|||||||
* @param integer $val The integer to decode
|
* @param integer $val The integer to decode
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
protected function decodeSynchsafe32($val)
|
protected final function decodeSynchsafe32($val)
|
||||||
{
|
{
|
||||||
return ($val & 0x7f) | ($val & 0x7f00) >> 1 |
|
return ($val & 0x7f) | ($val & 0x7f00) >> 1 |
|
||||||
($val & 0x7f0000) >> 2 | ($val & 0x7f000000) >> 3;
|
($val & 0x7f0000) >> 2 | ($val & 0x7f000000) >> 3;
|
||||||
@@ -180,7 +180,7 @@ abstract class ID3_Object
|
|||||||
* @param string $data The input data.
|
* @param string $data The input data.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function encodeUnsynchronisation(&$data)
|
protected final function encodeUnsynchronisation(&$data)
|
||||||
{
|
{
|
||||||
$result = "";
|
$result = "";
|
||||||
for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++)
|
for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++)
|
||||||
@@ -199,7 +199,7 @@ abstract class ID3_Object
|
|||||||
* @param string $data The input data.
|
* @param string $data The input data.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function decodeUnsynchronisation(&$data)
|
protected final function decodeUnsynchronisation(&$data)
|
||||||
{
|
{
|
||||||
$result = "";
|
$result = "";
|
||||||
for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++)
|
for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++)
|
||||||
@@ -217,7 +217,7 @@ abstract class ID3_Object
|
|||||||
* @param string $value The input string.
|
* @param string $value The input string.
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
protected function explodeString16($value, $limit = null)
|
protected final function explodeString16($value, $limit = null)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
$array = array();
|
$array = array();
|
||||||
@@ -244,7 +244,7 @@ abstract class ID3_Object
|
|||||||
* @param string $value The input string.
|
* @param string $value The input string.
|
||||||
* @return Array
|
* @return Array
|
||||||
*/
|
*/
|
||||||
protected function explodeString8($value, $limit = null)
|
protected final function explodeString8($value, $limit = null)
|
||||||
{
|
{
|
||||||
return preg_split("/\\x00/", $value, $limit);
|
return preg_split("/\\x00/", $value, $limit);
|
||||||
}
|
}
|
||||||
@@ -256,7 +256,7 @@ abstract class ID3_Object
|
|||||||
* @param string|Array $string
|
* @param string|Array $string
|
||||||
* @param string $encoding
|
* @param string $encoding
|
||||||
*/
|
*/
|
||||||
protected function convertString($string, $encoding)
|
protected final function convertString($string, $encoding)
|
||||||
{
|
{
|
||||||
$target = $this->getOption("encoding", ID3_Encoding::UTF8);
|
$target = $this->getOption("encoding", ID3_Encoding::UTF8);
|
||||||
switch ($target) {
|
switch ($target) {
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ require_once("ISO14496/Box.php");
|
|||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
* @version $Rev$
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
class ISO14496 extends ISO14496_Box
|
final class ISO14496 extends ISO14496_Box
|
||||||
{
|
{
|
||||||
/** @var string */
|
/** @var string */
|
||||||
private $_filename;
|
private $_filename;
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
/**
|
/**
|
||||||
* PHP Reader Library
|
* 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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -30,7 +31,7 @@
|
|||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @subpackage ISO 14496
|
* @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
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
@@ -45,7 +46,7 @@ require_once("ISO14496/Exception.php");
|
|||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @subpackage ISO 14496
|
* @subpackage ISO 14496
|
||||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
* @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
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
* @version $Rev$
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
@@ -107,7 +108,7 @@ class ISO14496_Box
|
|||||||
if ($this->_type == "uuid")
|
if ($this->_type == "uuid")
|
||||||
$this->_type = $this->_reader->readGUID();
|
$this->_type = $this->_reader->readGUID();
|
||||||
}
|
}
|
||||||
$this->_options = $options;
|
$this->_options = &$options;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,7 +116,7 @@ class ISO14496_Box
|
|||||||
*
|
*
|
||||||
* @return Array
|
* @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
|
* 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 string $option The name of the option.
|
||||||
* @param mixed $defaultValue The default value to be returned.
|
* @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]))
|
if (isset($this->_options[$option]))
|
||||||
return $this->_options[$option];
|
return $this->_options[$option];
|
||||||
@@ -136,7 +137,7 @@ class ISO14496_Box
|
|||||||
*
|
*
|
||||||
* @param Array $options The options array.
|
* @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.
|
* Sets the given option the given value.
|
||||||
@@ -144,7 +145,7 @@ class ISO14496_Box
|
|||||||
* @param string $option The name of the option.
|
* @param string $option The name of the option.
|
||||||
* @param mixed $value The value to set for 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;
|
$this->_options[$option] = $value;
|
||||||
}
|
}
|
||||||
@@ -154,14 +155,14 @@ class ISO14496_Box
|
|||||||
*
|
*
|
||||||
* @return integer
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getOffset() { return $this->_offset; }
|
public final function getOffset() { return $this->_offset; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the file offset where the box starts.
|
* Sets the file offset where the box starts.
|
||||||
*
|
*
|
||||||
* @param integer $offset The file offset to box start.
|
* @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,
|
* Returns the box size in bytes, including the size and type header,
|
||||||
@@ -169,7 +170,7 @@ class ISO14496_Box
|
|||||||
*
|
*
|
||||||
* @return integer
|
* @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,
|
* 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.
|
* @param integer $size The box size.
|
||||||
*/
|
*/
|
||||||
public function setSize($size)
|
public final function setSize($size)
|
||||||
{
|
{
|
||||||
if ($this->_parent !== null)
|
if ($this->_parent !== null)
|
||||||
$this->_parent->setSize
|
$this->_parent->setSize
|
||||||
@@ -193,21 +194,21 @@ class ISO14496_Box
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getType() { return $this->_type; }
|
public final function getType() { return $this->_type; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the box type.
|
* Sets the box type.
|
||||||
*
|
*
|
||||||
* @param string $type 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.
|
* Returns the parent box containing this box.
|
||||||
*
|
*
|
||||||
* @return ISO14496_Box
|
* @return ISO14496_Box
|
||||||
*/
|
*/
|
||||||
public function getParent() { return $this->_parent; }
|
public final function getParent() { return $this->_parent; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the parent containing box.
|
* Sets the parent containing box.
|
||||||
@@ -221,21 +222,21 @@ class ISO14496_Box
|
|||||||
*
|
*
|
||||||
* @return boolean
|
* @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.
|
* Returns a boolean value corresponding to whether the box is a container.
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function getContainer() { return $this->_container; }
|
public final function getContainer() { return $this->_container; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the box is a container.
|
* Sets whether the box is a container.
|
||||||
*
|
*
|
||||||
* @param boolean $container 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;
|
$this->_container = $container;
|
||||||
}
|
}
|
||||||
@@ -245,7 +246,7 @@ class ISO14496_Box
|
|||||||
*
|
*
|
||||||
* @todo Does not parse iTunes internal ---- boxes.
|
* @todo Does not parse iTunes internal ---- boxes.
|
||||||
*/
|
*/
|
||||||
protected function constructBoxes($defaultclassname = "ISO14496_Box")
|
protected final function constructBoxes($defaultclassname = "ISO14496_Box")
|
||||||
{
|
{
|
||||||
$base = $this->getOption("base", "");
|
$base = $this->getOption("base", "");
|
||||||
if ($this->getType() != "file")
|
if ($this->getType() != "file")
|
||||||
@@ -295,7 +296,7 @@ class ISO14496_Box
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws ISO14496_Exception if called on a non-container box
|
* @throws ISO14496_Exception if called on a non-container box
|
||||||
*/
|
*/
|
||||||
public function hasBox($identifier)
|
public final function hasBox($identifier)
|
||||||
{
|
{
|
||||||
if (!$this->isContainer())
|
if (!$this->isContainer())
|
||||||
throw new ISO14496_Exception("Box not a container");
|
throw new ISO14496_Exception("Box not a container");
|
||||||
@@ -309,7 +310,7 @@ class ISO14496_Box
|
|||||||
* @return Array
|
* @return Array
|
||||||
* @throws ISO14496_Exception if called on a non-container box
|
* @throws ISO14496_Exception if called on a non-container box
|
||||||
*/
|
*/
|
||||||
public function getBoxes()
|
public final function getBoxes()
|
||||||
{
|
{
|
||||||
if (!$this->isContainer())
|
if (!$this->isContainer())
|
||||||
throw new ISO14496_Exception("Box not a container");
|
throw new ISO14496_Exception("Box not a container");
|
||||||
@@ -331,7 +332,7 @@ class ISO14496_Box
|
|||||||
* @return Array
|
* @return Array
|
||||||
* @throws ISO14496_Exception if called on a non-container box
|
* @throws ISO14496_Exception if called on a non-container box
|
||||||
*/
|
*/
|
||||||
public function getBoxesByIdentifier($identifier)
|
public final function getBoxesByIdentifier($identifier)
|
||||||
{
|
{
|
||||||
if (!$this->isContainer())
|
if (!$this->isContainer())
|
||||||
throw new ISO14496_Exception("Box not a container");
|
throw new ISO14496_Exception("Box not a container");
|
||||||
@@ -351,7 +352,7 @@ class ISO14496_Box
|
|||||||
* @param ISO14496_Box The box to add
|
* @param ISO14496_Box The box to add
|
||||||
* @return ISO14496_Box
|
* @return ISO14496_Box
|
||||||
*/
|
*/
|
||||||
public function addBox($box)
|
public final function addBox($box)
|
||||||
{
|
{
|
||||||
$box->setParent($this);
|
$box->setParent($this);
|
||||||
$box->setOptions($this->_options);
|
$box->setOptions($this->_options);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
* @subpackage MPEG
|
* @subpackage MPEG
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @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 */
|
/**#@+ @ignore */
|
||||||
@@ -58,7 +58,7 @@ require_once("MPEG/ABS/Frame.php");
|
|||||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
* @version $Rev: 1 $
|
* @version $Rev$
|
||||||
* @todo Implement validation routines
|
* @todo Implement validation routines
|
||||||
*/
|
*/
|
||||||
final class MPEG_ABS extends MPEG_ABS_Object
|
final class MPEG_ABS extends MPEG_ABS_Object
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
/**
|
/**
|
||||||
* PHP Reader Library
|
* 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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@@ -30,9 +31,9 @@
|
|||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @subpackage MPEG
|
* @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
|
* @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 */
|
/**#@+ @ignore */
|
||||||
@@ -53,11 +54,11 @@ require_once("MPEG/ABS/Object.php");
|
|||||||
* @subpackage MPEG
|
* @subpackage MPEG
|
||||||
* @author Ryan Butterfield <buttza@gmail.com>
|
* @author Ryan Butterfield <buttza@gmail.com>
|
||||||
* @author Sven Vollbehr <svollbehr@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
|
* @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.
|
* The bitrate lookup table. The table has the following format.
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ require_once("MPEG/ABS/Object.php");
|
|||||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @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
|
class MPEG_ABS_LAMEHeader extends MPEG_ABS_Object
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,167 +1,167 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* PHP Reader Library
|
* PHP Reader Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
* - Neither the name of the project workgroup nor the names of its
|
* - Neither the name of the project workgroup nor the names of its
|
||||||
* contributors may be used to endorse or promote products derived from this
|
* contributors may be used to endorse or promote products derived from this
|
||||||
* software without specific prior written permission.
|
* software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @subpackage MPEG
|
* @subpackage MPEG
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @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 */
|
/**#@+ @ignore */
|
||||||
require_once("MPEG/Object.php");
|
require_once("MPEG/Object.php");
|
||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base class for all MPEG Audio Bit Stream objects.
|
* The base class for all MPEG Audio Bit Stream objects.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @subpackage MPEG
|
* @subpackage MPEG
|
||||||
* @author Ryan Butterfield <buttza@gmail.com>
|
* @author Ryan Butterfield <buttza@gmail.com>
|
||||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @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
|
abstract class MPEG_ABS_Object extends MPEG_Object
|
||||||
{
|
{
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const VERSION_ONE = 3;
|
const VERSION_ONE = 3;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const VERSION_TWO = 2;
|
const VERSION_TWO = 2;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const VERSION_TWO_FIVE = 0;
|
const VERSION_TWO_FIVE = 0;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const SAMPLING_FREQUENCY_LOW = 0;
|
const SAMPLING_FREQUENCY_LOW = 0;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const SAMPLING_FREQUENCY_HIGH = 1;
|
const SAMPLING_FREQUENCY_HIGH = 1;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const LAYER_ONE = 3;
|
const LAYER_ONE = 3;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const LAYER_TWO = 2;
|
const LAYER_TWO = 2;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const LAYER_THREE = 1;
|
const LAYER_THREE = 1;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const CHANNEL_STEREO = 0;
|
const CHANNEL_STEREO = 0;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const CHANNEL_JOINT_STEREO = 1;
|
const CHANNEL_JOINT_STEREO = 1;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const CHANNEL_DUAL_CHANNEL = 2;
|
const CHANNEL_DUAL_CHANNEL = 2;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const CHANNEL_SINGLE_CHANNEL = 3;
|
const CHANNEL_SINGLE_CHANNEL = 3;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const MODE_SUBBAND_4_TO_31 = 0;
|
const MODE_SUBBAND_4_TO_31 = 0;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const MODE_SUBBAND_8_TO_31 = 1;
|
const MODE_SUBBAND_8_TO_31 = 1;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const MODE_SUBBAND_12_TO_31 = 2;
|
const MODE_SUBBAND_12_TO_31 = 2;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const MODE_SUBBAND_16_TO_31 = 3;
|
const MODE_SUBBAND_16_TO_31 = 3;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const MODE_ISOFF_MSSOFF = 0;
|
const MODE_ISOFF_MSSOFF = 0;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const MODE_ISON_MSSOFF = 1;
|
const MODE_ISON_MSSOFF = 1;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const MODE_ISOFF_MSSON = 2;
|
const MODE_ISOFF_MSSON = 2;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const MODE_ISON_MSSON = 3;
|
const MODE_ISON_MSSON = 3;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const EMPHASIS_NONE = 0;
|
const EMPHASIS_NONE = 0;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const EMPHASIS_50_15 = 1;
|
const EMPHASIS_50_15 = 1;
|
||||||
|
|
||||||
/** @var integer */
|
/** @var integer */
|
||||||
const EMPHASIS_CCIT_J17 = 3;
|
const EMPHASIS_CCIT_J17 = 3;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layer III side information size lookup table. The table has the following
|
* Layer III side information size lookup table. The table has the following
|
||||||
* format.
|
* format.
|
||||||
*
|
*
|
||||||
* <code>
|
* <code>
|
||||||
* array (
|
* array (
|
||||||
* SAMPLING_FREQUENCY_HIGH | SAMPLING_FREQUENCY_LOW => array (
|
* SAMPLING_FREQUENCY_HIGH | SAMPLING_FREQUENCY_LOW => array (
|
||||||
* CHANNEL_STEREO | CHANNEL_JOINT_STEREO | CHANNEL_DUAL_CHANNEL |
|
* CHANNEL_STEREO | CHANNEL_JOINT_STEREO | CHANNEL_DUAL_CHANNEL |
|
||||||
* CHANNEL_SINGLE_CHANNEL => <size>
|
* CHANNEL_SINGLE_CHANNEL => <size>
|
||||||
* )
|
* )
|
||||||
* )
|
* )
|
||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @var Array
|
* @var Array
|
||||||
*/
|
*/
|
||||||
protected static $sidesizes = array(
|
protected static $sidesizes = array(
|
||||||
self::SAMPLING_FREQUENCY_HIGH => array(
|
self::SAMPLING_FREQUENCY_HIGH => array(
|
||||||
self::CHANNEL_STEREO => 32,
|
self::CHANNEL_STEREO => 32,
|
||||||
self::CHANNEL_JOINT_STEREO => 32,
|
self::CHANNEL_JOINT_STEREO => 32,
|
||||||
self::CHANNEL_DUAL_CHANNEL => 32,
|
self::CHANNEL_DUAL_CHANNEL => 32,
|
||||||
self::CHANNEL_SINGLE_CHANNEL => 17
|
self::CHANNEL_SINGLE_CHANNEL => 17
|
||||||
),
|
),
|
||||||
self::SAMPLING_FREQUENCY_LOW => array(
|
self::SAMPLING_FREQUENCY_LOW => array(
|
||||||
self::CHANNEL_STEREO => 17,
|
self::CHANNEL_STEREO => 17,
|
||||||
self::CHANNEL_JOINT_STEREO => 17,
|
self::CHANNEL_JOINT_STEREO => 17,
|
||||||
self::CHANNEL_DUAL_CHANNEL => 17,
|
self::CHANNEL_DUAL_CHANNEL => 17,
|
||||||
self::CHANNEL_SINGLE_CHANNEL => 9
|
self::CHANNEL_SINGLE_CHANNEL => 9
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the class with given parameters.
|
* Constructs the class with given parameters.
|
||||||
*
|
*
|
||||||
* @param Reader $reader The reader object.
|
* @param Reader $reader The reader object.
|
||||||
* @param Array $options The options array.
|
* @param Array $options The options array.
|
||||||
*/
|
*/
|
||||||
public function __construct($reader, &$options = array())
|
public function __construct($reader, &$options = array())
|
||||||
{
|
{
|
||||||
parent::__construct($reader, $options);
|
parent::__construct($reader, $options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
* @subpackage MPEG
|
* @subpackage MPEG
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @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 */
|
/**#@+ @ignore */
|
||||||
@@ -51,7 +51,7 @@ require_once("MPEG/ABS/Object.php");
|
|||||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @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
|
class MPEG_ABS_VBRIHeader extends MPEG_ABS_Object
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
* @subpackage MPEG
|
* @subpackage MPEG
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @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 */
|
/**#@+ @ignore */
|
||||||
@@ -51,7 +51,7 @@ require_once("MPEG/ABS/Object.php");
|
|||||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @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
|
class MPEG_ABS_XINGHeader extends MPEG_ABS_Object
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,51 +1,51 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* PHP Reader Library
|
* PHP Reader Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
* Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer.
|
* this list of conditions and the following disclaimer.
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
* - Neither the name of the project workgroup nor the names of its
|
* - Neither the name of the project workgroup nor the names of its
|
||||||
* contributors may be used to endorse or promote products derived from this
|
* contributors may be used to endorse or promote products derived from this
|
||||||
* software without specific prior written permission.
|
* software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @subpackage MPEG
|
* @subpackage MPEG
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @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$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The MPEG_Exception is thrown whenever an error occurs within the MPEG family
|
* The MPEG_Exception is thrown whenever an error occurs within the MPEG family
|
||||||
* of classes.
|
* of classes.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @subpackage MPEG
|
* @subpackage MPEG
|
||||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
* @version $Rev: 85 $
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
class MPEG_Exception extends Exception
|
class MPEG_Exception extends Exception
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,246 +1,247 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* PHP Reader Library
|
* 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:
|
* Redistribution and use in source and binary forms, with or without
|
||||||
*
|
* modification, are permitted provided that the following conditions are met:
|
||||||
* - Redistributions of source code must retain the above copyright notice,
|
*
|
||||||
* this list of conditions and the following disclaimer.
|
* - Redistributions of source code must retain the above copyright notice,
|
||||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
* this list of conditions and the following disclaimer.
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* and/or other materials provided with the distribution.
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* - Neither the name of the project workgroup nor the names of its
|
* and/or other materials provided with the distribution.
|
||||||
* contributors may be used to endorse or promote products derived from this
|
* - Neither the name of the project workgroup nor the names of its
|
||||||
* software without specific prior written permission.
|
* contributors may be used to endorse or promote products derived from this
|
||||||
*
|
* software without specific prior written permission.
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
*
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
*
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
* @package php-reader
|
*
|
||||||
* @subpackage MPEG
|
* @package php-reader
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @subpackage MPEG
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||||
* @version $Id: Object.php 107 2008-08-03 19:09:16Z svollbehr $
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
*/
|
* @version $Id$
|
||||||
|
*/
|
||||||
/**#@+ @ignore */
|
|
||||||
require_once("Reader.php");
|
/**#@+ @ignore */
|
||||||
require_once("MPEG/Exception.php");
|
require_once("Reader.php");
|
||||||
/**#@-*/
|
require_once("MPEG/Exception.php");
|
||||||
|
/**#@-*/
|
||||||
/**
|
|
||||||
* The base class for all MPEG objects.
|
/**
|
||||||
*
|
* The base class for all MPEG objects.
|
||||||
* @package php-reader
|
*
|
||||||
* @subpackage MPEG
|
* @package php-reader
|
||||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
* @subpackage MPEG
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
|
||||||
* @version $Rev: 107 $
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
*/
|
* @version $Rev$
|
||||||
abstract class MPEG_Object
|
*/
|
||||||
{
|
abstract class MPEG_Object
|
||||||
/**
|
{
|
||||||
* The reader object.
|
/**
|
||||||
*
|
* The reader object.
|
||||||
* @var Reader
|
*
|
||||||
*/
|
* @var Reader
|
||||||
protected $_reader;
|
*/
|
||||||
|
protected $_reader;
|
||||||
/**
|
|
||||||
* The options array.
|
/**
|
||||||
*
|
* The options array.
|
||||||
* @var Array
|
*
|
||||||
*/
|
* @var Array
|
||||||
private $_options;
|
*/
|
||||||
|
private $_options;
|
||||||
/**
|
|
||||||
* Constructs the class with given parameters.
|
/**
|
||||||
*
|
* Constructs the class with given parameters.
|
||||||
* @param Reader $reader The reader object.
|
*
|
||||||
* @param Array $options The options array.
|
* @param Reader $reader The reader object.
|
||||||
*/
|
* @param Array $options The options array.
|
||||||
public function __construct($reader, &$options = array())
|
*/
|
||||||
{
|
public function __construct($reader, &$options = array())
|
||||||
$this->_reader = $reader;
|
{
|
||||||
$this->_options = &$options;
|
$this->_reader = $reader;
|
||||||
}
|
$this->_options = &$options;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Returns the options array.
|
/**
|
||||||
*
|
* Returns the options array.
|
||||||
* @return Array
|
*
|
||||||
*/
|
* @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
|
/**
|
||||||
* defined.
|
* Returns the given option value, or the default value if the option is not
|
||||||
*
|
* defined.
|
||||||
* @param string $option The name of the option.
|
*
|
||||||
* @param mixed $defaultValue The default value to be returned.
|
* @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];
|
if (isset($this->_options[$option]))
|
||||||
return $defaultValue;
|
return $this->_options[$option];
|
||||||
}
|
return $defaultValue;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Sets the options array. See {@link MPEG} class for available options.
|
/**
|
||||||
*
|
* Sets the options array. See {@link MPEG} class for available options.
|
||||||
* @param Array $options The options array.
|
*
|
||||||
*/
|
* @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.
|
/**
|
||||||
*
|
* Sets the given option the given value.
|
||||||
* @param string $option The name of the option.
|
*
|
||||||
* @param mixed $value The value to set for the option.
|
* @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;
|
{
|
||||||
}
|
$this->_options[$option] = $value;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Finds and returns the next start code. Start codes are reserved bit
|
/**
|
||||||
* patterns in the video file that do not otherwise occur in the video stream.
|
* Finds and returns the next start code. Start codes are reserved bit
|
||||||
*
|
* patterns in the video file that do not otherwise occur in the video stream.
|
||||||
* All start codes are byte aligned and start with the following byte
|
*
|
||||||
* sequence: 0x00 0x00 0x01.
|
* All start codes are byte aligned and start with the following byte
|
||||||
*
|
* sequence: 0x00 0x00 0x01.
|
||||||
* @return integer
|
*
|
||||||
*/
|
* @return integer
|
||||||
protected function nextStartCode()
|
*/
|
||||||
{
|
protected final function nextStartCode()
|
||||||
$buffer = " ";
|
{
|
||||||
for ($i = 0; $i < 4; $i++) {
|
$buffer = " ";
|
||||||
$start = $this->_reader->getOffset();
|
for ($i = 0; $i < 4; $i++) {
|
||||||
if (($buffer = substr($buffer, -4) . $this->_reader->read(512)) === false)
|
$start = $this->_reader->getOffset();
|
||||||
throw new MPEG_Exception("Invalid data");
|
if (($buffer = substr($buffer, -4) . $this->_reader->read(512)) === false)
|
||||||
$limit = strlen($buffer);
|
throw new MPEG_Exception("Invalid data");
|
||||||
$pos = 0;
|
$limit = strlen($buffer);
|
||||||
while ($pos < $limit - 3) {
|
$pos = 0;
|
||||||
if (Transform::fromUInt8($buffer{$pos++}) == 0 &&
|
while ($pos < $limit - 3) {
|
||||||
Transform::fromUInt16BE(substr($buffer, $pos, 2)) == 1) {
|
if (Transform::fromUInt8($buffer{$pos++}) == 0 &&
|
||||||
if (($pos += 2) < $limit - 2)
|
Transform::fromUInt16BE(substr($buffer, $pos, 2)) == 1) {
|
||||||
if (Transform::fromUInt16BE(substr($buffer, $pos, 2)) == 0 &&
|
if (($pos += 2) < $limit - 2)
|
||||||
Transform::fromUInt8($buffer{$pos + 2}) == 1)
|
if (Transform::fromUInt16BE(substr($buffer, $pos, 2)) == 0 &&
|
||||||
continue;
|
Transform::fromUInt8($buffer{$pos + 2}) == 1)
|
||||||
$this->_reader->setOffset($start + $pos - 3);
|
continue;
|
||||||
return Transform::fromUInt8($buffer{$pos++}) & 0xff | 0x100;
|
$this->_reader->setOffset($start + $pos - 3);
|
||||||
}
|
return Transform::fromUInt8($buffer{$pos++}) & 0xff | 0x100;
|
||||||
}
|
}
|
||||||
$this->_reader->setOffset($start + $limit);
|
}
|
||||||
}
|
$this->_reader->setOffset($start + $limit);
|
||||||
|
}
|
||||||
/* No start code found within 2048 bytes, the maximum size of a pack */
|
|
||||||
throw new MPEG_Exception("Invalid data");
|
/* No start code found within 2048 bytes, the maximum size of a pack */
|
||||||
}
|
throw new MPEG_Exception("Invalid data");
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Finds and returns the previous start code. Start codes are reserved bit
|
/**
|
||||||
* patterns in the video file that do not otherwise occur in the video stream.
|
* Finds and returns the previous start code. Start codes are reserved bit
|
||||||
*
|
* patterns in the video file that do not otherwise occur in the video stream.
|
||||||
* All start codes are byte aligned and start with the following byte
|
*
|
||||||
* sequence: 0x00 0x00 0x01.
|
* All start codes are byte aligned and start with the following byte
|
||||||
*
|
* sequence: 0x00 0x00 0x01.
|
||||||
* @return integer
|
*
|
||||||
*/
|
* @return integer
|
||||||
protected function prevStartCode()
|
*/
|
||||||
{
|
protected final function prevStartCode()
|
||||||
$buffer = " ";
|
{
|
||||||
$start;
|
$buffer = " ";
|
||||||
$position = $this->_reader->getOffset();
|
$start;
|
||||||
while ($position > 0) {
|
$position = $this->_reader->getOffset();
|
||||||
$start = 0;
|
while ($position > 0) {
|
||||||
$position = $position - 512;
|
$start = 0;
|
||||||
if ($position < 0)
|
$position = $position - 512;
|
||||||
throw new MPEG_Exception("Invalid data");
|
if ($position < 0)
|
||||||
$this->_reader->setOffset($position);
|
throw new MPEG_Exception("Invalid data");
|
||||||
$buffer = $this->_reader->read(512) . substr($buffer, 0, 4);
|
$this->_reader->setOffset($position);
|
||||||
$pos = 512 - 8;
|
$buffer = $this->_reader->read(512) . substr($buffer, 0, 4);
|
||||||
while ($pos > 3) {
|
$pos = 512 - 8;
|
||||||
if (Transform::fromUInt8($buffer{$pos}) == 0 &&
|
while ($pos > 3) {
|
||||||
Transform::fromUInt16BE(substr($buffer, $pos + 1, 2)) == 1) {
|
if (Transform::fromUInt8($buffer{$pos}) == 0 &&
|
||||||
|
Transform::fromUInt16BE(substr($buffer, $pos + 1, 2)) == 1) {
|
||||||
if ($pos + 2 < 512 &&
|
|
||||||
Transform::fromUInt16BE(substr($buffer, $pos + 3, 2)) == 0 &&
|
if ($pos + 2 < 512 &&
|
||||||
Transform::fromUInt8($buffer{$pos + 5}) == 1) {
|
Transform::fromUInt16BE(substr($buffer, $pos + 3, 2)) == 0 &&
|
||||||
$pos --;
|
Transform::fromUInt8($buffer{$pos + 5}) == 1) {
|
||||||
continue;
|
$pos --;
|
||||||
}
|
continue;
|
||||||
$this->_reader->setOffset($position + $pos);
|
}
|
||||||
return Transform::fromUInt8($buffer{$pos + 3}) & 0xff | 0x100;
|
$this->_reader->setOffset($position + $pos);
|
||||||
}
|
return Transform::fromUInt8($buffer{$pos + 3}) & 0xff | 0x100;
|
||||||
$pos--;
|
}
|
||||||
}
|
$pos--;
|
||||||
$this->_reader->setOffset($position = $position + 3);
|
}
|
||||||
}
|
$this->_reader->setOffset($position = $position + 3);
|
||||||
return 0;
|
}
|
||||||
}
|
return 0;
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Formats given time in seconds into the form of
|
/**
|
||||||
* [hours:]minutes:seconds.milliseconds.
|
* Formats given time in seconds into the form of
|
||||||
*
|
* [hours:]minutes:seconds.milliseconds.
|
||||||
* @param integer $seconds The time to format, in seconds
|
*
|
||||||
* @return string
|
* @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);
|
$milliseconds = round(($seconds - floor($seconds)) * 1000);
|
||||||
$minutes = floor($seconds / 60);
|
$seconds = floor($seconds);
|
||||||
$hours = floor($minutes / 60);
|
$minutes = floor($seconds / 60);
|
||||||
return
|
$hours = floor($minutes / 60);
|
||||||
($minutes > 0 ?
|
return
|
||||||
($hours > 0 ? $hours . ":" .
|
($minutes > 0 ?
|
||||||
str_pad($minutes % 60, 2, "0", STR_PAD_LEFT) : $minutes % 60) . ":" .
|
($hours > 0 ? $hours . ":" .
|
||||||
str_pad($seconds % 60, 2, "0", STR_PAD_LEFT) : $seconds % 60) . "." .
|
str_pad($minutes % 60, 2, "0", STR_PAD_LEFT) : $minutes % 60) . ":" .
|
||||||
str_pad($milliseconds, 3, "0", STR_PAD_LEFT);
|
str_pad($seconds % 60, 2, "0", STR_PAD_LEFT) : $seconds % 60) . "." .
|
||||||
}
|
str_pad($milliseconds, 3, "0", STR_PAD_LEFT);
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Magic function so that $obj->value will work.
|
/**
|
||||||
*
|
* Magic function so that $obj->value will work.
|
||||||
* @param string $name The field name.
|
*
|
||||||
* @return mixed
|
* @param string $name The field name.
|
||||||
*/
|
* @return mixed
|
||||||
public function __get($name)
|
*/
|
||||||
{
|
public function __get($name)
|
||||||
if (method_exists($this, "get" . ucfirst($name)))
|
{
|
||||||
return call_user_func(array($this, "get" . ucfirst($name)));
|
if (method_exists($this, "get" . ucfirst($name)))
|
||||||
else throw new MPEG_Exception("Unknown field: " . $name);
|
return call_user_func(array($this, "get" . ucfirst($name)));
|
||||||
}
|
else throw new MPEG_Exception("Unknown field: " . $name);
|
||||||
|
}
|
||||||
/**
|
|
||||||
* Magic function so that assignments with $obj->value will work.
|
/**
|
||||||
*
|
* Magic function so that assignments with $obj->value will work.
|
||||||
* @param string $name The field name.
|
*
|
||||||
* @param string $value The field value.
|
* @param string $name The field name.
|
||||||
* @return mixed
|
* @param string $value The field value.
|
||||||
*/
|
* @return mixed
|
||||||
public function __set($name, $value)
|
*/
|
||||||
{
|
public function __set($name, $value)
|
||||||
if (method_exists($this, "set" . ucfirst($name)))
|
{
|
||||||
call_user_func
|
if (method_exists($this, "set" . ucfirst($name)))
|
||||||
(array($this, "set" . ucfirst($name)), $value);
|
call_user_func
|
||||||
else throw new MPEG_Exception("Unknown field: " . $name);
|
(array($this, "set" . ucfirst($name)), $value);
|
||||||
}
|
else throw new MPEG_Exception("Unknown field: " . $name);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
* @subpackage MPEG
|
* @subpackage MPEG
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @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 */
|
/**#@+ @ignore */
|
||||||
@@ -57,7 +57,7 @@ require_once("MPEG/Object.php");
|
|||||||
* @author Sven Vollbehr <svollbehr@gmail.com>
|
* @author Sven Vollbehr <svollbehr@gmail.com>
|
||||||
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
* @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
|
||||||
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
|
||||||
* @version $Rev: 1 $
|
* @version $Rev$
|
||||||
* @todo Full implementation
|
* @todo Full implementation
|
||||||
*/
|
*/
|
||||||
final class MPEG_PS extends MPEG_Object
|
final class MPEG_PS extends MPEG_Object
|
||||||
|
|||||||
Reference in New Issue
Block a user