Example #1
0
 def __update_parents(self, fileobj, path, delta, offset):
     # Update all parent atoms with the new size.
     for atom in path:
         fileobj.seek(atom.offset + offset)
         size = cdata.uint_be(fileobj.read(4)) + delta
         fileobj.seek(atom.offset + offset)
         fileobj.write(cdata.to_uint_be(size))
Example #2
0
 def __update_parents(self, fileobj, path, delta, offset):
     # Update all parent atoms with the new size.
     for atom in path:
         fileobj.seek(atom.offset + offset)
         size = cdata.uint_be(fileobj.read(4)) + delta
         fileobj.seek(atom.offset + offset)
         fileobj.write(cdata.to_uint_be(size))
Example #3
0
 def __update_parents(self, fileobj, path, delta):
     """Update all parent atoms with the new size."""
     for atom in path:
         fileobj.seek(atom.offset)
         size = cdata.uint_be(fileobj.read(4))
         if size == 1: # 64bit
             # skip name (4B) and read size (8B)
             size = cdata.ulonglong_be(fileobj.read(12)[4:])
             fileobj.seek(atom.offset + 8)
             fileobj.write(cdata.to_ulonglong_be(size + delta))
         else: # 32bit
             fileobj.seek(atom.offset)
             fileobj.write(cdata.to_uint_be(size + delta))
Example #4
0
File: mp4.py Project: atis/foobnix
 def __update_parents(self, fileobj, path, delta):
     """Update all parent atoms with the new size."""
     for atom in path:
         fileobj.seek(atom.offset)
         size = cdata.uint_be(fileobj.read(4))
         if size == 1:  # 64bit
             # skip name (4B) and read size (8B)
             size = cdata.ulonglong_be(fileobj.read(12)[4:])
             fileobj.seek(atom.offset + 8)
             fileobj.write(cdata.to_ulonglong_be(size + delta))
         else:  # 32bit
             fileobj.seek(atom.offset)
             fileobj.write(cdata.to_uint_be(size + delta))