示例#1
0
 /**
  * Process the raw data from a binary stream
  * 
  * @return  void
  */
 public function processData(Woops_Swf_Binary_Stream $stream)
 {
     // Gets the SWF file signature
     $signature = $stream->read(3);
     // Checks the SWF file signature
     if ($signature === 'FWS') {
         // No compression
         $this->_isCompressed = false;
     } elseif ($signature === 'CWS') {
         // SWF file data is compressed
         $this->_isCompressed = true;
     } else {
         // Error - Invalid SWF signature
         throw new Woops_Swf_Header_Exception('Invalid SWF file signature (' . $signature . ')', Woops_Swf_Header_Exception::EXCEPTION_BAD_SIGNATURE);
     }
     // Gets the SWF version
     $this->_version = $stream->unsignedChar();
     // Do not process the file size
     $stream->seek(4, Woops_Swf_Binary_Stream::SEEK_CUR);
     // Checks if we have to uncompress the SWF data
     if ($this->_isCompressed) {
         // Uncompress the SWF data
         $stream->uncompressData();
     }
     // Processes the frame size rectangle
     $this->_frameSize->processData($stream);
     // Gets the frame rate
     $this->_frameRate = $stream->littleEndianFixedPoint(8, 8);
     // Gets the number of frames
     $this->_frameCount = $stream->littleEndianUnsignedShort();
 }
示例#2
0
 /**
  * Process the raw data from a binary stream
  * 
  * @return  void
  */
 public function processData(Woops_Swf_Binary_Stream $stream)
 {
     // Gets the sprite ID and the frame count
     $this->_spriteId = $stream->littleEndianUnsignedShort();
     $this->_frameCount = $stream->littleEndianUnsignedShort();
     // Resets the tag array
     $this->_tags = array();
     // Process the tags
     while (!$stream->endOfStream()) {
         // Gets thge tag record header
         $tagHeader = $stream->littleEndianUnsignedShort();
         // Gets the tag type
         $tagType = $tagHeader >> 6;
         // Gets the tag length
         $tagLength = $tagHeader & 0x3f;
         // Checks for a 32bit length
         if ($tagLength === 0x3f) {
             // Tag is long
             $tagLength = $stream->littleEndianUnsignedLong();
         }
         // Creates the tag
         $tag = $this->newTag($tagType);
         // Creates a binary stream with the tag data
         $tagData = new Woops_Swf_Binary_Stream($stream->read($tagLength));
         // Processes the tag data
         $tag->processData($tagData);
     }
 }