Extended Stream Properties Object defines additional optional
* properties and characteristics of a digital media stream that are not
* described in the Stream Properties Object.
*
* Typically, the basic Stream Properties Object is present in the
* Header Object, and the Extended Stream Properties Object is
* present in the Header Extension Object. Sometimes, however, the
* Stream Properties Object for a stream may be embedded inside the
* Extended Stream Properties Object for that stream. This approach
* facilitates the creation of backward-compatible content.
*
* This object has an optional provision to include application-specific or
* implementation-specific data attached to the payloads of each digital media
* sample stored within a Data Packet. This data can be looked at as
* digital media sample properties and is stored in the Replicated Data
* field of a payload header. The Payload Extension Systems fields of the
* Extended Stream Properties Object describes what this data is and is
* necessary for that data to be parsed, if present.
*
* @package php-reader
* @subpackage ASF
* @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: 108 $
*/
final class ASF_Object_ExtendedStreamProperties extends ASF_Object
{
/**
* Indicates, if set, that this digital media stream, if sent over a network,
* must be carried over a reliable data communications transport mechanism.
* This should be set for streams that cannot recover after a lost media
* object.
*/
const RELIABLE = 1;
/**
* This flag should be set only if the stream is seekable, either by using an
* index object or by estimating according to bit rate (as can sometimes be
* done with audio). This flag pertains to this stream only rather than to the
* entire file.
*/
const SEEKABLE = 2;
/**
* Indicates, if set, that the stream does not contain any cleanpoints. A
* cleanpoint is any point at which playback could begin without having seen
* the previous media objects. For streams that use key frames, the key frames
* would be the cleanpoints.
*/
const NO_CLEANPOINT = 4;
/**
* Specifies, if set, that when a stream is joined in mid-transmission, all
* information from the most recent cleanpoint up to the current time should
* be sent before normal streaming begins at the current time. The default
* behavior (when this flag is not set) is to send only the data starting at
* the current time. This flag should only be set for streams that are coming
* from a live source.
*/
const RESEND_LIVE_CLEANPOINTS = 8;
const AUDIO_MEDIA = "f8699e40-5b4d-11cf-a8fd-00805f5c442b";
const VIDEO_MEDIA = "bc19efc0-5b4d-11cf-a8fd-00805f5c442b";
const COMMAND_MEDIA = "59dacfc0-59e6-11d0-a3ac-00a0c90348f6";
const JFIF_MEDIA = "b61be100-5b4e-11cf-a8fD-00805f5c442b";
const DEGRADABLE_JPEG_MEDIA = "35907dE0-e415-11cf-a917-00805f5c442b";
const FILE_TRANSFER_MEDIA = "91bd222c-f21c-497a-8b6d-5aa86bfc0185";
const BINARY_MEDIA = "3afb65e2-47ef-40f2-ac2c-70a90d71d343";
const NO_ERROR_CORRECTION = "20fb5700-5b55-11cf-a8fd-00805f5c442b";
const AUDIO_SPREAD = "bfc3cd50-618f-11cf-8bb2-00aa00b4e220";
const PAYLOAD_EXTENSION_SYSTEM_TIMECODE =
"399595ec-8667-4e2d-8fdb-98814ce76c1e";
const PAYLOAD_EXTENSION_SYSTEM_FILE_NAME =
"e165ec0e-19ed-45d7-b4a7-25cbd1e28e9b";
const PAYLOAD_EXTENSION_SYSTEM_CONTENT_TYPE =
"d590dc20-07bc-436c-9cf7-f3bbfbf1a4dc";
const PAYLOAD_EXTENSION_SYSTEM_PIXEL_ASPECT_RATIO =
"1b1ee554-f9ea-4bc8-821a-376b74e4c4b8";
const PAYLOAD_EXTENSION_SYSTEM_SAMPLE_DURATION =
"c6bd9450-867f-4907-83a3-c77921b733ad";
const PAYLOAD_EXTENSION_SYSTEM_ENCRYPTION_SAMPLE_ID =
"6698b84e-0afa-4330-aeb2-1c0a98d7a44d";
/** @var integer */
private $_startTime;
/** @var integer */
private $_endTime;
/** @var integer */
private $_dataBitrate;
/** @var integer */
private $_bufferSize;
/** @var integer */
private $_initialBufferFullness;
/** @var integer */
private $_alternateDataBitrate;
/** @var integer */
private $_alternateBufferSize;
/** @var integer */
private $_alternateInitialBufferFullness;
/** @var integer */
private $_maximumObjectSize;
/** @var integer */
private $_flags;
/** @var integer */
private $_streamNumber;
/** @var integer */
private $_streamLanguageIndex;
/** @var integer */
private $_averageTimePerFrame;
/** @var Array */
private $_streamNames = array();
/** @var Array */
private $_payloadExtensionSystems = array();
/**
* Constructs the class with given parameters and reads object related data
* from the ASF file.
*
* @param Reader $reader The reader object.
* @param Array $options The options array.
*/
public function __construct($reader, &$options = array())
{
parent::__construct($reader, $options);
$this->_startTime = $this->_reader->readInt64LE();
$this->_endTime = $this->_reader->readInt64LE();
$this->_dataBitrate = $this->_reader->readUInt32LE();
$this->_bufferSize = $this->_reader->readUInt32LE();
$this->_initialBufferFullness = $this->_reader->readUInt32LE();
$this->_alternateDataBitrate = $this->_reader->readUInt32LE();
$this->_alternateBufferSize = $this->_reader->readUInt32LE();
$this->_alternateInitialBufferFullness = $this->_reader->readUInt32LE();
$this->_maximumObjectSize = $this->_reader->readUInt32LE();
$this->_flags = $this->_reader->readUInt32LE();
$this->_streamNumber = $this->_reader->readUInt16LE();
$this->_streamLanguageIndex = $this->_reader->readUInt16LE();
$this->_averageTimePerFrame = $this->_reader->readInt64LE();
$streamNameCount = $this->_reader->readUInt16LE();
$payloadExtensionSystemCount = $this->_reader->readUInt16LE();
for ($i = 0; $i < $streamNameCount; $i++) {
$streamName = array("languageIndex" => $this->_reader->readUInt16LE());
$streamNameLength = $this->_reader->readUInt16LE();
$streamName["streamName"] = iconv
("utf-16le", $this->getOption("encoding"),
$this->_reader->readString16LE($streamNameLength));
$this->_streamNames[] = $streamName;
}
for ($i = 0; $i < $payloadExtensionSystemCount; $i++) {
$payloadExtensionSystem = array
("extensionSystemId" => $this->_reader->readGUID(),
"extensionDataSize" => $this->_reader->readUInt16LE());
$extensionSystemInfoLength = $this->_reader->readUInt32LE();
$payloadExtensionSystem["extensionSystemInfo"] = iconv
("utf-16le", $this->getOption("encoding"),
$this->_reader->readString16LE($extensionSystemInfoLength));
$this->_payloadExtensionSystems[] = $payloadExtensionSystem;
}
}
/**
* Returns the presentation time of the first object, indicating where this
* digital media stream starts within the context of the timeline of the ASF
* file as a whole. This time value corresponds to presentation times as they
* appear in the data packets (adjusted by the preroll). This field is given
* in units of milliseconds and can optionally be set to 0, in which case it
* will be ignored.
*
* @return integer
*/
public function getStartTime() { return $this->_startTime; }
/**
* Returns the presentation time of the last object plus the duration of play,
* indicating where this digital media stream ends within the context of the
* timeline of the ASF file as a whole. This time value corresponds to
* presentation times as they appear in the data packets (adjusted by the
* preroll). This field is given in units of milliseconds and can optionally
* be set to 0, in which case it will be ignored.
*
* @return integer
*/
public function getEndTime() { return $this->_endTime; }
/**
* Returns the leak rate R, in bits per second, of a leaky bucket that
* contains the data portion of the stream without overflowing, excluding all
* ASF Data Packet overhead. The size of the leaky bucket is specified by the
* value of the Buffer Size field. This field has a non-zero value.
*
* @return integer
*/
public function getDataBitrate() { return $this->_dataBitrate; }
/**
* Returns the size B, in milliseconds, of the leaky bucket used in the
* Data Bitrate definition.
*
* @return integer
*/
public function getBufferSize() { return $this->_bufferSize; }
/**
* Returns the initial fullness, in milliseconds, of the leaky bucket used in
* the Data Bitrate definition. This is the fullness of the buffer at
* the instant before the first bit in the stream is dumped into the bucket.
* Typically, this value is set to 0. This value shall not exceed the value in
* the Buffer Size field.
*
* @return integer
*/
public function getInitialBufferFullness()
{
return $this->_initialBufferFullness;
}
/**
* Returns the leak rate RAlt, in bits per second, of a leaky bucket that
* contains the data portion of the stream without overflowing, excluding all
* ASF Data Packet overhead. The size of the leaky bucket is specified
* by the value of the Alternate Buffer Size field. This value is
* relevant in most scenarios where the bit rate is not exactly constant, but
* it is especially useful for streams that have highly variable bit rates.
* This field can optionally be set to the same value as the Data
* Bitrate field.
*
* @return integer
*/
public function getAlternateDataBitrate()
{
return $this->_alternateDataBitrate;
}
/**
* Returns the size BAlt, in milliseconds, of the leaky bucket used in the
* Alternate Data Bitrate definition. This value is relevant in most
* scenarios where the bit rate is not exactly constant, but it is especially
* useful for streams that have highly variable bit rates. This field can
* optionally be set to the same value as the Buffer Size field.
*
* @return integer
*/
public function getAlternateBufferSize()
{
return $this->_alternateBufferSize;
}
/**
* Returns the initial fullness, in milliseconds, of the leaky bucket used in
* the Alternate Data Bitrate definition. This is the fullness of the
* buffer at the instant before the first bit in the stream is dumped into the
* bucket. Typically, this value is set to 0. This value does not exceed the
* value of the Alternate Buffer Size field.
*
* @return integer
*/
public function getAlternateInitialBufferFullness()
{
return $this->_alternateInitialBufferFullness;
}
/**
* Returns the maximum size of the largest sample stored in the data packets
* for a stream. A value of 0 means unknown.
*
* @return integer
*/
public function getMaximumObjectSize()
{
return $this->_maximumObjectSize;
}
/**
* Returns the average time duration, measured in 100-nanosecond units, of
* each frame. This number should be rounded to the nearest integer. This
* field can optionally be set to 0 if the average time per frame is unknown
* or unimportant. It is recommended that this field be set for video.
*
* @return integer
*/
public function getAverageTimePerFrame()
{
return $this->_averageTimePerFrame;
}
/**
* Returns the number of this stream. 0 is an invalid stream number (that is,
* other Header Objects use stream number 0 to refer to the entire file
* as a whole rather than to a specific media stream within the file). Valid
* values are between 1 and 127.
*
* @return integer
*/
public function getStreamNumber()
{
return $this->_streamNumber;
}
/**
* Returns the language, if any, which the content of the stream uses or
* assumes. Refer to the {@link LanguageList Language List Object} description
* for the details concerning how the Stream Language Index and
* Language Index fields should be used. Note that this is an index
* into the languages listed in the Language List Object rather than a
* language identifier.
*
* @return integer
*/
public function getStreamLanguageIndex()
{
return $this->_streamLanguageIndex;
}
/**
* Returns an array of Stream Names. Each stream name instance is potentially
* localized into a specific language. The Language Index field
* indicates the language in which the Stream Name has been written.
*
* The array contains the following keys:
* o languageIndex -- The language index
* o streamName -- The localized stream name
*
* @return Array
*/
public function getStreamNames()
{
return $this->_streamNames;
}
/**
* Returns an array of payload extension systems. Payload extensions provide a
* way for content creators to specify kinds of data that will appear in the
* payload header for every payload from this stream. This system is used when
* stream properties must be conveyed at the media object level. The
* Replicated Data bytes in the payload header will contain these
* properties in the order in which the Payload Extension Systems
* appear in this object. A Payload Extension System must appear in the
* Extended Stream Properties Object for each type of per-media-object
* properties that will appear with the payloads for this stream.
*
* The array contains the following keys:
* o extensionSystemId -- Specifies a unique identifier for the extension
* system.
* o extensionDataSize -- Specifies the fixed size of the extension data for
* this system that will appear in the replicated data alongside every
* payload for this stream. If this extension system uses variable-size
* data, then this should be set to 0xffff. Note, however, that replicated
* data length is limited to 255 bytes, which limits the total size of all
* extension systems for a particular stream.
* o extensionSystemInfo -- Specifies additional information to describe
* this extension system (optional).
*
* @return Array
*/
public function getPayloadExtensionSystems()
{
return $this->_payloadExtensionSystems;
}
}