Example #1
0
 /**
  * Returns the box raw data.
  *
  * @return string
  */
 public function __toString($data = "")
 {
   return parent::__toString(Transform::toUInt16BE(count($this->_boxes)));
 }
Example #2
0
 /**
  * Returns the frame raw data.
  *
  * @return string
  */
 public function __toString()
 {
   $data = Transform::toInt8($this->_interpolation) . $this->_device . "\0";
   foreach ($this->_adjustments as $frequency => $adjustment)
     $data .= Transform::toUInt16BE($frequency * 2) .
       Transform::toInt16BE($adjustment * 512);
   $this->setData($data);
   return parent::__toString();
 }
Example #3
0
 /**
  * Returns the frame raw data.
  *
  * @return string
  */
 public function __toString()
 {
   $data = $this->_device . "\0";
   foreach ($this->_adjustments as $channel) {
     $data .= Transform::toInt8($channel[self::channelType]) .
       Transform::toInt16BE($channel[self::volumeAdjustment] * 512);
     if (abs($channel[self::peakVolume]) <= 0xff)
       $data .= Transform::toInt8(8) .
         Transform::toUInt8($channel[self::peakVolume]);
     else if (abs($channel[self::peakVolume]) <= 0xffff)
       $data .= Transform::toInt8(16) .
         Transform::toUInt16BE($channel[self::peakVolume]);
     else if (abs($channel[self::peakVolume]) <= 0xffffffff)
       $data .= Transform::toInt8(32) .
         Transform::toUInt32BE($channel[self::peakVolume]);
     else
       $data .= Transform::toInt8(64) .
         Transform::toInt64BE($channel[self::peakVolume]); // UInt64
   }
   $this->setData($data);
   return parent::__toString();
 }
Example #4
0
 /**
  * Returns the frame raw data.
  *
  * @return string
  */
 public function __toString()
 {
     $flags = 0;
     if ($this->_adjustments["right"] > 0) {
         $flags = $flags | 0x20;
     }
     if ($this->_adjustments["left"] > 0) {
         $flags = $flags | 0x10;
     }
     $data = Transform::toInt8(16) . Transform::toUInt16BE(abs($this->_adjustments["right"])) . Transform::toUInt16BE(abs($this->_adjustments["left"])) . Transform::toUInt16BE(abs($this->_adjustments["peakRight"])) . Transform::toUInt16BE(abs($this->_adjustments["peakLeft"]));
     if (isset($this->_adjustments["rightBack"]) && isset($this->_adjustments["leftBack"]) && isset($this->_adjustments["peakRightBack"]) && isset($this->_adjustments["peakLeftBack"])) {
         if ($this->_adjustments["rightBack"] > 0) {
             $flags = $flags | 0x8;
         }
         if ($this->_adjustments["leftBack"] > 0) {
             $flags = $flags | 0x4;
         }
         $data .= Transform::toUInt16BE(abs($this->_adjustments["rightBack"])) . Transform::toUInt16BE(abs($this->_adjustments["leftBack"])) . Transform::toUInt16BE(abs($this->_adjustments["peakRightBack"])) . Transform::toUInt16BE(abs($this->_adjustments["peakLeftBack"]));
     }
     if (isset($this->_adjustments["center"]) && isset($this->_adjustments["peakCenter"])) {
         if ($this->_adjustments["center"] > 0) {
             $flags = $flags | 0x2;
         }
         $data .= Transform::toUInt16BE(abs($this->_adjustments["center"])) . Transform::toUInt16BE(abs($this->_adjustments["peakCenter"]));
     }
     if (isset($this->_adjustments["bass"]) && isset($this->_adjustments["peakBass"])) {
         if ($this->_adjustments["bass"] > 0) {
             $flags = $flags | 0x1;
         }
         $data .= Transform::toUInt16BE(abs($this->_adjustments["bass"])) . Transform::toUInt16BE(abs($this->_adjustments["peakBass"]));
     }
     $this->setData(Transform::toInt8($flags) . $data);
     return parent::__toString();
 }
