ASF_Header_Object object implementation. This object contains * objects that give information about the file. See corresponding object * classes for more. * * @package php-reader * @subpackage ASF * @author Sven Vollbehr * @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 $Rev$ */ final class ASF_HeaderObject extends ASF_Object { /** @var integer */ private $_objectCount; /** * @internal Internal variable to have the start of the stream stored in. * @var integer */ private $_readerSOffset; /** * @internal Internal variable to have the current position of the stream * pointer stored in. * @var integer */ private $_readerCOffset; /** * Constructs the class with given parameters and reads object related data * 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) { parent::__construct($reader, $id, $size); $this->_readerSOffset = $this->_reader->getOffset(); $this->_objectCount = $this->_reader->getUInt32LE(); $this->_reader->skip(2); $this->_readerCOffset = $this->_reader->getOffset(); } /** * Returns the number of standard ASF header objects this object contains. * * @return integer */ public function getObjectCount() { return $this->_objectCount; } /** * Checks whether there is more to be read within the bounds of the parent * object size. Returns true if there are child objects unread, * false otherwise. * * @return boolean */ public function hasChildObjects() { return ($this->_readerSOffset + $this->_size) > $this->_readerCOffset; } /** * Returns the next ASF object or false if end of stream has been * reached. Returned objects are of the type ASFObject or of any of * the other object types that inherit from that base class. * * @todo Only limited subset of possible child objects are regognized. * @return ASF_Object|false */ public function nextChildObject() { $object = false; if ($this->hasChildObjects()) { $this->_reader->setOffset($this->_readerCOffset); $guid = $this->_reader->getGUID(); $size = $this->_reader->getInt64LE(); $offset = $this->_reader->getOffset(); switch ($guid) { /* ASF_Content_Description_Object */ case "75b22633-668e-11cf-a6d9-00aa0062ce6c": $object = new ASF_ContentDescriptionObject($this->_reader, $guid, $size); break; /* ASF_Header_Extension_Object */ case "5fbf03b5-a92e-11cf-8ee3-00c00c205365": $this->_reader->skip(48); $this->_readerCOffset = $this->_reader->getOffset(); $object = $this->nextChildObject(); break; /* ASF_Extended_Content_Description_Object */ case "d2d0a440-e307-11d2-97f0-00a0c95ea850": $object = new ASF_ExtendedContentDescriptionObject ($this->_reader, $guid, $size); break; /* ASF_File_Properties_Object */ case "8cabdca1-a947-11cf-8ee4-00c00c205365": $object = new ASF_FilePropertiesObject($this->_reader, $guid, $size); break; default: // not implemented $object = new ASF_Object($this->_reader, $guid, $size); } $this->_reader->setOffset(($this->_readerCOffset = $offset - 24 + $size)); } return $object; } }