Fix file properties

git-svn-id: http://php-reader.googlecode.com/svn/branches/zend@166 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
svollbehr
2010-03-04 11:14:59 +00:00
parent 9fca42586e
commit 59e4026b0a
11 changed files with 1605 additions and 1605 deletions

View File

@@ -1,118 +1,118 @@
<?php <?php
/** /**
* Zend Framework * Zend Framework
* *
* LICENSE * LICENSE
* *
* This source file is subject to the new BSD license that is bundled * This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. * with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd * http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately. * to license@zend.com so we can send you a copy immediately.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* 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.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/FullBox.php'; require_once 'Zend/Media/Iso14496/FullBox.php';
/**#@-*/ /**#@-*/
/** /**
* When the primary data is in XML format and it is desired that the XML be * When the primary data is in XML format and it is desired that the XML be
* stored directly in the meta-box, one of the <i>XML Box</i> forms may be used. * stored directly in the meta-box, one of the <i>XML Box</i> forms may be used.
* The Binary XML Box may only be used when there is a single well-defined * 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. * 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 * 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. * byte-order-mark (BOM), which indicates that the data is in UTF-16 format.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
final class Zend_Media_Iso14496_Box_Bxml extends Zend_Media_Iso14496_FullBox final class Zend_Media_Iso14496_Box_Bxml extends Zend_Media_Iso14496_FullBox
{ {
/** @var string */ /** @var string */
private $_xml; private $_xml;
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader, &$options = array()) public function __construct($reader, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
$this->_xml = $this->_reader->read $this->_xml = $this->_reader->read
($this->getOffset() + $this->getSize() - ($this->getOffset() + $this->getSize() -
$this->_reader->getOffset()); $this->_reader->getOffset());
} }
/** /**
* Returns the XML data. * Returns the XML data.
* *
* @return string * @return string
*/ */
public function getXml() public function getXml()
{ {
return $this->_xml; return $this->_xml;
} }
/** /**
* Sets the binary data. * Sets the binary data.
* *
* @param string $xml The XML data. * @param string $xml The XML data.
*/ */
public function setXml($xml) public function setXml($xml)
{ {
$this->_xml = $xml; $this->_xml = $xml;
} }
/** /**
* Returns the box heap size in bytes. * Returns the box heap size in bytes.
* *
* @return integer * @return integer
*/ */
public function getHeapSize() public function getHeapSize()
{ {
return parent::getHeapSize() + strlen($this->_xml); return parent::getHeapSize() + strlen($this->_xml);
} }
/** /**
* Writes the box data. * Writes the box data.
* *
* @param Zend_Io_Writer $writer The writer object. * @param Zend_Io_Writer $writer The writer object.
* @return void * @return void
*/ */
protected function _writeData($writer) protected function _writeData($writer)
{ {
parent::_writeData($writer); parent::_writeData($writer);
$writer->write($this->_xml); $writer->write($this->_xml);
} }
} }

View File

@@ -1,133 +1,133 @@
<?php <?php
/** /**
* Zend Framework * Zend Framework
* *
* LICENSE * LICENSE
* *
* This source file is subject to the new BSD license that is bundled * This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. * with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd * http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately. * to license@zend.com so we can send you a copy immediately.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* 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.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/FullBox.php'; require_once 'Zend/Media/Iso14496/FullBox.php';
/**#@-*/ /**#@-*/
/** /**
* The <i>Chunk Offset Box</i> table gives the index of each chunk into the * The <i>Chunk Offset Box</i> table gives the index of each chunk into the
* containing file. There are two variants, permitting the use of 32-bit or * 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. * 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 * At most one of these variants will occur in any single instance of a sample
* table. * table.
* *
* Offsets are file offsets, not the offset into any box within the file (e.g. * 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 * {@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 * 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 * 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 * ({@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 * the {@link Zend_Media_Iso14496_Box_Moov Movie Box} will affect the chunk
* offsets to the media data. * offsets to the media data.
* *
* This box variant contains 64-bit offsets. * This box variant contains 64-bit offsets.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
final class Zend_Media_Iso14496_Box_Co64 extends Zend_Media_Iso14496_FullBox final class Zend_Media_Iso14496_Box_Co64 extends Zend_Media_Iso14496_FullBox
{ {
/** @var Array */ /** @var Array */
private $_chunkOffsetTable = array(); private $_chunkOffsetTable = array();
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader, &$options = array()) public function __construct($reader, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
$entryCount = $this->_reader->readUInt32BE(); $entryCount = $this->_reader->readUInt32BE();
for ($i = 1; $i <= $entryCount; $i++) { for ($i = 1; $i <= $entryCount; $i++) {
$this->_chunkOffsetTable[$i] = $this->_reader->readInt64BE(); $this->_chunkOffsetTable[$i] = $this->_reader->readInt64BE();
} }
} }
/** /**
* Returns an array of values. Each entry has the entry number as its index * 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 * and a 64 bit integer that gives the offset of the start of a chunk into
* its containing media file as its value. * its containing media file as its value.
* *
* @return Array * @return Array
*/ */
public function getChunkOffsetTable() public function getChunkOffsetTable()
{ {
return $this->_chunkOffsetTable; return $this->_chunkOffsetTable;
} }
/** /**
* Sets an array of chunk offsets. Each entry must have the entry number as * 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 * 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. * chunk into its containing media file as its value.
* *
* @param Array $chunkOffsetTable The chunk offset array. * @param Array $chunkOffsetTable The chunk offset array.
*/ */
public function setChunkOffsetTable($chunkOffsetTable) public function setChunkOffsetTable($chunkOffsetTable)
{ {
$this->_chunkOffsetTable = $chunkOffsetTable; $this->_chunkOffsetTable = $chunkOffsetTable;
} }
/** /**
* Returns the box heap size in bytes. * Returns the box heap size in bytes.
* *
* @return integer * @return integer
*/ */
public function getHeapSize() public function getHeapSize()
{ {
return parent::getHeapSize() + 4 + count($this->_chunkOffsetTable) * 8; return parent::getHeapSize() + 4 + count($this->_chunkOffsetTable) * 8;
} }
/** /**
* Writes the box data. * Writes the box data.
* *
* @param Zend_Io_Writer $writer The writer object. * @param Zend_Io_Writer $writer The writer object.
* @return void * @return void
*/ */
protected function _writeData($writer) protected function _writeData($writer)
{ {
$writer->writeUInt32BE($entryCount = count($this->_chunkOffsetTable)); $writer->writeUInt32BE($entryCount = count($this->_chunkOffsetTable));
for ($i = 1; $i <= $entryCount; $i++) { for ($i = 1; $i <= $entryCount; $i++) {
$writer->writeInt64BE($this->_chunkOffsetTable[$i]); $writer->writeInt64BE($this->_chunkOffsetTable[$i]);
} }
} }
} }

