本文整理汇总了Python中mutagen._util.cdata.ulonglong_be函数的典型用法代码示例。如果您正苦于以下问题:Python ulonglong_be函数的具体用法?Python ulonglong_be怎么用?Python ulonglong_be使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ulonglong_be函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_ulonglong
def test_ulonglong(self):
self.failUnlessEqual(cdata.ulonglong_le(self.ZERO(8)), 0)
self.failUnlessEqual(cdata.ulonglong_le(self.LEONE(8)), 1)
self.failUnlessEqual(cdata.longlong_le(self.BEONE(8)), 2 ** 64 >> 8)
self.failUnlessEqual(cdata.ulonglong_le(self.NEGONE(8)), 2 ** 64 - 1)
self.assertTrue(cdata.ulonglong_le is cdata.uint64_le)
self.failUnlessEqual(cdata.ulonglong_be(self.ZERO(8)), 0)
self.failUnlessEqual(cdata.ulonglong_be(self.LEONE(8)), 2 ** 64 >> 8)
self.failUnlessEqual(cdata.longlong_be(self.BEONE(8)), 1)
self.failUnlessEqual(cdata.ulonglong_be(self.NEGONE(8)), 2 ** 64 - 1)
self.assertTrue(cdata.ulonglong_be is cdata.uint64_be)
开发者ID:akerbis,项目名称:mutagen,代码行数:12,代码来源:test__util.py
示例2: __read_offsets
def __read_offsets(self, filename):
fileobj = open(filename, 'rb')
atoms = Atoms(fileobj)
moov = atoms['moov']
samples = []
for atom in moov.findall('stco', True):
fileobj.seek(atom.offset + 12)
data = fileobj.read(atom.length - 12)
fmt = ">%dI" % cdata.uint_be(data[:4])
offsets = struct.unpack(fmt, data[4:])
for offset in offsets:
fileobj.seek(offset)
samples.append(fileobj.read(8))
for atom in moov.findall('co64', True):
fileobj.seek(atom.offset + 12)
data = fileobj.read(atom.length - 12)
fmt = ">%dQ" % cdata.uint_be(data[:4])
offsets = struct.unpack(fmt, data[4:])
for offset in offsets:
fileobj.seek(offset)
samples.append(fileobj.read(8))
try:
for atom in atoms["moof"].findall('tfhd', True):
data = fileobj.read(atom.length - 9)
flags = cdata.uint_be("\x00" + data[:3])
if flags & 1:
offset = cdata.ulonglong_be(data[7:15])
fileobj.seek(offset)
samples.append(fileobj.read(8))
except KeyError:
pass
fileobj.close()
return samples
开发者ID:andrewboie,项目名称:discogstool,代码行数:33,代码来源:test_mp4.py
示例3: __update_tfhd
def __update_tfhd(self, fileobj, atom, delta, offset):
if atom.offset > offset:
atom.offset += delta
fileobj.seek(atom.offset + 9)
data = fileobj.read(atom.length - 9)
flags = cdata.uint_be(b"\x00" + data[:3])
if flags & 1:
o = cdata.ulonglong_be(data[7:15])
if o > offset:
o += delta
fileobj.seek(atom.offset + 16)
fileobj.write(cdata.to_ulonglong_be(o))
开发者ID:jbcurtin,项目名称:mutagen,代码行数:12,代码来源:__init__.py
示例4: __update_parents
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))
开发者ID:Sophist-UK,项目名称:mutagen,代码行数:13,代码来源:mp4.py
注:本文中的mutagen._util.cdata.ulonglong_be函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论