Beispiel #1
0
    def createFields(self):
        yield ZipVersion(self, "version_made_by", "Version made by")
        for field in ZipStartCommonFields(self):
            yield field

        # Check unicode status
        charset = zipGetCharset(self)

        yield UInt16(self, "comment_length", "Comment length")
        yield UInt16(self, "disk_number_start", "Disk number start")
        yield UInt16(self, "internal_attr", "Internal file attributes")
        yield UInt32(self, "external_attr", "External file attributes")
        yield UInt32(self, "offset_header", "Relative offset of local header")
        yield String(self, "filename", self["filename_length"].value,
                     "Filename", charset=charset)
        if 0 < self["extra_length"].value:
            yield ExtraFields(self, "extra", size=self["extra_length"].value * 8,
                              description="Extra fields")
        if 0 < self["comment_length"].value:
            yield String(self, "comment", self["comment_length"].value,
                         "Comment", charset=charset)
Beispiel #2
0
 def createFields(self):
     yield String(self, "marker", 4, "Track marker (MTrk)", charset="ASCII")
     yield UInt32(self, "size")
     cur = None
     if True:
         while not self.eof:
             cur = Command(self, "command[]", prev_command=cur)
             yield cur
     else:
         size = self["size"].value
         if size:
             yield RawBytes(self, "raw", size)
Beispiel #3
0
 def createFields(self):
     if self.root.isEMF():
         yield Enum(UInt32(self, "function"), EMF_META_NAME)
         yield UInt32(self, "size")
         try:
             parser = EMF_META[self["function"].value][2]
         except KeyError:
             parser = None
     else:
         yield UInt32(self, "size")
         yield Enum(UInt16(self, "function"), META_NAME)
         try:
             parser = META[self["function"].value][2]
         except KeyError:
             parser = None
     if parser:
         yield from parser(self)
     else:
         size = (self.size - self.current_size) // 8
         if size:
             yield RawBytes(self, "data", size)
Beispiel #4
0
 def createFields(self):
     yield PascalString32UTF16(self, "filename")
     yield Bytes(self, "property", 4)
     yield Bytes(self, "type", 4)
     type = self['type'].value
     if type == 'long':
         yield UInt32(self, "value")
     elif type == 'shor':
         yield NullBytes(self, "padding", 2)
         yield UInt16(self, "value")
     elif type == 'bool':
         yield UInt8(self, "value")
     elif type == 'blob':
         yield UInt32(self, "size")
         yield SubFile(self, "value", self['size'].value)
     elif type == 'type':
         yield Bytes(self, "value", 4)
     elif type == 'ustr':
         yield PascalString32UTF16(self, "value")
     else:
         raise ParserError("Unknown record type %s" % type)
Beispiel #5
0
 def createFields(self):
     yield Enum(UInt32(self, "type", "Segment type"),
                ProgramHeader32.TYPE_NAME)
     yield UInt32(self, "offset", "Offset")
     yield textHandler(UInt32(self, "vaddr", "V. address"), hexadecimal)
     yield textHandler(UInt32(self, "paddr", "P. address"), hexadecimal)
     yield UInt32(self, "file_size", "File size")
     yield UInt32(self, "mem_size", "Memory size")
     yield ProgramFlags(self, "flags")
     yield UInt32(self, "align", "Alignment padding")
