def parse_swf_head(self): "swf_header" self.magic = self.swf_read(3) self.version = ord(self.swf_read(1)) self.file_length = le4byte(self.swf_read(4)) "swf_header_movie" # twips 関連のヘッダは、今は飛ばす rectbits = ord(self.swf_read(1)) >> 3 total_bytes = int(ceil((5 + rectbits * 4) / 8.0)) twips_waste = self.swf_read(total_bytes - 1) # frame 関連 self.frame_rate_decimal = ord(self.swf_read(1)) self.frame_rate_integer = ord(self.swf_read(1)) self.frame_count = le2byte(self.swf_read(2)) if DEBUG: print "magic: %s\nver: %d\nlen: %d\nframe_rate: %d.%d\ncount: %d\n" % ( \ self.magic, self.version, self.file_length, self.frame_rate_integer, self.frame_rate_decimal, self.frame_count)
def parse_swfhead(self): "Parse File Header." self.magic = self.read(3) self.version = ord(self.read(1)) self.file_length = le4byte(self.read(4)) # RECT ヘッダ(これは 8 byte 目で固定) self.rect = RECT() self.rect.parse(self) # frame 関連 self.frame_rate = get_fixed_point_number(self.read(2)) self.frame_count = le2byte(self.read(2)) # File Header(head)とその後の部分(tail)を分離する self.swf_head = self.value[:self.pos] self.swf_tail = self.value[self.pos:] if DEBUG: print " Swf Header ".center(60,'-') print "magic: %s\nver: %d\nlen: %d\nframe_rate: %f\ncount: %d" % ( \ self.magic, self.version, self.file_length, self.frame_rate, self.frame_count) print " Swf Blocks ".center(60, '-')
def parse_swfblock(self): # print "--swf_pos:", self.swf_pos swf_block_start = self.swf_pos swf_tag = le2byte(self.swf_read(2)) block_len = swf_tag & 0x3f if block_len == 0x3f: block_len = le4byte(self.swf_read(4)) swf_tag = swf_tag >> 6 if swf_tag == 0: return None try: swf_tag_name = swf_tag_name_entry[swf_tag] except KeyError: swf_tag_name = "Unknown" self.block_pos = 0 ret = {} ret['block_start'] = swf_block_start ret['tag'] = swf_tag ret['block_len'] = block_len ret['tag_name'] = swf_tag_name ret['value'] = self.parse_swfblock_misc(swf_tag, block_len) self.block = ret return True
def parse(self): self.character_id = le2byte(self.read(2)) self.AlphaDataOffset = le4byte(self.read(4))