예제 #1
0
 def createFields(self):
     if self.root.endian == BIG_ENDIAN:
         if self.root.is64bit:
             yield RawBits(self, "reserved[]", 32)
         yield RawBits(self, "processor_specific", 4,
                       "Processor specific flags")
         yield NullBits(self, "reserved[]", 17)
         yield Bit(self, "is_tls", "Section contains TLS data?")
         yield NullBits(self, "reserved[]", 7)
         yield Bit(self, "is_exec",
                   "Section contains executable instructions?")
         yield Bit(self, "is_alloc", "Section occupies memory?")
         yield Bit(self, "is_writable", "Section contains writable data?")
     else:
         yield Bit(self, "is_writable", "Section contains writable data?")
         yield Bit(self, "is_alloc", "Section occupies memory?")
         yield Bit(self, "is_exec",
                   "Section contains executable instructions?")
         yield NullBits(self, "reserved[]", 7)
         yield Bit(self, "is_tls", "Section contains TLS data?")
         yield RawBits(self, "processor_specific", 4,
                       "Processor specific flags")
         yield NullBits(self, "reserved[]", 17)
         if self.root.is64bit:
             yield RawBits(self, "reserved[]", 32)
예제 #2
0
def createRawField(parent, size, name="raw[]", description=None):
    if size <= 0:
        raise FieldError("Unable to create raw field of %s bits" % size)
    if (size % 8) == 0:
        return RawBytes(parent, name, size / 8, description)
    else:
        return RawBits(parent, name, size, description)
예제 #3
0
 def createFields(self):
     yield UInt16(self, "TriggerSize")
     yield UInt16(self, "Reserved[]")
     yield UInt16(self, "BeginYear")
     yield UInt16(self, "BeginMonth")
     yield UInt16(self, "BeginDay")
     yield UInt16(self, "EndYear")
     yield UInt16(self, "EndMonth")
     yield UInt16(self, "EndDay")
     yield UInt16(self, "StartHour")
     yield UInt16(self, "StartMinute")
     yield UInt32(self, "MinutesDuration")
     yield UInt32(self, "MinutesInterval",
                  "Time period between repeated trigger firings.")
     yield Bit(self, "HasEndDate", "Can task stop at some point in time?")
     yield Bit(self, "KillAtDurationEnd",
               "Can task be stopped at the end of the repetition period?")
     yield Bit(self, "TriggerDisabled", "Is this trigger disabled?")
     yield RawBits(self, "Unused[]", 29)
     yield Enum(UInt32(self, "TriggerType"), self.TRIGGER_TYPE)
     yield UInt16(self, "TriggerSpecific0")
     yield UInt16(self, "TriggerSpecific1")
     yield UInt16(self, "TriggerSpecific2")
     yield UInt16(self, "Padding")
     yield UInt16(self, "Reserved[]")
     yield UInt16(self, "Reserved[]")
예제 #4
0
    def createFields(self):
        yield UInt8(self, "length")

        yield Bit(self, "discontinuity_indicator")
        yield Bit(self, "random_access_indicator")
        yield Bit(self, "es_prio_indicator")
        yield Bit(self, "has_pcr")
        yield Bit(self, "has_opcr")
        yield Bit(self, "has_splice_point")
        yield Bit(self, "private_data")
        yield Bit(self, "has_extension")

        if self['has_pcr'].value:
            yield Bits(self, "pcr_base", 33)
            yield Bits(self, "pcr_ext", 9)

        if self['has_opcr'].value:
            yield Bits(self, "opcr_base", 33)
            yield Bits(self, "opcr_ext", 9)

        if self['has_splice_point'].value:
            yield Bits(self, "splice_countdown", 8)

        stuff_len = ((self['length'].value + 1) * 8) - self.current_size
        if self['length'].value and stuff_len:
            yield RawBits(self, 'stuffing', stuff_len)
예제 #5
0
 def createFields(self):
     yield Bits(self, "quantizer_scale", 5)
     start = self.absolute_address + self.current_size + 3
     pos = self.stream.searchBytes(
         '\0\0\1', start,
         start + 1024 * 1024 * 8)  # seek forward by at most 1MB
     if pos is None: pos = self.root.size
     yield RawBits(self, "data", pos - start + 3)
