How to use the hachoir.field.FieldSet.__init__ function in hachoir

To help you get started, we’ve selected a few hachoir examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vstinner / hachoir / hachoir / parser / audio / midi.py View on Github external
def __init__(self, *args):
        FieldSet.__init__(self, *args)
        self._size = (8 + self["size"].value) * 8
github vstinner / hachoir / hachoir / parser / program / exe_res.py View on Github external
def __init__(self, parent, name, res_type=None):
        FieldSet.__init__(self, parent, name)
        nb_entries = self["header/nb_name"].value + \
            self["header/nb_index"].value
        self._size = Header.static_size + nb_entries * 64
        self.res_type = res_type
github vstinner / hachoir / hachoir / parser / common / win32.py View on Github external
def __init__(self, *args):
        FieldSet.__init__(self, *args)
        self.version = self.stream.readBits(
            self.absolute_address + 32 + 16 + 12, 4, self.endian)
github vstinner / hachoir / hachoir / parser / video / mpeg_video.py View on Github external
def __init__(self, *args):
        FieldSet.__init__(self, *args)
        if not hasattr(self.root, 'streamgroups'):
            self.root.streamgroups = {}
            for tag in range(0xBC, 0x100):
                self.root.streamgroups[tag] = None
        tag = self["tag"].value
        if tag in self.tag_info:
            self._name, self.parser, self._description = self.tag_info[tag]
        elif 0xBC <= tag <= 0xFF:
            if 0xC0 <= tag < 0xE0:
                # audio
                streamid = tag - 0xC0
                self._name, self.parser, self._description = (
                    "audio[%i][]" % streamid, Stream, "Audio Stream %i Packet" % streamid)
            elif 0xE0 <= tag < 0xF0:
                # video
                streamid = tag - 0xE0
github vstinner / hachoir / hachoir / parser / file_system / ext2.py View on Github external
def __init__(self, parent, name):
        FieldSet.__init__(self, parent, name)
        self._group_count = None
github vstinner / hachoir / hachoir / parser / container / realmedia.py View on Github external
def __init__(self, *args):
        FieldSet.__init__(self, *args)
        self._size = self["size"].value * 8
github vstinner / hachoir / hachoir / parser / container / mkv.py View on Github external
def __init__(self, parent, ids):
        FieldSet.__init__(self, parent, "?[]")

        # Set name
        id = self['id'].value
        self.val = ids.get(id)
        if not self.val:
            if id == 0xBF:
                self.val = 'CRC-32[]', Binary
            elif id == 0xEC:
                self.val = 'Void[]', Binary
            elif id == 0x1B538667:
                self.val = 'SignatureSlot[]', signature
            else:
                self.val = 'Unknown[]', Binary
        self._name = self.val[0]

        # Compute size
github vstinner / hachoir / hachoir / parser / audio / id3.py View on Github external
def __init__(self, *args):
        FieldSet.__init__(self, *args)
        if 3 <= self["../ver_major"].value:
            self._size = (10 + self["size"].value) * 8
        else:
            self._size = (self["size"].value + 6) * 8
github vstinner / hachoir / hachoir / parser / misc / pifv.py View on Github external
def __init__(self, *args, **kw):
        FieldSet.__init__(self, *args, **kw)
        if not self._size:
            self._size = self["volume_len"].value * 8
github vstinner / hachoir / hachoir / parser / file_system / ext2.py View on Github external
def __init__(self, parent, name, index):
        FieldSet.__init__(self, parent, name, None)
        self.uniq_id = 1 + index