Exemplo n.º 1
0
    def test_find_last_no_serial(self):
        pages = [OggPage() for i in range(10)]

        for i, page in enumerate(pages):
            page.sequence = i

        data = io.BytesIO(b"".join([page.write() for page in pages]))
        self.failUnless(OggPage.find_last(data, pages[0].serial + 1) is None)
Exemplo n.º 2
0
    def test_find_last_really_last(self):
        pages = [OggPage() for i in range(10)]
        pages[-1].last = True

        for i, page in enumerate(pages):
            page.sequence = i

        data = io.BytesIO(b"".join([page.write() for page in pages]))
        self.failUnlessEqual(
            OggPage.find_last(data, pages[0].serial), pages[-1])
Exemplo n.º 3
0
 def _post_tags(self, fileobj):
     if self.length:
         return
     page = OggPage.find_last(fileobj, self.serial)
     self.length = page.position / self.sample_rate
Exemplo n.º 4
0
 def _post_tags(self, fileobj):
     page = OggPage.find_last(fileobj, self.serial)
     self.length = page.position / self.sample_rate
Exemplo n.º 5
0
 def _post_tags(self, fileobj):
     page = OggPage.find_last(fileobj, self.serial)
     position = page.position
     mask = (1 << self.granule_shift) - 1
     frames = (position >> self.granule_shift) + (position & mask)
     self.length = frames / self.fps
Exemplo n.º 6
0
 def test_find_last_invalid_sync(self):
     data = io.BytesIO(b"if you think this is an OggS, you're crazy")
     page = OggPage.find_last(data, 0)
     self.failIf(page)
Exemplo n.º 7
0
 def _post_tags(self, fileobj):
     page = OggPage.find_last(fileobj, self.serial)
     self.length = page.position / float(self.sample_rate)
Exemplo n.º 8
0
 def _post_tags(self, fileobj):
     page = OggPage.find_last(fileobj, self.serial)
     position = page.position
     mask = (1 << self.granule_shift) - 1
     frames = (position >> self.granule_shift) + (position & mask)
     self.length = frames / float(self.fps)
Exemplo n.º 9
0
 def _post_tags(self, fileobj):
     page = OggPage.find_last(fileobj, self.serial)
     self.length = (page.position - self.__pre_skip) / 48000
Exemplo n.º 10
0
 def _post_tags(self, fileobj):
     page = OggPage.find_last(fileobj, self.serial)
     self.length = (page.position - self.__pre_skip) / 48000
Exemplo n.º 11
0
 def _post_tags(self, fileobj):
     if self.length:
         return
     page = OggPage.find_last(fileobj, self.serial)
     self.length = page.position / float(self.sample_rate)