View File

@@ -1,150 +1,150 @@
<?php <?php
/** /**
* Zend Framework * Zend Framework
* *
* LICENSE * LICENSE
* *
* This source file is subject to the new BSD license that is bundled * This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. * with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd * http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately. * to license@zend.com so we can send you a copy immediately.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* 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.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/FullBox.php'; require_once 'Zend/Media/Iso14496/FullBox.php';
/**#@-*/ /**#@-*/
/** /**
* The <i>Copyright Box</i> contains a copyright declaration which applies to * The <i>Copyright Box</i> contains a copyright declaration which applies to
* the entire presentation, when contained within the * the entire presentation, when contained within the
* {@link Zend_Media_Iso14496_Box_Moov Movie Box}, or, when contained in a * {@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 * track, to that entire track. There may be multiple copyright boxes using
* different language codes. * different language codes.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
final class Zend_Media_Iso14496_Box_Cprt extends Zend_Media_Iso14496_FullBox final class Zend_Media_Iso14496_Box_Cprt extends Zend_Media_Iso14496_FullBox
{ {
/** @var string */ /** @var string */
private $_language; private $_language;
/** @var string */ /** @var string */
private $_notice; private $_notice;
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
* @todo Distinguish UTF-16? * @todo Distinguish UTF-16?
*/ */
public function __construct($reader, &$options = array()) public function __construct($reader, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
$this->_language = chr $this->_language = chr
(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) . (((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) .
chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60);
$this->_notice = $this->_reader->readString8 $this->_notice = $this->_reader->readString8
($this->getOffset() + $this->getSize() - ($this->getOffset() + $this->getSize() -
$this->_reader->getOffset()); $this->_reader->getOffset());
} }
/** /**
* Returns the three byte language code to describe the language of the * Returns the three byte language code to describe the language of the
* notice, according to {@link http://www.loc.gov/standards/iso639-2/ * notice, according to {@link http://www.loc.gov/standards/iso639-2/
* ISO 639-2/T}. * ISO 639-2/T}.
* *
* @return string * @return string
*/ */
public function getLanguage() public function getLanguage()
{ {
return $this->_language; return $this->_language;
} }
/** /**
* Sets the three byte language code to describe the language of this * Sets the three byte language code to describe the language of this
* media, according to {@link http://www.loc.gov/standards/iso639-2/ * media, according to {@link http://www.loc.gov/standards/iso639-2/
* ISO 639-2/T}. * ISO 639-2/T}.
* *
* @param string $language The language code. * @param string $language The language code.
*/ */
public function setLanguage($language) public function setLanguage($language)
{ {
$this->_language = $language; $this->_language = $language;
} }
/** /**
* Returns the copyright notice. * Returns the copyright notice.
* *
* @return string * @return string
*/ */
public function getNotice() public function getNotice()
{ {
return $this->_notice; return $this->_notice;
} }
/** /**
* Returns the copyright notice. * Returns the copyright notice.
* *
* @param string $notice The copyright notice. * @param string $notice The copyright notice.
*/ */
public function setNotice($notice) public function setNotice($notice)
{ {
$this->_notice = $notice; $this->_notice = $notice;
} }
/** /**
* Returns the box heap size in bytes. * Returns the box heap size in bytes.
* *
* @return integer * @return integer
*/ */
public function getHeapSize() public function getHeapSize()
{ {
return parent::getHeapSize() + 3 + strlen($this->_notice); return parent::getHeapSize() + 3 + strlen($this->_notice);
} }
/** /**
* Writes the box data. * Writes the box data.
* *
* @param Zend_Io_Writer $writer The writer object. * @param Zend_Io_Writer $writer The writer object.
* @return void * @return void
*/ */
protected function _writeData($writer) protected function _writeData($writer)
{ {
parent::_writeData($writer); parent::_writeData($writer);
$writer->writeUInt16BE((ord($this->_language[0]) - 0x60) << 10 | $writer->writeUInt16BE((ord($this->_language[0]) - 0x60) << 10 |
(ord($this->_language[1])- 0x60) << 5 | (ord($this->_language[1])- 0x60) << 5 |
(ord($this->_language[2])- 0x60)) (ord($this->_language[2])- 0x60))
->writeString8($this->_notice, 1); ->writeString8($this->_notice, 1);
} }
} }

View File

