Пример #1
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)
Пример #2
0
 def createFields(self):
     if self.stream.readBytes(self.absolute_address, 2) == "\xff\xff":
         yield Int16(
             self, "utf16_marker",
             "If this field is present, the Sttbf contains UTF-16 data."
         )
         self.is_utf16 = True
     else:
         self.is_utf16 = False
     yield UInt16(self, "count", "Number of strings in this Sttbf")
     extra_data_field = UInt16(
         self, "extra_data_len",
         "Size of optional extra data after each string")
     yield extra_data_field
     extra_data_len = extra_data_field.value
     for i in xrange(self["count"].value):
         if self.name == "SttbfAssoc":
             desc = self.SttbfAssocDESC.get(i, None)
         else:
             desc = None
         if self.name == "Sttbfffn":
             yield TableParsers.Ffn(self, "string[]", desc)
         elif self.is_utf16:
             yield WidePascalString16(self, "string[]", desc)
         else:
             yield PascalString8(self, "string[]", desc)
         if extra_data_len:
             yield RawBytes(self, "extra[]", extra_data_len)
Пример #3
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")
Пример #4
0
 def createFields(self):
     yield UInt8(self, "version")
     yield NullBits(self, "flags", 24)
     yield UInt32(self, "unknown")
     yield UInt8(self, "count", description="Number of chapters")
     for i in xrange(self['count'].value):
         yield UInt64(self, "chapter_start[]")
         yield PascalString8(self, "chapter_name[]", charset='UTF-8')
Пример #5
0
 def createFields(self):
     yield textHandler(UInt8(self, "version"), hexadecimal)
     yield RawBytes(self, "flags", 3)
     yield String(self, "subtype", 8)
     yield String(self, "manufacturer", 4)
     yield UInt32(self, "res_flags")
     yield UInt32(self, "res_flags_mask")
     if self.root.is_mpeg4:
         yield CString(self, "name")
     else:
         yield PascalString8(self, "name")
Пример #6
0
 def createFields(self):
     yield UInt8(self, "version", "Version")
     yield NullBits(self, "flags", 24)
     yield String(self, "creator", 4)
     yield String(self, "subtype", 4)
     yield String(self, "manufacturer", 4)
     yield UInt32(self, "res_flags")
     yield UInt32(self, "res_flags_mask")
     if self.root.is_mpeg4:
         yield CString(self, "name", charset="UTF-8")
     else:
         yield PascalString8(self, "name")
Пример #7
0
def parseApplicationExtension(parent):
    yield PascalString8(parent, "app_name", "Application name")
    yield UInt8(parent, "size")
    size = parent["size"].value
    if parent["app_name"].value == "NETSCAPE2.0" and size == 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)
    yield NullBytes(parent, "terminator", 1, "Terminator (0)")
Пример #8
0
def parseTextExtension(parent):
    yield UInt8(parent, "block_size", "Block Size")
    yield UInt16(self, "left", "Text Grid Left")
    yield UInt16(self, "top", "Text Grid Top")
    yield UInt16(self, "width", "Text Grid Width")
    yield UInt16(self, "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
Пример #9
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")
 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:
         yield self.handler(self, "content", size=size * 8)
     else:
         yield RawBytes(self, "content", size)
Пример #11
0
def parseComplex(parent):
    yield PascalString8(parent, "real")
    yield PascalString8(parent, "complex")
Пример #12
0
def parseFloat(parent):
    yield PascalString8(parent, "value")
Пример #13
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")
Пример #14
0
def parseComments(parent):
    while True:
        field = PascalString8(parent, "comment[]", strip=" \0\r\n\t")
        yield field
        if field.length == 0:
            break
Пример #15
0
 def createFields(self):
     yield RawBytes(self, "unknown[]", 10)
     yield AVCHDTimestamp(self, "date")
     yield RawBytes(self, "unknown[]", 1)
     yield PascalString8(self, "date")
Пример #16
0
 def createFields(self):
     yield PascalString8(self, "name", charset="MacRoman")
     yield UInt32(self, "block")