From 59e4026b0af87dff2d506f0b716f54c0e72aacdf Mon Sep 17 00:00:00 2001 From: svollbehr Date: Thu, 4 Mar 2010 11:14:59 +0000 Subject: [PATCH] Fix file properties git-svn-id: http://php-reader.googlecode.com/svn/branches/zend@166 51a70ab9-7547-0410-9469-37e369ee0574 --- src/Zend/Media/Iso14496/Box/Bxml.php | 236 +++++----- src/Zend/Media/Iso14496/Box/Co64.php | 266 +++++------ src/Zend/Media/Iso14496/Box/Cprt.php | 300 ++++++------ src/Zend/Media/Iso14496/Box/Ctts.php | 278 ++++++------ src/Zend/Media/Iso14496/Box/Dref.php | 200 ++++---- src/Zend/Media/Iso14496/Box/Free.php | 178 ++++---- src/Zend/Media/Iso14496/Box/Frma.php | 232 +++++----- src/Zend/Media/Iso14496/Box/Hdlr.php | 348 +++++++------- src/Zend/Media/Iso14496/Box/Id32.php | 320 ++++++------- src/Zend/Media/Iso14496/Box/Iinf.php | 200 ++++---- src/Zend/Media/Iso14496/Box/Ilst.php | 652 +++++++++++++-------------- 11 files changed, 1605 insertions(+), 1605 deletions(-) diff --git a/src/Zend/Media/Iso14496/Box/Bxml.php b/src/Zend/Media/Iso14496/Box/Bxml.php index 090a84b..48caff2 100644 --- a/src/Zend/Media/Iso14496/Box/Bxml.php +++ b/src/Zend/Media/Iso14496/Box/Bxml.php @@ -1,118 +1,118 @@ -XML Box forms may be used. - * The Binary XML Box may only be used when there is a single well-defined - * binarization of the XML for that defined format as identified by the handler. - * - * Within an XML box the data is in UTF-8 format unless the data starts with a - * byte-order-mark (BOM), which indicates that the data is in UTF-16 format. - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - */ -final class Zend_Media_Iso14496_Box_Bxml extends Zend_Media_Iso14496_FullBox -{ - /** @var string */ - private $_xml; - - /** - * Constructs the class with given parameters and reads box related data - * from the ISO Base Media file. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - public function __construct($reader, &$options = array()) - { - parent::__construct($reader, $options); - - $this->_xml = $this->_reader->read - ($this->getOffset() + $this->getSize() - - $this->_reader->getOffset()); - } - - /** - * Returns the XML data. - * - * @return string - */ - public function getXml() - { - return $this->_xml; - } - - /** - * Sets the binary data. - * - * @param string $xml The XML data. - */ - public function setXml($xml) - { - $this->_xml = $xml; - } - - /** - * Returns the box heap size in bytes. - * - * @return integer - */ - public function getHeapSize() - { - return parent::getHeapSize() + strlen($this->_xml); - } - - /** - * Writes the box data. - * - * @param Zend_Io_Writer $writer The writer object. - * @return void - */ - protected function _writeData($writer) - { - parent::_writeData($writer); - $writer->write($this->_xml); - } -} +XML Box forms may be used. + * The Binary XML Box may only be used when there is a single well-defined + * binarization of the XML for that defined format as identified by the handler. + * + * Within an XML box the data is in UTF-8 format unless the data starts with a + * byte-order-mark (BOM), which indicates that the data is in UTF-16 format. + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +final class Zend_Media_Iso14496_Box_Bxml extends Zend_Media_Iso14496_FullBox +{ + /** @var string */ + private $_xml; + + /** + * Constructs the class with given parameters and reads box related data + * from the ISO Base Media file. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_xml = $this->_reader->read + ($this->getOffset() + $this->getSize() - + $this->_reader->getOffset()); + } + + /** + * Returns the XML data. + * + * @return string + */ + public function getXml() + { + return $this->_xml; + } + + /** + * Sets the binary data. + * + * @param string $xml The XML data. + */ + public function setXml($xml) + { + $this->_xml = $xml; + } + + /** + * Returns the box heap size in bytes. + * + * @return integer + */ + public function getHeapSize() + { + return parent::getHeapSize() + strlen($this->_xml); + } + + /** + * Writes the box data. + * + * @param Zend_Io_Writer $writer The writer object. + * @return void + */ + protected function _writeData($writer) + { + parent::_writeData($writer); + $writer->write($this->_xml); + } +} diff --git a/src/Zend/Media/Iso14496/Box/Co64.php b/src/Zend/Media/Iso14496/Box/Co64.php index 7034da6..451e73a 100644 --- a/src/Zend/Media/Iso14496/Box/Co64.php +++ b/src/Zend/Media/Iso14496/Box/Co64.php @@ -1,133 +1,133 @@ -Chunk Offset Box table gives the index of each chunk into the - * containing file. There are two variants, permitting the use of 32-bit or - * 64-bit offsets. The latter is useful when managing very large presentations. - * At most one of these variants will occur in any single instance of a sample - * table. - * - * Offsets are file offsets, not the offset into any box within the file (e.g. - * {@link Zend_Media_Iso14496_Box_Mdat Media Data Box}). This permits referring - * to media data in files without any box structure. It does also mean that care - * must be taken when constructing a self-contained ISO file with its metadata - * ({@link Zend_Media_Iso14496_Box_Moov Movie Box}) at the front, as the size of - * the {@link Zend_Media_Iso14496_Box_Moov Movie Box} will affect the chunk - * offsets to the media data. - * - * This box variant contains 64-bit offsets. - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - */ -final class Zend_Media_Iso14496_Box_Co64 extends Zend_Media_Iso14496_FullBox -{ - /** @var Array */ - private $_chunkOffsetTable = array(); - - /** - * Constructs the class with given parameters and reads box related data - * from the ISO Base Media file. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - public function __construct($reader, &$options = array()) - { - parent::__construct($reader, $options); - - $entryCount = $this->_reader->readUInt32BE(); - for ($i = 1; $i <= $entryCount; $i++) { - $this->_chunkOffsetTable[$i] = $this->_reader->readInt64BE(); - } - } - - /** - * Returns an array of values. Each entry has the entry number as its index - * and a 64 bit integer that gives the offset of the start of a chunk into - * its containing media file as its value. - * - * @return Array - */ - public function getChunkOffsetTable() - { - return $this->_chunkOffsetTable; - } - - /** - * Sets an array of chunk offsets. Each entry must have the entry number as - * its index and a 64 bit integer that gives the offset of the start of a - * chunk into its containing media file as its value. - * - * @param Array $chunkOffsetTable The chunk offset array. - */ - public function setChunkOffsetTable($chunkOffsetTable) - { - $this->_chunkOffsetTable = $chunkOffsetTable; - } - - /** - * Returns the box heap size in bytes. - * - * @return integer - */ - public function getHeapSize() - { - return parent::getHeapSize() + 4 + count($this->_chunkOffsetTable) * 8; - } - - /** - * Writes the box data. - * - * @param Zend_Io_Writer $writer The writer object. - * @return void - */ - protected function _writeData($writer) - { - $writer->writeUInt32BE($entryCount = count($this->_chunkOffsetTable)); - for ($i = 1; $i <= $entryCount; $i++) { - $writer->writeInt64BE($this->_chunkOffsetTable[$i]); - } - } -} +Chunk Offset Box table gives the index of each chunk into the + * containing file. There are two variants, permitting the use of 32-bit or + * 64-bit offsets. The latter is useful when managing very large presentations. + * At most one of these variants will occur in any single instance of a sample + * table. + * + * Offsets are file offsets, not the offset into any box within the file (e.g. + * {@link Zend_Media_Iso14496_Box_Mdat Media Data Box}). This permits referring + * to media data in files without any box structure. It does also mean that care + * must be taken when constructing a self-contained ISO file with its metadata + * ({@link Zend_Media_Iso14496_Box_Moov Movie Box}) at the front, as the size of + * the {@link Zend_Media_Iso14496_Box_Moov Movie Box} will affect the chunk + * offsets to the media data. + * + * This box variant contains 64-bit offsets. + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +final class Zend_Media_Iso14496_Box_Co64 extends Zend_Media_Iso14496_FullBox +{ + /** @var Array */ + private $_chunkOffsetTable = array(); + + /** + * Constructs the class with given parameters and reads box related data + * from the ISO Base Media file. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + for ($i = 1; $i <= $entryCount; $i++) { + $this->_chunkOffsetTable[$i] = $this->_reader->readInt64BE(); + } + } + + /** + * Returns an array of values. Each entry has the entry number as its index + * and a 64 bit integer that gives the offset of the start of a chunk into + * its containing media file as its value. + * + * @return Array + */ + public function getChunkOffsetTable() + { + return $this->_chunkOffsetTable; + } + + /** + * Sets an array of chunk offsets. Each entry must have the entry number as + * its index and a 64 bit integer that gives the offset of the start of a + * chunk into its containing media file as its value. + * + * @param Array $chunkOffsetTable The chunk offset array. + */ + public function setChunkOffsetTable($chunkOffsetTable) + { + $this->_chunkOffsetTable = $chunkOffsetTable; + } + + /** + * Returns the box heap size in bytes. + * + * @return integer + */ + public function getHeapSize() + { + return parent::getHeapSize() + 4 + count($this->_chunkOffsetTable) * 8; + } + + /** + * Writes the box data. + * + * @param Zend_Io_Writer $writer The writer object. + * @return void + */ + protected function _writeData($writer) + { + $writer->writeUInt32BE($entryCount = count($this->_chunkOffsetTable)); + for ($i = 1; $i <= $entryCount; $i++) { + $writer->writeInt64BE($this->_chunkOffsetTable[$i]); + } + } +} diff --git a/src/Zend/Media/Iso14496/Box/Cprt.php b/src/Zend/Media/Iso14496/Box/Cprt.php index 96a2272..0720523 100644 --- a/src/Zend/Media/Iso14496/Box/Cprt.php +++ b/src/Zend/Media/Iso14496/Box/Cprt.php @@ -1,150 +1,150 @@ -Copyright Box contains a copyright declaration which applies to - * the entire presentation, when contained within the - * {@link Zend_Media_Iso14496_Box_Moov Movie Box}, or, when contained in a - * track, to that entire track. There may be multiple copyright boxes using - * different language codes. - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - */ -final class Zend_Media_Iso14496_Box_Cprt extends Zend_Media_Iso14496_FullBox -{ - /** @var string */ - private $_language; - - /** @var string */ - private $_notice; - - /** - * Constructs the class with given parameters and reads box related data - * from the ISO Base Media file. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - * @todo Distinguish UTF-16? - */ - public function __construct($reader, &$options = array()) - { - parent::__construct($reader, $options); - - $this->_language = chr - (((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) . - chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); - $this->_notice = $this->_reader->readString8 - ($this->getOffset() + $this->getSize() - - $this->_reader->getOffset()); - } - - /** - * Returns the three byte language code to describe the language of the - * notice, according to {@link http://www.loc.gov/standards/iso639-2/ - * ISO 639-2/T}. - * - * @return string - */ - public function getLanguage() - { - return $this->_language; - } - - /** - * Sets the three byte language code to describe the language of this - * media, according to {@link http://www.loc.gov/standards/iso639-2/ - * ISO 639-2/T}. - * - * @param string $language The language code. - */ - public function setLanguage($language) - { - $this->_language = $language; - } - - /** - * Returns the copyright notice. - * - * @return string - */ - public function getNotice() - { - return $this->_notice; - } - - /** - * Returns the copyright notice. - * - * @param string $notice The copyright notice. - */ - public function setNotice($notice) - { - $this->_notice = $notice; - } - - /** - * Returns the box heap size in bytes. - * - * @return integer - */ - public function getHeapSize() - { - return parent::getHeapSize() + 3 + strlen($this->_notice); - } - - /** - * Writes the box data. - * - * @param Zend_Io_Writer $writer The writer object. - * @return void - */ - protected function _writeData($writer) - { - parent::_writeData($writer); - $writer->writeUInt16BE((ord($this->_language[0]) - 0x60) << 10 | - (ord($this->_language[1])- 0x60) << 5 | - (ord($this->_language[2])- 0x60)) - ->writeString8($this->_notice, 1); - } -} +Copyright Box contains a copyright declaration which applies to + * the entire presentation, when contained within the + * {@link Zend_Media_Iso14496_Box_Moov Movie Box}, or, when contained in a + * track, to that entire track. There may be multiple copyright boxes using + * different language codes. + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +final class Zend_Media_Iso14496_Box_Cprt extends Zend_Media_Iso14496_FullBox +{ + /** @var string */ + private $_language; + + /** @var string */ + private $_notice; + + /** + * Constructs the class with given parameters and reads box related data + * from the ISO Base Media file. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + * @todo Distinguish UTF-16? + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_language = chr + (((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) . + chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); + $this->_notice = $this->_reader->readString8 + ($this->getOffset() + $this->getSize() - + $this->_reader->getOffset()); + } + + /** + * Returns the three byte language code to describe the language of the + * notice, according to {@link http://www.loc.gov/standards/iso639-2/ + * ISO 639-2/T}. + * + * @return string + */ + public function getLanguage() + { + return $this->_language; + } + + /** + * Sets the three byte language code to describe the language of this + * media, according to {@link http://www.loc.gov/standards/iso639-2/ + * ISO 639-2/T}. + * + * @param string $language The language code. + */ + public function setLanguage($language) + { + $this->_language = $language; + } + + /** + * Returns the copyright notice. + * + * @return string + */ + public function getNotice() + { + return $this->_notice; + } + + /** + * Returns the copyright notice. + * + * @param string $notice The copyright notice. + */ + public function setNotice($notice) + { + $this->_notice = $notice; + } + + /** + * Returns the box heap size in bytes. + * + * @return integer + */ + public function getHeapSize() + { + return parent::getHeapSize() + 3 + strlen($this->_notice); + } + + /** + * Writes the box data. + * + * @param Zend_Io_Writer $writer The writer object. + * @return void + */ + protected function _writeData($writer) + { + parent::_writeData($writer); + $writer->writeUInt16BE((ord($this->_language[0]) - 0x60) << 10 | + (ord($this->_language[1])- 0x60) << 5 | + (ord($this->_language[2])- 0x60)) + ->writeString8($this->_notice, 1); + } +} diff --git a/src/Zend/Media/Iso14496/Box/Ctts.php b/src/Zend/Media/Iso14496/Box/Ctts.php index 640ca2a..1b84d6f 100644 --- a/src/Zend/Media/Iso14496/Box/Ctts.php +++ b/src/Zend/Media/Iso14496/Box/Ctts.php @@ -1,139 +1,139 @@ -Composition Time to Sample Box provides the offset between - * decoding time and composition time. Since decoding time must be less than the - * composition time, the offsets are expressed as unsigned numbers such that - * CT(n) = DT(n) + CTTS(n) where CTTS(n) is the (uncompressed) table entry for - * sample n. - * - * The composition time to sample table is optional and must only be present if - * DT and CT differ for any samples. Hint tracks do not use this box. - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - */ -final class Zend_Media_Iso14496_Box_Ctts extends Zend_Media_Iso14496_FullBox -{ - /** @var Array */ - private $_compositionOffsetTable = array(); - - /** - * Constructs the class with given parameters and reads box related data - * from the ISO Base Media file. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - public function __construct($reader, &$options = array()) - { - parent::__construct($reader, $options); - - $entryCount = $this->_reader->readUInt32BE(); - for ($i = 1; $i <= $entryCount; $i++) { - $this->_compositionOffsetTable[$i] = array - ('sampleCount' => $this->_reader->readUInt32BE(), - 'sampleOffset' => $this->_reader->readUInt32BE()); - } - } - - /** - * Returns an array of values. Each entry is an array containing the - * following keys. - * o sampleCount -- an integer that counts the number of consecutive - * samples that have the given offset. - * o sampleOffset -- a non-negative integer that gives the offset between - * CT and DT, such that CT(n) = DT(n) + CTTS(n). - * - * @return Array - */ - public function getCompositionOffsetTable() - { - return $this->_compositionOffsetTable; - } - - /** - * Sets an array of values. Each entry must have an array containing the - * following keys. - * o sampleCount -- an integer that counts the number of consecutive - * samples that have the given offset. - * o sampleOffset -- a non-negative integer that gives the offset between - * CT and DT, such that CT(n) = DT(n) + CTTS(n). - * - * @param Array $compositionOffsetTable The array of values. - */ - public function setCompositionOffsetTable($compositionOffsetTable) - { - $this->_compositionOffsetTable = $compositionOffsetTable; - } - - /** - * Returns the box heap size in bytes. - * - * @return integer - */ - public function getHeapSize() - { - return parent::getHeapSize() + 4 + - count($this->_compositionOffsetTable) * 8; - } - - /** - * Writes the box data. - * - * @param Zend_Io_Writer $writer The writer object. - * @return void - */ - protected function _writeData($writer) - { - parent::_writeData($writer); - $writer->writeUInt32BE($entryCount = count($this->_compositionOffsetTable)); - for ($i = 1; $i <= $entryCount; $i++) { - $writer->writeUInt32BE - ($this->_compositionOffsetTable[$i]['sampleCount']) - ->writeUInt32BE - ($this->_compositionOffsetTable[$i]['sampleOffset']); - } - } -} +Composition Time to Sample Box provides the offset between + * decoding time and composition time. Since decoding time must be less than the + * composition time, the offsets are expressed as unsigned numbers such that + * CT(n) = DT(n) + CTTS(n) where CTTS(n) is the (uncompressed) table entry for + * sample n. + * + * The composition time to sample table is optional and must only be present if + * DT and CT differ for any samples. Hint tracks do not use this box. + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +final class Zend_Media_Iso14496_Box_Ctts extends Zend_Media_Iso14496_FullBox +{ + /** @var Array */ + private $_compositionOffsetTable = array(); + + /** + * Constructs the class with given parameters and reads box related data + * from the ISO Base Media file. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + for ($i = 1; $i <= $entryCount; $i++) { + $this->_compositionOffsetTable[$i] = array + ('sampleCount' => $this->_reader->readUInt32BE(), + 'sampleOffset' => $this->_reader->readUInt32BE()); + } + } + + /** + * Returns an array of values. Each entry is an array containing the + * following keys. + * o sampleCount -- an integer that counts the number of consecutive + * samples that have the given offset. + * o sampleOffset -- a non-negative integer that gives the offset between + * CT and DT, such that CT(n) = DT(n) + CTTS(n). + * + * @return Array + */ + public function getCompositionOffsetTable() + { + return $this->_compositionOffsetTable; + } + + /** + * Sets an array of values. Each entry must have an array containing the + * following keys. + * o sampleCount -- an integer that counts the number of consecutive + * samples that have the given offset. + * o sampleOffset -- a non-negative integer that gives the offset between + * CT and DT, such that CT(n) = DT(n) + CTTS(n). + * + * @param Array $compositionOffsetTable The array of values. + */ + public function setCompositionOffsetTable($compositionOffsetTable) + { + $this->_compositionOffsetTable = $compositionOffsetTable; + } + + /** + * Returns the box heap size in bytes. + * + * @return integer + */ + public function getHeapSize() + { + return parent::getHeapSize() + 4 + + count($this->_compositionOffsetTable) * 8; + } + + /** + * Writes the box data. + * + * @param Zend_Io_Writer $writer The writer object. + * @return void + */ + protected function _writeData($writer) + { + parent::_writeData($writer); + $writer->writeUInt32BE($entryCount = count($this->_compositionOffsetTable)); + for ($i = 1; $i <= $entryCount; $i++) { + $writer->writeUInt32BE + ($this->_compositionOffsetTable[$i]['sampleCount']) + ->writeUInt32BE + ($this->_compositionOffsetTable[$i]['sampleOffset']); + } + } +} diff --git a/src/Zend/Media/Iso14496/Box/Dref.php b/src/Zend/Media/Iso14496/Box/Dref.php index de43527..129e662 100644 --- a/src/Zend/Media/Iso14496/Box/Dref.php +++ b/src/Zend/Media/Iso14496/Box/Dref.php @@ -1,100 +1,100 @@ -Data Reference Box contains a table of data references (normally - * URLs) that declare the location(s) of the media data used within the - * presentation. The data reference index in the sample description ties entries - * in this table to the samples in the track. A track may be split over several - * sources in this way. - * - * This box may either contain {@link Zend_Media_Iso14496_Box_Urn urn} or - * {@link Zend_Media_Iso14496_Box_Url url} boxes. - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - */ -final class Zend_Media_Iso14496_Box_Dref extends Zend_Media_Iso14496_FullBox -{ - /** - * Constructs the class with given parameters and reads box related data - * from the ISO Base Media file. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - public function __construct($reader = null, &$options = array()) - { - parent::__construct($reader, $options); - $this->setContainer(true); - - if ($reader === null) { - return; - } - - $this->_reader->skip(4); - $this->constructBoxes(); - } - - /** - * Returns the box heap size in bytes. - * - * @return integer - */ - public function getHeapSize() - { - return parent::getHeapSize() + 4; - } - - /** - * Writes the box data. - * - * @param Zend_Io_Writer $writer The writer object. - * @return void - */ - protected function _writeData($writer) - { - parent::_writeData($writer); - $writer->writeUInt32BE($this->getBoxCount()); - } -} +Data Reference Box contains a table of data references (normally + * URLs) that declare the location(s) of the media data used within the + * presentation. The data reference index in the sample description ties entries + * in this table to the samples in the track. A track may be split over several + * sources in this way. + * + * This box may either contain {@link Zend_Media_Iso14496_Box_Urn urn} or + * {@link Zend_Media_Iso14496_Box_Url url} boxes. + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +final class Zend_Media_Iso14496_Box_Dref extends Zend_Media_Iso14496_FullBox +{ + /** + * Constructs the class with given parameters and reads box related data + * from the ISO Base Media file. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) { + return; + } + + $this->_reader->skip(4); + $this->constructBoxes(); + } + + /** + * Returns the box heap size in bytes. + * + * @return integer + */ + public function getHeapSize() + { + return parent::getHeapSize() + 4; + } + + /** + * Writes the box data. + * + * @param Zend_Io_Writer $writer The writer object. + * @return void + */ + protected function _writeData($writer) + { + parent::_writeData($writer); + $writer->writeUInt32BE($this->getBoxCount()); + } +} diff --git a/src/Zend/Media/Iso14496/Box/Free.php b/src/Zend/Media/Iso14496/Box/Free.php index 927f0a9..db149a8 100644 --- a/src/Zend/Media/Iso14496/Box/Free.php +++ b/src/Zend/Media/Iso14496/Box/Free.php @@ -1,89 +1,89 @@ -Free Space Box are irrelevant and may be ignored, or - * the object deleted, without affecting the presentation. (Care should be - * exercised when deleting the object, as this may invalidate the offsets used - * in the sample table, unless this object is after all the media data). - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - */ -final class Zend_Media_Iso14496_Box_Free extends Zend_Media_Iso14496_Box -{ - /** - * Constructs the class with given parameters. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - public function __construct($reader = null, &$options = array()) - { - parent::__construct($reader, $options); - } - - /** - * Returns the box heap size in bytes. - * - * @return integer - */ - public function getHeapSize() - { - return ($this->getSize() >= 8 ? $this->getSize() : 0); - } - - /** - * Writes the box data. - * - * @param Zend_Io_Writer $writer The writer object. - * @return void - */ - protected function _writeData($writer) - { - if ($this->getSize() >= 8) { - parent::_writeData($writer); - $writer->write(str_repeat("\0", $this->getSize() - 8)); - } - } -} +Free Space Box are irrelevant and may be ignored, or + * the object deleted, without affecting the presentation. (Care should be + * exercised when deleting the object, as this may invalidate the offsets used + * in the sample table, unless this object is after all the media data). + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +final class Zend_Media_Iso14496_Box_Free extends Zend_Media_Iso14496_Box +{ + /** + * Constructs the class with given parameters. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + } + + /** + * Returns the box heap size in bytes. + * + * @return integer + */ + public function getHeapSize() + { + return ($this->getSize() >= 8 ? $this->getSize() : 0); + } + + /** + * Writes the box data. + * + * @param Zend_Io_Writer $writer The writer object. + * @return void + */ + protected function _writeData($writer) + { + if ($this->getSize() >= 8) { + parent::_writeData($writer); + $writer->write(str_repeat("\0", $this->getSize() - 8)); + } + } +} diff --git a/src/Zend/Media/Iso14496/Box/Frma.php b/src/Zend/Media/Iso14496/Box/Frma.php index a6644ed..a58f553 100644 --- a/src/Zend/Media/Iso14496/Box/Frma.php +++ b/src/Zend/Media/Iso14496/Box/Frma.php @@ -1,116 +1,116 @@ -Original Format Box contains the four-character-code of the - * original un-transformed sample description. - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - */ -final class Zend_Media_Iso14496_Box_Frma extends Zend_Media_Iso14496_Box -{ - /** @var string */ - private $_dataFormat; - - /** - * Constructs the class with given parameters and reads box related data - * from the ISO Base Media file. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - public function __construct($reader, &$options = array()) - { - parent::__construct($reader, $options); - - $this->_dataFormat = $this->_reader->read(4); - } - - /** - * Returns the four-character-code of the original un-transformed sample - * entry (e.g. mp4v if the stream contains protected MPEG-4 visual - * material). - * - * @return string - */ - public function getDataFormat() - { - return $this->_dataFormat; - } - - /** - * Sets the four-character-code of the original un-transformed sample - * entry (e.g. mp4v if the stream contains protected MPEG-4 visual - * material). - * - * @param string $dataFormat The data format. - */ - public function setDataFormat($dataFormat) - { - $this->_dataFormat = $dataFormat; - } - - /** - * Returns the box heap size in bytes. - * - * @return integer - */ - public function getHeapSize() - { - return parent::getHeapSize() + 4; - } - - /** - * Writes the box data. - * - * @param Zend_Io_Writer $writer The writer object. - * @return void - */ - protected function _writeData($writer) - { - parent::_writeData($writer); - - $writer->write(substr($this->_dataFormat, 0, 4)); - } -} +Original Format Box contains the four-character-code of the + * original un-transformed sample description. + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +final class Zend_Media_Iso14496_Box_Frma extends Zend_Media_Iso14496_Box +{ + /** @var string */ + private $_dataFormat; + + /** + * Constructs the class with given parameters and reads box related data + * from the ISO Base Media file. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_dataFormat = $this->_reader->read(4); + } + + /** + * Returns the four-character-code of the original un-transformed sample + * entry (e.g. mp4v if the stream contains protected MPEG-4 visual + * material). + * + * @return string + */ + public function getDataFormat() + { + return $this->_dataFormat; + } + + /** + * Sets the four-character-code of the original un-transformed sample + * entry (e.g. mp4v if the stream contains protected MPEG-4 visual + * material). + * + * @param string $dataFormat The data format. + */ + public function setDataFormat($dataFormat) + { + $this->_dataFormat = $dataFormat; + } + + /** + * Returns the box heap size in bytes. + * + * @return integer + */ + public function getHeapSize() + { + return parent::getHeapSize() + 4; + } + + /** + * Writes the box data. + * + * @param Zend_Io_Writer $writer The writer object. + * @return void + */ + protected function _writeData($writer) + { + parent::_writeData($writer); + + $writer->write(substr($this->_dataFormat, 0, 4)); + } +} diff --git a/src/Zend/Media/Iso14496/Box/Hdlr.php b/src/Zend/Media/Iso14496/Box/Hdlr.php index 9c001d4..91fed5d 100644 --- a/src/Zend/Media/Iso14496/Box/Hdlr.php +++ b/src/Zend/Media/Iso14496/Box/Hdlr.php @@ -1,174 +1,174 @@ -Handler Reference Box is within a - * {@link Zend_Media_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 Zend_Media_Iso14496_Box_Meta Meta Box}, - * declares the structure or format of the meta box contents. - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - */ -final class Zend_Media_Iso14496_Box_Hdlr extends Zend_Media_Iso14496_FullBox -{ - /** @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 Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - 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 heap size in bytes. - * - * @return integer - */ - public function getHeapSize() - { - return parent::getHeapSize() + 21 + strlen($this->_name); - } - - /** - * Writes the box data. - * - * @param Zend_Io_Writer $writer The writer object. - * @return void - */ - protected function _writeData($writer) - { - parent::_writeData($writer); - $writer->write(str_pad('', 4, "\0")) - ->write($this->_handlerType) - ->writeUInt32BE(0) - ->writeUInt32BE(0) - ->writeUInt32BE(0) - ->writeString8($this->_name, 1); - } -} +Handler Reference Box is within a + * {@link Zend_Media_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 Zend_Media_Iso14496_Box_Meta Meta Box}, + * declares the structure or format of the meta box contents. + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +final class Zend_Media_Iso14496_Box_Hdlr extends Zend_Media_Iso14496_FullBox +{ + /** @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 Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + 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 heap size in bytes. + * + * @return integer + */ + public function getHeapSize() + { + return parent::getHeapSize() + 21 + strlen($this->_name); + } + + /** + * Writes the box data. + * + * @param Zend_Io_Writer $writer The writer object. + * @return void + */ + protected function _writeData($writer) + { + parent::_writeData($writer); + $writer->write(str_pad('', 4, "\0")) + ->write($this->_handlerType) + ->writeUInt32BE(0) + ->writeUInt32BE(0) + ->writeUInt32BE(0) + ->writeString8($this->_name, 1); + } +} diff --git a/src/Zend/Media/Iso14496/Box/Id32.php b/src/Zend/Media/Iso14496/Box/Id32.php index 63a7a01..eb84fb8 100644 --- a/src/Zend/Media/Iso14496/Box/Id32.php +++ b/src/Zend/Media/Iso14496/Box/Id32.php @@ -1,160 +1,160 @@ -ID3v2 Box resides under the - * {@link Zend_Media_Iso14496_Box_Meta Meta Box} and stores ID3 version 2 - * meta-data. There may be more than one Id3v2 Box present each with a different - * language code. - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - */ -final class Zend_Media_Iso14496_Box_Id32 extends Zend_Media_Iso14496_FullBox -{ - /** @var string */ - private $_language = 'und'; - - /** @var Zend_Media_Id3v2 */ - private $_tag; - - /** - * Constructs the class with given parameters and reads box related data - * from the ISO Base Media file. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - public function __construct($reader = null, &$options = array()) - { - parent::__construct($reader, $options); - - if ($reader === null) { - return; - } - - $this->_language = - chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + - 0x60) . - chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); - $this->_tag = new Zend_Media_Id3v2 - ($this->_reader, array('readonly' => true)); - } - - /** - * Returns the three byte language code to describe the language of this - * media, according to {@link http://www.loc.gov/standards/iso639-2/ - * ISO 639-2/T}. - * - * @return string - */ - public function getLanguage() - { - return $this->_language; - } - - /** - * Sets the three byte language code as specified in the - * {@link http://www.loc.gov/standards/iso639-2/ ISO 639-2} standard. - * - * @param string $language The language code. - */ - public function setLanguage($language) - { - $this->_language = $language; - } - - /** - * Returns the {@link Zend_Media_Id3v2 Id3v2} tag class instance. - * - * @return string - */ - public function getTag() - { - return $this->_tag; - } - - /** - * Sets the {@link Zend_Media_Id3v2 Id3v2} tag class instance using given - * language. - * - * @param Zend_Media_Id3v2 $tag The tag instance. - * @param string $language The language code. - */ - public function setTag($tag, $language = null) - { - $this->_tag = $tag; - if ($language !== null) { - $this->_language = $language; - } - } - - /** - * Returns the box heap size in bytes. - * - * @return integer - * @todo There has got to be a better way to do this - */ - public function getHeapSize() - { - $writer = new Zend_Io_StringWriter(); - $this->_tag->write($writer); - return parent::getHeapSize() + 2 + $writer->getSize(); - } - - /** - * Writes the box data. - * - * @param Zend_Io_Writer $writer The writer object. - * @return void - */ - protected function _writeData($writer) - { - parent::_writeData($writer); - $writer->writeUInt16BE - (((ord($this->_language[0]) - 0x60) << 10) | - ((ord($this->_language[1]) - 0x60) << 5) | - ord($this->_language[2]) - 0x60); - $this->_tag->write($writer); - } -} +ID3v2 Box resides under the + * {@link Zend_Media_Iso14496_Box_Meta Meta Box} and stores ID3 version 2 + * meta-data. There may be more than one Id3v2 Box present each with a different + * language code. + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +final class Zend_Media_Iso14496_Box_Id32 extends Zend_Media_Iso14496_FullBox +{ + /** @var string */ + private $_language = 'und'; + + /** @var Zend_Media_Id3v2 */ + private $_tag; + + /** + * Constructs the class with given parameters and reads box related data + * from the ISO Base Media file. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) { + return; + } + + $this->_language = + chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + + 0x60) . + chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); + $this->_tag = new Zend_Media_Id3v2 + ($this->_reader, array('readonly' => true)); + } + + /** + * Returns the three byte language code to describe the language of this + * media, according to {@link http://www.loc.gov/standards/iso639-2/ + * ISO 639-2/T}. + * + * @return string + */ + public function getLanguage() + { + return $this->_language; + } + + /** + * Sets the three byte language code as specified in the + * {@link http://www.loc.gov/standards/iso639-2/ ISO 639-2} standard. + * + * @param string $language The language code. + */ + public function setLanguage($language) + { + $this->_language = $language; + } + + /** + * Returns the {@link Zend_Media_Id3v2 Id3v2} tag class instance. + * + * @return string + */ + public function getTag() + { + return $this->_tag; + } + + /** + * Sets the {@link Zend_Media_Id3v2 Id3v2} tag class instance using given + * language. + * + * @param Zend_Media_Id3v2 $tag The tag instance. + * @param string $language The language code. + */ + public function setTag($tag, $language = null) + { + $this->_tag = $tag; + if ($language !== null) { + $this->_language = $language; + } + } + + /** + * Returns the box heap size in bytes. + * + * @return integer + * @todo There has got to be a better way to do this + */ + public function getHeapSize() + { + $writer = new Zend_Io_StringWriter(); + $this->_tag->write($writer); + return parent::getHeapSize() + 2 + $writer->getSize(); + } + + /** + * Writes the box data. + * + * @param Zend_Io_Writer $writer The writer object. + * @return void + */ + protected function _writeData($writer) + { + parent::_writeData($writer); + $writer->writeUInt16BE + (((ord($this->_language[0]) - 0x60) << 10) | + ((ord($this->_language[1]) - 0x60) << 5) | + ord($this->_language[2]) - 0x60); + $this->_tag->write($writer); + } +} diff --git a/src/Zend/Media/Iso14496/Box/Iinf.php b/src/Zend/Media/Iso14496/Box/Iinf.php index 45db60a..a32e60c 100644 --- a/src/Zend/Media/Iso14496/Box/Iinf.php +++ b/src/Zend/Media/Iso14496/Box/Iinf.php @@ -1,100 +1,100 @@ -Item Information Box provides extra information about selected - * items, including symbolic (file) names. It may optionally occur, but - * if it does, it must be interpreted, as item protection or content encoding - * may have changed the format of the data in the item. If both content encoding - * and protection are indicated for an item, a reader should first un-protect - * the item, and then decode the item's content encoding. If more control is - * needed, an IPMP sequence code may be used. - * - - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - */ -final class Zend_Media_Iso14496_Box_Iinf extends Zend_Media_Iso14496_Box -{ - /** - * Constructs the class with given parameters and reads box related data - * from the ISO Base Media file. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - public function __construct($reader = null, &$options = array()) - { - parent::__construct($reader, $options); - $this->setContainer(true); - - if ($reader === null) { - return; - } - - $this->_reader->skip(2); - $this->constructBoxes(); - } - - /** - * Returns the box heap size in bytes. - * - * @return integer - */ - public function getHeapSize() - { - return parent::getHeapSize() + 2; - } - - /** - * Writes the box data. - * - * @param Zend_Io_Writer $writer The writer object. - * @return void - */ - protected function _writeData($writer) - { - parent::_writeData($writer); - $writer->writeUInt16BE($this->getBoxCount()); - } -} +Item Information Box provides extra information about selected + * items, including symbolic (file) names. It may optionally occur, but + * if it does, it must be interpreted, as item protection or content encoding + * may have changed the format of the data in the item. If both content encoding + * and protection are indicated for an item, a reader should first un-protect + * the item, and then decode the item's content encoding. If more control is + * needed, an IPMP sequence code may be used. + * + + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + */ +final class Zend_Media_Iso14496_Box_Iinf extends Zend_Media_Iso14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data + * from the ISO Base Media file. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) { + return; + } + + $this->_reader->skip(2); + $this->constructBoxes(); + } + + /** + * Returns the box heap size in bytes. + * + * @return integer + */ + public function getHeapSize() + { + return parent::getHeapSize() + 2; + } + + /** + * Writes the box data. + * + * @param Zend_Io_Writer $writer The writer object. + * @return void + */ + protected function _writeData($writer) + { + parent::_writeData($writer); + $writer->writeUInt16BE($this->getBoxCount()); + } +} diff --git a/src/Zend/Media/Iso14496/Box/Ilst.php b/src/Zend/Media/Iso14496/Box/Ilst.php index bc1e279..69714ea 100644 --- a/src/Zend/Media/Iso14496/Box/Ilst.php +++ b/src/Zend/Media/Iso14496/Box/Ilst.php @@ -1,326 +1,326 @@ - - *
  • _nam -- Name of the track
  • - *
  • _ART -- Name of the artist
  • - *
  • aART -- Name of the album artist
  • - *
  • _alb -- Name of the album
  • - *
  • _grp -- Grouping
  • - *
  • _day -- Year of publication
  • - *
  • trkn -- Track number (number/total)
  • - *
  • disk -- Disk number (number/total)
  • - *
  • tmpo -- BPM tempo
  • - *
  • _wrt -- Name of the composer
  • - *
  • _cmt -- Comments
  • - *
  • _gen -- Genre as string
  • - *
  • gnre -- Genre as an ID3v1 code, added by one
  • - *
  • cpil -- Part of a compilation (0/1)
  • - *
  • tvsh -- Name of the (television) show
  • - *
  • sonm -- Sort name of the track
  • - *
  • soar -- Sort name of the artist
  • - *
  • soaa -- Sort name of the album artist
  • - *
  • soal -- Sort name of the album
  • - *
  • soco -- Sort name of the composer
  • - *
  • sosn -- Sort name of the show
  • - *
  • _lyr -- Lyrics
  • - *
  • covr -- Cover (or other) artwork binary data
  • - *
  • _too -- Information about the software
  • - * - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - * @since iTunes/iPod specific - */ -final class Zend_Media_Iso14496_Box_Ilst extends Zend_Media_Iso14496_Box -{ - /** - * Constructs the class with given parameters and reads box related data - * from the ISO Base Media file. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - public function __construct($reader = null, &$options = array()) - { - parent::__construct($reader, $options); - $this->setContainer(true); - - if ($reader === null) { - return; - } - - $this->constructBoxes('Zend_Media_Iso14496_Box_Ilst_Container'); - } - - /** - * Override magic function so that $obj->value on a box will return the data - * box instead of the data container box. - * - * @param string $name The box or field name. - * @return mixed - */ - public function __get($name) - { - if (strlen($name) == 3) { - $name = "\xa9" . $name; - } - if ($name[0] == '_') { - $name = "\xa9" . substr($name, 1, 3); - } - if ($this->hasBox($name)) { - $boxes = $this->getBoxesByIdentifier($name); - return $boxes[0]->data; - } - if (method_exists($this, 'get' . ucfirst($name))) { - return call_user_func(array($this, 'get' . ucfirst($name))); - } - return $this->addBox - (new Zend_Media_Iso14496_Box_Ilst_Container($name))->data; - } -} - -/** - * Generic iTunes/iPod DATA Box container. - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - * @since iTunes/iPod specific - * @ignore - */ -final class Zend_Media_Iso14496_Box_Ilst_Container - extends Zend_Media_Iso14496_Box -{ - /** - * Constructs the class with given parameters and reads box related data - * from the ISO Base Media file. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - public function __construct($reader = null, &$options = array()) - { - parent::__construct(is_string($reader) ? null : $reader, $options); - $this->setContainer(true); - - if (is_string($reader)) { - $this->setType($reader); - $this->addBox(new Zend_Media_Iso14496_Box_Data()); - } else { - $this->constructBoxes(); - } - } -} - -/**#@+ @ignore */ -require_once 'Zend/Media/Iso14496/FullBox.php'; -/**#@-*/ - -/** - * A box that contains data for iTunes/iPod specific boxes. - * - * @category Zend - * @package Zend_Media - * @subpackage ISO 14496 - * @author Sven Vollbehr - * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) - * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id$ - * @since iTunes/iPod specific - */ -final class Zend_Media_Iso14496_Box_Data extends Zend_Media_Iso14496_FullBox -{ - /** @var mixed */ - private $_value; - - /** A flag to indicate that the data is an unsigned 8-bit integer. */ - const INTEGER = 0x0; - - /** - * A flag to indicate that the data is an unsigned 8-bit integer. Different - * value used in old versions of iTunes. - */ - const INTEGER_OLD_STYLE = 0x15; - - /** A flag to indicate that the data is a string. */ - const STRING = 0x1; - - /** A flag to indicate that the data is the contents of an JPEG image. */ - const JPEG = 0xd; - - /** A flag to indicate that the data is the contents of a PNG image. */ - const PNG = 0xe; - - /** - * Constructs the class with given parameters and reads box related data - * from the ISO Base Media file. - * - * @param Zend_Io_Reader $reader The reader object. - * @param Array $options The options array. - */ - public function __construct($reader = null, &$options = array()) - { - parent::__construct($reader, $options); - - if ($reader === null) { - return; - } - - $this->_reader->skip(4); - $data = $this->_reader->read - ($this->getOffset() + $this->getSize() - - $this->_reader->getOffset()); - switch ($this->getFlags()) { - case self::INTEGER: - // break intentionally omitted - case self::INTEGER_OLD_STYLE: - for ($i = 0; $i < strlen($data); $i++) { - $this->_value .= ord($data[$i]); - } - break; - case self::STRING: - // break intentionally omitted - default: - $this->_value = $data; - break; - } - } - - /** - * Returns the value this box contains. - * - * @return mixed - */ - public function getValue() - { - return $this->_value; - } - - /** - * Sets the value this box contains. - * - * @return mixed - */ - public function setValue($value, $type = null) - { - $this->_value = (string)$value; - if ($type === null && is_string($value)) { - $this->_flags = self::STRING; - } - if ($type === null && is_int($value)) { - $this->_flags = self::INTEGER; - } - if ($type !== null) { - $this->_flags = $type; - } - } - - /** - * Override magic function so that $obj->data will return the current box - * instead of an error. For other values the method will attempt to call a - * getter method. - * - * If there are no getter methods with given name, the method will yield an - * exception. - * - * @param string $name The box or field name. - * @return mixed - */ - public function __get($name) - { - if ($name == 'data') { - return $this; - } - if (method_exists($this, 'get' . ucfirst($name))) { - return call_user_func(array($this, 'get' . ucfirst($name))); - } - require_once 'Zend/Media/Iso14496/Exception.php'; - throw new Zend_Media_Iso14496_Exception('Unknown box/field: ' . $name); - } - - /** - * Returns the box heap size in bytes. - * - * @return integer - */ - public function getHeapSize() - { - return parent::getHeapSize() + 4 + strlen($this->_value); - } - - /** - * Writes the box data. - * - * @param Zend_Io_Writer $writer The writer object. - * @return void - */ - protected function _writeData($writer) - { - parent::_writeData($writer); - $writer->write("\0\0\0\0"); - switch ($this->getFlags()) { - case self::INTEGER: - // break intentionally omitted - case self::INTEGER_OLD_STYLE: - for ($i = 0; $i < strlen($this->_value); $i++) { - $writer->writeInt8($this->_value[$i]); - } - break; - case self::STRING: - // break intentionally omitted - default: - $writer->write($this->_value); - break; - } - } -} + + *
  • _nam -- Name of the track
  • + *
  • _ART -- Name of the artist
  • + *
  • aART -- Name of the album artist
  • + *
  • _alb -- Name of the album
  • + *
  • _grp -- Grouping
  • + *
  • _day -- Year of publication
  • + *
  • trkn -- Track number (number/total)
  • + *
  • disk -- Disk number (number/total)
  • + *
  • tmpo -- BPM tempo
  • + *
  • _wrt -- Name of the composer
  • + *
  • _cmt -- Comments
  • + *
  • _gen -- Genre as string
  • + *
  • gnre -- Genre as an ID3v1 code, added by one
  • + *
  • cpil -- Part of a compilation (0/1)
  • + *
  • tvsh -- Name of the (television) show
  • + *
  • sonm -- Sort name of the track
  • + *
  • soar -- Sort name of the artist
  • + *
  • soaa -- Sort name of the album artist
  • + *
  • soal -- Sort name of the album
  • + *
  • soco -- Sort name of the composer
  • + *
  • sosn -- Sort name of the show
  • + *
  • _lyr -- Lyrics
  • + *
  • covr -- Cover (or other) artwork binary data
  • + *
  • _too -- Information about the software
  • + * + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + * @since iTunes/iPod specific + */ +final class Zend_Media_Iso14496_Box_Ilst extends Zend_Media_Iso14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data + * from the ISO Base Media file. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) { + return; + } + + $this->constructBoxes('Zend_Media_Iso14496_Box_Ilst_Container'); + } + + /** + * Override magic function so that $obj->value on a box will return the data + * box instead of the data container box. + * + * @param string $name The box or field name. + * @return mixed + */ + public function __get($name) + { + if (strlen($name) == 3) { + $name = "\xa9" . $name; + } + if ($name[0] == '_') { + $name = "\xa9" . substr($name, 1, 3); + } + if ($this->hasBox($name)) { + $boxes = $this->getBoxesByIdentifier($name); + return $boxes[0]->data; + } + if (method_exists($this, 'get' . ucfirst($name))) { + return call_user_func(array($this, 'get' . ucfirst($name))); + } + return $this->addBox + (new Zend_Media_Iso14496_Box_Ilst_Container($name))->data; + } +} + +/** + * Generic iTunes/iPod DATA Box container. + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + * @since iTunes/iPod specific + * @ignore + */ +final class Zend_Media_Iso14496_Box_Ilst_Container + extends Zend_Media_Iso14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data + * from the ISO Base Media file. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct(is_string($reader) ? null : $reader, $options); + $this->setContainer(true); + + if (is_string($reader)) { + $this->setType($reader); + $this->addBox(new Zend_Media_Iso14496_Box_Data()); + } else { + $this->constructBoxes(); + } + } +} + +/**#@+ @ignore */ +require_once 'Zend/Media/Iso14496/FullBox.php'; +/**#@-*/ + +/** + * A box that contains data for iTunes/iPod specific boxes. + * + * @category Zend + * @package Zend_Media + * @subpackage ISO 14496 + * @author Sven Vollbehr + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id$ + * @since iTunes/iPod specific + */ +final class Zend_Media_Iso14496_Box_Data extends Zend_Media_Iso14496_FullBox +{ + /** @var mixed */ + private $_value; + + /** A flag to indicate that the data is an unsigned 8-bit integer. */ + const INTEGER = 0x0; + + /** + * A flag to indicate that the data is an unsigned 8-bit integer. Different + * value used in old versions of iTunes. + */ + const INTEGER_OLD_STYLE = 0x15; + + /** A flag to indicate that the data is a string. */ + const STRING = 0x1; + + /** A flag to indicate that the data is the contents of an JPEG image. */ + const JPEG = 0xd; + + /** A flag to indicate that the data is the contents of a PNG image. */ + const PNG = 0xe; + + /** + * Constructs the class with given parameters and reads box related data + * from the ISO Base Media file. + * + * @param Zend_Io_Reader $reader The reader object. + * @param Array $options The options array. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) { + return; + } + + $this->_reader->skip(4); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - + $this->_reader->getOffset()); + switch ($this->getFlags()) { + case self::INTEGER: + // break intentionally omitted + case self::INTEGER_OLD_STYLE: + for ($i = 0; $i < strlen($data); $i++) { + $this->_value .= ord($data[$i]); + } + break; + case self::STRING: + // break intentionally omitted + default: + $this->_value = $data; + break; + } + } + + /** + * Returns the value this box contains. + * + * @return mixed + */ + public function getValue() + { + return $this->_value; + } + + /** + * Sets the value this box contains. + * + * @return mixed + */ + public function setValue($value, $type = null) + { + $this->_value = (string)$value; + if ($type === null && is_string($value)) { + $this->_flags = self::STRING; + } + if ($type === null && is_int($value)) { + $this->_flags = self::INTEGER; + } + if ($type !== null) { + $this->_flags = $type; + } + } + + /** + * Override magic function so that $obj->data will return the current box + * instead of an error. For other values the method will attempt to call a + * getter method. + * + * If there are no getter methods with given name, the method will yield an + * exception. + * + * @param string $name The box or field name. + * @return mixed + */ + public function __get($name) + { + if ($name == 'data') { + return $this; + } + if (method_exists($this, 'get' . ucfirst($name))) { + return call_user_func(array($this, 'get' . ucfirst($name))); + } + require_once 'Zend/Media/Iso14496/Exception.php'; + throw new Zend_Media_Iso14496_Exception('Unknown box/field: ' . $name); + } + + /** + * Returns the box heap size in bytes. + * + * @return integer + */ + public function getHeapSize() + { + return parent::getHeapSize() + 4 + strlen($this->_value); + } + + /** + * Writes the box data. + * + * @param Zend_Io_Writer $writer The writer object. + * @return void + */ + protected function _writeData($writer) + { + parent::_writeData($writer); + $writer->write("\0\0\0\0"); + switch ($this->getFlags()) { + case self::INTEGER: + // break intentionally omitted + case self::INTEGER_OLD_STYLE: + for ($i = 0; $i < strlen($this->_value); $i++) { + $writer->writeInt8($this->_value[$i]); + } + break; + case self::STRING: + // break intentionally omitted + default: + $writer->write($this->_value); + break; + } + } +}