@@ -1,139 +1,139 @@
<?php <?php
/** /**
* Zend Framework * Zend Framework
* *
* LICENSE * LICENSE
* *
* This source file is subject to the new BSD license that is bundled * This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. * with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd * http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately. * to license@zend.com so we can send you a copy immediately.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* 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.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/FullBox.php'; require_once 'Zend/Media/Iso14496/FullBox.php';
/**#@-*/ /**#@-*/
/** /**
* The <i>Composition Time to Sample Box</i> provides the offset between * The <i>Composition Time to Sample Box</i> provides the offset between
* decoding time and composition time. Since decoding time must be less than the * decoding time and composition time. Since decoding time must be less than the
* composition time, the offsets are expressed as unsigned numbers such that * 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 * CT(n) = DT(n) + CTTS(n) where CTTS(n) is the (uncompressed) table entry for
* sample n. * sample n.
* *
* The composition time to sample table is optional and must only be present if * 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. * DT and CT differ for any samples. Hint tracks do not use this box.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
final class Zend_Media_Iso14496_Box_Ctts extends Zend_Media_Iso14496_FullBox final class Zend_Media_Iso14496_Box_Ctts extends Zend_Media_Iso14496_FullBox
{ {
/** @var Array */ /** @var Array */
private $_compositionOffsetTable = array(); private $_compositionOffsetTable = array();
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader, &$options = array()) public function __construct($reader, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
$entryCount = $this->_reader->readUInt32BE(); $entryCount = $this->_reader->readUInt32BE();
for ($i = 1; $i <= $entryCount; $i++) { for ($i = 1; $i <= $entryCount; $i++) {
$this->_compositionOffsetTable[$i] = array $this->_compositionOffsetTable[$i] = array
('sampleCount' => $this->_reader->readUInt32BE(), ('sampleCount' => $this->_reader->readUInt32BE(),
'sampleOffset' => $this->_reader->readUInt32BE()); 'sampleOffset' => $this->_reader->readUInt32BE());
} }
} }
/** /**
* Returns an array of values. Each entry is an array containing the * Returns an array of values. Each entry is an array containing the
* following keys. * following keys.
* o sampleCount -- an integer that counts the number of consecutive * o sampleCount -- an integer that counts the number of consecutive
* samples that have the given offset. * samples that have the given offset.
* o sampleOffset -- a non-negative integer that gives the offset between * o sampleOffset -- a non-negative integer that gives the offset between
* CT and DT, such that CT(n) = DT(n) + CTTS(n). * CT and DT, such that CT(n) = DT(n) + CTTS(n).
* *
* @return Array * @return Array
*/ */
public function getCompositionOffsetTable() public function getCompositionOffsetTable()
{ {
return $this->_compositionOffsetTable; return $this->_compositionOffsetTable;
} }
/** /**
* Sets an array of values. Each entry must have an array containing the * Sets an array of values. Each entry must have an array containing the
* following keys. * following keys.
* o sampleCount -- an integer that counts the number of consecutive * o sampleCount -- an integer that counts the number of consecutive
* samples that have the given offset. * samples that have the given offset.
* o sampleOffset -- a non-negative integer that gives the offset between * o sampleOffset -- a non-negative integer that gives the offset between
* CT and DT, such that CT(n) = DT(n) + CTTS(n). * CT and DT, such that CT(n) = DT(n) + CTTS(n).
* *
* @param Array $compositionOffsetTable The array of values. * @param Array $compositionOffsetTable The array of values.
*/ */
public function setCompositionOffsetTable($compositionOffsetTable) public function setCompositionOffsetTable($compositionOffsetTable)
{ {
$this->_compositionOffsetTable = $compositionOffsetTable; $this->_compositionOffsetTable = $compositionOffsetTable;
} }
/** /**
* Returns the box heap size in bytes. * Returns the box heap size in bytes.
* *
* @return integer * @return integer
*/ */
public function getHeapSize() public function getHeapSize()
{ {
return parent::getHeapSize() + 4 + return parent::getHeapSize() + 4 +
count($this->_compositionOffsetTable) * 8; count($this->_compositionOffsetTable) * 8;
} }
/** /**
* Writes the box data. * Writes the box data.
* *
* @param Zend_Io_Writer $writer The writer object. * @param Zend_Io_Writer $writer The writer object.
* @return void * @return void
*/ */
protected function _writeData($writer) protected function _writeData($writer)
{ {
parent::_writeData($writer); parent::_writeData($writer);
$writer->writeUInt32BE($entryCount = count($this->_compositionOffsetTable)); $writer->writeUInt32BE($entryCount = count($this->_compositionOffsetTable));
for ($i = 1; $i <= $entryCount; $i++) { for ($i = 1; $i <= $entryCount; $i++) {
$writer->writeUInt32BE $writer->writeUInt32BE
($this->_compositionOffsetTable[$i]['sampleCount']) ($this->_compositionOffsetTable[$i]['sampleCount'])
->writeUInt32BE ->writeUInt32BE
($this->_compositionOffsetTable[$i]['sampleOffset']); ($this->_compositionOffsetTable[$i]['sampleOffset']);
} }
} }
} }

View File

@@ -1,100 +1,100 @@
<?php <?php
/** /**
* Zend Framework * Zend Framework
* *
* LICENSE * LICENSE
* *
* This source file is subject to the new BSD license that is bundled * This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. * with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd * http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately. * to license@zend.com so we can send you a copy immediately.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* 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.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/FullBox.php'; require_once 'Zend/Media/Iso14496/FullBox.php';
/**#@-*/ /**#@-*/
/** /**
* The <i>Data Reference Box</i> contains a table of data references (normally * The <i>Data Reference Box</i> contains a table of data references (normally
* URLs) that declare the location(s) of the media data used within the * URLs) that declare the location(s) of the media data used within the
* presentation. The data reference index in the sample description ties entries * 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 * in this table to the samples in the track. A track may be split over several
* sources in this way. * sources in this way.
* *
* This box may either contain {@link Zend_Media_Iso14496_Box_Urn urn} or * This box may either contain {@link Zend_Media_Iso14496_Box_Urn urn} or
* {@link Zend_Media_Iso14496_Box_Url url} boxes. * {@link Zend_Media_Iso14496_Box_Url url} boxes.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
final class Zend_Media_Iso14496_Box_Dref extends Zend_Media_Iso14496_FullBox final class Zend_Media_Iso14496_Box_Dref extends Zend_Media_Iso14496_FullBox
{ {
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader = null, &$options = array()) public function __construct($reader = null, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
$this->setContainer(true); $this->setContainer(true);
if ($reader === null) { if ($reader === null) {
return; return;
} }
$this->_reader->skip(4); $this->_reader->skip(4);
$this->constructBoxes(); $this->constructBoxes();
} }
/** /**
* Returns the box heap size in bytes. * Returns the box heap size in bytes.
* *
* @return integer * @return integer
*/ */
public function getHeapSize() public function getHeapSize()
{ {
return parent::getHeapSize() + 4; return parent::getHeapSize() + 4;
} }
/** /**
* Writes the box data. * Writes the box data.
* *
* @param Zend_Io_Writer $writer The writer object. * @param Zend_Io_Writer $writer The writer object.
* @return void * @return void
*/ */
protected function _writeData($writer) protected function _writeData($writer)
{ {
parent::_writeData($writer); parent::_writeData($writer);
$writer->writeUInt32BE($this->getBoxCount()); $writer->writeUInt32BE($this->getBoxCount());
} }
} }

View File

