%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
# # The Python Imaging Library. # $Id$ # # MPEG file handling # # History: # 95-09-09 fl Created # # Copyright (c) Secret Labs AB 1997. # Copyright (c) Fredrik Lundh 1995. # # See the README file for information on usage and redistribution. # from . import Image, ImageFile from ._binary import i8 __version__ = "0.1" # # Bitstream parser class BitStream(object): def __init__(self, fp): self.fp = fp self.bits = 0 self.bitbuffer = 0 def next(self): return i8(self.fp.read(1)) def peek(self, bits): while self.bits < bits: c = self.next() if c < 0: self.bits = 0 continue self.bitbuffer = (self.bitbuffer << 8) + c self.bits += 8 return self.bitbuffer >> (self.bits - bits) & (1 << bits) - 1 def skip(self, bits): while self.bits < bits: self.bitbuffer = (self.bitbuffer << 8) + i8(self.fp.read(1)) self.bits += 8 self.bits = self.bits - bits def read(self, bits): v = self.peek(bits) self.bits = self.bits - bits return v ## # Image plugin for MPEG streams. This plugin can identify a stream, # but it cannot read it. class MpegImageFile(ImageFile.ImageFile): format = "MPEG" format_description = "MPEG" def _open(self): s = BitStream(self.fp) if s.read(32) != 0x1B3: raise SyntaxError("not an MPEG file") self.mode = "RGB" self.size = s.read(12), s.read(12) # -------------------------------------------------------------------- # Registry stuff Image.register_open(MpegImageFile.format, MpegImageFile) Image.register_extensions(MpegImageFile.format, [".mpg", ".mpeg"]) Image.register_mime(MpegImageFile.format, "video/mpeg")