/** * Constructs the class with given parameters and reads object related data * from the Ogg bitstream. * * @param Zend_Io_Reader $reader The reader object. */ public function __construct($reader) { $this->_reader = $reader; $this->_capturePattern = $this->_reader->read(4); if ($this->_capturePattern != 'OggS') { throw new Zend_Media_Ogg_Exception('Not a valid Ogg bitstream'); } $this->_streamStructureVersion = $this->_reader->readUInt8(); if ($this->_streamStructureVersion != 0) { throw new Zend_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; }
/** * Constructs the class with given parameters and options. * * @param Zend_Io_Reader $reader The reader object. * @param Array $options The options array. */ public function __construct($reader, &$options = array()) { $this->_reader = $reader; $this->_options =& $options; if (($this->_reader = $reader) === null) { if (defined($constant = 'self::' . strtoupper(preg_replace('/(?<=[a-z])[A-Z]/', '_$0', substr(get_class($this), 22))))) { $this->_identifier = constant($constant); } else { throw new Zend_Media_Asf_Exception('Object identifier could not be determined'); } } else { $this->_offset = $this->_reader->getOffset(); $this->_identifier = $this->_reader->readGuid(); $this->_size = $this->_reader->readInt64LE(); } }