@@ -1,89 +1,89 @@
<?php <?php
/** /**
* Zend Framework * Zend Framework
* *
* LICENSE * LICENSE
* *
* This source file is subject to the new BSD license that is bundled * This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. * with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd * http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately. * to license@zend.com so we can send you a copy immediately.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* 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.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/Box.php'; require_once 'Zend/Media/Iso14496/Box.php';
/**#@-*/ /**#@-*/
/** /**
* The contents of a <i>Free Space Box</i> are irrelevant and may be ignored, or * The contents of a <i>Free Space Box</i> are irrelevant and may be ignored, or
* the object deleted, without affecting the presentation. (Care should be * the object deleted, without affecting the presentation. (Care should be
* exercised when deleting the object, as this may invalidate the offsets used * 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). * in the sample table, unless this object is after all the media data).
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
final class Zend_Media_Iso14496_Box_Free extends Zend_Media_Iso14496_Box final class Zend_Media_Iso14496_Box_Free extends Zend_Media_Iso14496_Box
{ {
/** /**
* Constructs the class with given parameters. * Constructs the class with given parameters.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader = null, &$options = array()) public function __construct($reader = null, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
} }
/** /**
* Returns the box heap size in bytes. * Returns the box heap size in bytes.
* *
* @return integer * @return integer
*/ */
public function getHeapSize() public function getHeapSize()
{ {
return ($this->getSize() >= 8 ? $this->getSize() : 0); return ($this->getSize() >= 8 ? $this->getSize() : 0);
} }
/** /**
* Writes the box data. * Writes the box data.
* *
* @param Zend_Io_Writer $writer The writer object. * @param Zend_Io_Writer $writer The writer object.
* @return void * @return void
*/ */
protected function _writeData($writer) protected function _writeData($writer)
{ {
if ($this->getSize() >= 8) { if ($this->getSize() >= 8) {
parent::_writeData($writer); parent::_writeData($writer);
$writer->write(str_repeat("\0", $this->getSize() - 8)); $writer->write(str_repeat("\0", $this->getSize() - 8));
} }
} }
} }

View File

@@ -1,116 +1,116 @@
<?php <?php
/** /**
* Zend Framework * Zend Framework
* *
* LICENSE * LICENSE
* *
* This source file is subject to the new BSD license that is bundled * This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. * with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd * http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately. * to license@zend.com so we can send you a copy immediately.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* 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.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/Box.php'; require_once 'Zend/Media/Iso14496/Box.php';
/**#@-*/ /**#@-*/
/** /**
* The <i>Original Format Box</i> contains the four-character-code of the * The <i>Original Format Box</i> contains the four-character-code of the
* original un-transformed sample description. * original un-transformed sample description.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
final class Zend_Media_Iso14496_Box_Frma extends Zend_Media_Iso14496_Box final class Zend_Media_Iso14496_Box_Frma extends Zend_Media_Iso14496_Box
{ {
/** @var string */ /** @var string */
private $_dataFormat; private $_dataFormat;
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader, &$options = array()) public function __construct($reader, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
$this->_dataFormat = $this->_reader->read(4); $this->_dataFormat = $this->_reader->read(4);
} }
/** /**
* Returns the four-character-code of the original un-transformed sample * Returns the four-character-code of the original un-transformed sample
* entry (e.g. <i>mp4v</i> if the stream contains protected MPEG-4 visual * entry (e.g. <i>mp4v</i> if the stream contains protected MPEG-4 visual
* material). * material).
* *
* @return string * @return string
*/ */
public function getDataFormat() public function getDataFormat()
{ {
return $this->_dataFormat; return $this->_dataFormat;
} }
/** /**
* Sets the four-character-code of the original un-transformed sample * Sets the four-character-code of the original un-transformed sample
* entry (e.g. <i>mp4v</i> if the stream contains protected MPEG-4 visual * entry (e.g. <i>mp4v</i> if the stream contains protected MPEG-4 visual
* material). * material).
* *
* @param string $dataFormat The data format. * @param string $dataFormat The data format.
*/ */
public function setDataFormat($dataFormat) public function setDataFormat($dataFormat)
{ {
$this->_dataFormat = $dataFormat; $this->_dataFormat = $dataFormat;
} }
/** /**
* Returns the box heap size in bytes. * Returns the box heap size in bytes.
* *
* @return integer * @return integer
*/ */
public function getHeapSize() public function getHeapSize()
{ {
return parent::getHeapSize() + 4; return parent::getHeapSize() + 4;
} }
/** /**
* Writes the box data. * Writes the box data.
* *
* @param Zend_Io_Writer $writer The writer object. * @param Zend_Io_Writer $writer The writer object.
* @return void * @return void
*/ */
protected function _writeData($writer) protected function _writeData($writer)
{ {
parent::_writeData($writer); parent::_writeData($writer);
$writer->write(substr($this->_dataFormat, 0, 4)); $writer->write(substr($this->_dataFormat, 0, 4));
} }
} }

View File

