Beispiel #1
0
 def _generate_tfdt(self, seg_info):
     if seg_info.start_time > 2**30:
         version = 1
         size = 20
     else:
         version = 0
         size = 16
     output = uint32_to_str(size) + 'tfdt'
     if version == 0:
         output += uint32_to_str(0x00000000) + uint32_to_str(
             seg_info.start_time)
     else:
         output += uint32_to_str(0x01000000) + uint64_to_str(
             seg_info.start_time)
     return output
 def process_tfdt(self, data, output):
     """Adjust time of tfdt if offset set."""
     version = ord(data[8])
     if version == 0: # 32-bit baseMediaDecodeTime
         tfdt = str_to_uint32(data[12:16])
         if self.offset != None:
             tfdt += self.offset
             output += data[:12] + uint32_to_str(tfdt) + data[16:]
         else:
             output += data
     else:
         output = data[:12]
         tfdt = str_to_uint64(data[12:20])
         if self.offset != None:
             tfdt += self.offset
             output += uint64_to_str(tfdt)
         else:
             output += data
     self.tfdt = tfdt
     return output
Beispiel #3
0
 def process_tfdt(self, data, output):
     """Adjust time of tfdt if offset set."""
     version = ord(data[8])
     if version == 0: # 32-bit baseMediaDecodeTime
         tfdt = str_to_uint32(data[12:16])
         if self.offset != None:
             tfdt += self.offset
             output += data[:12] + uint32_to_str(tfdt) + data[16:]
         else:
             output += data
     else:
         output = data[:12]
         tfdt = str_to_uint64(data[12:20])
         if self.offset != None:
             tfdt += self.offset
             output += uint64_to_str(tfdt)
         else:
             output += data
     self.tfdt = tfdt
     return output