Handler Reference Box is within a {@link ISO14496_Box_MDIA Media * Box} declares the process by which the media-data in the track is presented, * and thus, the nature of the media in a track. For example, a video track * would be handled by a video handler. * * This box when present within a {@link ISO14496_Box_META Meta Box}, declares * the structure or format of the meta box contents. * * @package php-reader * @subpackage ISO 14496 * @author Sven Vollbehr * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup * @license http://code.google.com/p/php-reader/wiki/License New BSD License * @version $Rev: 92 $ */ final class ISO14496_Box_HDLR extends ISO14496_Box_Full { /** @var string */ private $_handlerType; /** @var string */ private $_name; /** * 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 = null, &$options = array()) { parent::__construct($reader, $options); if ($reader === null) return; $this->_reader->skip(4); $this->_handlerType = $this->_reader->read(4); $this->_reader->skip(12); $this->_name = $this->_reader->readString8 ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); } /** * Returns the handler type. * * When present in a media box, the returned value contains one of the * following values, or a value from a derived specification: * o vide Video track * o soun Audio track * o hint Hint track * * When present in a meta box, the returned value contains an appropriate * value to indicate the format of the meta box contents. * * @return integer */ public function getHandlerType() { return $this->_handlerType; } /** * Sets the handler type. * * When present in a media box, the value must be set to one of the following * values, or a value from a derived specification: * o vide Video track * o soun Audio track * o hint Hint track * * When present in a meta box, the value must be set to an appropriate value * to indicate the format of the meta box contents. * * @param string $handlerType The handler type. */ public function setHandlerType($handlerType) { $this->_handlerType = $handlerType; } /** * Returns the name string. The name is in UTF-8 characters and gives a * human-readable name for the track type (for debugging and inspection * purposes). * * @return integer */ public function getName() { return $this->_name; } /** * Sets the name string. The name must be in UTF-8 and give a human-readable * name for the track type (for debugging and inspection purposes). * * @param string $name The human-readable description. */ public function setName($name) { $this->_name = $name; } /** * Returns the box raw data. * * @return string */ public function __toString($data = "") { return parent::__toString ("appl" . $this->_handlerType . Transform::toUInt32BE(0) . Transform::toUInt32BE(0) . Transform::toUInt32BE(0) . $this->_name . "\0"); } }