@@ -1,174 +1,174 @@
<?php <?php
/** /**
* Zend Framework * Zend Framework
* *
* LICENSE * LICENSE
* *
* This source file is subject to the new BSD license that is bundled * This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. * with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd * http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately. * to license@zend.com so we can send you a copy immediately.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* 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.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/FullBox.php'; require_once 'Zend/Media/Iso14496/FullBox.php';
/**#@-*/ /**#@-*/
/** /**
* The <i>Handler Reference Box</i> is within a * The <i>Handler Reference Box</i> is within a
* {@link Zend_Media_Iso14496_Box_Mdia Media Box} declares the process by which * {@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 * 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. * 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}, * This box when present within a {@link Zend_Media_Iso14496_Box_Meta Meta Box},
* declares the structure or format of the <i>meta</i> box contents. * declares the structure or format of the <i>meta</i> box contents.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
final class Zend_Media_Iso14496_Box_Hdlr extends Zend_Media_Iso14496_FullBox final class Zend_Media_Iso14496_Box_Hdlr extends Zend_Media_Iso14496_FullBox
{ {
/** @var string */ /** @var string */
private $_handlerType; private $_handlerType;
/** @var string */ /** @var string */
private $_name; private $_name;
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader = null, &$options = array()) public function __construct($reader = null, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
if ($reader === null) { if ($reader === null) {
return; return;
} }
$this->_reader->skip(4); $this->_reader->skip(4);
$this->_handlerType = $this->_reader->read(4); $this->_handlerType = $this->_reader->read(4);
$this->_reader->skip(12); $this->_reader->skip(12);
$this->_name = $this->_reader->readString8 $this->_name = $this->_reader->readString8
($this->getOffset() + $this->getSize() - ($this->getOffset() + $this->getSize() -
$this->_reader->getOffset()); $this->_reader->getOffset());
} }
/** /**
* Returns the handler type. * Returns the handler type.
* *
* When present in a media box, the returned value contains one of the * When present in a media box, the returned value contains one of the
* following values, or a value from a derived specification: * following values, or a value from a derived specification:
* o <i>vide</i> Video track * o <i>vide</i> Video track
* o <i>soun</i> Audio track * o <i>soun</i> Audio track
* o <i>hint</i> Hint track * o <i>hint</i> Hint track
* *
* When present in a meta box, the returned value contains an appropriate * When present in a meta box, the returned value contains an appropriate
* value to indicate the format of the meta box contents. * value to indicate the format of the meta box contents.
* *
* @return integer * @return integer
*/ */
public function getHandlerType() public function getHandlerType()
{ {
return $this->_handlerType; return $this->_handlerType;
} }
/** /**
* Sets the handler type. * Sets the handler type.
* *
* When present in a media box, the value must be set to one of the * When present in a media box, the value must be set to one of the
* following values, or a value from a derived specification: * following values, or a value from a derived specification:
* o <i>vide</i> Video track * o <i>vide</i> Video track
* o <i>soun</i> Audio track * o <i>soun</i> Audio track
* o <i>hint</i> Hint track * o <i>hint</i> Hint track
* *
* When present in a meta box, the value must be set to an appropriate value * When present in a meta box, the value must be set to an appropriate value
* to indicate the format of the meta box contents. * to indicate the format of the meta box contents.
* *
* @param string $handlerType The handler type. * @param string $handlerType The handler type.
*/ */
public function setHandlerType($handlerType) public function setHandlerType($handlerType)
{ {
$this->_handlerType = $handlerType; $this->_handlerType = $handlerType;
} }
/** /**
* Returns the name string. The name is in UTF-8 characters and gives a * 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 * human-readable name for the track type (for debugging and inspection
* purposes). * purposes).
* *
* @return integer * @return integer
*/ */
public function getName() public function getName()
{ {
return $this->_name; return $this->_name;
} }
/** /**
* Sets the name string. The name must be in UTF-8 and give a human-readable * 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). * name for the track type (for debugging and inspection purposes).
* *
* @param string $name The human-readable description. * @param string $name The human-readable description.
*/ */
public function setName($name) public function setName($name)
{ {
$this->_name = $name; $this->_name = $name;
} }
/** /**
* Returns the box heap size in bytes. * Returns the box heap size in bytes.
* *
* @return integer * @return integer
*/ */
public function getHeapSize() public function getHeapSize()
{ {
return parent::getHeapSize() + 21 + strlen($this->_name); return parent::getHeapSize() + 21 + strlen($this->_name);
} }
/** /**
* Writes the box data. * Writes the box data.
* *
* @param Zend_Io_Writer $writer The writer object. * @param Zend_Io_Writer $writer The writer object.
* @return void * @return void
*/ */
protected function _writeData($writer) protected function _writeData($writer)
{ {
parent::_writeData($writer); parent::_writeData($writer);
$writer->write(str_pad('', 4, "\0")) $writer->write(str_pad('', 4, "\0"))
->write($this->_handlerType) ->write($this->_handlerType)
->writeUInt32BE(0) ->writeUInt32BE(0)
->writeUInt32BE(0) ->writeUInt32BE(0)
->writeUInt32BE(0) ->writeUInt32BE(0)
->writeString8($this->_name, 1); ->writeString8($this->_name, 1);
} }
} }

View File

@@ -1,160 +1,160 @@
<?php <?php
/** /**
* Zend Framework * Zend Framework
* *
* LICENSE * LICENSE
* *
* This source file is subject to the new BSD license that is bundled * This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. * with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd * http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately. * to license@zend.com so we can send you a copy immediately.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* 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.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/FullBox.php'; require_once 'Zend/Media/Iso14496/FullBox.php';
/**#@-*/ /**#@-*/
/** /**
* The <i>ID3v2 Box</i> resides under the * The <i>ID3v2 Box</i> resides under the
* {@link Zend_Media_Iso14496_Box_Meta Meta Box} and stores ID3 version 2 * {@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 * meta-data. There may be more than one Id3v2 Box present each with a different
* language code. * language code.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
final class Zend_Media_Iso14496_Box_Id32 extends Zend_Media_Iso14496_FullBox final class Zend_Media_Iso14496_Box_Id32 extends Zend_Media_Iso14496_FullBox
{ {
/** @var string */ /** @var string */
private $_language = 'und'; private $_language = 'und';
/** @var Zend_Media_Id3v2 */ /** @var Zend_Media_Id3v2 */
private $_tag; private $_tag;
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader = null, &$options = array()) public function __construct($reader = null, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
if ($reader === null) { if ($reader === null) {
return; return;
} }
$this->_language = $this->_language =
chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) +
0x60) . 0x60) .
chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60);
$this->_tag = new Zend_Media_Id3v2 $this->_tag = new Zend_Media_Id3v2
($this->_reader, array('readonly' => true)); ($this->_reader, array('readonly' => true));
} }
/** /**
* Returns the three byte language code to describe the language of this * Returns the three byte language code to describe the language of this
* media, according to {@link http://www.loc.gov/standards/iso639-2/ * media, according to {@link http://www.loc.gov/standards/iso639-2/
* ISO 639-2/T}. * ISO 639-2/T}.
* *
* @return string * @return string
*/ */
public function getLanguage() public function getLanguage()
{ {
return $this->_language; return $this->_language;
} }
/** /**
* Sets the three byte language code as specified in the * Sets the three byte language code as specified in the
* {@link http://www.loc.gov/standards/iso639-2/ ISO 639-2} standard. * {@link http://www.loc.gov/standards/iso639-2/ ISO 639-2} standard.
* *
* @param string $language The language code. * @param string $language The language code.
*/ */
public function setLanguage($language) public function setLanguage($language)
{ {
$this->_language = $language; $this->_language = $language;
} }
/** /**
* Returns the {@link Zend_Media_Id3v2 Id3v2} tag class instance. * Returns the {@link Zend_Media_Id3v2 Id3v2} tag class instance.
* *
* @return string * @return string
*/ */
public function getTag() public function getTag()
{ {
return $this->_tag; return $this->_tag;
} }
/** /**
* Sets the {@link Zend_Media_Id3v2 Id3v2} tag class instance using given * Sets the {@link Zend_Media_Id3v2 Id3v2} tag class instance using given
* language. * language.
* *
* @param Zend_Media_Id3v2 $tag The tag instance. * @param Zend_Media_Id3v2 $tag The tag instance.
* @param string $language The language code. * @param string $language The language code.
*/ */
public function setTag($tag, $language = null) public function setTag($tag, $language = null)
{ {
$this->_tag = $tag; $this->_tag = $tag;
if ($language !== null) { if ($language !== null) {
$this->_language = $language; $this->_language = $language;
} }
} }
/** /**
* Returns the box heap size in bytes. * Returns the box heap size in bytes.
* *
* @return integer * @return integer
* @todo There has got to be a better way to do this * @todo There has got to be a better way to do this
*/ */
public function getHeapSize() public function getHeapSize()
{ {
$writer = new Zend_Io_StringWriter(); $writer = new Zend_Io_StringWriter();
$this->_tag->write($writer); $this->_tag->write($writer);
return parent::getHeapSize() + 2 + $writer->getSize(); return parent::getHeapSize() + 2 + $writer->getSize();
} }
/** /**
* Writes the box data. * Writes the box data.
* *
* @param Zend_Io_Writer $writer The writer object. * @param Zend_Io_Writer $writer The writer object.
* @return void * @return void
*/ */
protected function _writeData($writer) protected function _writeData($writer)
{ {
parent::_writeData($writer); parent::_writeData($writer);
$writer->writeUInt16BE $writer->writeUInt16BE
(((ord($this->_language[0]) - 0x60) << 10) | (((ord($this->_language[0]) - 0x60) << 10) |
((ord($this->_language[1]) - 0x60) << 5) | ((ord($this->_language[1]) - 0x60) << 5) |
ord($this->_language[2]) - 0x60); ord($this->_language[2]) - 0x60);
$this->_tag->write($writer); $this->_tag->write($writer);
} }
} }

