本文整理匯總了Python中mutagenx.ogg.OggPage.packets[0]方法的典型用法代碼示例。如果您正苦於以下問題:Python OggPage.packets[0]方法的具體用法?Python OggPage.packets[0]怎麽用?Python OggPage.packets[0]使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mutagenx.ogg.OggPage
的用法示例。
在下文中一共展示了OggPage.packets[0]方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_unsupported_version
# 需要導入模塊: from mutagenx.ogg import OggPage [as 別名]
# 或者: from mutagenx.ogg.OggPage import packets[0] [as 別名]
def test_unsupported_version(self):
page = OggPage(open(self.filename, "rb"))
data = bytearray(page.packets[0])
data[8] = 0x03
page.packets[0] = bytes(data)
OggOpusInfo(io.BytesIO(page.write()))
data[8] = 0x10
page.packets[0] = bytes(data)
self.failUnlessRaises(IOError, OggOpusInfo, io.BytesIO(page.write()))
示例2: test_negative_bitrate
# 需要導入模塊: from mutagenx.ogg import OggPage [as 別名]
# 或者: from mutagenx.ogg.OggPage import packets[0] [as 別名]
def test_negative_bitrate(self):
page = OggPage(open(self.filename, "rb"))
packet = page.packets[0]
packet = (packet[:16] + b"\xff\xff\xff\xff" + b"\xff\xff\xff\xff" +
b"\xff\xff\xff\xff" + packet[28:])
page.packets[0] = packet
info = OggVorbisInfo(io.BytesIO(page.write()))
self.failUnlessEqual(info.bitrate, 0)
示例3: test_underestimated_bitrate
# 需要導入模塊: from mutagenx.ogg import OggPage [as 別名]
# 或者: from mutagenx.ogg.OggPage import packets[0] [as 別名]
def test_underestimated_bitrate(self):
page = OggPage(open(self.filename, "rb"))
packet = page.packets[0]
packet = (packet[:16] + b"\x00\x00\x01\x00" + b"\x01\x00\x00\x00" +
b"\x00\x00\x01\x00" + packet[28:])
page.packets[0] = packet
info = OggVorbisInfo(io.BytesIO(page.write()))
self.failUnlessEqual(info.bitrate, 65536)