示例#1
0
文件: Jpeg.php 项目: yoya/IO_SWF
 function parseContent($tagCode, $content, $opts = array())
 {
     $reader = new IO_Bit();
     $reader->input($content);
     if ($tagCode != 8) {
         // ! JPEGTable
         $this->_CharacterID = $reader->getUI16LE();
     }
     if ($tagCode == 35) {
         // DefgineBitsJPEG3
         $alphaDataOffset = $reader->getUI32LE();
         $this->_AlphaDataOffset = $alphaDataOffset;
     }
     if ($tagCode != 35) {
         // ! DefgineBitsJPEG3
         $this->_JPEGData = $reader->getDataUntil(false);
     } else {
         $this->_JPEGData = $reader->getData($alphaDataOffset);
         $this->_ZlibBitmapAlphaData = $reader->getDataUntil(false);
     }
 }
示例#2
0
文件: Lossless.php 项目: yoya/IO_SWF
 function parseContent($tagCode, $content, $opts = array())
 {
     $reader = new IO_Bit();
     $reader->input($content);
     $this->_CharacterID = $reader->getUI16LE();
     $bitmapFormat = $reader->getUI8();
     $this->_BitmapFormat = $bitmapFormat;
     $this->_BitmapWidth = $reader->getUI16LE();
     $this->_BitmapHeight = $reader->getUI16LE();
     if ($bitmapFormat == 3) {
         $this->_BitmapColorTableSize = $reader->getUI8() + 1;
     }
     $this->_ZlibBitmapData = $reader->getDataUntil(false);
 }
示例#3
0
文件: Sound.php 项目: yoya/IO_SWF
 function parseContent($tagCode, $content, $opts = array())
 {
     $reader = new IO_Bit();
     $reader->input($content);
     $this->SoundId = $reader->getUI16LE();
     // ---
     $this->SoundFormat = $reader->getUIBits(4);
     $this->SoundRate = $reader->getUIBits(2);
     $this->SoundSize = $reader->getUIBit();
     $this->SoundType = $reader->getUIBit();
     // ---
     $this->SoundSampleCount = $reader->getUI32LE();
     $this->SoundData = $reader->getDataUntil(false);
 }
示例#4
0
文件: JPEG.php 项目: yoya/IO_SWF
 function _splitChunk($eoiFinish = true, $sosScan = true)
 {
     $bitin = new IO_Bit();
     $bitin->input($this->_jpegdata);
     while ($bitin->hasNextData()) {
         $marker1 = $bitin->getUI8();
         if ($marker1 != 0xff) {
             fprintf(STDERR, "dumpChunk: marker1=0x%02X", $marker1);
             return false;
         }
         $marker2 = $bitin->getUI8();
         switch ($marker2) {
             case 0xd8:
                 // SOI (Start of Image)
                 $this->_jpegChunk[] = array('marker' => $marker2, 'data' => null, 'length' => null);
                 continue;
             case 0xd9:
                 // EOI (End of Image)
                 $this->_jpegChunk[] = array('marker' => $marker2, 'data' => null, 'length' => null);
                 if ($eoiFinish) {
                     break 2;
                     // while break;
                 }
                 continue;
             case 0xda:
                 // SOS
                 if ($sosScan === false) {
                     $remainData = $bitin->getDataUntil(false);
                     $this->_jpegChunk[] = array('marker' => $marker2, 'data' => $remainData, 'length' => null);
                     break 2;
                     // while break;
                 }
             case 0xd0:
             case 0xd1:
             case 0xd2:
             case 0xd3:
                 // RST
             // RST
             case 0xd4:
             case 0xd5:
             case 0xd6:
             case 0xd7:
                 // RST
                 list($chunk_data_offset, $dummy) = $bitin->getOffset();
                 while (true) {
                     $next_marker1 = $bitin->getUI8();
                     if ($next_marker1 != 0xff) {
                         continue;
                     }
                     $next_marker2 = $bitin->getUI8();
                     if ($next_marker2 == 0x0) {
                         continue;
                     }
                     $bitin->incrementOffset(-2, 0);
                     // back from next marker
                     list($next_chunk_offset, $dummy) = $bitin->getOffset();
                     $length = $next_chunk_offset - $chunk_data_offset;
                     $bitin->setOffset($chunk_data_offset, 0);
                     $this->_jpegChunk[] = array('marker' => $marker2, 'data' => $bitin->getData($length), 'length' => null);
                     break;
                 }
                 break;
             default:
                 $length = $bitin->getUI16BE();
                 $this->_jpegChunk[] = array('marker' => $marker2, 'data' => $bitin->getData($length - 2), 'length' => $length);
                 continue;
         }
     }
 }