View File

@@ -1,100 +1,100 @@
<?php <?php
/** /**
* Zend Framework * Zend Framework
* *
* LICENSE * LICENSE
* *
* This source file is subject to the new BSD license that is bundled * This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. * with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd * http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately. * to license@zend.com so we can send you a copy immediately.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* 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.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/Box.php'; require_once 'Zend/Media/Iso14496/Box.php';
/**#@-*/ /**#@-*/
/** /**
* The <i>Item Information Box</i> provides extra information about selected * The <i>Item Information Box</i> provides extra information about selected
* items, including symbolic (<i>file</i>) names. It may optionally occur, but * items, including symbolic (<i>file</i>) names. It may optionally occur, but
* if it does, it must be interpreted, as item protection or content encoding * 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 * 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 * 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 * the item, and then decode the item's content encoding. If more control is
* needed, an IPMP sequence code may be used. * needed, an IPMP sequence code may be used.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
final class Zend_Media_Iso14496_Box_Iinf extends Zend_Media_Iso14496_Box final class Zend_Media_Iso14496_Box_Iinf extends Zend_Media_Iso14496_Box
{ {
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader = null, &$options = array()) public function __construct($reader = null, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
$this->setContainer(true); $this->setContainer(true);
if ($reader === null) { if ($reader === null) {
return; return;
} }
$this->_reader->skip(2); $this->_reader->skip(2);
$this->constructBoxes(); $this->constructBoxes();
} }
/** /**
* Returns the box heap size in bytes. * Returns the box heap size in bytes.
* *
* @return integer * @return integer
*/ */
public function getHeapSize() public function getHeapSize()
{ {
return parent::getHeapSize() + 2; return parent::getHeapSize() + 2;
} }
/** /**
* Writes the box data. * Writes the box data.
* *
* @param Zend_Io_Writer $writer The writer object. * @param Zend_Io_Writer $writer The writer object.
* @return void * @return void
*/ */
protected function _writeData($writer) protected function _writeData($writer)
{ {
parent::_writeData($writer); parent::_writeData($writer);
$writer->writeUInt16BE($this->getBoxCount()); $writer->writeUInt16BE($this->getBoxCount());
} }
} }

View File

