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