PageRenderTime 23ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/src/Zend/Media/Iso14496/Box/Ndrm.php

http://php-reader.googlecode.com/
PHP | 109 lines | 28 code | 8 blank | 73 comment | 0 complexity | bb3c4b031d18ffea0f45273ee49d72f1 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 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
 16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 25 * POSSIBILITY OF SUCH DAMAGE.
 26 *
 27 * @category   Zend
 28 * @package    Zend_Media
 29 * @subpackage ISO14496
 30 * @copyright  Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) 
 31 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 32 * @version    $Id: Ndrm.php 210 2010-12-28 16:46:58Z svollbehr $
 33 */
 34
 35/**#@+ @ignore */
 36require_once 'Zend/Media/Iso14496/FullBox.php';
 37/**#@-*/
 38
 39/**
 40 * The <i>Nero Digital Rights Management Box</i>.
 41 *
 42 * @category   Zend
 43 * @package    Zend_Media
 44 * @subpackage ISO14496
 45 * @author     Sven Vollbehr <sven@vollbehr.eu>
 46 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
 47 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 48 * @version    $Id: Ndrm.php 210 2010-12-28 16:46:58Z svollbehr $
 49 */
 50final class Zend_Media_Iso14496_Box_Ndrm extends Zend_Media_Iso14496_FullBox
 51{
 52    private $_data;
 53
 54    /**
 55     * Constructs the class with given parameters and reads box related data
 56     * from the ISO Base Media file.
 57     *
 58     * @param Zend_Io_Reader $reader  The reader object.
 59     * @param Array          $options The options array.
 60     */
 61    public function __construct($reader, &$options = array())
 62    {
 63        parent::__construct($reader, $options);
 64
 65        $this->_data = $reader->read($this->getSize() - 12);
 66    }
 67
 68    /**
 69     * Returns the raw binary data.
 70     *
 71     * @return string
 72     */
 73    public function getData()
 74    {
 75        return $this->_data;
 76    }
 77
 78    /**
 79     * Sets the raw binary data.
 80     *
 81     * @param string $data The data.
 82     */
 83    public function setData($data)
 84    {
 85        $this->_data = $data;
 86    }
 87
 88    /**
 89     * Returns the box heap size in bytes.
 90     *
 91     * @return integer
 92     */
 93    public function getHeapSize()
 94    {
 95        return parent::getHeapSize() + $this->getSize() - 12;
 96    }
 97
 98    /**
 99     * Writes the box data.
100     *
101     * @param Zend_Io_Writer $writer The writer object.
102     * @return void
103     */
104    protected function _writeData($writer)
105    {
106        parent::_writeData($writer);
107        $writer->write($this->_data);
108    }
109}