예제 #6
0
def parseSMPTEOffset(parser, size):
    yield RawBits(parser, "padding", 1)
    yield Enum(Bits(parser, "frame_rate", 2), {
        0: "24 fps",
        1: "25 fps",
        2: "30 fps (drop frame)",
        3: "30 fps"
    })
    yield Bits(parser, "hour", 5)
    yield UInt8(parser, "minute")
    yield UInt8(parser, "second")
    yield UInt8(parser, "frame")
    yield UInt8(parser, "subframe", "100 subframes per frame")
예제 #7
0
 def createFields(self):
     yield Enum(Bits(self, "ext_type", 4), self.EXT_TYPE)
     ext_type = self['ext_type'].value
     if ext_type == 1:
         # Sequence extension
         yield Bits(self, 'profile_and_level', 8)
         yield Bit(self, 'progressive_sequence')
         yield Bits(self, 'chroma_format', 2)
         yield Bits(self, 'horiz_size_ext', 2)
         yield Bits(self, 'vert_size_ext', 2)
         yield Bits(self, 'bit_rate_ext', 12)
         yield Bits(self, 'pad[]', 1)
         yield Bits(self, 'vbv_buffer_size_ext', 8)
         yield Bit(self, 'low_delay')
         yield Bits(self, 'frame_rate_ext_n', 2)
         yield Bits(self, 'frame_rate_ext_d', 5)
     elif ext_type == 2:
         # Sequence Display extension
         yield Bits(self, 'video_format', 3)
         yield Bit(self, 'color_desc_present')
         if self['color_desc_present'].value:
             yield UInt8(self, 'color_primaries')
             yield UInt8(self, 'transfer_characteristics')
             yield UInt8(self, 'matrix_coeffs')
         yield Bits(self, 'display_horiz_size', 14)
         yield Bits(self, 'pad[]', 1)
         yield Bits(self, 'display_vert_size', 14)
         yield NullBits(self, 'pad[]', 3)
     elif ext_type == 8:
         yield Bits(self,
                    'f_code[0][0]',
                    4,
                    description="forward horizontal")
         yield Bits(self, 'f_code[0][1]', 4, description="forward vertical")
         yield Bits(self,
                    'f_code[1][0]',
                    4,
                    description="backward horizontal")
         yield Bits(self,
                    'f_code[1][1]',
                    4,
                    description="backward vertical")
         yield Bits(self, 'intra_dc_precision', 2)
         yield Bits(self, 'picture_structure', 2)
         yield Bit(self, 'top_field_first')
         yield Bit(self, 'frame_pred_frame_dct')
         yield Bit(self, 'concealment_motion_vectors')
         yield Bit(self, 'q_scale_type')
         yield Bit(self, 'intra_vlc_format')
         yield Bit(self, 'alternate_scan')
         yield Bit(self, 'repeat_first_field')
         yield Bit(self, 'chroma_420_type')
         yield Bit(self, 'progressive_frame')
         yield Bit(self, 'composite_display')
         if self['composite_display'].value:
             yield Bit(self, 'v_axis')
             yield Bits(self, 'field_sequence', 3)
             yield Bit(self, 'sub_carrier')
             yield Bits(self, 'burst_amplitude', 7)
             yield Bits(self, 'sub_carrier_phase', 8)
             yield NullBits(self, 'pad[]', 2)
         else:
             yield NullBits(self, 'pad[]', 6)
     else:
         yield RawBits(self, "raw[]", 4)
예제 #8
0
 def __init__(self, parent, name):
     RawBits.__init__(self, parent, name, 8)
예제 #9
0
 def __init__(self, parent, name, description=None):
     RawBits.__init__(self, parent, name, 1, description=description)
예제 #10
0
 def __init__(self, parent, name):
     RawBits.__init__(self, parent, name, 8)
예제 #11
0
 def __init__(self, parent, name, description=None):
     RawBits.__init__(self, parent, name, 1, description=description)