PageRenderTime 23ms CodeModel.GetById 8ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://php-reader.googlecode.com/
PHP | 120 lines | 40 code | 12 blank | 68 comment | 1 complexity | daf3d883bf0b14e98488e53599615e4f 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: Compatibility.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>Compatibility Object</i> is reserved for future use.
 29 *
 30 * @category   Zend
 31 * @package    Zend_Media
 32 * @subpackage ASF
 33 * @author     Sven Vollbehr <sven@vollbehr.eu>
 34 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 
 35 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 36 * @version    $Id: Compatibility.php 177 2010-03-09 13:13:34Z svollbehr $
 37 */
 38final class Zend_Media_Asf_Object_Compatibility extends Zend_Media_Asf_Object
 39{
 40    /** @var integer */
 41    private $_profile;
 42
 43    /** @var integer */
 44    private $_mode;
 45
 46    /**
 47     * Constructs the class with given parameters and reads object related data
 48     * from the ASF file.
 49     *
 50     * @param Zend_Io_Reader $reader  The reader object.
 51     * @param Array          $options The options array.
 52     */
 53    public function __construct($reader = null, &$options = array())
 54    {
 55        parent::__construct($reader, $options);
 56
 57        if ($reader === null) {
 58            return;
 59        }
 60
 61        $this->_profile = $this->_reader->readUInt8();
 62        $this->_mode = $this->_reader->readUInt8();
 63    }
 64
 65    /**
 66     * Returns the profile field. This field is reserved and is set to 2.
 67     *
 68     * @return integer
 69     */
 70    public function getProfile() 
 71    {
 72        return $this->_profile; 
 73    }
 74
 75    /**
 76     * Returns the profile field. This field is reserved and is set to 2.
 77     *
 78     * @param integer $profile The profile.
 79     */
 80    public function setProfile($profile) 
 81    {
 82        $this->_profile = $profile; 
 83    }
 84
 85    /**
 86     * Returns the mode field. This field is reserved and is set to 1.
 87     *
 88     * @return integer
 89     */
 90    public function getMode() 
 91    {
 92        return $this->_mode; 
 93    }
 94
 95    /**
 96     * Sets the mode field. This field is reserved and is set to 1.
 97     *
 98     * @param integer $mode The mode.
 99     */
100    public function setMode($mode) 
101    {
102        $this->_mode = $mode; 
103    }
104
105    /**
106     * Writes the object data.
107     *
108     * @param Zend_Io_Writer $writer The writer object.
109     * @return void
110     */
111    public function write($writer)
112    {
113        $this->setSize(24 /* for header */ + 2);
114
115        $writer->writeGuid($this->getIdentifier())
116               ->writeInt64LE($this->getSize())
117               ->writeUInt8($this->_profile)
118               ->writeUInt8($this->_mode);
119    }
120}