* @copyright Copyright (c) 2008 PHP Reader Project Workgroup * @license http://code.google.com/p/php-reader/wiki/License New BSD License * @version $Rev: 92 $ */ abstract class ISO14496_Box_Full extends ISO14496_Box { /** @var integer */ protected $_version = 0; /** @var integer */ protected $_flags = 0; /** * Constructs the class with given parameters and reads box related data from * the ISO Base Media file. * * @param Reader $reader The reader object. */ public function __construct($reader, &$options = array()) { parent::__construct($reader, $options); if ($reader === null) return; $this->_version = (($field = $this->_reader->readUInt32BE()) >> 24) & 0xff; $this->_flags = $field & 0xffffff; } /** * Returns the version of this format of the box. * * @return integer */ public function getVersion() { return $this->_version; } /** * Sets the version of this format of the box. * * @param integer $version The version. */ public function setVersion($version) { $this->_version = $version; } /** * Checks whether or not the flag is set. Returns true if the flag * is set, false otherwise. * * @param integer $flag The flag to query. * @return boolean */ public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; } /** * Returns the map of flags. * * @return integer */ public function getFlags() { return $this->_flags; } /** * Sets the map of flags. * * @param string $flags The map of flags. */ public function setFlags($flags) { $this->_flags = $flags; } /** * Returns the box raw data. * * @return string */ public function __toString($data = "") { return parent::__toString (Transform::toUInt32BE($this->_version << 24 | $this->_flags) . $data); } }