Delete old files

git-svn-id: http://php-reader.googlecode.com/svn/branches/zend@167 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
svollbehr
2010-03-04 12:08:55 +00:00
parent 59e4026b0a
commit 2d57b1fd24
76 changed files with 0 additions and 8273 deletions

View File

@@ -1,380 +0,0 @@
<?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:
*
* <li>Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* <li>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.
* <li>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$
*/
/**#@+ @ignore */
require_once("Reader.php");
require_once("ISO14496/Box.php");
/**#@-*/
/**
* This class represents a file in ISO base media file format as described in
* ISO/IEC 14496 Part 12 standard.
*
* The ISO Base Media File Format is designed to contain timed media information
* for a presentation in a flexible, extensible format that facilitates
* interchange, management, editing, and presentation of the media. This
* presentation may be local to the system containing the presentation, or may
* be via a network or other stream delivery mechanism.
*
* The file structure is object-oriented; a file can be decomposed into
* constituent objects very simply, and the structure of the objects inferred
* directly from their type. The file format is designed to be independent of
* any particular network protocol while enabling efficient support for them in
* general.
*
* The ISO Base Media File Format is a base format for media file formats.
*
*
* An overall view of the normal encapsulation structure is provided in the
* following table.
*
* The table shows those boxes that may occur at the top-level in the left-most
* column; indentation is used to show possible containment. Thus, for example,
* a {@link ISO14496_Box_TKHD Track Header Box} is found in a
* {@link ISO14496_Box_TRAK Track Box}, which is found in a
* {@link ISO14496_Box_MOOV Movie Box}. Not all boxes need be used in all files;
* the mandatory boxes are marked with bold typeface. See the description of the
* individual boxes for a discussion of what must be assumed if the optional
* boxes are not present.
*
* User data objects shall be placed only in {@link ISO14496_Box_MOOV Movie} or
* {@link ISO14496_Box_TRAK Track Boxes}, and objects using an extended type may
* be placed in a wide variety of containers, not just the top level.
*
* <ul>
* <li><b>ftyp</b> -- <i>{@link ISO14496_Box_FTYP File Type Box}</i>; file type
* and compatibility
* <li>pdin -- <i>{@link ISO14496_Box_PDIN Progressive Download Information
* Box}</i>
* <li><b>moov</b> -- <i>{@link ISO14496_Box_MOOV Movie Box}</i>; container for
* all the metadata
* <ul>
* <li><b>mvhd</b> -- <i>{@link ISO14496_Box_MVHD Movie Header Box}</i>;
* overall declarations
* <li><b>trak</b> -- <i>{@link ISO14496_Box_TRAK Track Box}</i>; container
* for an individual track or stream
* <ul>
* <li><b>tkhd</b> -- <i>{@link ISO14496_Box_TKHD Track Header Box}</i>;
* overall information about the track
* <li>tref -- <i>{@link ISO14496_Box_TREF Track Reference Box}</i>
* <li>edts -- <i>{@link ISO14496_Box_EDTS Edit Box}</i>
* <ul>
* <li>elst -- <i>{@link ISO14496_Box_ELST Edit List Box}</i>
* </ul>
* <li><b>mdia</b> -- <i>{@link ISO14496_Box_MDIA Media Box}</i>
* <ul>
* <li><b>mdhd</b> -- <i>{@link ISO14496_Box_MDHD Media Header Box}</i>;
* overall information about the media
* <li><b>hdlr</b> -- <i>{@link ISO14496_Box_HDLR Handler Reference
* Box}</i>; declares the media type
* <li><b>minf</b> -- <i>{@link ISO14496_Box_MINF Media Information
* Box}</i>
* <ul>
* <li>vmhd -- <i>{@link ISO14496_Box_VMHD Video Media Header Box}</i>;
* overall information (video track only)
* <li>smhd -- <i>{@link ISO14496_Box_SMHD Sound Media Header Box}</i>;
* overall information (sound track only)
* <li>hmhd -- <i>{@link ISO14496_Box_HMHD Hint Media Header Box}</i>;
* overall information (hint track only)
* <li>nmhd -- <i>{@link ISO14496_Box_NMHD Null Media Header Box}</i>;
* overall information (some tracks only)
* <li><b>dinf</b> -- <i>{@link ISO14496_Box_DINF Data Information
* Box}</i>
* <ul>
* <li><b>dref</b> -- <i>{@link ISO14496_Box_DREF Data Reference
* Box}</i>
* </ul>
* <li><b>stbl</b> -- <i>{@link ISO14496_Box_STBL Sample Table Box}</i>
* <ul>
* <li><b>stsd</b> -- <i>{@link ISO14496_Box_STSD Sample Descriptions
* Box}</i>
* <li><b>stts</b> -- <i>{@link ISO14496_Box_STTS Decoding Time To
* Sample Box}</i>
* <li>ctts -- <i>{@link ISO14496_Box_CTTS Composition Time To Sample
* Box}</i>
* <li><b>stsc</b> -- <i>{@link ISO14496_Box_STSC Sample To Chunk
* Box}</i>
* <li>stsz -- <i>{@link ISO14496_Box_STSZ Sample Size Box}</i>
* <li>stz2 -- <i>{@link ISO14496_Box_STZ2 Compact Sample Size
* Box}</i>
* <li><b>stco</b> -- <i>{@link ISO14496_Box_STCO Chunk Offset
* Box}</i>; 32-bit
* <li>co64 -- <i>{@link ISO14496_Box_CO64 Chunk Ooffset Box}</i>;
* 64-bit
* <li>stss -- <i>{@link ISO14496_Box_STSS Sync Sample Table Box}</i>
* <li>stsh -- <i>{@link ISO14496_Box_STSH Shadow Sync Sample Table
* Box}</i>
* <li>padb -- <i>{@link ISO14496_Box_PADB Padding Bits Box}</i>
* <li>stdp -- <i>{@link ISO14496_Box_STDP Sample Degradation Priority
* Box}</i>
* <li>sdtp -- <i>{@link ISO14496_Box_SDTP Independent and Disposable
* Samples Box}</i>
* <li>sbgp -- <i>{@link ISO14496_Box_SBGP Sample To Group Box}</i>
* <li>sgpd -- <i>{@link ISO14496_Box_SGPD Sample Group
* Description}</i>
* <li>subs -- <i>{@link ISO14496_Box_SUBS Sub-Sample Information
* Box}</i>
* </ul>
* </ul>
* </ul>
* </ul>
* <li>mvex -- <i>{@link ISO14496_Box_MVEX Movie Extends Box}</i>
* <ul>
* <li>mehd -- <i>{@link ISO14496_Box_MEHD Movie Extends Header Box}</i>
* <li><b>trex</b> -- <i>{@link ISO14496_Box_TREX Track Extends Box}</i>
* </ul>
* <li>ipmc -- <i>{@link ISO14496_Box_IPMC IPMP Control Box}</i>
* </ul>
* <li>moof -- <i>{@link ISO14496_Box_MOOF Movie Fragment Box}</i>
* <ul>
* <li><b>mfhd</b> -- <i>{@link ISO14496_Box_MFHD Movie Fragment Header
* Box}</i>
* <li>traf -- <i>{@link ISO14496_Box_TRAF Track Fragment Box}</i>
* <ul>
* <li><b>tfhd</b> -- <i>{@link ISO14496_Box_TFHD Track Fragment Header
* Box}</i>
* <li>trun -- <i>{@link ISO14496_Box_TRUN Track Fragment Run}</i>
* <li>sdtp -- <i>{@link ISO14496_Box_SDTP Independent and Disposable
* Samples}</i>
* <li>sbgp -- <i>{@link ISO14496_Box_SBGP !SampleToGroup Box}</i>
* <li>subs -- <i>{@link ISO14496_Box_SUBS Sub-Sample Information Box}</i>
* </ul>
* </ul>
* <li>mfra -- <i>{@link ISO14496_Box_MFRA Movie Fragment Random Access Box}</i>
* <ul>
* <li>tfra -- <i>{@link ISO14496_Box_TFRA Track Fragment Random Access
* Box}</i>
* <li><b>mfro</b> -- <i>{@link ISO14496_Box_MFRO Movie Fragment Random Access
* Offset Box}</i>
* </ul>
* <li>mdat -- <i>{@link ISO14496_Box_MDAT Media Data Box}</i>
* <li>free -- <i>{@link ISO14496_Box_FREE Free Space Box}</i>
* <li>skip -- <i>{@link ISO14496_Box_SKIP Free Space Box}</i>
* <ul>
* <li>udta -- <i>{@link ISO14496_Box_UDTA User Data Box}</i>
* <ul>
* <li>cprt -- <i>{@link ISO14496_Box_CPRT Copyright Box}</i>
* </ul>
* </ul>
* <li>meta -- <i>{@link ISO14496_Box_META The Meta Box}</i>
* <ul>
* <li><b>hdlr</b> -- <i>{@link ISO14496_Box_HDLR Handler Reference Box}</i>;
* declares the metadata type
* <li>dinf -- <i>{@link ISO14496_Box_DINF Data Information Box}</i>
* <ul>
* <li>dref -- <i>{@link ISO14496_Box_DREF Data Reference Box}</i>; declares
* source(s) of metadata items
* </ul>
* <li>ipmc -- <i>{@link ISO14496_Box_IPMC IPMP Control Box}</i>
* <li>iloc -- <i>{@link ISO14496_Box_ILOC Item Location Box}</i>
* <li>ipro -- <i>{@link ISO14496_Box_IPRO Item Protection Box}</i>
* <ul>
* <li>sinf -- <i>{@link ISO14496_Box_SINF Protection Scheme Information
* Box}</i>
* <ul>
* <li>frma -- <i>{@link ISO14496_Box_FRMA Original Format Box}</i>
* <li>imif -- <i>{@link ISO14496_Box_IMIF IPMP Information Box}</i>
* <li>schm -- <i>{@link ISO14496_Box_SCHM Scheme Type Box}</i>
* <li>schi -- <i>{@link ISO14496_Box_SCHI Scheme Information Box}</i>
* </ul>
* </ul>
* <li>iinf -- <i>{@link ISO14496_Box_IINF Item Information Box}</i>
* <ul>
* <li>infe -- <i>{@link ISO14496_Box_INFE Item Information Entry Box}</i>
* </ul>
* <li>xml -- <i>{@link ISO14496_Box_XML XML Box}</i>
* <li>bxml -- <i>{@link ISO14496_Box_BXML Binary XML Box}</i>
* <li>pitm -- <i>{@link ISO14496_Box_PITM Primary Item Reference Box}</i>
* </ul>
* </ul>
*
* There are two non-standard extensions to the ISO 14496 standard that add the
* ability to include file meta information. Both the boxes reside under
* moov.udta.meta.
*
* <ul>
* <li><i>moov</i> -- <i>{@link ISO14496_Box_MOOV Movie Box}</i>; container for
* all the metadata
* <li><i>udta</i> -- <i>{@link ISO14496_Box_UDTA User Data Box}</i>
* <li><i>meta</i> -- <i>{@link ISO14496_Box_META The Meta Box}</i>
* <ul>
* <li>ilst -- <i>{@link ISO14496_Box_ILST The iTunes/iPod Tag Container
* Box}</i>
* <li>id32 -- <i>{@link ISO14496_Box_ID32 The ID3v2 Box}</i>
* </ul>
* </ul>
*
* @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$
*/
final class ISO14496 extends ISO14496_Box
{
/** @var string */
private $_filename;
/**
* Constructs the ISO14496 class with given file and options.
*
* The following options are currently recognized:
* o base -- Indicates that only boxes with the given base path are parsed
* from the ISO base media file. Parsing all boxes can possibly have a
* significant impact on running time. Base path is a list of nested boxes
* separated by a dot.
* o readonly -- Indicates that the file is read from a temporary location
* or another source it cannot be written back to. The use of base option
* implies readonly option.
*
* @param string $filename The path to the file or file descriptor of an
* opened file.
* @param Array $options The options array.
*/
public function __construct($filename, $options = array())
{
$this->_reader = new Reader($this->_filename = $filename);
if (isset($options["base"]))
$options["readonly"] = true;
$this->setOptions($options);
$this->setOffset(0);
$this->setSize($this->_reader->getSize());
$this->setType("file");
$this->setContainer(true);
$this->constructBoxes();
}
/**
* Writes the changes back to the original media file.
*
* Please note: currently the method writes only ID32 and ILST boxes to
* <i>moov.udta.meta</i>. Changes to any other box are discarded. Write
* operation will overwrite <i>moov.udta</i>, if found.
*/
public function write()
{
if (!isset($this->moov->udta->meta->ilst) &&
!isset($this->moov->udta->meta->id32))
throw new ISO14496_Exception("Nothing to write");
if ($this->getOption("readonly", false) !== false)
throw new ISO14496_Exception("File is read only");
if (($fd = fopen($this->_filename, file_exists
($this->_filename) ? "r+b" : "wb")) === false)
throw new ISO14496_Exception
("Unable to open file for writing: " . $filename);
$this->moov->udta->meta->hdlr->setHandlerType("mdir");
/* Calculate start position */
$mark = ($this->moov->udta->getOffset() > 0 ?
$this->moov->udta->getOffset() :
$this->moov->getOffset() + $this->moov->getSize());
/* Calculate file size */
fseek($fd, 0, SEEK_END);
$oldFileSize = ftell($fd);
$newFileSize = $oldFileSize -
($this->moov->udta->getOffset() > 0 ? $this->moov->udta->getSize() : 0) -
(isset($this->moov->udta->meta->free) ?
$this->moov->udta->meta->free->getSize() : 0) +
strlen($this->moov->udta);
/* Calculate free space size */
if ($oldFileSize < $newFileSize) {
// Add free space to the file calculated using the following logaritmic
// equation: log(0.2(x + 10)), ranging from 1k to 9k given the file size
// of 0..4G
$this->moov->udta->meta->free->setSize
(ceil(log(0.2 * ($newFileSize / 1024 + 10), 10) * 1024));
ftruncate($fd, $newFileSize += $this->moov->udta->meta->free->getSize());
// Move data to the end of the file
for ($i = 1, $cur = $oldFileSize; $cur > $mark; $cur -= 1024, $i++) {
fseek($fd, -(($i * 1024) +
($excess = $cur - 1024 > $mark ? 0 : $cur - $mark - 1024) +
($newFileSize - $oldFileSize)), SEEK_END);
$buffer = fread($fd, 1024);
fseek($fd, -(($i * 1024) + $excess), SEEK_END);
fwrite($fd, $buffer, 1024);
}
// Update stco/co64 to correspond the data move
foreach ($this->moov->getBoxesByIdentifier("trak") as $trak) {
$chunkOffsetBox =
(isset($trak->mdia->minf->stbl->stco) ?
$trak->mdia->minf->stbl->stco : $trak->mdia->minf->stbl->co64);
$chunkOffsetTable = $chunkOffsetBox->getChunkOffsetTable();
$chunkOffsetTableCount = count($chunkOffsetTable);
$chunkOffsetDelta = $newFileSize - $oldFileSize;
for ($i = 1; $i <= $chunkOffsetTableCount; $i++)
$chunkOffsetTable[$i] += $chunkOffsetDelta;
$chunkOffsetBox->setChunkOffsetTable($chunkOffsetTable);
fseek($fd, $chunkOffsetBox->getOffset());
fwrite($fd, $chunkOffsetBox, $chunkOffsetBox->getSize());
}
}
else
$this->moov->udta->meta->free->setSize($oldFileSize - $newFileSize);
/* Update the target box */
fseek($fd, $mark);
$this->moov->udta->setSize(fwrite($fd, $this->moov->udta));
/* Update the parent box */
fseek($fd, $this->moov->getOffset());
fwrite($fd, Transform::toUInt32BE($this->moov->getSize()));
fclose($fd);
}
/**
* Returns the raw data of the ISO14496 file.
*
* @return string
*/
public function __toString($data = "")
{
if ($this->isContainer())
foreach ($this->getBoxes() as $name => $boxes)
foreach ($boxes as $box)
$data .= $box;
return $data;
}
}

