コード例 #1
0
 /**
  * Constructs the class with given parameters and reads object related data
  * from the ID3v2 tag.
  *
  * @param Reader $reader The reader object.
  * @param Array $options The options array.
  */
 public function __construct($reader = null, &$options = array())
 {
     parent::__construct($reader, $options);
     if ($reader === null) {
         return;
     }
     $offset = $this->_reader->getOffset();
     $this->_size = $this->decodeSynchsafe32($this->_reader->readUInt32BE());
     /* ID3v2.3.0 ExtendedHeader */
     if (isset($this->_options["version"]) && $this->_options["version"] < 4) {
         if ($this->_reader->readUInt16BE() == 0x8000) {
             $this->_flags = self::CRC32;
         }
         $this->_padding = $this->_reader->readUInt32BE();
         if ($this->hasFlag(self::CRC32)) {
             $this->_crc = Transform::readUInt32BE();
         }
     } else {
         $this->_reader->skip(1);
         $this->_flags = $this->_reader->readInt8();
         if ($this->hasFlag(self::UPDATE)) {
             $this->_reader->skip(1);
         }
         if ($this->hasFlag(self::CRC32)) {
             $this->_reader->skip(1);
             $this->_crc = Transform::fromInt8($this->_reader->read(1)) * (0xfffffff + 1) + decodeSynchsafe32(Transform::fromUInt32BE($this->_reader->read(4)));
         }
         if ($this->hasFlag(self::RESTRICTED)) {
             $this->_reader->skip(1);
             $this->_restrictions = $this->_reader->readInt8(1);
         }
     }
 }