Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 function parseContent($tagCode, $content, $opts = array())
 {
     $reader = new IO_Bit();
     $reader->input($content);
     $this->_buttonId = $reader->getUI16LE();
     $opts['tagCode'] = $tagCode;
     if ($tagCode == 34) {
         // DefineButton2
         $this->_reservedFlags = $reader->getUIBits(7);
         $this->_trackAsMenu = $reader->getUIBit();
         list($offset_actionOffset, $dummy) = $reader->getOffset();
         $this->_actionOffset = $reader->getUI16LE();
     }
     $characters = array();
     while ($reader->getUI8() != 0) {
         $reader->incrementOffset(-1, 0);
         // 1 byte back
         $characters[] = IO_SWF_Type_BUTTONRECORD::parse($reader, $opts);
     }
     $this->_characters = $characters;
     if ($tagCode == 34) {
         // DefineButton2
         // TODO: skip ActionOffset - CurrentOffsetUntilCharactersField
         $actions = array();
         if ($this->_actionOffset > 0) {
             list($offset_buttonCondition, $dummy) = $reader->getOffset();
             if ($offset_actionOffset + $this->_actionOffset != $offset_buttonCondition) {
                 // TODO: warning
                 $reader->setOffset($offset_actionOffset + $this->_actionOffset, 0);
             }
             while (true) {
                 $action = IO_SWF_Type_BUTTONCONDACTION::parse($reader, $opts);
                 $actions[] = $action;
                 if ($action['CondActionSize'] == 0) {
                     break;
                     // last action
                 }
             }
             $this->_actions = $actions;
         } else {
             $this->_actions = null;
         }
     } else {
         $actions = array();
         while ($reader->getUI8() != 0) {
             $reader->incrementOffset(-1, 0);
             // 1 byte back
             $actions[] = IO_SWF_Type_Action::parse($reader);
         }
         $this->_actions = $actions;
     }
     return true;
 }
Exemplo n.º 3
0
 function parseContent($tagCode, $content, $opts = array())
 {
     $reader = new IO_Bit();
     $reader->input($content);
     $this->Reserved = $reader->getUIBit();
     $this->UseDirectBlit = $reader->getUIBit();
     $this->UseGPU = $reader->getUIBit();
     $this->HasMetadata = $reader->getUIBit();
     $this->ActionScript3 = $reader->getUIBit();
     $this->Reserved2 = $reader->getUIBits(2);
     $this->UseNetwork = $reader->getUIBit();
     $this->Reserved3 = $reader->getUIBits(24);
 }
Exemplo n.º 4
0
Arquivo: Font.php Projeto: yoya/IO_SWF
 function parseContent($tagCode, $content, $opts = array())
 {
     $reader = new IO_Bit();
     $reader->input($content);
     $this->FontID = $reader->getUI16LE();
     $fontFlagsHasLayout = $reader->getUIBit();
     $this->FontFlagsShiftJIS = $reader->getUIBit();
     $this->FontFlagsSmallText = $reader->getUIBit();
     $this->FontFlagsANSI = $reader->getUIBit();
     $this->FontFlagsWideOffsets = $reader->getUIBit();
     $this->FontFlagsWideCodes = $reader->getUIBit();
     $this->FontFlagsItalic = $reader->getUIBit();
     $this->FontFlagsBold = $reader->getUIBit();
     $this->LanguageCode = IO_SWF_Type_LANGCODE::parse($reader);
     $fontNameLen = $reader->getUI8();
     $this->FontName = $reader->getData($fontNameLen);
     $numGlyphs = $reader->getUI16LE();
     if ($numGlyphs === 0) {
         return;
         // no glyphs field.
     }
     list($startOfOffsetTable, $dummy) = $reader->getOffset();
     if ($this->FontFlagsWideOffsets) {
         for ($i = 0; $i < $numGlyphs; $i++) {
             $this->OffsetTable[] = $reader->getUI32LE();
         }
     } else {
         for ($i = 0; $i < $numGlyphs; $i++) {
             $this->OffsetTable[] = $reader->getUI16LE();
         }
     }
     if ($this->FontFlagsWideOffsets) {
         $codeTableOffset = $reader->getUI32LE();
     } else {
         $codeTableOffset = $reader->getUI16LE();
     }
     for ($i = 0; $i < $numGlyphs; $i++) {
         $reader->setOffset($startOfOffsetTable + $this->OffsetTable[$i], 0);
         $this->GlyphShapeTable[] = IO_SWF_Type_SHAPE::parse($reader, $opts);
         $reader->byteAlign();
     }
     list($startOfOffsetCodeTable, $dummy) = $reader->getOffset();
     if ($startOfOffsetCodeTable != $startOfOffsetTable + $codeTableOffset) {
         trigger_error("startOfOffsetCodeTable:{$startOfOffsetCodeTable} != startOfOffsetTable:{$startOfOffsetTable} + codeTableOffset:{$codeTableOffset}", E_USER_WARNING);
     }
     $reader->setOffset($startOfOffsetTable + $codeTableOffset, 0);
     if ($this->FontFlagsWideCodes) {
         for ($i = 0; $i < $numGlyphs; $i++) {
             $this->CodeTable[] = $reader->getUI16LE();
         }
     } else {
         for ($i = 0; $i < $numGlyphs; $i++) {
             $this->CodeTable[] = $reader->getUI8();
         }
     }
     if ($fontFlagsHasLayout) {
         $this->FontAscent = $reader->getSI16LE();
         $this->FontDescent = $reader->getSI16LE();
         $this->FontLeading = $reader->getSI16LE();
         $this->FontAdvanceTable = array();
         for ($i = 0; $i < $numGlyphs; $i++) {
             $this->FontAdvanceTable[] = $reader->getSI16LE();
         }
         $this->FontBoundsTable = array();
         for ($i = 0; $i < $numGlyphs; $i++) {
             $this->FontBoundsTable[] = IO_SWF_TYPE_RECT::parse($reader);
         }
         $kerningCount = $reader->getUI16LE();
         if ($kerningCount > 0) {
             $this->FontKerningTable = array();
             $opts['FontFlagsWideCodes'] = $this->FontFlagsWideCodes;
             for ($i = 0; $i < $kerningCount; $i++) {
                 $this->FontKerningTable[] = IO_SWF_TYPE_KERNINGRECORD::parse($reader, $opts);
             }
         }
     }
 }