View File

@@ -1,497 +0,0 @@
<?php
/**
* PHP Reader Library
*
* Copyright (c) 2008-2009 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-2009 PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Id$
*/
/**#@+ @ignore */
require_once("ISO14496/Exception.php");
/**#@-*/
/**
* A base class for all ISO 14496-12 boxes.
*
* @package php-reader
* @subpackage ISO 14496
* @author Sven Vollbehr <svollbehr@gmail.com>
* @copyright Copyright (c) 2008-2009 PHP Reader Project Workgroup
* @license http://code.google.com/p/php-reader/wiki/License New BSD License
* @version $Rev$
*/
class ISO14496_Box
{
/**
* The reader object.
*
* @var Reader
*/
protected $_reader;
/** @var Array */
private $_options;
/** @var integer */
private $_offset = -1;
/** @var integer */
private $_size = -1;
/** @var string */
private $_type;
/** @var ISO14496_Box */
private $_parent = null;
/** @var boolean */
private $_container = false;
/** @var Array */
private $_boxes = array();
/** @var Array */
private static $_path = array();
/**
* Constructs the class with given parameters and options.
*
* @param Reader $reader The reader object.
* @param Array $options The options array.
*/
public function __construct($reader, &$options = array())
{
if (($this->_reader = $reader) === null) {
$this->_type = strtolower(substr(get_class($this), -4));
} else {
$this->_offset = $this->_reader->getOffset();
$this->_size = $this->_reader->readUInt32BE();
$this->_type = $this->_reader->read(4);
if ($this->_size == 1)
$this->_size = $this->_reader->readInt64BE();
if ($this->_size == 0)
$this->_size = $this->_reader->getSize() - $this->_offset;
if ($this->_type == "uuid")
$this->_type = $this->_reader->readGUID();
}
$this->_options = &$options;
}
/**
* Returns the options array.
*
* @return Array
*/
public final function getOptions() { return $this->_options; }
/**
* Returns the given option value, or the default value if the option is not
* defined.
*
* @param string $option The name of the option.
* @param mixed $defaultValue The default value to be returned.
*/
public final function getOption($option, $defaultValue = false)
{
if (isset($this->_options[$option]))
return $this->_options[$option];
return $defaultValue;
}
/**
* Sets the options array. See {@link ISO14496} class for available options.
*
* @param Array $options The options array.
*/
public final function setOptions(&$options) { $this->_options = &$options; }
/**
* Sets the given option the given value.
*
* @param string $option The name of the option.
* @param mixed $value The value to set for the option.
*/
public final function setOption($option, $value)
{
$this->_options[$option] = $value;
}
/**
* Returns the file offset to box start, or -1 if the box was created on heap.
*
* @return integer
*/
public final function getOffset() { return $this->_offset; }
/**
* Sets the file offset where the box starts.
*
* @param integer $offset The file offset to box start.
*/
public final function setOffset($offset) { $this->_offset = $offset; }
/**
* Returns the box size in bytes, including the size and type header,
* fields, and all contained boxes, or -1 if the box was created on heap.
*
* @return integer
*/
public final function getSize() { return $this->_size; }
/**
* Sets the box size. The size must include the size and type header,
* fields, and all contained boxes.
*
* The method will propagate size change to box parents.
*
* @param integer $size The box size.
*/
public final function setSize($size)
{
if ($this->_parent !== null)
$this->_parent->setSize
(($this->_parent->getSize() > 0 ? $this->_parent->getSize() : 0) +
$size - ($this->_size > 0 ? $this->_size : 0));
$this->_size = $size;
}
/**
* Returns the box type.
*
* @return string
*/
public final function getType() { return $this->_type; }
/**
* Sets the box type.
*
* @param string $type The box type.
*/
public final function setType($type) { $this->_type = $type; }
/**
* Returns the parent box containing this box.
*
* @return ISO14496_Box
*/
public final function getParent() { return $this->_parent; }
/**
* Sets the parent containing box.
*
* @param ISO14496_Box $parent The parent box.
*/
public function setParent(&$parent) { $this->_parent = $parent; }
/**
* Returns a boolean value corresponding to whether the box is a container.
*
* @return boolean
*/
public final function isContainer() { return $this->_container; }
/**
* Returns a boolean value corresponding to whether the box is a container.
*
* @return boolean
*/
public final function getContainer() { return $this->_container; }
/**
* Sets whether the box is a container.
*
* @param boolean $container Whether the box is a container.
*/
protected final function setContainer($container)
{
$this->_container = $container;
}
/**
* Reads and constructs the boxes found within this box.
*
* @todo Does not parse iTunes internal ---- boxes.
*/
protected final function constructBoxes($defaultclassname = "ISO14496_Box")
{
$base = $this->getOption("base", "");
if ($this->getType() != "file")
self::$_path[] = $this->getType();
$path = implode(self::$_path, ".");
while (true) {
$offset = $this->_reader->getOffset();
if ($offset >= $this->_offset + $this->_size)
break;
$size = $this->_reader->readUInt32BE();
$type = rtrim($this->_reader->read(4), " ");
if ($size == 1)
$size = $this->_reader->readInt64BE();
if ($size == 0)
$size = $this->_reader->getSize() - $offset;
if (preg_match("/^\xa9?[a-z0-9]{3,4}$/i", $type) &&
substr($base, 0, min(strlen($base), strlen
($tmp = $path . ($path ? "." : "") . $type))) ==
substr($tmp, 0, min(strlen($base), strlen($tmp))))
{
$this->_reader->setOffset($offset);
if (@fopen($filename = "ISO14496/Box/" . strtoupper($type) . ".php",
"r", true) !== false)
require_once($filename);
if (class_exists($classname = "ISO14496_Box_" . strtoupper($type)))
$box = new $classname($this->_reader, $this->_options);
else
$box = new $defaultclassname($this->_reader, $this->_options);
$box->setParent($this);
if (!isset($this->_boxes[$box->getType()]))
$this->_boxes[$box->getType()] = array();
$this->_boxes[$box->getType()][] = $box;
}
$this->_reader->setOffset($offset + $size);
}
array_pop(self::$_path);
}
/**
* Checks whether the box given as an argument is present in the file. Returns
* <var>true</var> if one or more boxes are present, <var>false</var>
* otherwise.
*
* @param string $identifier The box identifier.
* @return boolean
* @throws ISO14496_Exception if called on a non-container box
*/
public final function hasBox($identifier)
{
if (!$this->isContainer())
throw new ISO14496_Exception("Box not a container");
return isset($this->_boxes[$identifier]);
}
/**
* Returns all the boxes the file contains as an associate array. The box
* identifiers work as keys having an array of boxes as associated value.
*
* @return Array
* @throws ISO14496_Exception if called on a non-container box
*/
public final function getBoxes()
{
if (!$this->isContainer())
throw new ISO14496_Exception("Box not a container");
return $this->_boxes;
}
/**
* Returns an array of boxes matching the given identifier or an empty array
* if no boxes matched the identifier.
*
* The identifier may contain wildcard characters "*" and "?". The asterisk
* matches against zero or more characters, and the question mark matches any
* single character.
*
* Please note that one may also use the shorthand $obj->identifier to access
* the first box with the identifier given. Wildcards cannot be used with
* the shorthand and they will not work with user defined uuid types.
*
* @param string $identifier The box identifier.
* @return Array
* @throws ISO14496_Exception if called on a non-container box
*/
public final function getBoxesByIdentifier($identifier)
{
if (!$this->isContainer())
throw new ISO14496_Exception("Box not a container");
$matches = array();
$searchPattern = "/^" .
str_replace(array("*", "?"), array(".*", "."), $identifier) . "$/i";
foreach ($this->_boxes as $identifier => $boxes)
if (preg_match($searchPattern, $identifier))
foreach ($boxes as $box)
$matches[] = $box;
return $matches;
}
/**
* Removes any boxes matching the given box identifier.
*
* The identifier may contain wildcard characters "*" and "?". The asterisk
* matches against zero or more characters, and the question mark matches any
* single character.
*
* One may also use the shorthand unset($obj->identifier) to achieve the same
* result. Wildcards cannot be used with the shorthand method.
*
* @param string $identifier The box identifier.
* @throws ISO14496_Exception if called on a non-container box
*/
public final function removeBoxesByIdentifier($identifier)
{
if (!$this->isContainer())
throw new ISO14496_Exception("Box not a container");
$searchPattern = "/^" .
str_replace(array("*", "?"), array(".*", "."), $identifier) . "$/i";
foreach ($this->_objects as $identifier => $objects)
if (preg_match($searchPattern, $identifier))
unset($this->_objects[$identifier]);
}
/**
* Adds a new box into the current box and returns it.
*
* @param ISO14496_Box $box The box to add
* @return ISO14496_Box
* @throws ISO14496_Exception if called on a non-container box
*/
public final function addBox($box)
{
if (!$this->isContainer())
throw new ISO14496_Exception("Box not a container");
$box->setParent($this);
$box->setOptions($this->_options);
if (!$this->hasBox($box->getType()))
$this->_boxes[$box->getType()] = array();
return $this->_boxes[$box->getType()][] = $box;
}
/**
* Removes the given box.
*
* @param ISO14496_Box $box The box to remove
* @throws ISO14496_Exception if called on a non-container box
*/
public final function removeBox($box)
{
if (!$this->isContainer())
throw new ISO14496_Exception("Box not a container");
if ($this->hasBox($box->getType()))
foreach ($this->_boxes[$box->getType()] as $key => $value)
if ($box === $value)
unset($this->_boxes[$box->getType()][$key]);
}
/**
* Magic function so that $obj->value will work. If called on a container box,
* the method will first attempt to return the first contained box that
* matches the identifier, and if not found, invoke a getter method.
*
* If there are no boxes or getter methods with given name, the method
* attempts to create a frame with given identifier.
*
* If none of these work, an exception is thrown.
*
* @param string $name The box or field name.
* @return mixed
*/
public function __get($name)
{
if ($this->isContainer() && isset($this->_boxes[$name]))
return $this->_boxes[$name][0];
if (method_exists($this, "get" . ucfirst($name)))
return call_user_func(array($this, "get" . ucfirst($name)));
if (@fopen($filename = "ISO14496/Box/" .
strtoupper($name) . ".php", "r", true) !== false)
require_once($filename);
if (class_exists($classname = "ISO14496_Box_" . strtoupper($name)))
return $this->addBox(new $classname());
throw new ISO14496_Exception("Unknown box/field: " . $name);
}
/**
* Magic function so that assignments with $obj->value will work.
*
* @param string $name The field name.
* @param string $value The field value.
* @return mixed
*/
public function __set($name, $value)
{
if (method_exists($this, "set" . ucfirst($name)))
call_user_func(array($this, "set" . ucfirst($name)), $value);
else throw new ISO14496_Exception("Unknown field: " . $name);
}
/**
* Magic function so that isset($obj->value) will work. This method checks
* whether the box is a container and contains a box that matches the
* identifier.
*
* @param string $name The box name.
* @return boolean
*/
public function __isset($name)
{
return ($this->isContainer() && isset($this->_boxes[$name]));
}
/**
* Magic function so that unset($obj->value) will work. This method removes
* all the boxes from this container that match the identifier.
*
* @param string $name The box name.
*/
public function __unset($name)
{
if ($this->isContainer())
unset($this->_boxes[$name]);
}
/**
* Returns the box raw data.
*
* @return string
*/
public function __toString($data = "")
{
if ($this->isContainer())
foreach ($this->getBoxes() as $name => $boxes)
foreach ($boxes as $box)
$data .= $box;
$size = strlen($data) + 8;
if ($size > 0xffffffff)
$size += 8;
if (strlen($this->_type) > 4)
$size += 16;
return ($size > 0xffffffff ?
Transform::toUInt32BE(1) : Transform::toUInt32BE($size)) .
(strlen($this->_type) > 4 ? "uuid" : $this->_type) .
($size > 0xffffffff ? Transform::toInt64BE($size) : "") .
(strlen($this->_type) > 4 ? Transform::toGUID($this->_type) : "") . $data;
}
}

