PageRenderTime 24ms CodeModel.GetById 20ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/Zend/Media/Asf/Object/MediaObjectIndexParameters.php

http://php-reader.googlecode.com/
PHP | 133 lines | 32 code | 8 blank | 93 comment | 1 complexity | b986a9d6fa5617e4bd12da941e5a8d17 MD5 | raw file
  1<?php
  2/**
  3 * Zend Framework
  4 *
  5 * LICENSE
  6 *
  7 * This source file is subject to the new BSD license that is bundled
  8 * with this package in the file LICENSE.txt.
  9 * It is also available through the world-wide-web at this URL:
 10 * http://framework.zend.com/license/new-bsd
 11 * If you did not receive a copy of the license and are unable to
 12 * obtain it through the world-wide-web, please send an email
 13 * to license@zend.com so we can send you a copy immediately.
 14 *
 15 * @category   Zend
 16 * @package    Zend_Media
 17 * @subpackage ASF
 18 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 
 19 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 20 * @version    $Id: MediaObjectIndexParameters.php 177 2010-03-09 13:13:34Z svollbehr $
 21 */
 22
 23/**#@+ @ignore */
 24require_once 'Zend/Media/Asf/Object.php';
 25/**#@-*/
 26
 27/**
 28 * The <i>Media Object Index Parameters Object</i> supplies information about
 29 * those streams that actually indexed (there must be at least one stream in an
 30 * index) by media objects. This object shall be present in the
 31 * {@link Zend_Media_Asf_Object_Header Header Object} if there is a
 32 * {@link Zend_Media_Asf_Object_MediaObjectIndex Media Object Index Object}
 33 * present in the file.
 34 *
 35 * An Index Specifier is required for each stream that will be indexed by the
 36 * {@link Zend_Media_Asf_Object_MediaObjectIndex Media Object Index Object}.
 37 * These specifiers must exactly match those in the
 38 * {@link Zend_Media_Asf_Object_MediaObjectIndex Media Object Index Object}.
 39 *
 40 * @category   Zend
 41 * @package    Zend_Media
 42 * @subpackage ASF
 43 * @author     Sven Vollbehr <sven@vollbehr.eu>
 44 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 
 45 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 46 * @version    $Id: MediaObjectIndexParameters.php 177 2010-03-09 13:13:34Z svollbehr $
 47 */
 48final class Zend_Media_Asf_Object_MediaObjectIndexParameters
 49    extends Zend_Media_Asf_Object
 50{
 51    /** @var string */
 52    private $_indexEntryCountInterval;
 53
 54    /** @var Array */
 55    private $_indexSpecifiers = array();
 56
 57    /**
 58     * Constructs the class with given parameters and reads object related data
 59     * from the ASF file.
 60     *
 61     * @param Zend_Io_Reader $reader  The reader object.
 62     * @param Array          $options The options array.
 63     */
 64    public function __construct($reader, &$options = array())
 65    {
 66        parent::__construct($reader, $options);
 67
 68        $this->_indexEntryCountInterval = $this->_reader->readUInt32LE();
 69        $indexSpecifiersCount = $this->_reader->readUInt16LE();
 70        for ($i = 0; $i < $indexSpecifiersCount; $i++) {
 71            $this->_indexSpecifiers[] = array
 72                ('streamNumber' => $this->_reader->readUInt16LE(),
 73                 'indexType' => $this->_reader->readUInt16LE());
 74        }
 75    }
 76
 77    /**
 78     * Returns the interval between each index entry by the number of media
 79     * objects. This value cannot be 0.
 80     *
 81     * @return integer
 82     */
 83    public function getIndexEntryCountInterval()
 84    {
 85        return $this->_indexEntryCountInterval;
 86    }
 87
 88    /**
 89     * Returns an array of index entries. Each entry consists of the following
 90     * keys.
 91     *
 92     *   o streamNumber -- Specifies the stream number that the Index Specifiers
 93     *     refer to. Valid values are between 1 and 127.
 94     *
 95     *   o indexType -- Specifies the type of index. Values are defined as
 96     *     follows:
 97     *       1 = Nearest Past Data Packet,
 98     *       2 = Nearest Past Media Object,
 99     *       3 = Nearest Past Cleanpoint,
100     *       0xff = Frame Number Offset.
101     *     For a video stream, the Nearest Past Media Object and Nearest Past
102     *     Data Packet indexes point to the closest data packet containing an
103     *     entire video frame or first fragment of a video frame; Nearest Past
104     *     Cleanpoint indexes point to the closest data packet containing an
105     *     entire video frame (or first fragment of a video frame) that is a key
106     *     frame; and Frame Number Offset indicates how many more frames need to
107     *     be read for the given stream, starting with the first frame in the
108     *     packet pointed to by the index entry, in order to get to the
109     *     requested frame. Nearest Past Media Object is the most common value.
110     *     Because ASF payloads do not contain the full frame number, there is
111     *     often a Frame Number Offset index alongside one of the other types of
112     *     indexes to allow the user to identify the exact frame being seeked
113     *     to.
114     *
115     * @return Array
116     */
117    public function getIndexSpecifiers() 
118    {
119        return $this->_indexSpecifiers; 
120    }
121
122    /**
123     * Writes the object data.
124     *
125     * @param Zend_Io_Writer $writer The writer object.
126     * @return void
127     */
128    public function write($writer)
129    {
130        require_once 'Zend/Media/Asf/Exception.php';
131        throw new Zend_Media_Asf_Exception('Operation not supported');
132    }
133}