function build() { $writer_head = new IO_Bit(); $writer = new IO_Bit(); /* SWF Header */ $writer_head->putData($this->_headers['Signature']); $writer_head->putUI8($this->_headers['Version']); $writer_head->putUI32LE($this->_headers['FileLength']); /* SWF Movie Header */ IO_SWF_Type_RECT::build($writer, $this->_headers['FrameSize']); $writer->byteAlign(); $writer->putUI16LE($this->_headers['FrameRate']); $writer->putUI16LE($this->_headers['FrameCount']); /* SWF Tags */ foreach ($this->_tags as $idx => $tag) { $tagData = $tag->build(); if ($tagData != false) { $writer->putData($tagData); } else { throw new IO_SWF_Exception("tag build failed (tag idx={$idx})"); } } list($fileLength, $bit_offset_dummy) = $writer->getOffset(); $fileLength += 8; // swf header $this->_headers['FileLength'] = $fileLength; $writer_head->setUI32LE($fileLength, 4); if ($this->_headers['Signature'][0] == 'C') { return $writer_head->output() . gzcompress($writer->output()); } return $writer_head->output() . $writer->output(); }
function build() { $writer = new IO_Bit(); $writer->putData('RIFF'); $writer->putUI32LE(0); // $writer->putData('sfbk'); $this->buildChunkLIST($writer, 'INFO', $this->sfbk['INFO']); $this->buildChunkLIST($writer, 'sdta', $this->sfbk['sdta']); $this->buildChunkLIST($writer, 'pdta', $this->sfbk['pdta']); }
function buildContent($tagCode, $opts = array()) { $writer = new IO_Bit(); $writer->putUI16LE($this->SoundId); // ---- $writer->putUIBits($this->SoundFormat, 4); $writer->putUIBits($this->SoundRate, 2); $writer->putUIBit($this->SoundSize); // --- $writer->putUI32LE($this->SoundSampleCount); $writer->putData($this->SoundData); return $writer->output(); }
function buildContent($tagCode, $opts = array()) { $writer = new IO_Bit(); if ($tagCode != 8) { // ! JPEGTablesa $writer->putUI16LE($this->_CharacterID); } if ($tagCode == 35) { // DefgineBitsJPEG3 $this->_AlphaDataOffset = strlen($this->_JPEGData); $writer->putUI32LE($this->_AlphaDataOffset); } if ($tagCode != 35) { // ! DefgineBitsJPEG3 $writer->putData($this->_JPEGData); } else { $writer->putData($this->_JPEGData); $writer->putData($this->_ZlibBitmapAlphaData); } return $writer->output(); }
function build($opts = array()) { $code = $this->code; if (is_null($this->content)) { $this->content = $this->buildTagContent(); } $length = strlen($this->content); $writer = new IO_Bit(); switch ($code) { case 6: // DefineBitsJPEG // DefineBitsJPEG case 21: // DefineBitsJPEG2 // DefineBitsJPEG2 case 35: // DefineBitsJPEG3 // DefineBitsJPEG3 case 20: // DefineBitsLossless // DefineBitsLossless case 36: // DefineBitsLossless2 // DefineBitsLossless2 case 19: // SoundStreamBlock $longFormat = true; break; default: $longFormat = false; break; } if ($longFormat === false && $length < 0x3f) { $tagAndLength = $code << 6 | $length; $writer->putUI16LE($tagAndLength); } else { $tagAndLength = $code << 6 | 0x3f; $writer->putUI16LE($tagAndLength); $writer->putUI32LE($length); } return $writer->output() . $this->content; }