示例#1
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeString8(substr($this->_target, 0, 4), 4)->writeString8($this->_url, 1)->writeString8($this->_qualifier);
 }
示例#2
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeUInt8($this->_encoding)->write($this->_language);
     switch ($this->_encoding) {
         case self::UTF16LE:
             $writer->writeString16($this->_description, HausDesign_Io_Writer::LITTLE_ENDIAN_ORDER, 1)->writeString16($this->_text, HausDesign_Io_Writer::LITTLE_ENDIAN_ORDER);
             break;
         case self::UTF16:
             // break intentionally omitted
         // break intentionally omitted
         case self::UTF16BE:
             $writer->writeString16($this->_description, null, 1)->writeString16($this->_text);
             break;
         default:
             $writer->writeString8($this->_description, 1)->writeString8($this->_text);
             break;
     }
 }
示例#3
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeString8($this->_owner, 1)->writeInt8($this->_rating);
     if ($this->_counter > 0xffffffff) {
         $writer->writeInt64BE($this->_counter);
     } else {
         if ($this->_counter > 0) {
             $writer->writeUInt32BE($this->_counter);
         }
     }
 }
示例#4
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeUInt8($this->_encoding)->write($this->_currency)->writeString8($this->_price, 1)->write($this->_date)->writeString8($this->_contact, 1)->writeUInt8($this->_delivery);
     switch ($this->_encoding) {
         case self::UTF16LE:
             $writer->writeString16($this->_seller, HausDesign_Io_Writer::LITTLE_ENDIAN_ORDER, 1)->writeString16($this->_description, HausDesign_Io_Writer::LITTLE_ENDIAN_ORDER, 1);
             break;
         case self::UTF16:
             // break intentionally omitted
         // break intentionally omitted
         case self::UTF16BE:
             $writer->writeString16($this->_seller, null, 1)->writeString16($this->_description, null, 1);
             break;
         default:
             $writer->writeString8($this->_seller, 1)->writeString8($this->_description, 1);
             break;
     }
     if ($this->_mimeType) {
         $writer->writeString8($this->_mimeType, 1)->write($this->_imageData);
     }
 }
示例#5
0
 /**
  * Writes the frame data with the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 public function write($writer)
 {
     /* ID3v2.3.0 Flags; convert from 2.4.0 format */
     if ($this->getOption('version', 4) < 4) {
         $flags = 0;
         if ($this->hasFlag(self::DISCARD_ON_TAGCHANGE)) {
             $flags = $flags | 0x8000;
         }
         if ($this->hasFlag(self::DISCARD_ON_FILECHANGE)) {
             $flags = $flags | 0x4000;
         }
         if ($this->hasFlag(self::READ_ONLY)) {
             $flags = $flags | 0x2000;
         }
         if ($this->hasFlag(self::COMPRESSION)) {
             $flags = $flags | 0x80;
         }
         if ($this->hasFlag(self::ENCRYPTION)) {
             $flags = $flags | 0x40;
         }
         if ($this->hasFlag(self::GROUPING_IDENTITY)) {
             $flags = $flags | 0x20;
         }
     } else {
         $flags = $this->_flags;
     }
     $this->_writeData($buffer = new HausDesign_Io_StringWriter());
     $data = $buffer->toString();
     $size = $this->_size = strlen($data);
     // ID3v2.4.0 supports frame level unsynchronisation. The corresponding
     // option is set to true when any of the frames use the
     // unsynchronisation scheme. The usage is denoted by
     // HausDesign_Media_Id3_Header flag that is set accordingly upon file write.
     if ($this->getOption('version', 4) >= 4) {
         $data = $this->_encodeUnsynchronisation($data);
         if (($dataLength = strlen($data)) != $size) {
             $size = 4 + $dataLength;
             $flags |= self::DATA_LENGTH_INDICATOR | self::UNSYNCHRONISATION;
             $this->setOption('unsynchronisation', true);
         } else {
             $flags &= ~(self::DATA_LENGTH_INDICATOR | self::UNSYNCHRONISATION);
         }
     }
     $writer->writeString8(substr($this->_identifier, 0, 4), 4, " ")->writeUInt32BE($this->getOption('version', 4) < 4 ? $size : $this->_encodeSynchsafe32($size))->writeUInt16BE($flags);
     if (($flags & self::DATA_LENGTH_INDICATOR) == self::DATA_LENGTH_INDICATOR) {
         $writer->writeUInt32BE($this->getOption('version', 4) < 4 ? $this->_size : $this->_encodeSynchsafe32($this->_size));
     }
     $writer->write($data);
 }
