diff options
Diffstat (limited to 'libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box')
73 files changed, 7339 insertions, 0 deletions
diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/BXML.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/BXML.php new file mode 100644 index 0000000..d7533dd --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/BXML.php @@ -0,0 +1,86 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: BXML.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * 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. + * The Binary XML Box may only be used when there is a single well-defined + * binarization of the XML for that defined format as identified by the handler. + * + * Within an XML box the data is in UTF-8 format unless the data starts with a + * byte-order-mark (BOM), which indicates that the data is in UTF-16 format. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_BXML extends ISO14496_Box_Full +{ + /** @var string */ + private $_data; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + } + + /** + * Returns the binary data. + * + * @return string + */ + public function getData() + { + return $this->_data; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CDSC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CDSC.php new file mode 100644 index 0000000..fe7d627 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CDSC.php @@ -0,0 +1,80 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: CDSC.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * This box provides a reference from the containing track to another track in + * the presentation. This track describes the referenced track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_CDSC extends ISO14496_Box +{ + /** @var Array */ + private $_trackId = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + while ($this->_reader->getOffset <= $this->getSize()) + $this->_trackId[] = $this->_reader->readUInt32BE(); + } + + /** + * Returns an array of integer references from the containing track to another + * track in the presentation. Track IDs are never re-used and cannot be equal + * to zero. + * + * @return integer + */ + public function getTrackId() { return $this->_trackId; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CO64.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CO64.php new file mode 100644 index 0000000..b6a2f11 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CO64.php @@ -0,0 +1,122 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: CO64.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * 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 + * 64-bit offsets. The latter is useful when managing very large presentations. + * At most one of these variants will occur in any single instance of a sample + * table. + * + * Offsets are file offsets, not the offset into any box within the file (e.g. + * {@link ISO14496_Box_MDAT Media Data Box}). This permits referring to media + * data in files without any box structure. It does also mean that care must be + * taken when constructing a self-contained ISO file with its metadata + * ({@link ISO14496_Box_MOOV Movie Box}) at the front, as the size of the + * {@link ISO14496_Box_MOOV Movie Box} will affect the chunk offsets to the + * media data. + * + * This box variant contains 64-bit offsets. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_CO64 extends ISO14496_Box_Full +{ + /** @var Array */ + private $_chunkOffsetTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_chunkOffsetTable[$i] = + Transform::fromInt64BE(substr($data, ($i - 1) * 8, 8)); + } + + /** + * Returns an array of values. Each entry has the entry number as its index + * and a 64 bit integer that gives the offset of the start of a chunk into + * its containing media file as its value. + * + * @return Array + */ + public function getChunkOffsetTable() { return $this->_chunkOffsetTable; } + + /** + * Sets an array of chunk offsets. Each entry must have the entry number as + * its index and a 64 bit integer that gives the offset of the start of a + * chunk into its containing media file as its value. + * + * @param Array $chunkOffsetTable The chunk offset array. + */ + public function setChunkOffsetTable($chunkOffsetTable) + { + $this->_chunkOffsetTable = $chunkOffsetTable; + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + $data = Transform::toUInt32BE(count($this->_chunkOffsetTable)); + foreach ($this->_chunkOffsetTable as $chunkOffset) + $data .= Transform::toInt64BE($chunkOffset); + return parent::__toString($data); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CPRT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CPRT.php new file mode 100644 index 0000000..2fc10ed --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CPRT.php @@ -0,0 +1,96 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: CPRT.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Copyright Box</i> contains a copyright declaration which applies to + * the entire presentation, when contained within the {@link ISO14496_Box_MOOV + * Movie Box}, or, when contained in a track, to that entire track. There may be + * multiple copyright boxes using different language codes. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_CPRT extends ISO14496_Box_Full +{ + /** @var string */ + private $_language; + + /** @var string */ + private $_notice; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + * @todo Distinguish UTF-16? + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_language = + chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) . + chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); + $this->_notice = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + } + + /** + * Returns the three byte language code to describe the language of the + * notice, according to {@link http://www.loc.gov/standards/iso639-2/ + * ISO 639-2/T}. + * + * @return string + */ + public function getLanguage() { return $this->_language; } + + /** + * Returns the copyright notice. + * + * @return string + */ + public function getNotice() { return $this->_notice; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CTTS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CTTS.php new file mode 100644 index 0000000..c3d3dba --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/CTTS.php @@ -0,0 +1,99 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: CTTS.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * 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 + * composition time, the offsets are expressed as unsigned numbers such that + * CT(n) = DT(n) + CTTS(n) where CTTS(n) is the (uncompressed) table entry for + * sample n. + * + * The composition time to sample table is optional and must only be present if + * DT and CT differ for any samples. Hint tracks do not use this box. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_CTTS extends ISO14496_Box_Full +{ + /** @var Array */ + private $_compositionOffsetTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_compositionOffsetTable[$i] = array + ("sampleCount" => + Transform::fromUInt32BE(substr($data, ($i - 1) * 8, 4)), + "sampleOffset" => + Transform::fromUInt32BE(substr($data, $i * 8 - 4, 4))); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o sampleCount -- an integer that counts the number of consecutive samples + * that have the given offset. + * o sampleOffset -- a non-negative integer that gives the offset between CT + * and DT, such that CT(n) = DT(n) + CTTS(n). + * + * @return Array + */ + public function getCompositionOffsetTable() + { + return $this->_compositionOffsetTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DINF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DINF.php new file mode 100644 index 0000000..362f6b7 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DINF.php @@ -0,0 +1,71 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: DINF.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Data Information Box</i> contains objects that declare the location + * of the media information in a track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_DINF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DREF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DREF.php new file mode 100644 index 0000000..1f56355 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/DREF.php @@ -0,0 +1,88 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: DREF.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * 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 + * presentation. The data reference index in the sample description ties entries + * in this table to the samples in the track. A track may be split over several + * sources in this way. + * + * This box may either contain {@link ISO14496_Box_URN urn} or + * {@link ISO14496_Box_URL url} boxes. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_DREF extends ISO14496_Box_Full +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->_reader->skip(4); + $this->constructBoxes(); + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString(Transform::toUInt32BE(count($this->_boxes))); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/EDTS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/EDTS.php new file mode 100644 index 0000000..fa9207b --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/EDTS.php @@ -0,0 +1,76 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: EDTS.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Edit Box</i> maps the presentation time-line to the media time-line as + * it is stored in the file. The Edit Box is a container for the edit lists. + * + * The Edit Box is optional. In the absence of this box, there is an implicit + * one-to-one mapping of these time-lines, and the presentation of a track + * starts at the beginning of the presentation. An empty edit is used to offset + * the start time of a track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_EDTS extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ELST.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ELST.php new file mode 100644 index 0000000..56ae8da --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ELST.php @@ -0,0 +1,108 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: ELST.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Edit List Box</i> contains an explicit timeline map. Each entry + * defines part of the track time-line: by mapping part of the media time-line, + * or by indicating empty time, or by defining a dwell, where a single + * time-point in the media is held for a period. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_ELST extends ISO14496_Box_Full +{ + /** @var Array */ + private $_entries = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + for ($i = 1; $i <= $entryCount; $i++) { + $entry = array(); + if ($this->getVersion() == 1) { + $entry["segmentDuration"] = $this->_reader->readInt64BE(); + $entry["mediaTime"] = $this->_reader->readInt64BE(); + } else { + $entry["segmentDuration"] = $this->_reader->readUInt32BE(); + $entry["mediaTime"] = $this->_reader->readInt32BE(); + } + $entry["mediaRate"] = $this->_reader->readInt16BE() + + $this->_reader->readInt16BE() / 10; + $this->_entries[] = $entry; + } + } + + /** + * Returns an array of entries. Each entry is an array containing the + * following keys. + * o segmentDuration: specifies the duration of this edit segment in units + * of the timescale in the {@link ISO14496_Box_MVHD Movie Header Box}. + * o mediaTime: the starting time within the media of this edit segment (in + * media time scale units, in composition time). If this field is set to + * –1, it is an empty edit. The last edit in a track shall never be an + * empty edit. Any difference between the duration in the + * {@link ISO14496_Box_MVHD Movie Header Box}, and the track's duration is + * expressed as an implicit empty edit at the end. + * o mediaRate: the relative rate at which to play the media corresponding + * to this edit segment. If this value is 0, then the edit is specifying + * a dwell: the media at media-time is presented for the segment-duration. + * Otherwise this field shall contain the value 1. + * + * @return Array + */ + public function getEntries() + { + return $this->_entries; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FREE.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FREE.php new file mode 100644 index 0000000..449935a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FREE.php @@ -0,0 +1,76 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: FREE.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * 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 + * 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). + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_FREE extends ISO14496_Box +{ + /** + * Constructs the class with given parameters. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString(str_repeat("\0", $this->getSize() - 8)); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FRMA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FRMA.php new file mode 100644 index 0000000..909cfdb --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FRMA.php @@ -0,0 +1,78 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: FRMA.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Original Format Box</i> contains the four-character-code of the + * original un-transformed sample description. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_FRMA extends ISO14496_Box +{ + /** @var string */ + private $_dataFormat; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_dataFormat = $this->_reader->read(4); + } + + /** + * 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 material). + * + * @return string + */ + public function getDataFormat() { return $this->_dataFormat; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FTYP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FTYP.php new file mode 100644 index 0000000..f060091 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/FTYP.php @@ -0,0 +1,142 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: FTYP.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>File Type Box</i> is placed as early as possible in the file (e.g. + * after any obligatory signature, but before any significant variable-size + * boxes such as a {@link ISO14496_Box_MOOV Movie Box}, {@link ISO14496_Box_MDAT + * Media Data Box}, or {@link ISO14496_Box_FREE Free Space}). It identifies + * which specification is the <i>best use</i> of the file, and a minor version + * of that specification; and also a set of others specifications to which the + * file complies. + * + * The minor version is informative only. It does not appear for + * compatible-brands, and must not be used to determine the conformance of a + * file to a standard. It may allow more precise identification of the major + * specification, for inspection, debugging, or improved decoding. + * + * The type <i>isom</i> (ISO Base Media file) is defined as identifying files + * that conform to the first version of the ISO Base Media File Format. More + * specific identifiers can be used to identify precise versions of + * specifications providing more detail. This brand is not be used as the major + * brand; this base file format should be derived into another specification to + * be used. There is therefore no defined normal file extension, or mime type + * assigned to this brand, nor definition of the minor version when <i>isom</i> + * is the major brand. + * + * Files would normally be externally identified (e.g. with a file extension or + * mime type) that identifies the <i>best use</i> (major brand), or the brand + * that the author believes will provide the greatest compatibility. + * + * The brand <i>iso2</i> shall be used to indicate compatibility with the + * amended version of the ISO Base Media File Format; it may be used in addition + * to or instead of the <i>isom</i> brand and the same usage rules apply. If + * used without the brand <i>isom</i> identifying the first version of the + * specification, it indicates that support for some or all of the technology + * introduced by the amended version of the ISO Base Media File Format is + * required. + * + * The brand <i>avc1</i> shall be used to indicate that the file is conformant + * with the <i>AVC Extensions</i>. If used without other brands, this implies + * that support for those extensions is required. The use of <i>avc1</i> as a + * major-brand may be permitted by specifications; in that case, that + * specification defines the file extension and required behavior. + * + * If a Meta-box with an MPEG-7 handler type is used at the file level, then the + * brand <i>mp71</i> is a member of the compatible-brands list in the file-type + * box. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_FTYP extends ISO14496_Box +{ + /** @var integer */ + private $_majorBrand; + + /** @var integer */ + private $_minorVersion; + + /** @var integer */ + private $_compatibleBrands = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_majorBrand = $this->_reader->readString8(4); + $this->_minorVersion = $this->_reader->readUInt32BE(); + while ($this->_reader->getOffset() < $this->getSize()) + if (($brand = $this->_reader->readString8(4)) != "") + $this->_compatibleBrands[] = $brand; + } + + /** + * Returns the major version brand. + * + * @return string + */ + public function getMajorBrand() { return $this->_majorBrand; } + + /** + * Returns the minor version number. + * + * @return integer + */ + public function getMinorVersion() { return $this->_minorVersion; } + + /** + * Returns the array of compatible version brands. + * + * @return Array + */ + public function getCompatibleBrands() { return $this->_compatibleBrands; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/Full.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/Full.php new file mode 100644 index 0000000..d22e0d3 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/Full.php @@ -0,0 +1,124 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: Full.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * A base class for objects that also contain a version number and flags field. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +abstract class ISO14496_Box_Full extends ISO14496_Box +{ + /** @var integer */ + protected $_version = 0; + + /** @var integer */ + protected $_flags = 0; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_version = (($field = $this->_reader->readUInt32BE()) >> 24) & 0xff; + $this->_flags = $field & 0xffffff; + } + + /** + * Returns the version of this format of the box. + * + * @return integer + */ + public function getVersion() { return $this->_version; } + + /** + * Sets the version of this format of the box. + * + * @param integer $version The version. + */ + public function setVersion($version) { $this->_version = $version; } + + /** + * Checks whether or not the flag is set. Returns <var>true</var> if the flag + * is set, <var>false</var> otherwise. + * + * @param integer $flag The flag to query. + * @return boolean + */ + public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; } + + /** + * Returns the map of flags. + * + * @return integer + */ + public function getFlags() { return $this->_flags; } + + /** + * Sets the map of flags. + * + * @param string $flags The map of flags. + */ + public function setFlags($flags) { $this->_flags = $flags; } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString + (Transform::toUInt32BE($this->_version << 24 | $this->_flags) . $data); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HDLR.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HDLR.php new file mode 100644 index 0000000..6de86c1 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HDLR.php @@ -0,0 +1,150 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: HDLR.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Handler Reference Box</i> is within a {@link ISO14496_Box_MDIA Media + * Box} declares the process by which the media-data in the track is presented, + * and thus, the nature of the media in a track. For example, a video track + * would be handled by a video handler. + * + * This box when present within a {@link ISO14496_Box_META Meta Box}, declares + * the structure or format of the <i>meta</i> box contents. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_HDLR extends ISO14496_Box_Full +{ + /** @var string */ + private $_handlerType; + + /** @var string */ + private $_name; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_reader->skip(4); + $this->_handlerType = $this->_reader->read(4); + $this->_reader->skip(12); + $this->_name = $this->_reader->readString8 + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + } + + /** + * Returns the handler type. + * + * When present in a media box, the returned value contains one of the + * following values, or a value from a derived specification: + * o <i>vide</i> Video track + * o <i>soun</i> Audio track + * o <i>hint</i> Hint track + * + * When present in a meta box, the returned value contains an appropriate + * value to indicate the format of the meta box contents. + * + * @return integer + */ + public function getHandlerType() { return $this->_handlerType; } + + /** + * Sets the handler type. + * + * When present in a media box, the value must be set to one of the following + * values, or a value from a derived specification: + * o <i>vide</i> Video track + * o <i>soun</i> Audio track + * o <i>hint</i> Hint track + * + * When present in a meta box, the value must be set to an appropriate value + * to indicate the format of the meta box contents. + * + * @param string $handlerType The handler type. + */ + public function setHandlerType($handlerType) + { + $this->_handlerType = $handlerType; + } + + /** + * Returns the name string. The name is in UTF-8 characters and gives a + * human-readable name for the track type (for debugging and inspection + * purposes). + * + * @return integer + */ + public function getName() { return $this->_name; } + + /** + * Sets the name string. The name must be in UTF-8 and give a human-readable + * name for the track type (for debugging and inspection purposes). + * + * @param string $name The human-readable description. + */ + public function setName($name) { $this->_name = $name; } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString + ("appl" . $this->_handlerType . Transform::toUInt32BE(0) . + Transform::toUInt32BE(0) . Transform::toUInt32BE(0) . $this->_name . + "\0"); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HINT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HINT.php new file mode 100644 index 0000000..02d73af --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HINT.php @@ -0,0 +1,81 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: HINT.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * This box provides a reference from the containing track to another track in + * the presentation. The referenced track(s) contain the original media for this + * hint track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_HINT extends ISO14496_Box +{ + /** @var Array */ + private $_trackId = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + while ($this->_reader->getOffset <= $this->getSize()) + $this->_trackId[] = $this->_reader->readUInt32BE(); + } + + /** + * Returns an array of integer references from the containing track to another + * track in the presentation. Track IDs are never re-used and cannot be equal + * to zero. + * + * @return integer + */ + public function getTrackId() { return $this->_trackId; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HMHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HMHD.php new file mode 100644 index 0000000..c269099 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/HMHD.php @@ -0,0 +1,110 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: HMHD.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Hint Media Header Box</i> header contains general information, + * independent of the protocol, for hint tracks. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_HMHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_maxPDUSize; + + /** @var integer */ + private $_avgPDUSize; + + /** @var integer */ + private $_maxBitrate; + + /** @var integer */ + private $_avgBitrate; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_maxPDUSize = $this->_reader->readUInt16BE(); + $this->_avgPDUSize = $this->_reader->readUInt16BE(); + $this->_maxBitrate = $this->_reader->readUInt32BE(); + $this->_avgBitrate = $this->_reader->readUInt32BE(); + } + + /** + * Returns the size in bytes of the largest PDU in this (hint) stream. + * + * @return integer + */ + public function getMaxPDUSize() { return $this->_maxPDUSize; } + + /** + * Returns the average size of a PDU over the entire presentation. + * + * @return integer + */ + public function getAvgPDUSize() { return $this->_avgPDUSize; } + + /** + * Returns the maximum rate in bits/second over any window of one second. + * + * @return integer + */ + public function getMaxBitrate() { return $this->_maxbitrate; } + + /** + * Returns the average rate in bits/second over the entire presentation. + * + * @return integer + */ + public function getAvgBitrate() { return $this->_maxbitrate; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ID32.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ID32.php new file mode 100644 index 0000000..334289a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ID32.php @@ -0,0 +1,131 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: ID32.php 93 2008-05-10 17:11:44Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>ID3v2 Box</i> resides under the {@link ISO14496_Box_META Meta Box} and + * stores ID3 version 2 meta-data. There may be more than one ID3v2 Box present + * each with a different language code. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 93 $ + */ +final class ISO14496_Box_ID32 extends ISO14496_Box_Full +{ + /** @var string */ + private $_language = "und"; + + /** @var ID3v2 */ + private $_tag; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_language = + chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) . + chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); + $this->_tag = new ID3v2($this->_reader, array("readonly" => true)); + } + + /** + * Returns the three byte language code to describe the language of this + * media, according to {@link http://www.loc.gov/standards/iso639-2/ + * ISO 639-2/T}. + * + * @return string + */ + public function getLanguage() { return $this->_language; } + + /** + * Sets the three byte language code as specified in the + * {@link http://www.loc.gov/standards/iso639-2/ ISO 639-2} standard. + * + * @param string $language The language code. + */ + public function setLanguage($language) { $this->_language = $language; } + + /** + * Returns the {@link ID3v2} tag class instance. + * + * @return string + */ + public function getTag() { return $this->_tag; } + + /** + * Sets the {@link ID3v2} tag class instance using given language. + * + * @param ID3v2 $tag The tag instance. + * @param string $language The language code. + */ + public function setTag($tag, $language = false) + { + $this->_tag = $tag; + if ($language !== false) + $this->_language = $language; + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString + (Transform::toUInt16BE + (((ord($this->_language[0]) - 0x60) << 10) | + ((ord($this->_language[1]) - 0x60) << 5) | + ord($this->_language[2]) - 0x60) . $this->_tag); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IINF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IINF.php new file mode 100644 index 0000000..008e99d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IINF.php @@ -0,0 +1,87 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: IINF.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Item Information Box</i> provides extra information about selected + * 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 + * may have changed the format of the data in the item. If both content encoding + * and protection are indicated for an item, a reader should first un-protect + * the item, and then decode the item's content encoding. If more control is + * needed, an IPMP sequence code may be used. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_IINF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->_reader->skip(2); + $this->constructBoxes(); + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString(Transform::toUInt16BE(count($this->_boxes))); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILOC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILOC.php new file mode 100644 index 0000000..9244fda --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILOC.php @@ -0,0 +1,134 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: ILOC.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>The Item Location Box</i> provides a directory of resources in this or + * other files, by locating their containing file, their offset within that + * file, and their length. Placing this in binary format enables common handling + * of this data, even by systems which do not understand the particular metadata + * system (handler) used. For example, a system might integrate all the + * externally referenced metadata resources into one file, re-adjusting file + * offsets and file references accordingly. + * + * Items may be stored fragmented into extents, e.g. to enable interleaving. An + * extent is a contiguous subset of the bytes of the resource; the resource is + * formed by concatenating the extents. If only one extent is used then either + * or both of the offset and length may be implied: + * + * o If the offset is not identified (the field has a length of zero), then + * the beginning of the file (offset 0) is implied. + * o If the length is not specified, or specified as zero, then the entire + * file length is implied. References into the same file as this metadata, + * or items divided into more than one extent, should have an explicit + * offset and length, or use a MIME type requiring a different + * interpretation of the file, to avoid infinite recursion. + * + * The size of the item is the sum of the extentLengths. Note: extents may be + * interleaved with the chunks defined by the sample tables of tracks. + * + * The dataReferenceIndex may take the value 0, indicating a reference into the + * same file as this metadata, or an index into the dataReference table. + * + * Some referenced data may itself use offset/length techniques to address + * resources within it (e.g. an MP4 file might be included in this way). + * Normally such offsets are relative to the beginning of the containing file. + * The field base offset provides an additional offset for offset calculations + * within that contained data. For example, if an MP4 file is included within a + * file formatted to this specification, then normally data-offsets within that + * MP4 section are relative to the beginning of file; baseOffset adds to those + * offsets. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_ILOC extends ISO14496_Box +{ + /** @var Array */ + private $_items = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $offsetSize = (($tmp = $this->_reader->readUInt32BE()) >> 28) & 0xf; + $lengthSize = ($tmp >> 24) & 0xf; + $baseOffsetSize = ($tmp >> 20) & 0xf; + $itemCount = $this->_reader->readUInt16BE(); + for ($i = 0; $i < $itemCount; $i++) { + $item = array(); + $item["itemId"] = $this->_reader->readUInt16BE(); + $item["dataReferenceIndex"] = $this->_reader->readUInt16BE(); + $item["baseOffset"] = + ($baseOffsetSize == 4 ? $this->_reader->readUInt32BE() : + ($baseOffsetSize == 8 ? $this->_reader->readInt64BE() : 0)); + $item["extents"] = array(); + for ($j = 0; $j < $extentCount; $j++) { + $extent = array(); + $extent["offset"] = + ($offsetSize == 4 ? $this->_reader->readUInt32BE() : + ($offsetSize == 8 ? $this->_reader->readInt64BE() : 0)); + $extent["length"] = + ($lengthSize == 4 ? $this->_reader->readUInt32BE() : + ($lengthSize == 8 ? $this->_reader->readInt64BE() : 0)); + $item["extents"][] = $extent; + } + $this->_items[] = $item; + } + } + + /** + * Returns the array of items. Each entry has the following keys set: itemId, + * dataReferenceIndex, baseOffset, and extents. + * + * @return Array + */ + public function getItems() { return $this->_items; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILST.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILST.php new file mode 100644 index 0000000..9b4a209 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/ILST.php @@ -0,0 +1,280 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: ILST.php 101 2008-05-13 20:28:13Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * 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 + * in a nested {@link ISO14496_Box_DATA Data Box}. + * + * <ul> + * <li><b>_nam</b> -- <i>Name of the track</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>_alb</b> -- <i>Name of the album</i></li> + * <li><b>_grp</b> -- <i>Grouping</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>disk</b> -- <i>Disk number (number/total)</i></li> + * <li><b>tmpo</b> -- <i>BPM tempo</i></li> + * <li><b>_wrt</b> -- <i>Name of the composer</i></li> + * <li><b>_cmt</b> -- <i>Comments</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>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>sonm</b> -- <i>Sort name of the track</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>soal</b> -- <i>Sort name of the album</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>_lyr</b> -- <i>Lyrics</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> + * </ul> + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 101 $ + * @since iTunes/iPod specific + */ +final class ISO14496_Box_ILST extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes("ISO14496_Box_ILST_Container"); + } + + /** + * Override magic function so that $obj->value on a box will return the data + * box instead of the data container box. + * + * @param string $name The box or field name. + * @return mixed + */ + public function __get($name) + { + if (strlen($name) == 3) + $name = "\xa9" . $name; + if ($name[0] == "_") + $name = "\xa9" . substr($name, 1, 3); + if ($this->hasBox($name)) { + $boxes = $this->getBoxesByIdentifier($name); + return $boxes[0]->data; + } + if (method_exists($this, "get" . ucfirst($name))) + return call_user_func(array($this, "get" . ucfirst($name))); + return $this->addBox(new ISO14496_Box_ILST_Container($name))->data; + } +} + +/** + * Generic iTunes/iPod DATA Box container. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 101 $ + * @since iTunes/iPod specific + * @ignore + */ +final class ISO14496_Box_ILST_Container extends ISO14496_Box +{ + public function __construct($reader = null, &$options = array()) + { + parent::__construct(is_string($reader) ? null : $reader, $options); + $this->setContainer(true); + + if (is_string($reader)) { + $this->setType($reader); + $this->addBox(new ISO14496_Box_DATA()); + } else + $this->constructBoxes(); + } +} + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * A box that contains data for iTunes/iPod specific boxes. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 101 $ + * @since iTunes/iPod specific + */ +final class ISO14496_Box_DATA extends ISO14496_Box_Full +{ + /** @var mixed */ + private $_value; + + /** A flag to indicate that the data is an unsigned 8-bit integer. */ + const INTEGER = 0x0; + + /** + * A flag to indicate that the data is an unsigned 8-bit integer. Different + * value used in old versions of iTunes. + */ + const INTEGER_OLD_STYLE = 0x15; + + /** A flag to indicate that the data is a string. */ + const STRING = 0x1; + + /** A flag to indicate that the data is the contents of an JPEG image. */ + const JPEG = 0xd; + + /** A flag to indicate that the data is the contents of a PNG image. */ + const PNG = 0xe; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + + if ($reader === null) + return; + + $this->_reader->skip(4); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + switch ($this->getFlags()) { + case self::INTEGER: + case self::INTEGER_OLD_STYLE: + for ($i = 0; $i < strlen($data); $i++) + $this->_value .= Transform::fromInt8($data[$i]); + break; + case self::STRING: + default: + $this->_value = $data; + } + } + + /** + * Returns the value this box contains. + * + * @return mixed + */ + public function getValue() { return $this->_value; } + + /** + * Sets the value this box contains. + * + * @return mixed + */ + public function setValue($value, $type = false) + { + $this->_value = (string)$value; + if ($type === false && is_string($value)) + $this->_flags = self::STRING; + if ($type === false && is_int($value)) + $this->_flags = self::INTEGER; + if ($type !== false) + $this->_flags = $type; + } + + /** + * Override magic function so that $obj->data will return the current box + * instead of an error. For other values the method will attempt to call a + * getter method. + * + * If there are no getter methods with given name, the method will yield an + * exception. + * + * @param string $name The box or field name. + * @return mixed + */ + public function __get($name) + { + if ($name == "data") + return $this; + if (method_exists($this, "get" . ucfirst($name))) + return call_user_func(array($this, "get" . ucfirst($name))); + throw new ISO14496_Exception("Unknown box/field: " . $name); + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + switch ($this->getFlags()) { + case self::INTEGER: + case self::INTEGER_OLD_STYLE: + $data = ""; + for ($i = 0; $i < strlen($this->_value); $i++) + $data .= Transform::toInt8($this->_value[$i]); + break; + case self::STRING: + default: + $data = $this->_value; + } + return parent::__toString("\0\0\0\0" . $data); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IMIF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IMIF.php new file mode 100644 index 0000000..c4e389a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IMIF.php @@ -0,0 +1,91 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: IMIF.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>IPMP Information Box</i> contains IPMP Descriptors which document the + * protection applied to the stream. + * + * IPMP_Descriptor is defined in 14496-1. This is a part of the MPEG-4 object + * descriptors (OD) that describe how an object can be accessed and decoded. + * Here, in the ISO Base Media File Format, IPMP Descriptor can be carried + * directly in IPMP Information Box without the need for OD stream. + * + * The presence of IPMP Descriptor in this box indicates the associated media + * stream is protected by the IPMP Tool described in the IPMP Descriptor. + * + * Each IPMP_Descriptor has an IPMP_ToolID, which identifies the required IPMP + * tool for protection. An independent registration authority (RA) is used so + * any party can register its own IPMP Tool and identify this without + * collisions. + * + * The IPMP_Descriptor carries IPMP information for one or more IPMP Tool + * instances, it includes but not limited to IPMP Rights Data, IPMP Key Data, + * Tool Configuration Data, etc. + * + * More than one IPMP Descriptors can be carried in this box if this media + * stream is protected by more than one IPMP Tools. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_IMIF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/INFE.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/INFE.php new file mode 100644 index 0000000..6b7f113 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/INFE.php @@ -0,0 +1,131 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: INFE.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Item Information Entry Box</i> contains the entry information. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_INFE extends ISO14496_Box_Full +{ + /** @var integer */ + private $_itemId; + + /** @var integer */ + private $_itemProtectionIndex; + + /** @var string */ + private $_itemName; + + /** @var string */ + private $_contentType; + + /** @var string */ + private $_contentEncoding; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_itemId = $this->_reader->readUInt16BE(); + $this->_itemProtectionIndex = $this->_reader->readUInt16BE(); + list($this->_itemName, $this->_contentType, $this->_contentEncoding) = + preg_split + ("/\\x00/", $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset())); + } + + /** + * Returns the item identifier. The value is either 0 for the primary resource + * (e.g. the XML contained in an {@link ISO14496_Box_XML XML Box}) or the ID + * of the item for which the following information is defined. + * + * @return integer + */ + public function getItemId() { return $this->_itemId; } + + /** + * Returns the item protection index. The value is either 0 for an unprotected + * item, or the one-based index into the {@link ISO14496_Box_IPRO Item + * Protection Box} defining the protection applied to this item (the first box + * in the item protection box has the index 1). + * + * @return integer + */ + public function getItemProtectionIndex() + { + return $this->_itemProtectionIndex; + } + + /** + * Returns the symbolic name of the item. + * + * @return string + */ + public function getItemName() { return $this->_itemName; } + + /** + * Returns the MIME type for the item. + * + * @return string + */ + public function getContentType() { return $this->_contentType; } + + /** + * Returns the optional content encoding type as defined for Content-Encoding + * for HTTP /1.1. Some possible values are <i>gzip</i>, <i>compress</i> and + * <i>deflate</i>. An empty string indicates no content encoding. + * + * @return string + */ + public function getContentEncoding() { return $this->_contentEncoding; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPMC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPMC.php new file mode 100644 index 0000000..cce9469 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPMC.php @@ -0,0 +1,56 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: IPMC.php 85 2008-04-23 20:21:36Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>IPMP Control Box</i> may contain IPMP descriptors which may be + * referenced by any stream in the file. + * + * @todo Data parsing + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 85 $ + */ +final class ISO14496_Box_IPMC extends ISO14496_Box_Full +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPRO.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPRO.php new file mode 100644 index 0000000..edee325 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/IPRO.php @@ -0,0 +1,82 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: IPRO.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Item Protection Box</i> provides an array of item protection + * information, for use by the {@link ISO14496_Box_IINF Item Information Box}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_IPRO extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->_reader->skip(2); + $this->constructBoxes(); + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + return parent::__toString(Transform::toUInt16BE(count($this->_boxes))); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDAT.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDAT.php new file mode 100644 index 0000000..439d3cc --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDAT.php @@ -0,0 +1,66 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MDAT.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Media Data Box</i> contains the media data. In video tracks, this box + * would contain video frames. There may be any number of these boxes in the + * file (including zero, if all the media data is in other files). + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MDAT extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDHD.php new file mode 100644 index 0000000..c52cca3 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDHD.php @@ -0,0 +1,136 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MDHD.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Media Header Box</i> declares overall information that is + * media-independent, and relevant to characteristics of the media in a track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MDHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_creationTime; + + /** @var integer */ + private $_modificationTime; + + /** @var integer */ + private $_timescale; + + /** @var integer */ + private $_duration; + + /** @var string */ + private $_language; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + if ($this->getVersion() == 1) { + $this->_creationTime = $this->_reader->readInt64BE(); + $this->_modificationTime = $this->_reader->readInt64BE(); + $this->_timescale = $this->_reader->readUInt32BE(); + $this->_duration = $this->_reader->readInt64BE(); + } else { + $this->_creationTime = $this->_reader->readUInt32BE(); + $this->_modificationTime = $this->_reader->readUInt32BE(); + $this->_timescale = $this->_reader->readUInt32BE(); + $this->_duration = $this->_reader->readUInt32BE(); + } + $this->_language = + chr(((($tmp = $this->_reader->readUInt16BE()) >> 10) & 0x1f) + 0x60) . + chr((($tmp >> 5) & 0x1f) + 0x60) . chr(($tmp & 0x1f) + 0x60); + } + + /** + * Returns the creation time of the media in this track, in seconds since + * midnight, Jan. 1, 1904, in UTC time. + * + * @return integer + */ + public function getCreationTime() { return $this->_creationTime; } + + /** + * Returns the most recent time the media in this track was modified in + * seconds since midnight, Jan. 1, 1904, in UTC time. + * + * @return integer + */ + public function getModificationTime() { return $this->_modificationTime; } + + /** + * Returns the time-scale for this media. This is the number of time units + * that pass in one second. For example, a time coordinate system that + * measures time in sixtieths of a second has a time scale of 60. + * + * @return integer + */ + public function getTimescale() { return $this->_timescale; } + + /** + * Returns the duration of this media (in the scale of the timescale). + * + * @return integer + */ + public function getDuration() { return $this->_duration; } + + /** + * Returns the three byte language code to describe the language of this + * media, according to {@link http://www.loc.gov/standards/iso639-2/ + * ISO 639-2/T}. + * + * @return string + */ + public function getLanguage() { return $this->_language; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDIA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDIA.php new file mode 100644 index 0000000..4949c4f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MDIA.php @@ -0,0 +1,71 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MDIA.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Media Box</i> contains all the objects that declare information about + * the media data within a track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MDIA extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MEHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MEHD.php new file mode 100644 index 0000000..2967a1b --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MEHD.php @@ -0,0 +1,84 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MEHD.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Movie Extends Header Box</i> is optional, and provides the overall + * duration, including fragments, of a fragmented movie. If this box is not + * present, the overall duration must be computed by examining each fragment. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MEHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_fragmentDuration; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + if ($this->getVersion() == 1) + $this->_fragmentDuration = $this->_reader->readInt64BE(); + else + $this->_fragmentDuration = $this->_reader->readUInt32BE(); + } + + /** + * Returns the length of the presentation of the whole movie including + * fragments (in the timescale indicated in the {@link ISO14496_Box_MVHD + * Movie Header Box}). The value of this field corresponds to the duration of + * the longest track, including movie fragments. + * + * @return integer + */ + public function getFragmentDuration() { return $this->_fragmentDuration; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/META.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/META.php new file mode 100644 index 0000000..a7d13a7 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/META.php @@ -0,0 +1,90 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: META.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Meta Box</i> contains descriptive or annotative metadata. The + * <i>meta</i> box is required to contain a {@link ISO14496_Box_HDLR hdlr} box + * indicating the structure or format of the <i>meta</i> box contents. That + * metadata is located either within a box within this box (e.g. an XML box), or + * is located by the item identified by a primary item box. + * + * All other contained boxes are specific to the format specified by the handler + * box. + * + * The other boxes defined here may be defined as optional or mandatory for a + * given format. If they are used, then they must take the form specified here. + * These optional boxes include a data-information box, which documents other + * files in which metadata values (e.g. pictures) are placed, and a item + * location box, which documents where in those files each item is located (e.g. + * in the common case of multiple pictures stored in the same file). At most one + * meta box may occur at each of the file level, movie level, or track level. + * + * If an {@link ISO14496_Box_IPRO Item Protection Box} occurs, then some or all + * of the meta-data, including possibly the primary resource, may have been + * protected and be un-readable unless the protection system is taken into + * account. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_META extends ISO14496_Box_Full +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFHD.php new file mode 100644 index 0000000..d282ed5 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFHD.php @@ -0,0 +1,80 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MFHD.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Movie Fragment Header Box</i> contains a sequence number, as a safety + * check. The sequence number usually starts at 1 and must increase for each + * movie fragment in the file, in the order in which they occur. This allows + * readers to verify integrity of the sequence; it is an error to construct a + * file where the fragments are out of sequence. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MFHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_sequenceNumber; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_sequenceNumber = $this->_reader->readUInt32BE(); + } + + /** + * Returns the ordinal number of this fragment, in increasing order. + * + * @return integer + */ + public function getSequenceNumber() { return $this->_sequenceNumber; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRA.php new file mode 100644 index 0000000..c29f76f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRA.php @@ -0,0 +1,85 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MFRA.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Movie Fragment Random Access Box</i> provides a table which may assist + * readers in finding random access points in a file using movie fragments. It + * contains a track fragment random access box for each track for which + * information is provided (which may not be all tracks). It is usually placed + * at or near the end of the file; the last box within the Movie Fragment Random + * Access Box provides a copy of the length field from the Movie Fragment Random + * Access Box. Readers may attempt to find this box by examining the last 32 + * bits of the file, or scanning backwards from the end of the file for a Movie + * Fragment Random Access Offset Box and using the size information in it, to + * see if that locates the beginning of a Movie Fragment Random Access Box. + * + * This box provides only a hint as to where random access points are; the movie + * fragments themselves are definitive. It is recommended that readers take care + * in both locating and using this box as modifications to the file after it was + * created may render either the pointers, or the declaration of random access + * points, incorrect. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MFRA extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRO.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRO.php new file mode 100644 index 0000000..24bd696 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MFRO.php @@ -0,0 +1,85 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MFRO.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Movie Fragment Random Access Offset Box</i> provides a copy of the + * length field from the enclosing {@link ISO14496_Box_MFRA Movie Fragment + * Random Access Box}. It is placed last within that box, so that the size field + * is also last in the enclosing Movie Fragment Random Access Box. When the + * Movie Fragment Random Access Box is also last in the file this permits its + * easy location. The size field here must be correct. However, neither the + * presence of the Movie Fragment Random Access Box, nor its placement last in + * the file, are assured. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MFRO extends ISO14496_Box_Full +{ + /** @var integer */ + private $_parentSize; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_parentSize = $this->_reader->readUInt32BE(); + } + + /** + * Returns the number of bytes of the enclosing {@link ISO14496_Box_MFRA} box. + * This field is placed at the last of the enclosing box to assist readers + * scanning from the end of the file in finding the <i>mfra</i> box. + * + * @return integer + */ + public function getParentSize() { return $this->_parentSize; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MINF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MINF.php new file mode 100644 index 0000000..9865605 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MINF.php @@ -0,0 +1,71 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MINF.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Media Information Box</i> contains all the objects that declare + * characteristic information of the media in the track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MINF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOF.php new file mode 100644 index 0000000..e4b9f55 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOF.php @@ -0,0 +1,81 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MOOF.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Movie Fragment Box</i> extend the presentation in time. They provide + * the information that would previously have been in the + * {@link ISO14496_Box_MOOV Movie Box}. The actual samples are in + * {@link ISO14496_Box_MDAT Media Data Boxes}, as usual, if they are in the same + * file. The data reference index is in the sample description, so it is + * possible to build incremental presentations where the media data is in files + * other than the file containing the Movie Box. + * + * The Movie Fragment Box is a top-level box, (i.e. a peer to the Movie Box and + * Media Data boxes). It contains a {@link ISO14496_Box_MFHD Movie Fragment + * Header Box}, and then one or more {@link ISO14496_Box_TRAF Track Fragment + * Boxes}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MOOF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOV.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOV.php new file mode 100644 index 0000000..cd139e0 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MOOV.php @@ -0,0 +1,72 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MOOV.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The metadata for a presentation is stored in the single <i>Movie Box</i> + * which occurs at the top-level of a file. Normally this box is close to the + * beginning or end of the file, though this is not required. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MOOV extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVEX.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVEX.php new file mode 100644 index 0000000..78f8b3d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVEX.php @@ -0,0 +1,74 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MVEX.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Movie Extends Box</i> warns readers that there might be + * {@link ISO14496_Box_MFRA Movie Fragment Boxes} in this file. To know of all + * samples in the tracks, these Movie Fragment Boxes must be found and scanned + * in order, and their information logically added to that found in the + * {@link ISO14496_Box_MOOV Movie Box}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MVEX extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVHD.php new file mode 100644 index 0000000..5436c34 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/MVHD.php @@ -0,0 +1,166 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: MVHD.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Movie Header Box</i> defines overall information which is + * media-independent, and relevant to the entire presentation considered as a + * whole. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_MVHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_creationTime; + + /** @var integer */ + private $_modificationTime; + + /** @var integer */ + private $_timescale; + + /** @var integer */ + private $_duration; + + /** @var integer */ + private $_rate; + + /** @var integer */ + private $_volume; + + /** @var integer */ + private $_nextTrackId; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + if ($this->getVersion() == 1) { + $this->_creationTime = $this->_reader->readInt64BE(); + $this->_modificationTime = $this->_reader->readInt64BE(); + $this->_timescale = $this->_reader->readUInt32BE(); + $this->_duration = $this->_reader->readInt64BE(); + } else { + $this->_creationTime = $this->_reader->readUInt32BE(); + $this->_modificationTime = $this->_reader->readUInt32BE(); + $this->_timescale = $this->_reader->readUInt32BE(); + $this->_duration = $this->_reader->readUInt32BE(); + } + $this->_rate = + ((($tmp = $this->_reader->readUInt32BE()) >> 16) & 0xffff) + + ($tmp & 0xffff) / 10; + $this->_volume = ((($tmp = $this->_reader->readUInt16BE()) >> 8) & 0xff) + + ($tmp & 0xff) / 10; + $this->_reader->skip(70); + $this->_nextTrackId = $this->_reader->readUInt32BE(); + } + + /** + * Returns the creation time of the presentation. The value is in seconds + * since midnight, Jan. 1, 1904, in UTC time. + * + * @return integer + */ + public function getCreationTime() { return $this->_creationTime; } + + /** + * Returns the most recent time the presentation was modified. The value is in + * seconds since midnight, Jan. 1, 1904, in UTC time. + * + * @return integer + */ + public function getModificationTime() { return $this->_modificationTime; } + + /** + * Returns the time-scale for the entire presentation. This is the number of + * time units that pass in one second. For example, a time coordinate system + * that measures time in sixtieths of a second has a time scale of 60. + * + * @return integer + */ + public function getTimescale() { return $this->_timescale; } + + /** + * Returns the length of the presentation in the indicated timescale. This + * property is derived from the presentation's tracks: the value of this field + * corresponds to the duration of the longest track in the presentation. + * + * @return integer + */ + public function getDuration() { return $this->_duration; } + + /** + * Returns the preferred rate to play the presentation. 1.0 is normal forward + * playback. + * + * @return integer + */ + public function getRate() { return $this->_rate; } + + /** + * Returns the preferred playback volume. 1.0 is full volume. + * + * @return integer + */ + public function getVolume() { return $this->_volume; } + + /** + * Returns a value to use for the track ID of the next track to be added to + * this presentation. Zero is not a valid track ID value. The value is larger + * than the largest track-ID in use. If this value is equal to or larger than + * 32-bit maxint, and a new media track is to be added, then a search must be + * made in the file for a unused track identifier. + * + * @return integer + */ + public function getNextTrackId() { return $this->_nextTrackId; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/NMHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/NMHD.php new file mode 100644 index 0000000..e57831a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/NMHD.php @@ -0,0 +1,55 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: NMHD.php 85 2008-04-23 20:21:36Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * Streams other than visual and audio may use a <i>Null Media Header Box</i>, + * as defined here. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 85 $ + */ +final class ISO14496_Box_NMHD extends ISO14496_Box_Full +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PADB.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PADB.php new file mode 100644 index 0000000..6fe231a --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PADB.php @@ -0,0 +1,57 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: PADB.php 85 2008-04-23 20:21:36Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Padding Bits Box</i>In some streams the media samples do not occupy + * all bits of the bytes given by the sample size, and are padded at the end to + * a byte boundary. In some cases, it is necessary to record externally the + * number of padding bits used. This table supplies that information. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 85 $ + */ +final class ISO14496_Box_PADB extends ISO14496_Box_Full +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PDIN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PDIN.php new file mode 100644 index 0000000..57ed193 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PDIN.php @@ -0,0 +1,97 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: PDIN.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Progressive Download Information Box</i> aids the progressive download + * of an ISO file. The box contains pairs of numbers (to the end of the box) + * specifying combinations of effective file download bitrate in units of + * bytes/sec and a suggested initial playback delay in units of milliseconds. + * + * A receiving party can estimate the download rate it is experiencing, and from + * that obtain an upper estimate for a suitable initial delay by linear + * interpolation between pairs, or by extrapolation from the first or last + * entry. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_PDIN extends ISO14496_Box_Full +{ + /** @var Array */ + private $_progressiveDownloadInfo = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + while ($this->_reader->getOffset() < $this->getOffset() + $this->getSize()) + $this->_progressiveDownloadInfo[] = array + ("rate" => $this->_reader->readUInt32BE(), + "initialDelay" => $this->_reader->readUInt32BE()); + } + + /** + * Returns the progressive download information array. The array consists of + * items having two keys. + * + * o rate -- the download rate expressed in bytes/second + * o initialDelay -- the suggested delay to use when playing the file, + * such that if download continues at the given rate, all data within the + * file will arrive in time for its use and playback should not need to + * stall. + * + * @return Array + */ + public function getProgressiveDownloadInfo() + { + return $this->_progressiveDownloadInfo; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PITM.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PITM.php new file mode 100644 index 0000000..ecbc5c9 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/PITM.php @@ -0,0 +1,85 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: PITM.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * For a given handler, the primary data may be one of the referenced items when + * it is desired that it be stored elsewhere, or divided into extents; or the + * primary metadata may be contained in the meta-box (e.g. in an + * {@link ISO14496_Box_XML XML Box}). Either the <i>Primary Item Box</i> must + * occur, or there must be a box within the meta-box (e.g. an + * {@link ISO14496_Box_XML XML Box}) containing the primary information in the + * format required by the identified handler. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_PITM extends ISO14496_Box_Full +{ + /** @var string */ + private $_itemId; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_itemId = $this->_reader->readUInt16BE(); + } + + /** + * Returns the identifier of the primary item. + * + * @return integer + */ + public function getItemId() + { + return $this->_itemId; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SBGP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SBGP.php new file mode 100644 index 0000000..a7b21eb --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SBGP.php @@ -0,0 +1,132 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: SBGP.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Sample To Group Box</i> table can be used to find the group that a + * sample belongs to and the associated description of that sample group. The + * table is compactly coded with each entry giving the index of the first sample + * of a run of samples with the same sample group descriptor. The sample group + * description ID is an index that refers to a {@link ISO14496_Box_SGPD Sample + * Group Description Box}, which contains entries describing the characteristics + * of each sample group. + * + * There may be multiple instances of this box if there is more than one sample + * grouping for the samples in a track. Each instance of the Sample To Group Box + * has a type code that distinguishes different sample groupings. Within a + * track, there shall be at most one instance of this box with a particular + * grouping type. The associated Sample Group Description shall indicate the + * same value for the grouping type. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SBGP extends ISO14496_Box_Full +{ + /** @var integer */ + private $_groupingType; + + /** @var Array */ + private $_sampleToGroupTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $groupingType = $this->_reader->readUInt32BE(); + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_sampleToGroupTable[$i] = array + ("sampleCount" => + Transform::fromUInt32BE(substr($data, ($i - 1) * 8, 4)), + "groupDescriptionIndex" => + Transform::fromUInt32BE(substr($data, $i * 8 - 4, 4))); + } + + /** + * Returns the grouping type that identifies the type (i.e. criterion used to + * form the sample groups) of the sample grouping and links it to its sample + * group description table with the same value for grouping type. At most one + * occurrence of this box with the same value for groupingType shall exist for + * a track. + * + * @return integer + */ + public function getGroupingType() + { + return $this->_groupingType; + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o sampleCount -- an integer that gives the number of consecutive samples + * with the same sample group descriptor. If the sum of the sample count + * in this box is less than the total sample count, then the reader should + * effectively extend it with an entry that associates the remaining + * samples with no group. It is an error for the total in this box to be + * greater than the sample_count documented elsewhere, and the reader + * behavior would then be undefined. + * o groupDescriptionIndex -- an integer that gives the index of the sample + * group entry which describes the samples in this group. The index ranges + * from 1 to the number of sample group entries in the + * {@link ISO14496_Box_SGPD Sample Group Description Box}, or takes the + * value 0 to indicate that this sample is a member of no group of this + * type. + * + * @return Array + */ + public function getSampleToGroupTable() + { + return $this->_sampleToGroupTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHI.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHI.php new file mode 100644 index 0000000..d63d3f0 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHI.php @@ -0,0 +1,74 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: SCHI.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Scheme Information Box</i> is a container Box that is only interpreted + * by the scheme being used. Any information the encryption system needs is + * stored here. The content of this box is a series of boxes whose type and + * format are defined by the scheme declared in the + * {@link ISO14496_Box_SCHM Scheme Type Box}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SCHI extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHM.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHM.php new file mode 100644 index 0000000..2f361f2 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SCHM.php @@ -0,0 +1,103 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: SCHM.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Scheme Type Box</i> identifies the protection scheme. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SCHM extends ISO14496_Box_Full +{ + /** @var string */ + private $_schemeType; + + /** @var integer */ + private $_schemeVersion; + + /** @var string */ + private $_schemeUri; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_schemeType = $this->_reader->read(4); + $this->_schemeVersion = $this->_reader->readUInt32BE(); + if ($this->hasFlag(1)) + $this->_schemeUri = preg_split + ("/\\x00/", $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset())); + } + + /** + * Returns the code defining the protection scheme. + * + * @return string + */ + public function getSchemeType() { return $this->_schemeType; } + + /** + * Returns the version of the scheme used to create the content. + * + * @return integer + */ + public function getSchemeVersion() { return $this->_schemeVersion; } + + /** + * Returns the optional scheme address to allow for the option of directing + * the user to a web-page if they do not have the scheme installed on their + * system. It is an absolute URI. + * + * @return string + */ + public function getSchemeUri() { return $this->_schemeUri; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SDTP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SDTP.php new file mode 100644 index 0000000..b8f3dc3 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SDTP.php @@ -0,0 +1,130 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: SDTP.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Independent and Disposable Samples Box</i> optional table answers + * three questions about sample dependency: + * 1) does this sample depend on others (is it an I-picture)? + * 2) do no other samples depend on this one? + * 3) does this sample contain multiple (redundant) encodings of the data at + * this time-instant (possibly with different dependencies)? + * + * In the absence of this table: + * 1) the sync sample table answers the first question; in most video codecs, + * I-pictures are also sync points, + * 2) the dependency of other samples on this one is unknown. + * 3) the existence of redundant coding is unknown. + * + * When performing trick modes, such as fast-forward, it is possible to use the + * first piece of information to locate independently decodable samples. + * Similarly, when performing random access, it may be necessary to locate the + * previous sync point or random access recovery point, and roll-forward from + * the sync point or the pre-roll starting point of the random access recovery + * point to the desired point. While rolling forward, samples on which no others + * depend need not be retrieved or decoded. + * + * The value of sampleIsDependedOn is independent of the existence of redundant + * codings. However, a redundant coding may have different dependencies from the + * primary coding; if redundant codings are available, the value of + * sampleDependsOn documents only the primary coding. + * + * A sample dependency Box may also occur in the {@link ISO14496_Box_TRAF Track + * Fragment Box}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SDTP extends ISO14496_Box_Full +{ + /** @var Array */ + private $_sampleDependencyTypeTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + $dataSize = strlen($data); + for ($i = 1; $i <= $dataSize; $i++) + $this->_sampleDependencyTypeTable[$i] = array + ("sampleDependsOn" => (($tmp = Transform::fromInt8 + ($data[$i - 1])) >> 4) & 0x3, + "sampleIsDependedOn" => ($tmp >> 2) & 0x3, + "sampleHasRedundancy" => $tmp & 0x3); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o sampleDependsOn -- takes one of the following four values: + * 0: the dependency of this sample is unknown; + * 1: this sample does depend on others (not an I picture); + * 2: this sample does not depend on others (I picture); + * 3: reserved + * o sampleIsDependedOn -- takes one of the following four values: + * 0: the dependency of other samples on this sample is unknown; + * 1: other samples depend on this one (not disposable); + * 2: no other sample depends on this one (disposable); + * 3: reserved + * o sampleHasRedundancy -- takes one of the following four values: + * 0: it is unknown whether there is redundant coding in this sample; + * 1: there is redundant coding in this sample; + * 2: there is no redundant coding in this sample; + * 3: reserved + * + * @return Array + */ + public function getSampleDependencyTypeTable() + { + return $this->_sampleDependencyTypeTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SGPD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SGPD.php new file mode 100644 index 0000000..ca46806 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SGPD.php @@ -0,0 +1,64 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: SGPD.php 85 2008-04-23 20:21:36Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Sample Group Description Box</i> table gives information about the + * characteristics of sample groups. The descriptive information is any other + * information needed to define or characterize the sample group. + * + * There may be multiple instances of this box if there is more than one sample + * grouping for the samples in a track. Each instance of the Sample Group + * Description box has a type code that distinguishes different sample + * groupings. Within a track, there shall be at most one instance of this box + * with a particular grouping type. The associated Sample To Group shall + * indicate the same value for the grouping type. + * + * @todo Data parsing + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 85 $ + */ +final class ISO14496_Box_SGPD extends ISO14496_Box_Full +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SINF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SINF.php new file mode 100644 index 0000000..605781f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SINF.php @@ -0,0 +1,87 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: SINF.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Protection Scheme Information Box</i> contains all the information + * required both to understand the encryption transform applied and its + * parameters, and also to find other information such as the kind and location + * of the key management system. It also documents the original (unencrypted) + * format of the media. The Protection Scheme Info Box is a container Box. It is + * mandatory in a sample entry that uses a code indicating a protected stream. + * + * When used in a protected sample entry, this box must contain the original + * format box to document the original format. At least one of the following + * signaling methods must be used to identify the protection applied: + * + * a) MPEG-4 systems with IPMP: no other boxes, when IPMP descriptors in MPEG-4 + * systems streams are used; + * b) Standalone IPMP: an {@link ISO14496_Box_IMIF IPMP Info Box}, when IPMP + * descriptors outside MPEG-4 systems are used; + * c) Scheme signaling: a {@link ISO14496_Box_SCHM Scheme Type Box} and + * {@link ISO14496_Box_SCHI Scheme Information Box}, when these are used + * (either both must occur, or neither). + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SINF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SKIP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SKIP.php new file mode 100644 index 0000000..5bc259e --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SKIP.php @@ -0,0 +1,73 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: SKIP.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * 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 + * 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). + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SKIP extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SMHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SMHD.php new file mode 100644 index 0000000..d52ab79 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SMHD.php @@ -0,0 +1,66 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: SMHD.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Sound Media Header Box</i> contains general presentation information, + * independent of the coding, for audio media. This header is used for all + * tracks containing audio. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SMHD extends ISO14496_Box_Full +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STBL.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STBL.php new file mode 100644 index 0000000..06dfee6 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STBL.php @@ -0,0 +1,90 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: STBL.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Sample Table Box</i> contains all the time and data indexing of the + * media samples in a track. Using the tables here, it is possible to locate + * samples in time, determine their type (e.g. I-frame or not), and determine + * their size, container, and offset into that container. + * + * If the track that contains the Sample Table Box references no data, then the + * Sample Table Box does not need to contain any sub-boxes (this is not a very + * useful media track). + * + * If the track that the Sample Table Box is contained in does reference data, + * then the following sub-boxes are required: {@link ISO14496_Box_STSD Sample + * Description}, {@link ISO14496_Box_STSZ Sample Size}, + * {@link ISO14496_Box_STSC Sample To Chunk}, and {@link ISO14496_Box_STCO Chunk + * Offset}. Further, the {@link ISO14496_Box_STSD Sample Description Box} shall + * contain at least one entry. A Sample Description Box is required because it + * contains the data reference index field which indicates which + * {@link ISO14496_Box_DREF Data Reference Box} to use to retrieve the media + * samples. Without the Sample Description, it is not possible to determine + * where the media samples are stored. The {@link ISO14496_Box_STSS Sync Sample + * Box} is optional. If the Sync Sample Box is not present, all samples are sync + * samples. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STBL extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STCO.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STCO.php new file mode 100644 index 0000000..1b8e5cc --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STCO.php @@ -0,0 +1,122 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: STCO.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * 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 + * 64-bit offsets. The latter is useful when managing very large presentations. + * At most one of these variants will occur in any single instance of a sample + * table. + * + * Offsets are file offsets, not the offset into any box within the file (e.g. + * {@link ISO14496_Box_MDAT Media Data Box}). This permits referring to media + * data in files without any box structure. It does also mean that care must be + * taken when constructing a self-contained ISO file with its metadata + * ({@link ISO14496_Box_MOOV Movie Box}) at the front, as the size of the + * {@link ISO14496_Box_MOOV Movie Box} will affect the chunk offsets to the + * media data. + * + * This box variant contains 32-bit offsets. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STCO extends ISO14496_Box_Full +{ + /** @var Array */ + private $_chunkOffsetTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_chunkOffsetTable[$i] = + Transform::fromUInt32BE(substr($data, ($i - 1) * 4, 4)); + } + + /** + * Returns an array of values. Each entry has the entry number as its index + * and a 32 bit integer that gives the offset of the start of a chunk into + * its containing media file as its value. + * + * @return Array + */ + public function getChunkOffsetTable() { return $this->_chunkOffsetTable; } + + /** + * Sets an array of chunk offsets. Each entry must have the entry number as + * its index and a 32 bit integer that gives the offset of the start of a + * chunk into its containing media file as its value. + * + * @param Array $chunkOffsetTable The chunk offset array. + */ + public function setChunkOffsetTable($chunkOffsetTable) + { + $this->_chunkOffsetTable = $chunkOffsetTable; + } + + /** + * Returns the box raw data. + * + * @return string + */ + public function __toString($data = "") + { + $data = Transform::toUInt32BE(count($this->_chunkOffsetTable)); + foreach ($this->_chunkOffsetTable as $chunkOffset) + $data .= Transform::toUInt32BE($chunkOffset); + return parent::__toString($data); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STDP.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STDP.php new file mode 100644 index 0000000..a6eb4d6 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STDP.php @@ -0,0 +1,84 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: STDP.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Degradation Priority Box</i> contains the degradation priority of each + * sample. Specifications derived from this define the exact meaning and + * acceptable range of the priority field. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STDP extends ISO14496_Box_Full +{ + /** @var Array */ + private $_values = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + while ($this->_reader->getOffset() < $this->getOffset() + $this->getSize()) + $this->_values[] = array("priority" => $this->_reader->readUInt16BE()); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o priority: specifies the degradation priority for each sample segment. + * + * @return Array + */ + public function getValues() + { + return $this->_values; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSC.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSC.php new file mode 100644 index 0000000..22c751d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSC.php @@ -0,0 +1,110 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: STSC.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * Samples within the media data are grouped into chunks. Chunks can be of + * different sizes, and the samples within a chunk can have different sizes. + * The <i>Sample To Chunk Box</i> table can be used to find the chunk that + * contains a sample, its position, and the associated sample description. + * + * The table is compactly coded. Each entry gives the index of the first chunk + * of a run of chunks with the same characteristics. By subtracting one entry + * here from the previous one, you can compute how many chunks are in this run. + * You can convert this to a sample count by multiplying by the appropriate + * samplesPerChunk. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STSC extends ISO14496_Box_Full +{ + /** @var Array */ + private $_sampleToChunkTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_sampleToChunkTable[$i] = array + ("firstChunk" => + Transform::fromUInt32BE(substr($data, ($i - 1) * 12, 4)), + "samplesPerChunk" => + Transform::fromUInt32BE(substr($data, $i * 12 - 8, 4)), + "sampleDescriptionIndex" => + Transform::fromUInt32BE(substr($data, $i * 12 - 4, 4))); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o firstChunk -- an integer that gives the index of the first chunk in + * this run of chunks that share the same samplesPerChunk and + * sampleDescriptionIndex; the index of the first chunk in a track has the + * value 1 (the firstChunk field in the first record of this box has the + * value 1, identifying that the first sample maps to the first chunk). + * o samplesPerChunk is an integer that gives the number of samples in each + * of these chunks. + * o sampleDescriptionIndex is an integer that gives the index of the sample + * entry that describes the samples in this chunk. The index ranges from 1 + * to the number of sample entries in the {@link ISO14496_Box_STSD Sample + * Description Box}. + * + * @return Array + */ + public function getSampleToChunkTable() + { + return $this->_sampleToChunkTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSD.php new file mode 100644 index 0000000..cb13973 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSD.php @@ -0,0 +1,56 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: STSD.php 85 2008-04-23 20:21:36Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Sample Description Box</i> table gives detailed information about the + * coding type used, and any initialization information needed for that coding. + * + * @todo Data parsing + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 85 $ + */ +final class ISO14496_Box_STSD extends ISO14496_Box_Full +{ +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSH.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSH.php new file mode 100644 index 0000000..8dd6a6d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSH.php @@ -0,0 +1,117 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: STSH.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Shadow Sync Sample Box</i> table provides an optional set of sync + * samples that can be used when seeking or for similar purposes. In normal + * forward play they are ignored. + * + * Each entry in the Shadow Sync Table consists of a pair of sample numbers. The + * first entry (shadowedSampleNumber) indicates the number of the sample that a + * shadow sync will be defined for. This should always be a non-sync sample + * (e.g. a frame difference). The second sample number (syncSampleNumber) + * indicates the sample number of the sync sample (i.e. key frame) that can be + * used when there is a random access at, or before, the shadowedSampleNumber. + * + * The shadow sync samples are normally placed in an area of the track that is + * not presented during normal play (edited out by means of an edit list), + * though this is not a requirement. The shadow sync table can be ignored and + * the track will play (and seek) correctly if it is ignored (though perhaps not + * optimally). + * + * The Shadow Sync Sample replaces, not augments, the sample that it shadows + * (i.e. the next sample sent is shadowedSampleNumber+1). The shadow sync sample + * is treated as if it occurred at the time of the sample it shadows, having the + * duration of the sample it shadows. + * + * Hinting and transmission might become more complex if a shadow sample is used + * also as part of normal playback, or is used more than once as a shadow. In + * this case the hint track might need separate shadow syncs, all of which can + * get their media data from the one shadow sync in the media track, to allow + * for the different time-stamps etc. needed in their headers. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STSH extends ISO14496_Box_Full +{ + /** @var Array */ + private $_shadowSyncSampleTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 0; $i < $entryCount; $i++) + $this->_shadowSyncSampleTable[$i] = array + ("shadowedSampleNumber" => + Transform::fromUInt32BE(substr($data, ($i - 1) * 8, 4)), + "syncSampleNumber" => + Transform::fromUInt32BE(substr($data, $i * 8 - 4, 4))); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o shadowedSampleNumber - gives the number of a sample for which there is + * an alternative sync sample. + * o syncSampleNumber - gives the number of the alternative sync sample. + * + * @return Array + */ + public function getShadowSyncSampleTable() + { + return $this->_shadowSyncSampleTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSS.php new file mode 100644 index 0000000..ca0d03f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSS.php @@ -0,0 +1,89 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: STSS.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Sync Sample Box</i> provides a compact marking of the random access + * points within the stream. The table is arranged in strictly increasing order + * of sample number. If the sync sample box is not present, every sample is a + * random access point. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STSS extends ISO14496_Box_Full +{ + /** @var Array */ + private $_syncSampleTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_syncSampleTable[$i] = + Transform::fromUInt32BE(substr($data, ($i - 1) * 4, 4)); + } + + /** + * Returns an array of values. Each entry has the entry number as its index + * and an integer that gives the numbers of the samples that are random access + * points in the stream as its value. + * + * @return Array + */ + public function getSyncSampleTable() + { + return $this->_syncSampleTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSZ.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSZ.php new file mode 100644 index 0000000..21ba170 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STSZ.php @@ -0,0 +1,110 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: STSZ.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Sample Size Box</i> contains the sample count and a table giving the + * size in bytes of each sample. This allows the media data itself to be + * unframed. The total number of samples in the media is always indicated in the + * sample count. + * + * There are two variants of the sample size box. The first variant has a fixed + * size 32-bit field for representing the sample sizes; it permits defining a + * constant size for all samples in a track. The second variant permits smaller + * size fields, to save space when the sizes are varying but small. One of these + * boxes must be present; the first version is preferred for maximum + * compatibility. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STSZ extends ISO14496_Box_Full +{ + /** @var integer */ + private $_sampleSize; + + /** @var Array */ + private $_sampleSizeTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_sampleSize = $this->_reader->readUInt32BE(); + $sampleCount = $this->_reader->readUInt32BE(); + if ($this->_sampleSize == 0) { + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $sampleCount; $i++) + $this->_sampleSizeTable[$i] = + Transform::fromUInt32BE(substr($data, ($i - 1) * 4, 4)); + } + } + + /** + * Returns the default sample size. If all the samples are the same size, this + * field contains that size value. If this field is set to 0, then the samples + * have different sizes, and those sizes are stored in the sample size table. + * + * @return integer + */ + public function getSampleSize() { return $this->_sampleSize; } + + /** + * Returns an array of sample sizes specifying the size of a sample, indexed + * by its number. + * + * @return Array + */ + public function getSampleSizeTable() + { + return $this->_sampleSizeTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STTS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STTS.php new file mode 100644 index 0000000..ae0e39c --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STTS.php @@ -0,0 +1,110 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: STTS.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Decoding Time to Sample Box</i> contains a compact version of a table + * that allows indexing from decoding time to sample number. Other tables give + * sample sizes and pointers, from the sample number. Each entry in the table + * gives the number of consecutive samples with the same time delta, and the + * delta of those samples. By adding the deltas a complete time-to-sample map + * may be built. + * + * The Decoding Time to Sample Box contains decode time delta's: DT(n+1) = DT(n) + * + STTS(n) where STTS(n) is the (uncompressed) table entry for sample n. + * + * The sample entries are ordered by decoding time stamps; therefore the deltas + * are all non-negative. + * + * The DT axis has a zero origin; DT(i) = SUM(for j=0 to i-1 of delta(j)), and + * the sum of all deltas gives the length of the media in the track (not mapped + * to the overall timescale, and not considering any edit list). + * + * The {@link ISO14496_Box_ELST Edit List Box} provides the initial CT value if + * it is non-empty (non-zero). + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STTS extends ISO14496_Box_Full +{ + /** @var Array */ + private $_timeToSampleTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $entryCount; $i++) + $this->_timeToSampleTable[$i] = array + ("sampleCount" => + Transform::fromUInt32BE(substr($data, ($i - 1) * 8, 4)), + "sampleDelta" => + Transform::fromUInt32BE(substr($data, $i * 8 - 4, 4))); + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o sampleCount -- an integer that counts the number of consecutive samples + * that have the given duration. + * o sampleDelta -- an integer that gives the delta of these samples in the + * time-scale of the media. + * + * @return Array + */ + public function getTimeToSampleTable() + { + return $this->_timeToSampleTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STZ2.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STZ2.php new file mode 100644 index 0000000..44ab096 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/STZ2.php @@ -0,0 +1,109 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: STZ2.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Sample Size Box</i> contains the sample count and a table giving the + * size in bytes of each sample. This allows the media data itself to be + * unframed. The total number of samples in the media is always indicated in the + * sample count. + * + * There are two variants of the sample size box. This variant permits smaller + * than 32-bit size fields, to save space when the sizes are varying but small. + * One of the boxes must be present; the {@link ISO14496_Box_STSZ another + * variant} is preferred for maximum compatibility. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_STZ2 extends ISO14496_Box_Full +{ + /** @var Array */ + private $_sampleSizeTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_reader->skip(3); + $fieldSize = $this->_reader->readInt8(); + $sampleCount = $this->_reader->readUInt32BE(); + $data = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + for ($i = 1; $i <= $sampleCount; $i++) { + switch ($fieldSize) { + case 4: + $this->_sampleSizeTable[$i] = + (($tmp = Transform::fromInt8($data[$i - 1])) >> 4) & 0xf; + if ($i + 1 < $sampleCount) + $this->_sampleSizeTable[$i++] = $tmp & 0xf; + break; + case 8: + $this->_sampleSizeTable[$i] = Transform::fromInt8($data[$i - 1]); + break; + case 16: + $this->_sampleSizeTable[$i] = + Transform::fromUInt16BE(substr($data, ($i - 1) * 2, 2)); + break; + } + } + } + + /** + * Returns an array of sample sizes specifying the size of a sample, indexed + * by its number. + * + * @return Array + */ + public function getSampleSizeTable() + { + return $this->_sampleSizeTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SUBS.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SUBS.php new file mode 100644 index 0000000..83ae8ac --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/SUBS.php @@ -0,0 +1,138 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: SUBS.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Sub-Sample Information Box</i> is designed to contain sub-sample + * information. + * + * A sub-sample is a contiguous range of bytes of a sample. The specific + * definition of a sub-sample shall be supplied for a given coding system (e.g. + * for ISO/IEC 14496-10, Advanced Video Coding). In the absence of such a + * specific definition, this box shall not be applied to samples using that + * coding system. + * + * If subsample_count is 0 for any entry, then those samples have no subsample + * information and no array follows. The table is sparsely coded; the table + * identifies which samples have sub-sample structure by recording the + * difference in sample-number between each entry. The first entry in the table + * records the sample number of the first sample having sub-sample information. + * + * Note: It is possible to combine subsamplePriority and discardable such that + * when subsamplePriority is smaller than a certain value, discardable is set to + * 1. However, since different systems may use different scales of priority + * values, to separate them is safe to have a clean solution for discardable + * sub-samples. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_SUBS extends ISO14496_Box_Full +{ + /** @var Array */ + private $_subSampleTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $entryCount = $this->_reader->readUInt32BE(); + for ($i = 0; $i < $entryCount; $i++) { + $entry = array(); + $entry["sampleDelta"] = $this->_reader->readUInt32BE(); + $entry["subsamples"] = array(); + if (($subsampleCount = $this->_reader->readUInt16BE()) > 0) { + for ($j = 0; $j < $subsampleCount; $j++) { + $subsample = array(); + if ($this->getVersion() == 1) + $subsample["subsampleSize"] = $this->_reader->readUInt32BE(); + else + $subsample["subsampleSize"] = $this->_reader->readUInt16BE(); + $subsample["subsamplePriority"] = $this->_reader->readInt8(); + $subsample["discardable"] = $this->_reader->readInt8(); + $this->_reader->skip(4); + $entry["subsamples"][] = $subsample; + } + $this->_subSampleTable[] = $entry; + } + } + } + + /** + * Returns an array of values. Each entry is an array containing the following + * keys. + * o sampleDelta -- an integer that specifies the sample number of the + * sample having sub-sample structure. It is coded as the difference + * between the desired sample number, and the sample number indicated in + * the previous entry. If the current entry is the first entry, the value + * indicates the sample number of the first sample having sub-sample + * information, that is, the value is the difference between the sample + * number and zero (0). + * o subsamples -- an array of subsample arrays, each containing the + * following keys. + * o subsampleSize -- an integer that specifies the size, in bytes, of + * the current sub-sample. + * o subsamplePriority -- an integer specifying the degradation priority + * for each sub-sample. Higher values of subsamplePriority, indicate + * sub-samples which are important to, and have a greater impact on, + * the decoded quality. + * o discardable -- equal to 0 means that the sub-sample is required to + * decode the current sample, while equal to 1 means the sub-sample is + * not required to decode the current sample but may be used for + * enhancements, e.g., the sub-sample consists of supplemental + * enhancement information (SEI) messages. + * + * @return Array + */ + public function getSubSampleTable() + { + return $this->_subSampleTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFHD.php new file mode 100644 index 0000000..53faac1 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFHD.php @@ -0,0 +1,190 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: TFHD.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * Each movie fragment can add zero or more <i>Track Fragment Header Box</i> to + * each track; and a track fragment can add zero or more contiguous runs of + * samples. The track fragment header sets up information and defaults used for + * those runs of samples. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TFHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_trackId; + + /** @var integer */ + private $_defaultSampleDescriptionIndex; + + /** @var integer */ + private $_defaultSampleDuration; + + /** @var integer */ + private $_defaultSampleSize; + + /** @var integer */ + private $_defaultSampleFlags; + + /** + * Indicates indicates the presence of the baseDataOffset field. This provides + * an explicit anchor for the data offsets in each track run (see below). If + * not provided, the base-dataoffset for the first track in the movie fragment + * is the position of the first byte of the enclosing Movie Fragment Box, and + * for second and subsequent track fragments, the default is the end of the + * data defined by the preceding fragment. Fragments inheriting their offset + * in this way must all use the same data-reference (i.e., the data for these + * tracks must be in the same file). + */ + const BASE_DATA_OFFSET = 0x1; + + /** + * Indicates the presence of the sampleDescriptionIndex field, which + * over-rides, in this fragment, the default set up in the + * {@link ISO14496_Box_TREX Track Extends Box}. + */ + const SAMPLE_DESCRIPTION_INDEX = 0x2; + + /** Indicates the precense of the defaultSampleDuration field. */ + const DEFAULT_SAMPLE_DURATION = 0x8; + + /** Indicates the precense of the defaultSampleSize field. */ + const DEFAULT_SAMPLE_SIZE = 0x10; + + /** Indicates the precense of the defaultSampleFlags field. */ + const DEFAULT_SAMPLE_DURATION = 0x20; + + /** + * Indicates that the duration provided in either defaultSampleDuration, or by + * the defaultDuration in the {@link ISO14496_Box_TREX Track Extends Box}, is + * empty, i.e. that there are no samples for this time interval. + */ + const DURATION_IS_EMPTY = 0x10000; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + * @todo The sample flags could be parsed further + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_trackId = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::BASE_DATA_OFFSET)) + $this->_baseDataOffset = $this->_reader->readInt64BE(); + if ($this->hasFlag(self::SAMPLE_DESCRIPTION_INDEX)) + $this->_sampleDescriptionIndex = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::DEFAULT_SAMPLE_DURATION)) + $this->_defaultSampleDuration = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::DEFAULT_SAMPLE_SIZE)) + $this->_defaultSampleSize = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::DEFAULT_SAMPLE_FLAGS)) + $this->_defaultSampleFlags = $this->_reader->readUInt32BE(); + } + + /** + * Returns the track identifier. + * + * @return integer + */ + public function getTrackId() + { + return $this->_trackId; + } + + /** + * Returns the base offset to use when calculating data offsets. + * + * @return integer + */ + public function getBaseDataOffset() + { + return $this->_baseDataOffset; + } + + /** + * Returns the sample description index. + * + * @return integer + */ + public function getSampleDescriptionIndex() + { + return $this->_defaultSampleDescriptionIndex; + } + + /** + * Returns the default sample duration. + * + * @return integer + */ + public function getDefaultSampleDuration() + { + return $this->_defaultSampleDuration; + } + + /** + * Returns the default sample size. + * + * @return integer + */ + public function getDefaultSampleSize() + { + return $this->_defaultSampleSize; + } + + /** + * Returns the default sample flags. + * + * @return integer + */ + public function getDefaultSampleFlags() + { + return $this->_defaultSampleFlags; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFRA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFRA.php new file mode 100644 index 0000000..5e73844 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TFRA.php @@ -0,0 +1,142 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: TFRA.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * Each entry contains the location and the presentation time of the random + * accessible sample. It indicates that the sample in the entry can be random + * accessed. Note that not every random accessible sample in the track needs to + * be listed in the table. + * + * The absence of the <i>Track Fragment Random Access Box</i> does not mean that + * all the samples are sync samples. Random access information in the + * {@link ISO14496_Box_TRUN Track Fragment Run Box}, + * {@link ISO14496_Box_TRAF Track Fragment Box} and + * {@link ISO14496_Box_TREX Track Fragment Box} shall be set appropriately + * regardless of the presence of this box. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TFRA extends ISO14496_Box_Full +{ + /** @var integer */ + private $_trackId; + + /** @var Array */ + private $_degradationPriorityTable = array(); + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_trackId = $this->_reader->readUInt32BE(); + + $trafNumberSize = (($tmp = $this->_reader->readUInt32BE()) >> 4) & 0x3; + $trunNumberSize = ($tmp >> 2) & 0x3; + $sampleNumberSize = $tmp & 0x3; + $entryCount = $this->_reader->readUInt32BE(); + for ($i = 1; $i <= $entryCount; $i++) { + $entry = array(); + if ($this->getVersion() == 1) { + $entry["time"] = $this->_reader->readInt64BE(); + $entry["moofOffset"] = $this->_reader->readInt64BE(); + } else { + $entry["time"] = $this->_reader->readUInt32BE(); + $entry["moofOffset"] = $this->_reader->readUInt32BE(); + } + $entry["trafNumber"] = + ($trafNumberSize == 4 ? $this->_reader->readUInt32BE() : + ($trafNumberSize == 8 ? $this->_reader->readInt64BE() : 0)); + $entry["trunNumber"] = + ($trunNumberSize == 4 ? $this->_reader->readUInt32BE() : + ($trunNumberSize == 8 ? $this->_reader->readInt64BE() : 0)); + $entry["sampleNumber"] = + ($sampleNumberSize == 4 ? $this->_reader->readUInt32BE() : + ($sampleNumberSize == 8 ? $this->_reader->readInt64BE() : 0)); + $this->_degradationPriorityTable[$i] = $entry; + } + } + + /** + * Returns the track identifier. + * + * @return integer + */ + public function getTrackId() { return $this->_trackId; } + + /** + * Returns an array of entries. Each entry is an array containing the + * following keys. + * o time -- a 32 or 64 bits integer that indicates the presentation time of + * the random access sample in units defined in the + * {@link ISO14496_Box_MDHD Media Header Box} of the associated track. + * o moofOffset -- a 32 or 64 bits integer that gives the offset of the + * {@link ISO14496_Box_MOOF Movie Fragment Box} used in this entry. Offset + * is the byte-offset between the beginning of the file and the beginning + * of the Movie Fragment Box. + * o trafNumber -- indicates the {@link ISO14496_Box_TRAF Track Fragment + * Box} number that contains the random accessible sample. The number + * ranges from 1 (the first traf is numbered 1) in each Track Fragment + * Box. + * o trunNumber -- indicates the {@link ISO14496_Box_TRUN Track Fragment Run + * Box} number that contains the random accessible sample. The number + * ranges from 1 in each Track Fragment Run Box. + * o sampleNumber -- indicates the sample number that contains the random + * accessible sample. The number ranges from 1 in each Track Fragment Run + * Box. + * + * @return Array + */ + public function getDegradationPriorityTable() + { + return $this->_degradationPriorityTable; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TKHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TKHD.php new file mode 100644 index 0000000..e01013c --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TKHD.php @@ -0,0 +1,177 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: TKHD.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Track Header Box</i> specifies the characteristics of a single track. + * Exactly one Track Header Box is contained in a track. + * + * In the absence of an edit list, the presentation of a track starts at the + * beginning of the overall presentation. An empty edit is used to offset the + * start time of a track. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TKHD extends ISO14496_Box_Full +{ + /** @var integer */ + private $_creationTime; + + /** @var integer */ + private $_modificationTime; + + /** @var integer */ + private $_trackId; + + /** @var integer */ + private $_duration; + + /** @var integer */ + private $_width; + + /** @var integer */ + private $_height; + + /** + * Indicates that the track is enabled. A disabled track is treated as if it + * were not present. + */ + const TRACK_ENABLED = 1; + + /** Indicates that the track is used in the presentation. */ + const TRACK_IN_MOVIE = 2; + + /** Indicates that the track is used when previewing the presentation. */ + const TRACK_IN_PREVIEW = 4; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + if ($this->getVersion() == 1) { + $this->_creationTime = $this->_reader->readInt64BE(); + $this->_modificationTime = $this->_reader->readInt64BE(); + $this->_trackId = $this->_reader->readUInt32BE(); + $this->_reader->skip(4); + $this->_duration = $this->_reader->readInt64BE(); + } else { + $this->_creationTime = $this->_reader->readUInt32BE(); + $this->_modificationTime = $this->_reader->readUInt32BE(); + $this->_trackId = $this->_reader->readUInt32BE(); + $this->_reader->skip(4); + $this->_duration = $this->_reader->readUInt32BE(); + } + $this->_reader->skip(52); + $this->_width = + ((($tmp = $this->_reader->readUInt32BE()) >> 16) & 0xffff) + + ($tmp & 0xffff) / 10; + $this->_height = + ((($tmp = $this->_reader->readUInt32BE()) >> 16) & 0xffff) + + ($tmp & 0xffff) / 10; + } + + /** + * Returns the creation time of this track in seconds since midnight, Jan. 1, + * 1904, in UTC time. + * + * @return integer + */ + public function getCreationTime() { return $this->_creationTime; } + + /** + * Returns the most recent time the track was modified in seconds since + * midnight, Jan. 1, 1904, in UTC time. + * + * @return integer + */ + public function getModificationTime() { return $this->_modificationTime; } + + /** + * Returns a number that uniquely identifies this track over the entire + * life-time of this presentation. Track IDs are never re-used and cannot be + * zero. + * + * @return integer + */ + public function getTrackId() { return $this->_trackId; } + + /** + * Returns the duration of this track (in the timescale indicated in the + * {@link MVHD Movie Header Box}). The value of this field is equal to the sum + * of the durations of all of the track's edits. If there is no edit list, + * then the duration is the sum of the sample durations, converted into the + * timescale in the {@link MVHD Movie Header Box}. If the duration of this + * track cannot be determined then duration is set to all 32-bit maxint. + * + * @return integer + */ + public function getDuration() { return $this->_duration; } + + /** + * Returns the track's visual presentation width. This needs not be the same + * as the pixel width of the images; all images in the sequence are scaled to + * this width, before any overall transformation of the track represented by + * the matrix. The pixel width of the images is the default value. + * + * @return integer + */ + public function getWidth() { return $this->_rate; } + + /** + * Returns the track's visual presentation height. This needs not be the same + * as the pixel height of the images; all images in the sequence are scaled to + * this height, before any overall transformation of the track represented by + * the matrix. The pixel height of the images is the default value. + * + * @return integer + */ + public function getHeight() { return $this->_volume; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAF.php new file mode 100644 index 0000000..9ce8601 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAF.php @@ -0,0 +1,77 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: TRAF.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * Within the <i>Track Fragment Box</i> there is a set of track fragments, zero + * or more per track. The track fragments in turn contain zero or more track + * runs, each of which document a contiguous run of samples for that track. + * + * Within these structures, many fields are optional and can be defaulted. It is + * possible to add empty time to a track using these structures, as well as + * adding samples. Empty inserts can be used in audio tracks doing silence + * suppression, for example. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TRAF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAK.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAK.php new file mode 100644 index 0000000..152ab02 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRAK.php @@ -0,0 +1,83 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: TRAK.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Track Box</i> is a container box for a single track of a presentation. + * A presentation consists of one or more tracks. Each track is independent of + * the other tracks in the presentation and carries its own temporal and spatial + * information. Each track will contain its associated {@link ISO14496_Box_MDIA + * Media Box}. + * + * Tracks are used for two purposes: + * (a) to contain media data (media tracks) and + * (b) to contain packetization information for streaming protocols + * (hint tracks). + * There shall be at least one media track within an ISO file, and all the media + * tracks that contributed to the hint tracks shall remain in the file, even if + * the media data within them is not referenced by the hint tracks; after + * deleting all hint tracks, the entire un-hinted presentation shall remain. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TRAK extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREF.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREF.php new file mode 100644 index 0000000..f5f3815 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREF.php @@ -0,0 +1,81 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: TREF.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>Track Reference Box</i> provides a reference from the containing track + * to another track in the presentation. These references are typed. A {@link + * ISO14496_Box_HINT hint} reference links from the containing hint track to the + * media data that it hints. A content description reference {@link + * ISO14496_Box_CDSC cdsc} links a descriptive or metadata track to the content + * which it describes. + * + * Exactly one Track Reference Box can be contained within the {@link + * ISO14496_Box_TRAK Track Box}. + * + * If this box is not present, the track is not referencing any other track in + * any way. The reference array is sized to fill the reference type box. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TREF extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREX.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREX.php new file mode 100644 index 0000000..854c14e --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TREX.php @@ -0,0 +1,138 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: TREX.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Track Extends Box</i> sets up default values used by the movie + * fragments. By setting defaults in this way, space and complexity can be saved + * in each {@link ISO14496_Box_TRAF Track Fragment Box}. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TREX extends ISO14496_Box_Full +{ + /** @var integer */ + private $_trackId; + + /** @var integer */ + private $_defaultSampleDescriptionIndex; + + /** @var integer */ + private $_defaultSampleDuration; + + /** @var integer */ + private $_defaultSampleSize; + + /** @var integer */ + private $_defaultSampleFlags; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + * @todo The sample flags could be parsed further + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_trackId = $this->_reader->readUInt32BE(); + $this->_defaultSampleDescriptionIndex = $this->_reader->readUInt32BE(); + $this->_defaultSampleDuration = $this->_reader->readUInt32BE(); + $this->_defaultSampleSize = $this->_reader->readUInt32BE(); + $this->_defaultSampleFlags = $this->_reader->readUInt32BE(); + } + + /** + * Returns the default track identifier. + * + * @return integer + */ + public function getTrackId() + { + return $this->_trackId; + } + + /** + * Returns the default sample description index. + * + * @return integer + */ + public function getDefaultSampleDescriptionIndex() + { + return $this->_defaultSampleDescriptionIndex; + } + + /** + * Returns the default sample duration. + * + * @return integer + */ + public function getDefaultSampleDuration() + { + return $this->_defaultSampleDuration; + } + + /** + * Returns the default sample size. + * + * @return integer + */ + public function getDefaultSampleSize() + { + return $this->_defaultSampleSize; + } + + /** + * Returns the default sample flags. + * + * @return integer + */ + public function getDefaultSampleFlags() + { + return $this->_defaultSampleFlags; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRUN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRUN.php new file mode 100644 index 0000000..d6a51d2 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/TRUN.php @@ -0,0 +1,149 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: TRUN.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * Within the {@link ISO14496_Box_TRAF Track Fragment Box}, there are zero or + * more <i>Track Fragment Run Boxes</i>. If the durationIsEmpty flag is set, + * there are no track runs. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_TRUN extends ISO14496_Box_Full +{ + /** @var integer */ + private $_dataOffset; + + /** @var Array */ + private $_samples = array(); + + /** Indicates the precense of the dataOffset field. */ + const DATA_OFFSET = 0x1; + + /** + * Indicates the precense of the firstSampleFlags field; this over-rides the + * default flags for the first sample only. This makes it possible to record + * a group of frames where the first is a key and the rest are difference + * frames, without supplying explicit flags for every sample. If this flag and + * field are used, sampleFlags field shall not be present. + */ + const FIRST_SAMPLE_FLAGS = 0x4; + + /** + * Indicates that each sample has its own duration, otherwise the default is + * used. + */ + const SAMPLE_DURATION = 0x100; + + /** + * Indicates that each sample has its own size, otherwise the default is used. + */ + const SAMPLE_SIZE = 0x200; + + /** + * Indicates that each sample has its own flags, otherwise the default is + * used. + */ + const SAMPLE_FLAGS = 0x400; + + /** + * Indicates that each sample has a composition time offset (e.g. as used for + * I/P/B video in MPEG). + */ + const SAMPLE_COMPOSITION_TIME_OFFSETS = 0x800; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $flags = $this->_flags; + $sampleCount = $this->_reader->readUInt32BE(); + + if ($this->hasFlag(self::DATA_OFFSET)) + $this->_dataOffset = $this->_reader->readInt32BE(); + if ($this->hasFlag(self::FIRST_SAMPLE_FLAGS)) + $this->_flags = $this->_reader->readUInt32BE(); + + for ($i = 0; $i < $sampleCount; $i++) { + $sample = array(); + if ($this->hasFlag(self::SAMPLE_DURATION)) + $sample["duration"] = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::SAMPLE_SIZE)) + $sample["size"] = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::SAMPLE_FLAGS)) + $sample["flags"] = $this->_reader->readUInt32BE(); + if ($this->hasFlag(self::SAMPLE_COMPOSITION_TIME_OFFSET)) + $sample["compositionTimeOffset"] = $this->_reader->readUInt32BE(); + $this->_samples[] = $sample; + $this->_flags = $flags; + } + } + + /** + * Returns the data offset. + * + * @return integer + */ + public function getDataOffset() + { + return $this->_trackId; + } + + /** + * Returns the array of samples. + * + * @return Array + */ + public function getSamples() + { + return $this->_samples; + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/UDTA.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/UDTA.php new file mode 100644 index 0000000..e55d63f --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/UDTA.php @@ -0,0 +1,75 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: UDTA.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box.php"); +/**#@-*/ + +/** + * The <i>User Data Box</i> contains objects that declare user information about + * the containing box and its data (presentation or track). + * + * The User Data Box is a container box for informative user-data. This user + * data is formatted as a set of boxes with more specific box types, which + * declare more precisely their content. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_UDTA extends ISO14496_Box +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader = null, &$options = array()) + { + parent::__construct($reader, $options); + $this->setContainer(true); + + if ($reader === null) + return; + + $this->constructBoxes(); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URL.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URL.php new file mode 100644 index 0000000..593765b --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URL.php @@ -0,0 +1,83 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: URL.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * This box is a URL data reference. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_URL extends ISO14496_Box_Full +{ + /** @var string */ + private $_location; + + /** + * Indicates that the media data is in the same file as the Movie Box + * containing this data reference. + */ + const SELFCONTAINED = 1; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_location = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + } + + /** + * Returns the location. + * + * @return string + */ + public function getLocation() { return $this->_location; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URN.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URN.php new file mode 100644 index 0000000..dc5ae1d --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/URN.php @@ -0,0 +1,94 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: URN.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * This box is a URN data reference. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_URN extends ISO14496_Box_Full +{ + /** @var string */ + private $_name; + + /** @var string */ + private $_location; + + /** + * Indicates that the media data is in the same file as the Movie Box + * containing this data reference. + */ + const SELFCONTAINED = 1; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + list ($this->_name, $this->_location) = preg_split + ("/\\x00/", $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset())); + } + + /** + * Returns the name. + * + * @return string + */ + public function getName() { return $this->_name; } + + /** + * Returns the location. + * + * @return string + */ + public function getLocation() { return $this->_location; } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/VMHD.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/VMHD.php new file mode 100644 index 0000000..b661946 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/VMHD.php @@ -0,0 +1,65 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: VMHD.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * The <i>Video Media Header Box</i> contains general presentation information, + * independent of the coding, for video media. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_VMHD extends ISO14496_Box_Full +{ + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + } +} diff --git a/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/XML.php b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/XML.php new file mode 100644 index 0000000..c2efbc3 --- /dev/null +++ b/libraries/phpvideotoolkit/adapters/ffmpeg-php/php-reader/src/ISO14496/Box/XML.php @@ -0,0 +1,87 @@ +<?php +/** + * PHP Reader Library + * + * Copyright (c) 2008 The PHP Reader Project Workgroup. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the project workgroup nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * 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 + * POSSIBILITY OF SUCH DAMAGE. + * + * @package php-reader + * @subpackage ISO 14496 + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Id: XML.php 92 2008-05-10 13:43:14Z svollbehr $ + */ + +/**#@+ @ignore */ +require_once("ISO14496/Box/Full.php"); +/**#@-*/ + +/** + * 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. + * The {@link ISO14496_Box_BXML Binary XML Box} may only be used when there is a + * single well-defined binarization of the XML for that defined format as + * identified by the handler. + * + * Within an XML box the data is in UTF-8 format unless the data starts with a + * byte-order-mark (BOM), which indicates that the data is in UTF-16 format. + * + * @package php-reader + * @subpackage ISO 14496 + * @author Sven Vollbehr <svollbehr@gmail.com> + * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup + * @license http://code.google.com/p/php-reader/wiki/License New BSD License + * @version $Rev: 92 $ + */ +final class ISO14496_Box_XML extends ISO14496_Box_Full +{ + /** @var string */ + private $_xml; + + /** + * Constructs the class with given parameters and reads box related data from + * the ISO Base Media file. + * + * @param Reader $reader The reader object. + */ + public function __construct($reader, &$options = array()) + { + parent::__construct($reader, $options); + + $this->_xml = $this->_reader->read + ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()); + } + + /** + * Returns the XML data. + * + * @return string + */ + public function getXml() + { + return $this->_xml; + } +} |