/** * Constructs the class with given parameters and reads object related data from the bitstream. * * The following options are currently recognized: * o vorbisContext -- Indicates whether to expect comments to be in the context of a vorbis bitstream or not. This * option can be used to parse vorbis comments in another formats, eg FLAC, that do not use for example the * framing flags. Defaults to true. * * @param HausDesign_Io_Reader $reader The reader object. * @param Array $options Array of options. */ public function __construct($reader, $options = array()) { if (!isset($options['vorbisContext']) || $options['vorbisContext']) { parent::__construct($reader); } else { $this->_reader = $reader; } $this->_vendor = $this->_reader->read($this->_reader->readUInt32LE()); $userCommentListLength = $this->_reader->readUInt32LE(); for ($i = 0; $i < $userCommentListLength; $i++) { list($name, $value) = preg_split('/=/', $this->_reader->read($this->_reader->readUInt32LE()), 2); if (!isset($this->_comments[strtoupper($name)])) { $this->_comments[strtoupper($name)] = array(); } $this->_comments[strtoupper($name)][] = $value; } if (!isset($options['vorbisContext']) || $options['vorbisContext']) { $this->_framingFlag = $this->_reader->readUInt8() & 0x1; if ($this->_framingFlag == 0) { require_once 'HausDesign/Media/Vorbis/Exception.php'; throw new HausDesign_Media_Vorbis_Exception('Undecodable Vorbis stream'); } $this->_reader->skip($this->_packetSize - $this->_reader->getOffset() + 30); } }
/** * Constructs the class with given parameters. * * @param HausDesign_Io_Reader $reader The reader object. */ public function __construct($reader) { parent::__construct($reader); $this->_vorbisVersion = $this->_reader->readUInt32LE(); $this->_audioChannels = $this->_reader->readUInt8(); $this->_audioSampleRate = $this->_reader->readUInt32LE(); $this->_bitrateMaximum = $this->_reader->readInt32LE(); $this->_bitrateNominal = $this->_reader->readInt32LE(); $this->_bitrateMinimum = $this->_reader->readInt32LE(); $this->_blocksize0 = pow(2, ($tmp = $this->_reader->readUInt8()) & 0xf); $this->_blocksize1 = pow(2, $tmp >> 4 & 0xf); $framingFlag = $this->_reader->readUInt8() & 0x1; if ($this->_blocksize0 > $this->_blocksize1 || $framingFlag == 0) { require_once 'HausDesign/Media/Vorbis/Exception.php'; throw new HausDesign_Media_Vorbis_Exception('Undecodable Vorbis stream'); } }
/** * Constructs the class with given parameters. * * @param HausDesign_Io_Reader $reader The reader object. */ public function __construct($reader) { parent::__construct($reader); $this->_reader->skip($this->_packetSize - 7); }