Esempio n. 1
0
 def createFields(self):
     yield UInt32(self, "size")
     self._size = (self['size'].value + 4) * 8
     yield RawBytes(self, "unknown[]", 10)
     yield AVCHDTimestamp(self, "last_modified")
     yield RawBytes(self, "unknown[]", 2)
     yield PascalString8(self, "date")
Esempio n. 2
0
def parseMediaPropertiesHeader(self):
    yield UInt16(self, "stream_number", "Stream number")
    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, "stream_start", "Stream start offset in milliseconds")
    yield UInt32(self, "preroll", "Preroll in milliseconds")
    yield UInt32(self, "duration", "Stream duration in milliseconds")
    yield PascalString8(self,
                        "desc",
                        "Stream description",
                        charset="ISO-8859-1")
    yield PascalString8(self, "mime_type", "MIME type string", charset="ASCII")
    yield UInt32(self, "specific_size", "Size of type-specific data")
    size = self['specific_size'].value
    if size:
        if self["mime_type"].value == "logical-fileinfo":
            yield LogicalFileInfo(self, "file_info", size=size * 8)
        else:
            yield RawBytes(self, "specific", size, "Type-specific data")
Esempio n. 3
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)
Esempio n. 4
0
def parseTextExtension(parent):
    yield UInt8(parent, "block_size", "Block Size")
    yield UInt16(parent, "left", "Text Grid Left")
    yield UInt16(parent, "top", "Text Grid Top")
    yield UInt16(parent, "width", "Text Grid Width")
    yield UInt16(parent, "height", "Text Grid Height")
    yield UInt8(parent, "cell_width", "Character Cell Width")
    yield UInt8(parent, "cell_height", "Character Cell Height")
    yield UInt8(parent, "fg_color", "Foreground Color Index")
    yield UInt8(parent, "bg_color", "Background Color Index")
    while True:
        field = PascalString8(parent, "comment[]", strip=" \0\r\n\t")
        yield field
        if field.length == 0:
            break
Esempio n. 5
0
def parseApplicationExtension(parent):
    yield PascalString8(parent, "app_name", "Application name")
    while True:
        size = UInt8(parent, "size[]")
        if size.value == 0:
            break
        yield size
        if parent["app_name"].value == "NETSCAPE2.0" and size.value == 3:
            yield Enum(UInt8(parent, "netscape_code"), NETSCAPE_CODE)
            if parent["netscape_code"].value == 1:
                yield UInt16(parent, "loop_count")
            else:
                yield RawBytes(parent, "raw[]", 2)
        else:
            yield RawBytes(parent, "raw[]", size.value)
    yield NullBytes(parent, "terminator", 1, "Terminator (0)")
Esempio n. 6
0
def markerHeader(self):
    yield String(self, "signature", 7, "Signature")
    yield UInt8(self, "ver_extract", "Version needed to extract archive")
    yield UInt8(self, "ver_created", "Version used to create archive")
    yield Enum(UInt8(self, "host_os", "OS where the files were compressed"),
               HOST_OS)
    yield UInt8(self, "vol_num", "Volume number")
    yield TimeDateMSDOS32(self, "time", "Date and time (MS DOS format)")
    yield Bits(self, "reserved", 64, "Reserved size for future extensions")
    flags = self["flags"]
    if flags["has_av_string"].value:
        yield PascalString8(self, "av_string", "AV String")
    if flags["has_comment"].value:
        size = filesizeHandler(UInt16(self, "comment_size", "Comment size"))
        yield size
        if size.value > 0:
            yield RawBytes(self, "compressed_comment", size.value, \
                           "Compressed comment")
Esempio n. 7
0
 def createFields(self):
     yield String(self, "signature", 4, "8BIM signature", charset="ASCII")
     if self["signature"].value != "8BIM":
         raise ParserError("Stream doesn't look like 8BIM item (wrong signature)!")
     yield textHandler(UInt16(self, "tag"), hexadecimal)
     if self.stream.readBytes(self.absolute_address + self.current_size, 4) != "\0\0\0\0":
         yield PascalString8(self, "name")
         size = 2 + (self["name"].size // 8) % 2
         yield NullBytes(self, "name_padding", size)
     else:
         yield String(self, "name", 4, strip="\0")
     yield UInt16(self, "size")
     size = alignValue(self["size"].value, 2)
     if not size:
         return
     if self.handler:
         if issubclass(self.handler, FieldSet):
             yield self.handler(self, "content", size=size * 8)
         else:
             yield self.handler(self, "content")
     else:
         yield RawBytes(self, "content", size)
Esempio n. 8
0
 def createFields(self):
     yield UInt32(self, "size")
     yield UInt16(self, "obj_version")
     yield PascalString8(self, "name", charset="ASCII")
     yield UInt32(self, "type")
     yield PascalString16(self, "value", charset="ISO-8859-1", strip=" \0")
Esempio n. 9
0
 def createFields(self):
     yield PascalString8(self, "title", charset="ISO-8859-1")
     yield PascalString8(self, "author", charset="ISO-8859-1")
     yield PascalString8(self, "copyright", charset="ISO-8859-1")
     yield PascalString8(self, "comment", charset="ISO-8859-1")
Esempio n. 10
0
 def createFields(self):
     yield RawBytes(self, "unknown[]", 10)
     yield AVCHDTimestamp(self, "date")
     yield RawBytes(self, "unknown[]", 1)
     yield PascalString8(self, "date")
Esempio n. 11
0
def parseComments(parent):
    while True:
        field = PascalString8(parent, "comment[]", strip=" \0\r\n\t")
        yield field
        if field.length == 0:
            break
Esempio n. 12
0
def parseComplex(parent):
    yield PascalString8(parent, "real")
    yield PascalString8(parent, "complex")
Esempio n. 13
0
def parseFloat(parent):
    yield PascalString8(parent, "value")
Esempio n. 14
0
 def createFields(self):
     yield PascalString8(self, "name", charset="MacRoman")
     yield UInt32(self, "block")