Example #5
0
 /**
  * Returns the frame raw data.
  *
  * @return string
  */
 public function __toString()
 {
     $data = $this->_device . "";
     foreach ($this->_adjustments as $channel) {
         $data .= Transform::toInt8($channel["channelType"]) . Transform::toInt16BE($channel["volumeAdjustment"]);
         if ($channel["peakVolume"] < 255) {
             $data .= Transform::toInt8(8) . Transform::toInt8($channel["peakVolume"]);
         } else {
             if ($channel["peakVolume"] < 65535) {
                 $data .= Transform::toInt8(16) . Transform::toUInt16BE($channel["peakVolume"]);
             } else {
                 if ($channel["peakVolume"] < 4294967295) {
                     $data .= Transform::toInt8(32) . Transform::toUInt32BE($channel["peakVolume"]);
                 } else {
                     $data .= Transform::toInt8(64) . Transform::toUInt64BE($channel["peakVolume"]);
                 }
             }
         }
     }
     $this->setData($data);
     return parent::__toString();
 }
 /**
  * Returns the header raw data.
  *
  * @return string
  */
 public function __toString()
 {
     /* ID3v2.3.0 ExtendedHeader */
     if (isset($this->_options["version"]) && $this->_options["version"] < 4) {
         return Transform::toUInt32BE($this->_size) . Transform::toUInt16BE($this->hasFlag(self::CRC32) ? 0x8000 : 0) . Transform::toUInt32BE($this->_padding) . ($this->hasFlag(self::CRC32) ? Transform::toUInt32BE($this->_crc) : "");
     } else {
         return Transform::toUInt32BE($this->encodeSynchsafe32($this->_size)) . Transform::toInt8(1) . Transform::toInt8($this->_flags) . ($this->hasFlag(self::UPDATE) ? "" : "") . ($this->hasFlag(self::CRC32) ? Transform::toInt8(5) . Transform::toInt8($this->_crc & 0xf0000000 >> 28 & 0xf) . Transform::toUInt32BE(encodeSynchsafe32($this->_crc)) : "") . ($this->hasFlag(self::RESTRICTED) ? Transform::toInt8(1) . Transform::toInt8($this->_restrictions) : "");
     }
 }
Example #7
0
 /**
  * Returns the frame raw data.
  *
  * @return string
  */
 public function __toString()
 {
   $this->setData
     ($this->_owner . "\0" . Transform::toUInt16BE($this->_previewStart) .
      Transform::toUInt16BE($this->_previewLength) . $this->_encryptionInfo);
   return parent::__toString();
 }
Example #8
0
 /**
  * Returns the frame raw data.
  *
  * @return string
  */
 public function __toString()
 {
   $flags = 0;
   if ($this->_adjustments[self::right] > 0)
     $flags = $flags | 0x1;
   if ($this->_adjustments[self::left] > 0)
     $flags = $flags | 0x2;
   $data = Transform::toInt8(16) . 
     Transform::toUInt16BE(abs($this->_adjustments[self::right])) .
     Transform::toUInt16BE(abs($this->_adjustments[self::left])) .
     Transform::toUInt16BE(abs($this->_adjustments[self::peakRight])) .
     Transform::toUInt16BE(abs($this->_adjustments[self::peakLeft]));
   
   if (isset($this->_adjustments[self::rightBack]) &&
       isset($this->_adjustments[self::leftBack]) &&
       isset($this->_adjustments[self::peakRightBack]) &&
       isset($this->_adjustments[self::peakLeftBack])) {
     if ($this->_adjustments[self::rightBack] > 0)
       $flags = $flags | 0x4;
     if ($this->_adjustments[self::leftBack] > 0)
       $flags = $flags | 0x8;
     $data .= 
       Transform::toUInt16BE(abs($this->_adjustments[self::rightBack])) .
       Transform::toUInt16BE(abs($this->_adjustments[self::leftBack])) .
       Transform::toUInt16BE(abs($this->_adjustments[self::peakRightBack])) .
       Transform::toUInt16BE(abs($this->_adjustments[self::peakLeftBack]));
   }
   
   if (isset($this->_adjustments[self::center]) &&
       isset($this->_adjustments[self::peakCenter])) {
     if ($this->_adjustments[self::center] > 0)
       $flags = $flags | 0x10;
     $data .= 
       Transform::toUInt16BE(abs($this->_adjustments[self::center])) .
       Transform::toUInt16BE(abs($this->_adjustments[self::peakCenter]));
   }
   
   if (isset($this->_adjustments[self::bass]) &&
       isset($this->_adjustments[self::peakBass])) {
     if ($this->_adjustments[self::bass] > 0)
       $flags = $flags | 0x20;
     $data .= 
       Transform::toUInt16BE(abs($this->_adjustments[self::bass])) .
       Transform::toUInt16BE(abs($this->_adjustments[self::peakBass]));
   }
   $this->setData(Transform::toInt8($flags) . $data);
   return parent::__toString();
 }
