- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_ExtendedHeader extends ID3_Object
-{
- /**
- * A flag to denote that the present tag is an update of a tag found earlier
- * in the present file or stream. If frames defined as unique are found in
- * the present tag, they are to override any corresponding ones found in the
- * earlier tag. This flag has no corresponding data.
- *
- * @since ID3v2.4.0
- */
- const UPDATE = 64;
-
- /**
- * @since ID3v2.4.0 A flag to denote that a CRC-32 data is included in the
- * extended header. The CRC is calculated on all the data between the header
- * and footer as indicated by the header's tag length field, minus the
- * extended header. Note that this includes the padding (if there is any), but
- * excludes the footer. The CRC-32 is stored as an 35 bit synchsafe integer,
- * leaving the upper four bits always zeroed.
- *
- * @since ID3v2.3.0 The CRC is calculated before unsynchronisation on the data
- * between the extended header and the padding, i.e. the frames and only the
- * frames.
- */
- const CRC32 = 32;
-
- /**
- * A flag to denote whether or not the tag has restrictions applied on it.
- *
- * @since ID3v2.4.0
- */
- const RESTRICTED = 16;
-
- /** @var integer */
- private $_size;
-
- /** @var integer */
- private $_flags = 0;
-
- /** @var integer */
- private $_padding;
-
- /** @var integer */
- private $_crc;
-
- /** @var integer */
- private $_restrictions = 0;
-
- /**
- * Constructs the class with given parameters and reads object related data
- * from the ID3v2 tag.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $offset = $this->_reader->getOffset();
- $this->_size = $this->_reader->readUInt32BE();
-
- /* ID3v2.3.0 ExtendedHeader */
- if ($this->getOption("version", 4) < 4) {
- if ($this->_reader->readUInt16BE() == 0x8000)
- $this->_flags = self::CRC32;
- $this->_padding = $this->_reader->readUInt32BE();
- if ($this->hasFlag(self::CRC32))
- $this->_crc = Transform::readUInt32BE();
- }
-
- /* ID3v2.4.0 ExtendedHeader */
- else {
- $this->_size = $this->_decodeSynchsafe32($this->_size);
- $this->_reader->skip(1);
- $this->_flags = $this->_reader->readInt8();
- if ($this->hasFlag(self::UPDATE))
- $this->_reader->skip(1);
- if ($this->hasFlag(self::CRC32)) {
- $this->_reader->skip(1);
- $this->_crc =
- Transform::fromInt8($this->_reader->read(1)) * (0xfffffff + 1) +
- _decodeSynchsafe32(Transform::fromUInt32BE($this->_reader->read(4)));
- }
- if ($this->hasFlag(self::RESTRICTED)) {
- $this->_reader->skip(1);
- $this->_restrictions = $this->_reader->readInt8(1);
- }
- }
- }
-
- /**
- * Returns the extended header size in bytes.
- *
- * @return integer
- */
- public function getSize() { return $this->_size; }
-
- /**
- * Checks whether or not the flag is set. Returns true if the flag
- * is set, false otherwise.
- *
- * @param integer $flag The flag to query.
- * @return boolean
- */
- public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; }
-
- /**
- * Returns the flags byte.
- *
- * @return integer
- */
- public function getFlags($flags) { return $this->_flags; }
-
- /**
- * Sets the flags byte.
- *
- * @param integer $flags The flags byte.
- */
- public function setFlags($flags) { $this->_flags = $flags; }
-
- /**
- * Returns the CRC-32 data.
- *
- * @return integer
- */
- public function getCrc()
- {
- if ($this->hasFlag(self::CRC32))
- return $this->_crc;
- return false;
- }
-
- /**
- * Sets whether the CRC-32 should be generated upon tag write.
- *
- * @param boolean $useCrc Whether CRC-32 should be generated.
- */
- public function useCrc($useCrc)
- {
- if ($useCrc)
- $this->setFlags($this->getFlags() | self::CRC32);
- else
- $this->setFlags($this->getFlags() & ~self::CRC32);
- }
-
- /**
- * Sets the CRC-32. The CRC-32 value is calculated of all the frames in the
- * tag and includes padding.
- *
- * @param integer $crc The 32-bit CRC value.
- */
- public function setCrc($crc)
- {
- if (is_bool($crc))
- $this->useCrc($crc);
- else
- $this->_crc = $crc;
- }
-
- /**
- * Returns the restrictions. For some applications it might be desired to
- * restrict a tag in more ways than imposed by the ID3v2 specification. Note
- * that the presence of these restrictions does not affect how the tag is
- * decoded, merely how it was restricted before encoding. If this flag is set
- * the tag is restricted as follows:
- *
- *
- * Restrictions %ppqrrstt
- *
- * p - Tag size restrictions
- *
- * 00 No more than 128 frames and 1 MB total tag size.
- * 01 No more than 64 frames and 128 KB total tag size.
- * 10 No more than 32 frames and 40 KB total tag size.
- * 11 No more than 32 frames and 4 KB total tag size.
- *
- * q - Text encoding restrictions
- *
- * 0 No restrictions
- * 1 Strings are only encoded with ISO-8859-1 or UTF-8.
- *
- * r - Text fields size restrictions
- *
- * 00 No restrictions
- * 01 No string is longer than 1024 characters.
- * 10 No string is longer than 128 characters.
- * 11 No string is longer than 30 characters.
- *
- * Note that nothing is said about how many bytes is used to represent those
- * characters, since it is encoding dependent. If a text frame consists of
- * more than one string, the sum of the strungs is restricted as stated.
- *
- * s - Image encoding restrictions
- *
- * 0 No restrictions
- * 1 Images are encoded only with PNG [PNG] or JPEG [JFIF].
- *
- * t - Image size restrictions
- *
- * 00 No restrictions
- * 01 All images are 256x256 pixels or smaller.
- * 10 All images are 64x64 pixels or smaller.
- * 11 All images are exactly 64x64 pixels, unless required otherwise.
- *
- *
- * @return integer
- */
- public function getRestrictions() { return $this->_restrictions; }
-
- /**
- * Sets the restrictions byte. See {@link #getRestrictions} for more.
- *
- * @param integer $restrictions The restrictions byte.
- */
- public function setRestrictions($restrictions)
- {
- $this->_restrictions = $restrictions;
- }
-
- /**
- * Returns the total padding size, or simply the total tag size excluding the
- * frames and the headers.
- *
- * @return integer
- * @deprecated ID3v2.3.0
- */
- public function getPadding() { return $this->_padding; }
-
- /**
- * Sets the total padding size, or simply the total tag size excluding the
- * frames and the headers.
- *
- * @param integer $padding The padding size.
- * @deprecated ID3v2.3.0
- */
- public function setPadding($padding) { return $this->_padding = $padding; }
-
- /**
- * Returns the header data.
- *
- * @return string
- */
- public function __toString()
- {
- /* ID3v2.3.0 ExtendedHeader */
- if ($this->getOption("version", 4) < 4) {
- return Transform::toUInt32BE($this->_size) .
- Transform::toUInt16BE($this->hasFlag(self::CRC32) ? 0x8000 : 0) .
- Transform::toUInt32BE($this->_padding) .
- ($this->hasFlag(self::CRC32) ? Transform::toUInt32BE($this->_crc) : "");
- }
-
- /* ID3v2.4.0 ExtendedHeader */
- else {
- return Transform::toUInt32BE($this->_encodeSynchsafe32($this->_size)) .
- Transform::toInt8(1) . Transform::toInt8($this->_flags) .
- ($this->hasFlag(self::UPDATE) ? "\0" : "") .
- ($this->hasFlag(self::CRC32) ? Transform::toInt8(5) .
- Transform::toInt8($this->_crc & 0xf0000000 >> 28 & 0xf /*eq >>> 28*/) .
- Transform::toUInt32BE($this->_encodeSynchsafe32($this->_crc)) : "") .
- ($this->hasFlag(self::RESTRICTED) ?
- Transform::toInt8(1) . Transform::toInt8($this->_restrictions) : "");
- }
- }
-}
diff --git a/src/ID3/Frame.php b/src/ID3/Frame.php
deleted file mode 100644
index 638b218..0000000
--- a/src/ID3/Frame.php
+++ /dev/null
@@ -1,299 +0,0 @@
-
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-abstract class ID3_Frame extends ID3_Object
-{
- /**
- * This flag tells the tag parser what to do with this frame if it is unknown
- * and the tag is altered in any way. This applies to all kinds of
- * alterations, including adding more padding and reordering the frames.
- */
- const DISCARD_ON_TAGCHANGE = 16384;
-
- /**
- * This flag tells the tag parser what to do with this frame if it is unknown
- * and the file, excluding the tag, is altered. This does not apply when the
- * audio is completely replaced with other audio data.
- */
- const DISCARD_ON_FILECHANGE = 8192;
-
- /**
- * This flag, if set, tells the software that the contents of this frame are
- * intended to be read only. Changing the contents might break something,
- * e.g. a signature.
- */
- const READ_ONLY = 4096;
-
- /**
- * This flag indicates whether or not this frame belongs in a group with
- * other frames. If set, a group identifier byte is added to the frame. Every
- * frame with the same group identifier belongs to the same group.
- */
- const GROUPING_IDENTITY = 32;
-
- /**
- * This flag indicates whether or not the frame is compressed. A Data
- * Length Indicator byte is included in the frame.
- *
- * @see DATA_LENGTH_INDICATOR
- */
- const COMPRESSION = 8;
-
- /**
- * This flag indicates whether or not the frame is encrypted. If set, one byte
- * indicating with which method it was encrypted will be added to the frame.
- * See description of the {@link ID3_Frame_ENCR} frame for more information
- * about encryption method registration. Encryption should be done after
- * compression. Whether or not setting this flag requires the presence of a
- * Data Length Indicator depends on the specific algorithm used.
- *
- * @see DATA_LENGTH_INDICATOR
- */
- const ENCRYPTION = 4;
-
- /**
- * This flag indicates whether or not unsynchronisation was applied to this
- * frame.
- *
- * @since ID3v2.4.0
- */
- const UNSYNCHRONISATION = 2;
-
- /**
- * This flag indicates that a data length indicator has been added to the
- * frame.
- *
- * @since ID3v2.4.0
- */
- const DATA_LENGTH_INDICATOR = 1;
-
- /** @var integer */
- private $_identifier;
-
- /** @var integer */
- private $_size = 0;
-
- /** @var integer */
- private $_flags = 0;
-
- /**
- * Raw content of the frame.
- *
- * @var string
- */
- protected $_data = "";
-
- /**
- * Constructs the class with given parameters and reads object related data
- * from the ID3v2 tag.
- *
- * @todo Only limited subset of flags are processed.
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null) {
- $this->_identifier = substr(get_class($this), -4);
- } else {
- $this->_identifier = $this->_reader->readString8(4);
-
- /* ID3v2.3.0 size and flags; convert flags to 2.4.0 format */
- if ($this->getOption("version", 4) < 4) {
- $this->_size = $this->_reader->readUInt32BE();
- $flags = $this->_reader->readUInt16BE();
- if (($flags & 0x8000) == 0x8000)
- $this->_flags |= self::DISCARD_ON_TAGCHANGE;
- if (($flags & 0x4000) == 0x4000)
- $this->_flags |= self::DISCARD_ON_FILECHANGE;
- if (($flags & 0x2000) == 0x2000)
- $this->_flags |= self::READ_ONLY;
- if (($flags & 0x80) == 0x80)
- $this->_flags |= self::COMPRESSION;
- if (($flags & 0x40) == 0x40)
- $this->_flags |= self::ENCRYPTION;
- if (($flags & 0x20) == 0x20)
- $this->_flags |= self::GROUPING_IDENTITY;
- }
-
- /* ID3v2.4.0 size and flags */
- else {
- $this->_size =
- $this->_decodeSynchsafe32($this->_reader->readUInt32BE());
- $this->_flags = $this->_reader->readUInt16BE();
- }
-
- $dataLength = $this->_size;
- if ($this->hasFlag(self::DATA_LENGTH_INDICATOR)) {
- $dataLength = $this->_decodeSynchsafe32($this->_reader->readUInt32BE());
- $this->_size -= 4;
- }
- $this->_data = $this->_reader->read($this->_size);
- $this->_size = $dataLength;
-
- if ($this->hasFlag(self::UNSYNCHRONISATION) ||
- $this->getOption("unsynchronisation", false) === true)
- $this->_data = $this->_decodeUnsynchronisation($this->_data);
- }
- }
-
- /**
- * Returns the frame identifier string.
- *
- * @return string
- */
- public final function getIdentifier() { return $this->_identifier; }
-
- /**
- * Sets the frame identifier.
- *
- * @param string $identifier The identifier.
- */
- public final function setIdentifier($identifier)
- {
- $this->_identifier = $identifier;
- }
-
- /**
- * Returns the size of the data in the final frame, after encryption,
- * compression and unsynchronisation. The size is excluding the frame header.
- *
- * @return integer
- */
- public final function getSize() { return $this->_size; }
-
- /**
- * Checks whether or not the flag is set. Returns true if the flag
- * is set, false otherwise.
- *
- * @param integer $flag The flag to query.
- * @return boolean
- */
- public final function hasFlag($flag)
- {
- return ($this->_flags & $flag) == $flag;
- }
-
- /**
- * Returns the frame flags byte.
- *
- * @return integer
- */
- public final function getFlags($flags) { return $this->_flags; }
-
- /**
- * Sets the frame flags byte.
- *
- * @param string $flags The flags byte.
- */
- public final function setFlags($flags) { $this->_flags = $flags; }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- abstract protected function _getData();
-
- /**
- * Returns the frame data with the header.
- *
- * @return string
- */
- public function __toString()
- {
- /* ID3v2.3.0 Flags; convert from 2.4.0 format */
- if ($this->getOption("version", 4) < 4) {
- $flags = 0;
- if ($this->hasFlag(self::DISCARD_ON_TAGCHANGE))
- $flags = $flags | 0x8000;
- if ($this->hasFlag(self::DISCARD_ON_FILECHANGE))
- $flags = $flags | 0x4000;
- if ($this->hasFlag(self::READ_ONLY))
- $flags = $flags | 0x2000;
- if ($this->hasFlag(self::COMPRESSION))
- $flags = $flags | 0x80;
- if ($this->hasFlag(self::ENCRYPTION))
- $flags = $flags | 0x40;
- if ($this->hasFlag(self::GROUPING_IDENTITY))
- $flags = $flags | 0x20;
- }
-
- /* ID3v2.4.0 Flags */
- else
- $flags = $this->_flags;
-
- if ($this->getOption("version", 4) < 4) {
- $data = $this->_data = $this->_getData();
- $size = $this->_size = strlen($data);
- } else {
- $data = $this->_data = $this->_getData();
- $size = $this->_size = strlen($data);
- $data = $this->_encodeUnsynchronisation($data);
- if (($dataLength = strlen($data)) != $size) {
- $size = 4 + $dataLength;
- $data = Transform::toUInt32BE($this->_encodeSynchsafe32($this->_size)) .
- $data;
- $flags |= self::DATA_LENGTH_INDICATOR | self::UNSYNCHRONISATION;
- $this->setOption("unsynchronisation", true);
- } else
- $flags &= ~(self::DATA_LENGTH_INDICATOR | self::UNSYNCHRONISATION);
- }
- return Transform::toString8(substr($this->_identifier, 0, 4), 4) .
- Transform::toUInt32BE($this->_encodeSynchsafe32($size)) .
- Transform::toUInt16BE($flags) . $data;
- }
-}
diff --git a/src/ID3/Frame/AENC.php b/src/ID3/Frame/AENC.php
deleted file mode 100644
index a454887..0000000
--- a/src/ID3/Frame/AENC.php
+++ /dev/null
@@ -1,171 +0,0 @@
-Audio encryption indicates if the actual audio stream is
- * encrypted, and by whom.
- *
- * The identifier is a URL containing an email address, or a link to a location
- * where an email address can be found, that belongs to the organisation
- * responsible for this specific encrypted audio file. Questions regarding the
- * encrypted audio should be sent to the email address specified. There may be
- * more than one AENC frame in a tag, but only one with the same owner
- * identifier.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_AENC extends ID3_Frame
-{
- /** @var string */
- private $_owner;
-
- /** @var integer */
- private $_previewStart;
-
- /** @var integer */
- private $_previewLength;
-
- /** @var string */
- private $_encryptionInfo;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- list($this->_owner, $this->_data) = $this->_explodeString8($this->_data, 2);
- $this->_previewStart = Transform::fromUInt16BE(substr($this->_data, 0, 2));
- $this->_previewLength = Transform::fromUInt16BE(substr($this->_data, 2, 2));
- $this->_encryptionInfo = substr($this->_data, 4);
- }
-
- /**
- * Returns the owner identifier string.
- *
- * @return string
- */
- public function getOwner() { return $this->_owner; }
-
- /**
- * Sets the owner identifier string.
- *
- * @param string $owner The owner identifier string.
- */
- public function setOwner($owner) { $this->_owner = $owner; }
-
- /**
- * Returns the pointer to an unencrypted part of the audio in frames.
- *
- * @return integer
- */
- public function getPreviewStart() { return $this->_previewStart; }
-
- /**
- * Sets the pointer to an unencrypted part of the audio in frames.
- *
- * @param integer $previewStart The pointer to an unencrypted part.
- */
- public function setPreviewStart($previewStart)
- {
- $this->_previewStart = $previewStart;
- }
-
- /**
- * Returns the length of the preview in frames.
- *
- * @return integer
- */
- public function getPreviewLength() { return $this->_previewLength; }
-
- /**
- * Sets the length of the preview in frames.
- *
- * @param integer $previewLength The length of the preview.
- */
- public function setPreviewLength($previewLength)
- {
- $this->_previewLength = $previewLength;
- }
-
- /**
- * Returns the encryption info.
- *
- * @return string
- */
- public function getEncryptionInfo() { return $this->_encryptionInfo; }
-
- /**
- * Sets the encryption info binary string.
- *
- * @param string $encryptionInfo The data string.
- */
- public function setEncryptionInfo($encryptionInfo)
- {
- $this->_encryptionInfo = $encryptionInfo;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return
- $this->_owner . "\0" . Transform::toUInt16BE($this->_previewStart) .
- Transform::toUInt16BE($this->_previewLength) . $this->_encryptionInfo;
- }
-}
diff --git a/src/ID3/Frame/APIC.php b/src/ID3/Frame/APIC.php
deleted file mode 100644
index 322a8d1..0000000
--- a/src/ID3/Frame/APIC.php
+++ /dev/null
@@ -1,274 +0,0 @@
-Attached picture frame contains a picture directly related to the
- * audio file. Image format is the MIME type and subtype for the image.
- *
- * There may be several pictures attached to one file, each in their individual
- * APIC frame, but only one with the same content descriptor. There may only
- * be one picture with the same picture type. There is the possibility to put
- * only a link to the image file by using the MIME type "-->" and having a
- * complete URL instead of picture data.
- *
- * The use of linked files should however be used sparingly since there is the
- * risk of separation of files.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_APIC extends ID3_Frame
- implements ID3_Encoding
-{
- /**
- * The list of image types.
- *
- * @var Array
- */
- public static $types = array
- ("Other", "32x32 pixels file icon (PNG only)", "Other file icon",
- "Cover (front)", "Cover (back)", "Leaflet page",
- "Media (e.g. label side of CD)", "Lead artist/lead performer/soloist",
- "Artist/performer", "Conductor", "Band/Orchestra", "Composer",
- "Lyricist/text writer", "Recording Location", "During recording",
- "During performance", "Movie/video screen capture",
- "A bright coloured fish", "Illustration", "Band/artist logotype",
- "Publisher/Studio logotype");
-
- /** @var integer */
- private $_encoding;
-
- /** @var string */
- private $_mimeType = "image/unknown";
-
- /** @var integer */
- private $_imageType = 0;
-
- /** @var string */
- private $_description;
-
- /** @var string */
- private $_imageData;
-
- /** @var integer */
- private $_imageSize = 0;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- $this->_mimeType = substr
- ($this->_data, 1, ($pos = strpos($this->_data, "\0", 1)) - 1);
- $this->_imageType = Transform::fromUInt8($this->_data[++$pos]);
- $this->_data = substr($this->_data, $pos + 1);
-
- switch ($encoding) {
- case self::UTF16:
- list ($this->_description, $this->_imageData) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16");
- break;
- case self::UTF16BE:
- list ($this->_description, $this->_imageData) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16be");
- break;
- case self::UTF8:
- list ($this->_description, $this->_imageData) =
- $this->_explodeString8($this->_data, 2);
- $this->_description = $this->_convertString
- ($this->_description, "utf-8");
- break;
- default:
- list ($this->_description, $this->_imageData) =
- $this->_explodeString8($this->_data, 2);
- $this->_description = $this->_convertString
- ($this->_description, "iso-8859-1");
- }
-
- $this->_imageSize = strlen($this->_imageData);
- }
-
- /**
- * Returns the text encoding.
- *
- * All the strings read from a file are automatically converted to the
- * character encoding specified with the encoding option. See
- * {@link ID3v2} for details. This method returns the original text encoding
- * used to write the frame.
- *
- * @return integer
- */
- public function getEncoding() { return $this->_encoding; }
-
- /**
- * Sets the text encoding.
- *
- * All the string written to the frame are done so using given character
- * encoding. No conversions of existing data take place upon the call to this
- * method thus all texts must be given in given character encoding.
- *
- * The default character encoding used to write the frame is UTF-8.
- *
- * @see ID3_Encoding
- * @param integer $encoding The text encoding.
- */
- public function setEncoding($encoding) { $this->_encoding = $encoding; }
-
- /**
- * Returns the MIME type. The MIME type is always ISO-8859-1 encoded.
- *
- * @return string
- */
- public function getMimeType() { return $this->_mimeType; }
-
- /**
- * Sets the MIME type. The MIME type is always ISO-8859-1 encoded.
- *
- * @param string $mimeType The MIME type.
- */
- public function setMimeType($mimeType) { $this->_mimeType = $mimeType; }
-
- /**
- * Returns the image type.
- *
- * @return integer
- */
- public function getImageType() { return $this->_imageType; }
-
- /**
- * Sets the image type code.
- *
- * @param integer $imageType The image type code.
- */
- public function setImageType($imageType) { $this->_imageType = $imageType; }
-
- /**
- * Returns the file description.
- *
- * @return string
- */
- public function getDescription() { return $this->_description; }
-
- /**
- * Sets the content description text using given encoding.
- *
- * @param string $description The content description text.
- * @param integer $encoding The text encoding.
- */
- public function setDescription($description, $encoding = false)
- {
- $this->_description = $description;
- if ($encoding !== false)
- $this->_encoding = $encoding;
- }
-
- /**
- * Returns the embedded image data.
- *
- * @return string
- */
- public function getImageData() { return $this->_imageData; }
-
- /**
- * Sets the embedded image data. Also updates the image size field to
- * correspond the new data.
- *
- * @param string $imageData The image data.
- */
- public function setImageData($imageData)
- {
- $this->_imageData = $imageData;
- $this->_imageSize = strlen($imageData);
- }
-
- /**
- * Returns the size of the embedded image data.
- *
- * @return integer
- */
- public function getImageSize() { return $this->_imageSize; }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding) . $this->_mimeType . "\0" .
- Transform::toUInt8($this->_imageType);
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($this->_description, Transform::LITTLE_ENDIAN_ORDER, 1);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($this->_description, false, 1);
- break;
- default:
- $data .= $this->_description . "\0";
- }
- return $data . $this->_imageData;
- }
-}
diff --git a/src/ID3/Frame/ASPI.php b/src/ID3/Frame/ASPI.php
deleted file mode 100644
index 2c141a7..0000000
--- a/src/ID3/Frame/ASPI.php
+++ /dev/null
@@ -1,160 +0,0 @@
-Audio seek point index or
- * ASPI frame makes seeking easier by providing a list a seek points within the
- * audio file. The seek points are a fractional offset within the audio data,
- * providing a starting point from which to find an appropriate point to start
- * decoding. The presence of an ASPI frame requires the existence of a
- * {@link ID3_Frame_TLEN} frame, indicating the duration of the file in
- * milliseconds. There may only be one audio seek point index frame in a tag.
- *
- * @todo Data parsing and write support
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_ASPI extends ID3_Frame
-{
- /** @var integer */
- private $_dataStart;
-
- /** @var integer */
- private $_dataLength;
-
- /** @var integer */
- private $_size;
-
- /** @var Array */
- private $_fractions = array();
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null) {
- require_once("ID3/Exception.php");
- throw new ID3_Exception("Write not supported yet");
- }
-
- $this->_dataStart = Transform::fromInt32BE(substr($this->_data, 0, 4));
- $this->_dataLength = Transform::fromInt32BE(substr($this->_data, 4, 4));
- $this->_size = Transform::fromInt16BE(substr($this->_data, 8, 2));
-
- $bitsPerPoint = Transform::fromInt8($this->_data[10]);
- /*for ($i = 0, $offset = 11; $i < $this->_size; $i++) {
- if ($bitsPerPoint == 16) {
- $this->_fractions[$i] = substr($this->_data, $offset, 2);
- $offset += 2;
- } else {
- $this->_fractions[$i] = substr($this->_data, $offset, 1);
- $offset ++;
- }
- }*/
- }
-
- /**
- * Returns the byte offset from the beginning of the file.
- *
- * @return integer
- */
- public function getDataStart() { return $this->_dataStart; }
-
- /**
- * Sets the byte offset from the beginning of the file.
- *
- * @param integer $dataStart The offset.
- */
- public function setDataStart($dataStart) { $this->_dataStart = $dataStart; }
-
- /**
- * Returns the byte length of the audio data being indexed.
- *
- * @return integer
- */
- public function getDataLength() { return $this->_dataLength; }
-
- /**
- * Sets the byte length of the audio data being indexed.
- *
- * @param integer $dataLength The length.
- */
- public function setDataLength($dataLength)
- {
- $this->_dataLength = $dataLength;
- }
-
- /**
- * Returns the number of index points in the frame.
- *
- * @return integer
- */
- public function getSize() { return count($this->_fractions); }
-
- /**
- * Returns the numerator of the fraction representing a relative position in
- * the data or false if index not defined. The denominator is 2
- * to the power of b.
- *
- * @param integer $index The fraction numerator.
- * @return integer
- */
- public function getFractionAt($index)
- {
- if (isset($this->_fractions[$index]))
- return $this->_fractions[$index];
- return false;
- }
-}
diff --git a/src/ID3/Frame/AbstractLink.php b/src/ID3/Frame/AbstractLink.php
deleted file mode 100644
index 73650ed..0000000
--- a/src/ID3/Frame/AbstractLink.php
+++ /dev/null
@@ -1,96 +0,0 @@
-
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-abstract class ID3_Frame_AbstractLink extends ID3_Frame
-{
- /** @var string */
- protected $_link;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader !== null)
- $this->_link = implode($this->_explodeString8($this->_data, 1), "");
- }
-
- /**
- * Returns the link associated with the frame.
- *
- * @return string
- */
- public function getLink() { return $this->_link; }
-
- /**
- * Sets the link. The link encoding is always ISO-8859-1.
- *
- * @param string $link The link.
- */
- public function setLink($link) { $this->_link = $link; }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return $this->_link;
- }
-}
diff --git a/src/ID3/Frame/AbstractText.php b/src/ID3/Frame/AbstractText.php
deleted file mode 100644
index cf7753f..0000000
--- a/src/ID3/Frame/AbstractText.php
+++ /dev/null
@@ -1,188 +0,0 @@
-
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-abstract class ID3_Frame_AbstractText extends ID3_Frame
- implements ID3_Encoding
-{
- /**
- * The text encoding.
- *
- * @var integer
- */
- protected $_encoding;
-
- /**
- * The text array.
- *
- * @var string
- */
- protected $_text;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- $this->_data = substr($this->_data, 1);
- switch ($encoding) {
- case self::UTF16:
- $this->_text = $this->_convertString
- ($this->_explodeString16(Transform::fromString16($this->_data)),
- "utf-16");
- break;
- case self::UTF16BE:
- $this->_text = $this->_convertString
- ($this->_explodeString16(Transform::fromString16($this->_data)),
- "utf-16be");
- break;
- case self::UTF8:
- $this->_text = $this->_convertString
- ($this->_explodeString8(Transform::fromString8($this->_data)), "utf-8");
- break;
- default:
- $this->_text = $this->_convertString
- ($this->_explodeString8(Transform::fromString8($this->_data)),
- "iso-8859-1");
- }
- }
-
- /**
- * Returns the text encoding.
- *
- * All the strings read from a file are automatically converted to the
- * character encoding specified with the encoding option. See
- * {@link ID3v2} for details. This method returns the original text encoding
- * used to write the frame.
- *
- * @return integer
- */
- public function getEncoding() { return $this->_encoding; }
-
- /**
- * Sets the text encoding.
- *
- * All the string written to the frame are done so using given character
- * encoding. No conversions of existing data take place upon the call to this
- * method thus all texts must be given in given character encoding.
- *
- * The default character encoding used to write the frame is UTF-8.
- *
- * @see ID3_Encoding
- * @param integer $encoding The text encoding.
- */
- public function setEncoding($encoding) { $this->_encoding = $encoding; }
-
- /**
- * Returns the first text chunk the frame contains.
- *
- * @return string
- */
- public function getText() { return $this->_text[0]; }
-
- /**
- * Returns an array of texts the frame contains.
- *
- * @return Array
- */
- public function getTexts() { return $this->_text; }
-
- /**
- * Sets the text using given encoding.
- *
- * @param mixed $text The test string or an array of strings.
- * @param integer $encoding The text encoding.
- */
- public function setText($text, $encoding = false)
- {
- $this->_text = is_array($text) ? $text : array($text);
- if ($encoding !== false)
- $this->_encoding = $encoding;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding);
- switch ($this->_encoding) {
- case self::UTF16LE:
- $array = $this->_text;
- foreach ($array as &$text)
- $text = Transform::toString16($text, Transform::LITTLE_ENDIAN_ORDER);
- $data .= implode("\0\0", $array);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= implode("\0\0", $this->_text);
- break;
- default:
- $data .= implode("\0", $this->_text);
- }
- return $data;
- }
-}
diff --git a/src/ID3/Frame/COMM.php b/src/ID3/Frame/COMM.php
deleted file mode 100644
index d11e4ab..0000000
--- a/src/ID3/Frame/COMM.php
+++ /dev/null
@@ -1,254 +0,0 @@
-Comments frame is intended for any kind of full text information
- * that does not fit in any other frame. It consists of a frame header followed
- * by encoding, language and content descriptors and is ended with the actual
- * comment as a text string. Newline characters are allowed in the comment text
- * string. There may be more than one comment frame in each tag, but only one
- * with the same language and content descriptor.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_COMM extends ID3_Frame
- implements ID3_Encoding, ID3_Language
-{
- /** @var integer */
- private $_encoding;
-
- /** @var string */
- private $_language = "und";
-
- /** @var string */
- private $_description;
-
- /** @var string */
- private $_text;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- $this->_language = substr($this->_data, 1, 3);
- if ($this->_language == "XXX")
- $this->_language = "und";
- $this->_data = substr($this->_data, 4);
-
- switch ($encoding) {
- case self::UTF16:
- list ($this->_description, $this->_text) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16");
- $this->_text = $this->_convertString
- (Transform::fromString16($this->_text), "utf-16");
- break;
- case self::UTF16BE:
- list ($this->_description, $this->_text) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16be");
- $this->_text = $this->_convertString
- (Transform::fromString16($this->_text), "utf-16be");
- break;
- case self::UTF8:
- list ($this->_description, $this->_text) =
- $this->_explodeString8($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString8($this->_description), "utf-8");
- $this->_text = $this->_convertString
- (Transform::fromString8($this->_text), "utf-8");
- break;
- default:
- list ($this->_description, $this->_text) =
- $this->_explodeString8($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString8($this->_description), "iso-8859-1");
- $this->_text = $this->_convertString
- (Transform::fromString8($this->_text), "iso-8859-1");
- }
- }
-
- /**
- * Returns the text encoding.
- *
- * All the strings read from a file are automatically converted to the
- * character encoding specified with the encoding option. See
- * {@link ID3v2} for details. This method returns the original text encoding
- * used to write the frame.
- *
- * @return integer
- */
- public function getEncoding() { return $this->_encoding; }
-
- /**
- * Sets the text encoding.
- *
- * All the string written to the frame are done so using given character
- * encoding. No conversions of existing data take place upon the call to this
- * method thus all texts must be given in given character encoding.
- *
- * The default character encoding used to write the frame is UTF-8.
- *
- * @see ID3_Encoding
- * @param integer $encoding The text encoding.
- */
- public function setEncoding($encoding) { $this->_encoding = $encoding; }
-
- /**
- * Returns the language code as specified in the
- * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard.
- *
- * @return string
- */
- public function getLanguage() { return $this->_language; }
-
- /**
- * Sets the text language code as specified in the
- * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard.
- *
- * @see ID3_Language
- * @param string $language The language code.
- */
- public function setLanguage($language)
- {
- if ($language == "XXX")
- $language = "und";
- $this->_language = substr($language, 0, 3);
- }
-
- /**
- * Returns the short content description.
- *
- * @return string
- */
- public function getDescription() { return $this->_description; }
-
- /**
- * Sets the content description text using given encoding. The description
- * language and encoding must be that of the actual text.
- *
- * @param string $description The content description text.
- * @param string $language The language code.
- * @param integer $encoding The text encoding.
- */
- public function setDescription($description, $language = false,
- $encoding = false)
- {
- $this->_description = $description;
- if ($language !== false)
- $this->setLanguage($language);
- if ($encoding !== false)
- $this->setEncoding($encoding);
- }
-
- /**
- * Returns the comment text.
- *
- * @return string
- */
- public function getText() { return $this->_text; }
-
- /**
- * Sets the text using given encoding. The text language and encoding must be
- * that of the description text.
- *
- * @param mixed $text The test string.
- * @param string $language The language code.
- * @param integer $encoding The text encoding.
- */
- public function setText($text, $language = false, $encoding = false)
- {
- $this->_text = $text;
- if ($language !== false)
- $this->setLanguage($language);
- if ($encoding !== false)
- $this->setEncoding($encoding);
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding) . $this->_language;
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($this->_description, Transform::LITTLE_ENDIAN_ORDER, 1) .
- Transform::toString16($this->_text, Transform::LITTLE_ENDIAN_ORDER);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($this->_description, false, 1) .
- Transform::toString16($this->_text);
- break;
- default:
- $data .= $this->_description . "\0" . $this->_text;
- }
- return $data;
- }
-}
diff --git a/src/ID3/Frame/COMR.php b/src/ID3/Frame/COMR.php
deleted file mode 100644
index 29d54a1..0000000
--- a/src/ID3/Frame/COMR.php
+++ /dev/null
@@ -1,400 +0,0 @@
-Commercial frame enables several competing offers in the same tag
- * by bundling all needed information. That makes this frame rather complex but
- * it's an easier solution than if one tries to achieve the same result with
- * several frames.
- *
- * There may be more than one commercial frame in a tag, but no two may be
- * identical.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_COMR extends ID3_Frame
- implements ID3_Encoding
-{
- /**
- * The delivery types.
- *
- * @var Array
- */
- public static $types = array
- ("Other", "Standard CD album with other songs", "Compressed audio on CD",
- "File over the Internet", "Stream over the Internet", "As note sheets",
- "As note sheets in a book with other sheets", "Music on other media",
- "Non-musical merchandise");
-
- /** @var integer */
- private $_encoding;
-
- /** @var string */
- private $_currency = "EUR";
-
- /** @var string */
- private $_price;
-
- /** @var string */
- private $_date;
-
- /** @var string */
- private $_contact;
-
- /** @var integer */
- private $_delivery = 0;
-
- /** @var string */
- private $_seller;
-
- /** @var string */
- private $_description;
-
- /** @var string */
- private $_mimeType = false;
-
- /** @var string */
- private $_imageData;
-
- /** @var integer */
- private $_imageSize = 0;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- list($pricing, $this->_data) =
- $this->_explodeString8(substr($this->_data, 1), 2);
- $this->_currency = substr($pricing, 0, 3);
- $this->_price = substr($pricing, 3);
- $this->_date = substr($this->_data, 0, 8);
- list($this->_contact, $this->_data) =
- $this->_explodeString8(substr($this->_data, 8), 2);
- $this->_delivery = Transform::fromUInt8($this->_data[0]);
- $this->_data = substr($this->_data, 1);
-
- switch ($encoding) {
- case self::UTF16:
- list ($this->_seller, $this->_description, $this->_data) =
- $this->_explodeString16($this->_data, 3);
- $this->_seller = $this->_convertString
- (Transform::fromString16($this->_seller), "utf-16");
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16");
- break;
- case self::UTF16BE:
- list ($this->_seller, $this->_description, $this->_data) =
- $this->_explodeString16($this->_data, 3);
- $this->_seller = $this->_convertString
- (Transform::fromString16($this->_seller), "utf-16be");
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16be");
- break;
- case self::UTF8:
- list ($this->_seller, $this->_description, $this->_data) =
- $this->_explodeString8($this->_data, 3);
- $this->_seller = $this->_convertString
- (Transform::fromString8($this->_seller), "utf-8");
- $this->_description = $this->_convertString
- (Transform::fromString8($this->_description), "utf-8");
- break;
- default:
- list ($this->_seller, $this->_description, $this->_data) =
- $this->_explodeString8($this->_data, 3);
- $this->_seller = $this->_convertString
- (Transform::fromString8($this->_seller), "iso-8859-1");
- $this->_description = $this->_convertString
- (Transform::fromString8($this->_description), "iso-8859-1");
- }
-
- if (strlen($this->_data) == 0)
- return;
-
- list($this->_mimeType, $this->_imageData) =
- $this->_explodeString8($this->_data, 2);
-
- $this->_imageSize = strlen($this->_imageData);
- }
-
- /**
- * Returns the text encoding.
- *
- * All the strings read from a file are automatically converted to the
- * character encoding specified with the encoding option. See
- * {@link ID3v2} for details. This method returns the original text encoding
- * used to write the frame.
- *
- * @return integer
- */
- public function getEncoding() { return $this->_encoding; }
-
- /**
- * Sets the text encoding.
- *
- * All the string written to the frame are done so using given character
- * encoding. No conversions of existing data take place upon the call to this
- * method thus all texts must be given in given character encoding.
- *
- * The default character encoding used to write the frame is UTF-8.
- *
- * @see ID3_Encoding
- * @param integer $encoding The text encoding.
- */
- public function setEncoding($encoding) { $this->_encoding = $encoding; }
-
- /**
- * Returns the currency code, encoded according to
- * {@link http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes/currency_codes_list-1.htm
- * ISO 4217} alphabetic currency code.
- *
- * @return string
- */
- public function getCurrency() { return $this->_currency; }
-
- /**
- * Sets the currency used in transaction, encoded according to
- * {@link http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes/currency_codes_list-1.htm
- * ISO 4217} alphabetic currency code.
- *
- * @param string $currency The currency code.
- */
- public function setCurrency($currency) { $this->_currency = $currency; }
-
- /**
- * Returns the price as a numerical string using "." as the decimal separator.
- *
- * In the price string several prices may be concatenated, separated by a "/"
- * character, but there may only be one currency of each type.
- *
- * @return string
- */
- public function getPrice() { return $this->_price; }
-
- /**
- * Sets the price. The price must use "." as the decimal separator and have
- * multiple values be separated by a "/" character.
- *
- * @param string $price The price.
- */
- public function setPrice($price)
- {
- $this->_price = $price;
- }
-
- /**
- * Returns the date as an 8 character date string (YYYYMMDD), describing for
- * how long the price is valid.
- *
- * @return string
- */
- public function getDate() { return $this->_date; }
-
- /**
- * Sets the date describing for how long the price is valid for. The date must
- * be an 8 character date string (YYYYMMDD).
- *
- * @param string $date The date string.
- */
- public function setDate($date) { $this->_date = $date; }
-
- /**
- * Returns the contact URL, with which the user can contact the seller.
- *
- * @return string
- */
- public function getContact() { return $this->_contact; }
-
- /**
- * Sets the contact URL, with which the user can contact the seller.
- *
- * @param string $contact The contact URL.
- */
- public function setContact($contact) { $this->_contact = $contact; }
-
- /**
- * Returns the delivery type with whitch the audio was delivered when bought.
- *
- * @return integer
- */
- public function getDelivery() { return $this->_delivery; }
-
- /**
- * Sets the delivery type with whitch the audio was delivered when bought.
- *
- * @param integer $delivery The delivery type code.
- */
- public function setDelivery($delivery) { $this->_delivery = $delivery; }
-
- /**
- * Returns the name of the seller.
- *
- * @return string
- */
- public function getSeller() { return $this->_seller; }
-
- /**
- * Sets the name of the seller using given encoding. The seller text encoding
- * must be that of the description text.
- *
- * @param string $seller The name of the seller.
- * @param integer $encoding The text encoding.
- */
- public function setSeller($seller, $encoding = false)
- {
- $this->_seller = $seller;
- if ($encoding !== false)
- $this->_encoding = $encoding;
- }
-
- /**
- * Returns the short description of the product.
- *
- * @return string
- */
- public function getDescription() { return $this->_description; }
-
- /**
- * Sets the content description text using given encoding. The description
- * encoding must be that of the seller text.
- *
- * @param string $description The content description text.
- * @param integer $encoding The text encoding.
- */
- public function setDescription($description, $encoding = false)
- {
- $this->_description = $description;
- if ($encoding !== false)
- $this->_encoding = $encoding;
- }
-
- /**
- * Returns the MIME type of the seller's company logo, if attached, or
- * false otherwise. Currently only "image/png" and "image/jpeg"
- * are allowed.
- *
- * @return string
- */
- public function getMimeType() { return $this->_mimeType; }
-
- /**
- * Sets the MIME type. Currently only "image/png" and "image/jpeg" are
- * allowed. The MIME type is always ISO-8859-1 encoded.
- *
- * @param string $mimeType The MIME type.
- */
- public function setMimeType($mimeType) { $this->_mimeType = $mimeType; }
-
- /**
- * Returns the embedded image binary data.
- *
- * @return string
- */
- public function getImageData() { return $this->_imageData; }
-
- /**
- * Sets the embedded image data. Also updates the image size to correspond the
- * new data.
- *
- * @param string $imageData The image data.
- */
- public function setImageData($imageData)
- {
- $this->_imageData = $imageData;
- $this->_imageSize = strlen($imageData);
- }
-
- /**
- * Returns the size of the embedded image data.
- *
- * @return integer
- */
- public function getImageSize() { return $this->_imageSize; }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding) . $this->_currency .
- $this->_price . "\0" . $this->_date . $this->_contact . "\0" .
- Transform::toUInt8($this->_delivery);
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($this->_seller, Transform::LITTLE_ENDIAN_ORDER, 1) .
- Transform::toString16
- ($this->_description, Transform::LITTLE_ENDIAN_ORDER, 1);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($this->_seller, false, 1) .
- Transform::toString16($this->_description, false, 1);
- break;
- default:
- $data .= $this->_seller . "\0" . $this->_description . "\0";
- }
- return
- $data . ($this->_mimeType ?
- $this->_mimeType . "\0" . $this->_imageData : "");
- }
-}
diff --git a/src/ID3/Frame/ENCR.php b/src/ID3/Frame/ENCR.php
deleted file mode 100644
index b3cccc4..0000000
--- a/src/ID3/Frame/ENCR.php
+++ /dev/null
@@ -1,156 +0,0 @@
-Encryption method
- * registration frame.
- *
- * The owner identifier a URL containing an email address, or a link to a
- * location where an email address can be found, that belongs to the
- * organisation responsible for this specific encryption method. Questions
- * regarding the encryption method should be sent to the indicated email
- * address.
- *
- * The method symbol contains a value that is associated with this method
- * throughout the whole tag, in the range $80-F0. All other values are reserved.
- * The method symbol may optionally be followed by encryption specific data.
- *
- * There may be several ENCR frames in a tag but only one containing the same
- * symbol and only one containing the same owner identifier. The method must be
- * used somewhere in the tag. See {@link ID3_Frame#ENCRYPTION} for more
- * information.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_ENCR extends ID3_Frame
-{
- /** @var string */
- private $_owner;
-
- /** @var integer */
- private $_method;
-
- /** @var string */
- private $_encryptionData;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- list($this->_owner, $this->_data) = $this->_explodeString8($this->_data, 2);
- $this->_method = Transform::fromInt8($this->_data[0]);
- $this->_encryptionData = substr($this->_data, 1);
- }
-
- /**
- * Returns the owner identifier string.
- *
- * @return string
- */
- public function getOwner() { return $this->_owner; }
-
- /**
- * Sets the owner identifier string.
- *
- * @param string $owner The owner identifier string.
- */
- public function setOwner($owner) { $this->_owner = $owner; }
-
- /**
- * Returns the method symbol.
- *
- * @return integer
- */
- public function getMethod() { return $this->_method; }
-
- /**
- * Sets the method symbol.
- *
- * @param integer $method The method symbol byte.
- */
- public function setMethod($method) { $this->_method = $method; }
-
- /**
- * Returns the encryption data.
- *
- * @return string
- */
- public function getEncryptionData() { return $this->_encryptionData; }
-
- /**
- * Sets the encryption data.
- *
- * @param string $encryptionData The encryption data string.
- */
- public function setEncryptionData($encryptionData)
- {
- $this->_encryptionData = $encryptionData;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return
- $this->_owner . "\0" . Transform::toInt8($this->_method) .
- $this->_encryptionData;
- }
-}
diff --git a/src/ID3/Frame/EQU2.php b/src/ID3/Frame/EQU2.php
deleted file mode 100644
index 323064d..0000000
--- a/src/ID3/Frame/EQU2.php
+++ /dev/null
@@ -1,193 +0,0 @@
-Equalisation (2) is another subjective, alignment frame. It allows
- * the user to predefine an equalisation curve within the audio file. There may
- * be more than one EQU2 frame in each tag, but only one with the same
- * identification string.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_EQU2 extends ID3_Frame
-{
- /**
- * Interpolation type that defines that no interpolation is made. A jump from
- * one adjustment level to another occurs in the middle between two adjustment
- * points.
- */
- const BAND = 0;
-
- /**
- * Interpolation type that defines that interpolation between adjustment
- * points is linear.
- */
- const LINEAR = 1;
-
- /** @var integer */
- private $_interpolation;
-
- /** @var string */
- private $_device;
-
- /** @var Array */
- private $_adjustments;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $this->_interpolation = Transform::fromInt8($this->_data[0]);
- list ($this->_device, $this->_data) =
- $this->_explodeString8(substr($this->_data, 1), 2);
-
- for ($i = 0; $i < strlen($this->_data); $i += 4)
- $this->_adjustments
- [(int)(Transform::fromUInt16BE(substr($this->_data, $i, 2)) / 2)] =
- Transform::fromInt16BE(substr($this->_data, $i + 2, 2)) / 512.0;
- ksort($this->_adjustments);
- }
-
- /**
- * Returns the interpolation method. The interpolation method describes which
- * method is preferred when an interpolation between the adjustment point that
- * follows.
- *
- * @return integer
- */
- public function getInterpolation() { return $this->_interpolation; }
-
- /**
- * Sets the interpolation method. The interpolation method describes which
- * method is preferred when an interpolation between the adjustment point that
- * follows.
- *
- * @param integer $interpolation The interpolation method code.
- */
- public function setInterpolation($interpolation)
- {
- $this->_interpolation = $interpolation;
- }
-
- /**
- * Returns the device where the adjustments should apply.
- *
- * @return string
- */
- public function getDevice() { return $this->_device; }
-
- /**
- * Sets the device where the adjustments should apply.
- *
- * @param string $device The device.
- */
- public function setDevice($device) { $this->_device = $device; }
-
- /**
- * Returns the array containing adjustments having frequencies as keys and
- * their corresponding adjustments as values.
- *
- * Adjustment points are ordered by frequency.
- *
- * @return Array
- */
- public function getAdjustments() { return $this->_adjustments; }
-
- /**
- * Adds a volume adjustment setting for given frequency. The frequency can
- * have a value from 0 to 32767 Hz, and the adjustment > +/- 64 dB with a
- * precision of 0.001953125 dB.
- *
- * @param integer $frequency The frequency, in hertz.
- * @param integer $adjustment The adjustment, in dB.
- */
- public function addAdjustment($frequency, $adjustment)
- {
- $this->_adjustments[$frequency] = $adjustment;
- ksort($this->_adjustments);
- }
-
- /**
- * Sets the adjustments array. The array must have frequencies as keys and
- * their corresponding adjustments as values. The frequency can have a value
- * from 0 to 32767 Hz, and the adjustment > +/- 64 dB with a precision of
- * 0.001953125 dB. One frequency should only be described once in the frame.
- *
- * @param Array $adjustments The adjustments array.
- */
- public function setAdjustments($adjustments)
- {
- $this->_adjustments = $adjustments;
- ksort($this->_adjustments);
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toInt8($this->_interpolation) . $this->_device . "\0";
- foreach ($this->_adjustments as $frequency => $adjustment)
- $data .= Transform::toUInt16BE($frequency * 2) .
- Transform::toInt16BE($adjustment * 512);
- return $data;
- }
-}
diff --git a/src/ID3/Frame/EQUA.php b/src/ID3/Frame/EQUA.php
deleted file mode 100644
index 2ac5136..0000000
--- a/src/ID3/Frame/EQUA.php
+++ /dev/null
@@ -1,142 +0,0 @@
-Equalisation frame is another subjective, alignment frame. It
- * allows the user to predefine an equalisation curve within the audio file.
- * There may only be one EQUA frame in each tag.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @deprecated ID3v2.3.0
- */
-final class ID3_Frame_EQUA extends ID3_Frame
-{
- /** @var Array */
- private $_adjustments;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $adjustmentBits = Transform::fromInt8($this->_data[0]);
- if ($adjustmentBits <= 8 || $adjustmentBits > 16) {
- require_once("ID3/Exception.php");
- throw new ID3_Exception
- ("Unsupported adjustment bit size of: " . $adjustmentBits);
- }
-
- for ($i = 1; $i < strlen($this->_data); $i += 4) {
- $frequency = Transform::fromUInt16BE(substr($this->_data, $i, 2));
- $this->_adjustments[($frequency & 0x7fff)] =
- ($frequency & 0x8000) == 0x8000 ?
- Transform::fromUInt16BE(substr($this->_data, $i + 2, 2)) :
- -Transform::fromUInt16BE(substr($this->_data, $i + 2, 2));
- }
- ksort($this->_adjustments);
- }
-
- /**
- * Returns the array containing adjustments having frequencies as keys and
- * their corresponding adjustments as values.
- *
- * @return Array
- */
- public function getAdjustments() { return $this->_adjustments; }
-
- /**
- * Adds a volume adjustment setting for given frequency. The frequency can
- * have a value from 0 to 32767 Hz.
- *
- * @param integer $frequency The frequency, in hertz.
- * @param integer $adjustment The adjustment, in dB.
- */
- public function addAdjustment($frequency, $adjustment)
- {
- $this->_adjustments[$frequency] = $adjustment;
- ksort($this->_adjustments);
- }
-
- /**
- * Sets the adjustments array. The array must have frequencies as keys and
- * their corresponding adjustments as values. The frequency can have a value
- * from 0 to 32767 Hz. One frequency should only be described once in the
- * frame.
- *
- * @param Array $adjustments The adjustments array.
- */
- public function setAdjustments($adjustments)
- {
- $this->_adjustments = $adjustments;
- ksort($this->_adjustments);
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toInt8(16);
- foreach ($this->_adjustments as $frequency => $adjustment)
- $data .= Transform::toUInt16BE
- ($adjustment > 0 ? $frequency | 0x8000 : $frequency & ~0x8000) .
- Transform::toUInt16BE(abs($adjustment));
- return $data;
- }
-}
diff --git a/src/ID3/Frame/ETCO.php b/src/ID3/Frame/ETCO.php
deleted file mode 100644
index 95a4e69..0000000
--- a/src/ID3/Frame/ETCO.php
+++ /dev/null
@@ -1,168 +0,0 @@
-Event timing codes allows synchronisation with key events in the
- * audio.
- *
- * The events are an array of timestamp and type pairs. The time stamp is set to
- * zero if directly at the beginning of the sound or after the previous event.
- * All events are sorted in chronological order.
- *
- * The events $E0-EF are for user events. You might want to synchronise your
- * music to something, like setting off an explosion on-stage, activating a
- * screensaver etc.
- *
- * There may only be one ETCO frame in each tag.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_ETCO extends ID3_Frame
- implements ID3_Timing
-{
- /**
- * The list of event types.
- *
- * @var Array
- */
- public static $types = array
- ("Padding", "End of initial silence", "Intro start", "Main part start",
- "Outro start", "Outro end", "Verse start","Refrain start",
- "Interlude start", "Theme start", "Variation start", "Key change",
- "Time change", "Momentary unwanted noise", "Sustained noise",
- "Sustained noise end", "Intro end", "Main part end", "Verse end",
- "Refrain end", "Theme end", "Profanity", "Profanity end",
-
- 0xe0 => "User event", "User event", "User event", "User event",
- "User event", "User event", "User event", "User event", "User event",
- "User event", "User event", "User event", "User event", "User event",
-
- 0xfd => "Audio end (start of silence)", "Audio file ends",
- "One more byte of events follows");
-
- /** @var integer */
- private $_format = ID3_Timing::MPEG_FRAMES;
-
- /** @var Array */
- private $_events = array();
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $this->_format = Transform::fromUInt8($this->_data[0]);
- for ($i = 1; $i < $this->getSize(); $i += 5) {
- $this->_events[Transform::fromUInt32BE(substr($this->_data, $i + 1, 4))] =
- $data = Transform::fromUInt8($this->_data[$i]);
- if ($data == 0xff)
- break;
- }
- ksort($this->_events);
- }
-
- /**
- * Returns the timing format.
- *
- * @return integer
- */
- public function getFormat() { return $this->_format; }
-
- /**
- * Sets the timing format.
- *
- * @see ID3_Timing
- * @param integer $format The timing format.
- */
- public function setFormat($format) { $this->_format = $format; }
-
- /**
- * Returns the events as an associated array having the timestamps as keys and
- * the event types as values.
- *
- * @return Array
- */
- public function getEvents() { return $this->_events; }
-
- /**
- * Sets the events using given format. The value must be an associated array
- * having the timestamps as keys and the event types as values.
- *
- * @param Array $events The events array.
- * @param integer $format The timing format.
- */
- public function setEvents($events, $format = false)
- {
- $this->_events = $events;
- if ($format !== false)
- $this->_format = $format;
- ksort($this->_events);
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_format);
- foreach ($this->_events as $timestamp => $type)
- $data .= Transform::toUInt8($type) . Transform::toUInt32BE($timestamp);
- return $data;
- }
-}
diff --git a/src/ID3/Frame/GEOB.php b/src/ID3/Frame/GEOB.php
deleted file mode 100644
index 0a3c674..0000000
--- a/src/ID3/Frame/GEOB.php
+++ /dev/null
@@ -1,253 +0,0 @@
-General encapsulated object frame any type of file can be
- * encapsulated.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_GEOB extends ID3_Frame
- implements ID3_Encoding
-{
- /** @var integer */
- private $_encoding;
-
- /** @var string */
- private $_mimeType;
-
- /** @var string */
- private $_filename;
-
- /** @var string */
- private $_description;
-
- /** @var string */
- private $_objectData;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- $this->_mimeType = substr
- ($this->_data, 1, ($pos = strpos($this->_data, "\0", 1)) - 1);
- $this->_data = substr($this->_data, $pos + 1);
-
- switch ($encoding) {
- case self::UTF16:
- list ($this->_filename, $this->_description, $this->_objectData) =
- $this->_explodeString16($this->_data, 3);
- $this->_filename = $this->_convertString
- (Transform::fromString16($this->_filename), "utf-16");
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16");
- break;
- case self::UTF16BE:
- list ($this->_filename, $this->_description, $this->_objectData) =
- $this->_explodeString16($this->_data, 3);
- $this->_filename = $this->_convertString
- (Transform::fromString16($this->_filename), "utf-16be");
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16be");
- break;
- case self::UTF8:
- list ($this->_filename, $this->_description, $this->_objectData) =
- $this->_explodeString8($this->_data, 3);
- $this->_filename = $this->_convertString
- (Transform::fromString8($this->_filename), "utf-8");
- $this->_description = $this->_convertString
- (Transform::fromString8($this->_description), "utf-8");
- break;
- default:
- list ($this->_filename, $this->_description, $this->_objectData) =
- $this->_explodeString8($this->_data, 3);
- $this->_filename = $this->_convertString
- (Transform::fromString8($this->_filename), "iso-8859-1");
- $this->_description = $this->_convertString
- (Transform::fromString8($this->_description), "iso-8859-1");
- }
- }
-
- /**
- * Returns the text encoding.
- *
- * All the strings read from a file are automatically converted to the
- * character encoding specified with the encoding option. See
- * {@link ID3v2} for details. This method returns the original text encoding
- * used to write the frame.
- *
- * @return integer
- */
- public function getEncoding() { return $this->_encoding; }
-
- /**
- * Sets the text encoding.
- *
- * All the string written to the frame are done so using given character
- * encoding. No conversions of existing data take place upon the call to this
- * method thus all texts must be given in given character encoding.
- *
- * The default character encoding used to write the frame is UTF-8.
- *
- * @see ID3_Encoding
- * @param integer $encoding The text encoding.
- */
- public function setEncoding($encoding) { $this->_encoding = $encoding; }
-
- /**
- * Returns the MIME type. The MIME type is always encoded with ISO-8859-1.
- *
- * @return string
- */
- public function getMimeType() { return $this->_mimeType; }
-
- /**
- * Sets the MIME type. The MIME type is always ISO-8859-1 encoded.
- *
- * @param string $mimeType The MIME type.
- */
- public function setMimeType($mimeType) { $this->_mimeType = $mimeType; }
-
- /**
- * Returns the file name.
- *
- * @return string
- */
- public function getFilename() { return $this->_filename; }
-
- /**
- * Sets the file name using given encoding. The file name encoding must be
- * that of the description text.
- *
- * @param string $description The file description text.
- * @param integer $encoding The text encoding.
- */
- public function setFilename($filename, $encoding = false)
- {
- $this->_filename = $filename;
- if ($encoding !== false)
- $this->_encoding = $encoding;
- }
-
- /**
- * Returns the file description.
- *
- * @return string
- */
- public function getDescription() { return $this->_description; }
-
- /**
- * Sets the file description text using given encoding. The description
- * encoding must be that of the file name.
- *
- * @param string $description The file description text.
- * @param integer $encoding The text encoding.
- */
- public function setDescription($description, $encoding = false)
- {
- $this->_description = $description;
- if ($encoding !== false)
- $this->_encoding = $encoding;
- }
-
- /**
- * Returns the embedded object binary data.
- *
- * @return string
- */
- public function getObjectData() { return $this->_objectData; }
-
- /**
- * Sets the embedded object binary data.
- *
- * @param string $objectData The object data.
- */
- public function setObjectData($objectData)
- {
- $this->_objectData = $objectData;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding) . $this->_mimeType . "\0";
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($this->_filename, Transform::LITTLE_ENDIAN_ORDER, 1) .
- Transform::toString16
- ($this->_description, Transform::LITTLE_ENDIAN_ORDER, 1);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($this->_filename, false, 1) .
- Transform::toString16($this->_description, false, 1);
- break;
- default:
- $data .= $this->_filename . "\0" . $this->_description . "\0";
- }
- return $data . $this->_objectData;
- }
-}
diff --git a/src/ID3/Frame/GRID.php b/src/ID3/Frame/GRID.php
deleted file mode 100644
index faac81c..0000000
--- a/src/ID3/Frame/GRID.php
+++ /dev/null
@@ -1,152 +0,0 @@
-Group identification registration frame enables grouping of
- * otherwise unrelated frames. This can be used when some frames are to be
- * signed. To identify which frames belongs to a set of frames a group
- * identifier must be registered in the tag with this frame.
- *
- * The owner identifier is a URL containing an email address, or a link to a
- * location where an email address can be found, that belongs to the
- * organisation responsible for this grouping. Questions regarding the grouping
- * should be sent to the indicated email address.
- *
- * The group symbol contains a value that associates the frame with this group
- * throughout the whole tag, in the range $80-F0. All other values are reserved.
- * The group symbol may optionally be followed by some group specific data, e.g.
- * a digital signature. There may be several GRID frames in a tag but only one
- * containing the same symbol and only one containing the same owner identifier.
- * The group symbol must be used somewhere in the tag. See
- * {@link ID3_Frame#GROUPING_ownerENTITY} for more information.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_GRID extends ID3_Frame
-{
- /** @var string */
- private $_owner;
-
- /** @var integer */
- private $_group;
-
- /** @var string */
- private $_groupData;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- list($this->_owner, $this->_data) = $this->_explodeString8($this->_data, 2);
- $this->_group = Transform::fromUInt8($this->_data[0]);
- $this->_groupData = substr($this->_data, 1);
- }
-
- /**
- * Returns the owner identifier string.
- *
- * @return string
- */
- public function getOwner() { return $this->_owner; }
-
- /**
- * Sets the owner identifier string.
- *
- * @param string $owner The owner identifier string.
- */
- public function setOwner($owner) { $this->_owner = $owner; }
-
- /**
- * Returns the group symbol.
- *
- * @return integer
- */
- public function getGroup() { return $this->_group; }
-
- /**
- * Sets the group symbol.
- *
- * @param integer $group The group symbol.
- */
- public function setGroup($group) { $this->_group = $group; }
-
- /**
- * Returns the group dependent data.
- *
- * @return string
- */
- public function getGroupData() { return $this->_groupData; }
-
- /**
- * Sets the group dependent data.
- *
- * @param string $groupData The data.
- */
- public function setGroupData($groupData) { $this->_groupData = $groupData; }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return
- $this->_owner . "\0" . Transform::toUInt8($this->_group) .
- $this->_groupData;
- }
-}
diff --git a/src/ID3/Frame/IPLS.php b/src/ID3/Frame/IPLS.php
deleted file mode 100644
index b789605..0000000
--- a/src/ID3/Frame/IPLS.php
+++ /dev/null
@@ -1,191 +0,0 @@
-Involved people list is a frame containing the names of those
- * involved, and how they were involved. There may only be one IPLS frame in
- * each tag.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @deprecated ID3v2.3.0
- */
-final class ID3_Frame_IPLS extends ID3_Frame
- implements ID3_Encoding
-{
- /** @var integer */
- private $_encoding;
-
- /** @var Array */
- private $_people = array();
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- $data = substr($this->_data, 1);
- $order = Transform::MACHINE_ENDIAN_ORDER;
- switch ($encoding) {
- case self::UTF16:
- $data = $this->_explodeString16($data);
- foreach ($data as &$str)
- $str = $this->_convertString
- (Transform::fromString16($str, $order), "utf-16");
- break;
- case self::UTF16BE:
- $data = $this->_explodeString16($data);
- foreach ($data as &$str)
- $str = $this->_convertString
- (Transform::fromString16($str), "utf-16be");
- break;
- case self::UTF8:
- $data = $this->_convertString($this->_explodeString8($data), "utf-8");
- break;
- default:
- $data = $this->_convertString($this->_explodeString8($data), "iso-8859-1");
- }
-
- for ($i = 0; $i < count($data) - 1; $i += 2)
- $this->_people[] = array($data[$i] => @$data[$i + 1]);
- }
-
- /**
- * Returns the text encoding.
- *
- * All the strings read from a file are automatically converted to the
- * character encoding specified with the encoding option. See
- * {@link ID3v2} for details. This method returns the original text encoding
- * used to write the frame.
- *
- * @return integer
- */
- public function getEncoding() { return $this->_encoding; }
-
- /**
- * Sets the text encoding.
- *
- * All the string written to the frame are done so using given character
- * encoding. No conversions of existing data take place upon the call to this
- * method thus all texts must be given in given character encoding.
- *
- * The default character encoding used to write the frame is UTF-8.
- *
- * @see ID3_Encoding
- * @param integer $encoding The text encoding.
- */
- public function setEncoding($encoding) { $this->_encoding = $encoding; }
-
- /**
- * Returns the involved people list as an array. For each person, the array
- * contains an entry, which too is an associate array with involvement as its
- * key and involvee as its value.
- *
- * @return Array
- */
- public function getPeople() { return $this->_people; }
-
- /**
- * Adds a person with his involvement.
- *
- * @return string
- */
- public function addPerson($involvement, $person)
- {
- $this->_people[] = array($involvement => $person);
- }
-
- /**
- * Sets the involved people list array. For each person, the array must
- * contain an associate array with involvement as its key and involvee as its
- * value.
- *
- * @param Array $people The involved people list.
- */
- public function setPeople($people) { $this->_people = $people; }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding);
- foreach ($this->_people as $entry) {
- foreach ($entry as $key => $val) {
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($key, Transform::LITTLE_ENDIAN_ORDER, 1) .
- Transform::toString16($val, Transform::LITTLE_ENDIAN_ORDER, 1);
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($key, false, 1) .
- Transform::toString16($val, false, 1);
- break;
- default:
- $data .= $key . "\0" . $val . "\0";
- }
- }
- }
- return $data;
- }
-}
diff --git a/src/ID3/Frame/LINK.php b/src/ID3/Frame/LINK.php
deleted file mode 100644
index 341eeb4..0000000
--- a/src/ID3/Frame/LINK.php
+++ /dev/null
@@ -1,173 +0,0 @@
-Linked information frame is used to keep information duplication
- * as low as possible by linking information from another ID3v2 tag that might
- * reside in another audio file or alone in a binary file. It is recommended
- * that this method is only used when the files are stored on a CD-ROM or other
- * circumstances when the risk of file separation is low.
- *
- * Data should be retrieved from the first tag found in the file to which this
- * link points. There may be more than one LINK frame in a tag, but only one
- * with the same contents.
- *
- * A linked frame is to be considered as part of the tag and has the same
- * restrictions as if it was a physical part of the tag (i.e. only one
- * {@link ID3_Frame_RVRB} frame allowed, whether it's linked or not).
- *
- * Frames that may be linked and need no additional data are
- * {@link ID3_Frame_ASPI}, {@link ID3_Frame_ETCO}, {@link ID3_Frame_EQU2},
- * {@link ID3_Frame_MCDI}, {@link ID3_Frame_MLLT}, {@link ID3_Frame_OWNE},
- * {@link ID3_Frame_RVA2}, {@link ID3_Frame_RVRB}, {@link ID3_Frame_SYTC}, the
- * text information frames (ie frames descendats of
- * {@link ID3_Frame_AbstractText}) and the URL link frames (ie frames descendants
- * of {@link ID3_Frame_AbstractLink}).
- *
- * The {@link ID3_Frame_AENC}, {@link ID3_Frame_APIC}, {@link ID3_Frame_GEOB}
- * and {@link ID3_Frame_TXXX} frames may be linked with the content descriptor
- * as additional ID data.
- *
- * The {@link ID3_Frame_USER} frame may be linked with the language field as
- * additional ID data.
- *
- * The {@link ID3_Frame_PRIV} frame may be linked with the owner identifier as
- * additional ID data.
- *
- * The {@link ID3_Frame_COMM}, {@link ID3_Frame_SYLT} and {@link ID3_Frame_USLT}
- * frames may be linked with three bytes of language descriptor directly
- * followed by a content descriptor as additional ID data.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_LINK extends ID3_Frame
-{
- /** @var string */
- private $_target;
-
- /** @var string */
- private $_url;
-
- /** @var string */
- private $_qualifier;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $this->_target = substr($this->_data, 0, 4);
- list($this->_url, $this->_qualifier) =
- $this->_explodeString8(substr($this->_data, 4), 2);
- }
-
- /**
- * Returns the target tag identifier.
- *
- * @return string
- */
- public function getTarget() { return $this->_target; }
-
- /**
- * Sets the target tag identifier.
- *
- * @param string $target The target tag identifier.
- */
- public function setTarget($target) { $this->_target = $target; }
-
- /**
- * Returns the target tag URL.
- *
- * @return string
- */
- public function getUrl() { return $this->_url; }
-
- /**
- * Sets the target tag URL.
- *
- * @param string $url The target URL.
- */
- public function setUrl($url) { $this->_url = $url; }
-
- /**
- * Returns the additional data to identify further the tag.
- *
- * @return string
- */
- public function getQualifier() { return $this->_qualifier; }
-
- /**
- * Sets the additional data to be used in tag identification.
- *
- * @param string $identifier The qualifier.
- */
- public function setQualifier($qualifier)
- {
- $this->_qualifier = $qualifier;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return
- Transform::toString8(substr($this->_target, 0, 4), 4) .
- $this->_url . "\0" . $this->_qualifier;
- }
-}
diff --git a/src/ID3/Frame/MCDI.php b/src/ID3/Frame/MCDI.php
deleted file mode 100644
index 625fd6f..0000000
--- a/src/ID3/Frame/MCDI.php
+++ /dev/null
@@ -1,86 +0,0 @@
-
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_MCDI extends ID3_Frame
-{
- /**
- * Returns the CD TOC binary dump.
- *
- * @return string
- */
- public function getData() { return $this->_data; }
-
- /**
- * Sets the CD TOC binary dump.
- *
- * @param string $data The CD TOC binary dump string.
- */
- public function setData($data) { $this->_data = $data; }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData() { return $this->_data; }
-}
diff --git a/src/ID3/Frame/MLLT.php b/src/ID3/Frame/MLLT.php
deleted file mode 100644
index ee1218f..0000000
--- a/src/ID3/Frame/MLLT.php
+++ /dev/null
@@ -1,172 +0,0 @@
-MPEG location lookup table frame includes references that the
- * software can use to calculate positions in the file.
- *
- * The MPEG frames between reference describes how much the frame counter should
- * be increased for every reference. If this value is two then the first
- * reference points out the second frame, the 2nd reference the 4th frame, the
- * 3rd reference the 6th frame etc. In a similar way the bytes between reference
- * and milliseconds between reference points out bytes and milliseconds
- * respectively.
- *
- * Each reference consists of two parts; a certain number of bits that describes
- * the difference between what is said in bytes between reference and the
- * reality and a certain number of bits that describes the difference between
- * what is said in milliseconds between reference and the reality.
- *
- * There may only be one MLLT frame in each tag.
- *
- * @todo Data parsing and write support
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_MLLT extends ID3_Frame
-{
- /** @var integer */
- private $_frames;
-
- /** @var integer */
- private $_bytes;
-
- /** @var integer */
- private $_milliseconds;
-
- /** @var Array */
- private $_deviation = array();
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null) {
- require_once("ID3/Exception.php");
- throw new ID3_Exception("Write not supported yet");
- }
-
- $this->_frames = Transform::fromInt16BE(substr($this->_data, 0, 2));
- $this->_bytes = Transform::fromInt32BE(substr($this->_data, 2, 3));
- $this->_milliseconds = Transform::fromInt32BE(substr($this->_data, 5, 3));
-
- $byteDevBits = Transform::fromInt8($this->_data[8]);
- $millisDevBits = Transform::fromInt8($this->_data[9]);
-
- // $data = substr($this->_data, 10);
- }
-
- /**
- * Returns the number of MPEG frames between reference.
- *
- * @return integer
- */
- public function getFrames() { return $this->_frames; }
-
- /**
- * Sets the number of MPEG frames between reference.
- *
- * @param integer $frames The number of MPEG frames.
- */
- public function setFrames($frames) { $this->_frames = $frames; }
-
- /**
- * Returns the number of bytes between reference.
- *
- * @return integer
- */
- public function getBytes() { return $this->_bytes; }
-
- /**
- * Sets the number of bytes between reference.
- *
- * @param integer $bytes The number of bytes.
- */
- public function setBytes($bytes) { $this->_bytes = $bytes; }
-
- /**
- * Returns the number of milliseconds between references.
- *
- * @return integer
- */
- public function getMilliseconds() { return $this->_milliseconds; }
-
- /**
- * Sets the number of milliseconds between references.
- *
- * @param integer $milliseconds The number of milliseconds.
- */
- public function setMilliseconds($milliseconds)
- {
- return $this->_milliseconds;
- }
-
- /**
- * Returns the deviations as an array. Each value is an array containing two
- * values, ie the deviation in bytes, and the deviation in milliseconds,
- * respectively.
- *
- * @return Array
- */
- public function getDeviation() { return $this->_deviation; }
-
- /**
- * Sets the deviations array. The array must consist of arrays, each of which
- * having two values, the deviation in bytes, and the deviation in
- * milliseconds, respectively.
- *
- * @param Array $deviation The deviations array.
- */
- public function setDeviation($deviation) { $this->_deviation = $deviation; }
-}
diff --git a/src/ID3/Frame/OWNE.php b/src/ID3/Frame/OWNE.php
deleted file mode 100644
index 4af0048..0000000
--- a/src/ID3/Frame/OWNE.php
+++ /dev/null
@@ -1,238 +0,0 @@
-Ownership frame might be used as a reminder of a made transaction
- * or, if signed, as proof. Note that the {@link ID3_Frame_USER} and
- * {@link ID3_Frame_TOWN} frames are good to use in conjunction with this one.
- *
- * There may only be one OWNE frame in a tag.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_OWNE extends ID3_Frame
- implements ID3_Encoding
-{
- /** @var integer */
- private $_encoding;
-
- /** @var string */
- private $_currency = "EUR";
-
- /** @var string */
- private $_price;
-
- /** @var string */
- private $_date;
-
- /** @var string */
- private $_seller;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- list($tmp, $this->_data) =
- $this->_explodeString8(substr($this->_data, 1), 2);
- $this->_currency = substr($tmp, 0, 3);
- $this->_price = substr($tmp, 3);
- $this->_date = substr($this->_data, 0, 8);
- $this->_data = substr($this->_data, 8);
-
- switch ($encoding) {
- case self::UTF16:
- $this->_seller = $this->_convertString
- (Transform::fromString16($this->_data), "utf-16");
- break;
- case self::UTF16BE:
- $this->_seller = $this->_convertString
- (Transform::fromString16($this->_data), "utf-16be");
- break;
- case self::UTF8:
- $this->_seller = $this->_convertString
- (Transform::fromString8($this->_data), "utf-8");
- break;
- default:
- $this->_seller = $this->_convertString
- (Transform::fromString8($this->_data), "iso-8859-1");
- }
- }
-
- /**
- * Returns the text encoding.
- *
- * All the strings read from a file are automatically converted to the
- * character encoding specified with the encoding option. See
- * {@link ID3v2} for details. This method returns the original text encoding
- * used to write the frame.
- *
- * @return integer
- */
- public function getEncoding() { return $this->_encoding; }
-
- /**
- * Sets the text encoding.
- *
- * All the string written to the frame are done so using given character
- * encoding. No conversions of existing data take place upon the call to this
- * method thus all texts must be given in given character encoding.
- *
- * The default character encoding used to write the frame is UTF-8.
- *
- * @see ID3_Encoding
- * @param integer $encoding The text encoding.
- */
- public function setEncoding($encoding) { $this->_encoding = $encoding; }
-
- /**
- * Returns the currency used in transaction, encoded according to
- * {@link http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes/currency_codes_list-1.htm
- * ISO 4217} alphabetic currency code.
- *
- * @return string
- */
- public function getCurrency() { return $this->_currency; }
-
- /**
- * Sets the currency used in transaction, encoded according to
- * {@link http://www.iso.org/iso/support/faqs/faqs_widely_used_standards/widely_used_standards_other/currency_codes/currency_codes_list-1.htm
- * ISO 4217} alphabetic currency code.
- *
- * @param string $currency The currency code.
- */
- public function setCurrency($currency) { $this->_currency = $currency; }
-
- /**
- * Returns the price as a numerical string using "." as the decimal separator.
- *
- * @return string
- */
- public function getPrice() { return $this->_price; }
-
- /**
- * Sets the price.
- *
- * @param integer $price The price.
- */
- public function setPrice($price)
- {
- $this->_price = number_format($price, 2, ".", "");
- }
-
- /**
- * Returns the date of purchase as an 8 character date string (YYYYMMDD).
- *
- * @return string
- */
- public function getDate() { return $this->_date; }
-
- /**
- * Sets the date of purchase. The date must be an 8 character date string
- * (YYYYMMDD).
- *
- * @param string $date The date string.
- */
- public function setDate($date) { $this->_date = $date; }
-
- /**
- * Returns the name of the seller.
- *
- * @return string
- */
- public function getSeller() { return $this->_seller; }
-
- /**
- * Sets the name of the seller using given encoding.
- *
- * @param string $seller The name of the seller.
- * @param integer $encoding The text encoding.
- */
- public function setSeller($seller, $encoding = false)
- {
- $this->_seller = $seller;
- if ($encoding !== false)
- $this->_encoding = $encoding;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding) . $this->_currency .
- $this->_price . "\0" . $this->_date;
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($this->_seller, Transform::LITTLE_ENDIAN_ORDER);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($this->_seller);
- break;
- default:
- $data .= Transform::toString8($this->_seller);
- }
- return $data;
- }
-}
diff --git a/src/ID3/Frame/PCNT.php b/src/ID3/Frame/PCNT.php
deleted file mode 100644
index 233412f..0000000
--- a/src/ID3/Frame/PCNT.php
+++ /dev/null
@@ -1,111 +0,0 @@
-Play counter is simply a counter of the number of times a file has
- * been played. The value is increased by one every time the file begins to
- * play. There may only be one PCNT frame in each tag.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_PCNT extends ID3_Frame
-{
- /** @var integer */
- private $_counter = 0;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- if (strlen($this->_data) > 4)
- $this->_counter = Transform::fromInt64BE($this->_data); // UInt64
- else
- $this->_counter = Transform::fromUInt32BE($this->_data);
- }
-
- /**
- * Returns the counter.
- *
- * @return integer
- */
- public function getCounter() { return $this->_counter; }
-
- /**
- * Adds counter by one.
- */
- public function addCounter() { $this->_counter++; }
-
- /**
- * Sets the counter value.
- *
- * @param integer $counter The counter value.
- */
- public function setCounter($counter) { $this->_counter = $counter; }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return
- $this->_counter > 4294967295 ?
- Transform::toInt64BE($this->_counter) : // UInt64
- Transform::toUInt32BE($this->_counter);
- }
-}
diff --git a/src/ID3/Frame/POPM.php b/src/ID3/Frame/POPM.php
deleted file mode 100644
index b182a7b..0000000
--- a/src/ID3/Frame/POPM.php
+++ /dev/null
@@ -1,161 +0,0 @@
-Popularimeter frame is to specify how good an audio
- * file is. Many interesting applications could be found to this frame such as a
- * playlist that features better audio files more often than others or it could
- * be used to profile a person's taste and find other good files by comparing
- * people's profiles. The frame contains the email address to the user, one
- * rating byte and a four byte play counter, intended to be increased with one
- * for every time the file is played.
- *
- * The rating is 1-255 where 1 is worst and 255 is best. 0 is unknown. If no
- * personal counter is wanted it may be omitted. When the counter reaches all
- * one's, one byte is inserted in front of the counter thus making the counter
- * eight bits bigger in the same away as the play counter
- * {@link ID3_Frame_PCNT}. There may be more than one POPM frame in each tag,
- * but only one with the same email address.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_POPM extends ID3_Frame
-{
- /** @var string */
- private $_owner;
-
- /** @var integer */
- private $_rating = 0;
-
- /** @var integer */
- private $_counter = 0;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- list($this->_owner, $this->_data) = $this->_explodeString8($this->_data, 2);
- $this->_rating = Transform::fromUInt8($this->_data[0]);
- $this->_data = substr($this->_data, 1);
-
- if (strlen($this->_data) > 4)
- $this->_counter = Transform::fromInt64BE($this->_data); // UInt64
- else if (strlen($this->_data) > 0)
- $this->_counter = Transform::fromUInt32BE($this->_data);
- }
-
- /**
- * Returns the owner identifier string.
- *
- * @return string
- */
- public function getOwner() { return $this->_owner; }
-
- /**
- * Sets the owner identifier string.
- *
- * @param string $owner The owner identifier string.
- */
- public function setOwner($owner) { return $this->_owner = $owner; }
-
- /**
- * Returns the user rating.
- *
- * @return integer
- */
- public function getRating() { return $this->_rating; }
-
- /**
- * Sets the user rating.
- *
- * @param integer $rating The user rating.
- */
- public function setRating($rating) { $this->_rating = $rating; }
-
- /**
- * Returns the counter.
- *
- * @return integer
- */
- public function getCounter() { return $this->_counter; }
-
- /**
- * Adds counter by one.
- */
- public function addCounter() { $this->_counter++; }
-
- /**
- * Sets the counter value.
- *
- * @param integer $counter The counter value.
- */
- public function setCounter($counter) { $this->_counter = $counter; }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return
- $this->_owner . "\0" . Transform::toInt8($this->_rating) .
- ($this->_counter > 0xffffffff ?
- Transform::toInt64BE($this->_counter) :
- ($this->_counter > 0 ? Transform::toUInt32BE($this->_counter) : 0));
- }
-}
diff --git a/src/ID3/Frame/POSS.php b/src/ID3/Frame/POSS.php
deleted file mode 100644
index 5b0f67a..0000000
--- a/src/ID3/Frame/POSS.php
+++ /dev/null
@@ -1,132 +0,0 @@
-Position synchronisation frame delivers information to the
- * listener of how far into the audio stream he picked up; in effect, it states
- * the time offset from the first frame in the stream. There may only be one
- * POSS frame in each tag.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_POSS extends ID3_Frame
- implements ID3_Timing
-{
- /** @var integer */
- private $_format = ID3_Timing::MPEG_FRAMES;
-
- /** @var integer */
- private $_position;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $this->_format = Transform::fromUInt8($this->_data[0]);
- $this->_position = Transform::fromUInt32BE(substr($this->_data, 1, 4));
- }
-
- /**
- * Returns the timing format.
- *
- * @return integer
- */
- public function getFormat() { return $this->_format; }
-
- /**
- * Sets the timing format.
- *
- * @see ID3_Timing
- * @param integer $format The timing format.
- */
- public function setFormat($format) { $this->_format = $format; }
-
- /**
- * Returns the position where in the audio the listener starts to receive,
- * i.e. the beginning of the next frame.
- *
- * @return integer
- */
- public function getPosition() { return $this->_position; }
-
- /**
- * Sets the position where in the audio the listener starts to receive,
- * i.e. the beginning of the next frame, using given format.
- *
- * @param integer $position The position.
- * @param integer $format The timing format.
- */
- public function setPosition($position, $format = false)
- {
- $this->_position = $position;
- if ($format !== false)
- $this->_format = $format;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return
- Transform::toUInt8($this->_format) .
- Transform::toUInt32BE($this->_position);
- }
-}
diff --git a/src/ID3/Frame/PRIV.php b/src/ID3/Frame/PRIV.php
deleted file mode 100644
index e340591..0000000
--- a/src/ID3/Frame/PRIV.php
+++ /dev/null
@@ -1,126 +0,0 @@
-Private frame is used to contain information from a software
- * producer that its program uses and does not fit into the other frames. The
- * frame consists of an owner identifier string and the binary data. The owner
- * identifier is URL containing an email address, or a link to a location where
- * an email address can be found, that belongs to the organisation responsible
- * for the frame. Questions regarding the frame should be sent to the indicated
- * email address. The tag may contain more than one PRIV frame but only with
- * different contents.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_PRIV extends ID3_Frame
-{
- /** @var string */
- private $_owner;
-
- /** @var string */
- private $_privateData;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- list($this->_owner, $this->_privateData) =
- $this->_explodeString8($this->_data, 2);
- }
-
- /**
- * Returns the owner identifier string.
- *
- * @return string
- */
- public function getOwner() { return $this->_owner; }
-
- /**
- * Sets the owner identifier string.
- *
- * @param string $owner The owner identifier string.
- */
- public function setOwner($owner) { $this->_owner = $owner; }
-
- /**
- * Returns the private binary data associated with the frame.
- *
- * @return string
- */
- public function getPrivateData() { return $this->_privateData; }
-
- /**
- * Sets the private binary data associated with the frame.
- *
- * @param string $privateData The private binary data string.
- */
- public function setPrivateData($privateData)
- {
- $this->_privateData = $privateData;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return $this->_owner . "\0" . $this->_privateData;
- }
-}
diff --git a/src/ID3/Frame/RBUF.php b/src/ID3/Frame/RBUF.php
deleted file mode 100644
index 87095bf..0000000
--- a/src/ID3/Frame/RBUF.php
+++ /dev/null
@@ -1,181 +0,0 @@
-Recommended buffer size frame. If the embedded info
- * flag is set then this indicates that an ID3 tag with the maximum size
- * described in buffer size may occur in the audio stream. In such case the tag
- * should reside between two MPEG frames, if the audio is MPEG encoded. If the
- * position of the next tag is known, offset to next tag may be used. The offset
- * is calculated from the end of tag in which this frame resides to the first
- * byte of the header in the next. This field may be omitted. Embedded tags are
- * generally not recommended since this could render unpredictable behaviour
- * from present software/hardware.
- *
- * For applications like streaming audio it might be an idea to embed tags into
- * the audio stream though. If the clients connects to individual connections
- * like HTTP and there is a possibility to begin every transmission with a tag,
- * then this tag should include a recommended buffer size frame. If the client
- * is connected to a arbitrary point in the stream, such as radio or multicast,
- * then the recommended buffer size frame should be included in every tag.
- *
- * The buffer size should be kept to a minimum. There may only be one RBUF
- * frame in each tag.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_RBUF extends ID3_Frame
-{
- /**
- * A flag to denote that an ID3 tag with the maximum size described in buffer
- * size may occur in the audio stream.
- */
- const EMBEDDED = 0x1;
-
- /** @var integer */
- private $_bufferSize;
-
- /** @var integer */
- private $_infoFlags;
-
- /** @var integer */
- private $_offset = 0;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $this->_bufferSize =
- Transform::fromUInt32BE("\0" . substr($this->_data, 0, 3));
- $this->_infoFlags = Transform::fromInt8($this->_data[3]);
- if ($this->getSize() > 4)
- $this->_offset = Transform::fromInt32BE(substr($this->_data, 4, 4));
- }
-
- /**
- * Returns the buffer size.
- *
- * @return integer
- */
- public function getBufferSize() { return $this->_bufferSize; }
-
- /**
- * Sets the buffer size.
- *
- * @param integer $size The buffer size.
- */
- public function setBufferSize($bufferSize)
- {
- $this->_bufferSize = $bufferSize;
- }
-
- /**
- * Checks whether or not the flag is set. Returns true if the flag
- * is set, false otherwise.
- *
- * @param integer $flag The flag to query.
- * @return boolean
- */
- public function hasInfoFlag($flag)
- {
- return ($this->_infoFlags & $flag) == $flag;
- }
-
- /**
- * Returns the flags byte.
- *
- * @return integer
- */
- public function getInfoFlags() { return $this->_infoFlags; }
-
- /**
- * Sets the flags byte.
- *
- * @param string $flags The flags byte.
- */
- public function setInfoFlags($infoFlags) { $this->_infoFlags = $infoFlags; }
-
- /**
- * Returns the offset to next tag.
- *
- * @return integer
- */
- public function getOffset() { return $this->_offset; }
-
- /**
- * Sets the offset to next tag.
- *
- * @param integer $offset The offset.
- */
- public function setOffset($offset) { $this->_offset = $offset; }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return
- substr(Transform::toUInt32BE($this->_bufferSize), 1, 3) .
- Transform::toInt8($this->_infoFlags) .
- Transform::toInt32BE($this->_offset);
- }
-}
diff --git a/src/ID3/Frame/RVA2.php b/src/ID3/Frame/RVA2.php
deleted file mode 100644
index f54dda1..0000000
--- a/src/ID3/Frame/RVA2.php
+++ /dev/null
@@ -1,217 +0,0 @@
-Relative volume adjustment (2) frame is a more subjective frame than
- * the previous ones. It allows the user to say how much he wants to
- * increase/decrease the volume on each channel when the file is played. The
- * purpose is to be able to align all files to a reference volume, so that you
- * don't have to change the volume constantly. This frame may also be used to
- * balance adjust the audio. The volume adjustment is encoded as a fixed point
- * decibel value, 16 bit signed integer representing (adjustment*512), giving
- * +/- 64 dB with a precision of 0.001953125 dB. E.g. +2 dB is stored as $04 00
- * and -2 dB is $FC 00.
- *
- * There may be more than one RVA2 frame in each tag, but only one with the same
- * identification string.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_RVA2 extends ID3_Frame
-{
- /**
- * The channel type key.
- *
- * @see $types
- * @var string
- */
- const channelType = "channelType";
-
- /**
- * The volume adjustment key. Adjustments are +/- 64 dB with a precision of
- * 0.001953125 dB.
- *
- * @var string
- */
- const volumeAdjustment = "volumeAdjustment";
-
- /**
- * The peak volume key.
- *
- * @var string
- */
- const peakVolume = "peakVolume";
-
- /**
- * The list of channel types.
- *
- * @var Array
- */
- public static $types = array
- ("Other", "Master volume", "Front right", "Front left", "Back right",
- "Back left", "Front centre", "Back centre", "Subwoofer");
-
- /** @var string */
- private $_device;
-
- /** @var Array */
- private $_adjustments;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- list ($this->_device, $this->_data) =
- $this->_explodeString8($this->_data, 2);
-
- for ($i = $j = 0; $i < 9; $i++) {
- $this->_adjustments[$i] = array
- (self::channelType => Transform::fromInt8($this->_data[$j++]),
- self::volumeAdjustment =>
- Transform::fromInt16BE(substr($this->_data, $j++, 2)) / 512.0);
- $j++;
- $bitsInPeak = Transform::fromInt8($this->_data[$j++]);
- $bytesInPeak = $bitsInPeak > 0 ? ceil($bitsInPeak / 8) : 0;
- switch ($bytesInPeak) {
- case 8:
- case 7:
- case 6:
- case 5:
- $this->_adjustments[$i][self::peakVolume] =
- Transform::fromInt64BE(substr($this->_data, $j, $bytesInPeak));
- break;
- case 4:
- case 3:
- $this->_adjustments[$i][self::peakVolume] =
- Transform::fromUInt32BE(substr($this->_data, $j, $bytesInPeak));
- break;
- case 2:
- $this->_adjustments[$i][self::peakVolume] =
- Transform::fromUInt16BE(substr($this->_data, $j, $bytesInPeak));
- break;
- case 1:
- $this->_adjustments[$i][self::peakVolume] =
- Transform::fromUInt8(substr($this->_data, $j, $bytesInPeak));
- }
- $j += $bytesInPeak;
- }
- }
-
- /**
- * Returns the device where the adjustments should apply.
- *
- * @return string
- */
- public function getDevice() { return $this->_device; }
-
- /**
- * Sets the device where the adjustments should apply.
- *
- * @param string $device The device.
- */
- public function setDevice($device) { $this->_device = $device; }
-
- /**
- * Returns the array containing volume adjustments for each channel. Volume
- * adjustments are arrays themselves containing the following keys:
- * channelType, volumeAdjustment, peakVolume.
- *
- * @return Array
- */
- public function getAdjustments() { return $this->_adjustments; }
-
- /**
- * Sets the array of volume adjustments for each channel. Each volume
- * adjustment is an array too containing the following keys: channelType,
- * volumeAdjustment, peakVolume.
- *
- * @param Array $adjustments The volume adjustments array.
- */
- public function setAdjustments($adjustments)
- {
- $this->_adjustments = $adjustments;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = $this->_device . "\0";
- foreach ($this->_adjustments as $channel) {
- $data .= Transform::toInt8($channel[self::channelType]) .
- Transform::toInt16BE($channel[self::volumeAdjustment] * 512);
- if (abs($channel[self::peakVolume]) <= 0xff)
- $data .= Transform::toInt8(8) .
- Transform::toUInt8($channel[self::peakVolume]);
- else if (abs($channel[self::peakVolume]) <= 0xffff)
- $data .= Transform::toInt8(16) .
- Transform::toUInt16BE($channel[self::peakVolume]);
- else if (abs($channel[self::peakVolume]) <= 0xffffffff)
- $data .= Transform::toInt8(32) .
- Transform::toUInt32BE($channel[self::peakVolume]);
- else
- $data .= Transform::toInt8(64) .
- Transform::toInt64BE($channel[self::peakVolume]); // UInt64
- }
- return $data;
- }
-}
diff --git a/src/ID3/Frame/RVAD.php b/src/ID3/Frame/RVAD.php
deleted file mode 100644
index 0e0d4e1..0000000
--- a/src/ID3/Frame/RVAD.php
+++ /dev/null
@@ -1,254 +0,0 @@
-Relative volume adjustment frame is a more subjective function
- * than the previous ones. It allows the user to say how much he wants to
- * increase/decrease the volume on each channel while the file is played. The
- * purpose is to be able to align all files to a reference volume, so that you
- * don't have to change the volume constantly. This frame may also be used to
- * balance adjust the audio.
- *
- * There may only be one RVAD frame in each tag.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @deprecated ID3v2.3.0
- */
-final class ID3_Frame_RVAD extends ID3_Frame
-{
- /* The required keys. */
-
- /** @var string */
- const right = "right";
-
- /** @var string */
- const left = "left";
-
- /** @var string */
- const peakRight = "peakRight";
-
- /** @var string */
- const peakLeft = "peakLeft";
-
- /* The optional keys. */
-
- /** @var string */
- const rightBack = "rightBack";
-
- /** @var string */
- const leftBack = "leftBack";
-
- /** @var string */
- const peakRightBack = "peakRightBack";
-
- /** @var string */
- const peakLeftBack = "peakLeftBack";
-
- /** @var string */
- const center = "center";
-
- /** @var string */
- const peakCenter = "peakCenter";
-
- /** @var string */
- const bass = "bass";
-
- /** @var string */
- const peakBass = "peakBass";
-
- /** @var Array */
- private $_adjustments;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $flags = Transform::fromInt8($this->_data[0]);
- $descriptionBits = Transform::fromInt8($this->_data[1]);
- if ($descriptionBits <= 8 || $descriptionBits > 16) {
- require_once("ID3/Exception.php");
- throw new ID3_Exception
- ("Unsupported description bit size of: " . $descriptionBits);
- }
-
- $this->_adjustments[self::right] =
- ($flags & 0x1) == 0x1 ?
- Transform::fromUInt16BE(substr($this->_data, 2, 2)) :
- -Transform::fromUInt16BE(substr($this->_data, 2, 2));
- $this->_adjustments[self::left] =
- ($flags & 0x2) == 0x2 ?
- Transform::fromUInt16BE(substr($this->_data, 4, 2)) :
- -Transform::fromUInt16BE(substr($this->_data, 4, 2));
- $this->_adjustments[self::peakRight] =
- Transform::fromUInt16BE(substr($this->_data, 6, 2));
- $this->_adjustments[self::peakLeft] =
- Transform::fromUInt16BE(substr($this->_data, 8, 2));
-
- if ($this->getSize() <= 10)
- return;
-
- $this->_adjustments[self::rightBack] =
- ($flags & 0x4) == 0x4 ?
- Transform::fromUInt16BE(substr($this->_data, 10, 2)) :
- -Transform::fromUInt16BE(substr($this->_data, 10, 2));
- $this->_adjustments[self::leftBack] =
- ($flags & 0x8) == 0x8 ?
- Transform::fromUInt16BE(substr($this->_data, 12, 2)) :
- -Transform::fromUInt16BE(substr($this->_data, 12, 2));
- $this->_adjustments[self::peakRightBack] =
- Transform::fromUInt16BE(substr($this->_data, 14, 2));
- $this->_adjustments[self::peakLeftBack] =
- Transform::fromUInt16BE(substr($this->_data, 16, 2));
-
- if ($this->getSize() <= 18)
- return;
-
- $this->_adjustments[self::center] =
- ($flags & 0x10) == 0x10 ?
- Transform::fromUInt16BE(substr($this->_data, 18, 2)) :
- -Transform::fromUInt16BE(substr($this->_data, 18, 2));
- $this->_adjustments[self::peakCenter] =
- Transform::fromUInt16BE(substr($this->_data, 20, 2));
-
- if ($this->getSize() <= 22)
- return;
-
- $this->_adjustments[self::bass] =
- ($flags & 0x20) == 0x20 ?
- Transform::fromUInt16BE(substr($this->_data, 22, 2)) :
- -Transform::fromUInt16BE(substr($this->_data, 22, 2));
- $this->_adjustments[self::peakBass] =
- Transform::fromUInt16BE(substr($this->_data, 24, 2));
- }
-
- /**
- * Returns the array containing the volume adjustments. The array must contain
- * the following keys: right, left, peakRight, peakLeft. It may optionally
- * contain the following keys: rightBack, leftBack, peakRightBack,
- * peakLeftBack, center, peakCenter, bass, and peakBass.
- *
- * @return Array
- */
- public function getAdjustments() { return $this->_adjustments; }
-
- /**
- * Sets the array of volume adjustments. The array must contain the following
- * keys: right, left, peakRight, peakLeft. It may optionally contain the
- * following keys: rightBack, leftBack, peakRightBack, peakLeftBack, center,
- * peakCenter, bass, and peakBass.
- *
- * @param Array $adjustments The volume adjustments array.
- */
- public function setAdjustments($adjustments)
- {
- $this->_adjustments = $adjustments;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $flags = 0;
- if ($this->_adjustments[self::right] > 0)
- $flags = $flags | 0x1;
- if ($this->_adjustments[self::left] > 0)
- $flags = $flags | 0x2;
- $data = Transform::toInt8(16) .
- Transform::toUInt16BE(abs($this->_adjustments[self::right])) .
- Transform::toUInt16BE(abs($this->_adjustments[self::left])) .
- Transform::toUInt16BE(abs($this->_adjustments[self::peakRight])) .
- Transform::toUInt16BE(abs($this->_adjustments[self::peakLeft]));
-
- if (isset($this->_adjustments[self::rightBack]) &&
- isset($this->_adjustments[self::leftBack]) &&
- isset($this->_adjustments[self::peakRightBack]) &&
- isset($this->_adjustments[self::peakLeftBack])) {
- if ($this->_adjustments[self::rightBack] > 0)
- $flags = $flags | 0x4;
- if ($this->_adjustments[self::leftBack] > 0)
- $flags = $flags | 0x8;
- $data .=
- Transform::toUInt16BE(abs($this->_adjustments[self::rightBack])) .
- Transform::toUInt16BE(abs($this->_adjustments[self::leftBack])) .
- Transform::toUInt16BE(abs($this->_adjustments[self::peakRightBack])) .
- Transform::toUInt16BE(abs($this->_adjustments[self::peakLeftBack]));
- }
-
- if (isset($this->_adjustments[self::center]) &&
- isset($this->_adjustments[self::peakCenter])) {
- if ($this->_adjustments[self::center] > 0)
- $flags = $flags | 0x10;
- $data .=
- Transform::toUInt16BE(abs($this->_adjustments[self::center])) .
- Transform::toUInt16BE(abs($this->_adjustments[self::peakCenter]));
- }
-
- if (isset($this->_adjustments[self::bass]) &&
- isset($this->_adjustments[self::peakBass])) {
- if ($this->_adjustments[self::bass] > 0)
- $flags = $flags | 0x20;
- $data .=
- Transform::toUInt16BE(abs($this->_adjustments[self::bass])) .
- Transform::toUInt16BE(abs($this->_adjustments[self::peakBass]));
- }
- return Transform::toInt8($flags) . $data;
- }
-}
diff --git a/src/ID3/Frame/RVRB.php b/src/ID3/Frame/RVRB.php
deleted file mode 100644
index 3443c6d..0000000
--- a/src/ID3/Frame/RVRB.php
+++ /dev/null
@@ -1,314 +0,0 @@
-Reverb is yet another subjective frame, with which you can adjust
- * echoes of different kinds. Reverb left/right is the delay between every
- * bounce in milliseconds. Reverb bounces left/right is the number of bounces
- * that should be made. $FF equals an infinite number of bounces. Feedback is
- * the amount of volume that should be returned to the next echo bounce. $00 is
- * 0%, $FF is 100%. If this value were $7F, there would be 50% volume reduction
- * on the first bounce, 50% of that on the second and so on. Left to left means
- * the sound from the left bounce to be played in the left speaker, while left
- * to right means sound from the left bounce to be played in the right speaker.
- *
- * Premix left to right is the amount of left sound to be mixed in the right
- * before any reverb is applied, where $00 id 0% and $FF is 100%. Premix right
- * to left does the same thing, but right to left. Setting both premix to $FF
- * would result in a mono output (if the reverb is applied symmetric). There may
- * only be one RVRB frame in each tag.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_RVRB extends ID3_Frame
-{
- /** @var integer */
- private $_reverbLeft;
-
- /** @var integer */
- private $_reverbRight;
-
- /** @var integer */
- private $_reverbBouncesLeft;
-
- /** @var integer */
- private $_reverbBouncesRight;
-
- /** @var integer */
- private $_reverbFeedbackLtoL;
-
- /** @var integer */
- private $_reverbFeedbackLtoR;
-
- /** @var integer */
- private $_reverbFeedbackRtoR;
-
- /** @var integer */
- private $_reverbFeedbackRtoL;
-
- /** @var integer */
- private $_premixLtoR;
-
- /** @var integer */
- private $_premixRtoL;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $this->_reverbLeft = Transform::fromUInt16BE(substr($this->_data, 0, 2));
- $this->_reverbRight = Transform::fromUInt16BE(substr($this->_data, 2, 2));
- $this->_reverbBouncesLeft = Transform::fromUInt8($this->_data[4]);
- $this->_reverbBouncesRight = Transform::fromUInt8($this->_data[5]);
- $this->_reverbFeedbackLtoL = Transform::fromUInt8($this->_data[6]);
- $this->_reverbFeedbackLtoR = Transform::fromUInt8($this->_data[7]);
- $this->_reverbFeedbackRtoR = Transform::fromUInt8($this->_data[8]);
- $this->_reverbFeedbackRtoL = Transform::fromUInt8($this->_data[9]);
- $this->_premixLtoR = Transform::fromUInt8($this->_data[10]);
- $this->_premixRtoL = Transform::fromUInt8($this->_data[11]);
- }
-
- /**
- * Returns the left reverb.
- *
- * @return integer
- */
- public function getReverbLeft() { return $this->_reverbLeft; }
-
- /**
- * Sets the left reverb.
- *
- * @param integer $reverbLeft The left reverb.
- */
- public function setReverbLeft($reverbLeft)
- {
- return $this->_reverbLeft = $reverbLeft;
- }
-
- /**
- * Returns the right reverb.
- *
- * @return integer
- */
- public function getReverbRight() { return $this->_reverbRight; }
-
- /**
- * Sets the right reverb.
- *
- * @param integer $reverbRight The right reverb.
- */
- public function setReverbRight($reverbRight)
- {
- return $this->_reverbRight = $reverbRight;
- }
-
- /**
- * Returns the left reverb bounces.
- *
- * @return integer
- */
- public function getReverbBouncesLeft() { return $this->_reverbBouncesLeft; }
-
- /**
- * Sets the left reverb bounces.
- *
- * @param integer $reverbBouncesLeft The left reverb bounces.
- */
- public function setReverbBouncesLeft($reverbBouncesLeft)
- {
- $this->_reverbBouncesLeft = $reverbBouncesLeft;
- }
-
- /**
- * Returns the right reverb bounces.
- *
- * @return integer
- */
- public function getReverbBouncesRight() { return $this->_reverbBouncesRight; }
-
- /**
- * Sets the right reverb bounces.
- *
- * @param integer $reverbBouncesRight The right reverb bounces.
- */
- public function setReverbBouncesRight($reverbBouncesRight)
- {
- $this->_reverbBouncesRight = $reverbBouncesRight;
- }
-
- /**
- * Returns the left-to-left reverb feedback.
- *
- * @return integer
- */
- public function getReverbFeedbackLtoL() { return $this->_reverbFeedbackLtoL; }
-
- /**
- * Sets the left-to-left reverb feedback.
- *
- * @param integer $reverbFeedbackLtoL The left-to-left reverb feedback.
- */
- public function setReverbFeedbackLtoL($reverbFeedbackLtoL)
- {
- $this->_reverbFeedbackLtoL = $reverbFeedbackLtoL;
- }
-
- /**
- * Returns the left-to-right reverb feedback.
- *
- * @return integer
- */
- public function getReverbFeedbackLtoR() { return $this->_reverbFeedbackLtoR; }
-
- /**
- * Sets the left-to-right reverb feedback.
- *
- * @param integer $reverbFeedbackLtoR The left-to-right reverb feedback.
- */
- public function setReverbFeedbackLtoR($reverbFeedbackLtoR)
- {
- $this->_reverbFeedbackLtoR = $reverbFeedbackLtoR;
- }
-
- /**
- * Returns the right-to-right reverb feedback.
- *
- * @return integer
- */
- public function getReverbFeedbackRtoR() { return $this->_reverbFeedbackRtoR; }
-
- /**
- * Sets the right-to-right reverb feedback.
- *
- * @param integer $reverbFeedbackRtoR The right-to-right reverb feedback.
- */
- public function setReverbFeedbackRtoR($reverbFeedbackRtoR)
- {
- $this->_reverbFeedbackRtoR = $reverbFeedbackRtoR;
- }
-
- /**
- * Returns the right-to-left reverb feedback.
- *
- * @return integer
- */
- public function getReverbFeedbackRtoL() { return $this->_reverbFeedbackRtoL; }
-
- /**
- * Sets the right-to-left reverb feedback.
- *
- * @param integer $reverbFeedbackRtoL The right-to-left reverb feedback.
- */
- public function setReverbFeedbackRtoL($reverbFeedbackRtoL)
- {
- $this->_reverbFeedbackRtoL = $reverbFeedbackRtoL;
- }
-
- /**
- * Returns the left-to-right premix.
- *
- * @return integer
- */
- public function getPremixLtoR() { return $this->_premixLtoR; }
-
- /**
- * Sets the left-to-right premix.
- *
- * @param integer $premixLtoR The left-to-right premix.
- */
- public function setPremixLtoR($premixLtoR)
- {
- $this->_premixLtoR = $premixLtoR;
- }
-
- /**
- * Returns the right-to-left premix.
- *
- * @return integer
- */
- public function getPremixRtoL() { return $this->_premixRtoL; }
-
- /**
- * Sets the right-to-left premix.
- *
- * @param integer $premixRtoL The right-to-left premix.
- */
- public function setPremixRtoL($premixRtoL)
- {
- $this->_premixRtoL = $premixRtoL;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return
- Transform::toUInt16BE($this->_reverbLeft) .
- Transform::toUInt16BE($this->_reverbRight) .
- Transform::toUInt8($this->_reverbBouncesLeft) .
- Transform::toUInt8($this->_reverbBouncesRight) .
- Transform::toUInt8($this->_reverbFeedbackLtoL) .
- Transform::toUInt8($this->_reverbFeedbackLtoR) .
- Transform::toUInt8($this->_reverbFeedbackRtoR) .
- Transform::toUInt8($this->_reverbFeedbackRtoL) .
- Transform::toUInt8($this->_premixLtoR) .
- Transform::toUInt8($this->_premixRtoL);
- }
-}
diff --git a/src/ID3/Frame/SEEK.php b/src/ID3/Frame/SEEK.php
deleted file mode 100644
index 380be46..0000000
--- a/src/ID3/Frame/SEEK.php
+++ /dev/null
@@ -1,104 +0,0 @@
-Seek frame indicates where other tags in a file/stream can be
- * found. The minimum offset to next tag is calculated from the end of this tag
- * to the beginning of the next. There may only be one seek frame in a tag.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_SEEK extends ID3_Frame
-{
- /** @var integer */
- private $_minOffset;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $this->_minOffset = Transform::fromInt32BE($this->_data);
- }
-
- /**
- * Returns the minimum offset to next tag in bytes.
- *
- * @return integer
- */
- public function getMinimumOffset() { return $this->_minOffset; }
-
- /**
- * Sets the minimum offset to next tag in bytes.
- *
- * @param integer $minOffset The minimum offset.
- */
- public function setMinimumOffset($minOffset)
- {
- $this->_minOffset = $minOffset;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return Transform::toInt32BE($this->_minOffset);
- }
-}
diff --git a/src/ID3/Frame/SIGN.php b/src/ID3/Frame/SIGN.php
deleted file mode 100644
index 9a14060..0000000
--- a/src/ID3/Frame/SIGN.php
+++ /dev/null
@@ -1,122 +0,0 @@
-Group identification registration, to be signed. Although signatures
- * can reside inside the registration frame, it might be desired to store the
- * signature elsewhere, e.g. in watermarks. There may be more than one signature
- * frame in a tag, but no two may be identical.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_SIGN extends ID3_Frame
-{
- /** @var integer */
- private $_group;
-
- /** @var string */
- private $_signature;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $this->_group = Transform::fromUInt8(substr($this->_data, 0, 1));
- $this->_signature = substr($this->_data, 1);
- }
-
- /**
- * Returns the group symbol byte.
- *
- * @return integer
- */
- public function getGroup() { return $this->_group; }
-
- /**
- * Sets the group symbol byte.
- *
- * @param integer $group The group symbol byte.
- */
- public function setGroup($group) { $this->_group = $group; }
-
- /**
- * Returns the signature binary data.
- *
- * @return string
- */
- public function getSignature() { return $this->_signature; }
-
- /**
- * Sets the signature binary data.
- *
- * @param string $signature The signature binary data string.
- */
- public function setSignature($signature) { $this->_signature = $signature; }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- return Transform::toUInt8($this->_group) . $this->_signature;
- }
-}
diff --git a/src/ID3/Frame/SYLT.php b/src/ID3/Frame/SYLT.php
deleted file mode 100644
index a92866c..0000000
--- a/src/ID3/Frame/SYLT.php
+++ /dev/null
@@ -1,340 +0,0 @@
-Synchronised lyrics/text frame is another way of incorporating the
- * words, said or sung lyrics, in the audio file as text, this time, however,
- * in sync with the audio. It might also be used to describing events e.g.
- * occurring on a stage or on the screen in sync with the audio.
- *
- * There may be more than one SYLT frame in each tag, but only one with the
- * same language and content descriptor.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_SYLT extends ID3_Frame
- implements ID3_Encoding, ID3_Language, ID3_Timing
-{
- /**
- * The list of content types.
- *
- * @var Array
- */
- public static $types = array
- ("Other", "Lyrics", "Text transcription", "Movement/Part name", "Events",
- "Chord", "Trivia", "URLs to webpages", "URLs to images");
-
- /** @var integer */
- private $_encoding;
-
- /** @var string */
- private $_language = "und";
-
- /** @var integer */
- private $_format = ID3_Timing::MPEG_FRAMES;
-
- /** @var integer */
- private $_type = 0;
-
- /** @var string */
- private $_description;
-
- /** @var Array */
- private $_events = array();
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- $this->_language = substr($this->_data, 1, 3);
- if ($this->_language == "XXX")
- $this->_language = "und";
- $this->_format = Transform::fromUInt8($this->_data[4]);
- $this->_type = Transform::fromUInt8($this->_data[5]);
- $this->_data = substr($this->_data, 6);
-
- switch ($encoding) {
- case self::UTF16:
- list($this->_description, $this->_data) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16");
- break;
- case self::UTF16BE:
- list($this->_description, $this->_data) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16be");
- break;
- case self::UTF8:
- list($this->_description, $this->_data) =
- $this->_explodeString8($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString8($this->_description), "utf-8");
- break;
- default:
- list($this->_description, $this->_data) =
- $this->_explodeString8($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString8($this->_description), "iso-8859-1");
- }
-
- while (strlen($this->_data) > 0) {
- switch ($encoding) {
- case self::UTF16:
- list($syllable, $this->_data) =
- $this->_explodeString16($this->_data, 2);
- $syllable = $this->_convertString
- (Transform::fromString16($syllable), "utf-16");
- break;
- case self::UTF16BE:
- list($syllable, $this->_data) =
- $this->_explodeString16($this->_data, 2);
- $syllable = $this->_convertString
- (Transform::fromString16($syllable), "utf-16be");
- break;
- case self::UTF8:
- list($syllable, $this->_data) =
- $this->_explodeString8($this->_data, 2);
- $syllable = $this->_convertString
- (Transform::fromString8($syllable), "utf-8");
- break;
- default:
- list($syllable, $this->_data) =
- $this->_explodeString8($this->_data, 2);
- $syllable = $this->_convertString
- (Transform::fromString8($syllable), "iso-8859-1");
- }
- $this->_events[Transform::fromUInt32BE(substr($this->_data, 0, 4))] =
- $syllable;
- $this->_data = substr($this->_data, 4);
- }
- ksort($this->_events);
- }
-
- /**
- * Returns the text encoding.
- *
- * All the strings read from a file are automatically converted to the
- * character encoding specified with the encoding option. See
- * {@link ID3v2} for details. This method returns the original text encoding
- * used to write the frame.
- *
- * @return integer
- */
- public function getEncoding() { return $this->_encoding; }
-
- /**
- * Sets the text encoding.
- *
- * All the string written to the frame are done so using given character
- * encoding. No conversions of existing data take place upon the call to this
- * method thus all texts must be given in given character encoding.
- *
- * The default character encoding used to write the frame is UTF-8.
- *
- * @see ID3_Encoding
- * @param integer $encoding The text encoding.
- */
- public function setEncoding($encoding) { $this->_encoding = $encoding; }
-
- /**
- * Returns the language code as specified in the
- * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard.
- *
- * @return string
- */
- public function getLanguage() { return $this->_language; }
-
- /**
- * Sets the text language code as specified in the
- * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard.
- *
- * @see ID3_Language
- * @param string $language The language code.
- */
- public function setLanguage($language)
- {
- if ($language == "XXX")
- $language = "und";
- $this->_language = substr($language, 0, 3);
- }
-
- /**
- * Returns the timing format.
- *
- * @return integer
- */
- public function getFormat() { return $this->_format; }
-
- /**
- * Sets the timing format.
- *
- * @see ID3_Timing
- * @param integer $format The timing format.
- */
- public function setFormat($format) { $this->_format = $format; }
-
- /**
- * Returns the content type code.
- *
- * @return integer
- */
- public function getType() { return $this->_type; }
-
- /**
- * Sets the content type code.
- *
- * @param integer $type The content type code.
- */
- public function setType($type) { $this->_type = $type; }
-
- /**
- * Returns the content description.
- *
- * @return string
- */
- public function getDescription() { return $this->_description; }
-
- /**
- * Sets the content description text using given encoding. The description
- * language and encoding must be that of the actual text.
- *
- * @param string $description The content description text.
- * @param string $language The language code.
- * @param integer $encoding The text encoding.
- */
- public function setDescription($description, $language = false,
- $encoding = false)
- {
- $this->_description = $description;
- if ($language !== false)
- $this->setLanguage($language);
- if ($encoding !== false)
- $this->setEncoding($encoding);
- }
-
- /**
- * Returns the syllable events with their timestamps.
- *
- * @return Array
- */
- public function getEvents() { return $this->_events; }
-
- /**
- * Sets the syllable events with their timestamps using given encoding.
- * The text language and encoding must be that of the description text.
- *
- * @param Array $text The test string.
- * @param string $language The language code.
- * @param integer $encoding The text encoding.
- */
- public function setEvents($events, $language = false, $encoding = false)
- {
- $this->_events = $events;
- if ($language !== false)
- $this->setLanguage($language);
- if ($encoding !== false)
- $this->setEncoding($encoding);
- ksort($this->_events);
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding) . $this->_language .
- Transform::toUInt8($this->_format) . Transform::toUInt8($this->_type);
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($this->_description, Transform::LITTLE_ENDIAN_ORDER, 1);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($this->_description, false, 1);
- break;
- default:
- $data .= $this->_description . "\0";
- }
- foreach ($this->_events as $timestamp => $syllable) {
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($syllable, Transform::LITTLE_ENDIAN_ORDER, 1);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($syllable, false, 1);
- break;
- default:
- $data .= $syllable . "\0";
- }
- $data .= Transform::toUInt32BE($timestamp);
- }
- return $data;
- }
-}
diff --git a/src/ID3/Frame/SYTC.php b/src/ID3/Frame/SYTC.php
deleted file mode 100644
index 1654593..0000000
--- a/src/ID3/Frame/SYTC.php
+++ /dev/null
@@ -1,161 +0,0 @@
-Synchronised tempo codes frame might be used.
- *
- * The tempo data consists of one or more tempo codes. Each tempo code consists
- * of one tempo part and one time part. The tempo is in BPM described with one
- * or two bytes. If the first byte has the value $FF, one more byte follows,
- * which is added to the first giving a range from 2 - 510 BPM, since $00 and
- * $01 is reserved. $00 is used to describe a beat-free time period, which is
- * not the same as a music-free time period. $01 is used to indicate one single
- * beat-stroke followed by a beat-free period.
- *
- * The tempo descriptor is followed by a time stamp. Every time the tempo in the
- * music changes, a tempo descriptor may indicate this for the player. All tempo
- * descriptors must be sorted in chronological order. The first beat-stroke in
- * a time-period is at the same time as the beat description occurs. There may
- * only be one SYTC frame in each tag.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_SYTC extends ID3_Frame
- implements ID3_Timing
-{
- /** Describes a beat-free time period. */
- const BEAT_FREE = 0x00;
-
- /** Indicate one single beat-stroke followed by a beat-free period. */
- const SINGLE_BEAT = 0x01;
-
- /** @var integer */
- private $_format = ID3_Timing::MPEG_FRAMES;
-
- /** @var Array */
- private $_events = array();
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $offset = 0;
- $this->_format = Transform::fromUInt8($this->_data[$offset++]);
- while ($offset < strlen($this->_data)) {
- $tempo = Transform::fromUInt8($this->_data[$offset++]);
- if ($tempo == 0xff)
- $tempo += Transform::fromUInt8($this->_data[$offset++]);
- $this->_events
- [Transform::fromUInt32BE(substr($this->_data, $offset, 4))] = $tempo;
- $offset += 4;
- }
- ksort($this->_events);
- }
-
- /**
- * Returns the timing format.
- *
- * @return integer
- */
- public function getFormat() { return $this->_format; }
-
- /**
- * Sets the timing format.
- *
- * @see ID3_Timing
- * @param integer $format The timing format.
- */
- public function setFormat($format) { $this->_format = $format; }
-
- /**
- * Returns the time-bpm tempo events.
- *
- * @return Array
- */
- public function getEvents() { return $this->_events; }
-
- /**
- * Sets the time-bpm tempo events.
- *
- * @param Array $events The time-bpm tempo events.
- */
- public function setEvents($events)
- {
- $this->_events = $events;
- ksort($this->_events);
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_format);
- foreach ($this->_events as $timestamp => $tempo) {
- if ($tempo >= 0xff)
- $data .= Transform::toUInt8(0xff) . Transform::toUInt8($tempo - 0xff);
- else
- $data .= Transform::toUInt8($tempo);
- $data .= Transform::toUInt32BE($timestamp);
- }
- return $data;
- }
-}
diff --git a/src/ID3/Frame/TALB.php b/src/ID3/Frame/TALB.php
deleted file mode 100644
index 8a7492b..0000000
--- a/src/ID3/Frame/TALB.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Album/Movie/Show title frame is intended for the title of the
- * recording (or source of sound) from which the audio in the file is taken.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TALB extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TBPM.php b/src/ID3/Frame/TBPM.php
deleted file mode 100644
index 442b680..0000000
--- a/src/ID3/Frame/TBPM.php
+++ /dev/null
@@ -1,53 +0,0 @@
-BPM frame contains the number of beats per minute in the main part
- * of the audio. The BPM is an integer and represented as a numerical string.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TBPM extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TCOM.php b/src/ID3/Frame/TCOM.php
deleted file mode 100644
index c7f73ad..0000000
--- a/src/ID3/Frame/TCOM.php
+++ /dev/null
@@ -1,52 +0,0 @@
-Composer frame is intended for the name of the composer.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TCOM extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TCON.php b/src/ID3/Frame/TCON.php
deleted file mode 100644
index 28826e3..0000000
--- a/src/ID3/Frame/TCON.php
+++ /dev/null
@@ -1,62 +0,0 @@
-Content type, which ID3v1 was stored as a one byte numeric value
- * only, is now a string. You may use one or several of the ID3v1 types as
- * numerical strings, or, since the category list would be impossible to
- * maintain with accurate and up to date categories, define your own.
- *
- * You may also use any of the following keywords:
- *
- *
- * RX Remix
- * CR Cover
- *
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TCON extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TCOP.php b/src/ID3/Frame/TCOP.php
deleted file mode 100644
index a389935..0000000
--- a/src/ID3/Frame/TCOP.php
+++ /dev/null
@@ -1,59 +0,0 @@
-Copyright message frame, in which the string must begin with a
- * year and a space character (making five characters), is intended for the
- * copyright holder of the original sound, not the audio file itself. The
- * absence of this frame means only that the copyright information is
- * unavailable or has been removed, and must not be interpreted to mean that the
- * audio is public domain. Every time this field is displayed the field must be
- * preceded with "Copyright " (C) " ", where (C) is one character showing a C in
- * a circle.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TCOP extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TDAT.php b/src/ID3/Frame/TDAT.php
deleted file mode 100644
index 3f6be07..0000000
--- a/src/ID3/Frame/TDAT.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Date frame is a numeric string in the DDMM format containing the
- * date for the recording. This field is always four characters long.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @deprecated ID3v2.3.0
- */
-final class ID3_Frame_TDAT extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TDEN.php b/src/ID3/Frame/TDEN.php
deleted file mode 100644
index 4b21494..0000000
--- a/src/ID3/Frame/TDEN.php
+++ /dev/null
@@ -1,56 +0,0 @@
-Encoding time frame contains a timestamp describing when the audio
- * was encoded. Timestamp format is described in the
- * {@link http://www.id3.org/id3v2.4.0-structure ID3v2 structure document}.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TDEN extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TDLY.php b/src/ID3/Frame/TDLY.php
deleted file mode 100644
index df52531..0000000
--- a/src/ID3/Frame/TDLY.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Playlist delay defines the numbers of milliseconds of silence that
- * should be inserted before this audio. The value zero indicates that this is a
- * part of a multifile audio track that should be played continuously.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TDLY extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TDOR.php b/src/ID3/Frame/TDOR.php
deleted file mode 100644
index 7e5a3e1..0000000
--- a/src/ID3/Frame/TDOR.php
+++ /dev/null
@@ -1,57 +0,0 @@
-Original release time frame contains a timestamp describing when
- * the original recording of the audio was released. Timestamp format is
- * described in the {@link http://www.id3.org/id3v2.4.0-structure ID3v2
- * structure document}.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TDOR extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TDRC.php b/src/ID3/Frame/TDRC.php
deleted file mode 100644
index 5d761e3..0000000
--- a/src/ID3/Frame/TDRC.php
+++ /dev/null
@@ -1,56 +0,0 @@
-Recording time frame contains a timestamp describing when the
- * audio was recorded. Timestamp format is described in the
- * {@link http://www.id3.org/id3v2.4.0-structure ID3v2 structure document}.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TDRC extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TDRL.php b/src/ID3/Frame/TDRL.php
deleted file mode 100644
index 454490f..0000000
--- a/src/ID3/Frame/TDRL.php
+++ /dev/null
@@ -1,56 +0,0 @@
-Release time frame contains a timestamp describing when the audio
- * was first released. Timestamp format is described in the
- * {@link http://www.id3.org/id3v2.4.0-structure ID3v2 structure document}.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TDRL extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TDTG.php b/src/ID3/Frame/TDTG.php
deleted file mode 100644
index 17525fb..0000000
--- a/src/ID3/Frame/TDTG.php
+++ /dev/null
@@ -1,56 +0,0 @@
-Tagging time frame contains a timestamp describing then the audio
- * was tagged. Timestamp format is described in the
- * {@link http://www.id3.org/id3v2.4.0-structure ID3v2 structure document}.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TDTG extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TENC.php b/src/ID3/Frame/TENC.php
deleted file mode 100644
index d3cbf27..0000000
--- a/src/ID3/Frame/TENC.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Encoded by frame contains the name of the person or organisation
- * that encoded the audio file. This field may contain a copyright message, if
- * the audio file also is copyrighted by the encoder.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TENC extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TEXT.php b/src/ID3/Frame/TEXT.php
deleted file mode 100644
index bf632ab..0000000
--- a/src/ID3/Frame/TEXT.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Lyricist/Text writer frame is intended for the writer of the text
- * or lyrics in the recording.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TEXT extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TFLT.php b/src/ID3/Frame/TFLT.php
deleted file mode 100644
index f1e9a01..0000000
--- a/src/ID3/Frame/TFLT.php
+++ /dev/null
@@ -1,69 +0,0 @@
-File type frame indicates which type of audio this tag defines.
- * The following types and refinements are defined:
- *
- *
- * MIME MIME type follows
- * MPG MPEG Audio
- * /1 MPEG 1/2 layer I
- * /2 MPEG 1/2 layer II
- * /3 MPEG 1/2 layer III
- * /2.5 MPEG 2.5
- * /AAC Advanced audio compression
- * VQF Transform-domain Weighted Interleave Vector Quantisation
- * PCM Pulse Code Modulated audio
- *
- *
- * but other types may be used, but not for these types though. This is used in
- * a similar way to the predefined types in the {@link ID3_Frame_TMED}
- * frame. If this frame is not present audio type is assumed to be MPG.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TFLT extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TIME.php b/src/ID3/Frame/TIME.php
deleted file mode 100644
index 713226c..0000000
--- a/src/ID3/Frame/TIME.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Time frame is a numeric string in the HHMM format containing the
- * time for the recording. This field is always four characters long.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @deprecated ID3v2.3.0
- */
-final class ID3_Frame_TIME extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TIPL.php b/src/ID3/Frame/TIPL.php
deleted file mode 100644
index dfcadde..0000000
--- a/src/ID3/Frame/TIPL.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Involved people list is very similar to the musician credits list,
- * but maps between functions, like producer, and names.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TIPL extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TIT1.php b/src/ID3/Frame/TIT1.php
deleted file mode 100644
index 2f29e77..0000000
--- a/src/ID3/Frame/TIT1.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Content group description frame is used if the sound belongs to a
- * larger category of sounds/music. For example, classical music is often sorted
- * in different musical sections (e.g. "Piano Concerto", "Weather - Hurricane").
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TIT1 extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TIT2.php b/src/ID3/Frame/TIT2.php
deleted file mode 100644
index 384de2d..0000000
--- a/src/ID3/Frame/TIT2.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Title/Songname/Content description frame is the actual name of the
- * piece (e.g. "Adagio", "Hurricane Donna").
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TIT2 extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TIT3.php b/src/ID3/Frame/TIT3.php
deleted file mode 100644
index c593da2..0000000
--- a/src/ID3/Frame/TIT3.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Subtitle/Description refinement frame is used for information
- * directly related to the contents title (e.g. "Op. 16" or "Performed live at
- * Wembley").
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TIT3 extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TKEY.php b/src/ID3/Frame/TKEY.php
deleted file mode 100644
index dd8d6c4..0000000
--- a/src/ID3/Frame/TKEY.php
+++ /dev/null
@@ -1,56 +0,0 @@
-Initial key frame contains the musical key in which the sound
- * starts. It is represented as a string with a maximum length of three
- * characters. The ground keys are represented with "A", "B", "C", "D", "E", "F"
- * and "G" and halfkeys represented with "b" and "#". Minor is represented as
- * "m", e.g. "Dbm" $00. Off key is represented with an "o" only.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TKEY extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TLAN.php b/src/ID3/Frame/TLAN.php
deleted file mode 100644
index 14fd104..0000000
--- a/src/ID3/Frame/TLAN.php
+++ /dev/null
@@ -1,57 +0,0 @@
-Language frame should contain the languages of the text or lyrics
- * spoken or sung in the audio. The language is represented with three
- * characters according to {@link http://www.loc.gov/standards/iso639-2/
- * ISO-639-2}. If more than one language is used in the text their language
- * codes should follow according to the amount of their usage, e.g.
- * "eng" $00 "sve" $00.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TLAN extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TLEN.php b/src/ID3/Frame/TLEN.php
deleted file mode 100644
index faf81c1..0000000
--- a/src/ID3/Frame/TLEN.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Length frame contains the length of the audio file in
- * milliseconds, represented as a numeric string.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TLEN extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TMCL.php b/src/ID3/Frame/TMCL.php
deleted file mode 100644
index ca75f48..0000000
--- a/src/ID3/Frame/TMCL.php
+++ /dev/null
@@ -1,56 +0,0 @@
-Musician credits list is intended as a mapping between instruments
- * and the musician that played it. Every odd field is an instrument and every
- * even is an artist or a comma delimited list of artists.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TMCL extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TMOO.php b/src/ID3/Frame/TMOO.php
deleted file mode 100644
index 72059e6..0000000
--- a/src/ID3/Frame/TMOO.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Mood frame is intended to reflect the mood of the audio with a few
- * keywords, e.g. "Romantic" or "Sad".
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TMOO extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TOAL.php b/src/ID3/Frame/TOAL.php
deleted file mode 100644
index 144e09f..0000000
--- a/src/ID3/Frame/TOAL.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Original album/movie/show title frame is intended for the title of
- * the original recording (or source of sound), if for example the music in the
- * file should be a cover of a previously released song.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TOAL extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TOFN.php b/src/ID3/Frame/TOFN.php
deleted file mode 100644
index 572a59d..0000000
--- a/src/ID3/Frame/TOFN.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Original filename frame contains the preferred filename for the
- * file, since some media doesn't allow the desired length of the filename. The
- * filename is case sensitive and includes its suffix.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TOFN extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TOLY.php b/src/ID3/Frame/TOLY.php
deleted file mode 100644
index a4d0eff..0000000
--- a/src/ID3/Frame/TOLY.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Original lyricist/text writer frame is intended for the text
- * writer of the original recording, if for example the music in the file should
- * be a cover of a previously released song.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TOLY extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TOPE.php b/src/ID3/Frame/TOPE.php
deleted file mode 100644
index b3d4fe6..0000000
--- a/src/ID3/Frame/TOPE.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Original artist/performer frame is intended for the performer of
- * the original recording, if for example the music in the file should be a
- * cover of a previously released song.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TOPE extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TORY.php b/src/ID3/Frame/TORY.php
deleted file mode 100644
index d273bd6..0000000
--- a/src/ID3/Frame/TORY.php
+++ /dev/null
@@ -1,57 +0,0 @@
-Original release year frame is intended for the year when the
- * original recording, if for example the music in the file should be a cover of
- * a previously released song, was released. The field is formatted as in the
- * {@link ID3_Frame_TYER} frame.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @deprecated ID3v2.3.0
- */
-final class ID3_Frame_TORY extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TOWN.php b/src/ID3/Frame/TOWN.php
deleted file mode 100644
index 072f4b9..0000000
--- a/src/ID3/Frame/TOWN.php
+++ /dev/null
@@ -1,53 +0,0 @@
-File owner/licensee frame contains the name of the owner or
- * licensee of the file and it's contents.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TOWN extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TPE1.php b/src/ID3/Frame/TPE1.php
deleted file mode 100644
index bd82147..0000000
--- a/src/ID3/Frame/TPE1.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Lead artist/Lead performer/Soloist/Performing group is used for
- * the main artist.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TPE1 extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TPE2.php b/src/ID3/Frame/TPE2.php
deleted file mode 100644
index 0104db9..0000000
--- a/src/ID3/Frame/TPE2.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Band/Orchestra/Accompaniment frame is used for additional
- * information about the performers in the recording.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TPE2 extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TPE3.php b/src/ID3/Frame/TPE3.php
deleted file mode 100644
index a1d172c..0000000
--- a/src/ID3/Frame/TPE3.php
+++ /dev/null
@@ -1,52 +0,0 @@
-Conductor frame is used for the name of the conductor.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TPE3 extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TPE4.php b/src/ID3/Frame/TPE4.php
deleted file mode 100644
index 6977164..0000000
--- a/src/ID3/Frame/TPE4.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Interpreted, remixed, or otherwise modified by frame contains more
- * information about the people behind a remix and similar interpretations of
- * another existing piece.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TPE4 extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TPOS.php b/src/ID3/Frame/TPOS.php
deleted file mode 100644
index 5fd1458..0000000
--- a/src/ID3/Frame/TPOS.php
+++ /dev/null
@@ -1,56 +0,0 @@
-Part of a set frame is a numeric string that describes which part
- * of a set the audio came from. This frame is used if the source described in
- * the {@link ID3_Frame_TALB} frame is divided into several mediums, e.g.
- * a double CD. The value may be extended with a "/" character and a numeric
- * string containing the total number of parts in the set. E.g. "1/2".
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TPOS extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TPRO.php b/src/ID3/Frame/TPRO.php
deleted file mode 100644
index f4073f1..0000000
--- a/src/ID3/Frame/TPRO.php
+++ /dev/null
@@ -1,61 +0,0 @@
-Produced notice frame, in which the string must begin with a year
- * and a space character (making five characters), is intended for the
- * production copyright holder of the original sound, not the audio file itself.
- * The absence of this frame means only that the production copyright
- * information is unavailable or has been removed, and must not be interpreted
- * to mean that the audio is public domain. Every time this field is displayed
- * the field must be preceded with "Produced " (P) " ", where (P) is one
- * character showing a P in a circle.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TPRO extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TPUB.php b/src/ID3/Frame/TPUB.php
deleted file mode 100644
index b54efdb..0000000
--- a/src/ID3/Frame/TPUB.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Publisher frame simply contains the name of the label or
- * publisher.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TPUB extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TRCK.php b/src/ID3/Frame/TRCK.php
deleted file mode 100644
index bffc7c6..0000000
--- a/src/ID3/Frame/TRCK.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Track number/Position in set frame is a numeric string containing
- * the order number of the audio-file on its original recording. This may be
- * extended with a "/" character and a numeric string containing the total
- * number of tracks/elements on the original recording. E.g. "4/9".
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TRCK extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TRDA.php b/src/ID3/Frame/TRDA.php
deleted file mode 100644
index 1911ed6..0000000
--- a/src/ID3/Frame/TRDA.php
+++ /dev/null
@@ -1,57 +0,0 @@
-Recording dates frame is intended to be used as complement to
- * the {@link ID3_Frame_TYER}, {@link ID3_Frame_TDAT} and {@link ID3_Frame_TIME}
- * frames. E.g. "4th-7th June, 12th June" in combination with the
- * {@link ID3_Frame_TYER} frame.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @deprecated ID3v2.3.0
- */
-final class ID3_Frame_TRDA extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TRSN.php b/src/ID3/Frame/TRSN.php
deleted file mode 100644
index e12c048..0000000
--- a/src/ID3/Frame/TRSN.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Internet radio station name frame contains the name of the
- * internet radio station from which the audio is streamed.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TRSN extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TRSO.php b/src/ID3/Frame/TRSO.php
deleted file mode 100644
index 7d5a164..0000000
--- a/src/ID3/Frame/TRSO.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Internet radio station owner frame contains the name of the owner
- * of the internet radio station from which the audio is streamed.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TRSO extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TSIZ.php b/src/ID3/Frame/TSIZ.php
deleted file mode 100644
index d1551cd..0000000
--- a/src/ID3/Frame/TSIZ.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Size frame contains the size of the audiofile in bytes, excluding
- * the ID3v2 tag, represented as a numeric string.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @deprecated ID3v2.3.0
- */
-final class ID3_Frame_TSIZ extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TSOA.php b/src/ID3/Frame/TSOA.php
deleted file mode 100644
index 5e6942a..0000000
--- a/src/ID3/Frame/TSOA.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Album sort order frame defines a string which should be used
- * instead of the {@link ID3_Frame_TALB} album name frame for sorting purposes.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TSOA extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TSOP.php b/src/ID3/Frame/TSOP.php
deleted file mode 100644
index 04f3523..0000000
--- a/src/ID3/Frame/TSOP.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Performer sort order frame defines a string which should be used
- * instead of the {@link ID3_Frame_TPE2} performer frame for sorting purposes.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TSOP extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TSOT.php b/src/ID3/Frame/TSOT.php
deleted file mode 100644
index 0fb1e82..0000000
--- a/src/ID3/Frame/TSOT.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Title sort order frame defines a string which should be used
- * instead of the {@link ID3_Frame_TIT2} title frame for sorting purposes.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TSOT extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TSRC.php b/src/ID3/Frame/TSRC.php
deleted file mode 100644
index 93f604a..0000000
--- a/src/ID3/Frame/TSRC.php
+++ /dev/null
@@ -1,53 +0,0 @@
-ISRC frame should contain the International Standard Recording
- * Code (12 characters).
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_ISRC extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TSSE.php b/src/ID3/Frame/TSSE.php
deleted file mode 100644
index 9c1122b..0000000
--- a/src/ID3/Frame/TSSE.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Software/Hardware and settings used for encoding frame includes
- * the used audio encoder and its settings when the file was encoded. Hardware
- * refers to hardware encoders, not the computer on which a program was run.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TSSE extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TSST.php b/src/ID3/Frame/TSST.php
deleted file mode 100644
index c997ace..0000000
--- a/src/ID3/Frame/TSST.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Set subtitle frame is intended for the subtitle of the part of a
- * set this track belongs to.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @since ID3v2.4.0
- */
-final class ID3_Frame_TSST extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/TXXX.php b/src/ID3/Frame/TXXX.php
deleted file mode 100644
index 95ede88..0000000
--- a/src/ID3/Frame/TXXX.php
+++ /dev/null
@@ -1,159 +0,0 @@
-
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_TXXX extends ID3_Frame_AbstractText
-{
- /** @var string */
- private $_description;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- ID3_Frame::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- $this->_data = substr($this->_data, 1);
-
- switch ($encoding) {
- case self::UTF16:
- list($this->_description, $this->_text) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16");
- $this->_text = $this->_convertString
- (array(Transform::fromString16($this->_text)), "utf-16");
- break;
- case self::UTF16BE:
- list($this->_description, $this->_text) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16be");
- $this->_text = $this->_convertString
- (array(Transform::fromString16($this->_text)), "utf-16be");
- break;
- case self::UTF8:
- list($this->_description, $this->_text) = $this->_convertString
- ($this->_explodeString8($this->_data, 2), "utf-8");
- $this->_text = array($this->_text);
- break;
- default:
- list($this->_description, $this->_text) = $this->_convertString
- ($this->_explodeString8($this->_data, 2), "iso-8859-1");
- $this->_text = array($this->_text);
- }
- }
-
- /**
- * Returns the description text.
- *
- * @return string
- */
- public function getDescription() { return $this->_description; }
-
- /**
- * Sets the description text using given encoding.
- *
- * @param string $description The content description text.
- * @param integer $encoding The text encoding.
- */
- public function setDescription($description, $encoding = false)
- {
- $this->_description = $description;
- if ($encoding !== false)
- $this->_encoding = $encoding;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding);
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($this->_description, Transform::LITTLE_ENDIAN_ORDER, 1) .
- Transform::toString16
- ($this->_text[0], Transform::LITTLE_ENDIAN_ORDER, 1);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($this->_description, false, 1) .
- Transform::toString16($this->_text[0], false, 1);
- break;
- default:
- $data .= $this->_description . "\0" . $this->_text[0];
- }
- return $data;
- }
-}
-
diff --git a/src/ID3/Frame/TYER.php b/src/ID3/Frame/TYER.php
deleted file mode 100644
index 350c33d..0000000
--- a/src/ID3/Frame/TYER.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Year frame is a numeric string with a year of the recording. This
- * frames is always four characters long (until the year 10000).
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @deprecated ID3v2.3.0
- */
-final class ID3_Frame_TYER extends ID3_Frame_AbstractText {}
diff --git a/src/ID3/Frame/USER.php b/src/ID3/Frame/USER.php
deleted file mode 100644
index ef365df..0000000
--- a/src/ID3/Frame/USER.php
+++ /dev/null
@@ -1,205 +0,0 @@
-Terms of use frame contains a brief description of the terms of
- * use and ownership of the file. More detailed information concerning the legal
- * terms might be available through the {@link ID3_Frame_WCOP} frame. Newlines
- * are allowed in the text. There may be more than one Terms of use frames in a
- * tag, but only one with the same language.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_USER extends ID3_Frame
- implements ID3_Encoding, ID3_Language
-{
- /** @var integer */
- private $_encoding;
-
- /** @var string */
- private $_language = "und";
-
- /** @var string */
- private $_text;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- $this->_language = substr($this->_data, 1, 3);
- if ($this->_language == "XXX")
- $this->_language = "und";
- $this->_data = substr($this->_data, 4);
-
- switch ($encoding) {
- case self::UTF16:
- $this->_text = $this->_convertString
- (Transform::fromString16($this->_data), "utf-16");
- break;
- case self::UTF16BE:
- $this->_text = $this->_convertString
- (Transform::fromString16($this->_data), "utf-16be");
- break;
- case self::UTF8:
- $this->_text = $this->_convertString
- (Transform::fromString8($this->_data), "utf-8");
- break;
- default:
- $this->_text = $this->_convertString
- (Transform::fromString8($this->_data), "iso-8859-1");
- }
- }
-
- /**
- * Returns the text encoding.
- *
- * All the strings read from a file are automatically converted to the
- * character encoding specified with the encoding option. See
- * {@link ID3v2} for details. This method returns the original text encoding
- * used to write the frame.
- *
- * @return integer
- */
- public function getEncoding() { return $this->_encoding; }
-
- /**
- * Sets the text encoding.
- *
- * All the string written to the frame are done so using given character
- * encoding. No conversions of existing data take place upon the call to this
- * method thus all texts must be given in given character encoding.
- *
- * The default character encoding used to write the frame is UTF-8.
- *
- * @see ID3_Encoding
- * @param integer $encoding The text encoding.
- */
- public function setEncoding($encoding) { $this->_encoding = $encoding; }
-
- /**
- * Returns the language code as specified in the
- * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard.
- *
- * @return string
- */
- public function getLanguage() { return $this->_language; }
-
- /**
- * Sets the text language code as specified in the
- * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard.
- *
- * @see ID3_Language
- * @param string $language The language code.
- */
- public function setLanguage($language)
- {
- if ($language == "XXX")
- $language = "und";
- $this->_language = substr($language, 0, 3);
- }
-
- /**
- * Returns the text.
- *
- * @return string
- */
- public function getText() { return $this->_text; }
-
- /**
- * Sets the text using given language and encoding.
- *
- * @param string $text The text.
- * @param string $language The language code.
- * @param integer $encoding The text encoding.
- */
- public function setText($text, $language = false, $encoding = false)
- {
- $this->_text = $text;
- if ($language !== false)
- $this->setLanguage($language);
- if ($encoding !== false)
- $this->setEncoding($encoding);
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding) . $this->_language;
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($this->_text, Transform::MACHINE_ENDIAN_ORDER);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($this->_text);
- break;
- default:
- $data .= $this->_text;
- }
- return $data;
- }
-}
diff --git a/src/ID3/Frame/USLT.php b/src/ID3/Frame/USLT.php
deleted file mode 100644
index 33e2257..0000000
--- a/src/ID3/Frame/USLT.php
+++ /dev/null
@@ -1,251 +0,0 @@
-Unsynchronised lyrics/text transcription frame contains the lyrics
- * of the song or a text transcription of other vocal activities. There may be
- * more than one unsynchronised lyrics/text transcription frame in each tag, but
- * only one with the same language and content descriptor.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_USLT extends ID3_Frame
- implements ID3_Encoding, ID3_Language
-{
- /** @var integer */
- private $_encoding;
-
- /** @var string */
- private $_language = "und";
-
- /** @var string */
- private $_description;
-
- /** @var string */
- private $_text;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- $this->_language = substr($this->_data, 1, 3);
- if ($this->_language == "XXX")
- $this->_language = "und";
- $this->_data = substr($this->_data, 4);
-
- switch ($encoding) {
- case self::UTF16:
- list ($this->_description, $this->_text) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16");
- $this->_text = $this->_convertString
- (Transform::fromString16($this->_text), "utf-16");
- break;
- case self::UTF16BE:
- list ($this->_description, $this->_text) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16be");
- $this->_text = $this->_convertString
- (Transform::fromString16($this->_text), "utf-16be");
- break;
- case self::UTF8:
- list ($this->_description, $this->_text) =
- $this->_explodeString8($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString8($this->_description), "utf-8");
- $this->_text = $this->_convertString
- (Transform::fromString8($this->_text), "utf-8");
- break;
- default:
- list ($this->_description, $this->_text) =
- $this->_explodeString8($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString8($this->_description), "iso-8859-1");
- $this->_text = $this->_convertString
- (Transform::fromString8($this->_text), "iso-8859-1");
- }
- }
-
- /**
- * Returns the text encoding.
- *
- * All the strings read from a file are automatically converted to the
- * character encoding specified with the encoding option. See
- * {@link ID3v2} for details. This method returns the original text encoding
- * used to write the frame.
- *
- * @return integer
- */
- public function getEncoding() { return $this->_encoding; }
-
- /**
- * Sets the text encoding.
- *
- * All the string written to the frame are done so using given character
- * encoding. No conversions of existing data take place upon the call to this
- * method thus all texts must be given in given character encoding.
- *
- * The default character encoding used to write the frame is UTF-8.
- *
- * @see ID3_Encoding
- * @param integer $encoding The text encoding.
- */
- public function setEncoding($encoding) { $this->_encoding = $encoding; }
-
- /**
- * Returns the language code as specified in the
- * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard.
- *
- * @return string
- */
- public function getLanguage() { return $this->_language; }
-
- /**
- * Sets the text language code as specified in the
- * {@link http://www.loc.gov/standards/iso639-2/ ISO-639-2} standard.
- *
- * @see ID3_Language
- * @param string $language The language code.
- */
- public function setLanguage($language)
- {
- if ($language == "XXX")
- $language = "und";
- $this->_language = substr($language, 0, 3);
- }
-
- /**
- * Returns the short content description.
- *
- * @return string
- */
- public function getDescription() { return $this->_description; }
-
- /**
- * Sets the content description text using given encoding. The description
- * language and encoding must be that of the actual text.
- *
- * @param string $description The content description text.
- * @param string $language The language code.
- * @param integer $encoding The text encoding.
- */
- public function setDescription($description, $language = false,
- $encoding = false)
- {
- $this->_description = $description;
- if ($language !== false)
- $this->setLanguage($language);
- if ($encoding !== false)
- $this->setEncoding($encoding);
- }
-
- /**
- * Returns the lyrics/text.
- *
- * @return string
- */
- public function getText() { return $this->_text; }
-
- /**
- * Sets the text using given encoding. The text language and encoding must be
- * that of the description text.
- *
- * @param mixed $text The test string.
- * @param string $language The language code.
- * @param integer $encoding The text encoding.
- */
- public function setText($text, $language = false, $encoding = false)
- {
- $this->_text = $text;
- if ($language !== false)
- $this->setLanguage($language);
- if ($encoding !== false)
- $this->setEncoding($encoding);
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding) . $this->_language;
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($this->_description, Transform::LITTLE_ENDIAN_ORDER) . "\0\0" .
- Transform::toString16($this->_text, Transform::LITTLE_ENDIAN_ORDER);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($this->_description) . "\0\0" .
- Transform::toString16($this->_text);
- break;
- default:
- $data .= $this->_description . "\0" . $this->_text;
- }
- return $data;
- }
-}
diff --git a/src/ID3/Frame/Unknown.php b/src/ID3/Frame/Unknown.php
deleted file mode 100644
index d3c6b27..0000000
--- a/src/ID3/Frame/Unknown.php
+++ /dev/null
@@ -1,60 +0,0 @@
-
- * @copyright Copyright (c) 2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_Unknown extends ID3_Frame
-{
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData() { return $this->_data; }
-}
diff --git a/src/ID3/Frame/WCOM.php b/src/ID3/Frame/WCOM.php
deleted file mode 100644
index d976f29..0000000
--- a/src/ID3/Frame/WCOM.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Commercial information frame is a URL pointing at a webpage with
- * information such as where the album can be bought. There may be more than one
- * WCOM frame in a tag, but not with the same content.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_WCOM extends ID3_Frame_AbstractLink {}
diff --git a/src/ID3/Frame/WCOP.php b/src/ID3/Frame/WCOP.php
deleted file mode 100644
index 0115a32..0000000
--- a/src/ID3/Frame/WCOP.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Copyright/Legal information frame is a URL pointing at a webpage
- * where the terms of use and ownership of the file is described.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_WCOP extends ID3_Frame_AbstractLink {}
diff --git a/src/ID3/Frame/WOAF.php b/src/ID3/Frame/WOAF.php
deleted file mode 100644
index 50df02a..0000000
--- a/src/ID3/Frame/WOAF.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Official audio file webpage frame is a URL pointing at a file
- * specific webpage.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_WOAF extends ID3_Frame_AbstractLink {}
diff --git a/src/ID3/Frame/WOAR.php b/src/ID3/Frame/WOAR.php
deleted file mode 100644
index ec32302..0000000
--- a/src/ID3/Frame/WOAR.php
+++ /dev/null
@@ -1,54 +0,0 @@
-Official artist/performer webpage frame is a URL pointing at the
- * artists official webpage. There may be more than one WOAR frame in a tag if
- * the audio contains more than one performer, but not with the same content.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_WOAR extends ID3_Frame_AbstractLink {}
diff --git a/src/ID3/Frame/WOAS.php b/src/ID3/Frame/WOAS.php
deleted file mode 100644
index 7961bea..0000000
--- a/src/ID3/Frame/WOAS.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Official audio source webpage frame is a URL pointing at the
- * official webpage for the source of the audio file, e.g. a movie.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_WOAS extends ID3_Frame_AbstractLink {}
diff --git a/src/ID3/Frame/WORS.php b/src/ID3/Frame/WORS.php
deleted file mode 100644
index 1ea09a8..0000000
--- a/src/ID3/Frame/WORS.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Official Internet radio station homepage contains a URL pointing
- * at the homepage of the internet radio station.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_WORS extends ID3_Frame_AbstractLink {}
diff --git a/src/ID3/Frame/WPAY.php b/src/ID3/Frame/WPAY.php
deleted file mode 100644
index 1c724da..0000000
--- a/src/ID3/Frame/WPAY.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Payment frame is a URL pointing at a webpage that will handle the
- * process of paying for this file.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_WPAY extends ID3_Frame_AbstractLink {}
diff --git a/src/ID3/Frame/WPUB.php b/src/ID3/Frame/WPUB.php
deleted file mode 100644
index d5461b6..0000000
--- a/src/ID3/Frame/WPUB.php
+++ /dev/null
@@ -1,53 +0,0 @@
-Publishers official webpage frame is a URL pointing at the
- * official webpage for the publisher.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_WPUB extends ID3_Frame_AbstractLink {}
diff --git a/src/ID3/Frame/WXXX.php b/src/ID3/Frame/WXXX.php
deleted file mode 100644
index e758079..0000000
--- a/src/ID3/Frame/WXXX.php
+++ /dev/null
@@ -1,181 +0,0 @@
-
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Frame_WXXX extends ID3_Frame_AbstractLink
- implements ID3_Encoding
-{
- /** @var integer */
- private $_encoding;
-
- /** @var string */
- private $_description;
-
- /**
- * Constructs the class with given parameters and parses object related data.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- ID3_Frame::__construct($reader, $options);
-
- $this->_encoding = $this->getOption("encoding", ID3_Encoding::UTF8);
-
- if ($reader === null)
- return;
-
- $encoding = Transform::fromUInt8($this->_data[0]);
- $this->_data = substr($this->_data, 1);
-
- switch ($encoding) {
- case self::UTF16:
- list($this->_description, $this->_link) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16");
- break;
- case self::UTF16BE:
- list($this->_description, $this->_link) =
- $this->_explodeString16($this->_data, 2);
- $this->_description = $this->_convertString
- (Transform::fromString16($this->_description), "utf-16be");
- break;
- case self::UTF8:
- list($this->_description, $this->_link) =
- $this->_explodeString8($this->_data, 2);
- $this->_description = $this->_convertString($this->_description, "utf-8");
- break;
- default:
- list($this->_description, $this->_link) =
- $this->_explodeString8($this->_data, 2);
- $this->_description = $this->_convertString
- ($this->_description, "iso-8859-1");
- }
- $this->_link = implode($this->_explodeString8($this->_link, 1), "");
- }
-
- /**
- * Returns the text encoding.
- *
- * All the strings read from a file are automatically converted to the
- * character encoding specified with the encoding option. See
- * {@link ID3v2} for details. This method returns the original text encoding
- * used to write the frame.
- *
- * @return integer The encoding.
- */
- public function getEncoding() { return $this->_encoding; }
-
- /**
- * Sets the text encoding.
- *
- * All the string written to the frame are done so using given character
- * encoding. No conversions of existing data take place upon the call to this
- * method thus all texts must be given in given character encoding.
- *
- * The default character encoding used to write the frame is UTF-8.
- *
- * @see ID3_Encoding
- * @param integer $encoding The text encoding.
- */
- public function setEncoding($encoding) { $this->_encoding = $encoding; }
-
- /**
- * Returns the link description.
- *
- * @return string
- */
- public function getDescription() { return $this->_description; }
-
- /**
- * Sets the content description text using given encoding.
- *
- * @param string $description The content description text.
- * @param integer $encoding The text encoding.
- */
- public function setDescription($description, $encoding = false)
- {
- $this->_description = $description;
- if ($encoding !== false)
- $this->_encoding = $encoding;
- }
-
- /**
- * Returns the frame raw data without the header.
- *
- * @return string
- */
- protected function _getData()
- {
- $data = Transform::toUInt8($this->_encoding);
- switch ($this->_encoding) {
- case self::UTF16LE:
- $data .= Transform::toString16
- ($this->_description, Tranform::LITTLE_ENDIAN_ORDER, 1);
- break;
- case self::UTF16:
- case self::UTF16BE:
- $data .= Transform::toString16($this->_description, false, 1);
- break;
- default:
- $data .= Transform::toString8($this->_description, 1);
- }
- return $data . $this->_link;
- }
-}
diff --git a/src/ID3/Header.php b/src/ID3/Header.php
deleted file mode 100644
index cd8c5e6..0000000
--- a/src/ID3/Header.php
+++ /dev/null
@@ -1,174 +0,0 @@
-
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3_Header extends ID3_Object
-{
- /** A flag to denote whether or not unsynchronisation is applied on all
- frames */
- const UNSYNCHRONISATION = 128;
-
- /** A flag to denote whether or not the header is followed by an extended
- header */
- const EXTENDEDHEADER = 64;
-
- /** A flag used as an experimental indicator. This flag shall always be set
- when the tag is in an experimental stage. */
- const EXPERIMENTAL = 32;
-
- /**
- * A flag to denote whether a footer is present at the very end of the tag.
- *
- * @since ID3v2.4.0
- */
- const FOOTER = 16;
-
- /** @var integer */
- private $_version = 4.0;
-
- /** @var integer */
- private $_flags = 0;
-
- /** @var integer */
- private $_size;
-
- /**
- * Constructs the class with given parameters and reads object related data
- * from the ID3v2 tag.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $this->_version = $options["version"] =
- $this->_reader->readInt8() + $this->_reader->readInt8() / 10;
- $this->_flags = $this->_reader->readInt8();
- $this->_size = $this->_decodeSynchsafe32($this->_reader->readUInt32BE());
- }
-
- /**
- * Returns the tag version number. The version number is in the form of
- * major.revision.
- *
- * @return integer
- */
- public function getVersion() { return $this->_version; }
-
- /**
- * Sets the tag version number. Supported version numbers are 3.0 and 4.0
- * for ID3v2.3.0 and ID3v2.4.0 standards, respectively.
- *
- * @param integer $version The tag version number in the form of
- * major.revision.
- */
- public function setVersion($version)
- {
- $this->setOption("version", $this->_version = $version);
- }
-
- /**
- * Checks whether or not the flag is set. Returns true if the flag
- * is set, false otherwise.
- *
- * @param integer $flag The flag to query.
- * @return boolean
- */
- public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; }
-
- /**
- * Returns the flags byte.
- *
- * @return integer
- */
- public function getFlags() { return $this->_flags; }
-
- /**
- * Sets the flags byte.
- *
- * @param string $flags The flags byte.
- */
- public function setFlags($flags) { $this->_flags = $flags; }
-
- /**
- * Returns the tag size, excluding the header and the footer.
- *
- * @return integer
- */
- public function getSize() { return $this->_size; }
-
- /**
- * Sets the tag size, excluding the header and the footer. Called
- * automatically upon tag generation to adjust the tag size.
- *
- * @param integer $size The size of the tag, in bytes.
- */
- public function setSize($size) { $this->_size = $size; }
-
- /**
- * Returns the header/footer data without the identifier.
- *
- * @return string
- */
- public function __toString()
- {
- return Transform::toInt8(floor($this->_version)) .
- Transform::toInt8(($this->_version - floor($this->_version)) * 10) .
- Transform::toInt8($this->_flags) .
- Transform::toUInt32BE($this->_encodeSynchsafe32($this->_size));
- }
-}
diff --git a/src/ID3/Language.php b/src/ID3/Language.php
deleted file mode 100644
index e4f6336..0000000
--- a/src/ID3/Language.php
+++ /dev/null
@@ -1,69 +0,0 @@
-Language interface implies that the ID3v2 frame supports
- * its content to be given in multiple languages.
- *
- * The three byte language code is used to describe the language of the frame's
- * content, according to {@link http://www.loc.gov/standards/iso639-2/
- * ISO-639-2}. The language should be represented in lower case. If the language
- * is not known the string "xxx" should be used.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-interface ID3_Language
-{
- /**
- * Returns the text language code.
- *
- * @return string
- */
- public function getLanguage();
-
- /**
- * Sets the text language code.
- *
- * @param string $language The text language code.
- */
- public function setLanguage($language);
-}
diff --git a/src/ID3/Object.php b/src/ID3/Object.php
deleted file mode 100644
index 58e7b30..0000000
--- a/src/ID3/Object.php
+++ /dev/null
@@ -1,303 +0,0 @@
-
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-abstract class ID3_Object
-{
- /**
- * The reader object.
- *
- * @var Reader
- */
- protected $_reader;
-
- /**
- * The options array.
- *
- * @var Array
- */
- private $_options;
-
- /**
- * Constructs the class with given parameters.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader = null, &$options = array())
- {
- $this->_reader = $reader;
- $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 ID3v2} 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;
- }
-
- /**
- * Magic function so that $obj->value will work.
- *
- * @param string $name The field name.
- * @return mixed
- */
- public function __get($name)
- {
- if (method_exists($this, "get" . ucfirst($name)))
- return call_user_func(array($this, "get" . ucfirst($name)));
- else {
- require_once("ID3/Exception.php");
- throw new ID3_Exception("Unknown 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 {
- require_once("ID3/Exception.php");
- throw new ID3_Exception("Unknown field: " . $name);
- }
- }
-
- /**
- * Encodes the given 32-bit integer to 28-bit synchsafe integer, where the
- * most significant bit of each byte is zero, making seven bits out of eight
- * available.
- *
- * @param integer $val The integer to encode.
- * @return integer
- */
- protected final function _encodeSynchsafe32($val)
- {
- return ($val & 0x7f) | ($val & 0x3f80) << 1 |
- ($val & 0x1fc000) << 2 | ($val & 0xfe00000) << 3;
- }
-
- /**
- * Decodes the given 28-bit synchsafe integer to regular 32-bit integer.
- *
- * @param integer $val The integer to decode
- * @return integer
- */
- protected final function _decodeSynchsafe32($val)
- {
- return ($val & 0x7f) | ($val & 0x7f00) >> 1 |
- ($val & 0x7f0000) >> 2 | ($val & 0x7f000000) >> 3;
- }
-
- /**
- * Applies the unsynchronisation scheme to the given data string.
- *
- * Whenever a false synchronisation is found within the data, one zeroed byte
- * is inserted after the first false synchronisation byte. This has the side
- * effect that all 0xff00 combinations have to be altered, so they will not
- * be affected by the decoding process. Therefore all the 0xff00 combinations
- * have to be replaced with the 0xff0000 combination during the
- * unsynchronisation.
- *
- * @param string $data The input data.
- * @return string
- */
- protected final function _encodeUnsynchronisation(&$data)
- {
- $result = "";
- for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++)
- if (ord($data[$i]) == 0xff &&
- ((($tmp = ord($data[$i + 1])) & 0xe0) == 0xe0 || $tmp == 0x0)) {
- $result .= substr($data, $j, $i + 1 - $j) . "\0";
- $j = $i + 1;
- }
- return $result . substr($data, $j);
- }
-
- /**
- * Reverses the unsynchronisation scheme from the given data string.
- *
- * @see _encodeUnsynchronisation
- * @param string $data The input data.
- * @return string
- */
- protected final function _decodeUnsynchronisation(&$data)
- {
- $result = "";
- for ($i = 0, $j = 0; $i < strlen($data) - 1; $i++)
- if (ord($data[$i]) == 0xff && ord($data[$i + 1]) == 0x0) {
- $result .= substr($data, $j, $i + 1 - $j);
- $j = $i + 2;
- }
- return $result . substr($data, $j);
- }
-
- /**
- * Splits UTF-16 formatted binary data up according to null terminators
- * residing in the string, up to a given limit.
- *
- * @param string $value The input string.
- * @return Array
- */
- protected final function _explodeString16($value, $limit = null)
- {
- $i = 0;
- $array = array();
- while (count($array) < $limit - 1 || $limit === null) {
- $start = $i;
- do {
- $i = strpos($value, "\x00\x00", $i);
- if ($i === false) {
- $array[] = substr($value, $start);
- return $array;
- }
- } while ($i & 0x1 != 0 && $i++); // make sure its aligned
- $array[] = substr($value, $start, $i - $start);
- $i += 2;
- }
- $array[] = substr($value, $i);
- return $array;
- }
-
- /**
- * Splits UTF-8 or ISO-8859-1 formatted binary data according to null
- * terminators residing in the string, up to a given limit.
- *
- * @param string $value The input string.
- * @return Array
- */
- protected final function _explodeString8($value, $limit = null)
- {
- return preg_split("/\\x00/", $value, $limit);
- }
-
- /**
- * Converts string to requested character encoding and returns it. See the
- * documentation of iconv for accepted values for encoding.
- *
- * @param string|Array $string
- * @param string $encoding
- */
- protected final function _convertString($string, $encoding)
- {
- $target = $this->getOption("encoding", ID3_Encoding::UTF8);
- switch ($target) {
- case ID3_Encoding::UTF16:
- $target = "utf-16";
- break;
- case ID3_Encoding::UTF16LE:
- $target = "utf-16le";
- break;
- case ID3_Encoding::UTF16BE:
- $target = "utf-16be";
- break;
- case ID3_Encoding::UTF8:
- $target = "utf-8";
- break;
- default:
- $target = "iso-8859-1";
- }
-
- if (strtolower($target) == strtolower($encoding))
- return $string;
-
- if (is_array($string))
- foreach ($string as $key => $value)
- $string[$key] = iconv($encoding, $target, $value);
- else
- $string = iconv($encoding, $target, $string);
- return $string;
- }
-
- /**
- * Returns the object data.
- *
- * @return string
- */
- abstract public function __toString();
-}
diff --git a/src/ID3/Timing.php b/src/ID3/Timing.php
deleted file mode 100644
index 7eafee2..0000000
--- a/src/ID3/Timing.php
+++ /dev/null
@@ -1,73 +0,0 @@
-Timing interface implies that the ID3v2 frame contains
- * one or more 32-bit timestamps.
- *
- * The timestamps are absolute times, meaning that every stamp contains the time
- * from the beginning of the file.
- *
- * @package php-reader
- * @subpackage ID3
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-interface ID3_Timing
-{
- /** The timestamp is an absolute time, using MPEG frames as unit. */
- const MPEG_FRAMES = 1;
-
- /** The timestamp is an absolute time, using milliseconds as unit. */
- const MILLISECONDS = 2;
-
- /**
- * Returns the timing format.
- *
- * @return integer
- */
- public function getFormat();
-
- /**
- * Sets the timing format.
- *
- * @param integer $format The timing format.
- */
- public function setFormat($format);
-}
diff --git a/src/ID3v1.php b/src/ID3v1.php
deleted file mode 100644
index b2263cd..0000000
--- a/src/ID3v1.php
+++ /dev/null
@@ -1,361 +0,0 @@
-
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3v1
-{
- /** @var string */
- private $_title;
-
- /** @var string */
- private $_artist;
-
- /** @var string */
- private $_album;
-
- /** @var string */
- private $_year;
-
- /** @var string */
- private $_comment;
-
- /** @var integer */
- private $_track;
-
- /** @var integer */
- private $_genre = 255;
-
- /**
- * The genre list.
- *
- * @var Array
- */
- public static $genres = array
- ("Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge",
- "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B",
- "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska",
- "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient",
- "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical",
- "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise",
- "AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative",
- "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave",
- "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream",
- "Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap",
- "Pop/Funk", "Jungle", "Native American", "Cabaret", "New Wave",
- "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal",
- "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll",
- "Hard Rock", "Folk", "Folk-Rock", "National Folk", "Swing", "Fast Fusion",
- "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde",
- "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock",
- "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour",
- "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony",
- "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam", "Club",
- "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul",
- "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House",
- "Dance Hall", 255 => "Unknown");
-
- /** @var Reader */
- private $_reader;
-
- /** @var string */
- private $_filename = false;
-
- /**
- * Constructs the ID3v1 class with given file. The file is not mandatory
- * argument and may be omitted. A new tag can be written to a file also by
- * giving the filename to the {@link #write} method of this class.
- *
- * @param string|Reader $filename The path to the file, file descriptor of an
- * opened file, or {@link Reader} instance.
- */
- public function __construct($filename = false)
- {
- if ($filename instanceof Reader)
- $this->_reader = &$filename;
- else if ((is_string($filename) && ($this->_filename = $filename) !== false &&
- file_exists($filename) !== false) ||
- (is_resource($filename) &&
- in_array(get_resource_type($filename), array("file", "stream"))))
- $this->_reader = new Reader($filename);
- else
- return;
-
- if ($this->_reader->getSize() < 128)
- throw new ID3_Exception("File does not contain ID3v1 tag");
- $this->_reader->setOffset(-128);
- if ($this->_reader->read(3) != "TAG") {
- $this->_reader = false; // reset reader, see write
- throw new ID3_Exception("File does not contain ID3v1 tag");
- }
-
- $this->_title = rtrim($this->_reader->readString8(30), " \0");
- $this->_artist = rtrim($this->_reader->readString8(30), " \0");
- $this->_album = rtrim($this->_reader->readString8(30), " \0");
- $this->_year = $this->_reader->readString8(4);
- $this->_comment = rtrim($this->_reader->readString8(28), " \0");
-
- /* ID3v1.1 support for tracks */
- $v11_null = $this->_reader->read(1);
- $v11_track = $this->_reader->read(1);
- if (ord($v11_null) == 0 && ord($v11_track) != 0)
- $this->_track = ord($v11_track);
- else
- $this->_comment = rtrim($this->_comment . $v11_null . $v11_track, " \0");
-
- $this->_genre = $this->_reader->readInt8();
- }
-
- /**
- * Returns the title field.
- *
- * @return string
- */
- public function getTitle() { return $this->_title; }
-
- /**
- * Sets a new value for the title field. The field cannot exceed 30
- * characters in length.
- *
- * @param string $title The title.
- */
- public function setTitle($title) { $this->_title = $title; }
-
- /**
- * Returns the artist field.
- *
- * @return string
- */
- public function getArtist() { return $this->_artist; }
-
- /**
- * Sets a new value for the artist field. The field cannot exceed 30
- * characters in length.
- *
- * @param string $artist The artist.
- */
- public function setArtist($artist) { $this->_artist = $artist; }
-
- /**
- * Returns the album field.
- *
- * @return string
- */
- public function getAlbum() { return $this->_album; }
-
- /**
- * Sets a new value for the album field. The field cannot exceed 30
- * characters in length.
- *
- * @param string $album The album.
- */
- public function setAlbum($album) { $this->_album = $album; }
-
- /**
- * Returns the year field.
- *
- * @return string
- */
- public function getYear() { return $this->_year; }
-
- /**
- * Sets a new value for the year field. The field cannot exceed 4
- * characters in length.
- *
- * @param string $year The year.
- */
- public function setYear($year) { $this->_year = $year; }
-
- /**
- * Returns the comment field.
- *
- * @return string
- */
- public function getComment() { return $this->_comment; }
-
- /**
- * Sets a new value for the comment field. The field cannot exceed 30
- * characters in length.
- *
- * @param string $comment The comment.
- */
- public function setComment($comment) { $this->_comment = $comment; }
-
- /**
- * Returns the track field.
- *
- * @since ID3v1.1
- * @return integer
- */
- public function getTrack() { return $this->_track; }
-
- /**
- * Sets a new value for the track field. By setting this field you enforce the
- * 1.1 version to be used.
- *
- * @since ID3v1.1
- * @param integer $track The track number.
- */
- public function setTrack($track) { $this->_track = $track; }
-
- /**
- * Returns the genre.
- *
- * @return string
- */
- public function getGenre()
- {
- if (isset(self::$genres[$this->_genre]))
- return self::$genres[$this->_genre];
- else
- return self::$genres[255]; // unknown
- }
-
- /**
- * Sets a new value for the genre field. The value may either be a numerical
- * code representing one of the genres, or its string variant.
- *
- * The genre is set to unknown (code 255) in case the string is not found from
- * the static {@link $genres} array of this class.
- *
- * @param integer $genre The genre.
- */
- public function setGenre($genre)
- {
- if ((is_numeric($genre) && $genre >= 0 && $genre <= 255) ||
- ($genre = array_search($genre, self::$genres)) !== false)
- $this->_genre = $genre;
- else
- $this->_genre = 255; // unknown
- }
-
- /**
- * Writes the possibly altered ID3v1 tag back to the file where it was read.
- * If the class was constructed without a file name, one can be provided here
- * as an argument. Regardless, the write operation will override previous
- * tag information, if found.
- *
- * @param string $filename The optional path to the file.
- */
- public function write($filename = false)
- {
- if ($filename === false && ($filename = $this->_filename) === false)
- throw new ID3_Exception("No file given to write the tag to");
-
- if (($fd = fopen
- ($filename, file_exists($filename) ? "r+b" : "wb")) === false)
- throw new ID3_Exception("Unable to open file for writing: " . $filename);
-
- fseek($fd, $this->_reader !== false ? -128 : 0, SEEK_END);
- fwrite($fd, $this->__toString(), 128);
-
- $this->_filename = $filename;
- }
-
- /**
- * Magic function so that $obj->value will work.
- *
- * @param string $name The field name.
- * @return mixed
- */
- public function __get($name)
- {
- // To keep compatibility with PHP 5.0.0 we use a static array instead of
- // method_exists to check if a method can be called.
- static $names = array(
- "title", "artist", "album", "year", "comment", "track", "genre"
- );
- if (in_array($name, $names))
- return call_user_func(array($this, "get" . ucfirst(strtolower($name))));
- else throw new ID3_Exception("Unknown 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)
- {
- // To keep compatibility with PHP 5.0.0 we use a static array instead of
- // method_exists to check if a method can be called.
- static $names = array(
- "title", "artist", "album", "year", "comment", "track", "genre"
- );
- if (in_array($name, $names))
- call_user_func
- (array($this, "set" . ucfirst(strtolower($name))), $value);
- else throw new ID3_Exception("Unknown field: " . $name);
- }
-
- /**
- * Returns the tag raw data.
- *
- * @return string
- */
- private function __toString()
- {
- return "TAG" .
- Transform::toString8(substr($this->_title, 0, 30), 30) .
- Transform::toString8(substr($this->_artist, 0, 30), 30) .
- Transform::toString8(substr($this->_album, 0, 30), 30) .
- Transform::toString8(substr($this->_year, 0, 4), 4) .
- ($this->_track ?
- Transform::toString8(substr($this->_comment, 0, 28), 28) .
- "\0" . Transform::toInt8($this->_track) :
- Transform::toString8(substr($this->_comment, 0, 30), 30)) .
- Transform::toInt8($this->_genre);
- }
-}
diff --git a/src/ID3v2.php b/src/ID3v2.php
deleted file mode 100644
index 0905c38..0000000
--- a/src/ID3v2.php
+++ /dev/null
@@ -1,555 +0,0 @@
-
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ID3v2
-{
- /** @var Reader */
- private $_reader;
-
- /** @var ID3_Header */
- private $_header;
-
- /** @var ID3_ExtendedHeader */
- private $_extendedHeader;
-
- /** @var ID3_Header */
- private $_footer;
-
- /** @var Array */
- private $_frames = array();
-
- /** @var string */
- private $_filename = false;
-
- /** @var Array */
- private $_options;
-
- /**
- * Constructs the ID3v2 class with given file and options. The options array
- * may also be given as the only parameter.
- *
- * The following options are currently recognized:
- * o encoding -- Indicates the encoding that all the texts are presented
- * with. By default this is set to ID3_Encoding::UTF8. See the
- * documentation of the {@link ID3_Encoding} interface for accepted
- * values. Conversions are carried out using iconv.
- * o version -- The ID3v2 tag version to use in write operation. This option
- * is automatically set when a tag is read from a file and defaults to
- * version 4.0 for tag write.
- * o readonly -- Indicates that the tag is read from a temporary file or
- * another source it cannot be written back to. The tag can, however,
- * still be written to another file.
- *
- * @todo Only limited subset of flags are processed.
- * @todo Utilize the SEEK frame and search for a footer to find the tag
- * @todo Utilize the LINK frame to fetch frames from other sources
- * @param string|Reader $filename The path to the file, file descriptor of an
- * opened file, or {@link Reader} instance.
- * @param Array $options The options array.
- */
- public function __construct($filename = false, $options = array())
- {
- if (is_array($filename)) {
- $options = $filename;
- $filename = false;
- }
-
- $this->_options = &$options;
- if ($filename === false ||
- (is_string($filename) && file_exists($filename) === false) ||
- (is_resource($filename) &&
- in_array(get_resource_type($filename), array("file", "stream")))) {
- $this->_header = new ID3_Header(null, $options);
- } else {
- if (is_string($filename) && !isset($options["readonly"]))
- $this->_filename = $filename;
- if ($filename instanceof Reader)
- $this->_reader = &$filename;
- else
- $this->_reader = new Reader($filename);
-
- $startOffset = $this->_reader->getOffset();
-
- if ($this->_reader->readString8(3) != "ID3") {
- require_once("ID3/Exception.php");
- throw new ID3_Exception("File does not contain ID3v2 tag");
- }
-
- $this->_header = new ID3_Header($this->_reader, $options);
- if ($this->_header->getVersion() < 3 ||
- $this->_header->getVersion() > 4) {
- require_once("ID3/Exception.php");
- throw new ID3_Exception
- ("File does not contain ID3v2 tag of supported version");
- }
- if ($this->_header->getVersion() < 4 &&
- $this->_header->hasFlag(ID3_Header::UNSYNCHRONISATION)) {
- require_once("ID3/Exception.php");
- throw new ID3_Exception
- ("Unsynchronisation not supported for this version of ID3v2 tag");
- }
- unset($this->_options["unsyncronisation"]);
- if ($this->_header->hasFlag(ID3_Header::UNSYNCHRONISATION))
- $this->_options["unsyncronisation"] = true;
- if ($this->_header->hasFlag(ID3_Header::EXTENDEDHEADER)) {
- require_once("ID3/ExtendedHeader.php");
- $this->_extendedHeader =
- new ID3_ExtendedHeader($this->_reader, $options);
- }
- if ($this->_header->hasFlag(ID3_Header::FOOTER))
- $this->_footer = &$this->_header; // skip footer, and rather copy header
-
- while (true) {
- $offset = $this->_reader->getOffset();
-
- // Jump off the loop if we reached the end of the tag
- if ($offset - $startOffset - 10 >= $this->_header->getSize() -
- ($this->hasFooter() ? 10 : 0) - /* Min bytes for a header */ 10)
- break;
-
- // Jump off the loop if we reached padding
- if (Transform::fromUInt8($identifier = $this->_reader->read(1)) == 0)
- break;
-
- $identifier .= $this->_reader->read(3);
-
- // Jump off the loop if we reached invalid entities. This fix is just to
- // make things work. Utility called MP3ext does not seem to know what it
- // is doing as it uses padding to write its version information there.
- if ($identifier == "MP3e")
- break;
-
- $this->_reader->setOffset($offset);
- if (@fopen($filename = "ID3/Frame/" .
- strtoupper($identifier) . ".php", "r", true) !== false)
- require_once($filename);
- if (class_exists($classname = "ID3_Frame_" . $identifier))
- $frame = new $classname($this->_reader, $options);
- else {
- require_once("ID3/Frame/Unknown.php");
- $frame = new ID3_Frame_Unknown($this->_reader, $options);
- }
-
- if (!isset($this->_frames[$frame->getIdentifier()]))
- $this->_frames[$frame->getIdentifier()] = array();
- $this->_frames[$frame->getIdentifier()][] = $frame;
- }
- }
- }
-
- /**
- * Returns the header object.
- *
- * @return ID3_Header
- */
- public function getHeader() { return $this->_header; }
-
- /**
- * Checks whether there is an extended header present in the tag. Returns
- * true if the header is present, false otherwise.
- *
- * @return boolean
- */
- public function hasExtendedHeader()
- {
- if ($this->_header)
- return $this->_header->hasFlag(ID3_Header::EXTENDEDHEADER);
- }
-
- /**
- * Returns the extended header object if present, or false
- * otherwise.
- *
- * @return ID3_ExtendedHeader|false
- */
- public function getExtendedHeader()
- {
- if ($this->hasExtendedHeader())
- return $this->_extendedHeader;
- return false;
- }
-
- /**
- * Sets the extended header object.
- *
- * @param ID3_ExtendedHeader $extendedHeader The header object
- */
- public function setExtendedHeader($extendedHeader)
- {
- if (is_subclass_of($extendedHeader, "ID3_ExtendedHeader")) {
- $this->_header->flags =
- $this->_header->flags | ID3_Header::EXTENDEDHEADER;
- $this->_extendedHeader->setOptions($this->_options);
- $this->_extendedHeader = $extendedHeader;
- } else {
- require_once("ID3/Exception.php");
- throw new ID3_Exception("Invalid argument");
- }
- }
-
- /**
- * Checks whether there is a frame given as an argument defined in the tag.
- * Returns true if one ore more frames are present,
- * false otherwise.
- *
- * @param string $identifier The frame name.
- * @return boolean
- */
- public function hasFrame($identifier)
- {
- return isset($this->_frames[$identifier]);
- }
-
- /**
- * Returns all the frames the tag contains as an associate array. The frame
- * identifiers work as keys having an array of frames as associated value.
- *
- * @return Array
- */
- public function getFrames() { return $this->_frames; }
-
- /**
- * Returns an array of frames matching the given identifier or an empty array
- * if no frames 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 frame with the identifier given. Wildcards cannot be used with
- * the shorthand method.
- *
- * @param string $identifier The frame name.
- * @return Array
- */
- public function getFramesByIdentifier($identifier)
- {
- $matches = array();
- $searchPattern = "/^" .
- str_replace(array("*", "?"), array(".*", "."), $identifier) . "$/i";
- foreach ($this->_frames as $identifier => $frames)
- if (preg_match($searchPattern, $identifier))
- foreach ($frames as $frame)
- $matches[] = $frame;
- return $matches;
- }
-
- /**
- * Removes any frames matching the given object 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 frame name.
- */
- public final function removeFramesByIdentifier($identifier)
- {
- $searchPattern = "/^" .
- str_replace(array("*", "?"), array(".*", "."), $identifier) . "$/i";
- foreach ($this->_frames as $identifier => $frames)
- if (preg_match($searchPattern, $identifier))
- unset($this->_frames[$identifier]);
- }
-
- /**
- * Adds a new frame to the tag and returns it.
- *
- * @param ID3_Frame $frame The frame to add.
- * @return ID3_Frame
- */
- public function addFrame($frame)
- {
- $frame->setOptions($this->_options);
- if (!$this->hasFrame($frame->getIdentifier()))
- $this->_frames[$frame->getIdentifier()] = array();
- return $this->_frames[$frame->getIdentifier()][] = $frame;
- }
-
- /**
- * Remove the given frame from the tag.
- *
- * @param ID3_Frame $frame The frame to remove.
- */
- public function removeFrame($frame)
- {
- if (!$this->hasFrame($frame->getIdentifier()))
- foreach ($this->_frames[$frame->getIdentifier()] as $key => $value)
- if ($frame === $value)
- unset($this->_frames[$frame->getIdentifier()][$key]);
- }
-
- /**
- * Checks whether there is a footer present in the tag. Returns
- * true if the footer is present, false otherwise.
- *
- * @return boolean
- */
- public function hasFooter()
- {
- return $this->_header->hasFlag(ID3_Header::FOOTER);
- }
-
- /**
- * Returns the footer object if present, or false otherwise.
- *
- * @return ID3_Header|false
- */
- public function getFooter()
- {
- if ($this->hasFooter())
- return $this->_footer;
- return false;
- }
-
- /**
- * Sets whether the tag should have a footer defined.
- *
- * @param boolean $useFooter Whether the tag should have a footer
- */
- public function setFooter($useFooter)
- {
- if ($useFooter) {
- $this->_header->setFlags
- ($this->_header->getFlags() | ID3_Header::FOOTER);
- $this->_footer = &$this->_header;
- } else {
- /* Count footer bytes towards the tag size, so it gets removed or
- overridden upon re-write */
- if ($this->hasFooter())
- $this->_header->setSize($this->_header->getSize() + 10);
-
- $this->_header->setFlags
- ($this->_header->getFlags() & ~ID3_Header::FOOTER);
- $this->_footer = null;
- }
- }
-
- /**
- * Writes the possibly altered ID3v2 tag back to the file where it was read.
- * If the class was constructed without a file name, one can be provided here
- * as an argument. Regardless, the write operation will override previous
- * tag information, if found.
- *
- * If write is called without setting any frames to the tag, the tag is
- * removed from the file.
- *
- * @param string $filename The optional path to the file.
- */
- public function write($filename = false)
- {
- if ($filename === false && ($filename = $this->_filename) === false) {
- require_once("ID3/Exception.php");
- throw new ID3_Exception("No file given to write the tag to");
- }
- else if ($filename !== false && $this->_filename !== false &&
- realpath($filename) != realpath($this->_filename) &&
- !copy($this->_filename, $filename)) {
- require_once("ID3/Exception.php");
- throw new ID3_Exception("Unable to copy source to destination: " .
- realpath($this->_filename) . "->" . realpath($filename));
- }
-
- if (($fd = fopen
- ($filename, file_exists($filename) ? "r+b" : "wb")) === false) {
- require_once("ID3/Exception.php");
- throw new ID3_Exception("Unable to open file for writing: " . $filename);
- }
-
- $oldTagSize = $this->_header->getSize();
- $tag = $this->__toString();
- $tagSize = empty($this->_frames) ? 0 : strlen($tag);
-
- if ($this->_reader === null ||
- $tagSize - 10 > $oldTagSize || $tagSize == 0) {
- fseek($fd, 0, SEEK_END);
- $oldFileSize = ftell($fd);
- ftruncate($fd, $newFileSize = $tagSize - $oldTagSize + $oldFileSize);
- for ($i = 1, $cur = $oldFileSize; $cur > 0; $cur -= 1024, $i++) {
- fseek($fd, -(($i * 1024) + ($newFileSize - $oldFileSize)), SEEK_END);
- $buffer = fread($fd, 1024);
- fseek($fd, -($i * 1024), SEEK_END);
- fwrite($fd, $buffer, 1024);
- }
- }
- fseek($fd, 0);
- fwrite($fd, $tag, $tagSize);
- fclose($fd);
-
- $this->_filename = $filename;
- }
-
- /**
- * Magic function so that $obj->value will work. The method will attempt to
- * return the first frame that matches the identifier.
- *
- * If there is no frame or field with given name, the method will attempt to
- * create a frame with given identifier.
- *
- * If none of these work, an exception is thrown.
- *
- * @param string $name The frame or field name.
- * @return mixed
- */
- public function __get($name) {
- if (isset($this->_frames[strtoupper($name)]))
- return $this->_frames[strtoupper($name)][0];
- if (method_exists($this, "get" . ucfirst($name)))
- return call_user_func(array($this, "get" . ucfirst($name)));
- if (@fopen($filename =
- "ID3/Frame/" . strtoupper($name) . ".php", "r", true) !== false)
- require_once($filename);
- if (class_exists($classname = "ID3_Frame_" . strtoupper($name)))
- return $this->addFrame(new $classname());
- require_once("ID3/Exception.php");
- throw new ID3_Exception("Unknown frame/field: " . $name);
- }
-
- /**
- * Magic function so that isset($obj->value) will work. This method checks
- * whether the frame matching the identifier exists.
- *
- * @param string $name The frame identifier.
- * @return boolean
- */
- public function __isset($name)
- {
- return isset($this->_frames[strtoupper($name)]);
- }
-
- /**
- * Magic function so that unset($obj->value) will work. This method removes
- * all the frames matching the identifier.
- *
- * @param string $name The frame identifier.
- */
- public function __unset($name) { unset($this->_frames[strtoupper($name)]); }
-
- /**
- * Returns the tag raw data.
- *
- * @return string
- */
- public function __toString()
- {
- unset($this->_options["unsyncronisation"]);
-
- $data = "";
- foreach ($this->_frames as $frames)
- foreach ($frames as $frame)
- $data .= $frame->__toString();
-
- $datalen = strlen($data);
- $padlen = 0;
-
- if (isset($this->_options["unsyncronisation"]) &&
- $this->_options["unsyncronisation"] === true)
- $this->_header->setFlags
- ($this->_header->getFlags() | ID3_Header::UNSYNCHRONISATION);
-
- /* The tag padding is calculated as follows. If the tag can be written in
- the space of the previous tag, the remaining space is used for padding.
- If there is no previous tag or the new tag is bigger than the space taken
- by the previous tag, the padding is a constant 4096 bytes. */
- if ($this->hasFooter() === false) {
- if ($this->_reader !== null && $datalen < $this->_header->getSize())
- $padlen = $this->_header->getSize() - $datalen;
- else
- $padlen = 4096;
- }
-
- /* ID3v2.4.0 CRC calculated w/ padding */
- if (!isset($this->_options["version"]) || $this->_options["version"] >= 4)
- $data = str_pad($data, $datalen + $padlen, "\0");
-
- if ($this->hasExtendedHeader()) {
- $this->_extendedHeader->setPadding($padlen);
- if ($this->_extendedHeader->hasFlag(ID3_ExtendedHeader::CRC32)) {
- $crc = crc32($data);
- if ($crc & 0x80000000)
- $crc = -(($crc ^ 0xffffffff) + 1);
- $this->_extendedHeader->setCrc($crc);
- }
- $data = $this->getExtendedHeader()->__toString() . $data;
- }
-
- /* ID3v2.3.0 CRC calculated w/o padding */
- if (isset($this->_options["version"]) && $this->_options["version"] < 4)
- $data = str_pad($data, $datalen + $padlen, "\0");
-
- $this->_header->setSize(strlen($data));
-
- return "ID3" . $this->_header->__toString() . $data .
- ($this->hasFooter() ? "3DI" . $this->getFooter()->__toString() : "");
- }
-}
diff --git a/src/ISO14496.php b/src/ISO14496.php
deleted file mode 100644
index 31c1213..0000000
--- a/src/ISO14496.php
+++ /dev/null
@@ -1,380 +0,0 @@
-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("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.
- *
- *
- * - ftyp -- {@link ISO14496_Box_FTYP File Type Box}; file type
- * and compatibility
- *
- pdin -- {@link ISO14496_Box_PDIN Progressive Download Information
- * Box}
- *
- moov -- {@link ISO14496_Box_MOOV Movie Box}; container for
- * all the metadata
- *
- * - mvhd -- {@link ISO14496_Box_MVHD Movie Header Box};
- * overall declarations
- *
- trak -- {@link ISO14496_Box_TRAK Track Box}; container
- * for an individual track or stream
- *
- * - tkhd -- {@link ISO14496_Box_TKHD Track Header Box};
- * overall information about the track
- *
- tref -- {@link ISO14496_Box_TREF Track Reference Box}
- *
- edts -- {@link ISO14496_Box_EDTS Edit Box}
- *
- * - elst -- {@link ISO14496_Box_ELST Edit List Box}
- *
- * - mdia -- {@link ISO14496_Box_MDIA Media Box}
- *
- * - mdhd -- {@link ISO14496_Box_MDHD Media Header Box};
- * overall information about the media
- *
- hdlr -- {@link ISO14496_Box_HDLR Handler Reference
- * Box}; declares the media type
- *
- minf -- {@link ISO14496_Box_MINF Media Information
- * Box}
- *
- * - vmhd -- {@link ISO14496_Box_VMHD Video Media Header Box};
- * overall information (video track only)
- *
- smhd -- {@link ISO14496_Box_SMHD Sound Media Header Box};
- * overall information (sound track only)
- *
- hmhd -- {@link ISO14496_Box_HMHD Hint Media Header Box};
- * overall information (hint track only)
- *
- nmhd -- {@link ISO14496_Box_NMHD Null Media Header Box};
- * overall information (some tracks only)
- *
- dinf -- {@link ISO14496_Box_DINF Data Information
- * Box}
- *
- * - dref -- {@link ISO14496_Box_DREF Data Reference
- * Box}
- *
- * - stbl -- {@link ISO14496_Box_STBL Sample Table Box}
- *
- * - stsd -- {@link ISO14496_Box_STSD Sample Descriptions
- * Box}
- *
- stts -- {@link ISO14496_Box_STTS Decoding Time To
- * Sample Box}
- *
- ctts -- {@link ISO14496_Box_CTTS Composition Time To Sample
- * Box}
- *
- stsc -- {@link ISO14496_Box_STSC Sample To Chunk
- * Box}
- *
- stsz -- {@link ISO14496_Box_STSZ Sample Size Box}
- *
- stz2 -- {@link ISO14496_Box_STZ2 Compact Sample Size
- * Box}
- *
- stco -- {@link ISO14496_Box_STCO Chunk Offset
- * Box}; 32-bit
- *
- co64 -- {@link ISO14496_Box_CO64 Chunk Ooffset Box};
- * 64-bit
- *
- stss -- {@link ISO14496_Box_STSS Sync Sample Table Box}
- *
- stsh -- {@link ISO14496_Box_STSH Shadow Sync Sample Table
- * Box}
- *
- padb -- {@link ISO14496_Box_PADB Padding Bits Box}
- *
- stdp -- {@link ISO14496_Box_STDP Sample Degradation Priority
- * Box}
- *
- sdtp -- {@link ISO14496_Box_SDTP Independent and Disposable
- * Samples Box}
- *
- sbgp -- {@link ISO14496_Box_SBGP Sample To Group Box}
- *
- sgpd -- {@link ISO14496_Box_SGPD Sample Group
- * Description}
- *
- subs -- {@link ISO14496_Box_SUBS Sub-Sample Information
- * Box}
- *
- *
- *
- *
- * - mvex -- {@link ISO14496_Box_MVEX Movie Extends Box}
- *
- * - mehd -- {@link ISO14496_Box_MEHD Movie Extends Header Box}
- *
- trex -- {@link ISO14496_Box_TREX Track Extends Box}
- *
- * - ipmc -- {@link ISO14496_Box_IPMC IPMP Control Box}
- *
- * - moof -- {@link ISO14496_Box_MOOF Movie Fragment Box}
- *
- * - mfhd -- {@link ISO14496_Box_MFHD Movie Fragment Header
- * Box}
- *
- traf -- {@link ISO14496_Box_TRAF Track Fragment Box}
- *
- * - tfhd -- {@link ISO14496_Box_TFHD Track Fragment Header
- * Box}
- *
- trun -- {@link ISO14496_Box_TRUN Track Fragment Run}
- *
- sdtp -- {@link ISO14496_Box_SDTP Independent and Disposable
- * Samples}
- *
- sbgp -- {@link ISO14496_Box_SBGP !SampleToGroup Box}
- *
- subs -- {@link ISO14496_Box_SUBS Sub-Sample Information Box}
- *
- *
- * - mfra -- {@link ISO14496_Box_MFRA Movie Fragment Random Access Box}
- *
- * - tfra -- {@link ISO14496_Box_TFRA Track Fragment Random Access
- * Box}
- *
- mfro -- {@link ISO14496_Box_MFRO Movie Fragment Random Access
- * Offset Box}
- *
- * - mdat -- {@link ISO14496_Box_MDAT Media Data Box}
- *
- free -- {@link ISO14496_Box_FREE Free Space Box}
- *
- skip -- {@link ISO14496_Box_SKIP Free Space Box}
- *
- * - udta -- {@link ISO14496_Box_UDTA User Data Box}
- *
- * - cprt -- {@link ISO14496_Box_CPRT Copyright Box}
- *
- *
- * - meta -- {@link ISO14496_Box_META The Meta Box}
- *
- * - hdlr -- {@link ISO14496_Box_HDLR Handler Reference Box};
- * declares the metadata type
- *
- dinf -- {@link ISO14496_Box_DINF Data Information Box}
- *
- * - dref -- {@link ISO14496_Box_DREF Data Reference Box}; declares
- * source(s) of metadata items
- *
- * - ipmc -- {@link ISO14496_Box_IPMC IPMP Control Box}
- *
- iloc -- {@link ISO14496_Box_ILOC Item Location Box}
- *
- ipro -- {@link ISO14496_Box_IPRO Item Protection Box}
- *
- * - sinf -- {@link ISO14496_Box_SINF Protection Scheme Information
- * Box}
- *
- * - frma -- {@link ISO14496_Box_FRMA Original Format Box}
- *
- imif -- {@link ISO14496_Box_IMIF IPMP Information Box}
- *
- schm -- {@link ISO14496_Box_SCHM Scheme Type Box}
- *
- schi -- {@link ISO14496_Box_SCHI Scheme Information Box}
- *
- *
- * - iinf -- {@link ISO14496_Box_IINF Item Information Box}
- *
- * - infe -- {@link ISO14496_Box_INFE Item Information Entry Box}
- *
- * - xml -- {@link ISO14496_Box_XML XML Box}
- *
- bxml -- {@link ISO14496_Box_BXML Binary XML Box}
- *
- pitm -- {@link ISO14496_Box_PITM Primary Item Reference Box}
- *
- *
- *
- * 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.
- *
- *
- * - moov -- {@link ISO14496_Box_MOOV Movie Box}; container for
- * all the metadata
- *
- udta -- {@link ISO14496_Box_UDTA User Data Box}
- *
- meta -- {@link ISO14496_Box_META The Meta Box}
- *
- * - ilst -- {@link ISO14496_Box_ILST The iTunes/iPod Tag Container
- * Box}
- *
- id32 -- {@link ISO14496_Box_ID32 The ID3v2 Box}
- *
- *
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @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
- * moov.udta.meta. Changes to any other box are discarded. Write
- * operation will overwrite moov.udta, 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;
- }
-}
diff --git a/src/ISO14496/Box.php b/src/ISO14496/Box.php
deleted file mode 100644
index 38155ef..0000000
--- a/src/ISO14496/Box.php
+++ /dev/null
@@ -1,497 +0,0 @@
-
- * @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
- * true if one or more boxes are present, false
- * 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;
- }
-}
diff --git a/src/ISO14496/Box/BXML.php b/src/ISO14496/Box/BXML.php
deleted file mode 100644
index 3fd5c1c..0000000
--- a/src/ISO14496/Box/BXML.php
+++ /dev/null
@@ -1,86 +0,0 @@
-XML Box forms may be used.
- * The Binary XML Box may only be used when there is a single well-defined
- * binarization of the XML for that defined format as identified by the handler.
- *
- * Within an XML box the data is in UTF-8 format unless the data starts with a
- * byte-order-mark (BOM), which indicates that the data is in UTF-16 format.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_BXML extends ISO14496_Box_Full
-{
- /** @var string */
- private $_data;
-
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_data = $this->_reader->read
- ($this->getOffset() + $this->getSize() - $this->_reader->getOffset());
- }
-
- /**
- * Returns the binary data.
- *
- * @return string
- */
- public function getData()
- {
- return $this->_data;
- }
-}
diff --git a/src/ISO14496/Box/CDSC.php b/src/ISO14496/Box/CDSC.php
deleted file mode 100644
index 0effe2b..0000000
--- a/src/ISO14496/Box/CDSC.php
+++ /dev/null
@@ -1,80 +0,0 @@
-
- * @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; }
-}
diff --git a/src/ISO14496/Box/CO64.php b/src/ISO14496/Box/CO64.php
deleted file mode 100644
index 8aa5c59..0000000
--- a/src/ISO14496/Box/CO64.php
+++ /dev/null
@@ -1,122 +0,0 @@
-Chunk Offset Box table gives the index of each chunk into the
- * containing file. There are two variants, permitting the use of 32-bit or
- * 64-bit offsets. The latter is useful when managing very large presentations.
- * At most one of these variants will occur in any single instance of a sample
- * table.
- *
- * Offsets are file offsets, not the offset into any box within the file (e.g.
- * {@link 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
- * @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);
- }
-}
diff --git a/src/ISO14496/Box/CPRT.php b/src/ISO14496/Box/CPRT.php
deleted file mode 100644
index be1d9b7..0000000
--- a/src/ISO14496/Box/CPRT.php
+++ /dev/null
@@ -1,96 +0,0 @@
-Copyright Box 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
- * @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; }
-}
diff --git a/src/ISO14496/Box/CTTS.php b/src/ISO14496/Box/CTTS.php
deleted file mode 100644
index ec539a4..0000000
--- a/src/ISO14496/Box/CTTS.php
+++ /dev/null
@@ -1,99 +0,0 @@
-Composition Time to Sample Box provides the offset between
- * decoding time and composition time. Since decoding time must be less than the
- * composition time, the offsets are expressed as unsigned numbers such that
- * CT(n) = DT(n) + CTTS(n) where CTTS(n) is the (uncompressed) table entry for
- * sample n.
- *
- * The composition time to sample table is optional and must only be present if
- * DT and CT differ for any samples. Hint tracks do not use this box.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_CTTS extends ISO14496_Box_Full
-{
- /** @var Array */
- private $_compositionOffsetTable = array();
-
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $entryCount = $this->_reader->readUInt32BE();
- $data = $this->_reader->read
- ($this->getOffset() + $this->getSize() - $this->_reader->getOffset());
- for ($i = 1; $i <= $entryCount; $i++)
- $this->_compositionOffsetTable[$i] = array
- ("sampleCount" =>
- Transform::fromUInt32BE(substr($data, ($i - 1) * 8, 4)),
- "sampleOffset" =>
- Transform::fromUInt32BE(substr($data, $i * 8 - 4, 4)));
- }
-
- /**
- * Returns an array of values. Each entry is an array containing the following
- * keys.
- * o sampleCount -- an integer that counts the number of consecutive samples
- * that have the given offset.
- * o sampleOffset -- a non-negative integer that gives the offset between CT
- * and DT, such that CT(n) = DT(n) + CTTS(n).
- *
- * @return Array
- */
- public function getCompositionOffsetTable()
- {
- return $this->_compositionOffsetTable;
- }
-}
diff --git a/src/ISO14496/Box/DINF.php b/src/ISO14496/Box/DINF.php
deleted file mode 100644
index a8dfbbe..0000000
--- a/src/ISO14496/Box/DINF.php
+++ /dev/null
@@ -1,71 +0,0 @@
-Data Information Box contains objects that declare the location
- * of the media information in a track.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_DINF extends ISO14496_Box
-{
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
- $this->setContainer(true);
-
- if ($reader === null)
- return;
-
- $this->constructBoxes();
- }
-}
diff --git a/src/ISO14496/Box/DREF.php b/src/ISO14496/Box/DREF.php
deleted file mode 100644
index ced6db9..0000000
--- a/src/ISO14496/Box/DREF.php
+++ /dev/null
@@ -1,88 +0,0 @@
-Data Reference Box contains a table of data references (normally
- * URLs) that declare the location(s) of the media data used within the
- * presentation. The data reference index in the sample description ties entries
- * in this table to the samples in the track. A track may be split over several
- * sources in this way.
- *
- * This box may either contain {@link ISO14496_Box_URN urn} or
- * {@link ISO14496_Box_URL url} boxes.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_DREF extends ISO14496_Box_Full
-{
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
- $this->setContainer(true);
-
- if ($reader === null)
- return;
-
- $this->_reader->skip(4);
- $this->constructBoxes();
- }
-
- /**
- * Returns the box raw data.
- *
- * @return string
- */
- public function __toString($data = "")
- {
- return parent::__toString(Transform::toUInt32BE(count($this->_boxes)));
- }
-}
diff --git a/src/ISO14496/Box/EDTS.php b/src/ISO14496/Box/EDTS.php
deleted file mode 100644
index 0e24e13..0000000
--- a/src/ISO14496/Box/EDTS.php
+++ /dev/null
@@ -1,76 +0,0 @@
-Edit Box 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/ELST.php b/src/ISO14496/Box/ELST.php
deleted file mode 100644
index e424f2e..0000000
--- a/src/ISO14496/Box/ELST.php
+++ /dev/null
@@ -1,108 +0,0 @@
-Edit List Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/FREE.php b/src/ISO14496/Box/FREE.php
deleted file mode 100644
index f239e5f..0000000
--- a/src/ISO14496/Box/FREE.php
+++ /dev/null
@@ -1,76 +0,0 @@
-Free Space Box are irrelevant and may be ignored, or
- * the object deleted, without affecting the presentation. (Care should be
- * exercised when deleting the object, as this may invalidate the offsets used
- * in the sample table, unless this object is after all the media data).
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_FREE extends ISO14496_Box
-{
- /**
- * Constructs the class with given parameters.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
- }
-
- /**
- * Returns the box raw data.
- *
- * @return string
- */
- public function __toString($data = "")
- {
- return parent::__toString(str_repeat("\0", $this->getSize() - 8));
- }
-}
diff --git a/src/ISO14496/Box/FRMA.php b/src/ISO14496/Box/FRMA.php
deleted file mode 100644
index bb180e8..0000000
--- a/src/ISO14496/Box/FRMA.php
+++ /dev/null
@@ -1,78 +0,0 @@
-Original Format Box contains the four-character-code of the
- * original un-transformed sample description.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-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. mp4v if the stream contains protected MPEG-4 visual material).
- *
- * @return string
- */
- public function getDataFormat() { return $this->_dataFormat; }
-}
diff --git a/src/ISO14496/Box/FTYP.php b/src/ISO14496/Box/FTYP.php
deleted file mode 100644
index 550e583..0000000
--- a/src/ISO14496/Box/FTYP.php
+++ /dev/null
@@ -1,142 +0,0 @@
-File Type Box 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 best use 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 isom (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 isom
- * is the major brand.
- *
- * Files would normally be externally identified (e.g. with a file extension or
- * mime type) that identifies the best use (major brand), or the brand
- * that the author believes will provide the greatest compatibility.
- *
- * The brand iso2 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 isom brand and the same usage rules apply. If
- * used without the brand isom 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 avc1 shall be used to indicate that the file is conformant
- * with the AVC Extensions. If used without other brands, this implies
- * that support for those extensions is required. The use of avc1 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 mp71 is a member of the compatible-brands list in the file-type
- * box.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_FTYP extends ISO14496_Box
-{
- /** @var integer */
- private $_majorBrand;
-
- /** @var integer */
- private $_minorVersion;
-
- /** @var integer */
- private $_compatibleBrands = array();
-
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_majorBrand = $this->_reader->readString8(4);
- $this->_minorVersion = $this->_reader->readUInt32BE();
- while ($this->_reader->getOffset() < $this->getSize())
- if (($brand = $this->_reader->readString8(4)) != "")
- $this->_compatibleBrands[] = $brand;
- }
-
- /**
- * Returns the major version brand.
- *
- * @return string
- */
- public function getMajorBrand() { return $this->_majorBrand; }
-
- /**
- * Returns the minor version number.
- *
- * @return integer
- */
- public function getMinorVersion() { return $this->_minorVersion; }
-
- /**
- * Returns the array of compatible version brands.
- *
- * @return Array
- */
- public function getCompatibleBrands() { return $this->_compatibleBrands; }
-}
diff --git a/src/ISO14496/Box/Full.php b/src/ISO14496/Box/Full.php
deleted file mode 100644
index 06e7ab9..0000000
--- a/src/ISO14496/Box/Full.php
+++ /dev/null
@@ -1,124 +0,0 @@
-
- * @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 true if the flag
- * is set, false otherwise.
- *
- * @param integer $flag The flag to query.
- * @return boolean
- */
- public function hasFlag($flag) { return ($this->_flags & $flag) == $flag; }
-
- /**
- * Returns the map of flags.
- *
- * @return integer
- */
- public function getFlags() { return $this->_flags; }
-
- /**
- * Sets the map of flags.
- *
- * @param string $flags The map of flags.
- */
- public function setFlags($flags) { $this->_flags = $flags; }
-
- /**
- * Returns the box raw data.
- *
- * @return string
- */
- public function __toString($data = "")
- {
- return parent::__toString
- (Transform::toUInt32BE($this->_version << 24 | $this->_flags) . $data);
- }
-}
diff --git a/src/ISO14496/Box/HDLR.php b/src/ISO14496/Box/HDLR.php
deleted file mode 100644
index 61b88d3..0000000
--- a/src/ISO14496/Box/HDLR.php
+++ /dev/null
@@ -1,150 +0,0 @@
-Handler Reference Box is within a {@link ISO14496_Box_MDIA Media
- * Box} declares the process by which the media-data in the track is presented,
- * and thus, the nature of the media in a track. For example, a video track
- * would be handled by a video handler.
- *
- * This box when present within a {@link ISO14496_Box_META Meta Box}, declares
- * the structure or format of the meta box contents.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_HDLR extends ISO14496_Box_Full
-{
- /** @var string */
- private $_handlerType;
-
- /** @var string */
- private $_name;
-
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
-
- if ($reader === null)
- return;
-
- $this->_reader->skip(4);
- $this->_handlerType = $this->_reader->read(4);
- $this->_reader->skip(12);
- $this->_name = $this->_reader->readString8
- ($this->getOffset() + $this->getSize() - $this->_reader->getOffset());
- }
-
- /**
- * Returns the handler type.
- *
- * When present in a media box, the returned value contains one of the
- * following values, or a value from a derived specification:
- * o vide Video track
- * o soun Audio track
- * o hint Hint track
- *
- * When present in a meta box, the returned value contains an appropriate
- * value to indicate the format of the meta box contents.
- *
- * @return integer
- */
- public function getHandlerType() { return $this->_handlerType; }
-
- /**
- * Sets the handler type.
- *
- * When present in a media box, the value must be set to one of the following
- * values, or a value from a derived specification:
- * o vide Video track
- * o soun Audio track
- * o hint Hint track
- *
- * When present in a meta box, the value must be set to an appropriate value
- * to indicate the format of the meta box contents.
- *
- * @param string $handlerType The handler type.
- */
- public function setHandlerType($handlerType)
- {
- $this->_handlerType = $handlerType;
- }
-
- /**
- * Returns the name string. The name is in UTF-8 characters and gives a
- * human-readable name for the track type (for debugging and inspection
- * purposes).
- *
- * @return integer
- */
- public function getName() { return $this->_name; }
-
- /**
- * Sets the name string. The name must be in UTF-8 and give a human-readable
- * name for the track type (for debugging and inspection purposes).
- *
- * @param string $name The human-readable description.
- */
- public function setName($name) { $this->_name = $name; }
-
- /**
- * Returns the box raw data.
- *
- * @return string
- */
- public function __toString($data = "")
- {
- return parent::__toString
- ("appl" . $this->_handlerType . Transform::toUInt32BE(0) .
- Transform::toUInt32BE(0) . Transform::toUInt32BE(0) . $this->_name .
- "\0");
- }
-}
diff --git a/src/ISO14496/Box/HINT.php b/src/ISO14496/Box/HINT.php
deleted file mode 100644
index 286f3e5..0000000
--- a/src/ISO14496/Box/HINT.php
+++ /dev/null
@@ -1,81 +0,0 @@
-
- * @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; }
-}
diff --git a/src/ISO14496/Box/HMHD.php b/src/ISO14496/Box/HMHD.php
deleted file mode 100644
index 3c39f2c..0000000
--- a/src/ISO14496/Box/HMHD.php
+++ /dev/null
@@ -1,110 +0,0 @@
-Hint Media Header Box header contains general information,
- * independent of the protocol, for hint tracks.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_HMHD extends ISO14496_Box_Full
-{
- /** @var integer */
- private $_maxPDUSize;
-
- /** @var integer */
- private $_avgPDUSize;
-
- /** @var integer */
- private $_maxBitrate;
-
- /** @var integer */
- private $_avgBitrate;
-
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_maxPDUSize = $this->_reader->readUInt16BE();
- $this->_avgPDUSize = $this->_reader->readUInt16BE();
- $this->_maxBitrate = $this->_reader->readUInt32BE();
- $this->_avgBitrate = $this->_reader->readUInt32BE();
- }
-
- /**
- * Returns the size in bytes of the largest PDU in this (hint) stream.
- *
- * @return integer
- */
- public function getMaxPDUSize() { return $this->_maxPDUSize; }
-
- /**
- * Returns the average size of a PDU over the entire presentation.
- *
- * @return integer
- */
- public function getAvgPDUSize() { return $this->_avgPDUSize; }
-
- /**
- * Returns the maximum rate in bits/second over any window of one second.
- *
- * @return integer
- */
- public function getMaxBitrate() { return $this->_maxbitrate; }
-
- /**
- * Returns the average rate in bits/second over the entire presentation.
- *
- * @return integer
- */
- public function getAvgBitrate() { return $this->_maxbitrate; }
-}
diff --git a/src/ISO14496/Box/ID32.php b/src/ISO14496/Box/ID32.php
deleted file mode 100644
index 7c17394..0000000
--- a/src/ISO14496/Box/ID32.php
+++ /dev/null
@@ -1,131 +0,0 @@
-ID3v2 Box 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
- * @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);
- }
-}
diff --git a/src/ISO14496/Box/IINF.php b/src/ISO14496/Box/IINF.php
deleted file mode 100644
index a45270b..0000000
--- a/src/ISO14496/Box/IINF.php
+++ /dev/null
@@ -1,87 +0,0 @@
-Item Information Box provides extra information about selected
- * items, including symbolic (file) names. It may optionally occur, but
- * if it does, it must be interpreted, as item protection or content encoding
- * may have changed the format of the data in the item. If both content encoding
- * and protection are indicated for an item, a reader should first un-protect
- * the item, and then decode the item's content encoding. If more control is
- * needed, an IPMP sequence code may be used.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_IINF extends ISO14496_Box
-{
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
- $this->setContainer(true);
-
- if ($reader === null)
- return;
-
- $this->_reader->skip(2);
- $this->constructBoxes();
- }
-
- /**
- * Returns the box raw data.
- *
- * @return string
- */
- public function __toString($data = "")
- {
- return parent::__toString(Transform::toUInt16BE(count($this->_boxes)));
- }
-}
diff --git a/src/ISO14496/Box/ILOC.php b/src/ISO14496/Box/ILOC.php
deleted file mode 100644
index 315e7e9..0000000
--- a/src/ISO14496/Box/ILOC.php
+++ /dev/null
@@ -1,134 +0,0 @@
-The Item Location Box 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
- * @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; }
-}
diff --git a/src/ISO14496/Box/ILST.php b/src/ISO14496/Box/ILST.php
deleted file mode 100644
index a54ac8a..0000000
--- a/src/ISO14496/Box/ILST.php
+++ /dev/null
@@ -1,281 +0,0 @@
-
- * _nam -- Name of the track
- * _ART -- Name of the artist
- * aART -- Name of the album artist
- * _alb -- Name of the album
- * _grp -- Grouping
- * _day -- Year of publication
- * trkn -- Track number (number/total)
- * disk -- Disk number (number/total)
- * tmpo -- BPM tempo
- * _wrt -- Name of the composer
- * _cmt -- Comments
- * _gen -- Genre as string
- * gnre -- Genre as an ID3v1 code, added by one
- * cpil -- Part of a compilation (0/1)
- * tvsh -- Name of the (television) show
- * sonm -- Sort name of the track
- * soar -- Sort name of the artist
- * soaa -- Sort name of the album artist
- * soal -- Sort name of the album
- * soco -- Sort name of the composer
- * sosn -- Sort name of the show
- * _lyr -- Lyrics
- * covr -- Cover (or other) artwork binary data
- * _too -- Information about the software
- *
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @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
- * @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
- * @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);
- }
-}
diff --git a/src/ISO14496/Box/INFE.php b/src/ISO14496/Box/INFE.php
deleted file mode 100644
index 28740bb..0000000
--- a/src/ISO14496/Box/INFE.php
+++ /dev/null
@@ -1,131 +0,0 @@
-Item Information Entry Box contains the entry information.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-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 gzip, compress and
- * deflate. An empty string indicates no content encoding.
- *
- * @return string
- */
- public function getContentEncoding() { return $this->_contentEncoding; }
-}
diff --git a/src/ISO14496/Box/IPMC.php b/src/ISO14496/Box/IPMC.php
deleted file mode 100644
index 1d86051..0000000
--- a/src/ISO14496/Box/IPMC.php
+++ /dev/null
@@ -1,56 +0,0 @@
-IPMP Control Box 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
- * @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
-{
-}
diff --git a/src/ISO14496/Box/IPRO.php b/src/ISO14496/Box/IPRO.php
deleted file mode 100644
index 658fd0c..0000000
--- a/src/ISO14496/Box/IPRO.php
+++ /dev/null
@@ -1,82 +0,0 @@
-Item Protection Box 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
- * @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)));
- }
-}
diff --git a/src/ISO14496/Box/MDAT.php b/src/ISO14496/Box/MDAT.php
deleted file mode 100644
index 84441c7..0000000
--- a/src/ISO14496/Box/MDAT.php
+++ /dev/null
@@ -1,66 +0,0 @@
-Media Data Box 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
- * @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);
- }
-}
diff --git a/src/ISO14496/Box/MDHD.php b/src/ISO14496/Box/MDHD.php
deleted file mode 100644
index e0211eb..0000000
--- a/src/ISO14496/Box/MDHD.php
+++ /dev/null
@@ -1,136 +0,0 @@
-Media Header Box 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
- * @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; }
-}
diff --git a/src/ISO14496/Box/MDIA.php b/src/ISO14496/Box/MDIA.php
deleted file mode 100644
index 70f399a..0000000
--- a/src/ISO14496/Box/MDIA.php
+++ /dev/null
@@ -1,71 +0,0 @@
-Media Box contains all the objects that declare information about
- * the media data within a track.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_MDIA extends ISO14496_Box
-{
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
- $this->setContainer(true);
-
- if ($reader === null)
- return;
-
- $this->constructBoxes();
- }
-}
diff --git a/src/ISO14496/Box/MEHD.php b/src/ISO14496/Box/MEHD.php
deleted file mode 100644
index 8d25d95..0000000
--- a/src/ISO14496/Box/MEHD.php
+++ /dev/null
@@ -1,84 +0,0 @@
-Movie Extends Header Box 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
- * @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; }
-}
diff --git a/src/ISO14496/Box/META.php b/src/ISO14496/Box/META.php
deleted file mode 100644
index 0e7e532..0000000
--- a/src/ISO14496/Box/META.php
+++ /dev/null
@@ -1,90 +0,0 @@
-Meta Box contains descriptive or annotative metadata. The
- * meta box is required to contain a {@link ISO14496_Box_HDLR hdlr} box
- * indicating the structure or format of the meta 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/MFHD.php b/src/ISO14496/Box/MFHD.php
deleted file mode 100644
index eb64359..0000000
--- a/src/ISO14496/Box/MFHD.php
+++ /dev/null
@@ -1,80 +0,0 @@
-Movie Fragment Header Box 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
- * @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; }
-}
diff --git a/src/ISO14496/Box/MFRO.php b/src/ISO14496/Box/MFRO.php
deleted file mode 100644
index 08008e2..0000000
--- a/src/ISO14496/Box/MFRO.php
+++ /dev/null
@@ -1,85 +0,0 @@
-Movie Fragment Random Access Offset Box 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
- * @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 mfra box.
- *
- * @return integer
- */
- public function getParentSize() { return $this->_parentSize; }
-}
diff --git a/src/ISO14496/Box/MINF.php b/src/ISO14496/Box/MINF.php
deleted file mode 100644
index cf5dd1b..0000000
--- a/src/ISO14496/Box/MINF.php
+++ /dev/null
@@ -1,71 +0,0 @@
-Media Information Box contains all the objects that declare
- * characteristic information of the media in the track.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_MINF extends ISO14496_Box
-{
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
- $this->setContainer(true);
-
- if ($reader === null)
- return;
-
- $this->constructBoxes();
- }
-}
diff --git a/src/ISO14496/Box/MOOF.php b/src/ISO14496/Box/MOOF.php
deleted file mode 100644
index 55e3c1c..0000000
--- a/src/ISO14496/Box/MOOF.php
+++ /dev/null
@@ -1,81 +0,0 @@
-Movie Fragment Box 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/MOOV.php b/src/ISO14496/Box/MOOV.php
deleted file mode 100644
index 208f200..0000000
--- a/src/ISO14496/Box/MOOV.php
+++ /dev/null
@@ -1,72 +0,0 @@
-Movie Box
- * 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/MVEX.php b/src/ISO14496/Box/MVEX.php
deleted file mode 100644
index f4d4a4a..0000000
--- a/src/ISO14496/Box/MVEX.php
+++ /dev/null
@@ -1,74 +0,0 @@
-Movie Extends Box 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/MVHD.php b/src/ISO14496/Box/MVHD.php
deleted file mode 100644
index dac4288..0000000
--- a/src/ISO14496/Box/MVHD.php
+++ /dev/null
@@ -1,166 +0,0 @@
-Movie Header Box 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
- * @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; }
-}
diff --git a/src/ISO14496/Box/NMHD.php b/src/ISO14496/Box/NMHD.php
deleted file mode 100644
index 96ecf5b..0000000
--- a/src/ISO14496/Box/NMHD.php
+++ /dev/null
@@ -1,55 +0,0 @@
-Null Media Header Box,
- * as defined here.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_NMHD extends ISO14496_Box_Full
-{
-}
diff --git a/src/ISO14496/Box/PADB.php b/src/ISO14496/Box/PADB.php
deleted file mode 100644
index e1425ec..0000000
--- a/src/ISO14496/Box/PADB.php
+++ /dev/null
@@ -1,57 +0,0 @@
-Padding Bits BoxIn 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
- * @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
-{
-}
diff --git a/src/ISO14496/Box/PDIN.php b/src/ISO14496/Box/PDIN.php
deleted file mode 100644
index 5bb3a40..0000000
--- a/src/ISO14496/Box/PDIN.php
+++ /dev/null
@@ -1,97 +0,0 @@
-Progressive Download Information Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/PITM.php b/src/ISO14496/Box/PITM.php
deleted file mode 100644
index 465f48d..0000000
--- a/src/ISO14496/Box/PITM.php
+++ /dev/null
@@ -1,85 +0,0 @@
-Primary Item Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/SBGP.php b/src/ISO14496/Box/SBGP.php
deleted file mode 100644
index 299cccd..0000000
--- a/src/ISO14496/Box/SBGP.php
+++ /dev/null
@@ -1,132 +0,0 @@
-Sample To Group Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/SCHI.php b/src/ISO14496/Box/SCHI.php
deleted file mode 100644
index 2e7c43e..0000000
--- a/src/ISO14496/Box/SCHI.php
+++ /dev/null
@@ -1,74 +0,0 @@
-Scheme Information Box 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/SCHM.php b/src/ISO14496/Box/SCHM.php
deleted file mode 100644
index 148448b..0000000
--- a/src/ISO14496/Box/SCHM.php
+++ /dev/null
@@ -1,103 +0,0 @@
-Scheme Type Box identifies the protection scheme.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_SCHM extends ISO14496_Box_Full
-{
- /** @var string */
- private $_schemeType;
-
- /** @var integer */
- private $_schemeVersion;
-
- /** @var string */
- private $_schemeUri;
-
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_schemeType = $this->_reader->read(4);
- $this->_schemeVersion = $this->_reader->readUInt32BE();
- if ($this->hasFlag(1))
- $this->_schemeUri = preg_split
- ("/\\x00/", $this->_reader->read
- ($this->getOffset() + $this->getSize() - $this->_reader->getOffset()));
- }
-
- /**
- * Returns the code defining the protection scheme.
- *
- * @return string
- */
- public function getSchemeType() { return $this->_schemeType; }
-
- /**
- * Returns the version of the scheme used to create the content.
- *
- * @return integer
- */
- public function getSchemeVersion() { return $this->_schemeVersion; }
-
- /**
- * Returns the optional scheme address to allow for the option of directing
- * the user to a web-page if they do not have the scheme installed on their
- * system. It is an absolute URI.
- *
- * @return string
- */
- public function getSchemeUri() { return $this->_schemeUri; }
-}
diff --git a/src/ISO14496/Box/SDTP.php b/src/ISO14496/Box/SDTP.php
deleted file mode 100644
index b5b6818..0000000
--- a/src/ISO14496/Box/SDTP.php
+++ /dev/null
@@ -1,130 +0,0 @@
-Independent and Disposable Samples Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/SGPD.php b/src/ISO14496/Box/SGPD.php
deleted file mode 100644
index cf60fc4..0000000
--- a/src/ISO14496/Box/SGPD.php
+++ /dev/null
@@ -1,64 +0,0 @@
-Sample Group Description Box 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
- * @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
-{
-}
diff --git a/src/ISO14496/Box/SINF.php b/src/ISO14496/Box/SINF.php
deleted file mode 100644
index 5651b75..0000000
--- a/src/ISO14496/Box/SINF.php
+++ /dev/null
@@ -1,87 +0,0 @@
-Protection Scheme Information Box 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/SKIP.php b/src/ISO14496/Box/SKIP.php
deleted file mode 100644
index fa8ab98..0000000
--- a/src/ISO14496/Box/SKIP.php
+++ /dev/null
@@ -1,73 +0,0 @@
-Free Space Box are irrelevant and may be ignored, or
- * the object deleted, without affecting the presentation. (Care should be
- * exercised when deleting the object, as this may invalidate the offsets used
- * in the sample table, unless this object is after all the media data).
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_SKIP extends ISO14496_Box
-{
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader = null, &$options = array())
- {
- parent::__construct($reader, $options);
- $this->setContainer(true);
-
- if ($reader === null)
- return;
-
- $this->constructBoxes();
- }
-}
diff --git a/src/ISO14496/Box/SMHD.php b/src/ISO14496/Box/SMHD.php
deleted file mode 100644
index 9881452..0000000
--- a/src/ISO14496/Box/SMHD.php
+++ /dev/null
@@ -1,66 +0,0 @@
-Sound Media Header Box 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
- * @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);
- }
-}
diff --git a/src/ISO14496/Box/STBL.php b/src/ISO14496/Box/STBL.php
deleted file mode 100644
index 8793f77..0000000
--- a/src/ISO14496/Box/STBL.php
+++ /dev/null
@@ -1,90 +0,0 @@
-Sample Table Box 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/STCO.php b/src/ISO14496/Box/STCO.php
deleted file mode 100644
index de83e94..0000000
--- a/src/ISO14496/Box/STCO.php
+++ /dev/null
@@ -1,122 +0,0 @@
-Chunk Offset Box table gives the index of each chunk into the
- * containing file. There are two variants, permitting the use of 32-bit or
- * 64-bit offsets. The latter is useful when managing very large presentations.
- * At most one of these variants will occur in any single instance of a sample
- * table.
- *
- * Offsets are file offsets, not the offset into any box within the file (e.g.
- * {@link 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
- * @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);
- }
-}
diff --git a/src/ISO14496/Box/STDP.php b/src/ISO14496/Box/STDP.php
deleted file mode 100644
index 5eb371c..0000000
--- a/src/ISO14496/Box/STDP.php
+++ /dev/null
@@ -1,84 +0,0 @@
-Degradation Priority Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/STSC.php b/src/ISO14496/Box/STSC.php
deleted file mode 100644
index b0fc13e..0000000
--- a/src/ISO14496/Box/STSC.php
+++ /dev/null
@@ -1,110 +0,0 @@
-Sample To Chunk Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/STSD.php b/src/ISO14496/Box/STSD.php
deleted file mode 100644
index aa90e67..0000000
--- a/src/ISO14496/Box/STSD.php
+++ /dev/null
@@ -1,56 +0,0 @@
-Sample Description Box 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
- * @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
-{
-}
diff --git a/src/ISO14496/Box/STSH.php b/src/ISO14496/Box/STSH.php
deleted file mode 100644
index 3990a0e..0000000
--- a/src/ISO14496/Box/STSH.php
+++ /dev/null
@@ -1,117 +0,0 @@
-Shadow Sync Sample Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/STSS.php b/src/ISO14496/Box/STSS.php
deleted file mode 100644
index c5c3285..0000000
--- a/src/ISO14496/Box/STSS.php
+++ /dev/null
@@ -1,89 +0,0 @@
-Sync Sample Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/STSZ.php b/src/ISO14496/Box/STSZ.php
deleted file mode 100644
index 264900e..0000000
--- a/src/ISO14496/Box/STSZ.php
+++ /dev/null
@@ -1,110 +0,0 @@
-Sample Size Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/STTS.php b/src/ISO14496/Box/STTS.php
deleted file mode 100644
index 446abd4..0000000
--- a/src/ISO14496/Box/STTS.php
+++ /dev/null
@@ -1,110 +0,0 @@
-Decoding Time to Sample Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/STZ2.php b/src/ISO14496/Box/STZ2.php
deleted file mode 100644
index fdcdc1b..0000000
--- a/src/ISO14496/Box/STZ2.php
+++ /dev/null
@@ -1,109 +0,0 @@
-Sample Size Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/SUBS.php b/src/ISO14496/Box/SUBS.php
deleted file mode 100644
index eeda868..0000000
--- a/src/ISO14496/Box/SUBS.php
+++ /dev/null
@@ -1,138 +0,0 @@
-Sub-Sample Information Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/TFHD.php b/src/ISO14496/Box/TFHD.php
deleted file mode 100644
index 3126308..0000000
--- a/src/ISO14496/Box/TFHD.php
+++ /dev/null
@@ -1,194 +0,0 @@
-Track Fragment Header Box 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
- * @author Anders Ă–dlund
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/TFRA.php b/src/ISO14496/Box/TFRA.php
deleted file mode 100644
index 177f6df..0000000
--- a/src/ISO14496/Box/TFRA.php
+++ /dev/null
@@ -1,142 +0,0 @@
-Track Fragment Random Access Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/TKHD.php b/src/ISO14496/Box/TKHD.php
deleted file mode 100644
index f27e39d..0000000
--- a/src/ISO14496/Box/TKHD.php
+++ /dev/null
@@ -1,177 +0,0 @@
-Track Header Box 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
- * @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; }
-}
diff --git a/src/ISO14496/Box/TRAF.php b/src/ISO14496/Box/TRAF.php
deleted file mode 100644
index 69a7bb7..0000000
--- a/src/ISO14496/Box/TRAF.php
+++ /dev/null
@@ -1,77 +0,0 @@
-Track Fragment Box 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/TRAK.php b/src/ISO14496/Box/TRAK.php
deleted file mode 100644
index 8d6110f..0000000
--- a/src/ISO14496/Box/TRAK.php
+++ /dev/null
@@ -1,83 +0,0 @@
-Track Box 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/TREF.php b/src/ISO14496/Box/TREF.php
deleted file mode 100644
index 33e7f27..0000000
--- a/src/ISO14496/Box/TREF.php
+++ /dev/null
@@ -1,81 +0,0 @@
-Track Reference Box 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/TREX.php b/src/ISO14496/Box/TREX.php
deleted file mode 100644
index b0e4361..0000000
--- a/src/ISO14496/Box/TREX.php
+++ /dev/null
@@ -1,138 +0,0 @@
-Track Extends Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/TRUN.php b/src/ISO14496/Box/TRUN.php
deleted file mode 100644
index ced6c9c..0000000
--- a/src/ISO14496/Box/TRUN.php
+++ /dev/null
@@ -1,150 +0,0 @@
-Track Fragment Run Boxes. If the durationIsEmpty flag is set,
- * there are no track runs.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @author Anders Ă–dlund
- * @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;
- }
-}
diff --git a/src/ISO14496/Box/UDTA.php b/src/ISO14496/Box/UDTA.php
deleted file mode 100644
index e38b18d..0000000
--- a/src/ISO14496/Box/UDTA.php
+++ /dev/null
@@ -1,75 +0,0 @@
-User Data Box 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
- * @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();
- }
-}
diff --git a/src/ISO14496/Box/URL.php b/src/ISO14496/Box/URL.php
deleted file mode 100644
index 2c210d8..0000000
--- a/src/ISO14496/Box/URL.php
+++ /dev/null
@@ -1,83 +0,0 @@
-
- * @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; }
-}
diff --git a/src/ISO14496/Box/URN.php b/src/ISO14496/Box/URN.php
deleted file mode 100644
index 6d5ce99..0000000
--- a/src/ISO14496/Box/URN.php
+++ /dev/null
@@ -1,94 +0,0 @@
-
- * @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; }
-}
diff --git a/src/ISO14496/Box/VMHD.php b/src/ISO14496/Box/VMHD.php
deleted file mode 100644
index a460161..0000000
--- a/src/ISO14496/Box/VMHD.php
+++ /dev/null
@@ -1,65 +0,0 @@
-Video Media Header Box contains general presentation information,
- * independent of the coding, for video media.
- *
- * @package php-reader
- * @subpackage ISO 14496
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class ISO14496_Box_VMHD extends ISO14496_Box_Full
-{
- /**
- * Constructs the class with given parameters and reads box related data from
- * the ISO Base Media file.
- *
- * @param Reader $reader The reader object.
- */
- public function __construct($reader, &$options = array())
- {
- parent::__construct($reader, $options);
- }
-}
diff --git a/src/ISO14496/Box/XML.php b/src/ISO14496/Box/XML.php
deleted file mode 100644
index 5d5aa4f..0000000
--- a/src/ISO14496/Box/XML.php
+++ /dev/null
@@ -1,87 +0,0 @@
-XML Box 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
- * @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;
- }
-}
diff --git a/src/ISO14496/Exception.php b/src/ISO14496/Exception.php
deleted file mode 100644
index 7e6970d..0000000
--- a/src/ISO14496/Exception.php
+++ /dev/null
@@ -1,51 +0,0 @@
-
- * @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
-{
-}
diff --git a/src/MPEG/ABS.php b/src/MPEG/ABS.php
deleted file mode 100644
index 6061a18..0000000
--- a/src/MPEG/ABS.php
+++ /dev/null
@@ -1,395 +0,0 @@
-
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @todo Implement validation routines
- */
-final class MPEG_ABS extends MPEG_ABS_Object
-{
- /** @var integer */
- private $_bytes;
-
- /** @var Array */
- private $_frames = array();
-
- /** @var MPEG_ABS_XINGHeader */
- private $_xingHeader = null;
-
- /** @var MPEG_ABS_LAMEHeader */
- private $_lameHeader = null;
-
- /** @var MPEG_ABS_VBRIHeader */
- private $_vbriHeader = null;
-
- /** @var integer */
- private $_cumulativeBitrate = 0;
-
- /** @var integer */
- private $_cumulativePlayDuration = 0;
-
- /** @var integer */
- private $_estimatedBitrate = 0;
-
- /** @var integer */
- private $_estimatedPlayDuration = 0;
-
- /** @var integer */
- private $_lastFrameOffset = false;
-
-
- /**
- * Constructs the MPEG_ABS class with given file and options.
- *
- * The following options are currently recognized:
- * o readmode -- Can be one of full or lazy and determines when the read of
- * frames and their data happens. When in full mode the data is read
- * automatically during the instantiation of the frame and all the frames
- * are read during the instantiation of this class. While this allows
- * faster validation and data fetching, it is unnecessary in terms of
- * determining just the play duration of the file. Defaults to lazy.
- *
- * o estimatePrecision -- Only applicaple with lazy read mode to determine
- * the precision of play duration estimate. This precision is equal to how
- * many frames are read before fixing the average bitrate that is used to
- * calculate the play duration estimate of the whole file. Each frame adds
- * about 0.1-0.2ms to the processing of the file. Defaults to 1000.
- *
- * When in lazy data reading mode it is first checked whether a VBR header is
- * found in a file. If so, the play duration is calculated based no its data
- * and no further frames are read from the file. If no VBR header is found,
- * frames up to estimatePrecision are read to calculate an average bitrate.
- *
- * Hence, only zero or estimatePrecision number of frames are read
- * in lazy data reading mode. The rest of the frames are read automatically
- * when directly referenced, ie the data is read when it is needed.
- *
- * @param string|Reader $filename The path to the file, file descriptor of an
- * opened file, or {@link Reader} instance.
- * @param Array $options The options array.
- */
- public function __construct($filename, $options = array())
- {
- if ($filename instanceof Reader)
- $reader = &$filename;
- else
- $reader = new Reader($filename);
-
- parent::__construct($reader, $options);
-
- $offset = $this->_reader->getOffset();
- $this->_bytes = $this->_reader->getSize();
-
- /* Skip ID3v1 tag */
- $this->_reader->setOffset(-128);
- if ($this->_reader->read(3) == "TAG")
- $this->_bytes -= 128;
- $this->_reader->setOffset($offset);
-
- /* Skip ID3v2 tag */
- if ($this->_reader->readString8(3) == "ID3") {
- require_once("ID3/Header.php");
- $header = new ID3_Header($this->_reader);
- $this->_reader->skip
- ($header->getSize() + ($header->hasFlag(ID3_Header::FOOTER) ? 10 : 0));
- }
- else
- $this->_reader->setOffset($offset);
-
- /* Check for VBR headers */
- $offset = $this->_reader->getOffset();
-
- $this->_frames[] =
- $firstFrame = new MPEG_ABS_Frame($this->_reader, $options);
-
- $postoffset = $this->_reader->getOffset();
-
- $this->_reader->setOffset
- ($offset + 4 + self::$sidesizes
- [$firstFrame->getFrequencyType()][$firstFrame->getMode()]);
- if (($xing = $this->_reader->readString8(4)) == "Xing" || $xing == "Info") {
- require_once("MPEG/ABS/XINGHeader.php");
- $this->_xingHeader = new MPEG_ABS_XINGHeader($this->_reader, $options);
- if ($this->_reader->readString8(4) == "LAME") {
- require_once("MPEG/ABS/LAMEHeader.php");
- $this->_lameHeader =
- new MPEG_ABS_LAMEHeader($this->_reader, $options);
- }
-
- // A header frame is not counted as an audio frame
- array_pop($this->_frames);
- }
-
- $this->_reader->setOffset($offset + 4 + 32);
- if ($this->_reader->readString8(4) == "VBRI") {
- require_once("MPEG/ABS/VBRIHeader.php");
- $this->_vbriHeader = new MPEG_ABS_VBRIHeader($this->_reader, $options);
-
- // A header frame is not counted as an audio frame
- array_pop($this->_frames);
- }
-
- $this->_reader->setOffset($postoffset);
-
- // Ensure we always have read at least one frame
- if (empty($this->_frames))
- $this->_readFrames(1);
-
- /* Read necessary frames */
- if ($this->getOption("readmode", "lazy") == "lazy") {
- if (($header = $this->_xingHeader) !== null ||
- ($header = $this->_vbriHeader) !== null) {
- $this->_estimatedPlayDuration = $header->getFrames() *
- $firstFrame->getSamples() / $firstFrame->getSamplingFrequency();
- if ($this->_lameHeader !== null) {
- $this->_estimatedBitrate = $this->_lameHeader->getBitrate();
- if ($this->_estimatedBitrate == 255)
- $this->_estimatedBitrate = round
- (($this->_lameHeader->getMusicLength()) /
- (($header->getFrames() * $firstFrame->getSamples()) /
- $firstFrame->getSamplingFrequency()) / 1000 * 8);
- }
- else
- $this->_estimatedBitrate = ($this->_bytes - $offset) /
- $this->_estimatedPlayDuration / 1000 * 8;
- }
- else {
- $this->_readFrames($this->getOption("estimatePrecision", 1000));
-
- $this->_estimatedBitrate =
- $this->_cumulativeBitrate / count($this->_frames);
- $this->_estimatedPlayDuration =
- ($this->_bytes - $offset) / ($this->_estimatedBitrate * 1000 / 8);
- }
- }
- else {
- $this->_readFrames();
-
- $this->_estimatedBitrate =
- $this->_cumulativeBitrate / count($this->_frames);
- $this->_estimatedPlayDuration = $this->_cumulativePlayDuration;
- }
- }
-
- /**
- * Returns true if the audio bitstream contains the Xing VBR
- * header, or false otherwise.
- *
- * @return boolean
- */
- public function hasXingHeader() { return $this->_xingHeader === null; }
-
- /**
- * Returns the Xing VBR header, or null if not found in the audio
- * bitstream.
- *
- * @return MPEG_ABS_XINGHeader
- */
- public function getXingHeader() { return $this->_xingHeader; }
-
- /**
- * Returns true if the audio bitstream contains the LAME VBR
- * header, or false otherwise.
- *
- * @return boolean
- */
- public function hasLameHeader() { return $this->_lameHeader === null; }
-
- /**
- * Returns the LAME VBR header, or null if not found in the audio
- * bitstream.
- *
- * @return MPEG_ABS_LAMEHeader
- */
- public function getLameHeader() { return $this->_lameHeader; }
-
- /**
- * Returns true if the audio bitstream contains the Fraunhofer IIS
- * VBR header, or false otherwise.
- *
- * @return boolean
- */
- public function hasVbriHeader() { return $this->_vbriHeader === null; }
-
- /**
- * Returns the Fraunhofer IIS VBR header, or null if not found in
- * the audio bitstream.
- *
- * @return MPEG_ABS_VBRIHeader
- */
- public function getVbriHeader() { return $this->_vbriHeader; }
-
- /**
- * Returns the bitrate estimate. This value is either fetched from one of the
- * headers or calculated based on the read frames.
- *
- * @return integer
- */
- public function getBitrateEstimate()
- {
- return $this->_estimatedBitrate;
- }
-
- /**
- * For variable bitrate files this method returns the exact average bitrate of
- * the whole file.
- *
- * @return integer
- */
- public function getBitrate()
- {
- if ($this->getOption("readmode", "lazy") == "lazy")
- $this->_readFrames();
- return $this->_cumulativeBitrate / count($this->_frames);
- }
-
- /**
- * Returns the playtime estimate, in seconds.
- *
- * @return integer
- */
- public function getLengthEstimate()
- {
- return $this->_estimatedPlayDuration;
- }
-
- /**
- * Returns the exact playtime in seconds. In lazy reading mode the frames are
- * read from the file the first time you call this method to get the exact
- * playtime of the file.
- *
- * @return integer
- */
- public function getLength()
- {
- if ($this->getOption("readmode", "lazy") == "lazy")
- $this->_readFrames();
- return $this->_cumulativePlayDuration;
- }
-
- /**
- * Returns the playtime estimate as a string in the form of
- * [hours:]minutes:seconds.milliseconds.
- *
- * @param integer $seconds The playtime in seconds.
- * @return string
- */
- public function getFormattedLengthEstimate()
- {
- return $this->formatTime($this->getLengthEstimate());
- }
-
- /**
- * Returns the exact playtime given in seconds as a string in the form of
- * [hours:]minutes:seconds.milliseconds. In lazy reading mode the frames are
- * read from the file the first time you call this method to get the exact
- * playtime of the file.
- *
- * @param integer $seconds The playtime in seconds.
- * @return string
- */
- public function getFormattedLength()
- {
- return $this->formatTime($this->getLength());
- }
-
- /**
- * Returns all the frames of the audio bitstream as an array. In lazy reading
- * mode the frames are read from the file the first time you call this method.
- *
- * @return Array
- */
- public function getFrames()
- {
- if ($this->getOption("readmode", "lazy") == "lazy") {
- $this->_readFrames();
- }
- return $this->_frames;
- }
-
- /**
- * Reads frames up to given limit. If called subsequently the method continues
- * after the last frame read in the last call, again to read up to the limit
- * or just the rest of the frames.
- *
- * @param integer $limit The maximum number of frames read from the bitstream
- */
- private function _readFrames($limit = false)
- {
- if ($this->_lastFrameOffset !== false)
- $this->_reader->setOffset($this->_lastFrameOffset);
-
- for ($i = 0; $this->_reader->getOffset() < $this->_bytes; $i++) {
- $options = $this->getOptions();
- $frame = new MPEG_ABS_Frame($this->_reader, $options);
-
- $this->_cumulativePlayDuration +=
- (double)($frame->getLength() / ($frame->getBitrate() * 1000 / 8));
- $this->_cumulativeBitrate += $frame->getBitrate();
- $this->_frames[] = $frame;
-
- if ($limit === false)
- $this->_lastFrameOffset = $this->_reader->getOffset();
- if ($limit !== false && ($i + 1) == $limit) {
- $this->_lastFrameOffset = $this->_reader->getOffset();
- break;
- }
- }
- }
-}
diff --git a/src/MPEG/ABS/Frame.php b/src/MPEG/ABS/Frame.php
deleted file mode 100644
index 55ce81e..0000000
--- a/src/MPEG/ABS/Frame.php
+++ /dev/null
@@ -1,507 +0,0 @@
-
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class MPEG_ABS_Frame extends MPEG_ABS_Object
-{
- /**
- * The bitrate lookup table. The table has the following format.
- *
- *
- * array (
- * SAMPLING_FREQUENCY_HIGH | SAMPLING_FREQUENCY_LOW => array (
- * LAYER_ONE | LAYER_TWO | LAYER_TREE => array ( )
- * )
- * )
- *
- *
- * @var Array
- */
- private static $bitrates = array (
- self::SAMPLING_FREQUENCY_HIGH => array (
- self::LAYER_ONE => array (
- 1 => 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448
- ),
- self::LAYER_TWO => array (
- 1 => 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384
- ),
- self::LAYER_THREE => array (
- 1 => 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320
- )
- ),
- self::SAMPLING_FREQUENCY_LOW => array (
- self::LAYER_ONE => array (
- 1 => 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256
- ),
- self::LAYER_TWO => array (
- 1 => 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160
- ),
- self::LAYER_THREE => array (
- 1 => 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160
- )
- )
- );
-
- /**
- * Sample rate lookup table. The table has the following format.
- *
- *
- * array (
- * LAYER_ONE | LAYER_TWO | LAYER_TREE => array ( )
- * )
- *
- *
- * @var Array
- */
- private static $samplingFrequencies = array (
- self::VERSION_ONE => array (44100, 48000, 32000),
- self::VERSION_TWO => array (22050, 24000, 16000),
- self::VERSION_TWO_FIVE => array (11025, 12000, 8000)
- );
-
- /**
- * Samples per frame lookup table. The table has the following format.
- *
- *
- * array (
- * SAMPLING_FREQUENCY_HIGH | SAMPLING_FREQUENCY_LOW => array (
- * LAYER_ONE | LAYER_TWO | LAYER_TREE =>
- * )
- * )
- *
- *
- * @var Array
- */
- private static $samples = array (
- self::SAMPLING_FREQUENCY_HIGH => array (
- self::LAYER_ONE => 384,
- self::LAYER_TWO => 1152,
- self::LAYER_THREE => 1152),
- self::SAMPLING_FREQUENCY_LOW => array (
- self::LAYER_ONE => 384,
- self::LAYER_TWO => 1152,
- self::LAYER_THREE => 576));
-
- /**
- * Coefficient lookup table. The table has the following format.
- *
- *
- * array (
- * SAMPLING_FREQUENCY_HIGH | SAMPLING_FREQUENCY_LOW => array (
- * LAYER_ONE | LAYER_TWO | LAYER_TREE => array ( )
- * )
- * )
- *
- *
- * @var Array
- */
- private static $coefficients = array (
- self::SAMPLING_FREQUENCY_HIGH => array (
- self::LAYER_ONE => 12, self::LAYER_TWO => 144, self::LAYER_THREE => 144
- ),
- self::SAMPLING_FREQUENCY_LOW => array (
- self::LAYER_ONE => 12, self::LAYER_TWO => 144, self::LAYER_THREE => 72
- )
- );
-
- /**
- * Slot size per layer lookup table. The table has the following format.
- *
- *
- * array (
- * LAYER_ONE | LAYER_TWO | LAYER_TREE =>
- * )
- *
- *
- *
- * @var Array
- */
- private static $slotsizes = array (
- self::LAYER_ONE => 4, self::LAYER_TWO => 1, self::LAYER_THREE => 1
- );
-
-
- /** @var integer */
- private $_offset;
-
- /** @var integer */
- private $_version;
-
- /** @var integer */
- private $_frequencyType;
-
- /** @var integer */
- private $_layer;
-
- /** @var integer */
- private $_redundancy;
-
- /** @var integer */
- private $_bitrate;
-
- /** @var integer */
- private $_samplingFrequency;
-
- /** @var integer */
- private $_padding;
-
- /** @var integer */
- private $_mode;
-
- /** @var integer */
- private $_modeExtension;
-
- /** @var integer */
- private $_copyright;
-
- /** @var integer */
- private $_original;
-
- /** @var integer */
- private $_emphasis;
-
- /** @var integer */
- private $_length;
-
- /** @var integer */
- private $_samples;
-
- /** @var integer */
- private $_crc = false;
-
- /** @var string */
- private $_data = false;
-
- /**
- * Constructs the class with given parameters and reads object related data
- * from the frame.
- *
- * @param Reader $reader The reader object.
- * @param Array $options Array of options.
- */
- public function __construct($reader, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_offset = $this->_reader->getOffset();
-
- $header = Transform::fromUInt32BE($this->_reader->read(4));
- $this->_version = Twiddling::getValue($header, 19, 20);
- $this->_frequencyType = Twiddling::testBit($header, 19);
- $this->_layer = Twiddling::getValue($header, 17, 18);
- $this->_redundancy = !Twiddling::testBit($header, 16);
- $this->_bitrate = isset
- (self::$bitrates[$this->_frequencyType][$this->_layer]
- [$index = Twiddling::getValue($header, 12, 15)]) ?
- self::$bitrates[$this->_frequencyType][$this->_layer][$index] : false;
- $this->_samplingFrequency = isset
- (self::$samplingFrequencies[$this->_version]
- [$index = Twiddling::getValue($header, 10, 11)]) ?
- self::$samplingFrequencies[$this->_version][$index] : false;
- $this->_padding = Twiddling::testBit($header, 9);
- $this->_mode = Twiddling::getValue($header, 6, 7);
- $this->_modeExtension = Twiddling::getValue($header, 4, 5);
- $this->_copyright = Twiddling::testBit($header, 3);
- $this->_original = Twiddling::testBit($header, 2);
- $this->_emphasis = Twiddling::getValue($header, 0, 1);
-
- $this->_length = (int)
- ((self::$coefficients[$this->_frequencyType][$this->_layer] *
- ($this->_bitrate * 1000) / $this->_samplingFrequency) +
- ($this->_padding ? 1 : 0)) * self::$slotsizes[$this->_layer];
- $this->_samples = self::$samples[$this->_frequencyType][$this->_layer];
-
- if ($this->getOption("readmode", "lazy") == "full") {
- $this->_readCrc();
- $this->_readData();
- }
- $this->_reader->skip($this->_length - 4);
- }
-
- /**
- * Returns the version identifier of the algorithm.
- *
- * @see VERSION_ONE, VERSION_TWO, VERSION_TWO_FIVE
- * @return integer
- */
- public function getVersion() { return $this->_version; }
-
- /**
- * Returns the sampling frequency type. This can be one of the following
- * values.
- *
- * o {@link SAMPLING_FREQUENCY_HIGH} -- Higher Sampling Frequency
- * (Version 1)
- * o {@link SAMPLING_FREQUENCY_LOW} -- Lower Sampling Frequency
- * (Version 2 and 2.5)
- *
- * @see SAMPLING_FREQUENCY_LOW, SAMPLING_FREQUENCY_HIGH
- * @return integer
- */
- public function getFrequencyType() { return $this->_frequencyType; }
-
- /**
- * Returns the type of layer used.
- *
- * @see LAYER_ONE, LAYER_TWO, LAYER_THREE
- * @return integer
- */
- public function getLayer() { return $this->_layer; }
-
- /**
- * An alias to getRedundancy().
- *
- * @see getRedundancy
- * @return boolean
- */
- public function hasRedundancy() { return $this->getRedundancy(); }
-
- /**
- * Returns boolean corresponding to whether redundancy has been added in the
- * audio bitstream to facilitate error detection and concealment. Equals
- * false if no redundancy has been added, true if
- * redundancy has been added.
- *
- * @return boolean
- */
- public function getRedundancy() { return $this->_redundancy; }
-
- /**
- * Returns the bitrate in kbps. The returned value indicates the total bitrate
- * irrespective of the mode (stereo, joint_stereo, dual_channel,
- * single_channel).
- *
- * @return integer
- */
- public function getBitrate() { return $this->_bitrate; }
-
- /**
- * Returns the sampling frequency in Hz.
- *
- * @return integer
- */
- public function getSamplingFrequency() { return $this->_samplingFrequency; }
-
- /**
- * An alias to getPadding().
- *
- * @see getPadding
- * @return boolean
- */
- public function hasPadding() { return $this->getPadding(); }
-
- /**
- * Returns boolean corresponding the frame contains an additional slot to
- * adjust the mean bitrate to the sampling frequency. Equals to
- * true if padding has been added, false otherwise.
- *
- * Padding is only necessary with a sampling frequency of 44.1kHz.
- *
- * @return boolean
- */
- public function getPadding() { return $this->_padding; }
-
- /**
- * Returns the mode. In Layer I and II the CHANNEL_JOINT_STEREO mode is
- * intensity_stereo, in Layer III it is intensity_stereo and/or ms_stereo.
- *
- * @see CHANNEL_STEREO, CHANNEL_JOINT_STEREO, CHANNEL_DUAL_CHANNEL,
- * CHANNEL_SINGLE_CHANNEL
- * @return integer
- */
- public function getMode() { return $this->_mode; }
-
- /**
- * Returns the mode extension used in CHANNEL_JOINT_STEREO mode.
- *
- * In Layer I and II the return type indicates which subbands are in
- * intensity_stereo. All other subbands are coded in stereo.
- *
- * o {@link MODE_SUBBAND_4_TO_31} -- subbands 4-31 in
- * intensity_stereo, bound==4
- * o {@link MODE_SUBBAND_8_TO_31} -- subbands 8-31 in
- * intensity_stereo, bound==8
- * o {@link MODE_SUBBAND_12_TO_31} -- subbands 12-31 in
- * intensity_stereo, bound==12
- * o {@link MODE_SUBBAND_16_TO_31} -- subbands 16-31 in
- * intensity_stereo, bound==16
- *
- * In Layer III they indicate which type of joint stereo coding method is
- * applied. The frequency ranges over which the intensity_stereo and ms_stereo
- * modes are applied are implicit in the algorithm. Please see
- * {@link MODE_ISOFF_MSSOFF}, {@link MODE_ISON_MSSOFF},
- * {@link MODE_ISOFF_MSSON}, and {@link MODE_ISON_MSSON}.
- *
- * @return integer
- */
- public function getModeExtension() { return $this->_modeExtension; }
-
- /**
- * An alias to getCopyright().
- *
- * @see getCopyright
- * @return boolean
- */
- public function hasCopyright() { return $this->getCopyright(); }
-
- /**
- * Returns true if the coded bitstream is copyright protected,
- * false otherwise.
- *
- * @return boolean
- */
- public function getCopyright() { return $this->_copyright; }
-
- /**
- * An alias to getOriginal().
- *
- * @see getOriginal
- * @return boolean
- */
- public function isOriginal() { return $this->getOriginal(); }
-
- /**
- * Returns whether the bitstream is original or home made.
- *
- * @return boolean
- */
- public function getOriginal() { return $this->_original; }
-
- /**
- * Returns the type of de-emphasis that shall be used. The value is one of the
- * following.
- *
- * o {@link EMPHASIS_NONE} -- No emphasis
- * o {@link EMPHASIS_50_15} -- 50/15 microsec. emphasis
- * o {@link EMPHASIS_CCIT_J17} -- CCITT J.17
- *
- * @see EMPHASIS_NONE, EMPHASIS_50_15, EMPHASIS_CCIT_J17
- * @return integer
- */
- public function getEmphasis() { return $this->_emphasis; }
-
- /**
- * Returns the length of the frame based on the current layer, bit rate,
- * sampling frequency and padding, in bytes.
- *
- * @return integer
- */
- public function getLength() { return $this->_length; }
-
- /**
- * Returns the number of samples contained in the frame.
- *
- * @return integer
- */
- public function getSamples() { return $this->_samples; }
-
- /**
- * Returns the 16-bit CRC of the frame or false if not present.
- *
- * @return integer
- */
- public function getCrc()
- {
- if ($this->getOption("readmode", "lazy") == "lazy" &&
- $this->hasRedundancy() && $this->_crc === false) {
- $this->_readCrc();
- }
- return $this->_crc;
- }
-
- /**
- * Reads the CRC data.
- */
- private function _readCrc()
- {
- if ($this->hasRedundancy()) {
- $offset = $this->_reader->getOffset();
- $this->_reader->setOffset($this->_offset + 4);
- $this->_crc = $this->_reader->readUInt16BE();
- $this->_reader->setOffset($offset);
- }
- }
-
- /**
- * Returns the audio data.
- *
- * @return string
- */
- public function getData()
- {
- if ($this->getOption("readmode", "lazy") == "lazy" &&
- $this->_data === false) {
- $this->_readData();
- }
- return $this->_data;
- }
-
- /**
- * Reads the frame data.
- */
- private function _readData()
- {
- $offset = $this->_reader->getOffset();
- $this->_reader->setOffset
- ($this->_offset + 4 + ($this->hasRedundancy() ? 2 : 0));
- $this->_data = $this->_reader->read
- ($this->getLength() - 4 - ($this->hasRedundancy() ? 2 : 0));
- $this->_reader->setOffset($offset);
- }
-}
diff --git a/src/MPEG/ABS/LAMEHeader.php b/src/MPEG/ABS/LAMEHeader.php
deleted file mode 100644
index 035d8fd..0000000
--- a/src/MPEG/ABS/LAMEHeader.php
+++ /dev/null
@@ -1,481 +0,0 @@
-
- * @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 MPEG_ABS_LAMEHeader extends MPEG_ABS_Object
-{
-
- /** @var integer */
- const VBR_METHOD_CONSTANT = 1;
-
- /** @var integer */
- const VBR_METHOD_ABR = 2;
-
- /** @var integer */
- const VBR_METHOD_RH = 3;
-
- /** @var integer */
- const VBR_METHOD_MTRH = 4;
-
- /** @var integer */
- const VBR_METHOD_MT = 5;
-
- /** @var integer */
- const ENCODING_FLAG_NSPSYTUNE = 1;
-
- /** @var integer */
- const ENCODING_FLAG_NSSAFEJOINT = 2;
-
- /** @var integer */
- const ENCODING_FLAG_NOGAP_CONTINUED = 4;
-
- /** @var integer */
- const ENCODING_FLAG_NOGAP_CONTINUATION = 8;
-
- /** @var integer */
- const MODE_MONO = 0;
-
- /** @var integer */
- const MODE_STEREO = 1;
-
- /** @var integer */
- const MODE_DUAL = 2;
-
- /** @var integer */
- const MODE_JOINT = 3;
-
- /** @var integer */
- const MODE_FORCE = 4;
-
- /** @var integer */
- const MODE_AUTO = 5;
-
- /** @var integer */
- const MODE_INTENSITY = 6;
-
- /** @var integer */
- const MODE_UNDEFINED = 7;
-
- /** @var integer */
- const SOURCE_FREQUENCY_32000_OR_LOWER = 0;
-
- /** @var integer */
- const SOURCE_FREQUENCY_44100 = 1;
-
- /** @var integer */
- const SOURCE_FREQUENCY_48000 = 2;
-
- /** @var integer */
- const SOURCE_FREQUENCY_HIGHER = 3;
-
- /** @var integer */
- const SURROUND_NONE = 0;
-
- /** @var integer */
- const SURROUND_DPL = 1;
-
- /** @var integer */
- const SURROUND_DPL2 = 2;
-
- /** @var integer */
- const SURROUND_AMBISONIC = 3;
-
- /** @var string */
- private $_version;
-
- /** @var integer */
- private $_revision;
-
- /** @var integer */
- private $_vbrMethod;
-
- /** @var integer */
- private $_lowpass;
-
- /** @var integer */
- private $_peakSignalAmplitude;
-
- /** @var integer */
- private $_radioReplayGain;
-
- /** @var integer */
- private $_audiophileReplayGain;
-
- /** @var integer */
- private $_encodingFlags;
-
- /** @var integer */
- private $_athType;
-
- /** @var integer */
- private $_bitrate;
-
- /** @var integer */
- private $_encoderDelaySamples;
-
- /** @var integer */
- private $_paddedSamples;
-
- /** @var integer */
- private $_sourceSampleFrequency;
-
- /** @var boolean */
- private $_unwiseSettingsUsed;
-
- /** @var integer */
- private $_mode;
-
- /** @var integer */
- private $_noiseShaping;
-
- /** @var integer */
- private $_mp3Gain;
-
- /** @var integer */
- private $_surroundInfo;
-
- /** @var integer */
- private $_presetUsed;
-
- /** @var integer */
- private $_musicLength;
-
- /** @var integer */
- private $_musicCrc;
-
- /** @var integer */
- private $_crc;
-
- /**
- * Constructs the class with given parameters and reads object related data
- * from the bitstream.
- *
- * @param Reader $reader The reader object.
- * @param Array $options Array of options.
- */
- public function __construct($reader, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $this->_version = $this->_reader->readString8(5);
-
- $tmp = $this->_reader->readUInt8();
- $this->_revision = Twiddling::getValue($tmp, 4, 8);
- $this->_vbrMethod = Twiddling::getValue($tmp, 0, 3);
-
- $this->_lowpass = $this->_reader->readUInt8() * 100;
-
- $this->_peakSignalAmplitude = $this->_reader->readUInt32BE();
-
- $tmp = $this->_reader->readUInt16BE();
- $this->_radioReplayGain = array(
- "name" => Twiddling::getValue($tmp, 0, 2),
- "originator" => Twiddling::getValue($tmp, 3, 5),
- "absoluteGainAdjustment" => Twiddling::getValue($tmp, 7, 15) / 10
- );
-
- $tmp = $this->_reader->readUInt16BE();
- $this->_audiophileReplayGain = array(
- "name" => Twiddling::getValue($tmp, 0, 2),
- "originator" => Twiddling::getValue($tmp, 3, 5),
- "absoluteGainAdjustment" => Twiddling::getValue($tmp, 7, 15) / 10
- );
-
- $tmp = $this->_reader->readUInt8();
- $this->_encodingFlags = Twiddling::getValue($tmp, 4, 8);
- $this->_athType = Twiddling::getValue($tmp, 0, 3);
-
- $this->_bitrate = $this->_reader->readUInt8();
-
- $tmp = $this->_reader->readUInt32BE();
- // Encoder delay fields
- $this->_encoderDelaySamples = Twiddling::getValue($tmp, 20, 31);
- $this->_paddedSamples = Twiddling::getValue($tmp, 8, 19);
- // Misc field
- $this->_sourceSampleFrequency = Twiddling::getValue($tmp, 6, 7);
- $this->_unwiseSettingsUsed = Twiddling::testBit($tmp, 5);
- $this->_mode = Twiddling::getValue($tmp, 2, 4);
- $this->_noiseShaping = Twiddling::getValue($tmp, 0, 1);
-
- $this->_mp3Gain = pow(2, $this->_reader->readInt8() / 4);
-
- $tmp = $this->_reader->readUInt16BE();
- $this->_surroundInfo = Twiddling::getValue($tmp, 11, 14);
- $this->_presetUsed = Twiddling::getValue($tmp, 0, 10);
-
- $this->_musicLength = $this->_reader->readUInt32BE();
-
- $this->_musicCrc = $this->_reader->readUInt16BE();
- $this->_crc = $this->_reader->readUInt16BE();
- }
-
- /**
- * Returns the version string of the header.
- *
- * @return string
- */
- public function getVersion() { return $this->_version; }
-
- /**
- * Returns the info tag revision.
- *
- * @return integer
- */
- public function getRevision() { return $this->_revision; }
-
- /**
- * Returns the VBR method used for encoding. See the corresponding constants
- * for possible return values.
- *
- * @return integer
- */
- public function getVbrMethod() { return $this->_vbrMethod; }
-
- /**
- * Returns the lowpass filter value.
- *
- * @return integer
- */
- public function getLowpass() { return $this->_lowpass; }
-
- /**
- * Returns the peak signal amplitude field of replay gain. The value of 1.0
- * (ie 100%) represents maximal signal amplitude storeable in decoding format.
- *
- * @return integer
- */
- public function getPeakSignalAmplitude()
- {
- return $this->_peakSignalAmplitude;
- }
-
- /**
- * Returns the radio replay gain field of replay gain, required to make all
- * tracks equal loudness, as an array that consists of the following keys.
- *
- * o name -- Specifies the name of the gain adjustment. Can be one of the
- * following values: 0 = not set, 1 = radio, or 2 = audiophile.
- *
- * o originator -- Specifies the originator of the gain adjustment. Can be
- * one of the following values: 0 = not set, 1 = set by artist, 2 = set
- * by user, 3 = set by my model, 4 = set by simple RMS average.
- *
- * o absoluteGainAdjustment -- Speficies the absolute gain adjustment.
- *
- * @return Array
- */
- public function getRadioReplayGain() { return $this->_radioReplayGain; }
-
- /**
- * Returns the audiophile replay gain field of replay gain, required to give
- * ideal listening loudness, as an array that consists of the following keys.
- *
- * o name -- Specifies the name of the gain adjustment. Can be one of the
- * following values: 0 = not set, 1 = radio, or 2 = audiophile.
- *
- * o originator -- Specifies the originator of the gain adjustment. Can be
- * one of the following values: 0 = not set, 1 = set by artist, 2 = set
- * by user, 3 = set by my model, 4 = set by simple RMS average.
- *
- * o absoluteGainAdjustment -- Speficies the absolute gain adjustment.
- *
- * @return Array
- */
- public function getAudiophileReplayGain()
- {
- return $this->_audiophileReplayGain;
- }
-
- /**
- * Returns the encoding flags. See the corresponding flag constants for
- * possible values.
- *
- * @return integer
- */
- public function getEncodingFlags() { return $this->_encodingFlags; }
-
- /**
- * Returns the ATH type.
- *
- * @return integer
- */
- public function getAthType() { return $this->_athType; }
-
- /**
- * Returns the bitrate for CBR encoded files and the minimal birate for
- * VBR encoded file. The maximum value of this field is 255 even with higher
- * actual bitrates.
- *
- * @return integer
- */
- public function getBitrate() { return $this->_bitrate; }
-
- /**
- * Returns the encoder delay or number of samples added at start.
- *
- * @return integer
- */
- public function getEncoderDelaySamples()
- {
- return $this->_encoderDelaySamples;
- }
-
- /**
- * Returns the number of padded samples to complete the last frame.
- *
- * @return integer
- */
- public function getPaddedSamples() { return $this->_paddedSamples; }
-
- /**
- * Returns the source sample frequency. See corresponding constants for
- * possible values.
- *
- * @return integer
- */
- public function getSourceSampleFrequency()
- {
- return $this->_sourceSampleFrequency;
- }
-
- /**
- * An alias to getUnwiseSettingsUsed().
- *
- * @see getUnwiseSettingsUsed
- * @return boolean
- */
- public function areUnwiseSettingsUsed()
- {
- return $this->getUnwiseSettingsUsed();
- }
-
- /**
- * Returns whether unwise settings were used to encode the file.
- *
- * @return boolean
- */
- public function getUnwiseSettingsUsed() { return $this->_unwiseSettingsUsed; }
-
- /**
- * Returns the stereo mode. See corresponding constants for possible values.
- *
- * @return integer
- */
- public function getMode() { return $this->_mode; }
-
- /**
- * Returns the noise shaping.
- *
- * @return integer
- */
- public function getNoiseShaping() { return $this->_noiseShaping; }
-
- /**
- * Returns the MP3 gain change. Any MP3 can be amplified in a lossless manner.
- * If done so, this field can be used to log such transformation happened so
- * that any given time it can be undone.
- *
- * @return integer
- */
- public function getMp3Gain() { return $this->_mp3Gain; }
-
- /**
- * Returns the surround info. See corresponding contants for possible values.
- *
- * @return integer
- */
- public function getSurroundInfo() { return $this->_surroundInfo; }
-
- /**
- * Returns the preset used in encoding.
- *
- * @return integer
- */
- public function getPresetUsed() { return $this->_presetUsed; }
-
- /**
- * Returns the exact length in bytes of the MP3 file originally made by LAME
- * excluded ID3 tag info at the end.
- *
- * The first byte it counts is the first byte of this LAME header and the last
- * byte it counts is the last byte of the last MP3 frame containing music.
- * The value should be equal to file length at the time of LAME encoding,
- * except when using ID3 tags.
- *
- * @return integer
- */
- public function getMusicLength() { return $this->_musicLength; }
-
- /**
- * Returns the CRC-16 of the complete MP3 music data as made originally by
- * LAME.
- *
- * @return integer
- */
- public function getMusicCrc() { return $this->_musicCrc; }
-
- /**
- * Returns the CRC-16 of the first 190 bytes of the header frame.
- *
- * @return integer
- */
- public function getCrc() { return $this->_crc; }
-}
diff --git a/src/MPEG/ABS/Object.php b/src/MPEG/ABS/Object.php
deleted file mode 100644
index b05588a..0000000
--- a/src/MPEG/ABS/Object.php
+++ /dev/null
@@ -1,167 +0,0 @@
-
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-abstract class MPEG_ABS_Object extends MPEG_Object
-{
- /** @var integer */
- const VERSION_ONE = 3;
-
- /** @var integer */
- const VERSION_TWO = 2;
-
- /** @var integer */
- const VERSION_TWO_FIVE = 0;
-
- /** @var integer */
- const SAMPLING_FREQUENCY_LOW = 0;
-
- /** @var integer */
- const SAMPLING_FREQUENCY_HIGH = 1;
-
- /** @var integer */
- const LAYER_ONE = 3;
-
- /** @var integer */
- const LAYER_TWO = 2;
-
- /** @var integer */
- const LAYER_THREE = 1;
-
- /** @var integer */
- const CHANNEL_STEREO = 0;
-
- /** @var integer */
- const CHANNEL_JOINT_STEREO = 1;
-
- /** @var integer */
- const CHANNEL_DUAL_CHANNEL = 2;
-
- /** @var integer */
- const CHANNEL_SINGLE_CHANNEL = 3;
-
- /** @var integer */
- const MODE_SUBBAND_4_TO_31 = 0;
-
- /** @var integer */
- const MODE_SUBBAND_8_TO_31 = 1;
-
- /** @var integer */
- const MODE_SUBBAND_12_TO_31 = 2;
-
- /** @var integer */
- const MODE_SUBBAND_16_TO_31 = 3;
-
- /** @var integer */
- const MODE_ISOFF_MSSOFF = 0;
-
- /** @var integer */
- const MODE_ISON_MSSOFF = 1;
-
- /** @var integer */
- const MODE_ISOFF_MSSON = 2;
-
- /** @var integer */
- const MODE_ISON_MSSON = 3;
-
- /** @var integer */
- const EMPHASIS_NONE = 0;
-
- /** @var integer */
- const EMPHASIS_50_15 = 1;
-
- /** @var integer */
- const EMPHASIS_CCIT_J17 = 3;
-
-
- /**
- * Layer III side information size lookup table. The table has the following
- * format.
- *
- *
- * array (
- * SAMPLING_FREQUENCY_HIGH | SAMPLING_FREQUENCY_LOW => array (
- * CHANNEL_STEREO | CHANNEL_JOINT_STEREO | CHANNEL_DUAL_CHANNEL |
- * CHANNEL_SINGLE_CHANNEL =>
- * )
- * )
- *
- *
- *
- * @var Array
- */
- protected static $sidesizes = array(
- self::SAMPLING_FREQUENCY_HIGH => array(
- self::CHANNEL_STEREO => 32,
- self::CHANNEL_JOINT_STEREO => 32,
- self::CHANNEL_DUAL_CHANNEL => 32,
- self::CHANNEL_SINGLE_CHANNEL => 17
- ),
- self::SAMPLING_FREQUENCY_LOW => array(
- self::CHANNEL_STEREO => 17,
- self::CHANNEL_JOINT_STEREO => 17,
- self::CHANNEL_DUAL_CHANNEL => 17,
- self::CHANNEL_SINGLE_CHANNEL => 9
- )
- );
-
-
- /**
- * Constructs the class with given parameters.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader, &$options = array())
- {
- parent::__construct($reader, $options);
- }
-}
diff --git a/src/MPEG/ABS/VBRIHeader.php b/src/MPEG/ABS/VBRIHeader.php
deleted file mode 100644
index f874e93..0000000
--- a/src/MPEG/ABS/VBRIHeader.php
+++ /dev/null
@@ -1,165 +0,0 @@
-
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-class MPEG_ABS_VBRIHeader extends MPEG_ABS_Object
-{
- /** @var integer */
- private $_version;
-
- /** @var integer */
- private $_delay;
-
- /** @var integer */
- private $_qualityIndicator;
-
- /** @var integer */
- private $_bytes;
-
- /** @var integer */
- private $_frames;
-
- /** @var Array */
- private $_toc = array();
-
- /** @var integer */
- private $_tocFramesPerEntry;
-
- /** @var integer */
- private $_length;
-
- /**
- * Constructs the class with given parameters and reads object related data
- * from the bitstream.
- *
- * @param Reader $reader The reader object.
- * @param Array $options Array of options.
- */
- public function __construct($reader, &$options = array())
- {
- $offset = $this->_reader->getOffset();
- $this->_version = $this->_reader->readUInt16BE();
- $this->_delay = $this->_reader->readUInt16BE();
- $this->_qualityIndicator = $this->_reader->readUInt16BE();
- $this->_bytes = $this->_reader->readUInt32BE();
- $this->_frames = $this->_reader->readUInt32BE();
- $tocEntries = $this->_reader->readUInt16BE();
- $tocEntryScale = $this->_reader->readUInt16BE();
- $tocEntrySize = $this->_reader->readUInt16BE();
- $this->_tocFramesPerEntry = $this->_reader->readUInt16BE();
- $this->_toc = array_merge(unpack(($tocEntrySize == 1) ? "C*" :
- ($tocEntrySize == 2) ? "n*" : "N*",
- $this->_reader->read($tocCount * $tocEntrySize)));
- foreach ($this->_toc as $key => $value)
- $this->_toc[$key] = $tocEntryScale * $value;
- $this->_length = $this->_reader->getOffset() - $offset;
- }
-
- /**
- * Returns the header version.
- *
- * @return integer
- */
- public function getVersion() { return $this->_version; }
-
- /**
- * Returns the delay.
- *
- * @return integer
- */
- public function getDelay() { return $this->_delay; }
-
- /**
- * Returns the quality indicator. Return value varies from 0 (best quality) to
- * 100 (worst quality).
- *
- * @return integer
- */
- public function getQualityIndicator() { return $this->_qualityIndicator; }
-
- /**
- * Returns the number of bytes in the file.
- *
- * @return integer
- */
- public function getBytes() { return $this->_bytes; }
-
- /**
- * Returns the number of frames in the file.
- *
- * @return integer
- */
- public function getFrames() { return $this->_frames; }
-
- /**
- * Returns the table of contents array.
- *
- * @return Array
- */
- public function getToc() { return $this->_toc; }
-
- /**
- * Returns the number of frames per TOC entry.
- *
- * @return integer
- */
- public function getTocFramesPerEntry() { return $this->_tocFramesPerEntry; }
-
- /**
- * Returns the length of the header in bytes.
- *
- * @return integer
- */
- public function getLength() { return $this->_length; }
-}
diff --git a/src/MPEG/ABS/XINGHeader.php b/src/MPEG/ABS/XINGHeader.php
deleted file mode 100644
index d7ce7a7..0000000
--- a/src/MPEG/ABS/XINGHeader.php
+++ /dev/null
@@ -1,136 +0,0 @@
-
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-class MPEG_ABS_XINGHeader extends MPEG_ABS_Object
-{
- /** @var integer */
- private $_frames = false;
-
- /** @var integer */
- private $_bytes = false;
-
- /** @var Array */
- private $_toc = array();
-
- /** @var integer */
- private $_qualityIndicator = false;
-
- /**
- * Constructs the class with given parameters and reads object related data
- * from the bitstream.
- *
- * @param Reader $reader The reader object.
- * @param Array $options Array of options.
- */
- public function __construct($reader, &$options = array())
- {
- parent::__construct($reader, $options);
-
- $flags = $reader->readUInt32BE();
-
- if (Twiddling::testAnyBits($flags, 0x1))
- $this->_frames = $this->_reader->readUInt32BE();
- if (Twiddling::testAnyBits($flags, 0x2))
- $this->_bytes = $this->_reader->readUInt32BE();
- if (Twiddling::testAnyBits($flags, 0x4))
- $this->_toc = array_merge(unpack("C*", $this->_reader->read(100)));
- if (Twiddling::testAnyBits($flags, 0x8))
- $this->_qualityIndicator = $this->_reader->readUInt32BE();
- }
-
- /**
- * Returns the number of frames in the file.
- *
- * @return integer
- */
- public function getFrames() { return $this->_frames; }
-
- /**
- * Returns the number of bytes in the file.
- *
- * @return integer
- */
- public function getBytes() { return $this->_bytes; }
-
- /**
- * Returns the table of contents array. The returned array has a fixed amount
- * of 100 seek points to the file.
- *
- * @return Array
- */
- public function getToc() { return $this->_toc; }
-
- /**
- * Returns the quality indicator. The indicator is from 0 (best quality) to
- * 100 (worst quality).
- *
- * @return integer
- */
- public function getQualityIndicator() { return $this->_qualityIndicator; }
-
- /**
- * Returns the length of the header in bytes.
- *
- * @return integer
- */
- public function getLength()
- {
- return 4 +
- ($this->_frames !== false ? 4 : 0) +
- ($this->_bytes !== false ? 4 : 0) +
- (empty($this->_toc) ? 0 : 100) +
- ($this->_qualityIndicator !== false ? 4 : 0);
- }
-}
diff --git a/src/MPEG/Exception.php b/src/MPEG/Exception.php
deleted file mode 100644
index 6f24368..0000000
--- a/src/MPEG/Exception.php
+++ /dev/null
@@ -1,51 +0,0 @@
-
- * @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 MPEG_Exception extends Exception
-{
-}
diff --git a/src/MPEG/Object.php b/src/MPEG/Object.php
deleted file mode 100644
index d772e4d..0000000
--- a/src/MPEG/Object.php
+++ /dev/null
@@ -1,258 +0,0 @@
-
- * @copyright Copyright (c) 2008-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-abstract class MPEG_Object
-{
- /**
- * The reader object.
- *
- * @var Reader
- */
- protected $_reader;
-
- /**
- * The options array.
- *
- * @var Array
- */
- private $_options;
-
- /**
- * Constructs the class with given parameters.
- *
- * @param Reader $reader The reader object.
- * @param Array $options The options array.
- */
- public function __construct($reader, &$options = array())
- {
- $this->_reader = $reader;
- $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 MPEG} 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;
- }
-
- /**
- * Finds and returns the next start code. Start codes are reserved bit
- * patterns in the video file that do not otherwise occur in the video stream.
- *
- * All start codes are byte aligned and start with the following byte
- * sequence: 0x00 0x00 0x01.
- *
- * @return integer
- */
- protected final function nextStartCode()
- {
- $buffer = " ";
- for ($i = 0; $i < 4; $i++) {
- $start = $this->_reader->getOffset();
- if (($buffer = substr($buffer, -4) .
- $this->_reader->read(512)) === false) {
- require_once("MPEG/Exception.php");
- throw new MPEG_Exception("Invalid data");
- }
- $limit = strlen($buffer);
- $pos = 0;
- while ($pos < $limit - 3) {
- if (Transform::fromUInt8($buffer{$pos++}) == 0 &&
- Transform::fromUInt16BE(substr($buffer, $pos, 2)) == 1) {
- if (($pos += 2) < $limit - 2)
- if (Transform::fromUInt16BE(substr($buffer, $pos, 2)) == 0 &&
- Transform::fromUInt8($buffer{$pos + 2}) == 1)
- continue;
- $this->_reader->setOffset($start + $pos - 3);
- return Transform::fromUInt8($buffer{$pos++}) & 0xff | 0x100;
- }
- }
- $this->_reader->setOffset($start + $limit);
- }
-
- /* No start code found within 2048 bytes, the maximum size of a pack */
- require_once("MPEG/Exception.php");
- throw new MPEG_Exception("Invalid data");
- }
-
- /**
- * Finds and returns the previous start code. Start codes are reserved bit
- * patterns in the video file that do not otherwise occur in the video stream.
- *
- * All start codes are byte aligned and start with the following byte
- * sequence: 0x00 0x00 0x01.
- *
- * @return integer
- */
- protected final function prevStartCode()
- {
- $buffer = " ";
- $start;
- $position = $this->_reader->getOffset();
- while ($position > 0) {
- $start = 0;
- $position = $position - 512;
- if ($position < 0) {
- require_once("MPEG/Exception.php");
- throw new MPEG_Exception("Invalid data");
- }
- $this->_reader->setOffset($position);
- $buffer = $this->_reader->read(512) . substr($buffer, 0, 4);
- $pos = 512 - 8;
- while ($pos > 3) {
- if (Transform::fromUInt8($buffer{$pos}) == 0 &&
- Transform::fromUInt16BE(substr($buffer, $pos + 1, 2)) == 1) {
-
- if ($pos + 2 < 512 &&
- Transform::fromUInt16BE(substr($buffer, $pos + 3, 2)) == 0 &&
- Transform::fromUInt8($buffer{$pos + 5}) == 1) {
- $pos --;
- continue;
- }
- $this->_reader->setOffset($position + $pos);
- return Transform::fromUInt8($buffer{$pos + 3}) & 0xff | 0x100;
- }
- $pos--;
- }
- $this->_reader->setOffset($position = $position + 3);
- }
- return 0;
- }
-
- /**
- * Formats given time in seconds into the form of
- * [hours:]minutes:seconds.milliseconds.
- *
- * @param integer $seconds The time to format, in seconds
- * @return string
- */
- protected final function formatTime($seconds)
- {
- $milliseconds = round(($seconds - floor($seconds)) * 1000);
- $seconds = floor($seconds);
- $minutes = floor($seconds / 60);
- $hours = floor($minutes / 60);
- return
- ($minutes > 0 ?
- ($hours > 0 ? $hours . ":" .
- str_pad($minutes % 60, 2, "0", STR_PAD_LEFT) : $minutes % 60) . ":" .
- str_pad($seconds % 60, 2, "0", STR_PAD_LEFT) : $seconds % 60) . "." .
- str_pad($milliseconds, 3, "0", STR_PAD_LEFT);
- }
-
- /**
- * Magic function so that $obj->value will work.
- *
- * @param string $name The field name.
- * @return mixed
- */
- public function __get($name)
- {
- if (method_exists($this, "get" . ucfirst($name)))
- return call_user_func(array($this, "get" . ucfirst($name)));
- else {
- require_once("MPEG/Exception.php");
- throw new MPEG_Exception("Unknown 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 {
- require_once("MPEG/Exception.php");
- throw new MPEG_Exception("Unknown field: " . $name);
- }
- }
-}
diff --git a/src/MPEG/PS.php b/src/MPEG/PS.php
deleted file mode 100644
index e867fad..0000000
--- a/src/MPEG/PS.php
+++ /dev/null
@@ -1,146 +0,0 @@
-
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @todo Full implementation
- */
-final class MPEG_PS extends MPEG_Object
-{
- /** @var integer */
- private $_length;
-
- /**
- * Constructs the class with given file and options.
- *
- * @param string|Reader $filename The path to the file, file descriptor of an
- * opened file, or {@link Reader} instance.
- * @param Array $options The options array.
- */
- public function __construct($filename, $options = array())
- {
- if ($filename instanceof Reader)
- $reader = &$filename;
- else
- $reader = new Reader($filename);
-
- parent::__construct($reader, $options);
-
- $startCode = 0; $startTime = 0;
- $pictureCount = 0; $pictureRate = 0;
- $rates = array ( 0, 23.976, 24, 25, 29.97, 30, 50, 59.94, 60 );
- $foundSeqHdr = false; $foundGOP = false;
-
- do {
- do {
- $startCode = $this->nextStartCode();
- } while ($startCode != 0x1b3 && $startCode != 0x1b8);
- if ($startCode == 0x1b3 /* sequence_header_code */ && $pictureRate == 0) {
- $i1 = $this->_reader->readUInt32BE();
- $i2 = $this->_reader->readUInt32BE();
- if (!Twiddling::testAllBits($i2, 0x2000))
- throw new RuntimeException("Invalid mark");
- $pictureRate = $rates[Twiddling::getValue($i1, 4, 8)];
- $foundSeqHdr = true;
- }
- if ($startCode == 0x1b8 /* group_start_code */) {
- $tmp = $this->_reader->readUInt32BE();
- $startTime = (($tmp >> 26) & 0x1f) * 60 * 60 * 1000 /* hours */ +
- (($tmp >> 20) & 0x3f) * 60 * 1000 /* minutes */ +
- (($tmp >> 13) & 0x3f) * 1000 /* seconds */ +
- (int)(1 / $pictureRate * (($tmp >> 7) & 0x3f) * 1000);
- $foundGOP = true;
- }
- } while (!$foundSeqHdr || !$foundGOP);
-
- $this->_reader->setOffset($this->_reader->getSize());
-
- do {
- if (($startCode = $this->prevStartCode()) == 0x100)
- $pictureCount++;
- } while ($startCode != 0x1b8);
-
- $this->_reader->skip(4);
- $tmp = $this->_reader->readUInt32BE();
- $this->_length =
- (((($tmp >> 26) & 0x1f) * 60 * 60 * 1000 /* hours */ +
- (($tmp >> 20) & 0x3f) * 60 * 1000 /* minutes */ +
- (($tmp >> 13) & 0x3f) * 1000 /* seconds */ +
- (int)(1 / $pictureRate * (($tmp >> 7) & 0x3f) * 1000)) - $startTime +
- (int)(1 / $pictureRate * $pictureCount * 1000)) / 1000;
- }
-
- /**
- * Returns the exact playtime in seconds.
- *
- * @return integer
- */
- public function getLength() { return $this->_length; }
-
- /**
- * Returns the exact playtime given in seconds as a string in the form of
- * [hours:]minutes:seconds.milliseconds.
- *
- * @param integer $seconds The playtime in seconds.
- * @return string
- */
- public function getFormattedLength()
- {
- return $this->formatTime($this->getLength());
- }
-}
diff --git a/src/Magic.php b/src/Magic.php
deleted file mode 100644
index 21a3c27..0000000
--- a/src/Magic.php
+++ /dev/null
@@ -1,177 +0,0 @@
-1 -- byte number to begin checking from. ">" indicates a dependency
- * upon the previous non-">" line
- * o 2 -- type of data to match. Can be one of following
- * - byte (single character)
- * - short (machine-order 16-bit integer)
- * - long (machine-order 32-bit integer)
- * - string (arbitrary-length string)
- * - date (long integer date (seconds since Unix epoch/1970))
- * - beshort (big-endian 16-bit integer)
- * - belong (big-endian 32-bit integer)
- * - bedate (big-endian 32-bit integer date)
- * - leshort (little-endian 16-bit integer)
- * - lelong (little-endian 32-bit integer)
- * - ledate (little-endian 32-bit integer date)
- * o 3 -- contents of data to match
- * o 4 -- file description/MIME type if matched
- * o 5 -- optional MIME encoding if matched and if above was a MIME type
- *
- * @package php-reader
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2006-2008 PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-final class Magic
-{
- /** @var string */
- private $_magic;
-
- /**
- * Reads the magic information from given magic file.
- *
- * @param string $filename The path to the magic file.
- */
- public function __construct($filename)
- {
- $reader = new Reader($filename);
- $this->_magic = $reader->read($reader->getSize());
- }
-
- /**
- * Returns the recognized MIME type/description of the given file. The type
- * is determined by the content using magic bytes characteristic for the
- * particular file type.
- *
- * If the type could not be found, the function returns the default value, or
- * false.
- *
- * @param string $filename The file path whose type to determine.
- * @param string $default The default value.
- * @return string|false
- */
- public function getType($filename, $default = false)
- {
- $reader = new Reader($filename);
-
- $parentOffset = 0;
- foreach (preg_split("/^/m", $this->_magic) as $line) {
- $chunks = array();
- if (!preg_match("/^(?P>?)(?P\d+)\s+(?P\S+)" .
- "\s+(?P\S+)(?:\s+(?P[a-z]+\/[a-z-" .
- "0-9]+)?(?:\s+(?P.+))?)?$/", $line, $chunks))
- continue;
-
- if ($chunks["Dependant"]) {
- $reader->setOffset($parentOffset);
- $reader->skip($chunks["Byte"]);
- } else
- $reader->setOffset($parentOffset = $chunks["Byte"]);
-
- $matchType = strtolower($chunks["MatchType"]);
- $matchData = preg_replace
- (array("/\\\\ /", "/\\\\\\\\/", "/\\\\([0-7]{1,3})/e",
- "/\\\\x([0-9A-Fa-f]{1,2})/e", "/0x([0-9A-Fa-f]+)/e"),
- array(" ", "\\\\", "pack(\"H*\", base_convert(\"$1\", 8, 16));",
- "pack(\"H*\", \"$1\");", "hexdec(\"$1\");"),
- $chunks["MatchData"]);
-
- switch ($matchType) {
- case "byte": // single character
- $data = $reader->readInt8();
- break;
- case "short": // machine-order 16-bit integer
- $data = $reader->readInt16();
- break;
- case "long": // machine-order 32-bit integer
- $data = $reader->readInt32();
- break;
- case "string": // arbitrary-length string
- $data = $reader->readString8(strlen($matchData));
- break;
- case "date": // long integer date (seconds since Unix epoch/1970)
- $data = $reader->readInt64BE();
- break;
- case "beshort": // big-endian 16-bit integer
- $data = $reader->readUInt16BE();
- break;
- case "belong": // big-endian 32-bit integer
- case "bedate": // big-endian 32-bit integer date
- $data = $reader->readUInt32BE();
- break;
- case "leshort": // little-endian 16-bit integer
- $data = $reader->readUInt16LE();
- break;
- case "lelong": // little-endian 32-bit integer
- case "ledate": // little-endian 32-bit integer date
- $data = $reader->readUInt32LE();
- break;
- default:
- $data = null;
- break;
- }
-
- if (strcmp($data, $matchData) == 0) {
- if (!empty($chunks["MIMEType"]))
- return $chunks["MIMEType"];
- if (!empty($chunks["Description"]))
- return $chunks["Description"];
- }
- }
- return $default;
- }
-}
diff --git a/src/Reader.php b/src/Reader.php
deleted file mode 100644
index d6c185b..0000000
--- a/src/Reader.php
+++ /dev/null
@@ -1,234 +0,0 @@
-
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2006-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- */
-class Reader
-{
- /** @var resource */
- private $_fd;
-
- /** @var integer */
- private $_size;
-
- /**
- * Constructs the Reader class with given file.
- *
- * @param string $filename The path to the file.
- * @param string $mode The type of access.
- * @throws Reader_Exception if the file cannot be read.
- */
- public function __construct($filename, $mode = "rb")
- {
- if (is_resource($filename) &&
- in_array(get_resource_type($filename), array("file", "stream")))
- $this->_fd = $filename;
- else if (($this->_fd = fopen($filename, $mode)) === false)
- throw new Reader_Exception("Unable to open file:" . $filename);
-
- fseek($this->_fd, 0, SEEK_END);
- $this->_size = ftell($this->_fd);
- fseek($this->_fd, 0);
- }
-
- /**
- * Closes the file.
- */
- public function __destruct()
- {
- @fclose($this->_fd);
- }
-
- /**
- * Checks whether there is more to be read in the file. Returns
- * true if the end of the file has not yet been reached;
- * false otherwise.
- *
- * @return boolean
- */
- public function available()
- {
- return $this->getOffset() < $this->_size;
- }
-
- /**
- * Jumps size amount of bytes in the file stream.
- *
- * @param integer $size The amount of bytes.
- * @return void
- * @throws Reader_Exception if size attribute is negative.
- */
- public function skip($size)
- {
- if ($size < 0)
- throw new Reader_Exception("Invalid argument");
- if ($size == 0)
- return;
- fseek($this->_fd, $size, SEEK_CUR);
- }
-
- /**
- * Reads length amount of bytes from the file stream.
- *
- * @param integer $length The amount of bytes.
- * @return string
- * @throws Reader_Exception if length attribute is negative.
- */
- public function read($length)
- {
- if ($length < 0)
- throw new Reader_Exception("Invalid argument");
- if ($length == 0)
- return "";
- return fread($this->_fd, $length);
- }
-
- /**
- * Returns the current point of operation.
- *
- * @return integer
- */
- public function getOffset()
- {
- return ftell($this->_fd);
- }
-
- /**
- * Sets the point of operation, ie the cursor offset value. The offset can
- * also be set to a negative value when it is interpreted as an offset from
- * the end of the file instead of the beginning.
- *
- * @param integer $offset The new point of operation.
- * @return void
- */
- public function setOffset($offset)
- {
- fseek($this->_fd, $offset < 0 ? $this->_size + $offset : $offset);
- }
-
- /**
- * Returns the file size in bytes.
- *
- * @return integer
- */
- public function getSize() { return $this->_size; }
-
- /**
- * Magic function so that $obj->value will work.
- *
- * @param string $name The field name.
- * @return mixed
- */
- public function __get($name)
- {
- if (method_exists($this, "get" . ucfirst(strtolower($name))))
- return call_user_func(array($this, "get" . ucfirst(strtolower($name))));
- else throw new Reader_Exception("Unknown 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(strtolower($name))))
- call_user_func
- (array($this, "set" . ucfirst(strtolower($name))), $value);
- else throw new Reader_Exception("Unknown field: " . $name);
- }
-
- /**
- * Magic function to delegate the call to helper methods of
- * Transform class to transform read data in another format.
- *
- * The read data length is determined from the helper method name. For methods
- * where arbitrary data lengths are accepted a parameter can be used to
- * specify the length.
- *
- * @param string $method The method to be called.
- * @param string $params The parameters should the function accept them.
- * @return mixed
- * @throws Reader_Exception if no such transformer is implemented
- */
- public function __call($method, $params)
- {
- $chunks = array();
-
- // To keep compatibility with PHP 5.0.0 we use a static array instead of
- // method_exists to check if a method of the Transform class can be called.
- static $methods = array(
- "isLittleEndian", "isBigEndian", "toInt64LE", "fromInt64LE", "toInt64BE",
- "fromInt64BE", "toInt32", "fromInt32", "toInt32LE", "fromInt32LE",
- "toInt32BE", "fromInt32BE", "toUInt32LE", "fromUInt32LE", "toUInt32BE",
- "fromUInt32BE", "toInt16", "fromInt16", "toInt16LE", "fromInt16LE",
- "toInt16BE", "fromInt16BE", "toUInt16LE", "fromUInt16LE", "toUInt16BE",
- "fromUInt16BE", "toInt8", "fromInt8", "toUInt8", "fromUInt8", "toFloat",
- "fromFloat", "toFloatLE", "fromFloatLE", "toFloatBE", "fromFloatBE",
- "toString8", "fromString8", "toString16", "fromString16", "toString16LE",
- "fromString16LE", "toString16BE", "fromString16BE", "toHHex", "fromHHex",
- "toLHex", "fromLHex", "toGUID", "fromGUID"
- );
- if (preg_match
- ("/read([a-z]{3,6})?(\d{1,2})?(?:LE|BE)?/i", $method, $chunks) &&
- in_array(preg_replace("/^read/", "from", $method), $methods))
- return call_user_func
- (array("Transform", preg_replace("/^read/", "from", $method)),
- $this->read(preg_match("/String|(?:H|L)Hex/", $chunks[1]) ?
- (isset($params[0]) ? $params[0] : 1) :
- ($chunks[1] == "GUID" ? 16 : $chunks[2] / 8)));
- else throw new Reader_Exception("Unknown method: " . $method);
- }
-}
diff --git a/src/Reader/Exception.php b/src/Reader/Exception.php
deleted file mode 100644
index 18be17d..0000000
--- a/src/Reader/Exception.php
+++ /dev/null
@@ -1,49 +0,0 @@
-
- * @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 Reader_Exception extends Exception
-{
-}
diff --git a/src/Transform.php b/src/Transform.php
deleted file mode 100644
index 339af14..0000000
--- a/src/Transform.php
+++ /dev/null
@@ -1,711 +0,0 @@
-
- * @author Ryan Butterfield
- * @copyright Copyright (c) 2006-2009 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @static
- */
-final class Transform
-{
- const MACHINE_ENDIAN_ORDER = 0;
- const LITTLE_ENDIAN_ORDER = 1;
- const BIG_ENDIAN_ORDER = 2;
-
- /**
- * Default private constructor for a static class.
- */
- private function __construct() {}
-
- /**
- * Returns whether the current machine endian order is little endian.
- *
- * @return boolean
- */
- public static function isLittleEndian()
- {
- return self::fromInt32("\x01\x00\x00\x00") == 1;
- }
-
- /**
- * Returns whether the current machine endian order is big endian.
- *
- * @return boolean
- */
- public static function isBigEndian()
- {
- return self::fromInt32("\x00\x00\x00\x01") == 1;
- }
-
- /**
- * Returns 64-bit float as little-endian ordered binary data string.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toInt64LE($value)
- {
- return pack("V*", $value & 0xffffffff, $value / (0xffffffff+1));
- }
-
- /**
- * Returns little-endian ordered binary data as 64-bit float. PHP does not
- * support 64-bit integers as the long integer is of 32-bits but using
- * aritmetic operations it is implicitly converted into floating point which
- * is of 64-bits long.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromInt64LE($value)
- {
- list(, $lolo, $lohi, $hilo, $hihi) = unpack("v*", $value);
- return ($hihi * (0xffff+1) + $hilo) * (0xffffffff+1) +
- ($lohi * (0xffff+1) + $lolo);
- }
-
- /**
- * Returns 64-bit float as big-endian ordered binary data string.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toInt64BE($value)
- {
- return pack("N*", $value / (0xffffffff+1), $value & 0xffffffff);
- }
-
- /**
- * Returns big-endian ordered binary data as 64-bit float. PHP does not
- * support 64-bit integers as the long integer is of 32-bits but using
- * aritmetic operations it is implicitly converted into floating point which
- * is of 64-bits long.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromInt64BE($value)
- {
- list(, $hihi, $hilo, $lohi, $lolo) = unpack("n*", $value);
- return ($hihi * (0xffff+1) + $hilo) * (0xffffffff+1) +
- ($lohi * (0xffff+1) + $lolo);
- }
-
- /**
- * Returns signed 32-bit integer as machine-endian ordered binary data.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toInt32($value)
- {
- return pack("l*", $value);
- }
-
- /**
- * Returns machine-endian ordered binary data as signed 32-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromInt32($value)
- {
- list(, $int) = unpack("l*", $value);
- return $int;
- }
-
- /**
- * Returns signed 32-bit integer as little-endian ordered binary data.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toInt32LE($value)
- {
- if (self::isBigEndian())
- return strrev(self::toInt32($value));
- else
- return self::toInt32($value);
- }
-
- /**
- * Returns little-endian ordered binary data as signed 32-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromInt32LE($value)
- {
- if (self::isBigEndian())
- return self::fromInt32(strrev($value));
- else
- return self::fromInt32($value);
- }
-
- /**
- * Returns signed 32-bit integer as big-endian ordered binary data.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toInt32BE($value)
- {
- if (self::isBigEndian())
- return self::toInt32($value);
- else
- return strrev(self::toInt32($value));
- }
-
- /**
- * Returns big-endian ordered binary data as signed 32-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromInt32BE($value)
- {
- if (self::isBigEndian())
- return self::fromInt32($value);
- else
- return self::fromInt32(strrev($value));
- }
-
- /**
- * Returns unsigned 32-bit integer as little-endian ordered binary data.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toUInt32LE($value)
- {
- return pack("V*", $value);
- }
-
- /**
- * Returns little-endian ordered binary data as unsigned 32-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromUInt32LE($value)
- {
- if (PHP_INT_SIZE < 8) {
- list(, $lo, $hi) = unpack("v*", $value);
- return $hi * (0xffff+1) + $lo; // eq $hi << 16 | $lo
- } else {
- list(, $int) = unpack("V*", $value);
- return $int;
- }
- }
-
- /**
- * Returns unsigned 32-bit integer as big-endian ordered binary data.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toUInt32BE($value)
- {
- return pack("N*", $value);
- }
-
- /**
- * Returns big-endian ordered binary data as unsigned 32-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromUInt32BE($value)
- {
- if (PHP_INT_SIZE < 8) {
- list(, $hi, $lo) = unpack("n*", $value);
- return $hi * (0xffff+1) + $lo; // eq $hi << 16 | $lo
- } else {
- list(, $int) = unpack("N*", $value);
- return $int;
- }
- }
-
- /**
- * Returns signed 16-bit integer as machine endian ordered binary data.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toInt16($value)
- {
- return pack("s*", $value);
- }
-
- /**
- * Returns machine endian ordered binary data as signed 16-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromInt16($value)
- {
- list(, $int) = unpack("s*", $value);
- return $int;
- }
-
- /**
- * Returns signed 16-bit integer as little-endian ordered binary data.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toInt16LE($value)
- {
- if (self::isBigEndian())
- return strrev(self::toInt16($value));
- else
- return self::toInt16($value);
- }
-
- /**
- * Returns little-endian ordered binary data as signed 16-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromInt16LE($value)
- {
- if (self::isBigEndian())
- return self::fromInt16(strrev($value));
- else
- return self::fromInt16($value);
- }
-
- /**
- * Returns signed 16-bit integer as big-endian ordered binary data.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toInt16BE($value)
- {
- if (self::isBigEndian())
- return self::toInt16($value);
- else
- return strrev(self::toInt16($value));
- }
-
- /**
- * Returns big-endian ordered binary data as signed 16-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromInt16BE($value)
- {
- if (self::isBigEndian())
- return self::fromInt16($value);
- else
- return self::fromInt16(strrev($value));
- }
-
- /**
- * Returns machine endian ordered binary data as unsigned 16-bit integer.
- *
- * @param string $value The binary data string.
- * @param integer $order The byte order of the binary data string.
- * @return integer
- */
- private static function fromUInt16($value, $order = self::MACHINE_ENDIAN_ORDER)
- {
- list(, $int) = unpack
- (($order == self::BIG_ENDIAN_ORDER ? "n" :
- ($order == self::LITTLE_ENDIAN_ORDER ? "v" : "S")) . "*", $value);
- return $int;
- }
-
- /**
- * Returns unsigned 16-bit integer as little-endian ordered binary data.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toUInt16LE($value)
- {
- return pack("v*", $value);
- }
-
- /**
- * Returns little-endian ordered binary data as unsigned 16-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromUInt16LE($value)
- {
- return self::fromUInt16($value, self::LITTLE_ENDIAN_ORDER);
- }
-
- /**
- * Returns unsigned 16-bit integer as big-endian ordered binary data.
- *
- * @param integer $value The input value.
- * @return string
- */
- public static function toUInt16BE($value)
- {
- return pack("n*", $value);
- }
-
- /**
- * Returns big-endian ordered binary data as unsigned 16-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromUInt16BE($value)
- {
- return self::fromUInt16($value, self::BIG_ENDIAN_ORDER);
- }
-
- /**
- * Returns an 8-bit integer as binary data.
- *
- * @param integer $value The input value.
- * @return integer
- */
- public static function toInt8($value)
- {
- return pack("c*", $value);
- }
-
- /**
- * Returns binary data as 8-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromInt8($value)
- {
- list(, $int) = unpack("c*", $value);
- return $int;
- }
-
- /**
- * Returns an unsigned 8-bit integer as binary data.
- *
- * @param integer $value The input value.
- * @return integer
- */
- public static function toUInt8($value)
- {
- return pack("C*", $value);
- }
-
- /**
- * Returns binary data as an unsigned 8-bit integer.
- *
- * @param string $value The binary data string.
- * @return integer
- */
- public static function fromUInt8($value)
- {
- list(, $int) = unpack("C*", $value);
- return $int;
- }
-
- /**
- * Returns a floating point number as machine endian ordered binary data.
- *
- * @param float $value The input value.
- * @return string
- */
- public static function toFloat($value)
- {
- return pack("f*", $value);
- }
-
- /**
- * Returns machine endian ordered binary data as a floating point number.
- *
- * @param string $value The binary data string.
- * @return float
- */
- public static function fromFloat($value)
- {
- list(, $float) = unpack("f*", $value);
- return $float;
- }
-
- /**
- * Returns a floating point number as little-endian ordered binary data.
- *
- * @param float $value The input value.
- * @return string
- */
- public static function toFloatLE($value)
- {
- if (self::isBigEndian())
- return strrev(self::toFloat($value));
- else
- return self::toFloat($value);
- }
-
- /**
- * Returns little-endian ordered binary data as a floating point number.
- *
- * @param string $value The binary data string.
- * @return float
- */
- public static function fromFloatLE($value)
- {
- if (self::isBigEndian())
- return self::fromFloat(strrev($value));
- else
- return self::fromFloat($value);
- }
-
- /**
- * Returns a floating point number as big-endian ordered binary data.
- *
- * @param float $value The input value.
- * @return string
- */
- public static function toFloatBE($value)
- {
- if (self::isBigEndian())
- return self::toFloat($value);
- else
- return strrev(self::toFloat($value));
- }
-
- /**
- * Returns big-endian ordered binary data as a float point number.
- *
- * @param string $value The binary data string.
- * @return float
- */
- public static function fromFloatBE($value)
- {
- if (self::isBigEndian())
- return self::fromFloat($value);
- else
- return self::fromFloat(strrev($value));
- }
-
- /**
- * Returns string as binary data padded to given length with zeros. If length
- * is smaller than the length of the string, it is considered as the length of
- * the padding.
- *
- * @param string $value The input value.
- * @param integer $length The length to which to pad the value.
- * @param string $padding The padding character.
- * @return string
- */
- public static function toString8($value, $length = false, $padding = "\0")
- {
- if ($length === false)
- $length = strlen($value);
- if ($length < ($tmp = strlen($value)))
- $length = $tmp + $length;
- return str_pad($value, $length, $padding);
- }
-
- /**
- * Returns binary data as string. Removes terminating zero.
- *
- * @param string $value The binary data string.
- * @return string
- */
- public static function fromString8($value)
- {
- return rtrim($value, "\0");
- }
-
- /**
- * Returns the multibyte string as binary data with given byte order mark
- * (BOM) and padded to given length with zeros. Length is given in unicode
- * characters so each character adds two zeros to the string. If length is
- * smaller than the length of the string, it is considered as the length of
- * the padding.
- *
- * If byte order mark is false no mark is inserted to the binary
- * data.
- *
- * @param string $value The input value.
- * @param integer $order The byte order of the binary data string.
- * @param integer $length The length to which to pad the value.
- * @param string $padding The padding character.
- * @return string
- */
- public static function toString16
- ($value, $order = false, $length = false, $padding = "\0")
- {
- if ($length === false)
- $length = (int)(strlen($value) / 2);
- if ($length < ($tmp = strlen($value) / 2))
- $length = $tmp + $length;
- if ($order == self::BIG_ENDIAN_ORDER &&
- !(ord($value[0]) == 0xfe && ord($value[1]) == 0xff)) {
- $value = 0xfeff . $value;
- $length++;
- }
- if ($order == self::LITTLE_ENDIAN_ORDER &&
- !(ord($value[0]) == 0xff && ord($value[1]) == 0xfe)) {
- $value = 0xfffe . $value;
- $length++;
- }
- return str_pad($value, $length * 2, $padding);
- }
-
- /**
- * Returns binary data as multibyte Unicode string. Removes terminating zero.
- *
- * The byte order is possibly determined from the byte order mark included in
- * the binary data string. The order parameter is updated if the BOM is found.
- *
- * @param string $value The binary data string.
- * @param integer $order The endianess of the string.
- * @param integer $trimOrder Whether to remove the byte order mark from the
- * string.
- * @return string
- */
- public static function fromString16
- ($value, &$order = false, $trimOrder = false)
- {
- if (strlen($value) < 2)
- return "";
-
- if (ord($value[0]) == 0xfe && ord($value[1]) == 0xff) {
- $order = self::BIG_ENDIAN_ORDER;
- if ($trimOrder)
- $value = substr($value, 2);
- }
- if (ord($value[0]) == 0xff && ord($value[1]) == 0xfe) {
- $order = self::LITTLE_ENDIAN_ORDER;
- if ($trimOrder)
- $value = substr($value, 2);
- }
-
- return substr($value, -2) == "\0\0" ? substr($value, 0, -2) : $value;
- }
-
- /**
- * Returns hexadecimal string having high nibble first as binary data.
- *
- * @param string $value The input value.
- * @return string
- */
- public static function toHHex($value)
- {
- return pack("H*", $value);
- }
-
- /**
- * Returns binary data as hexadecimal string having high nibble first.
- *
- * @param string $value The binary data string.
- * @return string
- */
- public static function fromHHex($value)
- {
- list($hex) = unpack("H*0", $value);
- return $hex;
- }
-
- /**
- * Returns hexadecimal string having low nibble first as binary data.
- *
- * @param string $value The input value.
- * @return string
- */
- public static function toLHex($value)
- {
- return pack("h*", $value);
- }
-
- /**
- * Returns binary data as hexadecimal string having low nibble first.
- *
- * @param string $value The binary data string.
- * @return string
- */
- public static function fromLHex($value)
- {
- list($hex) = unpack("h*0", $value);
- return $hex;
- }
-
- /**
- * Returns big-endian ordered hexadecimal GUID string as little-endian ordered
- * binary data string.
- *
- * @param string $value The input value.
- * @return string
- */
- public static function toGUID($value)
- {
- $string = ""; $C = preg_split("/-/", $value);
- return pack
- ("V1v2N2", hexdec($C[0]), hexdec($C[1]), hexdec($C[2]),
- hexdec($C[3] . substr($C[4], 0, 4)), hexdec(substr($C[4], 4)));
- }
-
- /**
- * Returns the little-endian ordered binary data as big-endian ordered
- * hexadecimal GUID string.
- *
- * @param string $value The binary data string.
- * @return string
- */
- public static function fromGUID($value)
- {
- $C = @unpack("V1V/v2v/N2N", $value);
- list($hex) = @unpack("H*0", pack
- ("NnnNN", $C["V"], $C["v1"], $C["v2"], $C["N1"], $C["N2"]));
-
- /* Fixes a bug in PHP versions earlier than Jan 25 2006 */
- if (implode("", unpack("H*", pack("H*", "a"))) == "a00")
- $hex = substr($hex, 0, -1);
-
- return preg_replace
- ("/^(.{8})(.{4})(.{4})(.{4})/", "\\1-\\2-\\3-\\4-", $hex);
- }
-}
diff --git a/src/Twiddling.php b/src/Twiddling.php
deleted file mode 100644
index f48ef0a..0000000
--- a/src/Twiddling.php
+++ /dev/null
@@ -1,233 +0,0 @@
-
- * @author Sven Vollbehr
- * @copyright Copyright (c) 2008 The PHP Reader Project Workgroup
- * @license http://code.google.com/p/php-reader/wiki/License New BSD License
- * @version $Rev$
- * @static
- */
-final class Twiddling
-{
- /**
- * Default private constructor for a static class.
- */
- private function __construct() {}
-
- /**
- * Sets a bit at a given position in an integer.
- *
- * @param integer $integer The value to manipulate.
- * @param integer $position The position of the bit to set.
- * @param boolean $on Whether to enable or clear the bit.
- * @return integer
- */
- public static function setBit($integer, $position, $on)
- {
- return $on ? self::enableBit($integer, $position) :
- self::clearBit($integer, $position);
- }
-
- /**
- * Enables a bit at a given position in an integer.
- *
- * @param integer $integer The value to manipulate.
- * @param integer $position The position of the bit to enable.
- * @return integer
- */
- public static function enableBit($integer, $position)
- {
- return $integer | (1 << $position);
- }
-
- /**
- * Clears a bit at a given position in an integer.
- *
- * @param integer $integer The value to manipulate.
- * @param integer $position The position of the bit to clear.
- * @return integer
- */
- public static function clearBit($integer, $position)
- {
- return $integer & ~(1 << $position);
- }
-
- /**
- * Toggles a bit at a given position in an integer.
- *
- * @param integer $integer The value to manipulate.
- * @param integer $position The position of the bit to toggle.
- * @return integer
- */
- public static function toggleBit($integer, $position)
- {
- return $integer ^ (1 << $position);
- }
-
- /**
- * Tests a bit at a given position in an integer.
- *
- * @param integer $integer The value to test.
- * @param integer $position The position of the bit to test.
- * @return boolean
- */
- public static function testBit($integer, $position)
- {
- return ($integer & (1 << $position)) != 0;
- }
-
- /**
- * Sets a given set of bits in an integer.
- *
- * @param integer $integer The value to manipulate.
- * @param integer $bits The bits to set.
- * @param boolean $on Whether to enable or clear the bits.
- * @return integer
- */
- public static function setBits($integer, $bits, $on)
- {
- return $on ? self::enableBits($integer, $bits) :
- self::clearBits($integer, $bits);
- }
-
- /**
- * Enables a given set of bits in an integer.
- *
- * @param integer $integer The value to manipulate.
- * @param integer $bits The bits to enable.
- * @return integer
- */
- public static function enableBits($integer, $bits)
- {
- return $integer | $bits;
- }
-
- /**
- * Clears a given set of bits in an integer.
- *
- * @param integer $integer The value to manipulate.
- * @param integer $bits The bits to clear.
- * @return integer
- */
- public static function clearBits($integer, $bits)
- {
- return $integer & ~$bits;
- }
-
- /**
- * Toggles a given set of bits in an integer.
- *
- * @param integer $integer The value to manipulate.
- * @param integer $bits The bits to toggle.
- * @return integer
- */
- public static function toggleBits($integer, $bits)
- {
- return $integer ^ $bits;
- }
-
- /**
- * Tests a given set of bits in an integer
- * returning whether all bits are set.
- *
- * @param integer $integer The value to test.
- * @param integer $bits The bits to test.
- * @return boolean
- */
- public static function testAllBits($integer, $bits)
- {
- return ($integer & $bits) == $bits;
- }
-
- /**
- * Tests a given set of bits in an integer
- * returning whether any bits are set.
- *
- * @param integer $integer The value to test.
- * @param integer $bits The bits to test.
- * @return boolean
- */
- public static function testAnyBits($integer, $bits)
- {
- return ($integer & $bits) != 0;
- }
-
- /**
- * Stores a value in a given range in an integer.
- *
- * @param integer $integer The value to store into.
- * @param integer $start The position to store from. Must be <= $end.
- * @param integer $end The position to store to. Must be >= $start.
- * @param integer $value The value to store.
- * @return integer
- */
- public static function setValue($integer, $start, $end, $value)
- {
- return self::clearBits
- ($integer, self::getMask($start, $end) << $start) | ($value << $start);
- }
-
- /**
- * Retrieves a value from a given range in an integer, inclusive.
- *
- * @param integer $integer The value to read from.
- * @param integer $start The position to read from. Must be <= $end.
- * @param integer $end The position to read to. Must be >= $start.
- * @return integer
- */
- public static function getValue($integer, $start, $end)
- {
- return ($integer & self::getMask($start, $end)) >> $start;
- }
-
- /**
- * Returns an integer with all bits set from start to end.
- *
- * @param integer $start The position to start setting bits from. Must
- * be <= $end.
- * @param integer $end The position to stop setting bits. Must be >= $start.
- * @return integer
- */
- public static function getMask($start, $end)
- {
- return ($tmp = (1 << $end)) + $tmp - (1 << $start);
- }
-}
diff --git a/src/Zend/Bit/Twiddling.php b/src/Zend/Bit/Twiddling.php
new file mode 100644
index 0000000..d34c4a1
--- /dev/null
+++ b/src/Zend/Bit/Twiddling.php
@@ -0,0 +1,223 @@
+
+ * @author Sven Vollbehr
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ * @static
+ */
+final class Zend_Bit_Twiddling
+{
+ /**
+ * Default private constructor for a static class.
+ */
+ private function __construct()
+ {
+ }
+
+ /**
+ * Sets a bit at a given position in an integer.
+ *
+ * @param integer $integer The value to manipulate.
+ * @param integer $position The position of the bit to set.
+ * @param boolean $on Whether to enable or clear the bit.
+ * @return integer
+ */
+ public static function setBit($integer, $position, $on)
+ {
+ return $on ? self::enableBit($integer, $position) :
+ self::clearBit($integer, $position);
+ }
+
+ /**
+ * Enables a bit at a given position in an integer.
+ *
+ * @param integer $integer The value to manipulate.
+ * @param integer $position The position of the bit to enable.
+ * @return integer
+ */
+ public static function enableBit($integer, $position)
+ {
+ return $integer | (1 << $position);
+ }
+
+ /**
+ * Clears a bit at a given position in an integer.
+ *
+ * @param integer $integer The value to manipulate.
+ * @param integer $position The position of the bit to clear.
+ * @return integer
+ */
+ public static function clearBit($integer, $position)
+ {
+ return $integer & ~(1 << $position);
+ }
+
+ /**
+ * Toggles a bit at a given position in an integer.
+ *
+ * @param integer $integer The value to manipulate.
+ * @param integer $position The position of the bit to toggle.
+ * @return integer
+ */
+ public static function toggleBit($integer, $position)
+ {
+ return $integer ^ (1 << $position);
+ }
+
+ /**
+ * Tests a bit at a given position in an integer.
+ *
+ * @param integer $integer The value to test.
+ * @param integer $position The position of the bit to test.
+ * @return boolean
+ */
+ public static function testBit($integer, $position)
+ {
+ return ($integer & (1 << $position)) != 0;
+ }
+
+ /**
+ * Sets a given set of bits in an integer.
+ *
+ * @param integer $integer The value to manipulate.
+ * @param integer $bits The bits to set.
+ * @param boolean $on Whether to enable or clear the bits.
+ * @return integer
+ */
+ public static function setBits($integer, $bits, $on)
+ {
+ return $on ? self::enableBits($integer, $bits) :
+ self::clearBits($integer, $bits);
+ }
+
+ /**
+ * Enables a given set of bits in an integer.
+ *
+ * @param integer $integer The value to manipulate.
+ * @param integer $bits The bits to enable.
+ * @return integer
+ */
+ public static function enableBits($integer, $bits)
+ {
+ return $integer | $bits;
+ }
+
+ /**
+ * Clears a given set of bits in an integer.
+ *
+ * @param integer $integer The value to manipulate.
+ * @param integer $bits The bits to clear.
+ * @return integer
+ */
+ public static function clearBits($integer, $bits)
+ {
+ return $integer & ~$bits;
+ }
+
+ /**
+ * Toggles a given set of bits in an integer.
+ *
+ * @param integer $integer The value to manipulate.
+ * @param integer $bits The bits to toggle.
+ * @return integer
+ */
+ public static function toggleBits($integer, $bits)
+ {
+ return $integer ^ $bits;
+ }
+
+ /**
+ * Tests a given set of bits in an integer
+ * returning whether all bits are set.
+ *
+ * @param integer $integer The value to test.
+ * @param integer $bits The bits to test.
+ * @return boolean
+ */
+ public static function testAllBits($integer, $bits)
+ {
+ return ($integer & $bits) == $bits;
+ }
+
+ /**
+ * Tests a given set of bits in an integer
+ * returning whether any bits are set.
+ *
+ * @param integer $integer The value to test.
+ * @param integer $bits The bits to test.
+ * @return boolean
+ */
+ public static function testAnyBits($integer, $bits)
+ {
+ return ($integer & $bits) != 0;
+ }
+
+ /**
+ * Stores a value in a given range in an integer.
+ *
+ * @param integer $integer The value to store into.
+ * @param integer $start The position to store from. Must be <= $end.
+ * @param integer $end The position to store to. Must be >= $start.
+ * @param integer $value The value to store.
+ * @return integer
+ */
+ public static function setValue($integer, $start, $end, $value)
+ {
+ return self::clearBits
+ ($integer, self::getMask
+ ($start, $end) << $start) | ($value << $start);
+ }
+
+ /**
+ * Retrieves a value from a given range in an integer, inclusive.
+ *
+ * @param integer $integer The value to read from.
+ * @param integer $start The position to read from. Must be <= $end.
+ * @param integer $end The position to read to. Must be >= $start.
+ * @return integer
+ */
+ public static function getValue($integer, $start, $end)
+ {
+ return ($integer & self::getMask($start, $end)) >> $start;
+ }
+
+ /**
+ * Returns an integer with all bits set from start to end.
+ *
+ * @param integer $start The position to start setting bits from. Must
+ * be <= $end.
+ * @param integer $end The position to stop setting bits. Must
+ * be >= $start.
+ * @return integer
+ */
+ public static function getMask($start, $end)
+ {
+ return ($tmp = (1 << $end)) + $tmp - (1 << $start);
+ }
+}
diff --git a/src/Zend/Io/Exception.php b/src/Zend/Io/Exception.php
new file mode 100644
index 0000000..52318a0
--- /dev/null
+++ b/src/Zend/Io/Exception.php
@@ -0,0 +1,38 @@
+
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Io_Exception extends Zend_Exception
+{}
diff --git a/src/Zend/Io/FileReader.php b/src/Zend/Io/FileReader.php
new file mode 100644
index 0000000..8ef48fb
--- /dev/null
+++ b/src/Zend/Io/FileReader.php
@@ -0,0 +1,66 @@
+
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Io_FileReader extends Zend_Io_Reader
+{
+ /**
+ * Constructs the Zend_Io_FileReader class with given path to the file. By
+ * default the file is opened in read (rb) mode.
+ *
+ * @param string $filename The path to the file.
+ * @throws Zend_Io_Exception if the file cannot be read
+ */
+ public function __construct($filename, $mode = null)
+ {
+ if ($mode === null)
+ $mode = 'rb';
+ if (!file_exists($filename) || !is_readable($filename) ||
+ ($fd = fopen($filename, $mode)) === false) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception
+ ('Unable to open file for reading: ' . $filename);
+ }
+ parent::__construct($fd);
+ }
+
+ /**
+ * Closes the file descriptor.
+ */
+ public function __destruct()
+ {
+ $this->close();
+ }
+}
diff --git a/src/Zend/Io/FileWriter.php b/src/Zend/Io/FileWriter.php
new file mode 100644
index 0000000..591e3f9
--- /dev/null
+++ b/src/Zend/Io/FileWriter.php
@@ -0,0 +1,66 @@
+
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Io_FileWriter extends Zend_Io_Writer
+{
+ /**
+ * Constructs the Zend_Io_FileWriter class with given path to the file. By
+ * default the file is opened in write mode without altering its content
+ * (ie r+b mode if the file exists, and wb mode if not).
+ *
+ * @param string $filename The path to the file.
+ * @throws Zend_Io_Exception if the file cannot be written
+ */
+ public function __construct($filename, $mode = null)
+ {
+ if ($mode === null)
+ $mode = file_exists($filename) ? 'r+b' : 'wb';
+ if (($fd = fopen($filename, $mode)) === false) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception
+ ('Unable to open file for writing: ' . $filename);
+ }
+ parent::__construct($fd);
+ }
+
+ /**
+ * Closes the file descriptor.
+ */
+ public function __destruct()
+ {
+ $this->close();
+ }
+}
diff --git a/src/Zend/Io/Reader.php b/src/Zend/Io/Reader.php
new file mode 100644
index 0000000..2145c85
--- /dev/null
+++ b/src/Zend/Io/Reader.php
@@ -0,0 +1,785 @@
+
+ * @author Ryan Butterfield
+ * @author Marc Bennewitz
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Io_Reader
+{
+ const MACHINE_ENDIAN_ORDER = 0;
+ const LITTLE_ENDIAN_ORDER = 1;
+ const BIG_ENDIAN_ORDER = 2;
+
+ /**
+ * The endianess of the current machine.
+ *
+ * @var integer
+ */
+ private static $_endianess = 0;
+
+ /**
+ * The resource identifier of the stream.
+ *
+ * @var resource
+ */
+ protected $_fd = null;
+
+ /**
+ * Size of the underlying stream.
+ *
+ * @var integer
+ */
+ protected $_size = 0;
+
+ /**
+ * Constructs the Zend_Io_Reader class with given open file descriptor.
+ *
+ * @param resource $fd The file descriptor.
+ * @throws Zend_Io_Exception if given file descriptor is not valid
+ */
+ public function __construct($fd)
+ {
+ if (!is_resource($fd) ||
+ !in_array(get_resource_type($fd), array('stream'))) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception
+ ('Invalid resource type (only resources of type stream are supported)');
+ }
+
+ $this->_fd = $fd;
+
+ $offset = $this->getOffset();
+ fseek($this->_fd, 0, SEEK_END);
+ $this->_size = ftell($this->_fd);
+ fseek($this->_fd, $offset);
+ }
+
+ /**
+ * Default destructor.
+ */
+ public function __destruct() {}
+
+ /**
+ * Checks whether there is more to be read from the stream. Returns
+ * true if the end has not yet been reached; false
+ * otherwise.
+ *
+ * @return boolean
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public function available()
+ {
+ return $this->getOffset() < $this->getSize();
+ }
+
+ /**
+ * Returns the current point of operation.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public function getOffset()
+ {
+ if ($this->_fd === null) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Cannot operate on a closed stream');
+ }
+ return ftell($this->_fd);
+ }
+
+ /**
+ * Sets the point of operation, ie the cursor offset value. The offset may
+ * also be set to a negative value when it is interpreted as an offset from
+ * the end of the stream instead of the beginning.
+ *
+ * @param integer $offset The new point of operation.
+ * @return void
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public function setOffset($offset)
+ {
+ if ($this->_fd === null) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Cannot operate on a closed stream');
+ }
+ fseek($this->_fd, $offset < 0 ? $this->getSize() + $offset : $offset);
+ }
+
+ /**
+ * Returns the stream size in bytes.
+ *
+ * @return integer
+ */
+ public function getSize()
+ {
+ return $this->_size;
+ }
+
+ /**
+ * Returns the underlying stream file descriptor.
+ *
+ * @return resource
+ */
+ public function getFileDescriptor()
+ {
+ return $this->_fd;
+ }
+
+ /**
+ * Jumps size amount of bytes in the stream.
+ *
+ * @param integer $size The amount of bytes.
+ * @return void
+ * @throws Zend_Io_Exception if size attribute is negative or if
+ * an I/O error occurs
+ */
+ public function skip($size)
+ {
+ if ($size < 0) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Size cannot be negative');
+ }
+ if ($size == 0) {
+ return;
+ }
+ if ($this->_fd === null) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Cannot operate on a closed stream');
+ }
+ fseek($this->_fd, $size, SEEK_CUR);
+ }
+
+ /**
+ * Reads length amount of bytes from the stream.
+ *
+ * @param integer $length The amount of bytes.
+ * @return string
+ * @throws Zend_Io_Exception if length attribute is negative or
+ * if an I/O error occurs
+ */
+ public function read($length)
+ {
+ if ($length < 0) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Length cannot be negative');
+ }
+ if ($length == 0) {
+ return '';
+ }
+ if ($this->_fd === null) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Cannot operate on a closed stream');
+ }
+ return fread($this->_fd, $length);
+ }
+
+ /**
+ * Reads 1 byte from the stream and returns binary data as an 8-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readInt8()
+ {
+ $ord = ord($this->read(1));
+ if ($ord > 127) {
+ return -$ord - 2 * (128 - $ord);
+ } else {
+ return $ord;
+ }
+ }
+
+ /**
+ * Reads 1 byte from the stream and returns binary data as an unsigned 8-bit
+ * integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readUInt8()
+ {
+ return ord($this->read(1));
+ }
+
+ /**
+ * Returns machine endian ordered binary data as signed 16-bit integer.
+ *
+ * @param string $value The binary data string.
+ * @return integer
+ */
+ private function _fromInt16($value)
+ {
+ list(, $int) = unpack('s*', $value);
+ return $int;
+ }
+
+ /**
+ * Reads 2 bytes from the stream and returns little-endian ordered binary
+ * data as signed 16-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readInt16LE()
+ {
+ if ($this->_isBigEndian()) {
+ return $this->_fromInt16(strrev($this->read(2)));
+ } else {
+ return $this->_fromInt16($this->read(2));
+ }
+ }
+
+ /**
+ * Reads 2 bytes from the stream and returns big-endian ordered binary data
+ * as signed 16-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readInt16BE()
+ {
+ if ($this->_isLittleEndian()) {
+ return $this->_fromInt16(strrev($this->read(2)));
+ } else {
+ return $this->_fromInt16($this->read(2));
+ }
+ }
+
+ /**
+ * Reads 2 bytes from the stream and returns machine ordered binary data
+ * as signed 16-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readInt16()
+ {
+ return $this->_fromInt16($this->read(2));
+ }
+
+ /**
+ * Returns machine endian ordered binary data as unsigned 16-bit integer.
+ *
+ * @param string $value The binary data string.
+ * @param integer $order The byte order of the binary data string.
+ * @return integer
+ */
+ private function _fromUInt16($value, $order = 0)
+ {
+ list(, $int) = unpack
+ (($order == self::BIG_ENDIAN_ORDER ? 'n' :
+ ($order == self::LITTLE_ENDIAN_ORDER ? 'v' : 'S')) . '*',
+ $value);
+ return $int;
+ }
+
+ /**
+ * Reads 2 bytes from the stream and returns little-endian ordered binary
+ * data as unsigned 16-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readUInt16LE()
+ {
+ return $this->_fromUInt16($this->read(2), self::LITTLE_ENDIAN_ORDER);
+ }
+
+ /**
+ * Reads 2 bytes from the stream and returns big-endian ordered binary data
+ * as unsigned 16-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readUInt16BE()
+ {
+ return $this->_fromUInt16($this->read(2), self::BIG_ENDIAN_ORDER);
+ }
+
+ /**
+ * Reads 2 bytes from the stream and returns machine ordered binary data
+ * as unsigned 16-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readUInt16()
+ {
+ return $this->_fromUInt16($this->read(2), self::MACHINE_ENDIAN_ORDER);
+ }
+
+ /**
+ * Returns machine-endian ordered binary data as signed 32-bit integer.
+ *
+ * @param string $value The binary data string.
+ * @return integer
+ */
+ private final function _fromInt32($value)
+ {
+ list(, $int) = unpack('l*', $value);
+ return $int;
+ }
+
+ /**
+ * Reads 4 bytes from the stream and returns little-endian ordered binary
+ * data as signed 32-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readInt32LE()
+ {
+ if ($this->_isBigEndian())
+ return $this->_fromInt32(strrev($this->read(4)));
+ else
+ return $this->_fromInt32($this->read(4));
+ }
+
+ /**
+ * Reads 4 bytes from the stream and returns big-endian ordered binary data
+ * as signed 32-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readInt32BE()
+ {
+ if ($this->_isLittleEndian())
+ return $this->_fromInt32(strrev($this->read(4)));
+ else
+ return $this->_fromInt32($this->read(4));
+ }
+
+ /**
+ * Reads 4 bytes from the stream and returns machine ordered binary data
+ * as signed 32-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readInt32()
+ {
+ return $this->_fromInt32($this->read(4));
+ }
+
+ /**
+ * Reads 4 bytes from the stream and returns little-endian ordered binary
+ * data as unsigned 32-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readUInt32LE()
+ {
+ if (PHP_INT_SIZE < 8) {
+ list(, $lo, $hi) = unpack('v*', $this->read(4));
+ return $hi * (0xffff+1) + $lo; // eq $hi << 16 | $lo
+ } else {
+ list(, $int) = unpack('V*', $this->read(4));
+ return $int;
+ }
+ }
+
+ /**
+ * Reads 4 bytes from the stream and returns big-endian ordered binary data
+ * as unsigned 32-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readUInt32BE()
+ {
+ if (PHP_INT_SIZE < 8) {
+ list(, $hi, $lo) = unpack('n*', $this->read(4));
+ return $hi * (0xffff+1) + $lo; // eq $hi << 16 | $lo
+ } else {
+ list(, $int) = unpack('N*', $this->read(4));
+ return $int;
+ }
+ }
+
+ /**
+ * Reads 4 bytes from the stream and returns machine ordered binary data
+ * as unsigned 32-bit integer.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readUInt32()
+ {
+ if (PHP_INT_SIZE < 8) {
+ list(, $hi, $lo) = unpack('L*', $this->read(4));
+ return $hi * (0xffff+1) + $lo; // eq $hi << 16 | $lo
+ } else {
+ list(, $int) = unpack('L*', $this->read(4));
+ return $int;
+ }
+ }
+
+ /**
+ * Reads 8 bytes from the stream and returns little-endian ordered binary
+ * data as 64-bit float.
+ *
+ * {@internal PHP does not support 64-bit integers as the long
+ * integer is of 32-bits but using aritmetic operations it is implicitly
+ * converted into floating point which is of 64-bits long.}}
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readInt64LE()
+ {
+ list(, $lolo, $lohi, $hilo, $hihi) = unpack('v*', $this->read(8));
+ return ($hihi * (0xffff+1) + $hilo) * (0xffffffff+1) +
+ ($lohi * (0xffff+1) + $lolo);
+ }
+
+ /**
+ * Reads 8 bytes from the stream and returns big-endian ordered binary data
+ * as 64-bit float.
+ *
+ * {@internal PHP does not support 64-bit integers as the long integer is of
+ * 32-bits but using aritmetic operations it is implicitly converted into
+ * floating point which is of 64-bits long.}}
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readInt64BE()
+ {
+ list(, $hihi, $hilo, $lohi, $lolo) = unpack('n*', $this->read(8));
+ return ($hihi * (0xffff+1) + $hilo) * (0xffffffff+1) +
+ ($lohi * (0xffff+1) + $lolo);
+ }
+
+ /**
+ * Returns machine endian ordered binary data as a 32-bit floating point
+ * number as defined by IEEE 754.
+ *
+ * @param string $value The binary data string.
+ * @return float
+ */
+ private function _fromFloat($value)
+ {
+ list(, $float) = unpack('f', $value);
+ return $float;
+ }
+
+ /**
+ * Reads 4 bytes from the stream and returns little-endian ordered binary
+ * data as a 32-bit float point number as defined by IEEE 754.
+ *
+ * @return float
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readFloatLE()
+ {
+ if ($this->_isBigEndian()) {
+ return $this->_fromFloat(strrev($this->read(4)));
+ } else {
+ return $this->_fromFloat($this->read(4));
+ }
+ }
+
+ /**
+ * Reads 4 bytes from the stream and returns big-endian ordered binary data
+ * as a 32-bit float point number as defined by IEEE 754.
+ *
+ * @return float
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readFloatBE()
+ {
+ if ($this->_isLittleEndian()) {
+ return $this->_fromFloat(strrev($this->read(4)));
+ } else {
+ return $this->_fromFloat($this->read(4));
+ }
+ }
+
+ /**
+ * Returns machine endian ordered binary data as a 64-bit floating point
+ * number as defined by IEEE754.
+ *
+ * @param string $value The binary data string.
+ * @return float
+ */
+ private function _fromDouble($value)
+ {
+ list(, $double) = unpack('d', $value);
+ return $double;
+ }
+
+ /**
+ * Reads 8 bytes from the stream and returns little-endian ordered binary
+ * data as a 64-bit floating point number as defined by IEEE 754.
+ *
+ * @return float
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readDoubleLE()
+ {
+ if ($this->_isBigEndian()) {
+ return $this->_fromDouble(strrev($this->read(8)));
+ } else {
+ return $this->_fromDouble($this->read(8));
+ }
+ }
+
+ /**
+ * Reads 8 bytes from the stream and returns big-endian ordered binary data
+ * as a 64-bit float point number as defined by IEEE 754.
+ *
+ * @return float
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readDoubleBE()
+ {
+ if ($this->_isLittleEndian()) {
+ return $this->_fromDouble(strrev($this->read(8)));
+ } else {
+ return $this->_fromDouble($this->read(8));
+ }
+ }
+
+ /**
+ * Reads length amount of bytes from the stream and returns
+ * binary data as string. Removes terminating zero.
+ *
+ * @param integer $length The amount of bytes.
+ * @param string $charList The list of characters you want to strip.
+ * @return string
+ * @throws Zend_Io_Exception if length attribute is negative or
+ * if an I/O error occurs
+ */
+ public final function readString8($length, $charList = "\0")
+ {
+ return rtrim($this->read($length), $charList);
+ }
+
+ /**
+ * Reads length amount of bytes from the stream and returns
+ * binary data as multibyte Unicode string. Removes terminating zero.
+ *
+ * The byte order is possibly determined from the byte order mark included
+ * in the binary data string. The order parameter is updated if the BOM is
+ * found.
+ *
+ * @param integer $length The amount of bytes.
+ * @param integer $order The endianess of the string.
+ * @param integer $trimOrder Whether to remove the byte order mark read the
+ * string.
+ * @return string
+ * @throws Zend_Io_Exception if length attribute is negative or
+ * if an I/O error occurs
+ */
+ public final function readString16
+ ($length, &$order = null, $trimOrder = false)
+ {
+ $value = $this->read($length);
+
+ if (strlen($value) < 2) {
+ return '';
+ }
+
+ if (ord($value[0]) == 0xfe && ord($value[1]) == 0xff) {
+ $order = self::BIG_ENDIAN_ORDER;
+ if ($trimOrder) {
+ $value = substr($value, 2);
+ }
+ }
+ if (ord($value[0]) == 0xff && ord($value[1]) == 0xfe) {
+ $order = self::LITTLE_ENDIAN_ORDER;
+ if ($trimOrder) {
+ $value = substr($value, 2);
+ }
+ }
+
+ while (substr($value, -2) == "\0\0") {
+ $value = substr($value, 0, -2);
+ }
+
+ return $value;
+ }
+
+ /**
+ * Reads length amount of bytes from the stream and returns
+ * binary data as hexadecimal string having high nibble first.
+ *
+ * @param integer $length The amount of bytes.
+ * @return string
+ * @throws Zend_Io_Exception if length attribute is negative or
+ * if an I/O error occurs
+ */
+ public final function readHHex($length)
+ {
+ list($hex) = unpack('H*0', $this->read($length));
+ return $hex;
+ }
+
+ /**
+ * Reads length amount of bytes from the stream and returns
+ * binary data as hexadecimal string having low nibble first.
+ *
+ * @param integer $length The amount of bytes.
+ * @return string
+ * @throws Zend_Io_Exception if length attribute is negative or
+ * if an I/O error occurs
+ */
+ public final function readLHex($length)
+ {
+ list($hex) = unpack('h*0', $this->read($length));
+ return $hex;
+ }
+
+ /**
+ * Reads 16 bytes from the stream and returns the little-endian ordered
+ * binary data as mixed-ordered hexadecimal GUID string.
+ *
+ * @return string
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public final function readGuid()
+ {
+ $C = @unpack('V1V/v2v/N2N', $this->read(16));
+ list($hex) = @unpack('H*0', pack
+ ('NnnNN', $C['V'], $C['v1'], $C['v2'], $C['N1'], $C['N2']));
+
+ /* Fixes a bug in PHP versions earlier than Jan 25 2006 */
+ if (implode('', unpack('H*', pack('H*', 'a'))) == 'a00') {
+ $hex = substr($hex, 0, -1);
+ }
+
+ return preg_replace
+ ('/^(.{8})(.{4})(.{4})(.{4})/', "\\1-\\2-\\3-\\4-", $hex);
+ }
+
+ /**
+ * Resets the stream. Attempts to reset it in some way appropriate to the
+ * particular stream, for example by repositioning it to its starting point.
+ *
+ * @return void
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public function reset()
+ {
+ if ($this->_fd === null) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Cannot operate on a closed stream');
+ }
+ fseek($this->_fd, 0);
+ }
+
+ /**
+ * Closes the stream. Once a stream has been closed, further calls to read
+ * methods will throw an exception. Closing a previously-closed stream,
+ * however, has no effect.
+ *
+ * @return void
+ */
+ public function close()
+ {
+ if ($this->_fd !== null) {
+ @fclose($this->_fd);
+ $this->_fd = null;
+ }
+ }
+
+ /**
+ * Returns the current machine endian order.
+ *
+ * @return integer
+ */
+ private function _getEndianess()
+ {
+ if (self::$_endianess === 0) {
+ self::$_endianess = $this->_fromInt32("\x01\x00\x00\x00") == 1 ?
+ self::LITTLE_ENDIAN_ORDER : self::BIG_ENDIAN_ORDER;
+ }
+ return self::$_endianess;
+ }
+
+ /**
+ * Returns whether the current machine endian order is little endian.
+ *
+ * @return boolean
+ */
+ private function _isLittleEndian()
+ {
+ return $this->_getEndianess() == self::LITTLE_ENDIAN_ORDER;
+ }
+
+ /**
+ * Returns whether the current machine endian order is big endian.
+ *
+ * @return boolean
+ */
+ private function _isBigEndian()
+ {
+ return $this->_getEndianess() == self::BIG_ENDIAN_ORDER;
+ }
+
+ /**
+ * Magic function so that $obj->value will work.
+ *
+ * @param string $name The field name.
+ * @return mixed
+ */
+ public function __get($name)
+ {
+ if (method_exists($this, 'get' . ucfirst(strtolower($name)))) {
+ return call_user_func
+ (array($this, 'get' . ucfirst(strtolower($name))));
+ } else {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Unknown 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(strtolower($name)))) {
+ call_user_func
+ (array($this, 'set' . ucfirst(strtolower($name))), $value);
+ } else {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Unknown field: ' . $name);
+ }
+ }
+}
diff --git a/src/Zend/Io/StringReader.php b/src/Zend/Io/StringReader.php
new file mode 100644
index 0000000..46d338c
--- /dev/null
+++ b/src/Zend/Io/StringReader.php
@@ -0,0 +1,86 @@
+
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Io_StringReader extends Zend_Io_Reader
+{
+ /**
+ * Constructs the Zend_Io_StringReader class with given source string.
+ *
+ * @param string $data The string to use as the source.
+ * @param integer $length If the length argument is given,
+ * reading will stop after length bytes have been read or
+ * the end of string is reached, whichever comes first.
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public function __construct($data, $length = null)
+ {
+ if (($this->_fd = fopen('php://memory', 'w+b')) === false) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Unable to open php://memory stream');
+ }
+ if ($data !== null && is_string($data)) {
+ if ($length === null) {
+ $length = strlen($data);
+ }
+ if (($this->_size = fwrite($this->_fd, $data, $length)) === false) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception
+ ('Unable to write data to php://memory stream');
+ }
+ fseek($this->_fd, 0);
+ }
+ }
+
+ /**
+ * Returns the string representation of this class.
+ */
+ public function toString()
+ {
+ $offset = $this->getOffset();
+ $this->setOffset(0);
+ $data = $this->read($this->getSize());
+ $this->setOffset($offset);
+ return $data;
+ }
+
+ /**
+ * Closes the file descriptor.
+ */
+ public function __destruct()
+ {
+ $this->close();
+ }
+}
diff --git a/src/Zend/Io/StringWriter.php b/src/Zend/Io/StringWriter.php
new file mode 100644
index 0000000..b743a2f
--- /dev/null
+++ b/src/Zend/Io/StringWriter.php
@@ -0,0 +1,89 @@
+
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Io_StringWriter extends Zend_Io_Writer
+{
+ /**
+ * Constructs the Zend_Io_StringWriter class with given source string.
+ *
+ * @param string $data The string to use as the source.
+ * @param integer $length If the length argument is given,
+ * reading will stop after length bytes have been read or
+ * the end of string is reached, whichever comes first.
+ * @throws Zend_Io_Exception if an I/O error occurs
+ */
+ public function __construct($data = null, $length = null)
+ {
+ if (($this->_fd = fopen('php://memory', 'w+b')) === false) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Unable to open php://memory stream');
+ }
+ if ($data !== null && is_string($data)) {
+ if ($length === null) {
+ $length = strlen($data);
+ }
+ if (($this->_size = fwrite($this->_fd, $data, $length)) === false) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception
+ ('Unable to write data to php://memory stream');
+ }
+ fseek($this->_fd, 0);
+ }
+ }
+
+ /**
+ * Returns the string representation of this class.
+ */
+ public function toString()
+ {
+ if ($this->getSize() == 0) {
+ return '';
+ }
+ $offset = $this->getOffset();
+ $this->setOffset(0);
+ $data = fread($this->getFileDescriptor(), $this->getSize());
+ $this->setOffset($offset);
+ return $data;
+ }
+
+ /**
+ * Closes the file descriptor.
+ */
+ public function __destruct()
+ {
+ $this->close();
+ }
+}
diff --git a/src/Zend/Io/Writer.php b/src/Zend/Io/Writer.php
new file mode 100644
index 0000000..9359f7c
--- /dev/null
+++ b/src/Zend/Io/Writer.php
@@ -0,0 +1,631 @@
+
+ * @author Ryan Butterfield
+ * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Io_Writer
+{
+ const MACHINE_ENDIAN_ORDER = 0;
+ const LITTLE_ENDIAN_ORDER = 1;
+ const BIG_ENDIAN_ORDER = 2;
+
+ /**
+ * The endianess of the current machine.
+ *
+ * @var integer
+ */
+ private static $_endianess = 0;
+
+ /**
+ * The resource identifier of the stream.
+ *
+ * @var resource
+ */
+ protected $_fd = null;
+
+ /**
+ * Size of the underlying stream.
+ *
+ * @var integer
+ */
+ protected $_size = 0;
+
+ /**
+ * Constructs the Zend_Io_Writer class with given open file descriptor.
+ *
+ * @param resource $fd The file descriptor.
+ * @throws Zend_Io_Exception if file descriptor is not valid
+ */
+ public function __construct($fd)
+ {
+ if (!is_resource($fd) ||
+ !in_array(get_resource_type($fd), array('stream'))) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception
+ ('Invalid resource type (only resources of type stream are supported)');
+ }
+
+ $this->_fd = $fd;
+
+ $offset = $this->getOffset();
+ fseek($this->_fd, 0, SEEK_END);
+ $this->_size = ftell($this->_fd);
+ fseek($this->_fd, $offset);
+ }
+
+ /**
+ * Default destructor.
+ */
+ public function __destruct() {}
+
+ /**
+ * Returns the current point of operation.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public function getOffset()
+ {
+ if ($this->_fd === null) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Cannot operate on a closed stream');
+ }
+ return ftell($this->_fd);
+ }
+
+ /**
+ * Sets the point of operation, ie the cursor offset value. The offset may
+ * also be set to a negative value when it is interpreted as an offset from
+ * the end of the stream instead of the beginning.
+ *
+ * @param integer $offset The new point of operation.
+ * @return void
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public function setOffset($offset)
+ {
+ if ($this->_fd === null) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Cannot operate on a closed stream');
+ }
+ fseek($this->_fd, $offset < 0 ? $this->getSize() + $offset : $offset);
+ }
+
+ /**
+ * Returns the stream size in bytes.
+ *
+ * @return integer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public function getSize()
+ {
+ if ($this->_fd === null) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Cannot operate on a closed stream');
+ }
+ return $this->_size;
+ }
+
+ /**
+ * Sets the stream size in bytes, and truncates if required.
+ *
+ * @param integer $size The new size
+ * @return void
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public function setSize($size)
+ {
+ if ($this->_fd === null) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Cannot operate on a closed stream');
+ }
+ ftruncate($this->_fd, $size);
+ }
+
+ /**
+ * Returns the underlying stream file descriptor.
+ *
+ * @return resource
+ */
+ public function getFileDescriptor()
+ {
+ return $this->_fd;
+ }
+
+ /**
+ * Writes value up to length bytes to the stream.
+ *
+ * @param string $value The value to write to the stream.
+ * @param integer $length The number of bytes to write. Defaults to the
+ * length of the given value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public function write($value, $length = null)
+ {
+ if ($this->_fd === null) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Cannot operate on a closed stream');
+ }
+ if ($length === null) {
+ $length = strlen($value);
+ }
+ fwrite($this->_fd, $value, $length);
+ $this->_size += $length;
+ return $this;
+ }
+
+ /**
+ * Writes an 8-bit integer as binary data to the stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeInt8($value)
+ {
+ return $this->write(pack('c*', $value));
+ }
+
+ /**
+ * Writes an unsigned 8-bit integer as binary data to the stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeUInt8($value)
+ {
+ return $this->write(pack('C*', $value));
+ }
+
+ /**
+ * Returns signed 16-bit integer as machine endian ordered binary data.
+ *
+ * @param integer $value The input value.
+ * @return string
+ */
+ private function _toInt16($value)
+ {
+ return pack('s*', $value);
+ }
+
+ /**
+ * Writes a signed 16-bit integer as little-endian ordered binary data to
+ * the stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeInt16LE($value)
+ {
+ if ($this->_isLittleEndian()) {
+ return $this->write(strrev($this->_toInt16($value)));
+ } else {
+ return $this->write($this->_toInt16($value));
+ }
+ }
+
+ /**
+ * Returns signed 16-bit integer as big-endian ordered binary data to the
+ * stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeInt16BE($value)
+ {
+ if ($this->_isBigEndian()) {
+ return $this->write(strrev($this->_toInt16($value)));
+ } else {
+ return $this->write($this->_toInt16($value));
+ }
+ }
+
+ /**
+ * Writes unsigned 16-bit integer as little-endian ordered binary data
+ * to the stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeUInt16LE($value)
+ {
+ return $this->write(pack('v*', $value));
+ }
+
+ /**
+ * Writes unsigned 16-bit integer as big-endian ordered binary data to the
+ * stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeUInt16BE($value)
+ {
+ return $this->write(pack('n*', $value));
+ }
+
+ /**
+ * Returns signed 32-bit integer as machine-endian ordered binary data.
+ *
+ * @param integer $value The input value.
+ * @return string
+ */
+ private final function _toInt32($value)
+ {
+ return pack('l*', $value);
+ }
+
+ /**
+ * Writes signed 32-bit integer as little-endian ordered binary data to the
+ * stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeInt32LE($value)
+ {
+ if ($this->_isLittleEndian()) {
+ return $this->write(strrev($this->_toInt32($value)));
+ } else {
+ return $this->write($this->_toInt32($value));
+ }
+ }
+
+ /**
+ * Writes signed 32-bit integer as big-endian ordered binary data to the
+ * stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeInt32BE($value)
+ {
+ if ($this->_isBigEndian()) {
+ return $this->write(strrev($this->_toInt32($value)));
+ } else {
+ return $this->write($this->_toInt32($value));
+ }
+ }
+
+ /**
+ * Writes unsigned 32-bit integer as little-endian ordered binary data to
+ * the stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeUInt32LE($value)
+ {
+ return $this->write(pack('V*', $value));
+ }
+
+ /**
+ * Writes unsigned 32-bit integer as big-endian ordered binary data to the
+ * stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeUInt32BE($value)
+ {
+ return $this->write(pack('N*', $value));
+ }
+
+ /**
+ * Writes 64-bit float as little-endian ordered binary data string to the
+ * stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeInt64LE($value)
+ {
+ return $this->write
+ (pack('V*', $value & 0xffffffff, $value / (0xffffffff+1)));
+ }
+
+ /**
+ * Writes 64-bit float as big-endian ordered binary data string to the
+ * stream.
+ *
+ * @param integer $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeInt64BE($value)
+ {
+ return $this->write
+ (pack('N*', $value / (0xffffffff+1), $value & 0xffffffff));
+ }
+
+ /**
+ * Returns a floating point number as machine endian ordered binary data.
+ *
+ * @param float $value The input value.
+ * @return string
+ */
+ private function _toFloat($value)
+ {
+ return pack('f*', $value);
+ }
+
+ /**
+ * Writes a floating point number as little-endian ordered binary data to
+ * the stream.
+ *
+ * @param float $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeFloatLE($value)
+ {
+ if ($this->_isLittleEndian()) {
+ return $this->write(strrev($this->_toFloat($value)));
+ } else {
+ return $this->write($this->_toFloat($value));
+ }
+ }
+
+ /**
+ * Writes a floating point number as big-endian ordered binary data to the
+ * stream.
+ *
+ * @param float $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeFloatBE($value)
+ {
+ if ($this->_isBigEndian()) {
+ return $this->write(strrev($this->_toFloat($value)));
+ } else {
+ return $this->write($this->_toFloat($value));
+ }
+ }
+
+ /**
+ * Writes string as binary data padded to given length with zeros. If
+ * length is smaller than the length of the string, it is
+ * considered as the length of the padding.
+ *
+ * @param string $value The input value.
+ * @param integer $length The length to which to pad the value.
+ * @param string $padding The padding character.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeString8($value, $length = null, $padding = "\0")
+ {
+ if ($length === null) {
+ $length = strlen($value);
+ }
+ if ($length < ($tmp = strlen($value))) {
+ $length = $tmp + $length;
+ }
+ return $this->write(str_pad($value, $length, $padding));
+ }
+
+ /**
+ * Writes the multibyte string as binary data with given byte order mark
+ * (BOM) and padded to given length with zeros. Length is given in unicode
+ * characters so each character adds two zeros to the string. If length is
+ * smaller than the length of the string, it is considered as the length of
+ * the padding.
+ *
+ * If byte order mark is null no mark is inserted to the binary
+ * data.
+ *
+ * @param string $value The input value.
+ * @param integer $order The byte order of the binary data string.
+ * @param integer $length The length to which to pad the value.
+ * @param string $padding The padding character.
+ * @return string
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeString16
+ ($value, $order = null, $length = null, $padding = "\0")
+ {
+ if ($length === null) {
+ $length = (int)(strlen($value) / 2);
+ }
+ if ($length < ($tmp = strlen($value) / 2)) {
+ $length = $tmp + $length;
+ }
+ if ($order == self::BIG_ENDIAN_ORDER &&
+ !(ord($value[0]) == 0xfe && ord($value[1]) == 0xff)) {
+ $value = 0xfeff . $value;
+ $length++;
+ }
+ if ($order == self::LITTLE_ENDIAN_ORDER &&
+ !(ord($value[0]) == 0xff && ord($value[1]) == 0xfe)) {
+ $value = 0xfffe . $value;
+ $length++;
+ }
+ return $this->write(str_pad($value, $length * 2, $padding));
+ }
+
+ /**
+ * Writes hexadecimal string having high nibble first as binary data to the
+ * stream.
+ *
+ * @param string $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if length attribute is negative or
+ * if the stream is closed
+ */
+ public final function writeHHex($value)
+ {
+ return $this->write(pack('H*', $value));
+ }
+
+ /**
+ * Writes hexadecimal string having low nibble first as binary data to the
+ * stream.
+ *
+ * @param string $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if length attribute is negative or
+ * if the stream is closed
+ */
+ public final function writeLHex($value)
+ {
+ return $this->write(pack('h*', $value));
+ }
+
+ /**
+ * Writes big-endian ordered hexadecimal GUID string as little-endian
+ * ordered binary data string to the stream.
+ *
+ * @param string $value The input value.
+ * @return Zend_Io_Writer
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public final function writeGuid($value)
+ {
+ $string = '';
+ $C = preg_split('/-/', $value);
+ return $this->write
+ (pack
+ ('V1v2N2', hexdec($C[0]), hexdec($C[1]), hexdec($C[2]),
+ hexdec($C[3] . substr($C[4], 0, 4)), hexdec(substr($C[4], 4))));
+ }
+
+ /**
+ * Forces write of all buffered output to the underlying resource.
+ *
+ * @return void
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public function flush()
+ {
+ if ($this->_fd === null) {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Cannot operate on a closed stream');
+ }
+ fflush($this->_fd);
+ }
+
+ /**
+ * Closes the stream. Once a stream has been closed, further calls to write
+ * methods will throw an exception. Closing a previously-closed stream,
+ * however, has no effect.
+ *
+ * @return void
+ * @throws Zend_Io_Exception if the stream is closed
+ */
+ public function close()
+ {
+ if ($this->_fd !== null) {
+ @fclose($this->_fd);
+ $this->_fd = null;
+ }
+ }
+
+ /**
+ * Returns the current machine endian order.
+ *
+ * @return integer
+ */
+ private function _getEndianess()
+ {
+ if (self::$_endianess === 0) {
+ self::$_endianess = $this->_toInt32("\x01\x00\x00\x00") == 1 ?
+ self::LITTLE_ENDIAN_ORDER : self::BIG_ENDIAN_ORDER;
+ }
+ return self::$_endianess;
+ }
+
+ /**
+ * Returns whether the current machine endian order is little endian.
+ *
+ * @return boolean
+ */
+ private function _isLittleEndian()
+ {
+ return $this->_getEndianess() == self::LITTLE_ENDIAN_ORDER;
+ }
+
+ /**
+ * Returns whether the current machine endian order is big endian.
+ *
+ * @return boolean
+ */
+ private function _isBigEndian()
+ {
+ return $this->_getEndianess() == self::BIG_ENDIAN_ORDER;
+ }
+
+ /**
+ * Magic function so that $obj->value will work.
+ *
+ * @param string $name The field name.
+ * @return mixed
+ */
+ public function __get($name)
+ {
+ if (method_exists($this, 'get' . ucfirst(strtolower($name)))) {
+ return call_user_func
+ (array($this, 'get' . ucfirst(strtolower($name))));
+ } else {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Unknown 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(strtolower($name)))) {
+ call_user_func
+ (array($this, 'set' . ucfirst(strtolower($name))), $value);
+ } else {
+ require_once('Zend/Io/Exception.php');
+ throw new Zend_Io_Exception('Unknown field: ' . $name);
+ }
+ }
+}
diff --git a/src/Zend/Media/Asf.php b/src/Zend/Media/Asf.php
new file mode 100644
index 0000000..38550a6
--- /dev/null
+++ b/src/Zend/Media/Asf.php
@@ -0,0 +1,214 @@
+
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Media_Asf extends Zend_Media_Asf_Object_Container
+{
+ /** @var string */
+ private $_filename;
+
+ /**
+ * Constructs the ASF class with given file and options.
+ *
+ * The following options are currently recognized:
+ * o encoding -- Indicates the encoding that all the texts are presented
+ * with. By default this is set to utf-8. See the documentation of iconv
+ * for accepted values.
+ * o readonly -- Indicates that the file is read from a temporary location
+ * or another source it cannot be written back to.
+ *
+ * @param string|resource|Zend_Io_Reader $filename The path to the file,
+ * file descriptor of an opened file, or a {@link Zend_Io_Reader} instance.
+ * @param Array $options The options array.
+ */
+ public function __construct($filename, $options = array())
+ {
+ if ($filename instanceof Zend_Io_Reader) {
+ $this->_reader = &$filename;
+ } else {
+ require_once 'Zend/Io/FileReader.php';
+ try {
+ $this->_reader = new Zend_Io_FileReader($filename);
+ } catch (Zend_Io_Exception $e) {
+ $this->_reader = null;
+ require_once 'Zend/Media/Id3/Exception.php';
+ throw new Zend_Media_Asf_Exception($e->getMessage());
+ }
+ if (is_string($filename) && !isset($options['readonly'])) {
+ $this->_filename = $filename;
+ }
+ }
+ $this->setOptions($options);
+ if ($this->getOption('encoding', null) === null) {
+ $this->setOption('encoding', 'utf-8');
+ }
+ $this->setOffset(0);
+ $this->setSize($this->_reader->getSize());
+ $this->constructObjects
+ (array
+ (self::HEADER => 'Header',
+ self::DATA => 'Data',
+ self::SIMPLE_INDEX => 'SimpleIndex',
+ self::INDEX => 'Index',
+ self::MEDIA_OBJECT_INDEX => 'MediaObjectIndex',
+ self::TIMECODE_INDEX => 'TimecodeIndex'));
+ }
+
+ /**
+ * Returns the mandatory header object contained in this file.
+ *
+ * @return Zend_Media_Asf_Object_Header
+ */
+ public function getHeader()
+ {
+ $header = $this->getObjectsByIdentifier(self::HEADER);
+ return $header[0];
+ }
+
+ /**
+ * Returns the mandatory data object contained in this file.
+ *
+ * @return Zend_Media_Asf_Object_Data
+ */
+ public function getData()
+ {
+ $data = $this->getObjectsByIdentifier(self::DATA);
+ return $data[0];
+ }
+
+ /**
+ * Returns an array of index objects contained in this file.
+ *
+ * @return Array
+ */
+ public function getIndices()
+ {
+ return $this->getObjectsByIdentifier
+ (self::SIMPLE_INDEX . '|' . self::INDEX . '|' .
+ self::MEDIA_OBJECT_INDEX . '|' . self::TIMECODE_INDEX);
+ }
+
+ /**
+ * Writes the changes to given media file. All object offsets must be
+ * assumed to be invalid after the write operation.
+ *
+ * @param string $filename The optional path to the file, use null to save
+ * to the same file.
+ */
+ public function write($filename)
+ {
+ if ($filename === null && ($filename = $this->_filename) === null) {
+ require_once 'Zend/Media/Asf/Exception.php';
+ throw new Zend_Media_Asf_Exception
+ ('No file given to write to');
+ } else if ($filename !== null && $this->_filename !== null &&
+ realpath($filename) != realpath($this->_filename) &&
+ !copy($this->_filename, $filename)) {
+ require_once 'Zend/Media/Asf/Exception.php';
+ throw new Zend_Media_Asf_Exception
+ ('Unable to copy source to destination: ' .
+ realpath($this->_filename) . '->' . realpath($filename));
+ }
+
+ if (($fd = fopen
+ ($filename, file_exists($filename) ? 'r+b' : 'wb')) === false) {
+ require_once 'Zend/Media/Asf/Exception.php';
+ throw new Zend_Media_Asf_Exception
+ ('Unable to open file for writing: ' . $filename);
+ }
+
+ $header = $this->getHeader();
+ $headerLengthOld = $header->getSize();
+ $header->removeObjectsByIdentifier(Zend_Media_Asf_Object::PADDING);
+ $header->headerExtension->removeObjectsByIdentifier
+ (Zend_Media_Asf_Object::PADDING);
+
+ require_once 'Zend/Io/StringWriter.php';
+ $buffer = new Zend_Io_StringWriter();
+ $header->write($buffer);
+ $headerData = $buffer->toString();
+ $headerLengthNew = $header->getSize();
+
+ // Fits right in
+ if ($headerLengthOld == $headerLengthNew) {
+ }
+
+ // Fits with adjusted padding
+ else if ($headerLengthOld >= $headerLengthNew + 24 /* for header */) {
+ $header->headerExtension->padding->setSize
+ ($headerLengthOld - $headerLengthNew);
+ $buffer = new Zend_Io_StringWriter();
+ $header->write($buffer);
+ $headerData = $buffer->toString();
+ $headerLengthNew = $header->getSize();
+ }
+
+ // Must expand
+ else {
+ $header->headerExtension->padding->setSize(4096);
+ $buffer = new Zend_Io_StringWriter();
+ $header->write($buffer);
+ $headerData = $buffer->toString();
+ $headerLengthNew = $header->getSize();
+
+ fseek($fd, 0, SEEK_END);
+ $oldFileSize = ftell($fd);
+ ftruncate
+ ($fd, $newFileSize = $headerLengthNew - $headerLengthOld +
+ $oldFileSize);
+ for ($i = 1, $cur = $oldFileSize; $cur > 0; $cur -= 1024, $i++) {
+ fseek($fd, -(($i * 1024) +
+ ($newFileSize - $oldFileSize)), SEEK_END);
+ $buffer = fread($fd, 1024);
+ fseek($fd, -($i * 1024), SEEK_END);
+ fwrite($fd, $buffer, 1024);
+ }
+ }
+
+ fseek($fd, 0);
+ fwrite($fd, $headerData, $headerLengthNew);
+ fclose($fd);
+ }
+}
diff --git a/src/Zend/Media/Asf/Exception.php b/src/Zend/Media/Asf/Exception.php
new file mode 100644
index 0000000..f17474e
--- /dev/null
+++ b/src/Zend/Media/Asf/Exception.php
@@ -0,0 +1,40 @@
+
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+class Zend_Media_Asf_Exception extends Zend_Media_Exception
+{}
diff --git a/src/Zend/Media/Asf/Object.php b/src/Zend/Media/Asf/Object.php
new file mode 100644
index 0000000..830dfd5
--- /dev/null
+++ b/src/Zend/Media/Asf/Object.php
@@ -0,0 +1,322 @@
+
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+abstract class Zend_Media_Asf_Object
+{
+ /* ASF Objects */
+ const HEADER = '75b22630-668e-11cf-a6d9-00aa0062ce6c';
+ const DATA = '75b22636-668e-11cf-a6d9-00aa0062ce6c';
+ const SIMPLE_INDEX = '33000890-e5b1-11cf-89f4-00a0c90349cb';
+ const INDEX = 'd6e229d3-35da-11d1-9034-00a0c90349be';
+ const MEDIA_OBJECT_INDEX = 'feb103f8-12ad-4c64-840f-2a1d2f7ad48c';
+ const TIMECODE_INDEX = '3cb73fd0-0c4a-4803-953d-edf7b6228f0c';
+
+ /* Header Objects */
+ const FILE_PROPERTIES = '8cabdca1-a947-11cf-8ee4-00c00c205365';
+ const STREAM_PROPERTIES = 'b7dc0791-a9b7-11cf-8ee6-00c00c205365';
+ const HEADER_EXTENSION = '5fbf03b5-a92e-11cf-8ee3-00c00c205365';
+ const CODEC_LIST = '86d15240-311d-11d0-a3a4-00a0c90348f6';
+ const SCRIPT_COMMAND = '1efb1a30-0b62-11d0-a39b-00a0c90348f6';
+ const MARKER = 'f487cd01-a951-11cf-8ee6-00c00c205365';
+ const BITRATE_MUTUAL_EXCLUSION = 'd6e229dc-35da-11d1-9034-00a0c90349be';
+ const ERROR_CORRECTION = '75b22635-668e-11cf-a6d9-00aa0062ce6c';
+ const CONTENT_DESCRIPTION = '75b22633-668e-11cf-a6d9-00aa0062ce6c';
+ const EXTENDED_CONTENT_DESCRIPTION = 'd2d0a440-e307-11d2-97f0-00a0c95ea850';
+ const CONTENT_BRANDING = '2211b3fa-bd23-11d2-b4b7-00a0c955fc6e';
+ const STREAM_BITRATE_PROPERTIES = '7bf875ce-468d-11d1-8d82-006097c9a2b2';
+ const CONTENT_ENCRYPTION = '2211b3fb-bd23-11d2-b4b7-00a0c955fc6e';
+ const EXTENDED_CONTENT_ENCRYPTION = '298ae614-2622-4c17-b935-dae07ee9289c';
+ const DIGITAL_SIGNATURE = '2211b3fc-bd23-11d2-b4b7-00a0c955fc6e';
+ const PADDING = '1806d474-cadf-4509-a4ba-9aabcb96aae8';
+
+ /* Header Extension Objects */
+ const EXTENDED_STREAM_PROPERTIES = '14e6a5cb-c672-4332-8399-a96952065b5a';
+ const ADVANCED_MUTUAL_EXCLUSION = 'a08649cf-4775-4670-8a16-6e35357566cd';
+ const GROUP_MUTUAL_EXCLUSION = 'd1465a40-5a79-4338-b71b-e36b8fd6c249';
+ const STREAM_PRIORITIZATION = 'd4fed15b-88d3-454f-81f0-ed5c45999e24';
+ const BANDWIDTH_SHARING = 'a69609e6-517b-11d2-b6af-00c04fd908e9';
+ const LANGUAGE_LIST = '7c4346a9-efe0-4bfc-b229-393ede415c85';
+ const METADATA = 'c5f8cbea-5baf-4877-8467-aa8c44fa4cca';
+ const METADATA_LIBRARY = '44231c94-9498-49d1-a141-1d134e457054';
+ const INDEX_PARAMETERS = 'd6e229df-35da-11d1-9034-00a0c90349be';
+ const MEDIA_OBJECT_INDEX_PARAMETERS =
+ '6b203bad-3f11-48e4-aca8-d7613de2cfa7';
+ const TIMECODE_INDEX_PARAMETERS = 'f55e496d-9797-4b5d-8c8b-604dfe9bfb24';
+ const COMPATIBILITY = '75b22630-668e-11cf-a6d9-00aa0062ce6c';
+ const ADVANCED_CONTENT_ENCRYPTION = '43058533-6981-49e6-9b74-ad12cb86d58c';
+
+ /**
+ * The reader object.
+ *
+ * @var Zend_Io_Reader
+ */
+ protected $_reader;
+
+ /**
+ * The options array.
+ *
+ * @var Array
+ */
+ protected $_options;
+
+ /** @var integer */
+ private $_offset = false;
+
+ /** @var string */
+ private $_identifier = false;
+
+ /** @var integer */
+ private $_size = false;
+
+ /** @var Zend_Media_Asf_Object */
+ private $_parent = null;
+
+ /**
+ * Constructs the class with given parameters and options.
+ *
+ * @param Zend_Io_Reader $reader The reader object.
+ * @param Array $options The options array.
+ */
+ public function __construct($reader, &$options = array())
+ {
+ $this->_reader = $reader;
+ $this->_options = &$options;
+
+ if (($this->_reader = $reader) === null) {
+ if (defined($constant = 'self::' . strtoupper
+ (preg_replace
+ ('/(?<=[a-z])[A-Z]/', '_$0', substr(get_class($this), 22))))) {
+ $this->_identifier = constant($constant);
+ } else {
+ require_once 'Zend/Media/Asf/Exception.php';
+ throw new Zend_Media_Asf_Exception
+ ('Object identifier could not be determined');
+ }
+ } else {
+ $this->_offset = $this->_reader->getOffset();
+ $this->_identifier = $this->_reader->readGuid();
+ $this->_size = $this->_reader->readInt64LE();
+ }
+ }
+
+ /**
+ * 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 = null)
+ {
+ if (isset($this->_options[$option])) {
+ return $this->_options[$option];
+ }
+ return $defaultValue;
+ }
+
+ /**
+ * Sets the options array. See {@link Zend_Media_Asf} 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;
+ }
+
+ /**
+ * Clears the given option value.
+ *
+ * @param string $option The name of the option.
+ */
+ public final function clearOption($option)
+ {
+ unset($this->_options[$option]);
+ }
+
+ /**
+ * Returns the file offset to object start, or false if the
+ * object was created on heap.
+ *
+ * @return integer
+ */
+ public final function getOffset()
+ {
+ return $this->_offset;
+ }
+
+ /**
+ * Sets the file offset where the object starts.
+ *
+ * @param integer $offset The file offset to object start.
+ */
+ public final function setOffset($offset)
+ {
+ $this->_offset = $offset;
+ }
+
+ /**
+ * Returns the GUID of the ASF object.
+ *
+ * @return string
+ */
+ public final function getIdentifier()
+ {
+ return $this->_identifier;
+ }
+
+ /**
+ * Set the GUID of the ASF object.
+ *
+ * @param string $identifier The GUID
+ */
+ public final function setIdentifier($identifier)
+ {
+ $this->_identifier = $identifier;
+ }
+
+ /**
+ * Returns the object size in bytes, including the header.
+ *
+ * @return integer
+ */
+ public final function getSize()
+ {
+ return $this->_size;
+ }
+
+ /**
+ * Sets the object size. The size must include the 24 byte header.
+ *
+ * @param integer $size The object 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 parent object containing this object.
+ *
+ * @return Zend_Media_Asf_Object
+ */
+ public final function getParent()
+ {
+ return $this->_parent;
+ }
+
+ /**
+ * Sets the parent containing object.
+ *
+ * @param Zend_Media_Asf_Object $parent The parent object.
+ */
+ public final function setParent(&$parent)
+ {
+ $this->_parent = $parent;
+ }
+
+ /**
+ * Writes the object data.
+ *
+ * @param Zend_Io_Writer $writer The writer object.
+ * @return void
+ */
+ abstract public function write($writer);
+
+ /**
+ * Magic function so that $obj->value will work. The method will attempt to
+ * invoke a getter method. If there are no getter methods with given name,
+ * an exception is thrown.
+ *
+ * @param string $name The field name.
+ * @return mixed
+ */
+ public function __get($name)
+ {
+ if (method_exists($this, 'get' . ucfirst($name))) {
+ return call_user_func(array($this, 'get' . ucfirst($name)));
+ }
+ if (method_exists($this, 'is' . ucfirst($name))) {
+ return call_user_func(array($this, 'is' . ucfirst($name)));
+ }
+ require_once 'Zend/Media/Asf/Exception.php';
+ throw new Zend_Media_Asf_Exception('Unknown 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 {
+ require_once 'Zend/Media/Asf/Exception.php';
+ throw new Zend_Media_Asf_Exception('Unknown field: ' . $name);
+ }
+ }
+}
diff --git a/src/Zend/Media/Asf/Object/AdvancedContentEncryption.php b/src/Zend/Media/Asf/Object/AdvancedContentEncryption.php
new file mode 100644
index 0000000..d2c3bf9
--- /dev/null
+++ b/src/Zend/Media/Asf/Object/AdvancedContentEncryption.php
@@ -0,0 +1,168 @@
+Advanced Content Encryption Object lets authors protect content by
+ * using Next Generation Windows Media Digital Rights Management for Network
+ * Devices.
+ *
+ * @category Zend
+ * @package Zend_Media
+ * @subpackage ASF
+ * @author Sven Vollbehr
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+final class Zend_Media_Asf_Object_AdvancedContentEncryption
+ extends Zend_Media_Asf_Object
+{
+ const WINDOWS_MEDIA_DRM_NETWORK_DEVICES =
+ '7a079bb6-daa4-4e12-a5ca-91d3 8dc11a8d';
+
+ /** @var Array */
+ private $_contentEncryptionRecords = array();
+
+ /**
+ * Constructs the class with given parameters and reads object related data
+ * from the ASF file.
+ *
+ * @param Zend_Io_Reader $reader The reader object.
+ * @param Array $options The options array.
+ */
+ public function __construct($reader, &$options = array())
+ {
+ parent::__construct($reader, $options);
+ $contentEncryptionRecordsCount = $this->_reader->readUInt16LE();
+ for ($i = 0; $i < $contentEncryptionRecordsCount; $i++) {
+ $entry = array('systemId' => $this->_reader->readGuid(),
+ 'systemVersion' => $this->_reader->readUInt32LE(),
+ 'streamNumbers' => array());
+ $encryptedObjectRecordCount = $this->_reader->readUInt16LE();
+ for ($j = 0; $j < $encryptedObjectRecordCount; $j++) {
+ $this->_reader->skip(4);
+ $entry['streamNumbers'][] = $this->_reader->readUInt16LE();
+ }
+ $dataCount = $this->_reader->readUInt32LE();
+ $entry['data'] = $this->_reader->read($dataCount);
+ $this->_contentEncryptionRecords[] = $entry;
+ }
+ }
+
+ /**
+ * Returns an array of content encryption records. Each record consists of
+ * the following keys.
+ *
+ * o systemId -- Specifies the unique identifier for the content
+ * encryption system.
+ *
+ * o systemVersion -- Specifies the version of the content encryption
+ * system.
+ *
+ * o streamNumbers -- An array of stream numbers a particular Content
+ * Encryption Record is associated with. A value of 0 in this field
+ * indicates that it applies to the whole file; otherwise, the entry
+ * applies only to the indicated stream number.
+ *
+ * o data -- The content protection data for this Content Encryption
+ * Record.
+ *
+ * @return Array
+ */
+ public function getContentEncryptionRecords()
+ {
+ return $this->_contentEncryptionRecords;
+ }
+
+ /**
+ * Sets the array of content encryption records. Each record must consist of
+ * the following keys.
+ *
+ * o systemId -- Specifies the unique identifier for the content
+ * encryption system.
+ *
+ * o systemVersion -- Specifies the version of the content encryption
+ * system.
+ *
+ * o streamNumbers -- An array of stream numbers a particular Content
+ * Encryption Record is associated with. A value of 0 in this field
+ * indicates that it applies to the whole file; otherwise, the entry
+ * applies only to the indicated stream number.
+ *
+ * o data -- The content protection data for this Content Encryption
+ * Record.
+ *
+ * @param Array $contentEncryptionRecords The array of content encryption
+ * records.
+ */
+ public function setContentEncryptionRecords($contentEncryptionRecords)
+ {
+ $this->_contentEncryptionRecords = $contentEncryptionRecords;
+ }
+
+ /**
+ * Writes the object data.
+ *
+ * @param Zend_Io_Writer $writer The writer object.
+ * @return void
+ */
+ public function write($writer)
+ {
+ require_once 'Zend/Io/StringWriter.php';
+ $contentEncryptionRecordsCount =
+ count($this->_contentEncryptionRecords);
+ $contentEncryptionRecordsWriter = new Zend_Io_StringWriter();
+ for ($i = 0; $i < $contentEncryptionRecordsCount; $i++) {
+ $contentEncryptionRecordsWriter
+ ->writeGuid($this->_contentEncryptionRecords['systemId'])
+ ->writeUInt32LE
+ ($this->_contentEncryptionRecords['systemVersion'])
+ ->writeUInt16LE
+ ($encryptedObjectRecordCount =
+ $this->_contentEncryptionRecords['streamNumbers']);
+ for ($j = 0; $j < $encryptedObjectRecordCount; $j++) {
+ $contentEncryptionRecordsWriter
+ ->writeUInt16LE(1)
+ ->writeUInt16LE(2)
+ ->writeUInt16LE
+ ($this->_contentEncryptionRecords['streamNumbers'][$j]);
+ }
+ $contentEncryptionRecordsWriter
+ ->writeUInt32LE
+ (strlen($this->_contentEncryptionRecords['data']))
+ ->write($this->_contentEncryptionRecords['data']);
+ }
+
+ $this->setSize
+ (24 /* for header */ + 2 +
+ $contentEncryptionRecordsWriter->getSize());
+
+ $writer->writeGuid($this->getIdentifier())
+ ->writeInt64LE($this->getSize())
+ ->writeUInt16LE($contentEncryptionRecordsCount)
+ ->write($contentEncryptionRecordsWriter->toString());
+ }
+}
diff --git a/src/Zend/Media/Asf/Object/AdvancedMutualExclusion.php b/src/Zend/Media/Asf/Object/AdvancedMutualExclusion.php
new file mode 100644
index 0000000..e74166a
--- /dev/null
+++ b/src/Zend/Media/Asf/Object/AdvancedMutualExclusion.php
@@ -0,0 +1,140 @@
+Advanced Mutual Exclusion Object identifies streams that have a
+ * mutual exclusion relationship to each other (in other words, only one of the
+ * streams within such a relationship can be streamed—the rest are ignored).
+ * There should be one instance of this object for each set of objects that
+ * contain a mutual exclusion relationship. The exclusion type is used so that
+ * implementations can allow user selection of common choices, such as language.
+ * This object must be used if any of the streams in the mutual exclusion
+ * relationship are hidden.
+ *
+ * @category Zend
+ * @package Zend_Media
+ * @subpackage ASF
+ * @author Sven Vollbehr
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+final class Zend_Media_Asf_Object_AdvancedMutualExclusion
+ extends Zend_Media_Asf_Object
+{
+ const MUTEX_LANGUAGE = 'd6e22a00-35da-11d1-9034-00a0c90349be';
+ const MUTEX_BITRATE = 'd6e22a01-35da-11d1-9034-00a0c90349be';
+ const MUTEX_UNKNOWN = 'd6e22a02-35da-11d1-9034-00a0c90349be';
+
+ /** @var string */
+ private $_exclusionType;
+
+ /** @var Array */
+ private $_streamNumbers = array();
+
+ /**
+ * Constructs the class with given parameters and reads object related data
+ * from the ASF file.
+ *
+ * @param Zend_Io_Reader $reader The reader object.
+ * @param Array $options The options array.
+ */
+ public function __construct($reader = null, &$options = array())
+ {
+ parent::__construct($reader, $options);
+
+ if ($reader === null) {
+ return;
+ }
+
+ $this->_exclusionType = $this->_reader->readGuid();
+ $streamNumbersCount = $this->_reader->readUInt16LE();
+ for ($i = 0; $i < $streamNumbersCount; $i++) {
+ $this->_streamNumbers[] = $this->_reader->readUInt16LE();
+ }
+ }
+
+ /**
+ * Returns the nature of the mutual exclusion relationship.
+ *
+ * @return string
+ */
+ public function getExclusionType()
+ {
+ return $this->_exclusionType;
+ }
+
+ /**
+ * Returns the nature of the mutual exclusion relationship.
+ *
+ * @return string
+ */
+ public function setExclusionType($exclusionType)
+ {
+ $this->_exclusionType = $exclusionType;
+ }
+
+ /**
+ * Returns an array of stream numbers.
+ *
+ * @return Array
+ */
+ public function getStreamNumbers()
+ {
+ return $this->_streamNumbers;
+ }
+
+ /**
+ * Sets the array of stream numbers.
+ *
+ * @return Array
+ */
+ public function setStreamNumbers($streamNumbers)
+ {
+ $this->_streamNumbers = $streamNumbers;
+ }
+
+ /**
+ * Writes the object data.
+ *
+ * @param Zend_Io_Writer $writer The writer object.
+ * @return void
+ */
+ public function write($writer)
+ {
+ $streamNumbersCount = count($this->_streamNumbers);
+
+ $this->setSize(24 /* for header */ + 18 + $streamNumbersCount * 2);
+
+ $writer->writeGuid($this->getIdentifier())
+ ->writeInt64LE($this->getSize())
+ ->writeGuid($this->_exclusionType)
+ ->writeUInt16LE($streamNumbersCount);
+ for ($i = 0; $i < $streamNumbersCount; $i++) {
+ $writer->writeUInt16LE($this->_streamNumbers[$i]);
+ }
+ }
+}
diff --git a/src/Zend/Media/Asf/Object/BandwidthSharing.php b/src/Zend/Media/Asf/Object/BandwidthSharing.php
new file mode 100644
index 0000000..e3a8e1a
--- /dev/null
+++ b/src/Zend/Media/Asf/Object/BandwidthSharing.php
@@ -0,0 +1,217 @@
+Bandwidth Sharing Object indicates streams that share bandwidth in
+ * such a way that the maximum bandwidth of the set of streams is less than the
+ * sum of the maximum bandwidths of the individual streams. There should be one
+ * instance of this object for each set of objects that share bandwidth. Whether
+ * or not this object can be used meaningfully is content-dependent.
+ *
+ * @category Zend
+ * @package Zend_Media
+ * @subpackage ASF
+ * @author Sven Vollbehr
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+final class Zend_Media_Asf_Object_BandwidthSharing extends Zend_Media_Asf_Object
+{
+ const SHARING_EXCLUSIVE = 'af6060aa-5197-11d2-b6af-00c04fd908e9';
+ const SHARING_PARTIAL = 'af6060ab-5197-11d2-b6af-00c04fd908e9';
+
+ /** @var string */
+ private $_sharingType;
+
+ /** @var integer */
+ private $_dataBitrate;
+
+ /** @var integer */
+ private $_bufferSize;
+
+ /** @var Array */
+ private $_streamNumbers = array();
+
+ /**
+ * Constructs the class with given parameters and reads object related data
+ * from the ASF file.
+ *
+ * @param Zend_Io_Reader $reader The reader object.
+ * @param Array $options The options array.
+ */
+ public function __construct($reader, &$options = array())
+ {
+ parent::__construct($reader = null, $options);
+
+ if ($reader === null) {
+ return;
+ }
+
+ $this->_sharingType = $this->_reader->readGuid();
+ $this->_dataBitrate = $this->_reader->readUInt32LE();
+ $this->_bufferSize = $this->_reader->readUInt32LE();
+ $streamNumbersCount = $this->_reader->readUInt16LE();
+ for ($i = 0; $i < $streamNumbersCount; $i++) {
+ $this->_streamNumbers[] = $this->_reader->readUInt16LE();
+ }
+ }
+
+ /**
+ * Returns the type of sharing relationship for this object. Two types are
+ * predefined: SHARING_PARTIAL, in which any number of the streams in the
+ * relationship may be streaming data at any given time; and
+ * SHARING_EXCLUSIVE, in which only one of the streams in the relationship
+ * may be streaming data at any given time.
+ *
+ * @return string
+ */
+ public function getSharingType()
+ {
+ return $this->_sharingType;
+ }
+
+ /**
+ * Sets the type of sharing relationship for this object. Two types are
+ * predefined: SHARING_PARTIAL, in which any number of the streams in the
+ * relationship may be streaming data at any given time; and
+ * SHARING_EXCLUSIVE, in which only one of the streams in the relationship
+ * may be streaming data at any given time.
+ *
+ * @return string
+ */
+ public function setSharingType($sharingType)
+ {
+ $this->_sharingType = $sharingType;
+ }
+
+ /**
+ * Returns the leak rate R, in bits per second, of a leaky bucket that
+ * contains the data portion of all of the streams, excluding all ASF Data
+ * Packet overhead, without overflowing. The size of the leaky bucket is
+ * specified by the value of the Buffer Size field. This value can be less
+ * than the sum of all of the data bit rates in the
+ * {@link Zend_Media_Asf_Object_ExtendedStreamProperties Extended Stream
+ * Properties} Objects for the streams contained in this bandwidth-sharing
+ * relationship.
+ *
+ * @return integer
+ */
+ public function getDataBitrate()
+ {
+ return $this->_dataBitrate;
+ }
+
+ /**
+ * Sets the leak rate R, in bits per second, of a leaky bucket that contains
+ * the data portion of all of the streams, excluding all ASF Data Packet
+ * overhead, without overflowing. The size of the leaky bucket is specified
+ * by the value of the Buffer Size field. This value can be less than the
+ * sum of all of the data bit rates in the
+ * {@link Zend_Media_Asf_Object_ExtendedStreamProperties Extended Stream
+ * Properties} Objects for the streams contained in this bandwidth-sharing
+ * relationship.
+ *
+ * @param integer $dataBitrate The data bitrate.
+ */
+ public function setDataBitrate($dataBitrate)
+ {
+ $this->_dataBitrate = $dataBitrate;
+ }
+
+ /**
+ * Specifies the size B, in bits, of the leaky bucket used in the Data
+ * Bitrate definition. This value can be less than the sum of all of the
+ * buffer sizes in the
+ * {@link Zend_Media_Asf_Object_ExtendedStreamProperties Extended Stream
+ * Properties} Objects for the streams contained in this bandwidth-sharing
+ * relationship.
+ *
+ * @return integer
+ */
+ public function getBufferSize()
+ {
+ return $this->_bufferSize;
+ }
+
+ /**
+ * Sets the size B, in bits, of the leaky bucket used in the Data Bitrate
+ * definition. This value can be less than the sum of all of the buffer
+ * sizes in the
+ * {@link Zend_Media_Asf_Object_ExtendedStreamProperties Extended Stream
+ * Properties} Objects for the streams contained in this bandwidth-sharing
+ * relationship.
+ *
+ * @param integer $bufferSize The buffer size.
+ */
+ public function setBufferSize($bufferSize)
+ {
+ $this->_bufferSize = $bufferSize;
+ }
+
+ /**
+ * Returns an array of stream numbers.
+ *
+ * @return Array
+ */
+ public function getStreamNumbers()
+ {
+ return $this->_streamNumbers;
+ }
+
+ /**
+ * Sets the array of stream numbers.
+ *
+ * @param Array $streamNumbers The array of stream numbers.
+ */
+ public function setStreamNumbers($streamNumbers)
+ {
+ $this->_streamNumbers = $streamNumbers;
+ }
+
+ /**
+ * Writes the object data.
+ *
+ * @param Zend_Io_Writer $writer The writer object.
+ * @return void
+ */
+ public function write($writer)
+ {
+ $streamNumbersCount = count($this->_streamNumber);
+
+ $this->setSize(24 /* for header */ + 28 + $streamNumbersCount * 2);
+
+ $writer->writeGuid($this->getIdentifier())
+ ->writeInt64LE($this->getSize())
+ ->writeGuid($this->_sharingType)
+ ->writeUInt32LE($this->_dataBitrate)
+ ->writeUInt32LE($this->_bufferSize)
+ ->writeUInt16LE($streamNumbersCount);
+ for ($i = 0; $i < $streamNumbersCount; $i++) {
+ $writer->writeUInt16LE($this->_streamNumbers[$i]);
+ }
+ }
+}
diff --git a/src/Zend/Media/Asf/Object/BitrateMutualExclusion.php b/src/Zend/Media/Asf/Object/BitrateMutualExclusion.php
new file mode 100644
index 0000000..eb5e4d7
--- /dev/null
+++ b/src/Zend/Media/Asf/Object/BitrateMutualExclusion.php
@@ -0,0 +1,141 @@
+Bitrate Mutual Exclusion Object identifies video streams that have
+ * a mutual exclusion relationship to each other (in other words, only one of
+ * the streams within such a relationship can be streamed at any given time and
+ * the rest are ignored). One instance of this object must be present for each
+ * set of objects that contains a mutual exclusion relationship. All video
+ * streams in this relationship must have the same frame size. The exclusion
+ * type is used so that implementations can allow user selection of common
+ * choices, such as bit rate.
+ *
+ * @category Zend
+ * @package Zend_Media
+ * @subpackage ASF
+ * @author Sven Vollbehr
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+final class Zend_Media_Asf_Object_BitrateMutualExclusion
+ extends Zend_Media_Asf_Object
+{
+ const MUTEX_LANGUAGE = 'd6e22a00-35da-11d1-9034-00a0c90349be';
+ const MUTEX_BITRATE = 'd6e22a01-35da-11d1-9034-00a0c90349be';
+ const MUTEX_UNKNOWN = 'd6e22a02-35da-11d1-9034-00a0c90349be';
+
+ /** @var string */
+ private $_exclusionType;
+
+ /** @var Array */
+ private $_streamNumbers = array();
+
+ /**
+ * Constructs the class with given parameters and reads object related data
+ * from the ASF file.
+ *
+ * @param Zend_Io_Reader $reader The reader object.
+ * @param Array $options The options array.
+ */
+ public function __construct($reader = null, &$options = array())
+ {
+ parent::__construct($reader, $options);
+
+ if ($reader === null) {
+ return;
+ }
+
+ $this->_exclusionType = $this->_reader->readGuid();
+ $streamNumbersCount = $this->_reader->readUInt16LE();
+ for ($i = 0; $i < $streamNumbersCount; $i++) {
+ $this->_streamNumbers[] = $this->_reader->readUInt16LE();
+ }
+ }
+
+ /**
+ * Returns the nature of the mutual exclusion relationship.
+ *
+ * @return string
+ */
+ public function getExclusionType()
+ {
+ return $this->_exclusionType;
+ }
+
+ /**
+ * Sets the nature of the mutual exclusion relationship.
+ *
+ * @param string $exclusionType The nature of the mutual exclusion
+ * relationship.
+ */
+ public function setExclusionType($exclusionType)
+ {
+ $this->_exclusionType = $exclusionType;
+ }
+
+ /**
+ * Returns an array of stream numbers.
+ *
+ * @return Array
+ */
+ public function getStreamNumbers()
+ {
+ return $this->_streamNumbers;
+ }
+
+ /**
+ * Sets the array of stream numbers.
+ *
+ * @param Array $streamNumbers The array of stream numbers.
+ */
+ public function setStreamNumbers($streamNumbers)
+ {
+ $this->_streamNumbers = $streamNumbers;
+ }
+
+ /**
+ * Writes the object data.
+ *
+ * @param Zend_Io_Writer $writer The writer object.
+ * @return void
+ */
+ public function write($writer)
+ {
+ $streamNumbersCount = count($this->_streamNumbers);
+
+ $this->setSize(24 /* for header */ + 18 + $streamNumbersCount * 2);
+
+ $writer->writeGuid($this->getIdentifier())
+ ->writeInt64LE($this->getSize())
+ ->writeGuid($this->_exclusionType)
+ ->writeUInt16LE($streamNumbersCount);
+ for ($i = 0; $i < $streamNumbersCount; $i++) {
+ $writer->writeUInt16LE($this->_streamNumbers[$i]);
+ }
+ }
+}
diff --git a/src/Zend/Media/Asf/Object/CodecList.php b/src/Zend/Media/Asf/Object/CodecList.php
new file mode 100644
index 0000000..798b406
--- /dev/null
+++ b/src/Zend/Media/Asf/Object/CodecList.php
@@ -0,0 +1,165 @@
+Codec List Object provides user-friendly information about the
+ * codecs and formats used to encode the content found in the ASF file.
+ *
+ * @category Zend
+ * @package Zend_Media
+ * @subpackage ASF
+ * @author Sven Vollbehr
+ * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @version $Id$
+ */
+final class Zend_Media_Asf_Object_CodecList extends Zend_Media_Asf_Object
+{
+ const VIDEO_CODEC = 0x1;
+ const AUDIO_CODEC = 0x2;
+ const UNKNOWN_CODEC = 0xffff;
+
+ /** @var string */
+ private $_reserved;
+
+ /** @var Array */
+ private $_entries = array();
+
+ /**
+ * Constructs the class with given parameters and reads object related data
+ * from the ASF file.
+ *
+ * @param Zend_Io_Reader $reader The reader object.
+ * @param Array $options The options array.
+ */
+ public function __construct($reader = null, &$options = array())
+ {
+ parent::__construct($reader, $options);
+
+ if ($reader === null) {
+ return;
+ }
+
+ $this->_reserved = $this->_reader->readGuid();
+ $codecEntriesCount = $this->_reader->readUInt32LE();
+ for ($i = 0; $i < $codecEntriesCount; $i++) {
+ $entry = array('type' => $this->_reader->readUInt16LE());
+ $codecNameLength = $this->_reader->readUInt16LE() * 2;
+ $entry['codecName'] = iconv
+ ('utf-16le', $this->getOption('encoding'),
+ $this->_reader->readString16($codecNameLength));
+ $codecDescriptionLength = $this->_reader->readUInt16LE() * 2;
+ $entry['codecDescription'] = iconv
+ ('utf-16le', $this->getOption('encoding'),
+ $this->_reader->readString16($codecDescriptionLength));
+ $codecInformationLength = $this->_reader->readUInt16LE();
+ $entry['codecInformation'] =
+ $this->_reader->read($codecInformationLength);
+ $this->_entries[] = $entry;
+ }
+ }
+
+ /**
+ * Returns the array of codec entries. Each record consists of the following
+ * keys.
+ *
+ * o type -- Specifies the type of the codec used. Use one of the
+ * following values: VIDEO_CODEC, AUDIO_CODEC, or UNKNOWN_CODEC.
+ *
+ * o codecName -- Specifies the name of the codec used to create the
+ * content.
+ *
+ * o codecDescription -- Specifies the description of the format used to
+ * create the content.
+ *
+ * o codecInformation -- Specifies an opaque array of information bytes
+ * about the codec used to create the content. The meaning of these
+ * bytes is determined by the codec.
+ *
+ * @return Array
+ */
+ public function getEntries()
+ {
+ return $this->_entries;
+ }
+
+ /**
+ * Sets the array of codec entries. Each record must consist of the
+ * following keys.
+ *
+ * o codecName -- Specifies the name of the codec used to create the
+ * content.
+ *
+ * o codecDescription -- Specifies the description of the format used to
+ * create the content.
+ *
+ * o codecInformation -- Specifies an opaque array of information bytes
+ * about the codec used to create the content. The meaning of these
+ * bytes is determined by the codec.
+ *
+ * @param Array $entries The array of codec entries.
+ */
+ public function setEntries($entries)
+ {
+ $this->_entries = $entries;
+ }
+
+ /**
+ * Writes the object data.
+ *
+ * @param Zend_Io_Writer $writer The writer object.
+ * @return void
+ */
+ public function write($writer)
+ {
+ require_once 'Zend/Io/StringWriter.php';
+ $codecEntriesCount = count($this->_entries);
+ $codecEntriesWriter = new Zend_Io_StringWriter();
+ for ($i = 0; $i < $codecEntriesCount; $i++) {
+ $codecEntriesWriter
+ ->writeUInt16LE($this->_entries[$i]['type'])
+ ->writeUInt16LE(strlen($codecName = iconv
+ ($this->getOption('encoding'), 'utf-16le',
+ $this->_entries[$i]['codecName']) . "\0\0") / 2)
+ ->writeString16($codecName)
+ ->writeUInt16LE(strlen($codecDescription = iconv
+ ($this->getOption('encoding'), 'utf-16le',
+ $this->_entries[$i]['codecDescription']) . "\0\0") / 2)
+ ->writeString16($codecDescription)
+ ->writeUInt16LE(strlen($this->_entries[$i]['codecInformation']))
+ ->write($this->_entries[$i]['codecInformation']);
+ }
+
+ $this->setSize
+ (24 /* for header */ + 20 + $codecEntriesWriter->getSize());
+
+ $writer->writeGuid($this->getIdentifier())
+ ->writeInt64LE($this->getSize())
+ ->writeGuid($this->_reserved)
+ ->writeUInt32LE($codecEntriesCount)
+ ->write($codecEntriesWriter->toString());
+ }
+}
diff --git a/src/Zend/Media/Asf/Object/Compatibility.php b/src/Zend/Media/Asf/Object/Compatibility.php
new file mode 100644
index 0000000..913508a
--- /dev/null
+++ b/src/Zend/Media/Asf/Object/Compatibility.php
@@ -0,0 +1,120 @@
+Compatibility Object is reserved for future use.
+ *
+ * @category Zend
+ * @package Zend_Media
+ * @subpackage ASF
+ * @author Sven Vollbehr