示例#6
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeString8($this->_device, 1);
     foreach ($this->_adjustments as $channel) {
         $writer->writeInt8($channel[self::channelType])->writeInt16BE($channel[self::volumeAdjustment] * 512);
         if (abs($channel[self::peakVolume]) <= 0xff) {
             $writer->writeInt8(8)->writeUInt8($channel[self::peakVolume]);
         } else {
             if (abs($channel[self::peakVolume]) <= 0xffff) {
                 $writer->writeInt8(16)->writeUInt16BE($channel[self::peakVolume]);
             } else {
                 if (abs($channel[self::peakVolume]) <= 0xffffffff) {
                     $writer->writeInt8(32)->writeUInt32BE($channel[self::peakVolume]);
                 } else {
                     $writer->writeInt8(64)->writeInt64BE($channel[self::peakVolume]);
                     // UInt64
                 }
             }
         }
     }
 }
示例#7
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeUInt8($this->_encoding);
     foreach ($this->_people as $entry) {
         foreach ($entry as $key => $val) {
             switch ($this->_encoding) {
                 case self::UTF16LE:
                     $writer->writeString16($key, HausDesign_Io_Writer::LITTLE_ENDIAN_ORDER, 1)->writeString16($val, HausDesign_Io_Writer::LITTLE_ENDIAN_ORDER, 1);
                     break;
                 case self::UTF16:
                     // break intentionally omitted
                 // break intentionally omitted
                 case self::UTF16BE:
                     $writer->writeString16($key, null, 1)->writeString16($val, null, 1);
                     break;
                 default:
                     $writer->writeString8($key, 1)->writeString8($val, 1);
                     break;
             }
         }
     }
 }
示例#8
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeString8($this->_owner, 1)->writeUInt8($this->_group)->write($this->_data);
 }
示例#9
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeUInt8($this->_encoding)->write($this->_language)->writeUInt8($this->_format)->writeUInt8($this->_type);
     switch ($this->_encoding) {
         case self::UTF16LE:
             $writer->writeString16($this->_description, HausDesign_Io_Writer::LITTLE_ENDIAN_ORDER, 1);
             break;
         case self::UTF16:
             // break intentionally omitted
         // break intentionally omitted
         case self::UTF16BE:
             $writer->writeString16($this->_description, null, 1);
             break;
         default:
             $writer->writeString8($this->_description, 1);
             break;
     }
     foreach ($this->_events as $timestamp => $syllable) {
         switch ($this->_encoding) {
             case self::UTF16LE:
                 $writer->writeString16($syllable, HausDesign_Io_Writer::LITTLE_ENDIAN_ORDER, 1);
                 break;
             case self::UTF16:
                 // break intentionally omitted
             // break intentionally omitted
             case self::UTF16BE:
                 $writer->writeString16($syllable, null, 1);
                 break;
             default:
                 $writer->writeString8($syllable, 1);
                 break;
         }
         $writer->writeUInt32BE($timestamp);
     }
 }
示例#10
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeString8($this->_owner, 1)->write($this->_fileIdentifier);
 }
示例#11
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeUInt8($this->_encoding)->write($this->_currency)->writeString8($this->_price, 1)->write($this->_date);
     switch ($this->_encoding) {
         case self::UTF16LE:
             $writer->writeString16($this->_seller, HausDesign_Io_Writer::LITTLE_ENDIAN_ORDER);
             break;
         case self::UTF16:
             // break intentionally omitted
         // break intentionally omitted
         case self::UTF16BE:
             $writer->writeString16($this->_seller);
             break;
         default:
             $writer->writeString8($this->_seller);
             break;
     }
 }
示例#12
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeString8($this->_owner, 1)->writeUInt16BE($this->_previewStart)->writeUInt16BE($this->_previewLength)->write($this->_encryptionInfo);
 }
示例#13
0
 /**
  * Writes the frame raw data without the header.
  *
  * @param HausDesign_Io_Writer $writer The writer object.
  * @return void
  */
 protected function _writeData($writer)
 {
     $writer->writeString8($this->_owner, 1)->writeInt8($this->_method)->write($this->_encryptionData);
 }