Exemplo n.º 1
0
Arquivo: io_jpeg.py Projeto: yoya/misc
 def parse(self, jpegdata):
      self._jpegdata = jpegdata
      reader = IO_Bit()
      reader.input(jpegdata)
      while reader.hasNextData(2):
          chunk = self._parseChunk(reader)
          self.chunks.append(chunk)
Exemplo n.º 2
0
 def parse(self, mididata):
     self._mididata = mididata
     reader = IO_Bit()
     reader.input(mididata)
     while reader.hasNextData(4):
         chunk = self._parseChunk(reader)
         if chunk['type'] == b'MThd':
             self.header = chunk
         elif chunk['type'] == b'MTrk':
             self.tracks.append(chunk)
         elif chunk['type'] == b'XFIH':
             self.xfinfo = chunk
         elif chunk['type'] == b'XFKM':
             self.xfkaraoke = chunk
         else:
             sys.stderr.write("Can't parse chunk.")
             break