Exemplo n.º 1
0
 public function getActionQueue()
 {
     $actions = new _ActionQueue();
     $point_offset = 0;
     foreach ($this->_actions as $act) {
         $r = null;
         // offsetの更新
         ++$point_offset;
         if ($act['ActionCode'] & 0x80) {
             $point_offset += 2;
             $point_offset += $act['Length'];
         }
         switch ($act['ActionCode']) {
             case self::PUSH:
                 $r = new Media_SWF_Parser();
                 $r->input($act['Content']);
                 $type = $r->getUI8();
                 switch ($type) {
                     case 0:
                         $data = $this->root->convertEncoding($r->getString());
                         break;
                     case 1:
                         $data = $r->getFLOAT();
                         break;
                     case 4:
                     case 5:
                     case 8:
                         $data = $r->getUI8();
                         break;
                     case 6:
                         $data = $r->getDOUBLE();
                         break;
                     case 7:
                         $data = $r->getUI32LE();
                         break;
                     case 9:
                         $data = $r->getUI16LE();
                         break;
                     default:
                         $data = null;
                 }
                 if ($type === 0 && !(strlen($data) > 1 && substr($data, 0, 1) == 0) && is_numeric($data)) {
                     $data = intval($data);
                 }
                 $actions->add($act['ActionCode'], array($data), $point_offset);
                 break;
             case self::_IF:
             case self::JUMP:
                 $r = new Media_SWF_Parser();
                 $r->input($act['Content']);
                 $offset = $r->getSI16();
                 $actions->add($act['ActionCode'], array($point_offset + $offset), $point_offset);
                 break;
             case self::GET_URL2:
                 $r = new Media_SWF_Parser();
                 $r->input($act['Content']);
                 $m = $r->getUIBits(2);
                 $r->getUIBits(4);
                 $lt_flag = $r->getUIBit();
                 $vr_flag = $r->getUIBit();
                 $method = $m == 1 ? 'GET' : ($m == 2 ? 'POST' : 'NONE');
                 $actions->add($act['ActionCode'], array($method, $lt_flag, $vr_flag), $point_offset);
                 break;
             case self::GOTO_FRAME2:
                 $r = new Media_SWF_Parser();
                 $r->input($act['Content']);
                 $r->getUIBits(6);
                 $sceneBiasFlag = (bool) $r->getUIBit();
                 $playFlag = (int) $r->getUIBit();
                 if ($sceneBiasFlag) {
                     $sceneBias = $r->getUI16LE();
                 }
                 $actions->add($act['ActionCode'], array($playFlag), $point_offset);
                 break;
             case self::GOTO_FRAME:
                 $r = new Media_SWF_Parser();
                 $r->input($act['Content']);
                 $frame = $r->getUI16LE();
                 $actions->add($act['ActionCode'], array($frame, 0), $point_offset);
                 break;
             case self::GOTO_LABEL:
                 $r = new Media_SWF_Parser();
                 $r->input($act['Content']);
                 $frame = $r->getString();
                 $actions->add($act['ActionCode'], array($frame, 0), $point_offset);
                 break;
             case self::SET_TARGET:
                 $r = new Media_SWF_Parser();
                 $r->input($act['Content']);
                 $target = $r->getString();
                 $actions->add($act['ActionCode'], array($target), $point_offset);
                 break;
             default:
                 $actions->add($act['ActionCode'], array(), $point_offset);
                 break;
         }
     }
     return $actions;
 }