Example #9
0
 /**
  * Returns the header raw data.
  *
  * @return string
  */
 public function __toString()
 {
   /* ID3v2.3.0 ExtendedHeader */
   if ($this->getOption("version", 4) < 4) {
     return Transform::toUInt32BE($this->_size) .
       Transform::toUInt16BE($this->hasFlag(self::CRC32) ? 0x8000 : 0) .
       Transform::toUInt32BE($this->_padding) .
       ($this->hasFlag(self::CRC32) ? Transform::toUInt32BE($this->_crc) : "");
   }
   
   /* ID3v2.4.0 ExtendedHeader */
   else {
     return Transform::toUInt32BE($this->encodeSynchsafe32($this->_size)) .
       Transform::toInt8(1) . Transform::toInt8($this->_flags) .
       ($this->hasFlag(self::UPDATE) ? "\0" : "") .
       ($this->hasFlag(self::CRC32) ? Transform::toInt8(5) .
        Transform::toInt8($this->_crc & 0xf0000000 >> 28 & 0xf /*eq >>> 28*/) .
        Transform::toUInt32BE($this->encodeSynchsafe32($this->_crc)) : "") .
       ($this->hasFlag(self::RESTRICTED) ? 
          Transform::toInt8(1) . Transform::toInt8($this->_restrictions) : "");
   }
 }
Example #10
0
 /**
  * Returns the frame raw data.
  *
  * @return string
  */
 public function __toString()
 {
   $data = Transform::toInt8(16);
   foreach ($this->_adjustments as $frequency => $adjustment)
     $data .= Transform::toUInt16BE
       ($adjustment > 0 ? $frequency | 0x8000 : $frequency & ~0x8000) .
       Transform::toUInt16BE(abs($adjustment));
   $this->setData($data);
   return parent::__toString();
 }
Example #11
0
 /**
  * Returns the frame raw data.
  *
  * @return string
  */
 public function __toString()
 {
   $this->setData
     (Transform::toUInt16BE($this->_reverbLeft) .
      Transform::toUInt16BE($this->_reverbRight) .
      Transform::toUInt8($this->_reverbBouncesLeft) .
      Transform::toUInt8($this->_reverbBouncesRight) .
      Transform::toUInt8($this->_reverbFeedbackLtoL) .
      Transform::toUInt8($this->_reverbFeedbackLtoR) .
      Transform::toUInt8($this->_reverbFeedbackRtoR) .
      Transform::toUInt8($this->_reverbFeedbackRtoL) .
      Transform::toUInt8($this->_premixLtoR) .
      Transform::toUInt8($this->_premixRtoL));
   return parent::__toString();
 }
Example #12
0
 /**
  * Returns the box raw data.
  *
  * @return string
  */
 public function __toString($data = "")
 {
   return parent::__toString
     (Transform::toUInt16BE
      (((ord($this->_language[0]) - 0x60) << 10) |
       ((ord($this->_language[1]) - 0x60) << 5) |
         ord($this->_language[2]) - 0x60) . $this->_tag);
 }
Example #13
0
  /**
   * Returns the frame raw data.
   *
   * @return string
   */
  public function __toString()
  {
    /* 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;
    }

    /* ID3v2.4.0 Flags */
    else
      $flags = $this->_flags;
    
    $size = $this->_size;
    if ($this->getOption("version", 4) < 4)
      $data = $this->_data;
    else {
      $data = $this->encodeUnsynchronisation($this->_data);
      if (($dataLength = strlen($data)) != $size) {
        $size = 4 + $dataLength;
        $data = Transform::toUInt32BE($this->encodeSynchsafe32($this->_size)) .
          $data;
        $flags |= self::DATA_LENGTH_INDICATOR | self::UNSYNCHRONISATION;
        $this->setOption("unsyncronisation", true);
      }
    }
    return Transform::toString8(substr($this->_identifier, 0, 4), 4) .
      Transform::toUInt32BE($this->encodeSynchsafe32($size)) .
      Transform::toUInt16BE($flags) . $data;
  }
Example #14
0
 /**
  * Returns the frame raw data.
  *
  * @return string
  */
 public function __toString()
 {
     /* ID3v2.3.0 Flags; convert from 2.4.0 format */
     if (isset($this->_options["version"]) && $this->_options["version"] < 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;
     }
     return Transform::toString8(substr($this->_identifier, 0, 4), 4) . Transform::toUInt32BE($this->encodeSynchsafe32($this->_size)) . Transform::toUInt16BE($flags) . $this->_data;
 }