コード例 #1
0
ファイル: Page.php プロジェクト: hausdesign/zf-library
 /**
  * Constructs the class with given parameters and reads object related data
  * from the Ogg bitstream.
  *
  * @param HausDesign_Io_Reader $reader The reader object.
  */
 public function __construct($reader)
 {
     $this->_reader = $reader;
     $this->_capturePattern = $this->_reader->read(4);
     if ($this->_capturePattern != 'OggS') {
         require_once 'HausDesign/Media/Ogg/Exception.php';
         throw new HausDesign_Media_Ogg_Exception('Not a valid Ogg bitstream');
     }
     $this->_streamStructureVersion = $this->_reader->readUInt8();
     if ($this->_streamStructureVersion != 0) {
         require_once 'HausDesign/Media/Ogg/Exception.php';
         throw new HausDesign_Media_Ogg_Exception('Unsupported Ogg stream structure version');
     }
     $this->_headerTypeFlag = $this->_reader->readUInt8();
     $this->_granulePosition = $this->_reader->readInt64LE();
     $this->_bitstreamSerialNumber = $this->_reader->readUInt32LE();
     $this->_pageSequenceNumber = $this->_reader->readUInt32LE();
     $this->_crcChecksum = $this->_reader->readUInt32LE();
     $this->_numberPageSegments = $this->_reader->readUInt8();
     $this->_segmentTable = array();
     for ($i = 0; $i < $this->_numberPageSegments; $i++) {
         $this->_segmentTable[] = $this->_reader->readUInt8();
     }
     $this->_headerSize = $this->_numberPageSegments + 27;
     $this->_pageSize = array_sum($this->_segmentTable);
     $this->_size = $this->_headerSize + $this->_pageSize;
 }