Fix comments
git-svn-id: http://php-reader.googlecode.com/svn/trunk@10 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
48
src/ASF.php
48
src/ASF.php
@@ -1,11 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* PHP Reader Library
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
|
|
||||||
* Copyright (C) 2007, 2008 BEHR Software Systems. 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 +26,12 @@
|
|||||||
* 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 ASF
|
||||||
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**#@+ @ignore */
|
/**#@+ @ignore */
|
||||||
@@ -57,20 +58,23 @@ require_once("ASF/FilePropertiesObject.php");
|
|||||||
* or other specific data. Each supported object has been implemented as their
|
* or other specific data. Each supported object has been implemented as their
|
||||||
* own classes to ease the correct use of the information.
|
* own classes to ease the correct use of the information.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
* @subpackage ASF
|
||||||
* @copyright 2006, 2007 The Bearpaw Project Work Group
|
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
||||||
* @copyright 2007, 2008 BEHR Software Systems
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
* @version $Rev$
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
class ASF
|
class ASF
|
||||||
{
|
{
|
||||||
/** @var Reader The Reader object */
|
/** @var Reader */
|
||||||
private $_reader;
|
private $_reader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default constructor. Initiates the reader for the given file.
|
* Constructs the ASF class with given file.
|
||||||
|
*
|
||||||
|
* @param string $filename The path to the file.
|
||||||
*/
|
*/
|
||||||
public function __construct($filename)
|
public function __construct($filename)
|
||||||
{
|
{
|
||||||
@@ -78,9 +82,11 @@ class ASF
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether there are objects left in the stream.
|
* Checks whether there are objects left in the stream. Returns
|
||||||
|
* <var>true</var> if there are objects left in the stream, <var>false</var>
|
||||||
|
* otherwise.
|
||||||
*
|
*
|
||||||
* @return Boolean value corresponding whether there is more to read.
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function hasObjects()
|
public function hasObjects()
|
||||||
{
|
{
|
||||||
@@ -88,12 +94,12 @@ class ASF
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the next ASF object or false if end of stream has been reached.
|
* Returns the next ASF object or <var>false</var> if end of stream has been
|
||||||
|
* reached. Returned objects are of the type ASF_Object or of any of its child
|
||||||
|
* types.
|
||||||
*
|
*
|
||||||
* @todo Only the ASF_Header_Object top level object is regognized.
|
* @todo Only the ASF_Header_Object top level object is regognized.
|
||||||
* @return ASF_Object Returns the appropriate object. Returned objects are of
|
* @return ASF_Object
|
||||||
* the type ASF_Object or of any of the other object types that
|
|
||||||
* inherit from that base class.
|
|
||||||
*/
|
*/
|
||||||
public function nextObject()
|
public function nextObject()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* PHP Reader Library
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
|
|
||||||
* Copyright (C) 2007, 2008 BEHR Software Systems. 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 +26,12 @@
|
|||||||
* 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 ASF
|
||||||
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**#@+ @ignore */
|
/**#@+ @ignore */
|
||||||
@@ -38,47 +39,42 @@ require_once("Object.php");
|
|||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ASF_Content_Description_Object object implementation. This object
|
* The <i>ASF_Content_Description_Object</i> object implementation. This object
|
||||||
* contains five core attribute fields giving more information about the file:
|
* contains five core attribute fields giving more information about the file:
|
||||||
* title, author, description, copyright and rating.
|
* title, author, description, copyright and rating.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
* @subpackage ASF
|
||||||
* @copyright 2006, 2007 The Bearpaw Project Work Group
|
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
||||||
* @copyright 2007, 2008 BEHR Software Systems
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
* @version $Rev$
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
final class ASF_ContentDescriptionObject extends ASF_Object
|
final class ASF_ContentDescriptionObject extends ASF_Object
|
||||||
{
|
{
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The title field.
|
|
||||||
*/
|
|
||||||
private $_title;
|
private $_title;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The author field.
|
|
||||||
*/
|
|
||||||
private $_author;
|
private $_author;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The copyright field.
|
|
||||||
*/
|
|
||||||
private $_copyright;
|
private $_copyright;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The description field.
|
|
||||||
*/
|
|
||||||
private $_description;
|
private $_description;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The rating field.
|
|
||||||
*/
|
|
||||||
private $_rating;
|
private $_rating;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. Initiates the class with given parameters and reads
|
* Constructs the class with given parameters and reads object related data
|
||||||
* object related data from the ASF file.
|
* from the ASF file.
|
||||||
|
*
|
||||||
|
* @param Reader $reader The reader object.
|
||||||
|
* @param string $id The object GUID identifier.
|
||||||
|
* @param integer $size The object size.
|
||||||
*/
|
*/
|
||||||
public function __construct($reader, $id, $size)
|
public function __construct($reader, $id, $size)
|
||||||
{
|
{
|
||||||
@@ -99,36 +95,34 @@ final class ASF_ContentDescriptionObject extends ASF_Object
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the title field.
|
* Returns the title field.
|
||||||
*
|
|
||||||
* @return string Returns the title field.
|
|
||||||
*/
|
*/
|
||||||
public function getTitle() { return $this->_title; }
|
public function getTitle() { return $this->_title; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the author field.
|
* Returns the author field.
|
||||||
*
|
*
|
||||||
* @return string Returns the author field.
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAuthor() { return $this->_author; }
|
public function getAuthor() { return $this->_author; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the copyright field.
|
* Returns the copyright field.
|
||||||
*
|
*
|
||||||
* @return string Returns the copyright field.
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getCopyright() { return $this->_copyright; }
|
public function getCopyright() { return $this->_copyright; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the description field.
|
* Returns the description field.
|
||||||
*
|
*
|
||||||
* @return string Returns the description field.
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDescription() { return $this->_description; }
|
public function getDescription() { return $this->_description; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the rating field.
|
* Returns the rating field.
|
||||||
*
|
*
|
||||||
* @return string Returns the rating field.
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getRating() { return $this->_rating; }
|
public function getRating() { return $this->_rating; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* PHP Reader Library
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
|
|
||||||
* Copyright (C) 2007, 2008 BEHR Software Systems. 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 +26,12 @@
|
|||||||
* 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 ASF
|
||||||
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**#@+ @ignore */
|
/**#@+ @ignore */
|
||||||
@@ -38,27 +39,30 @@ require_once("Object.php");
|
|||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ASF_Extended_Content_Description_Object object implementation. This
|
* The <i>ASF_Extended_Content_Description_Object</i> object implementation.
|
||||||
* object contains unlimited number of attribute fields giving more information
|
* This object contains unlimited number of attribute fields giving more
|
||||||
* about the file.
|
* information about the file.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
* @subpackage ASF
|
||||||
* @copyright 2006, 2007 The Bearpaw Project Work Group
|
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
||||||
* @copyright 2007, 2008 BEHR Software Systems
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
* @version $Rev$
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
final class ASF_ExtendedContentDescriptionObject extends ASF_Object
|
final class ASF_ExtendedContentDescriptionObject extends ASF_Object
|
||||||
{
|
{
|
||||||
/**
|
/** @var Array */
|
||||||
* @var Array An associate array of descriptors and their values.
|
|
||||||
*/
|
|
||||||
private $_contentDescriptors = array();
|
private $_contentDescriptors = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiates the object class with given parameters and reads and processes
|
* Constructs the class with given parameters and reads object related data
|
||||||
* the object information from the ASF file.
|
* from the ASF file.
|
||||||
|
*
|
||||||
|
* @param Reader $reader The reader object.
|
||||||
|
* @param string $id The object GUID identifier.
|
||||||
|
* @param integer $size The object size.
|
||||||
*/
|
*/
|
||||||
public function __construct($reader, $id, $size)
|
public function __construct($reader, $id, $size)
|
||||||
{
|
{
|
||||||
@@ -96,7 +100,7 @@ final class ASF_ExtendedContentDescriptionObject extends ASF_Object
|
|||||||
* is no such descriptor defined.
|
* is no such descriptor defined.
|
||||||
*
|
*
|
||||||
* @param string $name The name of the descriptor (ie the name of the field).
|
* @param string $name The name of the descriptor (ie the name of the field).
|
||||||
* @return string Returns the value of a descriptor.
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
public function getDescriptor($name)
|
public function getDescriptor($name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* PHP Reader Library
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
|
|
||||||
* Copyright (C) 2007, 2008 BEHR Software Systems. 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 +26,12 @@
|
|||||||
* 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 ASF
|
||||||
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**#@+ @ignore */
|
/**#@+ @ignore */
|
||||||
@@ -38,76 +39,59 @@ require_once("Object.php");
|
|||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ASF_File_Properties_Object object implementation. This object contains
|
* The <i>ASF_File_Properties_Object</i> object implementation. This object
|
||||||
* various information about the ASF file.
|
* contains various information about the ASF file.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
* @subpackage ASF
|
||||||
* @copyright 2006, 2007 The Bearpaw Project Work Group
|
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
||||||
* @copyright 2007, 2008 BEHR Software Systems
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
* @version $Rev$
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
final class ASF_FilePropertiesObject extends ASF_Object
|
final class ASF_FilePropertiesObject extends ASF_Object
|
||||||
{
|
{
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The file id field.
|
|
||||||
*/
|
|
||||||
private $_fileId;
|
private $_fileId;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The file size field.
|
|
||||||
*/
|
|
||||||
private $_fileSize;
|
private $_fileSize;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The creation date field.
|
|
||||||
*/
|
|
||||||
private $_creationDate;
|
private $_creationDate;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The data packets count field.
|
|
||||||
*/
|
|
||||||
private $_dataPacketsCount;
|
private $_dataPacketsCount;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The play duration field.
|
|
||||||
*/
|
|
||||||
private $_playDuration;
|
private $_playDuration;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The send duration field.
|
|
||||||
*/
|
|
||||||
private $_sendDuration;
|
private $_sendDuration;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The preroll field.
|
|
||||||
*/
|
|
||||||
private $_preroll;
|
private $_preroll;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The flags field.
|
|
||||||
*/
|
|
||||||
private $_flags;
|
private $_flags;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The minimum data packet size field.
|
|
||||||
*/
|
|
||||||
private $_minimumDataPacketSize;
|
private $_minimumDataPacketSize;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The maximum data packet size field.
|
|
||||||
*/
|
|
||||||
private $_maximumDataPacketSize;
|
private $_maximumDataPacketSize;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string The maximum bitrate field.
|
|
||||||
*/
|
|
||||||
private $_maximumBitrate;
|
private $_maximumBitrate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initiates the object class with given parameters and reads and processes
|
* Constructs the class with given parameters and reads object related data
|
||||||
* the object information from the ASF file.
|
* from the ASF file.
|
||||||
|
*
|
||||||
|
* @param Reader $reader The reader object.
|
||||||
|
* @param string $id The object GUID identifier.
|
||||||
|
* @param integer $size The object size.
|
||||||
*/
|
*/
|
||||||
public function __construct($reader, $id, $size)
|
public function __construct($reader, $id, $size)
|
||||||
{
|
{
|
||||||
@@ -146,63 +130,63 @@ final class ASF_FilePropertiesObject extends ASF_Object
|
|||||||
/**
|
/**
|
||||||
* Returns the file id field.
|
* Returns the file id field.
|
||||||
*
|
*
|
||||||
* @return integer Returns the file id field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getFileId() { return $this->_fileId; }
|
public function getFileId() { return $this->_fileId; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the file size field.
|
* Returns the file size field.
|
||||||
*
|
*
|
||||||
* @return integer Returns the file size field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getFileSize() { return $this->_fileSize; }
|
public function getFileSize() { return $this->_fileSize; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the creation date field.
|
* Returns the creation date field.
|
||||||
*
|
*
|
||||||
* @return integer Returns the creation date field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getCreationDate() { return $this->_creationDate; }
|
public function getCreationDate() { return $this->_creationDate; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the data packets field.
|
* Returns the data packets field.
|
||||||
*
|
*
|
||||||
* @return integer Returns the data packets field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getDataPacketsCount() { return $this->_dataPacketsCount; }
|
public function getDataPacketsCount() { return $this->_dataPacketsCount; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the play duration field.
|
* Returns the play duration field.
|
||||||
*
|
*
|
||||||
* @return integer Returns the play duration field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getPlayDuration() { return $this->_playDuration; }
|
public function getPlayDuration() { return $this->_playDuration; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the send duration field.
|
* Returns the send duration field.
|
||||||
*
|
*
|
||||||
* @return integer Returns the send duration field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getSendDuration() { return $this->_sendDuration; }
|
public function getSendDuration() { return $this->_sendDuration; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the preroll field.
|
* Returns the preroll field.
|
||||||
*
|
*
|
||||||
* @return integer Returns the preroll field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getPreroll() { return $this->_preroll; }
|
public function getPreroll() { return $this->_preroll; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the flags field.
|
* Returns the flags field.
|
||||||
*
|
*
|
||||||
* @return integer Returns the flags field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getFlags() { return $this->_flags; }
|
public function getFlags() { return $this->_flags; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the minimum data packet size field.
|
* Returns the minimum data packet size field.
|
||||||
*
|
*
|
||||||
* @return integer Returns the minimum data packet size field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getMinimumDataPacketSize()
|
public function getMinimumDataPacketSize()
|
||||||
{
|
{
|
||||||
@@ -212,7 +196,7 @@ final class ASF_FilePropertiesObject extends ASF_Object
|
|||||||
/**
|
/**
|
||||||
* Returns the maximum data packet size field.
|
* Returns the maximum data packet size field.
|
||||||
*
|
*
|
||||||
* @return integer Returns the maximum data packet size field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getMaximumDataPacketSize()
|
public function getMaximumDataPacketSize()
|
||||||
{
|
{
|
||||||
@@ -222,10 +206,7 @@ final class ASF_FilePropertiesObject extends ASF_Object
|
|||||||
/**
|
/**
|
||||||
* Returns the maximum bitrate field.
|
* Returns the maximum bitrate field.
|
||||||
*
|
*
|
||||||
* @return integer Returns the maximum bitrate field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getMaximumBitrate()
|
public function getMaximumBitrate() { return $this->_maximumBitrate; }
|
||||||
{
|
|
||||||
return $this->_maximumBitrate;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* PHP Reader Library
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
|
|
||||||
* Copyright (C) 2007, 2008 BEHR Software Systems. 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 +26,12 @@
|
|||||||
* 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 ASF
|
||||||
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**#@+ @ignore */
|
/**#@+ @ignore */
|
||||||
@@ -38,38 +39,43 @@ require_once("Object.php");
|
|||||||
/**#@-*/
|
/**#@-*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ASF_Header_Object object implementation. This object contains objects
|
* The <i>ASF_Header_Object</i> object implementation. This object contains
|
||||||
* that give information about the file. See corresponding object classes for
|
* objects that give information about the file. See corresponding object
|
||||||
* more.
|
* classes for more.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
* @subpackage ASF
|
||||||
* @copyright 2006, 2007 The Bearpaw Project Work Group
|
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
||||||
* @copyright 2007, 2008 BEHR Software Systems
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
* @version $Rev$
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
final class ASF_HeaderObject extends ASF_Object
|
final class ASF_HeaderObject extends ASF_Object
|
||||||
{
|
{
|
||||||
/**
|
/** @var integer */
|
||||||
* @var integer The number of the objects the header contains.
|
|
||||||
*/
|
|
||||||
private $_objectCount;
|
private $_objectCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer Internal variable to have the start of the stream stored in.
|
* @internal Internal variable to have the start of the stream stored in.
|
||||||
|
* @var integer
|
||||||
*/
|
*/
|
||||||
private $_readerSOffset;
|
private $_readerSOffset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer Internal variable to have the current position of the
|
* @internal Internal variable to have the current position of the stream
|
||||||
* stream pointer stored in.
|
* pointer stored in.
|
||||||
|
* @var integer
|
||||||
*/
|
*/
|
||||||
private $_readerCOffset;
|
private $_readerCOffset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor. Initiates the class with given parameters and reads
|
* Constructs the class with given parameters and reads object related data
|
||||||
* object information from the file.
|
* from the ASF file.
|
||||||
|
*
|
||||||
|
* @param Reader $reader The reader object.
|
||||||
|
* @param string $id The object GUID identifier.
|
||||||
|
* @param integer $size The object size.
|
||||||
*/
|
*/
|
||||||
public function __construct($reader, $id, $size)
|
public function __construct($reader, $id, $size)
|
||||||
{
|
{
|
||||||
@@ -84,15 +90,16 @@ final class ASF_HeaderObject extends ASF_Object
|
|||||||
/**
|
/**
|
||||||
* Returns the number of standard ASF header objects this object contains.
|
* Returns the number of standard ASF header objects this object contains.
|
||||||
*
|
*
|
||||||
* @return integer The number of objects the header contains.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getObjectCount() { return $this->_objectCount; }
|
public function getObjectCount() { return $this->_objectCount; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether there is more to be read within the bounds of the parent
|
* Checks whether there is more to be read within the bounds of the parent
|
||||||
* object size.
|
* object size. Returns <var>true</var> if there are child objects unread,
|
||||||
|
* <var>false</var> otherwise.
|
||||||
*
|
*
|
||||||
* @return boolean Boolean value corresponding whether there is more to read.
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function hasChildObjects()
|
public function hasChildObjects()
|
||||||
{
|
{
|
||||||
@@ -100,13 +107,12 @@ final class ASF_HeaderObject extends ASF_Object
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the next standard ASF object or <var>false</var> if end of stream
|
* Returns the next ASF object or <var>false</var> if end of stream has been
|
||||||
* has been reached.
|
* reached. Returned objects are of the type <var>ASFObject</var> or of any of
|
||||||
|
* the other object types that inherit from that base class.
|
||||||
*
|
*
|
||||||
* @todo Only limited subset of possible child objects are regognized.
|
* @todo Only limited subset of possible child objects are regognized.
|
||||||
* @return ASF_Object Returns the appropriate object. Returned objects are of
|
* @return ASF_Object|false
|
||||||
* the type ASFObject or of any of the other object types that inherit
|
|
||||||
* from that base class.
|
|
||||||
*/
|
*/
|
||||||
public function nextChildObject()
|
public function nextChildObject()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* PHP Reader Library
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
|
|
||||||
* Copyright (C) 2007, 2008 BEHR Software Systems. 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,38 +26,50 @@
|
|||||||
* 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 ASF
|
||||||
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base class for all ASF objects.
|
* The base class for all ASF objects.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
* @subpackage ASF
|
||||||
* @copyright 2006, 2007 The Bearpaw Project Work Group
|
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
||||||
* @copyright 2007, 2008 BEHR Software Systems
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
* @version $Rev$
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
class ASF_Object
|
class ASF_Object
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var Reader The reader associated with this object.
|
* The reader object.
|
||||||
|
*
|
||||||
|
* @var Reader
|
||||||
*/
|
*/
|
||||||
protected $_reader;
|
protected $_reader;
|
||||||
|
|
||||||
/**
|
/** @var string */
|
||||||
* @var string Object's ID
|
|
||||||
*/
|
|
||||||
private $_id;
|
private $_id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var integer Object size in bytes.
|
* The object size in bytes.
|
||||||
|
*
|
||||||
|
* @var integer
|
||||||
*/
|
*/
|
||||||
protected $_size;
|
protected $_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the object with the given parameters.
|
* Constructs the class with given parameters.
|
||||||
|
*
|
||||||
|
* @param Reader $reader The reader object.
|
||||||
|
* @param string $id The object GUID identifier.
|
||||||
|
* @param integer $size The object size.
|
||||||
*/
|
*/
|
||||||
public function __construct($reader, $id, $size)
|
public function __construct($reader, $id, $size)
|
||||||
{
|
{
|
||||||
@@ -73,7 +81,7 @@ class ASF_Object
|
|||||||
/**
|
/**
|
||||||
* Returns the GUID of the ASF object.
|
* Returns the GUID of the ASF object.
|
||||||
*
|
*
|
||||||
* @return string Returns the GUID of the ASF object.
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getID() { return $this->_id; }
|
public function getIdentifier() { return $this->_id; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* PHP Reader Library
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008 BEHR Software Systems. 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:
|
||||||
@@ -29,7 +26,11 @@
|
|||||||
* 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 ID3
|
||||||
|
* @copyright Copyright (c) 2008 BEHR Software Systems
|
||||||
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**#@+ @ignore */
|
/**#@+ @ignore */
|
||||||
@@ -40,36 +41,41 @@ require_once("Reader.php");
|
|||||||
* This class represents a file containing ID3v1 headers as described in
|
* This class represents a file containing ID3v1 headers as described in
|
||||||
* {@link http://www.id3.org/id3v2-00 The ID3-Tag Specification Appendix}.
|
* {@link http://www.id3.org/id3v2-00 The ID3-Tag Specification Appendix}.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
* @subpackage ID3
|
||||||
* @copyright 2008 BEHR Software Systems
|
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @copyright Copyright (c) 2008 BEHR Software Systems
|
||||||
* @version $Rev$
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
class ID3v1
|
final class ID3v1
|
||||||
{
|
{
|
||||||
/** @var string The title */
|
/** @var string */
|
||||||
private $_title;
|
private $_title;
|
||||||
|
|
||||||
/** @var string The artist */
|
/** @var string */
|
||||||
private $_artist;
|
private $_artist;
|
||||||
|
|
||||||
/** @var string The album */
|
/** @var string */
|
||||||
private $_album;
|
private $_album;
|
||||||
|
|
||||||
/** @var string The year */
|
/** @var string */
|
||||||
private $_year;
|
private $_year;
|
||||||
|
|
||||||
/** @var string The comment */
|
/** @var string */
|
||||||
private $_comment;
|
private $_comment;
|
||||||
|
|
||||||
/** @var integer The track number */
|
/** @var integer */
|
||||||
private $_track;
|
private $_track;
|
||||||
|
|
||||||
/** @var integer The genre index */
|
/** @var integer */
|
||||||
private $_genre = 128;
|
private $_genre = 128;
|
||||||
|
|
||||||
/** @var Array The genre list */
|
/**
|
||||||
|
* The genre list.
|
||||||
|
*
|
||||||
|
* @var Array
|
||||||
|
*/
|
||||||
public static $genres = array
|
public static $genres = array
|
||||||
("Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
|
("Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
|
||||||
"Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B",
|
"Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B",
|
||||||
@@ -94,11 +100,13 @@ class ID3v1
|
|||||||
"Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House",
|
"Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House",
|
||||||
"Dance Hall", "Unknown");
|
"Dance Hall", "Unknown");
|
||||||
|
|
||||||
/** @var Reader The Reader object */
|
/** @var Reader */
|
||||||
private $_reader;
|
private $_reader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default constructor. Initiates the reader for the given file.
|
* Constructs the ID3v1 class with given file.
|
||||||
|
*
|
||||||
|
* @param string $filename The path to the file.
|
||||||
*/
|
*/
|
||||||
public function __construct($filename)
|
public function __construct($filename)
|
||||||
{
|
{
|
||||||
@@ -127,50 +135,50 @@ class ID3v1
|
|||||||
/**
|
/**
|
||||||
* Returns the title field.
|
* Returns the title field.
|
||||||
*
|
*
|
||||||
* @return string Returns the title field.
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getTitle() { return $this->_title; }
|
public function getTitle() { return $this->_title; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the artist field.
|
* Returns the artist field.
|
||||||
*
|
*
|
||||||
* @return string Returns the artist field.
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getArtist() { return $this->_artist; }
|
public function getArtist() { return $this->_artist; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the album field.
|
* Returns the album field.
|
||||||
*
|
*
|
||||||
* @return string Returns the album field.
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAlbum() { return $this->_album; }
|
public function getAlbum() { return $this->_album; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the year field.
|
* Returns the year field.
|
||||||
*
|
*
|
||||||
* @return string Returns the year field.
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getYear() { return $this->_year; }
|
public function getYear() { return $this->_year; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the comment field.
|
* Returns the comment field.
|
||||||
*
|
*
|
||||||
* @return string Returns the comment field.
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getComment() { return $this->_comment; }
|
public function getComment() { return $this->_comment; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the track field.
|
* Returns the track field.
|
||||||
*
|
*
|
||||||
* @note ID3v1.1 feature only
|
* @since ID3v1.1
|
||||||
* @return integer Returns the track field.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getTrack() { return $this->_track; }
|
public function getTrack() { return $this->_track; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the genre.
|
* Returns the genre.
|
||||||
*
|
*
|
||||||
* @return string Returns the genre.
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getGenre() {
|
public function getGenre() {
|
||||||
if (isset(self::$genres[$this->_genre]))
|
if (isset(self::$genres[$this->_genre]))
|
||||||
@@ -182,7 +190,7 @@ class ID3v1
|
|||||||
/**
|
/**
|
||||||
* Magic function so that $obj->value will work.
|
* Magic function so that $obj->value will work.
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name The field name.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __get($name) {
|
public function __get($name) {
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* PHP Reader Library
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
|
|
||||||
* Copyright (C) 2007, 2008 BEHR Software Systems. 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:
|
||||||
*
|
*
|
||||||
@@ -31,6 +27,10 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**#@+ @ignore */
|
/**#@+ @ignore */
|
||||||
@@ -45,27 +45,23 @@ require_once("Transform.php");
|
|||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
||||||
* @copyright 2006, 2007 The Bearpaw Project Work Group
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
* @copyright 2007, 2008 BEHR Software Systems
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
* @version $Rev$
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
class Reader
|
class Reader
|
||||||
{
|
{
|
||||||
/**
|
/** @var resource */
|
||||||
* @var resource The underlying file descriptor.
|
|
||||||
*/
|
|
||||||
private $_fd;
|
private $_fd;
|
||||||
|
|
||||||
/**
|
/** @var integer */
|
||||||
* @var integer The file size.
|
|
||||||
*/
|
|
||||||
private $_size;
|
private $_size;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the file given as a parameter.
|
* Constructs the Reader class with given file.
|
||||||
*
|
*
|
||||||
* @param string $filename The absolute or relative path to the file.
|
* @param string $filename The path to the file.
|
||||||
* @throws Reader_Exception if the file cannot be read.
|
* @throws Reader_Exception if the file cannot be read.
|
||||||
*/
|
*/
|
||||||
public function __construct($filename)
|
public function __construct($filename)
|
||||||
@@ -87,10 +83,11 @@ class Reader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether there is more to be read in the file.
|
* Checks whether there is more to be read in the file. Returns
|
||||||
|
* <var>true</var> if the end of the file has not yet been reached;
|
||||||
|
* <var>false</var> otherwise.
|
||||||
*
|
*
|
||||||
* @return boolean Returns <var>true</var> if the end of the file has not yet
|
* @return boolean
|
||||||
* been reached; <var>false</var> otherwise.
|
|
||||||
*/
|
*/
|
||||||
public function available()
|
public function available()
|
||||||
{
|
{
|
||||||
@@ -100,6 +97,7 @@ class Reader
|
|||||||
/**
|
/**
|
||||||
* Jumps <var>size</var> amount of bytes in the file stream.
|
* Jumps <var>size</var> amount of bytes in the file stream.
|
||||||
*
|
*
|
||||||
|
* @param integer $size The amount of bytes.
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Reader_Exception if <var>size</var> attribute is negative.
|
* @throws Reader_Exception if <var>size</var> attribute is negative.
|
||||||
*/
|
*/
|
||||||
@@ -115,7 +113,8 @@ class Reader
|
|||||||
/**
|
/**
|
||||||
* Reads <var>length</var> amount of bytes from the file stream.
|
* Reads <var>length</var> amount of bytes from the file stream.
|
||||||
*
|
*
|
||||||
* @return string Returns read bytes as a string
|
* @param integer $length The amount of bytes.
|
||||||
|
* @return string
|
||||||
* @throws Reader_Exception if <var>length</var> attribute is negative.
|
* @throws Reader_Exception if <var>length</var> attribute is negative.
|
||||||
*/
|
*/
|
||||||
public function read($length)
|
public function read($length)
|
||||||
@@ -130,7 +129,7 @@ class Reader
|
|||||||
/**
|
/**
|
||||||
* Returns the current point of operation.
|
* Returns the current point of operation.
|
||||||
*
|
*
|
||||||
* @return integer Returns the current cursor position.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getOffset()
|
public function getOffset()
|
||||||
{
|
{
|
||||||
@@ -138,8 +137,11 @@ class Reader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the point of operation, ie the cursor offset value.
|
* Sets the point of operation, ie the cursor offset value. The offset can
|
||||||
|
* also be set to a negative value when it is interpreted as an offset from
|
||||||
|
* the end of the file instead of the beginning.
|
||||||
*
|
*
|
||||||
|
* @param integer $offset The new point of operation.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setOffset($offset)
|
public function setOffset($offset)
|
||||||
@@ -150,7 +152,7 @@ class Reader
|
|||||||
/**
|
/**
|
||||||
* Returns the file size in bytes.
|
* Returns the file size in bytes.
|
||||||
*
|
*
|
||||||
* @return integer Returns the file size in bytes.
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getSize()
|
public function getSize()
|
||||||
{
|
{
|
||||||
@@ -158,8 +160,8 @@ class Reader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Magic function to delegate the call to helper methods of Transform class
|
* Magic function to delegate the call to helper methods of
|
||||||
* to transform read data in another format.
|
* <var>Transform</var> class to transform read data in another format.
|
||||||
*
|
*
|
||||||
* The read data length is determined from the helper method name. For methods
|
* The read data length is determined from the helper method name. For methods
|
||||||
* where arbitrary data lengths are accepted a parameter can be used to
|
* where arbitrary data lengths are accepted a parameter can be used to
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* PHP Reader Library
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008 BEHR Software Systems. 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,15 +27,18 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
|
* @copyright Copyright (c) 2008 BEHR Software Systems
|
||||||
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ReaderException is thrown whenever an error occurs within the Reader
|
* The Reader_Exception is thrown whenever an error occurs within the Reader
|
||||||
* class during a file operation.
|
* class during a file operation.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
||||||
* @copyright 2008 BEHR Software Systems
|
* @copyright Copyright (c) 2008 BEHR Software Systems
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
* @version $Rev$
|
* @version $Rev$
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* $Id$
|
* PHP Reader Library
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* Copyright (C) 2006, 2007 The Bearpaw Project Work Group. All Rights Reserved.
|
|
||||||
* Copyright (C) 2007, 2008 BEHR Software Systems. 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:
|
||||||
*
|
*
|
||||||
@@ -31,6 +27,10 @@
|
|||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,8 +38,8 @@
|
|||||||
*
|
*
|
||||||
* @package php-reader
|
* @package php-reader
|
||||||
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
* @author Sven Vollbehr <sven.vollbehr@behrss.eu>
|
||||||
* @copyright 2006, 2007 The Bearpaw Project Work Group
|
* @copyright Copyright (c) 2006, 2007 The Bearpaw Project Work Group
|
||||||
* @copyright 2007, 2008 BEHR Software Systems
|
* @copyright Copyright (c) 2007, 2008 BEHR Software Systems
|
||||||
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
|
||||||
* @version $Rev$
|
* @version $Rev$
|
||||||
* @static
|
* @static
|
||||||
@@ -61,7 +61,9 @@ final class Transform
|
|||||||
* aritmetic operations it is implicitly converted into floating point which
|
* aritmetic operations it is implicitly converted into floating point which
|
||||||
* is of 64-bits long.
|
* is of 64-bits long.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting 64-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @param integer $order The byte order of the raw string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getInt64($raw, $order = self::MACHINE_ENDIAN_ORDER)
|
public static function getInt64($raw, $order = self::MACHINE_ENDIAN_ORDER)
|
||||||
{
|
{
|
||||||
@@ -76,7 +78,8 @@ final class Transform
|
|||||||
* aritmetic operations it is implicitly converted into floating point which
|
* aritmetic operations it is implicitly converted into floating point which
|
||||||
* is of 64-bits long.
|
* is of 64-bits long.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting 64-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getInt64LE($raw)
|
public static function getInt64LE($raw)
|
||||||
{
|
{
|
||||||
@@ -89,7 +92,8 @@ final class Transform
|
|||||||
* aritmetic operations it is implicitly converted into floating point which
|
* aritmetic operations it is implicitly converted into floating point which
|
||||||
* is of 64-bits long.
|
* is of 64-bits long.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting 64-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getInt64BE($raw)
|
public static function getInt64BE($raw)
|
||||||
{
|
{
|
||||||
@@ -99,7 +103,8 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns machine-endian ordered binary data as signed 32-bit integer.
|
* Returns machine-endian ordered binary data as signed 32-bit integer.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting signed 32-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getInt32($raw)
|
public static function getInt32($raw)
|
||||||
{
|
{
|
||||||
@@ -110,7 +115,9 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns machine-endian ordered binary data as unsigned 32-bit integer.
|
* Returns machine-endian ordered binary data as unsigned 32-bit integer.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting unsigned 32-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @param integer $order The byte order of the raw string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getUInt32($raw, $order = self::MACHINE_ENDIAN_ORDER)
|
public static function getUInt32($raw, $order = self::MACHINE_ENDIAN_ORDER)
|
||||||
{
|
{
|
||||||
@@ -122,7 +129,8 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns little-endian ordered binary data as unsigned 32-bit integer.
|
* Returns little-endian ordered binary data as unsigned 32-bit integer.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting unsigned 32-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getUInt32LE($raw)
|
public static function getUInt32LE($raw)
|
||||||
{
|
{
|
||||||
@@ -132,7 +140,8 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns big-endian ordered binary data as unsigned 32-bit integer.
|
* Returns big-endian ordered binary data as unsigned 32-bit integer.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting unsigned 32-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getUInt32BE($raw)
|
public static function getUInt32BE($raw)
|
||||||
{
|
{
|
||||||
@@ -142,7 +151,8 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns machine endian ordered binary data as signed 16-bit integer.
|
* Returns machine endian ordered binary data as signed 16-bit integer.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting signed 16-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getInt16($raw)
|
public static function getInt16($raw)
|
||||||
{
|
{
|
||||||
@@ -153,7 +163,9 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns machine endian ordered binary data as unsigned 16-bit integer.
|
* Returns machine endian ordered binary data as unsigned 16-bit integer.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting unsigned 16-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @param integer $order The byte order of the raw string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getUInt16($raw, $order)
|
public static function getUInt16($raw, $order)
|
||||||
{
|
{
|
||||||
@@ -165,7 +177,8 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns little-endian ordered binary data as unsigned 16-bit integer.
|
* Returns little-endian ordered binary data as unsigned 16-bit integer.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting unsigned 16-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getUInt16LE($raw)
|
public static function getUInt16LE($raw)
|
||||||
{
|
{
|
||||||
@@ -175,7 +188,8 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns big-endian ordered binary data as unsigned 16-bit integer.
|
* Returns big-endian ordered binary data as unsigned 16-bit integer.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting unsigned 16-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getUInt16BE($raw)
|
public static function getUInt16BE($raw)
|
||||||
{
|
{
|
||||||
@@ -185,7 +199,8 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns binary data as 8-bit integer.
|
* Returns binary data as 8-bit integer.
|
||||||
*
|
*
|
||||||
* @return integer Returns the resulting 8-bit integer.
|
* @param string $raw The raw data string.
|
||||||
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public static function getInt8($raw)
|
public static function getInt8($raw)
|
||||||
{
|
{
|
||||||
@@ -195,7 +210,8 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns binary data as string. Removes terminating zero.
|
* Returns binary data as string. Removes terminating zero.
|
||||||
*
|
*
|
||||||
* @return string Returns the resulting string.
|
* @param string $raw The raw data string.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getString8($raw)
|
public static function getString8($raw)
|
||||||
{
|
{
|
||||||
@@ -206,9 +222,11 @@ final class Transform
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns machine-endian ordered binary data as string.
|
* Returns machine-endian ordered binary data as multibyte string.
|
||||||
*
|
*
|
||||||
* @return string Returns the resulting string.
|
* @param string $raw The raw data string.
|
||||||
|
* @param integer $order The byte order of the raw string.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getString16($raw, $order = self::MACHINE_ENDIAN_ORDER)
|
public static function getString16($raw, $order = self::MACHINE_ENDIAN_ORDER)
|
||||||
{
|
{
|
||||||
@@ -220,9 +238,10 @@ final class Transform
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns little-endian ordered binary data as string.
|
* Returns little-endian ordered binary data as multibyte string.
|
||||||
*
|
*
|
||||||
* @return string Returns the resulting string.
|
* @param string $raw The raw data string.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getString16LE($raw)
|
public static function getString16LE($raw)
|
||||||
{
|
{
|
||||||
@@ -230,9 +249,10 @@ final class Transform
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns big-endian ordered binary data as string.
|
* Returns big-endian ordered binary data as multibyte string.
|
||||||
*
|
*
|
||||||
* @return string Returns the resulting string.
|
* @param string $raw The raw data string.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getString16BE($raw)
|
public static function getString16BE($raw)
|
||||||
{
|
{
|
||||||
@@ -242,7 +262,8 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns binary data as hexadecimal string having high nibble first.
|
* Returns binary data as hexadecimal string having high nibble first.
|
||||||
*
|
*
|
||||||
* @return string Returns the resulting string.
|
* @param string $raw The raw data string.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getHHex($raw)
|
public static function getHHex($raw)
|
||||||
{
|
{
|
||||||
@@ -253,7 +274,8 @@ final class Transform
|
|||||||
/**
|
/**
|
||||||
* Returns binary data as hexadecimal string having low nibble first.
|
* Returns binary data as hexadecimal string having low nibble first.
|
||||||
*
|
*
|
||||||
* @return string Returns the resulting string.
|
* @param string $raw The raw data string.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getLHex($raw)
|
public static function getLHex($raw)
|
||||||
{
|
{
|
||||||
@@ -265,7 +287,8 @@ final class Transform
|
|||||||
* Returns the little-endian ordered raw data as big-endian ordered
|
* Returns the little-endian ordered raw data as big-endian ordered
|
||||||
* hexadecimal GUID string.
|
* hexadecimal GUID string.
|
||||||
*
|
*
|
||||||
* @return string Returns the raw data in appropriate GUID format.
|
* @param string $raw The raw data string.
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getGUID($raw)
|
public static function getGUID($raw)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user