@@ -1,326 +1,326 @@
<?php <?php
/** /**
* Zend Framework * Zend Framework
* *
* LICENSE * LICENSE
* *
* This source file is subject to the new BSD license that is bundled * This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt. * with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL: * It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd * http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to * If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email * obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately. * to license@zend.com so we can send you a copy immediately.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* 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.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/Box.php'; require_once 'Zend/Media/Iso14496/Box.php';
/**#@-*/ /**#@-*/
/** /**
* A container box for all the iTunes/iPod specific boxes. A list of well known * A container box for all the iTunes/iPod specific boxes. A list of well known
* boxes is provided in the following table. The value for each box is contained * boxes is provided in the following table. The value for each box is contained
* in a nested {@link Zend_Media_Iso14496_Box_Data Data Box}. * in a nested {@link Zend_Media_Iso14496_Box_Data Data Box}.
* *
* <ul> * <ul>
* <li><b>_nam</b> -- <i>Name of the track</i></li> * <li><b>_nam</b> -- <i>Name of the track</i></li>
* <li><b>_ART</b> -- <i>Name of the artist</i></li> * <li><b>_ART</b> -- <i>Name of the artist</i></li>
* <li><b>aART</b> -- <i>Name of the album artist</i></li> * <li><b>aART</b> -- <i>Name of the album artist</i></li>
* <li><b>_alb</b> -- <i>Name of the album</i></li> * <li><b>_alb</b> -- <i>Name of the album</i></li>
* <li><b>_grp</b> -- <i>Grouping</i></li> * <li><b>_grp</b> -- <i>Grouping</i></li>
* <li><b>_day</b> -- <i>Year of publication</i></li> * <li><b>_day</b> -- <i>Year of publication</i></li>
* <li><b>trkn</b> -- <i>Track number (number/total)</i></li> * <li><b>trkn</b> -- <i>Track number (number/total)</i></li>
* <li><b>disk</b> -- <i>Disk number (number/total)</i></li> * <li><b>disk</b> -- <i>Disk number (number/total)</i></li>
* <li><b>tmpo</b> -- <i>BPM tempo</i></li> * <li><b>tmpo</b> -- <i>BPM tempo</i></li>
* <li><b>_wrt</b> -- <i>Name of the composer</i></li> * <li><b>_wrt</b> -- <i>Name of the composer</i></li>
* <li><b>_cmt</b> -- <i>Comments</i></li> * <li><b>_cmt</b> -- <i>Comments</i></li>
* <li><b>_gen</b> -- <i>Genre as string</i></li> * <li><b>_gen</b> -- <i>Genre as string</i></li>
* <li><b>gnre</b> -- <i>Genre as an ID3v1 code, added by one</i></li> * <li><b>gnre</b> -- <i>Genre as an ID3v1 code, added by one</i></li>
* <li><b>cpil</b> -- <i>Part of a compilation (0/1)</i></li> * <li><b>cpil</b> -- <i>Part of a compilation (0/1)</i></li>
* <li><b>tvsh</b> -- <i>Name of the (television) show</i></li> * <li><b>tvsh</b> -- <i>Name of the (television) show</i></li>
* <li><b>sonm</b> -- <i>Sort name of the track</i></li> * <li><b>sonm</b> -- <i>Sort name of the track</i></li>
* <li><b>soar</b> -- <i>Sort name of the artist</i></li> * <li><b>soar</b> -- <i>Sort name of the artist</i></li>
* <li><b>soaa</b> -- <i>Sort name of the album artist</i></li> * <li><b>soaa</b> -- <i>Sort name of the album artist</i></li>
* <li><b>soal</b> -- <i>Sort name of the album</i></li> * <li><b>soal</b> -- <i>Sort name of the album</i></li>
* <li><b>soco</b> -- <i>Sort name of the composer</i></li> * <li><b>soco</b> -- <i>Sort name of the composer</i></li>
* <li><b>sosn</b> -- <i>Sort name of the show</i></li> * <li><b>sosn</b> -- <i>Sort name of the show</i></li>
* <li><b>_lyr</b> -- <i>Lyrics</i></li> * <li><b>_lyr</b> -- <i>Lyrics</i></li>
* <li><b>covr</b> -- <i>Cover (or other) artwork binary data</i></li> * <li><b>covr</b> -- <i>Cover (or other) artwork binary data</i></li>
* <li><b>_too</b> -- <i>Information about the software</i></li> * <li><b>_too</b> -- <i>Information about the software</i></li>
* </ul> * </ul>
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
* @since iTunes/iPod specific * @since iTunes/iPod specific
*/ */
final class Zend_Media_Iso14496_Box_Ilst extends Zend_Media_Iso14496_Box final class Zend_Media_Iso14496_Box_Ilst extends Zend_Media_Iso14496_Box
{ {
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader = null, &$options = array()) public function __construct($reader = null, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
$this->setContainer(true); $this->setContainer(true);
if ($reader === null) { if ($reader === null) {
return; return;
} }
$this->constructBoxes('Zend_Media_Iso14496_Box_Ilst_Container'); $this->constructBoxes('Zend_Media_Iso14496_Box_Ilst_Container');
} }
/** /**
* Override magic function so that $obj->value on a box will return the data * Override magic function so that $obj->value on a box will return the data
* box instead of the data container box. * box instead of the data container box.
* *
* @param string $name The box or field name. * @param string $name The box or field name.
* @return mixed * @return mixed
*/ */
public function __get($name) public function __get($name)
{ {
if (strlen($name) == 3) { if (strlen($name) == 3) {
$name = "\xa9" . $name; $name = "\xa9" . $name;
} }
if ($name[0] == '_') { if ($name[0] == '_') {
$name = "\xa9" . substr($name, 1, 3); $name = "\xa9" . substr($name, 1, 3);
} }
if ($this->hasBox($name)) { if ($this->hasBox($name)) {
$boxes = $this->getBoxesByIdentifier($name); $boxes = $this->getBoxesByIdentifier($name);
return $boxes[0]->data; return $boxes[0]->data;
} }
if (method_exists($this, 'get' . ucfirst($name))) { if (method_exists($this, 'get' . ucfirst($name))) {
return call_user_func(array($this, 'get' . ucfirst($name))); return call_user_func(array($this, 'get' . ucfirst($name)));
} }
return $this->addBox return $this->addBox
(new Zend_Media_Iso14496_Box_Ilst_Container($name))->data; (new Zend_Media_Iso14496_Box_Ilst_Container($name))->data;
} }
} }
/** /**
* Generic iTunes/iPod DATA Box container. * Generic iTunes/iPod DATA Box container.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
* @since iTunes/iPod specific * @since iTunes/iPod specific
* @ignore * @ignore
*/ */
final class Zend_Media_Iso14496_Box_Ilst_Container final class Zend_Media_Iso14496_Box_Ilst_Container
extends Zend_Media_Iso14496_Box extends Zend_Media_Iso14496_Box
{ {
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader = null, &$options = array()) public function __construct($reader = null, &$options = array())
{ {
parent::__construct(is_string($reader) ? null : $reader, $options); parent::__construct(is_string($reader) ? null : $reader, $options);
$this->setContainer(true); $this->setContainer(true);
if (is_string($reader)) { if (is_string($reader)) {
$this->setType($reader); $this->setType($reader);
$this->addBox(new Zend_Media_Iso14496_Box_Data()); $this->addBox(new Zend_Media_Iso14496_Box_Data());
} else { } else {
$this->constructBoxes(); $this->constructBoxes();
} }
} }
} }
/**#@+ @ignore */ /**#@+ @ignore */
require_once 'Zend/Media/Iso14496/FullBox.php'; require_once 'Zend/Media/Iso14496/FullBox.php';
/**#@-*/ /**#@-*/
/** /**
* A box that contains data for iTunes/iPod specific boxes. * A box that contains data for iTunes/iPod specific boxes.
* *
* @category Zend * @category Zend
* @package Zend_Media * @package Zend_Media
* @subpackage ISO 14496 * @subpackage ISO 14496
* @author Sven Vollbehr <sven@vollbehr.eu> * @author Sven Vollbehr <sven@vollbehr.eu>
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
* @since iTunes/iPod specific * @since iTunes/iPod specific
*/ */
final class Zend_Media_Iso14496_Box_Data extends Zend_Media_Iso14496_FullBox final class Zend_Media_Iso14496_Box_Data extends Zend_Media_Iso14496_FullBox
{ {
/** @var mixed */ /** @var mixed */
private $_value; private $_value;
/** A flag to indicate that the data is an unsigned 8-bit integer. */ /** A flag to indicate that the data is an unsigned 8-bit integer. */
const INTEGER = 0x0; const INTEGER = 0x0;
/** /**
* A flag to indicate that the data is an unsigned 8-bit integer. Different * A flag to indicate that the data is an unsigned 8-bit integer. Different
* value used in old versions of iTunes. * value used in old versions of iTunes.
*/ */
const INTEGER_OLD_STYLE = 0x15; const INTEGER_OLD_STYLE = 0x15;
/** A flag to indicate that the data is a string. */ /** A flag to indicate that the data is a string. */
const STRING = 0x1; const STRING = 0x1;
/** A flag to indicate that the data is the contents of an JPEG image. */ /** A flag to indicate that the data is the contents of an JPEG image. */
const JPEG = 0xd; const JPEG = 0xd;
/** A flag to indicate that the data is the contents of a PNG image. */ /** A flag to indicate that the data is the contents of a PNG image. */
const PNG = 0xe; const PNG = 0xe;
/** /**
* Constructs the class with given parameters and reads box related data * Constructs the class with given parameters and reads box related data
* from the ISO Base Media file. * from the ISO Base Media file.
* *
* @param Zend_Io_Reader $reader The reader object. * @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array. * @param Array $options The options array.
*/ */
public function __construct($reader = null, &$options = array()) public function __construct($reader = null, &$options = array())
{ {
parent::__construct($reader, $options); parent::__construct($reader, $options);
if ($reader === null) { if ($reader === null) {
return; return;
} }
$this->_reader->skip(4); $this->_reader->skip(4);
$data = $this->_reader->read $data = $this->_reader->read
($this->getOffset() + $this->getSize() - ($this->getOffset() + $this->getSize() -
$this->_reader->getOffset()); $this->_reader->getOffset());
switch ($this->getFlags()) { switch ($this->getFlags()) {
case self::INTEGER: case self::INTEGER:
// break intentionally omitted // break intentionally omitted
case self::INTEGER_OLD_STYLE: case self::INTEGER_OLD_STYLE:
for ($i = 0; $i < strlen($data); $i++) { for ($i = 0; $i < strlen($data); $i++) {
$this->_value .= ord($data[$i]); $this->_value .= ord($data[$i]);
} }
break; break;
case self::STRING: case self::STRING:
// break intentionally omitted // break intentionally omitted
default: default:
$this->_value = $data; $this->_value = $data;
break; break;
} }
} }
/** /**
* Returns the value this box contains. * Returns the value this box contains.
* *
* @return mixed * @return mixed
*/ */
public function getValue() public function getValue()
{ {
return $this->_value; return $this->_value;
} }
/** /**
* Sets the value this box contains. * Sets the value this box contains.
* *
* @return mixed * @return mixed
*/ */
public function setValue($value, $type = null) public function setValue($value, $type = null)
{ {
$this->_value = (string)$value; $this->_value = (string)$value;
if ($type === null && is_string($value)) { if ($type === null && is_string($value)) {
$this->_flags = self::STRING; $this->_flags = self::STRING;
} }
if ($type === null && is_int($value)) { if ($type === null && is_int($value)) {
$this->_flags = self::INTEGER; $this->_flags = self::INTEGER;
} }
if ($type !== null) { if ($type !== null) {
$this->_flags = $type; $this->_flags = $type;
} }
} }
/** /**
* Override magic function so that $obj->data will return the current box * 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 * instead of an error. For other values the method will attempt to call a
* getter method. * getter method.
* *
* If there are no getter methods with given name, the method will yield an * If there are no getter methods with given name, the method will yield an
* exception. * exception.
* *
* @param string $name The box or field name. * @param string $name The box or field name.
* @return mixed * @return mixed
*/ */
public function __get($name) public function __get($name)
{ {
if ($name == 'data') { if ($name == 'data') {
return $this; return $this;
} }
if (method_exists($this, 'get' . ucfirst($name))) { if (method_exists($this, 'get' . ucfirst($name))) {
return call_user_func(array($this, 'get' . ucfirst($name))); return call_user_func(array($this, 'get' . ucfirst($name)));
} }
require_once 'Zend/Media/Iso14496/Exception.php'; require_once 'Zend/Media/Iso14496/Exception.php';
throw new Zend_Media_Iso14496_Exception('Unknown box/field: ' . $name); throw new Zend_Media_Iso14496_Exception('Unknown box/field: ' . $name);
} }
/** /**
* Returns the box heap size in bytes. * Returns the box heap size in bytes.
* *
* @return integer * @return integer
*/ */
public function getHeapSize() public function getHeapSize()
{ {
return parent::getHeapSize() + 4 + strlen($this->_value); return parent::getHeapSize() + 4 + strlen($this->_value);
} }
/** /**
* Writes the box data. * Writes the box data.
* *
* @param Zend_Io_Writer $writer The writer object. * @param Zend_Io_Writer $writer The writer object.
* @return void * @return void
*/ */
protected function _writeData($writer) protected function _writeData($writer)
{ {
parent::_writeData($writer); parent::_writeData($writer);
$writer->write("\0\0\0\0"); $writer->write("\0\0\0\0");
switch ($this->getFlags()) { switch ($this->getFlags()) {
case self::INTEGER: case self::INTEGER:
// break intentionally omitted // break intentionally omitted
case self::INTEGER_OLD_STYLE: case self::INTEGER_OLD_STYLE:
for ($i = 0; $i < strlen($this->_value); $i++) { for ($i = 0; $i < strlen($this->_value); $i++) {
$writer->writeInt8($this->_value[$i]); $writer->writeInt8($this->_value[$i]);
} }
break; break;
case self::STRING: case self::STRING:
// break intentionally omitted // break intentionally omitted
default: default:
$writer->write($this->_value); $writer->write($this->_value);
break; break;
} }
} }
} }