當前位置: 首頁>>代碼示例>>Python>>正文


Python OggPage.packets方法代碼示例

本文整理匯總了Python中mutagenx.ogg.OggPage.packets方法的典型用法代碼示例。如果您正苦於以下問題:Python OggPage.packets方法的具體用法?Python OggPage.packets怎麽用?Python OggPage.packets使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mutagenx.ogg.OggPage的用法示例。


在下文中一共展示了OggPage.packets方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_page_max_size

# 需要導入模塊: from mutagenx.ogg import OggPage [as 別名]
# 或者: from mutagenx.ogg.OggPage import packets [as 別名]
 def test_page_max_size(self):
     page = OggPage()
     page.packets = [b"1" * 255 * 255]
     page.complete = False
     page2 = OggPage()
     page2.packets = [b""]
     page2.sequence = 1
     page2.continued = True
     self.failUnlessEqual(
         [b"1" * 255 * 255], OggPage.to_packets([page, page2]))
開發者ID:badwtg1111,項目名稱:mutagen,代碼行數:12,代碼來源:test_ogg.py

示例2: test_read_max_size

# 需要導入模塊: from mutagenx.ogg import OggPage [as 別名]
# 或者: from mutagenx.ogg.OggPage import packets [as 別名]
 def test_read_max_size(self):
     page = OggPage()
     page.packets = [b"1" * 255 * 255]
     page.complete = False
     page2 = OggPage()
     page2.packets = [b"", b"foo"]
     page2.sequence = 1
     page2.continued = True
     data = page.write() + page2.write()
     fileobj = io.BytesIO(data)
     self.failUnlessEqual(OggPage(fileobj), page)
     self.failUnlessEqual(OggPage(fileobj), page2)
     self.failUnlessRaises(EOFError, OggPage, fileobj)
開發者ID:badwtg1111,項目名稱:mutagen,代碼行數:15,代碼來源:test_ogg.py

示例3: test_theora_bad_version

# 需要導入模塊: from mutagenx.ogg import OggPage [as 別名]
# 或者: from mutagenx.ogg.OggPage import packets [as 別名]
 def test_theora_bad_version(self):
     page = OggPage(open(self.filename, "rb"))
     packet = page.packets[0]
     packet = packet[:7] + b"\x03\x00" + packet[9:]
     page.packets = [packet]
     fileobj = io.BytesIO(page.write())
     self.failUnlessRaises(IOError, OggTheoraInfo, fileobj)
開發者ID:badwtg1111,項目名稱:mutagen,代碼行數:9,代碼來源:test_oggtheora.py

示例4: test_crc_py25

# 需要導入模塊: from mutagenx.ogg import OggPage [as 別名]
# 或者: from mutagenx.ogg.OggPage import packets [as 別名]
    def test_crc_py25(self):
        # Make sure page.write can handle both signed/unsigned int
        # return values of crc32.
        # http://code.google.com/p/mutagen/issues/detail?id=63
        # http://docs.python.org/library/zlib.html#zlib.crc32

        import zlib
        old_crc = zlib.crc32
        def zlib_uint(*args):
            return (old_crc(*args) & 0xffffffff)
        def zlib_int(*args):
            return cdata.int_be(cdata.to_uint_be(old_crc(*args) & 0xffffffff))

        try:
            page = OggPage()
            page.packets = [b"abc"]
            zlib.crc32 = zlib_uint
            uint_data = page.write()
            zlib.crc32 = zlib_int
            int_data  = page.write()
        finally:
            zlib.crc32 = old_crc

        self.failUnlessEqual(uint_data, int_data)
開發者ID:badwtg1111,項目名稱:mutagen,代碼行數:26,代碼來源:test_ogg.py

示例5: test_page_max_size_alone_too_big

# 需要導入模塊: from mutagenx.ogg import OggPage [as 別名]
# 或者: from mutagenx.ogg.OggPage import packets [as 別名]
 def test_page_max_size_alone_too_big(self):
     page = OggPage()
     page.packets = [b"1" * 255 * 255]
     page.complete = True
     self.failUnlessRaises(ValueError, page.write)
開發者ID:badwtg1111,項目名稱:mutagen,代碼行數:7,代碼來源:test_ogg.py


注:本文中的mutagenx.ogg.OggPage.packets方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。