Beispiel #6
0
    def createFields(self):
        yield String(self, "block_type", 4)
        if self.has_size:
            yield UInt32(self, "block_size")

        if self.parseBlock:
            yield from self.parseBlock()

        if self.has_size:
            size = self["block_size"].value - (self.current_size // 8)
            if size > 0:
                yield RawBytes(self, "data", size, "Unknown data")
Beispiel #7
0
 def createFields(self):
     yield filesizeHandler(
         UInt32(self, "filesize", "Uncompressed file size"))
     yield UInt32(self, "folder_offset",
                  "File offset in uncompressed folder")
     yield Enum(
         UInt16(self, "folder_index", "Containing folder ID (index)"), {
             0xFFFD:
             "Folder continued from previous cabinet (real folder ID = 0)",
             0xFFFE:
             "Folder continued to next cabinet (real folder ID = %i)" %
             (self["../nb_folder"].value - 1),
             0xFFFF:
             "Folder spanning previous, current and next cabinets (real folder ID = 0)"
         })
     yield DateTimeMSDOS32(self, "timestamp")
     yield CabFileAttributes(self, "attributes")
     if self["attributes/name_is_utf"].value:
         yield CString(self, "filename", charset="UTF-8")
     else:
         yield CString(self, "filename", charset="ASCII")
Beispiel #8
0
 def createFields(self):
     yield String(self, 'capture_pattern', 4, charset="ASCII")
     if self['capture_pattern'].value != self.MAGIC:
         self.warning(
             'Invalid signature. An Ogg page must start with "%s".' %
             self.MAGIC)
     yield UInt8(self, 'stream_structure_version')
     yield Bit(self, 'continued_packet')
     yield Bit(self, 'first_page')
     yield Bit(self, 'last_page')
     yield NullBits(self, 'unused', 5)
     yield UInt64(self, 'abs_granule_pos')
     yield textHandler(UInt32(self, 'serial'), hexadecimal)
     yield UInt32(self, 'page')
     yield textHandler(UInt32(self, 'checksum'), hexadecimal)
     yield UInt8(self, 'lacing_size')
     if self.lacing_size:
         yield Lacing(self, "lacing", size=self.lacing_size * 8)
         yield Segments(self,
                        "segments",
                        size=self._size - self._current_size)
Beispiel #9
0
 def createFields(self):
     yield GUID(self, "type")
     yield GUID(self, "error_correction")
     yield UInt64(self, "time_offset")
     yield UInt32(self, "data_len")
     yield UInt32(self, "error_correct_len")
     yield Bits(self, "stream_index", 7)
     yield Bits(self, "reserved[]", 8)
     yield Bit(self, "encrypted", "Content is encrypted?")
     yield UInt32(self, "reserved[]")
     size = self["data_len"].value
     if size:
         tag = self["type"].value
         if tag in Object.TAG_INFO:
             name, parser = Object.TAG_INFO[tag][0:2]
             yield parser(self, name, size=size * 8)
         else:
             yield RawBytes(self, "data", size)
     size = self["error_correct_len"].value
     if size:
         yield RawBytes(self, "error_correct", size)
Beispiel #10
0
 def createFields(self):
     yield UInt32(self, "size")
     self._size = (self['size'].value + 4) * 8
     yield RawBytes(self, "unknown[]", 10)
     yield textHandler(
         UInt16(self, "video_pid", "PID of video data in stream file"),
         hexadecimal)
     yield AVCHDMPLS_StreamAttribs(self, "video_attribs")
     yield textHandler(
         UInt16(self, "audio_pid", "PID of audio data in stream file"),
         hexadecimal)
     yield AVCHDMPLS_StreamAttribs(self, "audio_attribs")
Beispiel #11
0
 def createFields(self):
     yield GUID(self, "clsid", "16 bytes GUID used by some apps")
     yield UInt16(self, "ver_min", "Minor version")
     yield UInt16(self, "ver_maj", "Major version")
     yield Bytes(self, "endian", 2, "Endian (\\xfe\\xff for little endian)")
     yield UInt16(self, "bb_shift", "Log, base 2, of the big block size")
     yield UInt16(self, "sb_shift", "Log, base 2, of the small block size")
     yield NullBytes(self, "reserved[]", 6, "(reserved)")
     yield UInt32(
         self, "csectdir",
         "Number of SECTs in directory chain for 4 KB sectors (version 4)")
     yield UInt32(self, "bb_count", "Number of Big Block Depot blocks")
     yield SECT(self, "bb_start", "Root start block")
     yield NullBytes(self, "transaction", 4,
                     "Signature used for transactions (must be zero)")
     yield UInt32(self, "threshold",
                  "Maximum size for a mini stream (typically 4096 bytes)")
     yield SECT(self, "sb_start", "Small Block Depot start block")
     yield UInt32(self, "sb_count")
     yield SECT(self, "db_start", "First block of DIFAT")
     yield UInt32(self, "db_count", "Number of SECTs in DIFAT")
Beispiel #12
0
    def createFields(self):
        yield String(self, "tag", 4, "Chunk FourCC", charset="ASCII")
        yield UInt32(self, "size", "Chunk Size")
        yield UInt16(self, "version", "Chunk Version")

        if self.parse_func:
            for field in self.parse_func(self):
                yield field
        else:
            size = (self.size - self.current_size) // 8
            if size:
                yield RawBytes(self, "raw", size)
Beispiel #13
0
 def createFields(self):
     yield String(self, "type", 4, "Signature (FORM)", charset="ASCII")
     yield filesizeHandler(UInt32(self, "size"))
     size = self["size"].value
     if size:
         if self._parser:
             for field in self._parser(self):
                 yield field
             if size % 2:
                 yield NullBytes(self, "padding", 1)
         else:
             yield RawBytes(self, "data", size)
Beispiel #14
0
 def createFields(self):
     yield UInt32(self, "last_block")
     yield UInt32(self, "count")
     if self['last_block'].value != 0:
         for i in xrange(self['count'].value):
             block = UInt32(self, "child_block[]")
             yield block
             link = Link(self, "child_link[]")
             link.createValue = self.linkValue(block)
             yield link
             yield DSRecord(self, "record[]")
         link = Link(self, "child_link[]")
         link.createValue = self.linkValue(self['last_block'])
         yield link
     else:
         for i in xrange(self['count'].value):
             yield DSRecord(self, "record[]")
     if self.current_size < self.size:
         yield PaddingBytes(self,
                            "slack", (self.size - self.current_size) // 8,
                            description="slack space")
Beispiel #15
0
 def createFields(self):
     yield UInt32(self, "offset", "Offset to data (from file start)")
     yield UInt16(self, "data_blocks", "Number of data blocks which are in this cabinet")
     yield Enum(Bits(self, "compr_method", 4, "Compression method"), COMPRESSION_NAME)
     if self["compr_method"].value in [2, 3]:  # Quantum or LZX use compression level
         yield PaddingBits(self, "padding[]", 4)
         yield Bits(self, "compr_level", 5, "Compression level")
         yield PaddingBits(self, "padding[]", 3)
     else:
         yield PaddingBits(self, "padding[]", 12)
     if self["../flags/has_reserved"].value and self["../reserved_folder_size"].value:
         yield RawBytes(self, "reserved_folder", self["../reserved_folder_size"].value, "Per-folder reserved area")
Beispiel #16
0
    def createFields(self):
        yield UInt16(self, "wIdent", "Magic Number")
        yield UInt16(self, "nFib", "File Information Block (FIB) Version")
        yield UInt16(self, "nProduct", "Product Version")
        yield Enum(UInt16(self, "lid", "Language ID"), LANGUAGE_ID)
        yield Int16(self, "pnNext")

        yield Bit(self, "fDot", "Is the document a document template?")
        yield Bit(self, "fGlsy", "Is the document a glossary?")
        yield Bit(self, "fComplex", "Is the document in Complex format?")
        yield Bit(self, "fHasPic", "Does the document have embedded images?")
        yield Bits(self, "cQuickSaves", 4, "Number of times the document was quick-saved")
        yield Bit(self, "fEncrypted", "Is the document encrypted?")
        yield Bits(self, "fWhichTblStm", 1, "Which table stream (0Table or 1Table) to use")
        yield Bit(self, "fReadOnlyRecommended", "Should the file be opened read-only?")
        yield Bit(self, "fWriteReservation", "Is the file write-reserved?")
        yield Bit(self, "fExtChar", "Does the file use an extended character set?")
        yield Bit(self, "fLoadOverride")
        yield Bit(self, "fFarEast")
        yield Bit(self, "fCrypto")

        yield UInt16(self, "nFibBack", "Document is backwards compatible down to this FIB version")
        yield UInt32(self, "lKey", "File encryption key (only if fEncrypted)")
        yield Enum(UInt8(self, "envr", "Document creation environment"), {0: 'Word for Windows', 1: 'Macintosh Word'})

        yield Bit(self, "fMac", "Was this file last saved on a Mac?")
        yield Bit(self, "fEmptySpecial")
        yield Bit(self, "fLoadOverridePage")
        yield Bit(self, "fFutureSavedUndo")
        yield Bit(self, "fWord97Save")
        yield Bits(self, "fSpare0", 3)
        CHARSET = {0: 'Windows ANSI', 256: 'Macintosh'}
        yield Enum(UInt16(self, "chse", "Character set for document text"), CHARSET)
        yield Enum(UInt16(self, "chsTables", "Character set for internal table text"), CHARSET)
        yield UInt32(self, "fcMin", "File offset for the first character of text")
        yield UInt32(self, "fcMax", "File offset for the last character of text + 1")

        yield ShortArray(self, "array1", "Array of shorts")
        yield LongArray(self, "array2", "Array of longs")
        yield FCLCBArray(self, "array3", "Array of File Offset/Byte Count (FC/LCB) pairs")
Beispiel #17
0
    def createFields(self):
        yield Bytes(self, "magic", 8, "File magic (BOMStore)")
        yield UInt32(self, "version")  # ?
        yield UInt32(self, "num_objects")
        yield UInt32(self, "trailer_offset")
        yield UInt32(self, "trailer_size")
        yield UInt32(self, "header_offset")
        yield UInt32(self, "header_size")

        yield RawBytes(self, "object[]", 512 - 32, "Null object (size 0, offset 0)")

        self.seekByte(self['trailer_offset'].value)
        yield BomTrailer(self, "trailer")

        self.seekByte(self['header_offset'].value)
        yield RawBytes(self, "header", self['header_size'].value)

        for entry in self['trailer'].array('entry'):
            if entry['size'].value == 0:
                continue
            self.seekByte(entry['offset'].value)
            yield RawBytes(self, "object[]", entry['size'].value)

        for entry in self['trailer'].array('trail'):
            self.seekByte(entry['offset'].value)
            yield RawBytes(self, "trail[]", entry['size'].value)
Beispiel #18
0
 def createFields(self):
     yield UInt32(self, "1st_block", "Journal 1st block number")
     yield UInt32(self, "dev", "Journal device number")
     yield UInt32(self, "size", "Size of the journal")
     yield UInt32(self, "trans_max",
                  "Max number of blocks in a transaction")
     # TODO: Must be explained: it was sb_journal_block_count
     yield UInt32(self, "magic", "Random value made on fs creation.")
     yield UInt32(self, "max_batch",
                  "Max number of blocks to batch into a trans")
     yield UInt32(self, "max_commit_age",
                  "In seconds, how old can an async commit be")
     yield UInt32(self, "max_trans_age",
                  "In seconds, how old can a transaction be")
Beispiel #19
0
 def createFields(self):
     yield UInt16(self, "bytes_per_sector", "Size of a sector in bytes")
     yield UInt8(self, "sectors_per_cluster", "Size of a cluster in sectors")
     yield NullBytes(self, "reserved_sectors", 2)
     yield NullBytes(self, "fats", 1)
     yield NullBytes(self, "root_entries", 2)
     yield NullBytes(self, "sectors", 2)
     yield Enum(UInt8(self, "media_type"), self.MEDIA_TYPE)
     yield NullBytes(self, "sectors_per_fat", 2)
     yield UInt16(self, "sectors_per_track")
     yield UInt16(self, "heads")
     yield UInt32(self, "hidden_sectors")
     yield NullBytes(self, "large_sectors", 4)
Beispiel #20
0
    def createFields(self):
        if self.isEMF():
            yield EMF_Header(self, "emf_header")
        else:
            if self.isAPM():
                yield PlaceableHeader(self, "amf_header")
            yield Enum(UInt16(self, "file_type"), self.FILE_TYPE)
            yield UInt16(self, "header_size",
                         "Size of header in 16-bit words (always 9)")
            yield UInt8(self, "win_ver_min",
                        "Minor version of Microsoft Windows")
            yield UInt8(self, "win_ver_maj",
                        "Major version of Microsoft Windows")
            yield UInt32(self, "file_size",
                         "Total size of the metafile in 16-bit words")
            yield UInt16(self, "nb_obj", "Number of objects in the file")
            yield UInt32(self, "max_record_size",
                         "The size of largest record in 16-bit words")
            yield UInt16(self, "nb_params", "Not Used (always 0)")

        while not (self.eof):
            yield Function(self, "func[]")
Beispiel #21
0
    def createFields(self):
        yield String(self, "name", 8, charset="ASCII", strip="\0 ")
        yield filesizeHandler(UInt32(self, "mem_size", "Size in memory"))
        yield textHandler(UInt32(self, "rva", "RVA (location) in memory"), hexadecimal)
        yield filesizeHandler(UInt32(self, "phys_size", "Physical size (on disk)"))
        yield filesizeHandler(UInt32(self, "phys_off", "Physical location (on disk)"))
        yield PaddingBytes(self, "reserved", 12)

        # 0x0000000#
        yield NullBits(self, "reserved[]", 4)
        # 0x000000#0
        yield NullBits(self, "reserved[]", 1)
        yield Bit(self, "has_code", "Contains code")
        yield Bit(self, "has_init_data", "Contains initialized data")
        yield Bit(self, "has_uninit_data", "Contains uninitialized data")
        # 0x00000#00
        yield NullBits(self, "reserved[]", 1)
        yield Bit(self, "has_comment", "Contains comments?")
        yield NullBits(self, "reserved[]", 1)
        yield Bit(self, "remove", "Contents will not become part of image")
        # 0x0000#000
        yield Bit(self, "has_comdata", "Contains comdat?")
        yield NullBits(self, "reserved[]", 1)
        yield Bit(self, "no_defer_spec_exc", "Reset speculative exceptions handling bits in the TLB entries")
        yield Bit(self, "gp_rel", "Content can be accessed relative to GP")
        # 0x000#0000
        yield NullBits(self, "reserved[]", 4)
        # 0x00#00000
        yield NullBits(self, "reserved[]", 4)
        # 0x0#000000
        yield Bit(self, "ext_reloc", "Contains extended relocations?")
        yield Bit(self, "discarded", "Can be discarded?")
        yield Bit(self, "is_not_cached", "Is not cachable?")
        yield Bit(self, "is_not_paged", "Is not pageable?")
        # 0x#0000000
        yield Bit(self, "is_shareable", "Is shareable?")
        yield Bit(self, "is_executable", "Is executable?")
        yield Bit(self, "is_readable", "Is readable?")
        yield Bit(self, "is_writable", "Is writable?")
Beispiel #22
0
 def createFields(self):
     yield UInt32(self, "nblocks")
     yield UInt32(self, "unknown", description="Always 0")
     for i in xrange(self['nblocks'].value):
         yield BlockAddress(self, "block[]")
     padding = paddingSize(self['nblocks'].value, 256)
     if padding:
         yield NullBytes(
             self,
             "padding",
             padding * 4,
             description=
             "padding to make the number of blocks a multiple of 256")
     yield UInt32(self, "ndirs")
     for i in xrange(self['ndirs'].value):
         yield BudDirectory(self, "dir[]")
     for i in xrange(32):
         yield FreeList(self, "freelist[]")
     if self.current_size < self.size:
         yield PaddingBytes(self,
                            "slack", (self.size - self.current_size) // 8,
                            description="slack space")
Beispiel #23
0
 def createFields(self):
     yield UInt32(self, "width", "Width in pixel")
     yield UInt32(self, "height", "Height in pixel")
     yield UInt32(self, "offset", "Offset")
     offset = self["offset"].value
     if offset == 0:
         return
     data_offsets = []
     while (self.absolute_address + self.current_size) // 8 < offset:
         chunk = UInt32(self, "data_offset[]", "Data offset")
         yield chunk
         if chunk.value == 0:
             break
         data_offsets.append(chunk)
     if (self.absolute_address + self.current_size) // 8 != offset:
         raise ParserError("Problem with level offset.")
     previous = offset
     for chunk in data_offsets:
         data_offset = chunk.value
         size = data_offset - previous
         yield RawBytes(self, "data[]", size, "Data content of %s" % chunk.name)
         previous = data_offset
Beispiel #24
0
    def createFields(self):
        yield UInt32(self, "width", "Layer width in pixels")
        yield UInt32(self, "height", "Layer height in pixels")
        yield Enum(UInt32(self, "type", "Layer type"), XcfFile.IMAGE_TYPE_NAME)
        yield PascalString32(self,
                             "name",
                             "Layer name",
                             strip="\0",
                             charset="UTF-8")
        for prop in readProperties(self):
            yield prop

        # --
        # TODO: Hack for Gimp 1.2 files
        # --

        yield UInt32(self, "hierarchy_ofs", "Hierarchy offset")
        yield UInt32(self, "mask_ofs", "Layer mask offset")
        padding = self.seekByte(self["hierarchy_ofs"].value, relative=False)
        if padding is not None:
            yield padding
        yield XcfHierarchy(self, "hierarchy", "Hierarchy")
Beispiel #25
0
def specialHeader(s, is_file):
    yield filesizeHandler(
        UInt32(s, "compressed_size", "Compressed size (bytes)"))
    yield filesizeHandler(
        UInt32(s, "uncompressed_size", "Uncompressed size (bytes)"))
    yield Enum(UInt8(s, "host_os", "Operating system used for archiving"),
               OS_NAME)
    yield textHandler(UInt32(s, "crc32", "File CRC32"), hexadecimal)
    yield TimeDateMSDOS32(s, "ftime", "Date and time (MS DOS format)")
    yield textHandler(
        UInt8(s, "version", "RAR version needed to extract file"),
        formatRARVersion)
    yield Enum(UInt8(s, "method", "Packing method"), COMPRESSION_NAME)
    yield filesizeHandler(UInt16(s, "filename_length", "File name size"))
    if s["host_os"].value in (OS_MSDOS, OS_WIN32):
        yield MSDOSFileAttr32(s, "file_attr", "File attributes")
    else:
        yield textHandler(UInt32(s, "file_attr", "File attributes"),
                          hexadecimal)

    # Start additional field from unrar
    if s["flags/is_large"].value:
        yield filesizeHandler(
            UInt64(s, "large_size", "Extended 64bits filesize"))

    # End additional field
    size = s["filename_length"].value
    if size > 0:
        if s["flags/is_unicode"].value:
            charset = "UTF-8"
        else:
            charset = "ISO-8859-15"
        yield String(s, "filename", size, "Filename", charset=charset)
    # Start additional fields from unrar - file only
    if is_file:
        if s["flags/has_salt"].value:
            yield textHandler(UInt8(s, "salt", "Salt"), hexadecimal)
        if s["flags/has_ext_time"].value:
            yield ExtTime(s, "extra_time", "Extra time info")
Beispiel #26
0
 def createFields(self):
     yield UInt16(self, "magic_number", "Magic number")
     yield String(self,
                  "magic_string",
                  2,
                  r"Magic string \r\n",
                  charset="ASCII")
     yield TimestampUnix32(self, "timestamp", "Timestamp")
     version = self.getVersion()
     if version >= 0x3030000 and self['magic_number'].value >= 3200:
         yield UInt32(self, "filesize",
                      "Size of the Python source file (.py) modulo 2**32")
     yield Object(self, "content")
Beispiel #27
0
    def createFields(self):
        yield UInt8(self, "version", "Version (0 or 1)")
        yield NullBits(self, "flags", 20)
        yield Bit(self, "is_in_poster")
        yield Bit(self, "is_in_preview", "Is this track used when previewing the presentation?")
        yield Bit(self, "is_in_movie", "Is this track used in the presentation?")
        yield Bit(self, "is_enabled", "Is this track enabled?")

        if self['version'].value == 0:
            # 32-bit version
            yield TimestampMac32(self, "creation_date", "Creation time of this track")
            yield TimestampMac32(self, "lastmod_date", "Last modification time of this track")
            yield UInt32(self, "track_id", "Unique nonzero identifier of this track within the presentation")
            yield NullBytes(self, "reserved[]", 4)
            yield UInt32(self, "duration", "Length of track, in movie time-units")
        elif self['version'].value == 1:
            # 64-bit version
            yield TimestampMac64(self, "creation_date", "Creation time of this track")
            yield TimestampMac64(self, "lastmod_date", "Last modification time of this track")
            yield UInt32(self, "track_id", "Unique nonzero identifier of this track within the presentation")
            yield NullBytes(self, "reserved[]", 4)
            yield UInt64(self, "duration", "Length of track, in movie time-units")
        yield NullBytes(self, "reserved[]", 8)
        yield Int16(self, "video_layer", "Middle layer is 0; lower numbers are closer to the viewer")
        yield Int16(self, "alternate_group", "Group ID that this track belongs to (0=no group)")
        yield QTFloat16(self, "volume", "Track relative audio volume (1.0 = full)")
        yield NullBytes(self, "reserved[]", 2)
        yield QTFloat32(self, "geom_a", "Width scale")
        yield QTFloat32(self, "geom_b", "Width rotate")
        yield QTFloat2_30(self, "geom_u", "Width angle")
        yield QTFloat32(self, "geom_c", "Height rotate")
        yield QTFloat32(self, "geom_d", "Height scale")
        yield QTFloat2_30(self, "geom_v", "Height angle")
        yield QTFloat32(self, "geom_x", "Position X")
        yield QTFloat32(self, "geom_y", "Position Y")
        yield QTFloat2_30(self, "geom_w", "Divider scale")
        yield QTFloat32(self, "frame_size_width")
        yield QTFloat32(self, "frame_size_height")
Beispiel #28
0
 def createFields(self):
     yield Bytes(self, "signature", 4, r"RealAudio identifier ('.ra\xFD')")
     yield UInt16(self, "version", "Version")
     if self["version"].value == 3:
         yield UInt16(self, "header_size", "Header size")
         yield RawBytes(self, "Unknown1", 10)
         yield UInt32(self, "data_size", "Data size")
         yield Metadata(self, "metadata")
         yield UInt8(self, "Unknown2")
         yield PascalString8(self, "FourCC")
         audio_size = self["data_size"].value
     else:  # version = 4
         yield UInt16(self, "reserved1", "Reserved, should be 0")
         yield String(self, "ra4sig", 4, "'.ra4' signature")
         yield UInt32(self, "filesize", "File size (minus 40 bytes)")
         yield UInt16(self, "version2",
                      "Version 2 (always equal to version)")
         yield UInt32(self, "headersize", "Header size (minus 16)")
         yield UInt16(self, "codec_flavor", "Codec flavor")
         yield UInt32(self, "coded_frame_size", "Coded frame size")
         yield RawBytes(self, "unknown1", 12)
         yield UInt16(self, "subpacketh", "Subpacket h (?)")
         yield UInt16(self, "frame_size", "Frame size")
         yield UInt16(self, "sub_packet_size", "Subpacket size")
         yield UInt16(self, "unknown2", "Unknown")
         yield displayHandler(UInt16(self, "sample_rate", "Sample rate"),
                              humanFrequency)
         yield UInt16(self, "unknown3", "Unknown")
         yield UInt16(self, "sample_size", "Sample size")
         yield UInt16(self, "channels", "Channels")
         yield PascalString8(self, "Interleaving ID String")
         yield PascalString8(self, "FourCC")
         yield RawBytes(self, "unknown4", 3)
         yield Metadata(self, "metadata")
         audio_size = (self["filesize"].value +
                       40) - (self["headersize"].value + 16)
     if 0 < audio_size:
         yield RawBytes(self, "audio_data", audio_size)
Beispiel #29
0
def parseFileProperties(self):
    yield UInt32(self, "max_bit_rate", "Maximum bit rate")
    yield UInt32(self, "avg_bit_rate", "Average bit rate")
    yield UInt32(self, "max_pkt_size", "Size of largest data packet")
    yield UInt32(self, "avg_pkt_size", "Size of average data packet")
    yield UInt32(self, "num_pkts", "Number of data packets")
    yield UInt32(self, "duration", "File duration in milliseconds")
    yield UInt32(self, "preroll", "Suggested preroll in milliseconds")
    yield textHandler(
        UInt32(self, "index_offset", "Absolute offset of first index chunk"),
        hexadecimal)
    yield textHandler(
        UInt32(self, "data_offset", "Absolute offset of first data chunk"),
        hexadecimal)
    yield UInt16(self, "stream_count", "Number of streams in the file")
    yield RawBits(self, "reserved", 13)
    yield Bit(self, "is_live", "Whether file is a live broadcast")
    yield Bit(self, "is_perfect_play", "Whether PerfectPlay can be used")
    yield Bit(self, "is_saveable", "Whether file can be saved")
Beispiel #30
0
 def createFields(self):
     yield String(self,
                  "header_id",
                  4,
                  "DataSet Header Markup (\"mhsd\")",
                  charset="ISO-8859-1")
     yield UInt32(self, "header_length", "Header Length")
     yield UInt32(self, "entry_length", "Entry Length")
     yield Enum(UInt32(self, "type", "type"), self.type_name)
     padding = self.seekByte(self["header_length"].value, "header_raw")
     if padding:
         yield padding
     if self["type"].value == 1:
         yield TrackList(self, "tracklist[]")
     if self["type"].value == 2:
         yield PlaylistList(self, "playlist_list[]")
     if self["type"].value == 3:
         yield PlaylistList(self, "podcast_list[]")
     if self["type"].value == 4:
         yield AlbumList(self, "album_list[]")
     padding = self.seekBit(self._size, "entry padding")
     if padding:
         yield padding
Beispiel #31
0
 def __init__(self, parent, name):
     UInt32.__init__(self, parent, name)
Beispiel #32
0
 def createValue(self):
     return 1 == UInt32.createValue(self)