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); }
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); }
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; }
<?php require_once 'IO/Bit.php'; function usage() { echo "Usage: php iobit_get.php <filename> <width> [<width2> [...]]" . PHP_EOL; echo "ex) php iobit_get.php iobit_get.php 1 2 3 4 5 6 7 8" . PHP_EOL; } if ($argc < 2) { usage(); exit(1); } $filename = $argv[1]; if ($filename === '-') { $filename = 'php://stdin'; } else { if (is_readable($filename) === false) { usage(); exit(1); } } $iobit = new IO_Bit(); $filedata = file_get_contents($filename); $iobit->input($filedata); foreach (array_slice($argv, 2) as $arg) { $value = $iobit->getUIBits($arg); echo "{$arg}:{$value} "; } echo PHP_EOL;