View File

@@ -1,86 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,80 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,122 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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);
}
}

View File

@@ -1,96 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,99 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,71 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,88 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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)));
}
}

View File

@@ -1,76 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,108 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,76 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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));
}
}

View File

@@ -1,78 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,142 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,124 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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);
}
}

View File

@@ -1,150 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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");
}
}

View File

@@ -1,81 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,110 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,131 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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);
}
}

View File

@@ -1,87 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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)));
}
}

View File

@@ -1,134 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,281 +0,0 @@
<?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$
*/
/**#@+ @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$
* @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$
* @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$
* @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)));
require_once("ISO14496/Exception.php");
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);
}
}

View File

@@ -1,91 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,131 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,56 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
final class ISO14496_Box_IPMC extends ISO14496_Box_Full
{
}

View File

@@ -1,82 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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)));
}
}

View File

@@ -1,66 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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);
}
}

View File

@@ -1,136 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,71 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,84 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,90 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,80 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,85 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,85 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,71 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,81 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,72 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,74 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,166 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,55 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
final class ISO14496_Box_NMHD extends ISO14496_Box_Full
{
}

View File

@@ -1,57 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
final class ISO14496_Box_PADB extends ISO14496_Box_Full
{
}

View File

@@ -1,97 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,85 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,132 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,74 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,103 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,130 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,64 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
final class ISO14496_Box_SGPD extends ISO14496_Box_Full
{
}

View File

@@ -1,87 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,73 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,66 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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);
}
}

View File

@@ -1,90 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,122 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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);
}
}

View File

@@ -1,84 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,110 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,56 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
final class ISO14496_Box_STSD extends ISO14496_Box_Full
{
}

View File

@@ -1,117 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,89 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,110 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,110 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,109 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,138 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,194 +0,0 @@
<?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$
*/
/**#@+ @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>
* @author Anders Ödlund <odlund@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$
*/
final class ISO14496_Box_TFHD extends ISO14496_Box_Full
{
/** @var integer */
private $_trackId;
/** @var integer */
private $_baseDataOffset;
/** @var integer */
private $_sampleDescriptionIndex;
/** @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_FLAGS = 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->_sampleDescriptionIndex;
}
/**
* 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;
}
}

View File

@@ -1,142 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,177 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,77 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,83 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,81 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,138 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,150 +0,0 @@
<?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$
*/
/**#@+ @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>
* @author Anders Ödlund <odlund@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$
*/
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_OFFSETS))
$sample["compositionTimeOffset"] = $this->_reader->readUInt32BE();
$this->_samples[] = $sample;
$this->_flags = $flags;
}
}
/**
* Returns the data offset.
*
* @return integer
*/
public function getDataOffset()
{
return $this->_dataOffset;
}
/**
* Returns the array of samples.
*
* @return Array
*/
public function getSamples()
{
return $this->_samples;
}
}

View File

@@ -1,75 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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();
}
}

View File

@@ -1,83 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,94 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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; }
}

View File

@@ -1,65 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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);
}
}

View File

@@ -1,87 +0,0 @@
<?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$
*/
/**#@+ @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$
*/
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;
}
}

View File

@@ -1,51 +0,0 @@
<?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$
*/
/**
* The ISO14496_Exception is thrown whenever an error occurs within the
* {@link ISO14496} class.
*
* @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$
*/
class ISO14496_Exception extends Exception
{
}