Exemplo n.º 1
0
 def load_unit(self, f):
   if self._data_unit_type == StatementBody.ID:
     return StatementBody(f, self)
   elif self._data_unit_type == DRCS1ByteCharacter.ID:
     # DRCS character data unit
     return DRCS1ByteCharacter(f, self)
   else:
     read.buffer(f, self._data_unit_size)
Exemplo n.º 2
0
  def __init__(self, f):
    if DEBUG:
      print("__DATA_GROUP_START__")

    self._stuffing_byte = read.ucb(f)
    if DEBUG:
      print hex(self._stuffing_byte)
    if(self._stuffing_byte is not 0x80):
      raise DataGroupParseError("Initial stuffing byte not equal to 0x80: " + hex(self._stuffing_byte))

    self._data_identifier = read.ucb(f)
    if DEBUG:
      print hex(self._data_identifier)
    if self._data_identifier is not 0xff:
      raise DataGroupParseError("Initial data identifier is not equal to 0xff" + hex(self._data_identifier))

    self._private_stream_id = read.ucb(f)
    if DEBUG:
     print hex(self._private_stream_id)
    if self._private_stream_id is not 0xf0:
      raise DataGroupParseError("Private stream id not equal to 0xf0: " + hex(self._private_stream_id))

    self._group_id = read.ucb(f)
    if DEBUG:
        print 'group id ' + str((self._group_id >> 2)&(~0x20))
    self._group_link_number = read.ucb(f)
    if DEBUG:
        print str(self._group_link_number)
    self._last_group_link_number = read.ucb(f)
    if DEBUG:
      print str(self._last_group_link_number)
    if self._group_link_number != self._last_group_link_number:
      print("This is data group packet " + str(self._group_link_number) + " of " + str(self._last_group_link_number))
    self._data_group_size = read.usb(f)
    if DEBUG:
      print 'data group size found is ' + str(self._data_group_size)

    if not self.is_management_data():
      self._payload = CaptionStatementData(f)
    else:
      #self._payload = f.read(self._data_group_size)
      self._payload = read.buffer(f, self._data_group_size)
    
    self._crc = read.usb(f)
    if DEBUG:
      print 'crc value is ' + str(self._crc)
Exemplo n.º 3
0
 def __init__(self, f):
   self._stuffing_byte = read.ucb(f)
   if DEBUG:
     print str(self._stuffing_byte)
   if(self._stuffing_byte is not 0x80):
     raise ValueError
   self._data_identifier = read.ucb(f)
   if DEBUG:
     print str(self._data_identifier)
   if self._data_identifier is not 0xff:
     raise ValueError
   self._private_stream_id = read.ucb(f)
   if DEBUG:
    print str(self._private_stream_id)
   if self._private_stream_id is not 0xf0:
     raise ValueError
   self._group_id = read.ucb(f)
   if DEBUG:
     print 'group id ' + str((self._group_id >> 2)&(~0x20))
   self._group_link_number = read.ucb(f)
   if DEBUG:
     print str(self._group_link_number)
   self._last_group_link_number = read.ucb(f)
   if DEBUG:
     print str(self._last_group_link_number)
   self._data_group_size = read.usb(f)
   if DEBUG:
     print 'data group size found is ' + str(self._data_group_size)
   if not self.is_management_data():
     self._payload = CaptionStatementData(f)
   else:
     #self._payload = f.read(self._data_group_size)
     self._payload = read.buffer(f, self._data_group_size)
   self._crc = read.usb(f)
   if DEBUG:
     print 'crc value is ' + str(self._crc)
Exemplo n.º 4
0
 def __init__(self, f):
     self._stuffing_byte = read.ucb(f)
     if DEBUG:
         print str(self._stuffing_byte)
     if (self._stuffing_byte is not 0x80):
         raise ValueError
     self._data_identifier = read.ucb(f)
     if DEBUG:
         print str(self._data_identifier)
     if self._data_identifier is not 0xff:
         raise ValueError
     self._private_stream_id = read.ucb(f)
     if DEBUG:
         print str(self._private_stream_id)
     if self._private_stream_id is not 0xf0:
         raise ValueError
     self._group_id = read.ucb(f)
     if DEBUG:
         print 'group id ' + str((self._group_id >> 2) & (~0x20))
     self._group_link_number = read.ucb(f)
     if DEBUG:
         print str(self._group_link_number)
     self._last_group_link_number = read.ucb(f)
     if DEBUG:
         print str(self._last_group_link_number)
     self._data_group_size = read.usb(f)
     if DEBUG:
         print 'data group size found is ' + str(self._data_group_size)
     if not self.is_management_data():
         self._payload = CaptionStatementData(f)
     else:
         #self._payload = f.read(self._data_group_size)
         self._payload = read.buffer(f, self._data_group_size)
     self._crc = read.usb(f)
     if DEBUG:
         print 'crc value is ' + str(self._crc)
Exemplo n.º 5
0
 def load_unit(self, f):
   if self._data_unit_type == StatementBody.ID:
     return StatementBody(f, self)
   else:
     read.buffer(f, self._data_unit_size)
Exemplo n.º 6
0
 def load_unit(self, f):
     if self._data_unit_type == StatementBody.ID:
         return StatementBody(f, self)
     else:
         read.buffer(f, self._data_unit_size)